From c900d09cf828bb3b1488868d24ed4505328d6423 Mon Sep 17 00:00:00 2001 From: Benjamin <73490201+BenjaminHalko@users.noreply.github.com> Date: Fri, 2 Feb 2024 06:12:10 -0800 Subject: [PATCH] refactor: Disable update for dev build (#1662) --- lib/services/manager_api.dart | 4 ++++ lib/ui/views/home/home_viewmodel.dart | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index 4b2af7fc..1044cbaa 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -36,6 +36,7 @@ class ManagerAPI { Patch? selectedPatch; BuildContext? ctx; bool isRooted = false; + bool releaseBuild = false; bool suggestedAppVersionSelected = true; bool isDynamicThemeAvailable = false; String storedPatchesFile = '/selected-patches.json'; @@ -68,6 +69,9 @@ class ManagerAPI { (await getSdkVersion()) >= 31; // ANDROID_12_SDK_VERSION = 31 storedPatchesFile = (await getApplicationDocumentsDirectory()).path + storedPatchesFile; + if (kReleaseMode) { + releaseBuild = !(await getCurrentManagerVersion()).contains('-dev'); + } // Migrate to new API URL if not done yet as the old one is sunset. final bool hasMigrated = _prefs.getBool('migratedToNewApiUrl') ?? false; diff --git a/lib/ui/views/home/home_viewmodel.dart b/lib/ui/views/home/home_viewmodel.dart index 5f1eabaf..a50a1c38 100644 --- a/lib/ui/views/home/home_viewmodel.dart +++ b/lib/ui/views/home/home_viewmodel.dart @@ -34,6 +34,7 @@ class HomeViewModel extends BaseViewModel { final Toast _toast = locator(); final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); bool showUpdatableApps = false; + bool releaseBuild = false; List patchedInstalledApps = []; String _currentManagerVersion = ''; String _currentPatchesVersion = ''; @@ -127,6 +128,9 @@ class HomeViewModel extends BaseViewModel { } Future hasManagerUpdates() async { + if (!_managerAPI.releaseBuild) { + return false; + } _latestManagerVersion = await _managerAPI.getLatestManagerVersion() ?? _currentManagerVersion;