From 660268587e9f3b9e89571c2a4bc2682c4db77d3d Mon Sep 17 00:00:00 2001 From: Rahul Kumar Patel Date: Tue, 6 Apr 2021 22:32:33 +0530 Subject: [PATCH] Do not allow users to install bundled apps via native installer --- .../view/ui/details/AppDetailsActivity.kt | 31 ++++++++++--------- app/src/main/res/values/strings.xml | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt b/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt index 91cc6de6e..7f33e4044 100644 --- a/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt +++ b/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt @@ -279,21 +279,24 @@ class AppDetailsActivity : BaseDetailsActivity() { private fun install(files: List) { updateActionState(State.IDLE) - task { - AppInstaller(this) - .getPreferredInstaller() - .install( - app.packageName, - files - .filter { it.file.endsWith(".apk") } - .map { - it.file - }.toList() - ) - } + val apkFiles = files.filter { it.file.endsWith(".apk") } + val preferredInstaller = Preferences.getInteger(this, Preferences.PREFERENCE_INSTALLER_ID) - runOnUiThread { - B.layoutDetailsInstall.btnDownload.setText(getString(R.string.action_installing)) + if (apkFiles.size > 1 && preferredInstaller == 1) { + showDialog(R.string.title_installer, R.string.dialog_desc_native_split) + } else { + task { + AppInstaller(this) + .getPreferredInstaller() + .install( + app.packageName, + apkFiles.map { it.file } + ) + } + + runOnUiThread { + B.layoutDetailsInstall.btnDownload.setText(getString(R.string.action_installing)) + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e73e5e1af..c5e46f8e6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -233,6 +233,7 @@ "Optionally you can choose Native installer, but then you can not install bundled (split) APKs, so choice is yours." "New update available" "Do you wish to update now ?" + "You can not install bundled(split) apps via Native Installer. Change your installer to Session, Services or Root." "update available" "Quick notification" "General notification"