mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Add ContentProvider for user avatars.
This commit is contained in:
@@ -9,6 +9,7 @@ import android.os.Build;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.Person;
|
||||
|
||||
import org.signal.core.util.PendingIntentFlags;
|
||||
import org.thoughtcrime.securesms.MainActivity;
|
||||
@@ -19,10 +20,6 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.service.webrtc.WebRtcCallService;
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.core.Single;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Manages the state of the WebRtc items in the Android notification bar.
|
||||
*
|
||||
@@ -64,7 +61,7 @@ public class CallNotificationBuilder {
|
||||
*/
|
||||
public static final int API_LEVEL_CALL_STYLE = 29;
|
||||
|
||||
public static Single<Notification> getCallInProgressNotification(Context context, int type, Recipient recipient, boolean isVideoCall) {
|
||||
public static Notification getCallInProgressNotification(Context context, int type, Recipient recipient, boolean isVideoCall) {
|
||||
PendingIntent pendingIntent = getActivityPendingIntent(context, LaunchCallScreenIntentState.CONTENT);
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, getNotificationChannel(type))
|
||||
.setSmallIcon(R.drawable.ic_call_secure_white_24dp)
|
||||
@@ -76,33 +73,27 @@ public class CallNotificationBuilder {
|
||||
builder.setContentText(context.getString(R.string.CallNotificationBuilder_connecting));
|
||||
builder.setPriority(NotificationCompat.PRIORITY_MIN);
|
||||
builder.setContentIntent(null);
|
||||
return Single.just(builder.build());
|
||||
return builder.build();
|
||||
} else if (type == TYPE_INCOMING_RINGING) {
|
||||
builder.setContentText(getIncomingCallContentText(context, recipient, isVideoCall));
|
||||
builder.setPriority(NotificationCompat.PRIORITY_HIGH);
|
||||
builder.setCategory(NotificationCompat.CATEGORY_CALL);
|
||||
builder.setFullScreenIntent(pendingIntent, true);
|
||||
|
||||
if (deviceVersionSupportsIncomingCallStyle())
|
||||
{
|
||||
return Single.fromCallable(() -> ConversationUtil.buildPerson(context, recipient))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.map(person -> {
|
||||
builder.setStyle(NotificationCompat.CallStyle.forIncomingCall(
|
||||
person,
|
||||
getServicePendingIntent(context, WebRtcCallService.denyCallIntent(context)),
|
||||
getActivityPendingIntent(context, isVideoCall ? LaunchCallScreenIntentState.VIDEO : LaunchCallScreenIntentState.AUDIO)
|
||||
).setIsVideo(isVideoCall));
|
||||
return builder.build();
|
||||
});
|
||||
} else {
|
||||
return Single.just(builder.build());
|
||||
if (deviceVersionSupportsIncomingCallStyle()) {
|
||||
Person person = ConversationUtil.buildPerson(context, recipient);
|
||||
builder.setStyle(NotificationCompat.CallStyle.forIncomingCall(
|
||||
person,
|
||||
getServicePendingIntent(context, WebRtcCallService.denyCallIntent(context)),
|
||||
getActivityPendingIntent(context, isVideoCall ? LaunchCallScreenIntentState.VIDEO : LaunchCallScreenIntentState.AUDIO)
|
||||
).setIsVideo(isVideoCall));
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
} else if (type == TYPE_OUTGOING_RINGING) {
|
||||
builder.setContentText(context.getString(R.string.NotificationBarManager__establishing_signal_call));
|
||||
builder.addAction(getServiceNotificationAction(context, WebRtcCallService.hangupIntent(context), R.drawable.ic_call_end_grey600_32dp, R.string.NotificationBarManager__cancel_call));
|
||||
return Single.just(builder.build());
|
||||
return builder.build();
|
||||
} else {
|
||||
builder.setContentText(getOngoingCallContentText(context, recipient, isVideoCall));
|
||||
builder.setOnlyAlertOnce(true);
|
||||
@@ -110,19 +101,14 @@ public class CallNotificationBuilder {
|
||||
builder.setCategory(NotificationCompat.CATEGORY_CALL);
|
||||
|
||||
if (deviceVersionSupportsIncomingCallStyle()) {
|
||||
return Single.fromCallable(() -> ConversationUtil.buildPerson(context, recipient))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.map(person -> {
|
||||
builder.setStyle(NotificationCompat.CallStyle.forOngoingCall(
|
||||
person,
|
||||
getServicePendingIntent(context, WebRtcCallService.hangupIntent(context))
|
||||
).setIsVideo(isVideoCall));
|
||||
return builder.build();
|
||||
});
|
||||
} else {
|
||||
return Single.just(builder.build());
|
||||
Person person = ConversationUtil.buildPerson(context, recipient);
|
||||
builder.setStyle(NotificationCompat.CallStyle.forOngoingCall(
|
||||
person,
|
||||
getServicePendingIntent(context, WebRtcCallService.hangupIntent(context))
|
||||
).setIsVideo(isVideoCall));
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user