@@ -125,7 +125,7 @@ class InstallerViewModel extends BaseViewModel {
125
125
});
126
126
await WakelockPlus .enable ();
127
127
await handlePlatformChannelMethods ();
128
- await runPatcher (context );
128
+ await runPatcher ();
129
129
}
130
130
131
131
Future <dynamic > handlePlatformChannelMethods () async {
@@ -164,6 +164,16 @@ class InstallerViewModel extends BaseViewModel {
164
164
_managerAPI.setLastUsedPatchesVersion (
165
165
version: _managerAPI.patchesVersion,
166
166
);
167
+ _app.appliedPatches = _patches.map ((p) => p.name).toList ();
168
+ if (_managerAPI.isLastPatchedAppEnabled ()) {
169
+ await _managerAPI.setLastPatchedApp (_app, _patcherAPI.outFile! );
170
+ } else {
171
+ _app.patchedFilePath = _patcherAPI.outFile! .path;
172
+ }
173
+ final homeViewModel = locator <HomeViewModel >();
174
+ _managerAPI
175
+ .reAssessPatchedApps ()
176
+ .then ((_) => homeViewModel.getPatchedApps ());
167
177
} else if (value == - 100.0 ) {
168
178
isPatching = false ;
169
179
hasErrors = true ;
@@ -187,24 +197,14 @@ class InstallerViewModel extends BaseViewModel {
187
197
notifyListeners ();
188
198
}
189
199
190
- Future <void > runPatcher (BuildContext context ) async {
200
+ Future <void > runPatcher () async {
191
201
try {
192
202
await _patcherAPI.runPatcher (
193
203
_app.packageName,
194
204
_app.apkFilePath,
195
205
_patches,
196
206
_app.isFromStorage,
197
207
);
198
- _app.appliedPatches = _patches.map ((p) => p.name).toList ();
199
- if (_managerAPI.isLastPatchedAppEnabled ()) {
200
- await _managerAPI.setLastPatchedApp (_app, _patcherAPI.outFile! );
201
- } else {
202
- _app.patchedFilePath = _patcherAPI.outFile! .path;
203
- }
204
- final homeViewModel = locator <HomeViewModel >();
205
- _managerAPI
206
- .reAssessPatchedApps ()
207
- .then ((_) => homeViewModel.getPatchedApps ());
208
208
} on Exception catch (e) {
209
209
update (
210
210
- 100.0 ,
@@ -506,7 +506,7 @@ class InstallerViewModel extends BaseViewModel {
506
506
_app.isRooted = installAsRoot;
507
507
if (headerLogs != 'Installing...' ) {
508
508
update (
509
- . 85 ,
509
+ - 1.0 ,
510
510
'Installing...' ,
511
511
_app.isRooted ? 'Mounting patched app' : 'Installing patched app' ,
512
512
);
@@ -534,15 +534,15 @@ class InstallerViewModel extends BaseViewModel {
534
534
update (1.0 , 'Installed' , 'Installed' );
535
535
} else if (response == 3 ) {
536
536
update (
537
- . 85 ,
537
+ - 1.0 ,
538
538
'Installation canceled' ,
539
539
'Installation canceled' ,
540
540
);
541
541
} else if (response == 10 ) {
542
542
installResult (context, installAsRoot);
543
543
} else {
544
544
update (
545
- . 85 ,
545
+ - 1.0 ,
546
546
'Installation failed' ,
547
547
'Installation failed' ,
548
548
);
0 commit comments