mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 13:58:25 +00:00
parent
214629e2db
commit
c0a26862f3
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user