From 720a8d634b78566821921f87ea77974c4fdbf133 Mon Sep 17 00:00:00 2001 From: sim Date: Wed, 15 Jan 2025 09:37:30 +0100 Subject: [PATCH] Allow configuring push notifications with UnifiedPush --- .../joinmastodon/android/UnifiedPushNotificationReceiver.java | 4 ++-- .../fragments/settings/SettingsNotificationsFragment.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/UnifiedPushNotificationReceiver.java b/mastodon/src/main/java/org/joinmastodon/android/UnifiedPushNotificationReceiver.java index dcad18895b..4cf04f6de7 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/UnifiedPushNotificationReceiver.java +++ b/mastodon/src/main/java/org/joinmastodon/android/UnifiedPushNotificationReceiver.java @@ -39,10 +39,10 @@ public void onNewEndpoint(@NotNull Context context, @NotNull PushEndpoint endpoi if (account != null) { PublicKeySet ks = endpoint.getPubKeySet(); if (ks != null){ - account.getPushSubscriptionManager().registerAccountForPush(null, true, endpoint.getUrl(), ks.getPubKey(), ks.getAuth()); + account.getPushSubscriptionManager().registerAccountForPush(account.pushSubscription, true, endpoint.getUrl(), ks.getPubKey(), ks.getAuth()); } else { // ks should never be null on new endpoint - account.getPushSubscriptionManager().registerAccountForPush(null, endpoint.getUrl()); + account.getPushSubscriptionManager().registerAccountForPush(account.pushSubscription, endpoint.getUrl()); } } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsNotificationsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsNotificationsFragment.java index ac22670c62..668ab76d41 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsNotificationsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsNotificationsFragment.java @@ -127,7 +127,7 @@ protected void onHidden(){ GlobalUserPreferences.save(); lp.keepOnlyLatestNotification=onlyLatestItem.checked; lp.save(); - if(needUpdateNotificationSettings && PushSubscriptionManager.arePushNotificationsAvailable()){ + if(needUpdateNotificationSettings && (PushSubscriptionManager.arePushNotificationsAvailable() || useUnifiedPush)){ ps.alerts.mention=mentionsItem.checked; ps.alerts.reblog=boostsItem.checked; ps.alerts.favourite=favoritesItem.checked;