feat(android): add flavor support

This commit is contained in:
Kingkor Roy Tirtho 2023-09-16 22:08:47 +06:00
parent ffe8d9ca6d
commit 5e12bbd72f
4 changed files with 27 additions and 9 deletions

View File

@ -235,10 +235,8 @@ jobs:
- name: Build Apk
run: |
flutter build apk
flutter build appbundle
mv build/app/outputs/apk/release/app-release.apk build/Spotube-android-all-arch.apk
mv build/app/outputs/bundle/release/app-release.aab build/Spotube-playstore-all-arch.aab
flutter build apk --flavor ${{ inputs.channel }}
mv build/app/outputs/apk/release/app-${{ inputs.channel }}-release.apk build/Spotube-android-all-arch.apk
- name: Build Playstore AppBundle
run: |
@ -247,8 +245,8 @@ jobs:
export MANIFEST=android/app/src/main/AndroidManifest.xml
xmlstarlet ed -d '//meta-data[@android:name="com.google.android.gms.car.application"]' $MANIFEST > $MANIFEST.tmp
mv $MANIFEST.tmp $MANIFEST
flutter build appbundle
mv build/app/outputs/bundle/release/app-release.aab build/Spotube-playstore-all-arch.aab
flutter build appbundle --flavor ${{ inputs.channel }}
mv build/app/outputs/bundle/release/app-${{ inputs.channel }}-release.aab build/Spotube-playstore-all-arch.aab
- name: Debug With SSH When fails
if: ${{ failure() && inputs.debug && inputs.channel == 'nightly' }}

6
.vscode/launch.json vendored
View File

@ -5,7 +5,11 @@
"name": "spotube",
"type": "dart",
"request": "launch",
"program": "lib/main.dart"
"program": "lib/main.dart",
"args": [
"--flavor",
"nightly"
]
},
{
"name": "spotube (profile)",

View File

@ -72,6 +72,22 @@ android {
signingConfig signingConfigs.release
}
}
flavorDimensions "default"
productFlavors {
nightly {
dimension "default"
resValue "string", "app_name", "Spotube Nightly"
applicationIdSuffix ".nightly"
versionNameSuffix "-nightly"
}
stable {
dimension "default"
resValue "string", "app_name", "Spotube"
}
}
}
flutter {
@ -92,4 +108,4 @@ dependencies {
// other deps so just ignore
implementation 'com.android.support:multidex:2.0.1'
}
}

View File

@ -18,7 +18,7 @@
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:label="Spotube"
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true"