Merge "Show restoring toast message only after Play Store responded successfully" into main
This commit is contained in:
@@ -4057,8 +4057,6 @@
|
|||||||
<string name="archiving_succeeded">Archived <xliff:g id="package_label" example="Translate">%1$s</xliff:g></string>
|
<string name="archiving_succeeded">Archived <xliff:g id="package_label" example="Translate">%1$s</xliff:g></string>
|
||||||
<!-- Toast message when restoring an app failed. -->
|
<!-- Toast message when restoring an app failed. -->
|
||||||
<string name="restoring_failed">Restoring failed</string>
|
<string name="restoring_failed">Restoring failed</string>
|
||||||
<!-- Toast message when restoring an app succeeded. -->
|
|
||||||
<string name="restoring_succeeded">Restored <xliff:g id="package_label" example="Translate">%1$s</xliff:g></string>
|
|
||||||
<!-- Toast message when restoring an app has started. -->
|
<!-- Toast message when restoring an app has started. -->
|
||||||
<string name="restoring_in_progress">Restoring <xliff:g id="package_label" example="Translate">%1$s</xliff:g></string>
|
<string name="restoring_in_progress">Restoring <xliff:g id="package_label" example="Translate">%1$s</xliff:g></string>
|
||||||
|
|
||||||
|
@@ -73,12 +73,6 @@ class AppRestoreButton(packageInfoPresenter: PackageInfoPresenter) {
|
|||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
packageInstaller.requestUnarchive(app.packageName, pendingIntent.intentSender)
|
packageInstaller.requestUnarchive(app.packageName, pendingIntent.intentSender)
|
||||||
val appLabel = userPackageManager.getApplicationLabel(app)
|
|
||||||
Toast.makeText(
|
|
||||||
context,
|
|
||||||
context.getString(R.string.restoring_in_progress, appLabel),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(LOG_TAG, "Request unarchive failed", e)
|
Log.e(LOG_TAG, "Request unarchive failed", e)
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
@@ -92,23 +86,11 @@ class AppRestoreButton(packageInfoPresenter: PackageInfoPresenter) {
|
|||||||
private fun onReceive(intent: Intent, app: ApplicationInfo) {
|
private fun onReceive(intent: Intent, app: ApplicationInfo) {
|
||||||
when (val unarchiveStatus =
|
when (val unarchiveStatus =
|
||||||
intent.getIntExtra(PackageInstaller.EXTRA_UNARCHIVE_STATUS, Int.MIN_VALUE)) {
|
intent.getIntExtra(PackageInstaller.EXTRA_UNARCHIVE_STATUS, Int.MIN_VALUE)) {
|
||||||
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
|
PackageInstaller.UNARCHIVAL_OK -> {
|
||||||
Log.e(
|
|
||||||
LOG_TAG,
|
|
||||||
"Request unarchiving failed for $packageName with code $unarchiveStatus"
|
|
||||||
)
|
|
||||||
Toast.makeText(
|
|
||||||
context,
|
|
||||||
context.getString(R.string.restoring_failed),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageInstaller.STATUS_SUCCESS -> {
|
|
||||||
val appLabel = userPackageManager.getApplicationLabel(app)
|
val appLabel = userPackageManager.getApplicationLabel(app)
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.restoring_succeeded, appLabel),
|
context.getString(R.string.restoring_in_progress, appLabel),
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user