Add support for Incoming / Outgoing Video Type.
This commit is contained in:
parent
9f882d2fbb
commit
2b4a4d6109
10 changed files with 70 additions and 33 deletions
|
@ -366,7 +366,11 @@ public final class ConversationListItem extends RelativeLayout
|
|||
}
|
||||
|
||||
private void setStatusIcons(ThreadRecord thread) {
|
||||
if (!thread.isOutgoing() || thread.isOutgoingCall() || thread.isVerificationStatusChange()) {
|
||||
if (!thread.isOutgoing() ||
|
||||
thread.isOutgoingAudioCall() ||
|
||||
thread.isOutgoingVideoCall() ||
|
||||
thread.isVerificationStatusChange())
|
||||
{
|
||||
deliveryStatusIndicator.setNone();
|
||||
alertView.setNone();
|
||||
} else if (thread.isFailed()) {
|
||||
|
@ -446,9 +450,9 @@ public final class ConversationListItem extends RelativeLayout
|
|||
} else if (MmsSmsColumns.Types.isDraftMessageType(thread.getType())) {
|
||||
String draftText = context.getString(R.string.ThreadRecord_draft);
|
||||
return emphasisAdded(context, draftText + " " + thread.getBody());
|
||||
} else if (SmsDatabase.Types.isOutgoingCall(thread.getType())) {
|
||||
} else if (SmsDatabase.Types.isOutgoingAudioCall(thread.getType()) || SmsDatabase.Types.isOutgoingVideoCall(thread.getType())) {
|
||||
return emphasisAdded(context, context.getString(R.string.ThreadRecord_called));
|
||||
} else if (SmsDatabase.Types.isIncomingCall(thread.getType())) {
|
||||
} else if (SmsDatabase.Types.isIncomingAudioCall(thread.getType()) || SmsDatabase.Types.isIncomingVideoCall(thread.getType())) {
|
||||
return emphasisAdded(context, context.getString(R.string.ThreadRecord_called_you));
|
||||
} else if (SmsDatabase.Types.isMissedAudioCall(thread.getType())) {
|
||||
return emphasisAdded(context, context.getString(R.string.ThreadRecord_missed_audio_call));
|
||||
|
|
|
@ -126,8 +126,8 @@ public abstract class MessageDatabase extends Database implements MmsSmsColumns
|
|||
public abstract void addFailures(long messageId, List<NetworkFailure> failure);
|
||||
public abstract void removeFailure(long messageId, NetworkFailure failure);
|
||||
|
||||
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> insertReceivedCall(@NonNull RecipientId address, boolean isVideoOffer);
|
||||
public abstract @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address, boolean isVideoOffer);
|
||||
public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp, boolean isVideoOffer);
|
||||
|
||||
public abstract Optional<InsertResult> insertMessageInbox(IncomingTextMessage message, long type);
|
||||
|
|
|
@ -380,12 +380,12 @@ public class MmsDatabase extends MessageDatabase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address) {
|
||||
public @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address, boolean isVideoOffer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address) {
|
||||
public @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address, boolean isVideoOffer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ public interface MmsSmsColumns {
|
|||
// Base Types
|
||||
protected static final long BASE_TYPE_MASK = 0x1F;
|
||||
|
||||
protected static final long INCOMING_CALL_TYPE = 1;
|
||||
protected static final long OUTGOING_CALL_TYPE = 2;
|
||||
protected static final long INCOMING_AUDIO_CALL_TYPE = 1;
|
||||
protected static final long OUTGOING_AUDIO_CALL_TYPE = 2;
|
||||
protected static final long MISSED_AUDIO_CALL_TYPE = 3;
|
||||
protected static final long JOINED_TYPE = 4;
|
||||
protected static final long UNSUPPORTED_MESSAGE_TYPE = 5;
|
||||
|
@ -41,6 +41,8 @@ public interface MmsSmsColumns {
|
|||
protected static final long PROFILE_CHANGE_TYPE = 7;
|
||||
protected static final long MISSED_VIDEO_CALL_TYPE = 8;
|
||||
protected static final long GV1_MIGRATION_TYPE = 9;
|
||||
protected static final long INCOMING_VIDEO_CALL_TYPE = 10;
|
||||
protected static final long OUTGOING_VIDEO_CALL_TYPE = 11;
|
||||
|
||||
protected static final long BASE_INBOX_TYPE = 20;
|
||||
protected static final long BASE_OUTBOX_TYPE = 21;
|
||||
|
@ -55,7 +57,7 @@ public interface MmsSmsColumns {
|
|||
BASE_SENDING_TYPE, BASE_SENT_FAILED_TYPE,
|
||||
BASE_PENDING_SECURE_SMS_FALLBACK,
|
||||
BASE_PENDING_INSECURE_SMS_FALLBACK,
|
||||
OUTGOING_CALL_TYPE};
|
||||
OUTGOING_AUDIO_CALL_TYPE, OUTGOING_VIDEO_CALL_TYPE};
|
||||
|
||||
// Message attributes
|
||||
protected static final long MESSAGE_ATTRIBUTE_MASK = 0xE0;
|
||||
|
@ -206,21 +208,35 @@ public interface MmsSmsColumns {
|
|||
}
|
||||
|
||||
public static boolean isCallLog(long type) {
|
||||
return type == INCOMING_CALL_TYPE || type == OUTGOING_CALL_TYPE || type == MISSED_AUDIO_CALL_TYPE || type == MISSED_VIDEO_CALL_TYPE;
|
||||
return isIncomingAudioCall(type) ||
|
||||
isIncomingVideoCall(type) ||
|
||||
isOutgoingAudioCall(type) ||
|
||||
isOutgoingVideoCall(type) ||
|
||||
isMissedAudioCall(type) ||
|
||||
isMissedVideoCall(type);
|
||||
}
|
||||
|
||||
public static boolean isExpirationTimerUpdate(long type) {
|
||||
return (type & EXPIRATION_TIMER_UPDATE_BIT) != 0;
|
||||
}
|
||||
|
||||
public static boolean isIncomingCall(long type) {
|
||||
return type == INCOMING_CALL_TYPE;
|
||||
public static boolean isIncomingAudioCall(long type) {
|
||||
return type == INCOMING_AUDIO_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isOutgoingCall(long type) {
|
||||
return type == OUTGOING_CALL_TYPE;
|
||||
public static boolean isIncomingVideoCall(long type) {
|
||||
return type == INCOMING_VIDEO_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isOutgoingAudioCall(long type) {
|
||||
return type == OUTGOING_AUDIO_CALL_TYPE;
|
||||
}
|
||||
|
||||
public static boolean isOutgoingVideoCall(long type) {
|
||||
return type == OUTGOING_VIDEO_CALL_TYPE;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isMissedAudioCall(long type) {
|
||||
return type == MISSED_AUDIO_CALL_TYPE;
|
||||
}
|
||||
|
|
|
@ -634,10 +634,11 @@ public class SmsDatabase extends MessageDatabase {
|
|||
public boolean hasReceivedAnyCallsSince(long threadId, long timestamp) {
|
||||
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||
String[] projection = SqlUtil.buildArgs(SmsDatabase.TYPE);
|
||||
String selection = THREAD_ID + " = ? AND " + DATE_RECEIVED + " > ? AND (" + TYPE + " = ? OR " + TYPE + " = ? OR " + TYPE + " =?)";
|
||||
String selection = THREAD_ID + " = ? AND " + DATE_RECEIVED + " > ? AND (" + TYPE + " = ? OR " + TYPE + " = ? OR " + TYPE + " = ? OR " + TYPE + " =?)";
|
||||
String[] selectionArgs = SqlUtil.buildArgs(threadId,
|
||||
timestamp,
|
||||
Types.INCOMING_CALL_TYPE,
|
||||
Types.INCOMING_AUDIO_CALL_TYPE,
|
||||
Types.INCOMING_VIDEO_CALL_TYPE,
|
||||
Types.MISSED_AUDIO_CALL_TYPE,
|
||||
Types.MISSED_VIDEO_CALL_TYPE);
|
||||
|
||||
|
@ -647,18 +648,18 @@ public class SmsDatabase extends MessageDatabase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address) {
|
||||
return insertCallLog(address, Types.INCOMING_CALL_TYPE, false, System.currentTimeMillis());
|
||||
public @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address, boolean isVideoOffer) {
|
||||
return insertCallLog(address, isVideoOffer ? Types.INCOMING_VIDEO_CALL_TYPE : Types.INCOMING_AUDIO_CALL_TYPE, false, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address) {
|
||||
return insertCallLog(address, Types.OUTGOING_CALL_TYPE, false, System.currentTimeMillis());
|
||||
public @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address, boolean isVideoOffer) {
|
||||
return insertCallLog(address, isVideoOffer ? Types.OUTGOING_VIDEO_CALL_TYPE : Types.OUTGOING_AUDIO_CALL_TYPE, false, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp, boolean isVideoOffer) {
|
||||
return insertCallLog(address, isVideoOffer ? 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) {
|
||||
|
|
|
@ -140,12 +140,20 @@ public abstract class DisplayRecord {
|
|||
return SmsDatabase.Types.isJoinedType(type);
|
||||
}
|
||||
|
||||
public boolean isIncomingCall() {
|
||||
return SmsDatabase.Types.isIncomingCall(type);
|
||||
public boolean isIncomingAudioCall() {
|
||||
return SmsDatabase.Types.isIncomingAudioCall(type);
|
||||
}
|
||||
|
||||
public boolean isOutgoingCall() {
|
||||
return SmsDatabase.Types.isOutgoingCall(type);
|
||||
public boolean isIncomingVideoCall() {
|
||||
return SmsDatabase.Types.isIncomingVideoCall(type);
|
||||
}
|
||||
|
||||
public boolean isOutgoingAudioCall() {
|
||||
return SmsDatabase.Types.isOutgoingAudioCall(type);
|
||||
}
|
||||
|
||||
public boolean isOutgoingVideoCall() {
|
||||
return SmsDatabase.Types.isOutgoingVideoCall(type);
|
||||
}
|
||||
|
||||
public final boolean isMissedAudioCall() {
|
||||
|
|
|
@ -140,10 +140,14 @@ public abstract class MessageRecord extends DisplayRecord {
|
|||
return staticUpdateDescription(context.getString(R.string.MessageRecord_left_group), R.drawable.ic_update_group_leave_light_16, R.drawable.ic_update_group_leave_dark_16);
|
||||
} else if (isGroupQuit()) {
|
||||
return fromRecipient(getIndividualRecipient(), r -> context.getString(R.string.ConversationItem_group_action_left, r.getDisplayName(context)), R.drawable.ic_update_group_leave_light_16, R.drawable.ic_update_group_leave_dark_16);
|
||||
} else if (isIncomingCall()) {
|
||||
} else if (isIncomingAudioCall()) {
|
||||
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()) {
|
||||
} else if (isIncomingVideoCall()) {
|
||||
return fromRecipient(getIndividualRecipient(), r -> context.getString(R.string.MessageRecord_s_called_you_date, r.getDisplayName(context), getCallDateString(context)), R.drawable.ic_update_video_call_incomg_light_16, R.drawable.ic_update_video_call_incoming_dark_16);
|
||||
} else if (isOutgoingAudioCall()) {
|
||||
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 (isOutgoingVideoCall()) {
|
||||
return staticUpdateDescription(context.getString(R.string.MessageRecord_you_called_date, getCallDateString(context)), R.drawable.ic_update_video_call_outgoing_light_16, R.drawable.ic_update_video_call_outgoing_dark_16);
|
||||
} 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()) {
|
||||
|
|
|
@ -147,8 +147,12 @@ public final class ThreadRecord {
|
|||
return MmsSmsColumns.Types.isOutgoingMessageType(type);
|
||||
}
|
||||
|
||||
public boolean isOutgoingCall() {
|
||||
return SmsDatabase.Types.isOutgoingCall(type);
|
||||
public boolean isOutgoingAudioCall() {
|
||||
return SmsDatabase.Types.isOutgoingAudioCall(type);
|
||||
}
|
||||
|
||||
public boolean isOutgoingVideoCall() {
|
||||
return SmsDatabase.Types.isOutgoingVideoCall(type);
|
||||
}
|
||||
|
||||
public boolean isVerificationStatusChange() {
|
||||
|
|
|
@ -108,7 +108,7 @@ public class IncomingCallActionProcessor extends DeviceAwareActionProcessor {
|
|||
|
||||
Log.i(TAG, "handleAcceptCall(): call_id: " + activePeer.getCallId());
|
||||
|
||||
DatabaseFactory.getSmsDatabase(context).insertReceivedCall(activePeer.getId());
|
||||
DatabaseFactory.getSmsDatabase(context).insertReceivedCall(activePeer.getId(), currentState.getCallSetupState().isRemoteVideoOffer());
|
||||
|
||||
currentState = currentState.builder()
|
||||
.changeCallSetupState()
|
||||
|
|
|
@ -76,7 +76,7 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
|
|||
|
||||
webRtcInteractor.setCallInProgressNotification(TYPE_OUTGOING_RINGING, remotePeer);
|
||||
|
||||
DatabaseFactory.getSmsDatabase(context).insertOutgoingCall(remotePeer.getId());
|
||||
DatabaseFactory.getSmsDatabase(context).insertOutgoingCall(remotePeer.getId(), currentState.getCallSetupState().isEnableVideoOnCreate());
|
||||
|
||||
webRtcInteractor.retrieveTurnServers(remotePeer);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue