Skip to content

Commit c7627ce

Browse files
committed
fix: Unable to install application regardless of preference
Signed-off-by: validcube <[email protected]>
1 parent 63c6412 commit c7627ce

File tree

3 files changed

+9
-87
lines changed

3 files changed

+9
-87
lines changed

lib/services/manager_api.dart

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -832,82 +832,4 @@ class ManagerAPI {
832832
selectedPatchesFile.deleteSync();
833833
}
834834
}
835-
836-
Future<bool> installTypeDialog(BuildContext context) async {
837-
final ValueNotifier<int> installType = ValueNotifier(0);
838-
if (isRooted) {
839-
await showDialog(
840-
context: context,
841-
barrierDismissible: false,
842-
builder: (context) => AlertDialog(
843-
title: Text(t.installerView.installType),
844-
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
845-
icon: const Icon(Icons.file_download_outlined),
846-
contentPadding: const EdgeInsets.symmetric(vertical: 16),
847-
content: SingleChildScrollView(
848-
child: ValueListenableBuilder(
849-
valueListenable: installType,
850-
builder: (context, value, child) {
851-
return Column(
852-
mainAxisSize: MainAxisSize.min,
853-
crossAxisAlignment: CrossAxisAlignment.start,
854-
children: [
855-
Padding(
856-
padding: const EdgeInsets.symmetric(
857-
horizontal: 20,
858-
vertical: 10,
859-
),
860-
child: Text(
861-
t.installerView.installTypeDescription,
862-
style: TextStyle(
863-
fontSize: 16,
864-
fontWeight: FontWeight.w500,
865-
color: Theme.of(context).colorScheme.secondary,
866-
),
867-
),
868-
),
869-
RadioListTile(
870-
title: Text(t.installerView.installNonRootType),
871-
contentPadding:
872-
const EdgeInsets.symmetric(horizontal: 16),
873-
value: 0,
874-
groupValue: value,
875-
onChanged: (selected) {
876-
installType.value = selected!;
877-
},
878-
),
879-
RadioListTile(
880-
title: Text(t.installerView.installRootType),
881-
contentPadding:
882-
const EdgeInsets.symmetric(horizontal: 16),
883-
value: 1,
884-
groupValue: value,
885-
onChanged: (selected) {
886-
installType.value = selected!;
887-
},
888-
),
889-
],
890-
);
891-
},
892-
),
893-
),
894-
actions: [
895-
OutlinedButton(
896-
child: Text(t.cancelButton),
897-
onPressed: () {
898-
Navigator.of(context).pop();
899-
},
900-
),
901-
FilledButton(
902-
child: Text(t.installerView.installButton),
903-
onPressed: () {
904-
Navigator.of(context).pop();
905-
},
906-
),
907-
],
908-
),
909-
);
910-
}
911-
return false;
912-
}
913835
}

lib/ui/views/installer/installer_viewmodel.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class InstallerViewModel extends BaseViewModel {
495495
Future<void> installResult(BuildContext context, bool installAsRoot) async {
496496
isInstalling = true;
497497
try {
498-
_app.isRooted = await _managerAPI.installTypeDialog(context);
498+
_app.isRooted = installAsRoot;
499499
if (headerLogs != 'Installing...') {
500500
update(
501501
.85,
@@ -512,7 +512,7 @@ class InstallerViewModel extends BaseViewModel {
512512
// In case a patch changed the app name or package name,
513513
// update the app info.
514514
final app =
515-
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
515+
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
516516
if (app != null) {
517517
_app.name = app.appName;
518518
_app.packageName = app.packageName;

lib/ui/widgets/appInfoView/app_info_viewmodel.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ignore_for_file: use_build_context_synchronously
22
import 'dart:math';
3+
34
import 'package:device_apps/device_apps.dart';
45
import 'package:flutter/material.dart';
56
import 'package:intl/intl.dart';
@@ -11,6 +12,7 @@ import 'package:revanced_manager/services/patcher_api.dart';
1112
import 'package:revanced_manager/services/root_api.dart';
1213
import 'package:revanced_manager/services/toast.dart';
1314
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
15+
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
1416
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
1517
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
1618
import 'package:stacked/stacked.dart';
@@ -25,11 +27,7 @@ class AppInfoViewModel extends BaseViewModel {
2527
BuildContext context,
2628
PatchedApplication app,
2729
) async {
28-
app.isRooted = await _managerAPI.installTypeDialog(context);
29-
final int statusCode = await _patcherAPI.installPatchedFile(context, app);
30-
if (statusCode == 0) {
31-
locator<HomeViewModel>().initialize(context);
32-
}
30+
locator<InstallerViewModel>().installTypeDialog(context);
3331
}
3432

3533
Future<void> exportApp(
@@ -152,15 +150,17 @@ class AppInfoViewModel extends BaseViewModel {
152150
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
153151
content: Text(t.appInfoView.removeAppDialogText),
154152
actions: <Widget>[
155-
OutlinedButton(
153+
TextButton(
156154
child: Text(t.cancelButton),
157155
onPressed: () => Navigator.of(context).pop(),
158156
),
159157
FilledButton(
160158
child: Text(t.okButton),
161159
onPressed: () => {
162160
_managerAPI.deleteLastPatchedApp(),
163-
Navigator.of(context)..pop()..pop(),
161+
Navigator.of(context)
162+
..pop()
163+
..pop(),
164164
locator<HomeViewModel>().initialize(context),
165165
},
166166
),

0 commit comments

Comments
 (0)