mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-14 04:34:18 +02:00
Add ProGuard rules and OSS build type
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
import java.io.FileInputStream
|
||||||
|
import java.io.FileNotFoundException
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
@@ -22,19 +26,86 @@ android {
|
|||||||
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_round"
|
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_round"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
create("release") {
|
||||||
|
val keystorePropertiesFile = rootProject.file("../../openScale.keystore")
|
||||||
|
val keystoreProperties = Properties()
|
||||||
|
var propertiesLoaded : Boolean
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileInputStream(keystorePropertiesFile).use { fis ->
|
||||||
|
keystoreProperties.load(fis)
|
||||||
|
}
|
||||||
|
propertiesLoaded = true
|
||||||
|
} catch (e: FileNotFoundException) {
|
||||||
|
project.logger.warn("Keystore properties file not found: ${keystorePropertiesFile.absolutePath}. Release signing might fail if not configured via environment variables.")
|
||||||
|
propertiesLoaded = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertiesLoaded && keystoreProperties.containsKey("releaseKeyStore")) {
|
||||||
|
storeFile = file(rootProject.projectDir.canonicalPath + "/" + keystoreProperties.getProperty("releaseKeyStore"))
|
||||||
|
keyAlias = keystoreProperties.getProperty("releaseKeyAlias")
|
||||||
|
keyPassword = keystoreProperties.getProperty("releaseKeyPassword")
|
||||||
|
storePassword = keystoreProperties.getProperty("releaseStorePassword")
|
||||||
|
} else {
|
||||||
|
project.logger.warn("Release signing information not fully loaded from properties. Ensure it's set via environment variables or the properties file is correct.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
create("oss") {
|
||||||
|
val keystoreOSSPropertiesFile = rootProject.file("../../openScale_oss.keystore")
|
||||||
|
val keystoreOSSProperties = Properties()
|
||||||
|
var propertiesLoaded : Boolean
|
||||||
|
|
||||||
|
try {
|
||||||
|
FileInputStream(keystoreOSSPropertiesFile).use { fis ->
|
||||||
|
keystoreOSSProperties.load(fis)
|
||||||
|
}
|
||||||
|
propertiesLoaded = true
|
||||||
|
} catch (e: FileNotFoundException) {
|
||||||
|
project.logger.warn("OSS Keystore properties file not found: ${keystoreOSSPropertiesFile.absolutePath}. OSS signing might fail if not configured via environment variables.")
|
||||||
|
propertiesLoaded = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertiesLoaded && keystoreOSSProperties.containsKey("releaseKeyStore")) {
|
||||||
|
storeFile = file(rootProject.projectDir.canonicalPath + "/" + keystoreOSSProperties.getProperty("releaseKeyStore"))
|
||||||
|
keyAlias = keystoreOSSProperties.getProperty("releaseKeyAlias")
|
||||||
|
keyPassword = keystoreOSSProperties.getProperty("releaseKeyPassword")
|
||||||
|
storePassword = keystoreOSSProperties.getProperty("releaseStorePassword")
|
||||||
|
} else {
|
||||||
|
project.logger.warn("OSS signing information not fully loaded from properties. Ensure it's set via environment variables or the properties file is correct.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = false
|
signingConfig = signingConfigs.getByName("release")
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
create("beta") {
|
create("beta") {
|
||||||
initWith(getByName("debug"))
|
initWith(getByName("release"))
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
applicationIdSuffix = ".beta"
|
applicationIdSuffix = ".beta"
|
||||||
versionNameSuffix = "-beta"
|
versionNameSuffix = "-beta"
|
||||||
manifestPlaceholders["appName"] = "openScale beta"
|
manifestPlaceholders["appName"] = "openScale beta"
|
||||||
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_beta"
|
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_beta"
|
||||||
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_beta_round"
|
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_beta_round"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create("oss") {
|
||||||
|
initWith(getByName("release"))
|
||||||
|
signingConfig = signingConfigs.getByName("oss")
|
||||||
|
applicationIdSuffix = ".oss"
|
||||||
|
versionNameSuffix = "-oss"
|
||||||
|
manifestPlaceholders["appName"] = "openScale"
|
||||||
|
manifestPlaceholders["appIcon"] = "@mipmap/ic_launcher_beta"
|
||||||
|
manifestPlaceholders["appRoundIcon"] = "@mipmap/ic_launcher_beta_round"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationVariants.all {
|
applicationVariants.all {
|
||||||
|
26
android_app/app/proguard-rules.pro
vendored
Normal file
26
android_app/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
|
-keepclassmembernames class io.netty.** { *; }
|
||||||
|
-keepclassmembers class org.jctools.** { *; }
|
||||||
|
-keep class * { *; }
|
||||||
|
-keep interface * { *; }
|
||||||
|
-keep enum * { *; }
|
@@ -236,7 +236,7 @@ fun AppNavigation(sharedViewModel: SharedViewModel) {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = if (BuildConfig.BUILD_TYPE == "beta") painterResource(id = R.drawable.ic_launcher_beta_foreground) else painterResource(id = R.drawable.ic_launcher_foreground) ,
|
painter = if (BuildConfig.BUILD_TYPE == "beta" || BuildConfig.BUILD_TYPE == "oss") painterResource(id = R.drawable.ic_launcher_beta_foreground) else painterResource(id = R.drawable.ic_launcher_foreground) ,
|
||||||
contentDescription = stringResource(R.string.app_logo_content_description),
|
contentDescription = stringResource(R.string.app_logo_content_description),
|
||||||
modifier = Modifier.size(64.dp)
|
modifier = Modifier.size(64.dp)
|
||||||
)
|
)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.health.openscale.ui.screen.settings
|
package com.health.openscale.ui.screen.settings
|
||||||
|
|
||||||
|
import android.R.attr.contentDescription
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -91,7 +92,7 @@ fun AboutScreen(
|
|||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = if (BuildConfig.BUILD_TYPE == "beta") painterResource(id = R.drawable.ic_launcher_beta_foreground) else painterResource(id = R.drawable.ic_launcher_foreground) ,
|
painter = if (BuildConfig.BUILD_TYPE == "beta" || BuildConfig.BUILD_TYPE == "oss") painterResource(id = R.drawable.ic_launcher_beta_foreground) else painterResource(id = R.drawable.ic_launcher_foreground) ,
|
||||||
contentDescription = stringResource(R.string.app_logo_content_description),
|
contentDescription = stringResource(R.string.app_logo_content_description),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(128.dp)
|
.size(128.dp)
|
||||||
|
Reference in New Issue
Block a user