From c0a26862f3bc42cbd6b3ae7f640bef6cec8e2b6b Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 1 Oct 2015 17:33:10 -0700 Subject: [PATCH] No special missed call notifications. Fixes #4174 // FREEBIE --- .../redphone/RedPhoneService.java | 4 ++- .../redphone/ui/NotificationBarManager.java | 26 +------------------ 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/org/thoughtcrime/redphone/RedPhoneService.java b/src/org/thoughtcrime/redphone/RedPhoneService.java index 577fbac1b2..5af56a3e00 100644 --- a/src/org/thoughtcrime/redphone/RedPhoneService.java +++ b/src/org/thoughtcrime/redphone/RedPhoneService.java @@ -48,8 +48,10 @@ import org.thoughtcrime.redphone.ui.NotificationBarManager; import org.thoughtcrime.redphone.util.Base64; import org.thoughtcrime.redphone.util.UncaughtExceptionHandlerManager; import org.thoughtcrime.securesms.database.DatabaseFactory; +import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientFactory; +import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.util.TextSecurePreferences; import java.io.IOException; @@ -228,7 +230,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS private void handleMissedCall(String remoteNumber) { DatabaseFactory.getSmsDatabase(this).insertMissedCall(remoteNumber); - NotificationBarManager.notifyMissedCall(this, remoteNumber); + MessageNotifier.updateNotification(this, KeyCachingService.getMasterSecret(this)); } private void handleAnswerCall(Intent intent) { diff --git a/src/org/thoughtcrime/redphone/ui/NotificationBarManager.java b/src/org/thoughtcrime/redphone/ui/NotificationBarManager.java index 41142f0d68..30c304c307 100644 --- a/src/org/thoughtcrime/redphone/ui/NotificationBarManager.java +++ b/src/org/thoughtcrime/redphone/ui/NotificationBarManager.java @@ -66,29 +66,5 @@ public class NotificationBarManager { notification.flags = Notification.FLAG_NO_CLEAR; notificationManager.notify(RED_PHONE_NOTIFICATION, notification); } - - public static void notifyMissedCall(Context context, String remoteNumber) { - Intent intent = new Intent(context, ConversationActivity.class); - Recipients notifyRecipients = RecipientFactory.getRecipientsFromString(context, remoteNumber, false); - intent.putExtra("recipients", notifyRecipients.getIds()); - intent.putExtra("thread_id", DatabaseFactory.getThreadDatabase(context).getThreadIdFor(notifyRecipients)); - intent.setData((Uri.parse("custom://" + System.currentTimeMillis()))); - - PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - builder.setSmallIcon(R.drawable.ic_call_missed_grey600_24dp); - builder.setWhen(System.currentTimeMillis()); - builder.setTicker(context.getString(R.string.NotificationBarManager_missed_call_from_s, notifyRecipients.toShortString())); - builder.setContentTitle(context.getString(R.string.NotificationBarManager_missed_signal_call)); - builder.setContentText(context.getString(R.string.NotificationBarManager_missed_call_from_s, notifyRecipients.toShortString())); - builder.setContentIntent(pendingIntent); - builder.setDefaults(Notification.DEFAULT_VIBRATE); - builder.setAutoCancel(true); - - NotificationManager manager = (NotificationManager)context - .getSystemService(Context.NOTIFICATION_SERVICE); - - manager.notify(MISSED_CALL_NOTIFICATION, builder.build()); - } + }