From 9e9add1d96c0544a07ced7fb6f57445433faee00 Mon Sep 17 00:00:00 2001 From: Koen Date: Tue, 20 Jun 2023 14:48:43 +0200 Subject: [PATCH] Separate PlayStore version and normal version. --- receivers/android/.gitlab-ci.yml | 16 ++++ receivers/android/.idea/misc.xml | 3 +- receivers/android/app/build.gradle | 20 +++++ .../android/app/src/main/AndroidManifest.xml | 1 - .../com/futo/fcast/receiver/MainActivity.kt | 19 ++++- .../java/com/futo/fcast/receiver/Updater.kt | 13 ---- .../app/src/main/res/layout/activity_main.xml | 73 +++++++++++-------- 7 files changed, 94 insertions(+), 51 deletions(-) delete mode 100644 receivers/android/app/src/main/java/com/futo/fcast/receiver/Updater.kt diff --git a/receivers/android/.gitlab-ci.yml b/receivers/android/.gitlab-ci.yml index d57eded..536609a 100644 --- a/receivers/android/.gitlab-ci.yml +++ b/receivers/android/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - buildAndDeployApk + - buildAndDeployPlayStoreAab variables: ANDROID_VERSION_NAME: @@ -18,4 +19,19 @@ buildAndDeployApk: - ./gradlew --stacktrace assembleRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE - cp ./app/build/outputs/apk/release/app-release.apk /var/www/html/fcast-release.apk - cp ./app/build/outputs/apk/release/app-release.apk /var/www/html/fastcast-release.apk + - echo $ANDROID_VERSION_CODE > /var/www/html/fastcast-version.txt + - echo $ANDROID_VERSION_CODE > /var/www/html/fcast-version.txt + when: manual + +buildAndDeployPlayStoreAab: + stage: buildAndDeployPlayStoreAab + before_script: + - cd receivers/android + script: + - if [ -z "$ANDROID_VERSION_NAME" ] || [ -z "$ANDROID_VERSION_CODE" ]; then echo "Version name or code not specified. Skipping build."; exit 0; fi + - ./gradlew --stacktrace assemblePlaystoreRelease -PversionName=$ANDROID_VERSION_NAME -PversionCode=$ANDROID_VERSION_CODE + - cp ./app/build/outputs/apk/release/app-release.apk /var/www/html/fcast-release.apk + - cp ./app/build/outputs/apk/release/app-release.apk /var/www/html/fastcast-release.apk + - echo $ANDROID_VERSION_CODE > /var/www/html/fastcast-version.txt + - echo $ANDROID_VERSION_CODE > /var/www/html/fcast-version.txt when: manual diff --git a/receivers/android/.idea/misc.xml b/receivers/android/.idea/misc.xml index 9924903..2733308 100644 --- a/receivers/android/.idea/misc.xml +++ b/receivers/android/.idea/misc.xml @@ -1,7 +1,6 @@ - - + diff --git a/receivers/android/app/build.gradle b/receivers/android/app/build.gradle index 7dffc41..28e1614 100644 --- a/receivers/android/app/build.gradle +++ b/receivers/android/app/build.gradle @@ -32,6 +32,20 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + flavorDimensions "type" + productFlavors { + playstore { + dimension "type" + applicationIdSuffix ".playstore" + versionNameSuffix "-playstore" + buildConfigField "boolean", "IS_PLAYSTORE_VERSION", "true" + } + defaultFlavor { + dimension "type" + buildConfigField "boolean", "IS_PLAYSTORE_VERSION", "false" + } + } + signingConfigs { release { keyAlias keystoreProperties['keyAlias'] @@ -41,6 +55,12 @@ android { } } + sourceSets { + playstore { + manifest.srcFile 'src/playstore/AndroidManifest.xml' + } + } + buildTypes { release { signingConfig signingConfigs.release diff --git a/receivers/android/app/src/main/AndroidManifest.xml b/receivers/android/app/src/main/AndroidManifest.xml index 5aea0c8..a4c14f4 100644 --- a/receivers/android/app/src/main/AndroidManifest.xml +++ b/receivers/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ - - - + android:orientation="vertical" + android:gravity="center"> - + android:text="@string/there_is_an_update_available_do_you_wish_to_update" + android:textSize="14sp" + android:minLines="3" + android:textColor="@color/white" + android:fontFamily="@font/inter_regular" + android:layout_marginTop="30dp" + android:layout_marginStart="30dp" + android:layout_marginEnd="30dp" + android:gravity="center"/> - + + + android:background="@drawable/background_button_primary" + android:layout_marginEnd="28dp" + android:clickable="true"> + + + + \ No newline at end of file