Use better update string for manual installs.

Fixes #13700
This commit is contained in:
Greyson Parrelli
2024-09-19 10:05:31 -04:00
parent 9a1d5f4dce
commit 01ee98af91
3 changed files with 10 additions and 3 deletions

View File

@@ -83,7 +83,7 @@ object ApkUpdateNotifications {
ServiceUtil.getNotificationManager(context).notify(NotificationIds.APK_UPDATE_FAILED_INSTALL, notification) ServiceUtil.getNotificationManager(context).notify(NotificationIds.APK_UPDATE_FAILED_INSTALL, notification)
} }
fun showAutoUpdateSuccess(context: Context) { fun showUpdateSuccess(context: Context, userInitiated: Boolean) {
val pendingIntent = PendingIntent.getActivity( val pendingIntent = PendingIntent.getActivity(
context, context,
0, 0,
@@ -93,9 +93,15 @@ object ApkUpdateNotifications {
val appVersionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName val appVersionName = context.packageManager.getPackageInfo(context.packageName, 0).versionName
val body = if (userInitiated) {
context.getString(R.string.ApkUpdateNotifications_manual_update_success_body, appVersionName)
} else {
context.getString(R.string.ApkUpdateNotifications_auto_update_success_body, appVersionName)
}
val notification = NotificationCompat.Builder(context, NotificationChannels.getInstance().APP_UPDATES) val notification = NotificationCompat.Builder(context, NotificationChannels.getInstance().APP_UPDATES)
.setContentTitle(context.getString(R.string.ApkUpdateNotifications_auto_update_success_title)) .setContentTitle(context.getString(R.string.ApkUpdateNotifications_auto_update_success_title))
.setContentText(context.getString(R.string.ApkUpdateNotifications_auto_update_success_body, appVersionName)) .setContentText(body)
.setSmallIcon(R.drawable.ic_notification) .setSmallIcon(R.drawable.ic_notification)
.setColor(ContextCompat.getColor(context, R.color.core_ultramarine)) .setColor(ContextCompat.getColor(context, R.color.core_ultramarine))
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)

View File

@@ -39,7 +39,7 @@ class ApkUpdatePackageInstallerReceiver : BroadcastReceiver() {
if (SignalStore.apkUpdate.lastApkUploadTime != SignalStore.apkUpdate.pendingApkUploadTime) { if (SignalStore.apkUpdate.lastApkUploadTime != SignalStore.apkUpdate.pendingApkUploadTime) {
Log.i(TAG, "Update installed successfully! Updating our lastApkUploadTime to ${SignalStore.apkUpdate.pendingApkUploadTime}") Log.i(TAG, "Update installed successfully! Updating our lastApkUploadTime to ${SignalStore.apkUpdate.pendingApkUploadTime}")
SignalStore.apkUpdate.lastApkUploadTime = SignalStore.apkUpdate.pendingApkUploadTime SignalStore.apkUpdate.lastApkUploadTime = SignalStore.apkUpdate.pendingApkUploadTime
ApkUpdateNotifications.showAutoUpdateSuccess(context) ApkUpdateNotifications.showUpdateSuccess(context, userInitiated)
} else { } else {
Log.i(TAG, "Spurious 'success' notification?") Log.i(TAG, "Spurious 'success' notification?")
} }

View File

@@ -2651,6 +2651,7 @@
<string name="ApkUpdateNotifications_failed_general_body">We will try again later.</string> <string name="ApkUpdateNotifications_failed_general_body">We will try again later.</string>
<string name="ApkUpdateNotifications_auto_update_success_title">Signal successfully updated</string> <string name="ApkUpdateNotifications_auto_update_success_title">Signal successfully updated</string>
<string name="ApkUpdateNotifications_auto_update_success_body">You were automatically updated to version %1$s.</string> <string name="ApkUpdateNotifications_auto_update_success_body">You were automatically updated to version %1$s.</string>
<string name="ApkUpdateNotifications_manual_update_success_body">You updated to version %1$s.</string>
<!-- UntrustedSendDialog --> <!-- UntrustedSendDialog -->
<string name="UntrustedSendDialog_send_message">Send message?</string> <string name="UntrustedSendDialog_send_message">Send message?</string>