mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 09:07:47 +01:00
feat: Add a confirmation dialog to update Manager button
This commit is contained in:
parent
351b04dd46
commit
80eeafaf2b
5 changed files with 40 additions and 13 deletions
|
@ -18,6 +18,8 @@
|
||||||
"noUpdates": "No updates available",
|
"noUpdates": "No updates available",
|
||||||
"noInstallations": "No patched applications installed",
|
"noInstallations": "No patched applications installed",
|
||||||
"installed": "Installed",
|
"installed": "Installed",
|
||||||
|
"updateDialogTitle": "Update",
|
||||||
|
"updateDialogText": "Are you sure you want to download and update Manager?",
|
||||||
"notificationTitle": "ReVanced Manager was updated!",
|
"notificationTitle": "ReVanced Manager was updated!",
|
||||||
"notificationText": "Tap to open the app",
|
"notificationText": "Tap to open the app",
|
||||||
"downloadingMessage": "Downloading update!",
|
"downloadingMessage": "Downloading update!",
|
||||||
|
@ -68,8 +70,8 @@
|
||||||
},
|
},
|
||||||
"patchItem": {
|
"patchItem": {
|
||||||
"unsupportedWarningButton": "Unsupported version",
|
"unsupportedWarningButton": "Unsupported version",
|
||||||
"alertDialogTitle": "Warning",
|
"unsupportedDialogTitle": "Warning",
|
||||||
"alertDialogText": "Selecting this patch may or may not result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
"unsupportedDialogText": "Selecting this patch may or may not result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
||||||
},
|
},
|
||||||
"installerView": {
|
"installerView": {
|
||||||
"widgetTitle": "Installer",
|
"widgetTitle": "Installer",
|
||||||
|
@ -113,9 +115,10 @@
|
||||||
"openButton": "Open",
|
"openButton": "Open",
|
||||||
"uninstallButton": "Uninstall",
|
"uninstallButton": "Uninstall",
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
"alertDialogTitle": "Uninstall",
|
"uninstallDialogTitle": "Uninstall",
|
||||||
"alertDialogText": "Are you sure you want to uninstall this app?",
|
"uninstallDialogText": "Are you sure you want to uninstall this app?",
|
||||||
"errorDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
"rootDialogTitle": "Error",
|
||||||
|
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
||||||
"packageNameLabel": "Package Name",
|
"packageNameLabel": "Package Name",
|
||||||
"installTypeLabel": "Installation Type",
|
"installTypeLabel": "Installation Type",
|
||||||
"rootTypeLabel": "Root",
|
"rootTypeLabel": "Root",
|
||||||
|
|
|
@ -47,7 +47,8 @@ class HomeView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
LatestCommitCard(
|
LatestCommitCard(
|
||||||
onPressed: () => model.updateManager(context),
|
onPressed: () =>
|
||||||
|
model.showUpdateConfirmationDialog(context),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 23),
|
const SizedBox(height: 23),
|
||||||
I18nText(
|
I18nText(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:app_installer/app_installer.dart';
|
import 'package:app_installer/app_installer.dart';
|
||||||
import 'package:device_apps/device_apps.dart';
|
import 'package:device_apps/device_apps.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
@ -14,6 +14,7 @@ import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
|
@ -147,4 +148,26 @@ class HomeViewModel extends BaseViewModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> showUpdateConfirmationDialog(BuildContext context) async {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: I18nText('homeView.updateDialogTitle'),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: I18nText('homeView.updateDialogText'),
|
||||||
|
actions: [
|
||||||
|
CustomMaterialButton(
|
||||||
|
isFilled: false,
|
||||||
|
label: I18nText('cancelButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () => updateManager(context),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ class AppInfoViewModel extends BaseViewModel {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('appInfoView.alertDialogTitle'),
|
title: I18nText('appInfoView.rootDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('appInfoView.errorDialogText'),
|
content: I18nText('appInfoView.rootDialogText'),
|
||||||
actions: [
|
actions: [
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
|
@ -60,9 +60,9 @@ class AppInfoViewModel extends BaseViewModel {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('appInfoView.alertDialogTitle'),
|
title: I18nText('appInfoView.uninstallDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('appInfoView.alertDialogText'),
|
content: I18nText('appInfoView.uninstallDialogText'),
|
||||||
actions: [
|
actions: [
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
|
|
|
@ -144,10 +144,10 @@ class _PatchItemState extends State<PatchItem> {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('patchItem.alertDialogTitle'),
|
title: I18nText('patchItem.unsupportedDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText(
|
content: I18nText(
|
||||||
'patchItem.alertDialogText',
|
'patchItem.unsupportedDialogText',
|
||||||
translationParams: {
|
translationParams: {
|
||||||
'packageVersion': widget.packageVersion,
|
'packageVersion': widget.packageVersion,
|
||||||
'supportedVersions':
|
'supportedVersions':
|
||||||
|
|
Loading…
Reference in a new issue