mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
move old message notifier to optimized message notifier
This commit is contained in:
parent
871d707460
commit
2a88de3f61
@ -69,8 +69,10 @@ import org.thoughtcrime.securesms.loki.protocol.EphemeralMessage;
|
||||
import org.thoughtcrime.securesms.loki.protocol.LokiSessionResetImplementation;
|
||||
import org.thoughtcrime.securesms.loki.protocol.PushEphemeralMessageSendJob;
|
||||
import org.thoughtcrime.securesms.loki.utilities.Broadcaster;
|
||||
import org.thoughtcrime.securesms.notifications.DefaultMessageNotifier;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.notifications.OptimizedMessageNotifier;
|
||||
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
|
||||
@ -148,6 +150,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
private PersistentLogger persistentLogger;
|
||||
|
||||
// Loki
|
||||
public MessageNotifier messageNotifier = null;
|
||||
public LokiPoller lokiPoller = null;
|
||||
public LokiPublicChatManager lokiPublicChatManager = null;
|
||||
private LokiPublicChatAPI lokiPublicChatAPI = null;
|
||||
@ -173,6 +176,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
||||
// Loki
|
||||
// ========
|
||||
messageNotifier = new OptimizedMessageNotifier(new DefaultMessageNotifier());
|
||||
broadcaster = new Broadcaster(this);
|
||||
LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this);
|
||||
LokiThreadDatabase threadDB = DatabaseFactory.getLokiThreadDatabase(this);
|
||||
@ -222,7 +226,9 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
executePendingContactSync();
|
||||
KeyCachingService.onAppForegrounded(this);
|
||||
// Loki
|
||||
if (lokiPoller != null) { lokiPoller.shouldCatchUp(); }
|
||||
startPollingIfNeeded();
|
||||
lokiPublicChatManager.shouldAllCatchUp();
|
||||
lokiPublicChatManager.startPollersIfNeeded();
|
||||
}
|
||||
|
||||
@ -231,7 +237,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
isAppVisible = false;
|
||||
Log.i(TAG, "App is no longer visible.");
|
||||
KeyCachingService.onAppBackgrounded(this);
|
||||
MessageNotifier.setVisibleThread(-1);
|
||||
messageNotifier.setVisibleThread(-1);
|
||||
// Loki
|
||||
if (lokiPoller != null) { lokiPoller.stopIfNeeded(); }
|
||||
if (lokiPublicChatManager != null) { lokiPublicChatManager.stopPollers(); }
|
||||
|
@ -298,7 +298,7 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||
Context context = ConversationListActivity.this;
|
||||
List<MarkedMessageInfo> messageIds = DatabaseFactory.getThreadDatabase(context).setAllThreadsRead();
|
||||
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
|
||||
return null;
|
||||
|
@ -324,8 +324,9 @@ public class ConversationListFragment extends Fragment
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
DatabaseFactory.getThreadDatabase(getActivity()).deleteConversations(selectedConversations);
|
||||
MessageNotifier.updateNotification(getActivity());
|
||||
Context context = getActivity();
|
||||
DatabaseFactory.getThreadDatabase(context).deleteConversations(selectedConversations);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -542,9 +543,10 @@ public class ConversationListFragment extends Fragment
|
||||
DatabaseFactory.getThreadDatabase(getActivity()).archiveConversation(threadId);
|
||||
|
||||
if (unreadCount > 0) {
|
||||
List<MarkedMessageInfo> messageIds = DatabaseFactory.getThreadDatabase(getActivity()).setRead(threadId, false);
|
||||
MessageNotifier.updateNotification(getActivity());
|
||||
MarkReadReceiver.process(getActivity(), messageIds);
|
||||
Context context = getActivity();
|
||||
List<MarkedMessageInfo> messageIds = DatabaseFactory.getThreadDatabase(context).setRead(threadId, false);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -553,8 +555,9 @@ public class ConversationListFragment extends Fragment
|
||||
DatabaseFactory.getThreadDatabase(getActivity()).unarchiveConversation(threadId);
|
||||
|
||||
if (unreadCount > 0) {
|
||||
DatabaseFactory.getThreadDatabase(getActivity()).incrementUnread(threadId, unreadCount);
|
||||
MessageNotifier.updateNotification(getActivity());
|
||||
Context context = getActivity();
|
||||
DatabaseFactory.getThreadDatabase(context).incrementUnread(threadId, unreadCount);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
}
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, threadId);
|
||||
|
@ -176,7 +176,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
return null;
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -133,13 +133,13 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
||||
assert getSupportActionBar() != null;
|
||||
getSupportActionBar().setTitle("Message Details");
|
||||
|
||||
MessageNotifier.setVisibleThread(threadId);
|
||||
ApplicationContext.getInstance(this).messageNotifier.setVisibleThread(threadId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
MessageNotifier.setVisibleThread(-1L);
|
||||
ApplicationContext.getInstance(this).messageNotifier.setVisibleThread(-1L);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -550,7 +550,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
setGroupShareProfileReminder(recipient);
|
||||
calculateCharactersRemaining();
|
||||
|
||||
MessageNotifier.setVisibleThread(threadId);
|
||||
ApplicationContext.getInstance(this).messageNotifier.setVisibleThread(threadId);
|
||||
markThreadAsRead();
|
||||
|
||||
DatabaseFactory.getLokiThreadDatabase(this).setDelegate(this);
|
||||
@ -565,7 +565,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
MessageNotifier.setVisibleThread(-1L);
|
||||
ApplicationContext.getInstance(this).messageNotifier.setVisibleThread(-1L);
|
||||
if (isFinishing()) overridePendingTransition(R.anim.fade_scale_in, R.anim.slide_to_right);
|
||||
inputPanel.onPause();
|
||||
|
||||
@ -2244,7 +2244,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
if (refreshFragment) {
|
||||
fragment.reload(recipient, threadId);
|
||||
MessageNotifier.setVisibleThread(threadId);
|
||||
ApplicationContext.getInstance(this).messageNotifier.setVisibleThread(threadId);
|
||||
}
|
||||
|
||||
fragment.scrollToBottom();
|
||||
|
@ -12,6 +12,7 @@ import android.text.TextUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.DatabaseUpgradeActivity;
|
||||
import org.thoughtcrime.securesms.crypto.AttachmentSecret;
|
||||
import org.thoughtcrime.securesms.crypto.ClassicDecryptingPartInputStream;
|
||||
@ -423,7 +424,7 @@ public class ClassicOpenHelper extends SQLiteOpenHelper {
|
||||
db.endTransaction();
|
||||
|
||||
// DecryptingQueue.schedulePendingDecrypts(context, masterSecret);
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -281,7 +281,7 @@ public class GroupMessageProcessor {
|
||||
Optional<InsertResult> insertResult = smsDatabase.insertMessageInbox(groupMessage);
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
return insertResult.get().getThreadId();
|
||||
} else {
|
||||
return null;
|
||||
|
@ -5,6 +5,7 @@ import android.support.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
||||
@ -107,7 +108,7 @@ public class AttachmentDownloadJob extends BaseJob implements InjectableType {
|
||||
@Override
|
||||
public void onRun() throws IOException {
|
||||
doWork();
|
||||
MessageNotifier.updateNotification(context, 0);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context, 0);
|
||||
}
|
||||
|
||||
public void doWork() throws IOException {
|
||||
|
@ -10,6 +10,7 @@ import com.google.android.mms.pdu_alt.PduBody;
|
||||
import com.google.android.mms.pdu_alt.PduPart;
|
||||
import com.google.android.mms.pdu_alt.RetrieveConf;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.UriAttachment;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
@ -57,6 +58,7 @@ public class MmsDownloadJob extends BaseJob {
|
||||
private long messageId;
|
||||
private long threadId;
|
||||
private boolean automatic;
|
||||
private MessageNotifier messageNotifier;
|
||||
|
||||
public MmsDownloadJob(long messageId, long threadId, boolean automatic) {
|
||||
this(new Job.Parameters.Builder()
|
||||
@ -75,6 +77,7 @@ public class MmsDownloadJob extends BaseJob {
|
||||
this.messageId = messageId;
|
||||
this.threadId = threadId;
|
||||
this.automatic = automatic;
|
||||
this.messageNotifier = ApplicationContext.getInstance(context).messageNotifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,7 +97,7 @@ public class MmsDownloadJob extends BaseJob {
|
||||
public void onAdded() {
|
||||
if (automatic && KeyCachingService.isLocked(context)) {
|
||||
DatabaseFactory.getMmsDatabase(context).markIncomingNotificationReceived(threadId);
|
||||
MessageNotifier.updateNotification(context);
|
||||
messageNotifier.updateNotification(context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +180,7 @@ public class MmsDownloadJob extends BaseJob {
|
||||
|
||||
if (automatic) {
|
||||
database.markIncomingNotificationReceived(threadId);
|
||||
MessageNotifier.updateNotification(context, threadId);
|
||||
messageNotifier.updateNotification(context, threadId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +255,7 @@ public class MmsDownloadJob extends BaseJob {
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
database.delete(messageId);
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,7 +267,7 @@ public class MmsDownloadJob extends BaseJob {
|
||||
|
||||
if (automatic) {
|
||||
db.markIncomingNotificationReceived(threadId);
|
||||
MessageNotifier.updateNotification(context, threadId);
|
||||
messageNotifier.updateNotification(context, threadId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import com.google.android.mms.pdu_alt.SendReq;
|
||||
import com.google.android.mms.smil.SmilHelper;
|
||||
import com.klinker.android.send_message.Utils;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
@ -304,7 +305,7 @@ public class MmsSendJob extends SendJob {
|
||||
Recipient recipient = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadId);
|
||||
|
||||
if (recipient != null) {
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +159,9 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
private long messageId;
|
||||
private long smsMessageId;
|
||||
|
||||
//Loki
|
||||
private MessageNotifier messageNotifier;
|
||||
|
||||
@Inject SignalServiceMessageSender messageSender;
|
||||
private Address author;
|
||||
|
||||
@ -178,6 +181,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
pushMessageId,
|
||||
smsMessageId);
|
||||
setContext(context);
|
||||
this.messageNotifier = ApplicationContext.getInstance(context).messageNotifier;
|
||||
}
|
||||
|
||||
private PushDecryptJob(@NonNull Job.Parameters parameters, long pushMessageId, long smsMessageId) {
|
||||
@ -546,7 +550,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
if (threadId != null) {
|
||||
SessionManagementProtocol.handleEndSessionMessageIfNeeded(context, content);
|
||||
MessageNotifier.updateNotification(context, threadId);
|
||||
messageNotifier.updateNotification(context, threadId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -709,10 +713,10 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
if (threadId != null) {
|
||||
DatabaseFactory.getThreadDatabase(context).setRead(threadId, true);
|
||||
MessageNotifier.updateNotification(context);
|
||||
messageNotifier.updateNotification(context);
|
||||
}
|
||||
|
||||
MessageNotifier.setLastDesktopActivityTimestamp(message.getTimestamp());
|
||||
messageNotifier.setLastDesktopActivityTimestamp(message.getTimestamp());
|
||||
} catch (MmsException e) {
|
||||
throw new StorageFailedException(e, content.getSender(), content.getSenderDevice());
|
||||
}
|
||||
@ -775,9 +779,9 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
}
|
||||
}
|
||||
|
||||
MessageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
|
||||
MessageNotifier.cancelDelayedNotifications();
|
||||
MessageNotifier.updateNotification(context);
|
||||
messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
|
||||
messageNotifier.cancelDelayedNotifications();
|
||||
messageNotifier.updateNotification(context);
|
||||
}
|
||||
|
||||
public void handleMediaMessage(@NonNull SignalServiceContent content,
|
||||
@ -843,7 +847,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
}
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
|
||||
// Loki - Store message open group server ID if needed
|
||||
@ -1015,7 +1019,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
if (smsMessageId.isPresent()) database.deleteMessage(smsMessageId.get());
|
||||
|
||||
if (threadId != null) {
|
||||
MessageNotifier.updateNotification(context, threadId);
|
||||
messageNotifier.updateNotification(context, threadId);
|
||||
}
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
@ -1116,7 +1120,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
smsDatabase.markAsInvalidVersionKeyExchange(insertResult.get().getMessageId());
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
} else {
|
||||
smsDatabase.markAsInvalidVersionKeyExchange(smsMessageId.get());
|
||||
@ -1133,7 +1137,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
smsDatabase.markAsDecryptFailed(insertResult.get().getMessageId());
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
} else {
|
||||
smsDatabase.markAsDecryptFailed(smsMessageId.get());
|
||||
@ -1151,7 +1155,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
smsDatabase.markAsNoSession(insertResult.get().getMessageId());
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
} else {
|
||||
smsDatabase.markAsNoSession(smsMessageId.get());
|
||||
@ -1169,7 +1173,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
smsDatabase.markAsLegacyVersion(insertResult.get().getMessageId());
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
} else {
|
||||
smsDatabase.markAsLegacyVersion(smsMessageId.get());
|
||||
|
@ -182,7 +182,7 @@ public abstract class PushSendJob extends SendJob {
|
||||
Recipient recipient = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadId);
|
||||
|
||||
if (threadId != -1 && recipient != null) {
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
warn(TAG, "Couldn't send message due to error: ", e);
|
||||
if (messageId >= 0) {
|
||||
database.markAsPendingInsecureSmsFallback(record.getId());
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
}
|
||||
} catch (UntrustedIdentityException e) {
|
||||
warn(TAG, "Couldn't send message due to error: ", e);
|
||||
@ -198,7 +198,7 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
|
||||
Recipient recipient = DatabaseFactory.getThreadDatabase(context).getRecipientForThreadId(threadId);
|
||||
|
||||
if (threadId != -1 && recipient != null) {
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.telephony.SmsMessage;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraint;
|
||||
@ -79,7 +80,7 @@ public class SmsReceiveJob extends BaseJob {
|
||||
Optional<InsertResult> insertResult = storeMessage(message.get());
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
} else if (message.isPresent()) {
|
||||
Log.w(TAG, "*** Received blocked SMS, ignoring...");
|
||||
|
@ -9,6 +9,7 @@ import android.support.annotation.NonNull;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.telephony.SmsManager;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkOrCellServiceConstraint;
|
||||
@ -88,7 +89,7 @@ public class SmsSendJob extends SendJob {
|
||||
} catch (UndeliverableMessageException ude) {
|
||||
warn(TAG, ude);
|
||||
DatabaseFactory.getSmsDatabase(context).markAsSentFailed(record.getId());
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +107,7 @@ public class SmsSendJob extends SendJob {
|
||||
DatabaseFactory.getSmsDatabase(context).markAsSentFailed(messageId);
|
||||
|
||||
if (threadId != -1 && recipient != null) {
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, recipient, threadId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class SmsSentJob extends BaseJob {
|
||||
break;
|
||||
default:
|
||||
database.markAsSentFailed(messageId);
|
||||
MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
ApplicationContext.getInstance(context).messageNotifier.notifyMessageDeliveryFailed(context, record.getRecipient(), record.getThreadId());
|
||||
}
|
||||
} catch (NoSuchMessageException e) {
|
||||
Log.w(TAG, e);
|
||||
|
@ -78,7 +78,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
val threadID = archivedConversations.getLong(archivedConversations.getColumnIndex(ThreadDatabase.ID))
|
||||
AsyncTask.execute {
|
||||
threadDatabase.deleteConversation(threadID)
|
||||
MessageNotifier.updateNotification(this)
|
||||
(applicationContext as ApplicationContext).messageNotifier.updateNotification(this)
|
||||
}
|
||||
}
|
||||
deleteThreadAtCurrentPosition()
|
||||
@ -314,7 +314,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
|
||||
ApplicationContext.getInstance(activity).lokiPublicChatAPI!!.leave(publicChat.channel, publicChat.server)
|
||||
}
|
||||
threadDatabase.deleteConversation(threadID)
|
||||
MessageNotifier.updateNotification(activity)
|
||||
ApplicationContext.getInstance(activity).messageNotifier.updateNotification(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
||||
import org.whispersystems.libsignal.logging.Log;
|
||||
@ -66,7 +67,7 @@ public class AndroidAutoHeardReceiver extends BroadcastReceiver {
|
||||
messageIdsCollection.addAll(messageIds);
|
||||
}
|
||||
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
MarkReadReceiver.process(context, messageIdsCollection);
|
||||
|
||||
return null;
|
||||
|
@ -25,6 +25,7 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.RemoteInput;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
||||
@ -86,7 +87,7 @@ public class AndroidAutoReplyReceiver extends BroadcastReceiver {
|
||||
|
||||
List<MarkedMessageInfo> messageIds = DatabaseFactory.getThreadDatabase(context).setRead(replyThreadId, true);
|
||||
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
|
||||
return null;
|
||||
|
@ -6,6 +6,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
|
||||
public class DeleteNotificationReceiver extends BroadcastReceiver {
|
||||
@ -18,7 +19,7 @@ public class DeleteNotificationReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
if (DELETE_NOTIFICATION_ACTION.equals(intent.getAction())) {
|
||||
MessageNotifier.clearReminder(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.clearReminder(context);
|
||||
|
||||
final long[] ids = intent.getLongArrayExtra(EXTRA_IDS);
|
||||
final boolean[] mms = intent.getBooleanArrayExtra(EXTRA_MMS);
|
||||
|
@ -61,7 +61,7 @@ public class MarkReadReceiver extends BroadcastReceiver {
|
||||
|
||||
process(context, messageIdsCollection);
|
||||
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.RemoteInput;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.MessagingDatabase.MarkedMessageInfo;
|
||||
@ -59,7 +60,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
|
||||
|
||||
final Address address = intent.getParcelableExtra(ADDRESS_EXTRA);
|
||||
final ReplyMethod replyMethod = (ReplyMethod) intent.getSerializableExtra(REPLY_METHOD);
|
||||
final CharSequence responseText = remoteInput.getCharSequence(MessageNotifier.EXTRA_REMOTE_REPLY);
|
||||
final CharSequence responseText = remoteInput.getCharSequence(DefaultMessageNotifier.EXTRA_REMOTE_REPLY);
|
||||
|
||||
if (address == null) throw new AssertionError("No address specified");
|
||||
if (replyMethod == null) throw new AssertionError("No reply method specified");
|
||||
@ -91,7 +92,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
|
||||
|
||||
List<MarkedMessageInfo> messageIds = DatabaseFactory.getThreadDatabase(context).setRead(threadId, true);
|
||||
|
||||
MessageNotifier.updateNotification(context);
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
||||
MarkReadReceiver.process(context, messageIds);
|
||||
|
||||
return null;
|
||||
|
@ -177,14 +177,14 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
replyAction = new Action.Builder(R.drawable.ic_reply_white_36dp,
|
||||
actionName,
|
||||
wearableReplyIntent)
|
||||
.addRemoteInput(new RemoteInput.Builder(MessageNotifier.EXTRA_REMOTE_REPLY).setLabel(label).build())
|
||||
.addRemoteInput(new RemoteInput.Builder(DefaultMessageNotifier.EXTRA_REMOTE_REPLY).setLabel(label).build())
|
||||
.build();
|
||||
}
|
||||
|
||||
Action wearableReplyAction = new Action.Builder(R.drawable.ic_reply,
|
||||
actionName,
|
||||
wearableReplyIntent)
|
||||
.addRemoteInput(new RemoteInput.Builder(MessageNotifier.EXTRA_REMOTE_REPLY).setLabel(label).build())
|
||||
.addRemoteInput(new RemoteInput.Builder(DefaultMessageNotifier.EXTRA_REMOTE_REPLY).setLabel(label).build())
|
||||
.build();
|
||||
|
||||
|
||||
|
@ -220,7 +220,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
MessageNotifier.updateNotification(getActivity());
|
||||
ApplicationContext.getInstance(getActivity()).messageNotifier.updateNotification(getActivity());
|
||||
return null;
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -115,7 +115,7 @@ public class KeyCachingService extends Service {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
if (!DatabaseUpgradeActivity.isUpdate(KeyCachingService.this)) {
|
||||
MessageNotifier.updateNotification(KeyCachingService.this);
|
||||
ApplicationContext.getInstance(KeyCachingService.this).messageNotifier.updateNotification(KeyCachingService.this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -188,7 +188,7 @@ public class KeyCachingService extends Service {
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
MessageNotifier.updateNotification(KeyCachingService.this);
|
||||
ApplicationContext.getInstance(KeyCachingService.this).messageNotifier.updateNotification(KeyCachingService.this);
|
||||
return null;
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
@ -721,7 +721,7 @@ public class WebRtcCallService extends Service implements InjectableType,
|
||||
|
||||
private void insertMissedCall(@NonNull Recipient recipient, boolean signal) {
|
||||
Pair<Long, Long> messageAndThreadId = DatabaseFactory.getSmsDatabase(this).insertMissedCall(recipient.getAddress());
|
||||
MessageNotifier.updateNotification(this, messageAndThreadId.second, signal);
|
||||
ApplicationContext.getInstance(this).messageNotifier.updateNotification(this, messageAndThreadId.second, signal);
|
||||
}
|
||||
|
||||
private void handleAnswerCall(Intent intent) {
|
||||
|
@ -6,6 +6,7 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.StringRes;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationContext;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureIdentityKeyStore;
|
||||
import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
@ -143,7 +144,7 @@ public class IdentityUtil {
|
||||
Optional<InsertResult> insertResult = smsDatabase.insertMessageInbox(individualUpdate);
|
||||
|
||||
if (insertResult.isPresent()) {
|
||||
MessageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context, insertResult.get().getThreadId());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user