fix: use correct version in update download dialog (#859)

This commit is contained in:
Hokora Yinphine 2023-05-10 03:23:02 -07:00 committed by GitHub
parent b803ce7435
commit 4150e2265c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,13 +39,10 @@ class HomeViewModel extends BaseViewModel {
bool showUpdatableApps = false; bool showUpdatableApps = false;
List<PatchedApplication> patchedInstalledApps = []; List<PatchedApplication> patchedInstalledApps = [];
List<PatchedApplication> patchedUpdatableApps = []; List<PatchedApplication> patchedUpdatableApps = [];
String _managerVersion = ''; String? _latestManagerVersion = '';
Future<void> initialize(BuildContext context) async { Future<void> initialize(BuildContext context) async {
_managerVersion = await AboutInfo.getInfo().then( _latestManagerVersion = await _managerAPI.getLatestManagerVersion();
(value) => value.keys.contains('version') ? value['version']! : '',
);
_managerVersion = await _managerAPI.getCurrentManagerVersion();
await flutterLocalNotificationsPlugin.initialize( await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings( const InitializationSettings(
android: AndroidInitializationSettings('ic_notification'), android: AndroidInitializationSettings('ic_notification'),
@ -115,7 +112,6 @@ class HomeViewModel extends BaseViewModel {
} }
Future<bool> hasManagerUpdates() async { Future<bool> hasManagerUpdates() async {
final String? latestVersion = await _managerAPI.getLatestManagerVersion();
String currentVersion = await _managerAPI.getCurrentManagerVersion(); String currentVersion = await _managerAPI.getCurrentManagerVersion();
// add v to current version // add v to current version
@ -123,7 +119,7 @@ class HomeViewModel extends BaseViewModel {
currentVersion = 'v$currentVersion'; currentVersion = 'v$currentVersion';
} }
if (latestVersion != currentVersion) { if (_latestManagerVersion != currentVersion) {
return true; return true;
} }
return false; return false;
@ -194,7 +190,7 @@ class HomeViewModel extends BaseViewModel {
), ),
const SizedBox(width: 8.0), const SizedBox(width: 8.0),
Text( Text(
'v$_managerVersion', 'v$_latestManagerVersion',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,