Commit c052e376 authored by Thomas's avatar Thomas
Browse files

Fix reactions displayed in all notif tabs

parent 7e1d9b89
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -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);
+0 −2
Original line number Diff line number Diff line
@@ -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();
                }
            }
+0 −3
Original line number Diff line number Diff line
@@ -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);
+5 −1
Original line number Diff line number Diff line
@@ -186,7 +186,11 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
                case "admin.report":
                    return TYPE_ADMIN_REPORT;
                case "pleroma:emoji_reaction":
                    if (notificationList.get(position).status != null) {
                        return TYPE_REACTION;
                    } else {
                        return TYPE_HIDDEN;
                    }
            }
        }
        return super.getItemViewType(position);
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
        excludeType.add("status");
        excludeType.add("admin.sign_up");
        excludeType.add("admin.report");
        excludeType.add("pleroma:emoji_reaction");
        if (notificationType == NotificationTypeEnum.ALL) {
            aggregateNotification = sharedpreferences.getBoolean(getString(R.string.SET_AGGREGATE_NOTIFICATION), true);
            if (excludedCategories != null) {