From 84a788fd9e72c9c3611427d191f5f44eb370adb6 Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Wed, 19 Oct 2022 16:32:54 +0530 Subject: [PATCH] feat: toast for disabled updates. --- assets/i18n/en_US.json | 3 ++- lib/ui/views/home/home_viewmodel.dart | 4 ++++ .../homeView/available_updates_card.dart | 19 ++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/assets/i18n/en_US.json b/assets/i18n/en_US.json index 111742e6..1d94a14e 100644 --- a/assets/i18n/en_US.json +++ b/assets/i18n/en_US.json @@ -26,7 +26,8 @@ "installingMessage": "Installing update...", "errorDownloadMessage": "Unable to download update", "errorInstallMessage": "Unable to install update", - "noConnection": "No internet connection" + "noConnection": "No internet connection", + "updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again." }, "applicationItem": { "patchButton": "Patch", diff --git a/lib/ui/views/home/home_viewmodel.dart b/lib/ui/views/home/home_viewmodel.dart index 363b19ee..508cc09a 100644 --- a/lib/ui/views/home/home_viewmodel.dart +++ b/lib/ui/views/home/home_viewmodel.dart @@ -143,6 +143,10 @@ class HomeViewModel extends BaseViewModel { } } + void updatesAreDisabled() { + _toast.show('homeView.updatesDisabled'); + } + Future showUpdateConfirmationDialog(BuildContext parentContext) async { return showDialog( context: parentContext, diff --git a/lib/ui/widgets/homeView/available_updates_card.dart b/lib/ui/widgets/homeView/available_updates_card.dart index 3756a4ed..dd4f560b 100644 --- a/lib/ui/widgets/homeView/available_updates_card.dart +++ b/lib/ui/widgets/homeView/available_updates_card.dart @@ -45,17 +45,14 @@ class AvailableUpdatesCard extends StatelessWidget { physics: const NeverScrollableScrollPhysics(), children: apps .map((app) => ApplicationItem( - icon: app.icon, - name: app.name, - patchDate: app.patchDate, - changelog: app.changelog, - isUpdatableApp: true, - //TODO: Find a better way to do update functionality - onPressed: () {} - // () => - // locator().navigateToPatcher( - // app, - // ), + icon: app.icon, + name: app.name, + patchDate: app.patchDate, + changelog: app.changelog, + isUpdatableApp: true, + //TODO: Find a better way to do update functionality + onPressed: () => + locator().updatesAreDisabled(), )) .toList(), );