Skip to content

Commit

Permalink
fix: Update the progress properly until installation finishes success…
Browse files Browse the repository at this point in the history
…fully
  • Loading branch information
oSumAtrIX committed Dec 23, 2023
1 parent 1928b15 commit 1298a96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class MainActivity : FlutterActivity() {
return@Thread
}

updateProgress(0.8, "Building...", "")
updateProgress(0.75, "Building...", "")

val res = patcher.get()
patcher.close()
Expand Down Expand Up @@ -399,7 +399,7 @@ class MainActivity : FlutterActivity() {
return@Thread
}

updateProgress(0.9, "Signing...", "Signing APK")
updateProgress(0.8, "Signing...", "Signing APK")

try {
Signer("ReVanced", keystorePassword)
Expand All @@ -409,7 +409,7 @@ class MainActivity : FlutterActivity() {
e.printStackTrace()
}

updateProgress(1.0, "Patched", "Patched")
updateProgress(.85, "Patched", "Patched")
} catch (ex: Throwable) {
if (!cancel) {
val stack = ex.stackTraceToString()
Expand Down
18 changes: 7 additions & 11 deletions lib/ui/views/installer/installer_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:revanced_manager/services/manager_api.dart';
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/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/utils/about_info.dart';
import 'package:screenshot_callback/screenshot_callback.dart';
Expand Down Expand Up @@ -103,7 +104,7 @@ class InstallerViewModel extends BaseViewModel {
isPatching = true;
isInstalled = false;
hasErrors = false;
} else if (value == 1.0) {
} else if (value == .85) {
isPatching = false;
hasErrors = false;
await _managerAPI.savePatches(
Expand All @@ -126,10 +127,10 @@ class InstallerViewModel extends BaseViewModel {
if (logs[logs.length - 1] == '\n') {
logs = logs.substring(0, logs.length - 1);
}
Future.delayed(const Duration(milliseconds: 500)).then((value) {
Future.delayed(const Duration(milliseconds: 100)).then((value) {
scrollController.animateTo(
scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 200),
duration: const Duration(milliseconds: 100),
curve: Curves.fastOutSlowIn,
);
});
Expand Down Expand Up @@ -455,7 +456,7 @@ class InstallerViewModel extends BaseViewModel {
_app.isRooted = installAsRoot;
if (headerLogs != 'Installing...') {
update(
1.0,
.85,
'Installing...',
_app.isRooted ? 'Mounting patched app' : 'Installing patched app',
);
Expand All @@ -482,20 +483,15 @@ class InstallerViewModel extends BaseViewModel {
update(1.0, 'Installed', 'Installed');
} else if (response == 3) {
update(
1.0,
.85,
'Installation canceled',
'Installation canceled',
);
} else if (response == 10) {
installResult(context, installAsRoot);
update(
1.0,
'',
'Starting installer',
);
} else {
update(
1.0,
.85,
'Installation failed',
'Installation failed',
);
Expand Down

0 comments on commit 1298a96

Please sign in to comment.