mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 13:08:59 -04:00
Uninstaller : Ask user first before uninstalling an app via root
https://gitlab.com/AuroraOSS/AuroraStore/issues/238
This commit is contained in:
@@ -12,9 +12,11 @@ import android.os.RemoteException;
|
||||
import com.aurora.services.IPrivilegedCallback;
|
||||
import com.aurora.services.IPrivilegedService;
|
||||
import com.aurora.store.Constants;
|
||||
import com.aurora.store.R;
|
||||
import com.aurora.store.model.App;
|
||||
import com.aurora.store.util.Log;
|
||||
import com.aurora.store.util.PrefUtil;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
public class Uninstaller {
|
||||
|
||||
@@ -32,7 +34,7 @@ public class Uninstaller {
|
||||
uninstallByPackageManager(app);
|
||||
break;
|
||||
case "1":
|
||||
uninstallByRoot(app);
|
||||
askUninstall(app);
|
||||
break;
|
||||
default:
|
||||
uninstallByPackageManager(app);
|
||||
@@ -86,4 +88,18 @@ public class Uninstaller {
|
||||
new AppUninstallerRooted().uninstall(app);
|
||||
}
|
||||
|
||||
private void askUninstall(App app) {
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(context)
|
||||
.setTitle(app.getDisplayName())
|
||||
.setMessage(context.getString(R.string.dialog_uninstall_confirmation))
|
||||
.setPositiveButton(context.getString(android.R.string.ok), (dialog, which) -> {
|
||||
uninstallByRoot(app);
|
||||
})
|
||||
.setNegativeButton(context.getString(android.R.string.cancel), (dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
builder.create();
|
||||
builder.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
<string name="details_why_rate_this_app">"Tell others what you think"</string>
|
||||
<string name="details_you_rated_this_app">"Your rating"</string>
|
||||
<string name="dialog_title_logout">"Log out?"</string>
|
||||
<string name="dialog_uninstall_confirmation">"Do you want to uninstall this app ?"</string>
|
||||
<string name="download_cancel_all">"Cancel all"</string>
|
||||
<string name="download_canceled">"Canceled"</string>
|
||||
<string name="download_clear_completed">"Clear completed"</string>
|
||||
|
||||
Reference in New Issue
Block a user