Commit 8c49260a authored by Thomas's avatar Thomas
Browse files

add policy for push

parent e013dc96
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -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() {
+4 −2
Original line number Diff line number Diff line
@@ -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")
+2 −0
Original line number Diff line number Diff line
@@ -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")
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ public class PushNotifications {
                    notif_status,
                    notif_updates,
                    notif_signup,
                    notif_report);
                    notif_report, "all");
            if (pushSubscriptionCall != null) {
                try {
                    Response<PushSubscription> pushSubscriptionResponse = pushSubscriptionCall.execute();
+3 −0
Original line number Diff line number Diff line
@@ -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);
Loading