Skip to content

Commit

Permalink
fix: fix broken manager update implmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aunali321 authored and PalmDevs committed Apr 30, 2023
1 parent d2e8e7d commit 15a32a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/ui/views/home/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class HomeView extends StatelessWidget {
Widget build(BuildContext context) {
return ViewModelBuilder<HomeViewModel>.reactive(
disposeViewModel: false,
fireOnViewModelReadyOnce: true,
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => locator<HomeViewModel>(),
builder: (context, model, child) => Scaffold(
Expand Down
8 changes: 7 additions & 1 deletion lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ class HomeViewModel extends BaseViewModel {

Future<bool> hasManagerUpdates() async {
final String? latestVersion = await _managerAPI.getLatestManagerVersion();
final String currentVersion = await _managerAPI.getCurrentManagerVersion();
String currentVersion = await _managerAPI.getCurrentManagerVersion();

// add v to current version
if (!currentVersion.startsWith('v')) {
currentVersion = 'v$currentVersion';
}

if (latestVersion != currentVersion) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/homeView/latest_commit_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
],
),
FutureBuilder<bool>(
future: locator<HomeViewModel>().hasManagerUpdates(),
future: model.hasManagerUpdates(),
initialData: false,
builder: (context, snapshot) => Opacity(
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
Expand Down

0 comments on commit 15a32a1

Please sign in to comment.