From 4d13ca6c1d4d0e5e0f7ac6c64b37555a379f0ee0 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Sat, 12 Aug 2023 11:51:54 +0530 Subject: [PATCH] Use env variable to identify Github APKs --- .github/workflows/ci.yml | 4 ++-- lib/services/update_service.dart | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59a28dd5e..365b4dadc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: # Build independent apk. - name: Build - run: flutter build apk --release --flavor independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente-auth.apk + run: flutter build apk --release --flavor independent --dart-define=app.flavor=independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente-auth.apk env: SIGNING_KEY_PATH: "/home/runner/work/_temp/keystore/ente_auth_key.jks" SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} @@ -50,7 +50,7 @@ jobs: # Build Play store aab. - name: Build - run: flutter build appbundle --release --flavor playstore + run: flutter build appbundle --release --flavor playstore --dart-define=app.flavor=playstore env: SIGNING_KEY_PATH: "/home/runner/work/_temp/keystore/ente_auth_key.jks" SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} diff --git a/lib/services/update_service.dart b/lib/services/update_service.dart index 7d0fd3314..b0d338839 100644 --- a/lib/services/update_service.dart +++ b/lib/services/update_service.dart @@ -16,6 +16,7 @@ class UpdateService { static final UpdateService instance = UpdateService._privateConstructor(); static const kUpdateAvailableShownTimeKey = "update_available_shown_time_key"; + static const String flavor = String.fromEnvironment('app.flavor'); LatestVersionInfo? _latestVersion; final _logger = Logger("UpdateService"); @@ -105,10 +106,7 @@ class UpdateService { } bool isIndependent() { - if (Platform.isIOS) { - return false; - } - return kDebugMode || _packageInfo.packageName.endsWith("independent"); + return flavor == "independent" || _packageInfo.packageName.endsWith("independent"); } }