fix: Unable to install application regardless of preference

Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
validcube
2024-07-29 23:47:48 +07:00
parent 63c6412736
commit c7627ced8e
3 changed files with 9 additions and 87 deletions

View File

@ -495,7 +495,7 @@ class InstallerViewModel extends BaseViewModel {
Future<void> installResult(BuildContext context, bool installAsRoot) async {
isInstalling = true;
try {
_app.isRooted = await _managerAPI.installTypeDialog(context);
_app.isRooted = installAsRoot;
if (headerLogs != 'Installing...') {
update(
.85,
@ -512,7 +512,7 @@ class InstallerViewModel extends BaseViewModel {
// In case a patch changed the app name or package name,
// update the app info.
final app =
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
if (app != null) {
_app.name = app.appName;
_app.packageName = app.packageName;

View File

@ -1,5 +1,6 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:math';
import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@ -11,6 +12,7 @@ import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:stacked/stacked.dart';
@ -25,11 +27,7 @@ class AppInfoViewModel extends BaseViewModel {
BuildContext context,
PatchedApplication app,
) async {
app.isRooted = await _managerAPI.installTypeDialog(context);
final int statusCode = await _patcherAPI.installPatchedFile(context, app);
if (statusCode == 0) {
locator<HomeViewModel>().initialize(context);
}
locator<InstallerViewModel>().installTypeDialog(context);
}
Future<void> exportApp(
@ -152,7 +150,7 @@ class AppInfoViewModel extends BaseViewModel {
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: Text(t.appInfoView.removeAppDialogText),
actions: <Widget>[
OutlinedButton(
TextButton(
child: Text(t.cancelButton),
onPressed: () => Navigator.of(context).pop(),
),
@ -160,7 +158,9 @@ class AppInfoViewModel extends BaseViewModel {
child: Text(t.okButton),
onPressed: () => {
_managerAPI.deleteLastPatchedApp(),
Navigator.of(context)..pop()..pop(),
Navigator.of(context)
..pop()
..pop(),
locator<HomeViewModel>().initialize(context),
},
),