mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Fix Notification pops up when in conversation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user