diff --git a/app/build.gradle b/app/build.gradle index 202f1f8d..7f0181db 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -144,9 +144,9 @@ dependencies { implementation "ch.acra:acra-limiter:5.9.3" implementation "ch.acra:acra-dialog:5.9.6" implementation "com.madgag.spongycastle:bctls-jdk15on:1.58.0.0" - implementation 'com.github.UnifiedPush:android-connector:2.0.1' + implementation 'com.github.UnifiedPush:android-connector:2.1.1' // implementation 'com.github.UnifiedPush:android-foss_embedded_fcm_distributor:1.0.0-beta1' - playstoreImplementation('com.github.UnifiedPush:android-embedded_fcm_distributor:2.1.3') { + playstoreImplementation('com.github.UnifiedPush:android-embedded_fcm_distributor:2.2.0') { exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-analytics' exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' @@ -191,20 +191,11 @@ dependencies { playstoreImplementation "androidx.mediarouter:mediarouter:1.3.0" playstoreImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1' - playstoreImplementation "com.google.android.gms:play-services-cast-tv:19.0.1" - playstoreImplementation "com.google.android.gms:play-services-cast:21.0.1" - playstoreImplementation "androidx.mediarouter:mediarouter:1.3.0" - playstoreImplementation 'com.google.android.gms:play-services-cast-framework:21.0.1' //----> Other flavors fdroidImplementation 'su.litvak.chromecast:api-v2:0.11.3' fdroidImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0' fdroidImplementation 'org.slf4j:slf4j-simple:1.7.30' - fdroidImplementation 'com.github.evozi:Cyanea:1.0.7' - - fdroidImplementation 'su.litvak.chromecast:api-v2:0.11.3' - fdroidImplementation 'com.fasterxml.jackson.core:jackson-core:2.12.0' - fdroidImplementation 'org.slf4j:slf4j-simple:1.7.30' } def getCurrentFlavor() { diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonNotificationsService.java b/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonNotificationsService.java index 214e9093..c8340f86 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonNotificationsService.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonNotificationsService.java @@ -75,7 +75,8 @@ public interface MastodonNotificationsService { @Field("data[alerts][status]") boolean status, @Field("data[alerts][update]") boolean update, @Field("data[alerts][admin.sign_up]") boolean admin_sign_up, - @Field("data[alerts][admin.report]") boolean admin_report + @Field("data[alerts][admin.report]") boolean admin_report, + @Field("data[policy]") String policy ); @@ -93,7 +94,8 @@ public interface MastodonNotificationsService { @Field("data[alerts][favourite]") boolean favourite, @Field("data[alerts][reblog]") boolean reblog, @Field("data[alerts][mention]") boolean mention, - @Field("data[alerts][poll]") boolean poll + @Field("data[alerts][poll]") boolean poll, + @Field("data[policy]") String policy ); @DELETE("push/subscription") diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/PushSubscription.java b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/PushSubscription.java index 0f421528..d95e3043 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/PushSubscription.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/entities/api/PushSubscription.java @@ -22,6 +22,8 @@ public class PushSubscription { public String id; @SerializedName("endpoint") public String endpoint; + @SerializedName("policy") + public String policy; @SerializedName("alerts") public Alerts alerts; @SerializedName("server_key") diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/PushNotifications.java b/app/src/main/java/app/fedilab/android/mastodon/helper/PushNotifications.java index 1861d956..c0855174 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/PushNotifications.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/PushNotifications.java @@ -95,7 +95,7 @@ public class PushNotifications { notif_status, notif_updates, notif_signup, - notif_report); + notif_report, "all"); if (pushSubscriptionCall != null) { try { Response pushSubscriptionResponse = pushSubscriptionCall.execute(); diff --git a/app/src/main/java/app/fedilab/android/mastodon/services/CustomReceiver.java b/app/src/main/java/app/fedilab/android/mastodon/services/CustomReceiver.java index e89837d1..b1572a5d 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/services/CustomReceiver.java +++ b/app/src/main/java/app/fedilab/android/mastodon/services/CustomReceiver.java @@ -16,6 +16,7 @@ package app.fedilab.android.mastodon.services; import android.content.Context; import android.content.Intent; +import android.util.Log; import androidx.annotation.NonNull; @@ -23,6 +24,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.unifiedpush.android.connector.MessagingReceiver; +import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.NotificationsHelper; import app.fedilab.android.mastodon.helper.PushNotifications; @@ -38,6 +40,7 @@ public class CustomReceiver extends MessagingReceiver { @Override public void onMessage(@NotNull Context context, @NotNull byte[] message, @NotNull String slug) { // Called when a new message is received. The message contains the full POST body of the push message + Log.v(Helper.TAG, "onMessage: " + slug); new Thread(() -> { try { /*Notification notification = ECDHFedilab.decryptNotification(context, slug, message); diff --git a/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/NotificationsVM.java b/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/NotificationsVM.java index c7b24c8e..0887c451 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/NotificationsVM.java +++ b/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/NotificationsVM.java @@ -314,7 +314,7 @@ public class NotificationsVM extends AndroidViewModel { MastodonNotificationsService mastodonNotificationsService = init(instance); new Thread(() -> { PushSubscription pushSubscription = null; - Call pushSubscriptionCall = mastodonNotificationsService.pushSubscription(token, endpoint, keys_p256dh, keys_auth, follow, favourite, reblog, mention, poll, status, updates, signup, report); + Call pushSubscriptionCall = mastodonNotificationsService.pushSubscription(token, endpoint, keys_p256dh, keys_auth, follow, favourite, reblog, mention, poll, status, updates, signup, report, "all"); if (pushSubscriptionCall != null) { try { Response pushSubscriptionResponse = pushSubscriptionCall.execute(); @@ -390,7 +390,7 @@ public class NotificationsVM extends AndroidViewModel { MastodonNotificationsService mastodonNotificationsService = init(instance); new Thread(() -> { PushSubscription pushSubscription = null; - Call pushSubscriptionCall = mastodonNotificationsService.updatePushSubscription(token, follow, favourite, reblog, mention, poll); + Call pushSubscriptionCall = mastodonNotificationsService.updatePushSubscription(token, follow, favourite, reblog, mention, poll, "all"); if (pushSubscriptionCall != null) { try { Response pushSubscriptionResponse = pushSubscriptionCall.execute();