mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
feat: Use simpler wording
This commit is contained in:
parent
3a88d4d3e6
commit
d8eadc2a2d
2 changed files with 50 additions and 51 deletions
|
@ -330,7 +330,7 @@ class MainActivity : FlutterActivity() {
|
||||||
val stack = ex.stackTraceToString()
|
val stack = ex.stackTraceToString()
|
||||||
updateProgress(
|
updateProgress(
|
||||||
-100.0,
|
-100.0,
|
||||||
"Aborted",
|
"Failed",
|
||||||
"An error occurred:\n$stack"
|
"An error occurred:\n$stack"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,28 +132,24 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
|
|
||||||
Future<void> runPatcher() async {
|
Future<void> runPatcher() async {
|
||||||
try {
|
try {
|
||||||
update(0.0, 'Initializing...', 'Initializing installer');
|
update(0.1, '', 'Creating working directory');
|
||||||
if (_patches.isNotEmpty) {
|
await _patcherAPI.runPatcher(
|
||||||
try {
|
_app.packageName,
|
||||||
update(0.1, '', 'Creating working directory');
|
_app.apkFilePath,
|
||||||
await _patcherAPI.runPatcher(
|
_patches,
|
||||||
_app.packageName,
|
);
|
||||||
_app.apkFilePath,
|
} on Exception catch (e) {
|
||||||
_patches,
|
update(
|
||||||
);
|
-100.0,
|
||||||
} on Exception catch (e) {
|
'Failed...',
|
||||||
update(
|
'Something went wrong:\n$e',
|
||||||
-100.0,
|
);
|
||||||
'Aborted...',
|
if (kDebugMode) {
|
||||||
'An error occurred! Aborted\nError:\n$e',
|
print(e);
|
||||||
);
|
|
||||||
if (kDebugMode) {
|
|
||||||
print(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
update(-100.0, 'Aborted...', 'No app or patches selected! Aborted');
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||||
try {
|
try {
|
||||||
FlutterBackground.disableBackgroundExecution();
|
FlutterBackground.disableBackgroundExecution();
|
||||||
|
@ -211,7 +207,8 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
),
|
),
|
||||||
RadioListTile(
|
RadioListTile(
|
||||||
title: I18nText('installerView.installNonRootType'),
|
title: I18nText('installerView.installNonRootType'),
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16),
|
||||||
value: 0,
|
value: 0,
|
||||||
groupValue: value,
|
groupValue: value,
|
||||||
onChanged: (selected) {
|
onChanged: (selected) {
|
||||||
|
@ -220,7 +217,8 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
),
|
),
|
||||||
RadioListTile(
|
RadioListTile(
|
||||||
title: I18nText('installerView.installRootType'),
|
title: I18nText('installerView.installRootType'),
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16),
|
||||||
value: 1,
|
value: 1,
|
||||||
groupValue: value,
|
groupValue: value,
|
||||||
onChanged: (selected) {
|
onChanged: (selected) {
|
||||||
|
@ -258,9 +256,9 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
Future<void> stopPatcher() async {
|
Future<void> stopPatcher() async {
|
||||||
try {
|
try {
|
||||||
isCanceled = true;
|
isCanceled = true;
|
||||||
update(0.5, 'Aborting...', 'Canceling patching process');
|
update(0.5, 'Canceling...', 'Canceling patching process');
|
||||||
await _patcherAPI.stopPatcher();
|
await _patcherAPI.stopPatcher();
|
||||||
update(-100.0, 'Aborted...', 'Press back to exit');
|
update(-100.0, 'Canceled...', 'Press back to exit');
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
print(e);
|
print(e);
|
||||||
|
@ -271,33 +269,34 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
Future<void> installResult(BuildContext context, bool installAsRoot) async {
|
Future<void> installResult(BuildContext context, bool installAsRoot) async {
|
||||||
try {
|
try {
|
||||||
_app.isRooted = installAsRoot;
|
_app.isRooted = installAsRoot;
|
||||||
update(
|
update(
|
||||||
1.0,
|
1.0,
|
||||||
'Installing...',
|
'Installing...',
|
||||||
_app.isRooted
|
_app.isRooted
|
||||||
? 'Installing patched file using root method'
|
? 'Installing patched file using root method'
|
||||||
: 'Installing patched file using nonroot method',
|
: 'Installing patched file using nonroot method',
|
||||||
);
|
);
|
||||||
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
||||||
if (isInstalled) {
|
if (isInstalled) {
|
||||||
_app.isFromStorage = false;
|
_app.isFromStorage = false;
|
||||||
_app.patchDate = DateTime.now();
|
_app.patchDate = DateTime.now();
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
|
|
||||||
// In case a patch changed the app name or package name,
|
// In case a patch changed the app name or package name,
|
||||||
// update the app info.
|
// update the app info.
|
||||||
final app = await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
|
final app =
|
||||||
if (app != null) {
|
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
|
||||||
_app.name = app.appName;
|
if (app != null) {
|
||||||
_app.packageName = app.packageName;
|
_app.name = app.appName;
|
||||||
}
|
_app.packageName = app.packageName;
|
||||||
|
|
||||||
await _managerAPI.savePatchedApp(_app);
|
|
||||||
|
|
||||||
update(1.0, 'Installed!', 'Installed!');
|
|
||||||
} else {
|
|
||||||
// TODO(aabed): Show error message.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _managerAPI.savePatchedApp(_app);
|
||||||
|
|
||||||
|
update(1.0, 'Installed!', 'Installed!');
|
||||||
|
} else {
|
||||||
|
// TODO(aabed): Show error message.
|
||||||
|
}
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
Loading…
Reference in a new issue