mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add support for MISSED_VIDEO_CALL type.
This commit is contained in:
@@ -108,7 +108,7 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns
|
||||
public abstract void markUnidentified(long messageId, boolean unidentified);
|
||||
public abstract void markAsSending(long messageId);
|
||||
public abstract void markAsRemoteDelete(long messageId);
|
||||
public abstract void markAsMissedCall(long id);
|
||||
public abstract void markAsMissedCall(long id, boolean isVideoOffer);
|
||||
public abstract void markAsNotified(long id);
|
||||
public abstract void markSmsStatus(long id, int status);
|
||||
public abstract void markDownloadState(long messageId, long state);
|
||||
@@ -126,7 +126,7 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns
|
||||
|
||||
public abstract @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address);
|
||||
public abstract @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address);
|
||||
public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp);
|
||||
public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp, boolean isVideoOffer);
|
||||
|
||||
public abstract Optional<InsertResult> insertMessageInbox(IncomingTextMessage message, long type);
|
||||
public abstract Optional<InsertResult> insertMessageInbox(IncomingTextMessage message);
|
||||
|
||||
@@ -365,7 +365,7 @@ public class MmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsMissedCall(long id) {
|
||||
public void markAsMissedCall(long id, boolean isVideoOffer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ public class MmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp) {
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp, boolean isVideoOffer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,12 @@ public interface MmsSmsColumns {
|
||||
|
||||
protected static final long INCOMING_CALL_TYPE = 1;
|
||||
protected static final long OUTGOING_CALL_TYPE = 2;
|
||||
protected static final long MISSED_CALL_TYPE = 3;
|
||||
protected static final long MISSED_AUDIO_CALL_TYPE = 3;
|
||||
protected static final long JOINED_TYPE = 4;
|
||||
protected static final long UNSUPPORTED_MESSAGE_TYPE = 5;
|
||||
protected static final long INVALID_MESSAGE_TYPE = 6;
|
||||
protected static final long PROFILE_CHANGE_TYPE = 7;
|
||||
protected static final long MISSED_VIDEO_CALL_TYPE = 8;
|
||||
|
||||
protected static final long BASE_INBOX_TYPE = 20;
|
||||
protected static final long BASE_OUTBOX_TYPE = 21;
|
||||
@@ -204,7 +205,7 @@ public interface MmsSmsColumns {
|
||||
}
|
||||
|
||||
public static boolean isCallLog(long type) {
|
||||
return type == INCOMING_CALL_TYPE || type == OUTGOING_CALL_TYPE || type == MISSED_CALL_TYPE;
|
||||
return type == INCOMING_CALL_TYPE || type == OUTGOING_CALL_TYPE || type == MISSED_AUDIO_CALL_TYPE || type == MISSED_VIDEO_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isExpirationTimerUpdate(long type) {
|
||||
@@ -219,8 +220,12 @@ public interface MmsSmsColumns {
|
||||
return type == OUTGOING_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isMissedCall(long type) {
|
||||
return type == MISSED_CALL_TYPE;
|
||||
public static boolean isMissedAudioCall(long type) {
|
||||
return type == MISSED_AUDIO_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isMissedVideoCall(long type) {
|
||||
return type == MISSED_VIDEO_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isGroupUpdate(long type) {
|
||||
|
||||
@@ -364,8 +364,8 @@ public class SmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsMissedCall(long id) {
|
||||
updateTypeBitmask(id, Types.TOTAL_MASK, Types.MISSED_CALL_TYPE);
|
||||
public void markAsMissedCall(long id, boolean isVideoOffer) {
|
||||
updateTypeBitmask(id, Types.TOTAL_MASK, isVideoOffer ? Types.MISSED_VIDEO_CALL_TYPE : Types.MISSED_AUDIO_CALL_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -633,12 +633,13 @@ public class SmsDatabase extends MessageDatabase {
|
||||
@Override
|
||||
public boolean hasReceivedAnyCallsSince(long threadId, long timestamp) {
|
||||
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||
String[] projection = new String[]{SmsDatabase.TYPE};
|
||||
String selection = THREAD_ID + " = ? AND " + DATE_RECEIVED + " > ? AND (" + TYPE + " = ? OR " + TYPE + " = ?)";
|
||||
String[] selectionArgs = new String[]{String.valueOf(threadId),
|
||||
String.valueOf(timestamp),
|
||||
String.valueOf(Types.INCOMING_CALL_TYPE),
|
||||
String.valueOf(Types.MISSED_CALL_TYPE)};
|
||||
String[] projection = SqlUtil.buildArgs(SmsDatabase.TYPE);
|
||||
String selection = THREAD_ID + " = ? AND " + DATE_RECEIVED + " > ? AND (" + TYPE + " = ? OR " + TYPE + " = ? OR " + TYPE + " =?)";
|
||||
String[] selectionArgs = SqlUtil.buildArgs(threadId,
|
||||
timestamp,
|
||||
Types.INCOMING_CALL_TYPE,
|
||||
Types.MISSED_AUDIO_CALL_TYPE,
|
||||
Types.MISSED_VIDEO_CALL_TYPE);
|
||||
|
||||
try (Cursor cursor = db.query(TABLE_NAME, projection, selection, selectionArgs, null, null, null)) {
|
||||
return cursor != null && cursor.moveToFirst();
|
||||
@@ -656,8 +657,8 @@ public class SmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp) {
|
||||
return insertCallLog(address, Types.MISSED_CALL_TYPE, true, timestamp);
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp, boolean isVideoCall) {
|
||||
return insertCallLog(address, isVideoCall ? Types.MISSED_VIDEO_CALL_TYPE : Types.MISSED_AUDIO_CALL_TYPE, true, timestamp);
|
||||
}
|
||||
|
||||
private @NonNull Pair<Long, Long> insertCallLog(@NonNull RecipientId recipientId, long type, boolean unread, long timestamp) {
|
||||
|
||||
@@ -148,8 +148,12 @@ public abstract class DisplayRecord {
|
||||
return SmsDatabase.Types.isOutgoingCall(type);
|
||||
}
|
||||
|
||||
public boolean isMissedCall() {
|
||||
return SmsDatabase.Types.isMissedCall(type);
|
||||
public final boolean isMissedAudioCall() {
|
||||
return SmsDatabase.Types.isMissedAudioCall(type);
|
||||
}
|
||||
|
||||
public final boolean isMissedVideoCall() {
|
||||
return SmsDatabase.Types.isMissedVideoCall(type);
|
||||
}
|
||||
|
||||
public boolean isVerificationStatusChange() {
|
||||
|
||||
@@ -144,8 +144,10 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
return fromRecipient(getIndividualRecipient(), r -> context.getString(R.string.MessageRecord_s_called_you_date, r.getDisplayName(context), getCallDateString(context)), R.drawable.ic_update_audio_call_incoming_light_16, R.drawable.ic_update_audio_call_incoming_dark_16);
|
||||
} else if (isOutgoingCall()) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_you_called_date, getCallDateString(context)), R.drawable.ic_update_audio_call_outgoing_light_16, R.drawable.ic_update_audio_call_outgoing_dark_16);
|
||||
} else if (isMissedCall()) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_missed_call_date, getCallDateString(context)), R.drawable.ic_update_audio_call_missed_light_16, R.drawable.ic_update_audio_call_missed_dark_16, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red));
|
||||
} else if (isMissedAudioCall()) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_missed_audio_call_date, getCallDateString(context)), R.drawable.ic_update_audio_call_missed_light_16, R.drawable.ic_update_audio_call_missed_dark_16, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red));
|
||||
} else if (isMissedVideoCall()) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_missed_video_call_date, getCallDateString(context)), R.drawable.ic_update_video_call_missed_light_16, R.drawable.ic_update_video_call_missed_dark_16, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red));
|
||||
} else if (isJoined()) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_s_joined_signal, getIndividualRecipient().getDisplayName(context)), R.drawable.ic_update_group_add_light_16, R.drawable.ic_update_group_add_dark_16);
|
||||
} else if (isExpirationTimerUpdate()) {
|
||||
|
||||
Reference in New Issue
Block a user