Skip to content

Commit

Permalink
refactor: Disable update for dev build (#1662)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHalko committed Feb 2, 2024
1 parent edc8ef4 commit c900d09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class HomeViewModel extends BaseViewModel {
final Toast _toast = locator<Toast>();
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
bool showUpdatableApps = false;
bool releaseBuild = false;
List<PatchedApplication> patchedInstalledApps = [];
String _currentManagerVersion = '';
String _currentPatchesVersion = '';
Expand Down Expand Up @@ -127,6 +128,9 @@ class HomeViewModel extends BaseViewModel {
}

Future<bool> hasManagerUpdates() async {
if (!_managerAPI.releaseBuild) {
return false;
}
_latestManagerVersion =
await _managerAPI.getLatestManagerVersion() ?? _currentManagerVersion;

Expand Down

0 comments on commit c900d09

Please sign in to comment.