Add notifications channel migrations

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-02-23 23:35:03 +01:00
parent eb18269ec9
commit f8f7b104c7
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
3 changed files with 23 additions and 2 deletions

View File

@ -70,7 +70,7 @@ class PackageReplacedReceiver : BroadcastReceiver(), KoinComponent {
appPreferences.setNotificationChannelIsUpgradedToV2(true)
}
if (!appPreferences.isNotificationChannelUpgradedToV3 && packageInfo.versionCode > 51) {
if (!appPreferences.isNotificationChannelUpgradedToV3) {
notificationManager.deleteNotificationChannel(
NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V2
)
@ -80,6 +80,16 @@ class PackageReplacedReceiver : BroadcastReceiver(), KoinComponent {
appPreferences.setNotificationChannelIsUpgradedToV3(true)
}
if (!appPreferences.isNotificationChannelUpgradedToV4) {
notificationManager.deleteNotificationChannel(
NotificationUtils.NOTIFICATION_CHANNEL_MESSAGES_V3
)
notificationManager.deleteNotificationChannel(
NotificationUtils.NOTIFICATION_CHANNEL_CALLS_V3
)
appPreferences.setNotificationChannelIsUpgradedToV4(true)
}
}
} catch (e: PackageManager.NameNotFoundException) {
Log.e(TAG, "Failed to fetch package info")

View File

@ -182,6 +182,17 @@ public interface AppPreferences {
@RemoveMethod
void removeNotificationChannelUpgradeToV3();
@KeyByString("notification_channels_upgrade_to_v4")
boolean getIsNotificationChannelUpgradedToV4();
@KeyByString("notification_channels_upgrade_to_v4")
void setNotificationChannelIsUpgradedToV4(boolean value);
@KeyByString("notification_channels_upgrade_to_v4")
@RemoveMethod
void removeNotificationChannelUpgradeToV4();
@KeyByString("notifications_vibrate")
@DefaultValue(R.bool.value_true)
boolean getShouldVibrateSetting();

View File

@ -41,6 +41,7 @@
<color name="nc_darkRed">#D32F2F</color>
<color name="nc_darkGreen">#006400</color>
<color name="per70white">#46FFFFFF</color>
<color name="nc_white_color">@color/per70white</color>
<color name="nc_light_blue_color">#7FC0E3</color>
<color name="controller_chat_separator">#E8E8E8</color>
@ -63,7 +64,6 @@
<color name="nc_chip_mention_others_background">@color/white</color>
<color name="bg_dark_mention_chips">#333333</color>
<color name="bg_selected_participant_clear_icon">#484848</color>
<color name="bg_message_list_incoming_bubble">#EFEFEF</color>
<color name="bg_message_list_outcoming_bubble">@color/colorPrimary</color>