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",
|
||||
"downloadToast": "Download function is not available yet",
|
||||
"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": {
|
||||
"viewTitle": "Select patches",
|
||||
|
@ -111,16 +111,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
model.getSuggestedVersion(
|
||||
app.packageName,
|
||||
),
|
||||
onTap: () {
|
||||
model.isRooted
|
||||
? model.selectApp(app).then(
|
||||
(_) => Navigator.of(context)
|
||||
.pop(),
|
||||
)
|
||||
: model.showSelectFromStorageDialog(
|
||||
context,
|
||||
);
|
||||
},
|
||||
onTap: () => model.canSelectInstalled(context, app.packageName),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
|
@ -65,6 +65,14 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
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 {
|
||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||
name: application.appName,
|
||||
@ -78,6 +86,22 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
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 {
|
||||
return showDialog(
|
||||
context: context,
|
||||
|
Loading…
Reference in New Issue
Block a user