From c052e376e22088f02a28b725c6f18bbf3bf40652 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 6 Jan 2023 16:27:26 +0100 Subject: [PATCH] Fix reactions displayed in all notif tabs --- .../app/fedilab/android/helper/ECDHFedilab.java | 14 -------------- .../fedilab/android/helper/PushNotifications.java | 2 -- .../fedilab/android/services/CustomReceiver.java | 3 --- .../android/ui/drawer/NotificationAdapter.java | 6 +++++- .../timeline/FragmentMastodonNotification.java | 1 + 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/helper/ECDHFedilab.java b/app/src/main/java/app/fedilab/android/helper/ECDHFedilab.java index 0dbe27fd..de56a192 100644 --- a/app/src/main/java/app/fedilab/android/helper/ECDHFedilab.java +++ b/app/src/main/java/app/fedilab/android/helper/ECDHFedilab.java @@ -19,7 +19,6 @@ import static app.fedilab.android.client.entities.app.StatusCache.restoreNotific import android.content.Context; import android.content.SharedPreferences; import android.util.Base64; -import android.util.Log; import androidx.preference.PreferenceManager; @@ -144,23 +143,14 @@ public class ECDHFedilab { SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(context); - Log.v(Helper.TAG, ">>slug: " + slug); String pushPrivateKey = sharedPreferences.getString("pushPrivateKey" + slug, null); String pushPublicKey = sharedPreferences.getString("pushPublicKey" + slug, null); String encodedAuthKey = sharedPreferences.getString("encodedAuthKey" + slug, null); sharedPreferences.getString("pushAccountID" + slug, null); - Log.v(Helper.TAG, "getServerKey(context, slug): " + getServerKey(context, slug)); - - - Log.v(Helper.TAG, "pushPrivateKey: " + pushPrivateKey); - Log.v(Helper.TAG, "pushPublicKey: " + pushPublicKey); - Log.v(Helper.TAG, "encodedAuthKey: " + encodedAuthKey); - PublicKey serverKey = null; serverKey = deserializeRawPublicKey(Base64.decode(getServerKey(context, slug), Base64.URL_SAFE)); - Log.v(Helper.TAG, "serverKey: " + serverKey); PrivateKey privateKey; PublicKey publicKey; byte[] authKey; @@ -171,7 +161,6 @@ public class ECDHFedilab { authKey = Base64.decode(encodedAuthKey, Base64.URL_SAFE); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { e.printStackTrace(); - Log.v(Helper.TAG, "err1: " + e.getMessage()); return null; } byte[] sharedSecret; @@ -182,7 +171,6 @@ public class ECDHFedilab { sharedSecret = keyAgreement.generateSecret(); } catch (NoSuchAlgorithmException | InvalidKeyException e) { e.printStackTrace(); - Log.v(Helper.TAG, "err2: " + e.getMessage()); return null; } byte[] secondSaltInfo = "Content-Encoding: auth\0".getBytes(StandardCharsets.UTF_8); @@ -191,7 +179,6 @@ public class ECDHFedilab { deriveKey = deriveKey(authKey, sharedSecret, secondSaltInfo, 32); } catch (NoSuchAlgorithmException | InvalidKeyException e) { e.printStackTrace(); - Log.v(Helper.TAG, "err3: " + e.getMessage()); return null; } String decryptedStr; @@ -207,7 +194,6 @@ public class ECDHFedilab { decryptedStr = new String(decrypted, 2, decrypted.length - 2, StandardCharsets.UTF_8); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { e.printStackTrace(); - Log.v(Helper.TAG, "err4: " + e.getMessage()); return null; } return restoreNotificationFromString(decryptedStr); diff --git a/app/src/main/java/app/fedilab/android/helper/PushNotifications.java b/app/src/main/java/app/fedilab/android/helper/PushNotifications.java index 670909de..a2be75ea 100644 --- a/app/src/main/java/app/fedilab/android/helper/PushNotifications.java +++ b/app/src/main/java/app/fedilab/android/helper/PushNotifications.java @@ -19,7 +19,6 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Handler; import android.os.Looper; -import android.util.Log; import androidx.annotation.NonNull; import androidx.preference.PreferenceManager; @@ -104,7 +103,6 @@ public class PushNotifications { } } } catch (Exception e) { - Log.v(Helper.TAG, slug + " -> " + e.getMessage()); e.printStackTrace(); } } diff --git a/app/src/main/java/app/fedilab/android/services/CustomReceiver.java b/app/src/main/java/app/fedilab/android/services/CustomReceiver.java index 3e13ff73..a6eb6f77 100644 --- a/app/src/main/java/app/fedilab/android/services/CustomReceiver.java +++ b/app/src/main/java/app/fedilab/android/services/CustomReceiver.java @@ -16,7 +16,6 @@ package app.fedilab.android.services; import android.content.Context; import android.content.Intent; -import android.util.Log; import androidx.annotation.NonNull; @@ -24,7 +23,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.unifiedpush.android.connector.MessagingReceiver; -import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.NotificationsHelper; import app.fedilab.android.helper.PushNotifications; @@ -40,7 +38,6 @@ 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/ui/drawer/NotificationAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java index 3ecbc651..f3b2af69 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/NotificationAdapter.java @@ -186,7 +186,11 @@ public class NotificationAdapter extends RecyclerView.Adapter