mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
revert: "feat: improve predictive back (#1487)"
This reverts commit 06ff36c836
.
Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
parent
637641cf54
commit
7f26c5bd45
4 changed files with 27 additions and 38 deletions
|
@ -582,8 +582,8 @@ class ManagerAPI {
|
|||
return showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (context) => PopScope(
|
||||
canPop: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
title: I18nText('warning'),
|
||||
|
|
|
@ -15,8 +15,7 @@ class InstallerView extends StatelessWidget {
|
|||
return ViewModelBuilder<InstallerViewModel>.reactive(
|
||||
onViewModelReady: (model) => model.initialize(context),
|
||||
viewModelBuilder: () => InstallerViewModel(),
|
||||
builder: (context, model, child) => PopScope(
|
||||
onPopInvoked: (bool didPop) => model.onPopInvoked(context, didPop),
|
||||
builder: (context, model, child) => WillPopScope(
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: model.isPatching,
|
||||
|
@ -84,7 +83,7 @@ class InstallerView extends StatelessWidget {
|
|||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
onBackButtonPressed: () => model.onBackButtonInvoked(context),
|
||||
onBackButtonPressed: () => model.onWillPop(context),
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size(double.infinity, 1.0),
|
||||
child: GradientProgressIndicator(progress: model.progress),
|
||||
|
@ -112,6 +111,7 @@ class InstallerView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
onWillPop: () => model.onWillPop(context),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -489,28 +489,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
bool canPop() {
|
||||
return !isPatching;
|
||||
}
|
||||
|
||||
void onBackButtonInvoked(BuildContext context) {
|
||||
if (canPop()) {
|
||||
onPopInvoked(context, true);
|
||||
} else {
|
||||
onPopInvoked(context, false);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onPopInvoked(BuildContext context, bool didPop) async {
|
||||
if (didPop) {
|
||||
if (!cancel) {
|
||||
cleanPatcher();
|
||||
} else {
|
||||
_patcherAPI.cleanPatcher();
|
||||
}
|
||||
screenshotCallback.dispose();
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
Future<bool> onWillPop(BuildContext context) async {
|
||||
if (isPatching) {
|
||||
if (!cancel) {
|
||||
cancel = true;
|
||||
|
@ -520,7 +499,15 @@ class InstallerViewModel extends BaseViewModel {
|
|||
} else {
|
||||
_toast.showBottom('installerView.noExit');
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!cancel) {
|
||||
cleanPatcher();
|
||||
} else {
|
||||
_patcherAPI.cleanPatcher();
|
||||
}
|
||||
screenshotCallback.dispose();
|
||||
Navigator.of(context).pop();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,13 @@ class NavigationView extends StatelessWidget {
|
|||
return ViewModelBuilder<NavigationViewModel>.reactive(
|
||||
onViewModelReady: (model) => model.initialize(context),
|
||||
viewModelBuilder: () => locator<NavigationViewModel>(),
|
||||
builder: (context, model, child) => PopScope(
|
||||
canPop: model.currentIndex == 0,
|
||||
onPopInvoked: (bool didPop) {
|
||||
if (!didPop) {
|
||||
builder: (context, model, child) => WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (model.currentIndex == 0) {
|
||||
return true;
|
||||
} else {
|
||||
model.setIndex(0);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
|
|
Loading…
Reference in a new issue