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)
}
fun showAutoUpdateSuccess(context: Context) {
fun showUpdateSuccess(context: Context, userInitiated: Boolean) {
val pendingIntent = PendingIntent.getActivity(
context,
0,
@ -93,9 +93,15 @@ object ApkUpdateNotifications {
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)
.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)
.setColor(ContextCompat.getColor(context, R.color.core_ultramarine))
.setContentIntent(pendingIntent)

View file

@ -39,7 +39,7 @@ class ApkUpdatePackageInstallerReceiver : BroadcastReceiver() {
if (SignalStore.apkUpdate.lastApkUploadTime != SignalStore.apkUpdate.pendingApkUploadTime) {
Log.i(TAG, "Update installed successfully! Updating our lastApkUploadTime to ${SignalStore.apkUpdate.pendingApkUploadTime}")
SignalStore.apkUpdate.lastApkUploadTime = SignalStore.apkUpdate.pendingApkUploadTime
ApkUpdateNotifications.showAutoUpdateSuccess(context)
ApkUpdateNotifications.showUpdateSuccess(context, userInitiated)
} else {
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_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_manual_update_success_body">You updated to version %1$s.</string>
<!-- UntrustedSendDialog -->
<string name="UntrustedSendDialog_send_message">Send message?</string>