mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: allow selecting installed if app is full apk
This commit is contained in:
parent
359f052608
commit
8fc86dbe02
@ -78,7 +78,7 @@
|
|||||||
"errorMessage": "Unable to use selected application",
|
"errorMessage": "Unable to use selected application",
|
||||||
"downloadToast": "Download function is not available yet",
|
"downloadToast": "Download function is not available yet",
|
||||||
"featureNotAvailable": "Feature not implemented",
|
"featureNotAvailable": "Feature not implemented",
|
||||||
"featureNotAvailableText": "This feature has not been added yet for non-root. You'll need to select APK files from storage for now."
|
"featureNotAvailableText": "This application is a split APK and cannot be selected. Unfortunately, this feature is only available for rooted users at the moment. However, you can still install the application by selecting its APK files from your device's storage instead"
|
||||||
},
|
},
|
||||||
"patchesSelectorView": {
|
"patchesSelectorView": {
|
||||||
"viewTitle": "Select patches",
|
"viewTitle": "Select patches",
|
||||||
|
@ -111,16 +111,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
model.getSuggestedVersion(
|
model.getSuggestedVersion(
|
||||||
app.packageName,
|
app.packageName,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () => model.canSelectInstalled(context, app.packageName),
|
||||||
model.isRooted
|
|
||||||
? model.selectApp(app).then(
|
|
||||||
(_) => Navigator.of(context)
|
|
||||||
.pop(),
|
|
||||||
)
|
|
||||||
: model.showSelectFromStorageDialog(
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
@ -65,6 +65,14 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
return _patcherAPI.getSuggestedVersion(packageName);
|
return _patcherAPI.getSuggestedVersion(packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> checkSplitApk(String packageName) async {
|
||||||
|
final app = await DeviceApps.getApp(packageName);
|
||||||
|
if (app != null) {
|
||||||
|
return app.isSplit;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> selectApp(ApplicationWithIcon application) async {
|
Future<void> selectApp(ApplicationWithIcon application) async {
|
||||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||||
name: application.appName,
|
name: application.appName,
|
||||||
@ -78,6 +86,22 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
locator<PatcherViewModel>().loadLastSelectedPatches();
|
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> canSelectInstalled(
|
||||||
|
BuildContext context,
|
||||||
|
String packageName,
|
||||||
|
) async {
|
||||||
|
final app =
|
||||||
|
await DeviceApps.getApp(packageName, true) as ApplicationWithIcon?;
|
||||||
|
if (app != null) {
|
||||||
|
if (await checkSplitApk(packageName) && !isRooted) {
|
||||||
|
return showSelectFromStorageDialog(context);
|
||||||
|
} else if (!await checkSplitApk(packageName) || isRooted) {
|
||||||
|
selectApp(app);
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future showSelectFromStorageDialog(BuildContext context) async {
|
Future showSelectFromStorageDialog(BuildContext context) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
Loading…
Reference in New Issue
Block a user