v1.5.0-hotfix: Fix app signing, add in-app update

This commit is contained in:
zarzet
2026-01-02 03:36:11 +07:00
parent d227d57545
commit 33e8ddd758
12 changed files with 487 additions and 55 deletions
+37 -1
View File
@@ -5,6 +5,13 @@ plugins {
id("dev.flutter.flutter-gradle-plugin")
}
// Load keystore properties from file if exists
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = java.util.Properties()
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(java.io.FileInputStream(keystorePropertiesFile))
}
android {
namespace = "com.zarz.spotiflac"
compileSdk = flutter.compileSdkVersion
@@ -22,6 +29,30 @@ android {
}
}
signingConfigs {
create("release") {
if (keystorePropertiesFile.exists()) {
storeFile = file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
} else if (System.getenv("KEYSTORE_BASE64") != null) {
// CI/CD: decode keystore from base64 environment variable
val keystoreFile = file("${project.buildDir}/keystore.jks")
if (!keystoreFile.exists()) {
keystoreFile.parentFile.mkdirs()
keystoreFile.writeBytes(
java.util.Base64.getDecoder().decode(System.getenv("KEYSTORE_BASE64"))
)
}
storeFile = keystoreFile
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}
}
defaultConfig {
applicationId = "com.zarz.spotiflac"
minSdk = flutter.minSdkVersion
@@ -39,7 +70,12 @@ android {
buildTypes {
release {
signingConfig = signingConfigs.getByName("debug")
// Use release signing config if available, otherwise fall back to debug
signingConfig = if (signingConfigs.findByName("release")?.storeFile != null) {
signingConfigs.getByName("release")
} else {
signingConfigs.getByName("debug")
}
// Enable code shrinking and resource shrinking
isMinifyEnabled = true
isShrinkResources = true
+12
View File
@@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application
android:label="SpotiFLAC"
@@ -76,6 +77,17 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<!-- FileProvider for APK installation -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
<queries>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-files-path name="external_files" path="." />
<cache-path name="cache" path="." />
<files-path name="files" path="." />
</paths>