mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-23 13:40:43 +01:00
parent
323d9e16b1
commit
400c41e731
@ -37,6 +37,7 @@ import android.os.Vibrator;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
@ -44,6 +45,7 @@ import androidx.work.Data;
|
||||
import androidx.work.Worker;
|
||||
import androidx.work.WorkerParameters;
|
||||
import autodagger.AutoInjector;
|
||||
|
||||
import com.bluelinelabs.logansquare.LoganSquare;
|
||||
import com.nextcloud.talk.R;
|
||||
import com.nextcloud.talk.activities.MagicCallActivity;
|
||||
@ -67,16 +69,20 @@ import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils;
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.JavaNetCookieJar;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import org.parceler.Parcels;
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.CookieManager;
|
||||
import java.security.InvalidKeyException;
|
||||
@ -424,6 +430,11 @@ public class NotificationWorker extends Worker {
|
||||
decryptedPushMessage = LoganSquare.parse(new String(decryptedSubject),
|
||||
DecryptedPushMessage.class);
|
||||
|
||||
if (decryptedPushMessage.isDelete()) {
|
||||
NotificationUtils.cancelExistingNotificationWithId(context, signatureVerification.getUserEntity(), decryptedPushMessage.getNotificationId());
|
||||
} else if (decryptedPushMessage.isDeleteAll()) {
|
||||
NotificationUtils.cancelAllNotificationsForAccount(context, signatureVerification.getUserEntity());
|
||||
} else {
|
||||
credentials = ApiUtils.getCredentials(signatureVerification.getUserEntity().getUsername(),
|
||||
signatureVerification.getUserEntity().getToken());
|
||||
|
||||
@ -489,6 +500,7 @@ public class NotificationWorker extends Worker {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NoSuchAlgorithmException e1) {
|
||||
Log.d(TAG, "No proper algorithm to decrypt the message " + e1.getLocalizedMessage());
|
||||
} catch (NoSuchPaddingException e1) {
|
||||
|
@ -45,6 +45,12 @@ public class DecryptedPushMessage {
|
||||
@JsonField(name = "nid")
|
||||
long notificationId;
|
||||
|
||||
@JsonField(name = "delete")
|
||||
boolean delete;
|
||||
|
||||
@JsonField(name = "delete-all")
|
||||
boolean deleteAll;
|
||||
|
||||
@JsonIgnore
|
||||
String text;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user