From af964643aae2804fafea0614cec4a54f737eebf3 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Tue, 4 Oct 2022 18:43:16 +0200 Subject: [PATCH] notification improvements # Conflicts: # Habitica/src/main/java/com/habitrpg/android/habitica/helpers/notifications/HabiticaFirebaseMessagingService.kt # version.properties --- Habitica/AndroidManifest.xml | 6 +++++ .../notifications/PushNotificationManager.kt | 25 ++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Habitica/AndroidManifest.xml b/Habitica/AndroidManifest.xml index a7bbc8380..447f79bdd 100644 --- a/Habitica/AndroidManifest.xml +++ b/Habitica/AndroidManifest.xml @@ -257,6 +257,12 @@ + + key = "preference_push_invited_to_party" - type.contains(RECEIVED_PRIVATE_MESSAGE_PUSH_NOTIFICATION_KEY) -> key = "preference_push_received_a_private_message" - type.contains(RECEIVED_GEMS_PUSH_NOTIFICATION_KEY) -> key = "preference_push_gifted_gems" - type.contains(RECEIVED_SUBSCRIPTION_GIFT_PUSH_NOTIFICATION_KEY) -> key = "preference_push_gifted_subscription" - type.contains(GUILD_INVITE_PUSH_NOTIFICATION_KEY) -> key = "preference_push_invited_to_guild" - type.contains(QUEST_INVITE_PUSH_NOTIFICATION_KEY) -> key = "preference_push_invited_to_quest" - type.contains(QUEST_BEGUN_PUSH_NOTIFICATION_KEY) -> key = "preference_push_your_quest_has_begun" - type.contains(WON_CHALLENGE_PUSH_NOTIFICATION_KEY) -> key = "preference_push_you_won_challenge" + val key = when { + type == PARTY_INVITE_PUSH_NOTIFICATION_KEY -> "preference_push_invited_to_party" + type?.contains(RECEIVED_PRIVATE_MESSAGE_PUSH_NOTIFICATION_KEY) == true -> "preference_push_received_a_private_message" + type?.contains(RECEIVED_GEMS_PUSH_NOTIFICATION_KEY) == true -> "preference_push_gifted_gems" + type?.contains(RECEIVED_SUBSCRIPTION_GIFT_PUSH_NOTIFICATION_KEY) == true -> "preference_push_gifted_subscription" + type?.contains(GUILD_INVITE_PUSH_NOTIFICATION_KEY) == true -> "preference_push_invited_to_guild" + type?.contains(QUEST_INVITE_PUSH_NOTIFICATION_KEY) == true -> "preference_push_invited_to_quest" + type?.contains(QUEST_BEGUN_PUSH_NOTIFICATION_KEY) == true -> "preference_push_your_quest_has_begun" + type?.contains(WON_CHALLENGE_PUSH_NOTIFICATION_KEY) == true -> "preference_push_you_won_challenge" + else -> return true } return sharedPreferences.getBoolean(key, true)