Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce758931 authored by Enming Xie's avatar Enming Xie
Browse files

Fix Notification pops up when in conversation

parent 0c30950e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ public class NotificationManager {

                    // If this message is in the foreground, mark it as read
                    Message message = new Message(context, lastMessage.mMsgId);
                    if (message.getThreadId() == MainActivity.sThreadShowing) {
                    if (MessageListActivity.isInForeground && message.getThreadId() == MessageListActivity.getThreadId()) {
                        message.markRead();
                        return;
                    }
@@ -254,7 +254,7 @@ public class NotificationManager {
                // If the message is visible (i.e. it is currently showing in the Main Activity),
                // don't show a notification; just mark it as read and return.
                Message message = new Message(context, lastMessage.mMsgId);
                if (message.getThreadId() == MainActivity.sThreadShowing) {
                if (MessageListActivity.isInForeground && message.getThreadId() == MessageListActivity.getThreadId()) {
                    message.markRead();
                    return;
                }
+19 −1
Original line number Diff line number Diff line
@@ -32,13 +32,15 @@ public class MessageListActivity extends QKSwipeBackActivity {
    public static final String ARG_HIGHLIGHT = "highlight";
    public static final String ARG_SHOW_IMMEDIATE = "showImmediate";

    private long mThreadId;
    private static long mThreadId;
    private long mRowId;
    private String mHighlight;
    private boolean mShowImmediate;

    private long mWaitingForThreadId = -1;

    public static boolean isInForeground;

    public static void launch(QKActivity context, long threadId, long rowId, String pattern, boolean showImmediate) {
        Intent intent = new Intent(context, MessageListActivity.class);
        intent.putExtra(ARG_THREAD_ID, threadId);
@@ -54,6 +56,18 @@ public class MessageListActivity extends QKSwipeBackActivity {
        onNewIntent(getIntent());
    }

    @Override
    protected void onResume() {
        super.onResume();
        isInForeground = true;
    }

    @Override
    protected void onPause() {
        super.onPause();
        isInForeground = false;
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
@@ -148,4 +162,8 @@ public class MessageListActivity extends QKSwipeBackActivity {
        inflater.inflate(R.menu.message_list, menu);
        return super.onCreateOptionsMenu(menu);
    }

    public static long getThreadId() {
        return mThreadId;
    }
}