Allow runtime API/Web/WebSocket URLs via DataStore, plus a remember-login toggle that clears tokens when the app stops if it is off.
144 lines
5.8 KiB
Groovy
144 lines
5.8 KiB
Groovy
plugins {
|
|
id "com.android.application"
|
|
id "org.jetbrains.kotlin.android"
|
|
id "org.jetbrains.kotlin.plugin.compose"
|
|
}
|
|
|
|
def localProperties = new Properties()
|
|
def localPropertiesFile = rootProject.file("local.properties")
|
|
if (localPropertiesFile.exists()) {
|
|
localPropertiesFile.withInputStream { localProperties.load(it) }
|
|
}
|
|
|
|
def configValue = { String propertyName, String environmentName, String defaultValue ->
|
|
def localValue = localProperties.getProperty(propertyName)
|
|
if (localValue != null && !localValue.isBlank()) {
|
|
return localValue
|
|
}
|
|
def gradleValue = providers.gradleProperty(propertyName).orNull
|
|
if (gradleValue != null && !gradleValue.isBlank()) {
|
|
return gradleValue
|
|
}
|
|
def environmentValue = providers.environmentVariable(environmentName).orNull
|
|
if (environmentValue != null && !environmentValue.isBlank()) {
|
|
return environmentValue
|
|
}
|
|
return defaultValue
|
|
}
|
|
|
|
def umengPublicAppKey = configValue("multicaUmengPublicAppKey", "MULTICA_UMENG_PUBLIC_APP_KEY", "")
|
|
def postHogPublicApiKey = configValue("multicaPostHogPublicApiKey", "MULTICA_POSTHOG_PUBLIC_API_KEY", "")
|
|
def postHogPublicHost = configValue("multicaPostHogPublicHost", "MULTICA_POSTHOG_PUBLIC_HOST", "https://us.i.posthog.com")
|
|
def analyticsRoute = configValue("multicaAnalyticsRoute", "MULTICA_ANALYTICS_ROUTE", "auto")
|
|
def releaseStoreFilePath = configValue("multicaReleaseStoreFile", "MULTICA_RELEASE_STORE_FILE", "")
|
|
def releaseStorePassword = configValue("multicaReleaseStorePassword", "MULTICA_RELEASE_STORE_PASSWORD", "")
|
|
def releaseKeyAlias = configValue("multicaReleaseKeyAlias", "MULTICA_RELEASE_KEY_ALIAS", "")
|
|
def releaseKeyPassword = configValue("multicaReleaseKeyPassword", "MULTICA_RELEASE_KEY_PASSWORD", "")
|
|
def hasReleaseSigning = !releaseStoreFilePath.isBlank()
|
|
&& !releaseStorePassword.isBlank()
|
|
&& !releaseKeyAlias.isBlank()
|
|
&& !releaseKeyPassword.isBlank()
|
|
def releaseStoreFile = releaseStoreFilePath.isBlank()
|
|
? null
|
|
: (new File(releaseStoreFilePath).isAbsolute() ? file(releaseStoreFilePath) : rootProject.file(releaseStoreFilePath))
|
|
|
|
android {
|
|
namespace "ai.multica.app"
|
|
compileSdk 36
|
|
buildToolsVersion "36.1.0"
|
|
|
|
defaultConfig {
|
|
applicationId "ai.multicasual.app"
|
|
minSdk 24
|
|
targetSdk 36
|
|
versionCode 3
|
|
versionName "0.1.2"
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
buildFeatures {
|
|
compose true
|
|
buildConfig true
|
|
}
|
|
|
|
flavorDimensions "distribution"
|
|
|
|
signingConfigs {
|
|
release {
|
|
if (hasReleaseSigning) {
|
|
storeFile releaseStoreFile
|
|
storePassword releaseStorePassword
|
|
keyAlias releaseKeyAlias
|
|
keyPassword releaseKeyPassword
|
|
}
|
|
}
|
|
}
|
|
|
|
productFlavors {
|
|
create("public") {
|
|
dimension "distribution"
|
|
applicationId "ai.multicasual.app"
|
|
resValue "string", "app_name", "Multi-Casual"
|
|
manifestPlaceholders = [
|
|
usesCleartextTraffic: "true",
|
|
deepLinkScheme: "multi-casual",
|
|
umengDeepLinkScheme: "um.${umengPublicAppKey}"
|
|
]
|
|
buildConfigField "String", "MULTICA_ENVIRONMENT", "\"public\""
|
|
buildConfigField "String", "MULTICA_API_BASE_URL", "\"https://api.multica.ai\""
|
|
buildConfigField "String", "MULTICA_WEB_BASE_URL", "\"https://app.multica.ai\""
|
|
buildConfigField "String", "MULTICA_WS_BASE_URL", "\"wss://api.multica.ai\""
|
|
buildConfigField "String", "MULTICA_AUTH_PREFS_NAME", "\"multi_casual_auth\""
|
|
buildConfigField "String", "ANALYTICS_ROUTE", "\"${analyticsRoute}\""
|
|
buildConfigField "boolean", "UMENG_ENABLED", "true"
|
|
buildConfigField "String", "UMENG_APP_KEY", "\"${umengPublicAppKey}\""
|
|
buildConfigField "String", "UMENG_CHANNEL", "\"public\""
|
|
buildConfigField "boolean", "POSTHOG_ENABLED", "true"
|
|
buildConfigField "String", "POSTHOG_API_KEY", "\"${postHogPublicApiKey}\""
|
|
buildConfigField "String", "POSTHOG_HOST", "\"${postHogPublicHost}\""
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
if (hasReleaseSigning) {
|
|
signingConfig signingConfigs.release
|
|
}
|
|
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
publicImplementation "com.umeng.umsdk:common:9.9.2"
|
|
publicImplementation "com.umeng.umsdk:asms:1.8.7.2"
|
|
publicImplementation "com.posthog:posthog-android:3.47.0"
|
|
implementation "androidx.datastore:datastore-preferences:1.1.1"
|
|
implementation platform("androidx.compose:compose-bom:2024.10.01")
|
|
implementation "androidx.activity:activity-compose:1.9.3"
|
|
implementation "androidx.compose.foundation:foundation"
|
|
implementation "androidx.compose.material3:material3"
|
|
implementation "androidx.compose.material:material-icons-extended"
|
|
implementation "androidx.compose.ui:ui"
|
|
implementation "androidx.compose.ui:ui-tooling-preview"
|
|
implementation "io.github.alexzhirkevich:cupertino:0.1.0-alpha04"
|
|
implementation "dev.chrisbanes.haze:haze:1.6.10"
|
|
implementation "com.airbnb.android:lottie-compose:6.7.1"
|
|
implementation "io.coil-kt:coil-compose:2.7.0"
|
|
testImplementation "junit:junit:4.13.2"
|
|
testImplementation "org.json:json:20240303"
|
|
androidTestImplementation "androidx.test:runner:1.6.2"
|
|
androidTestImplementation "androidx.test.ext:junit:1.2.1"
|
|
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.3.0"
|
|
debugImplementation "androidx.compose.ui:ui-tooling"
|
|
}
|