mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-08 17:08:34 +00:00
parent
18957b1f41
commit
15ee8c6cac
@ -186,7 +186,7 @@ public final class ConversationUpdateItem extends LinearLayout
|
||||
else if (messageRecord.isOutgoingCall()) icon.setImageResource(R.drawable.ic_call_made_grey600_24dp);
|
||||
else icon.setImageResource(R.drawable.ic_call_missed_grey600_24dp);
|
||||
|
||||
date.setText(DateUtils.getExtendedRelativeTimeSpanString(getContext(), locale, messageRecord.getDateReceived()));
|
||||
date.setText(DateUtils.getExtendedRelativeTimeSpanString(getContext(), locale, messageRecord.getDateSent()));
|
||||
|
||||
title.setVisibility(GONE);
|
||||
date.setVisibility(View.VISIBLE);
|
||||
|
@ -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);
|
||||
public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp);
|
||||
|
||||
public abstract Optional<InsertResult> insertMessageInbox(IncomingTextMessage message, long type);
|
||||
public abstract Optional<InsertResult> insertMessageInbox(IncomingTextMessage message);
|
||||
|
@ -389,7 +389,7 @@ public class MmsDatabase extends MessageDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address) {
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -644,20 +644,20 @@ public class SmsDatabase extends MessageDatabase {
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address) {
|
||||
return insertCallLog(address, Types.INCOMING_CALL_TYPE, false);
|
||||
return insertCallLog(address, Types.INCOMING_CALL_TYPE, false, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address) {
|
||||
return insertCallLog(address, Types.OUTGOING_CALL_TYPE, false);
|
||||
return insertCallLog(address, Types.OUTGOING_CALL_TYPE, false, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address) {
|
||||
return insertCallLog(address, Types.MISSED_CALL_TYPE, true);
|
||||
public @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp) {
|
||||
return insertCallLog(address, Types.MISSED_CALL_TYPE, true, timestamp);
|
||||
}
|
||||
|
||||
private @NonNull Pair<Long, Long> insertCallLog(@NonNull RecipientId recipientId, long type, boolean unread) {
|
||||
private @NonNull Pair<Long, Long> insertCallLog(@NonNull RecipientId recipientId, long type, boolean unread, long timestamp) {
|
||||
Recipient recipient = Recipient.resolved(recipientId);
|
||||
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient);
|
||||
|
||||
@ -665,7 +665,7 @@ public class SmsDatabase extends MessageDatabase {
|
||||
values.put(RECIPIENT_ID, recipientId.serialize());
|
||||
values.put(ADDRESS_DEVICE_ID, 1);
|
||||
values.put(DATE_RECEIVED, System.currentTimeMillis());
|
||||
values.put(DATE_SENT, System.currentTimeMillis());
|
||||
values.put(DATE_SENT, timestamp);
|
||||
values.put(READ, unread ? 0 : 1);
|
||||
values.put(TYPE, type);
|
||||
values.put(THREAD_ID, threadId);
|
||||
|
@ -270,7 +270,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
if (isPush() && getDateSent() < getDateReceived()) {
|
||||
if ((isPush() || isCallLog()) && getDateSent() < getDateReceived()) {
|
||||
return getDateSent();
|
||||
}
|
||||
return getDateReceived();
|
||||
|
@ -80,7 +80,6 @@ import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserExce
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -202,6 +201,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
@Nullable private RemotePeer busyPeer;
|
||||
@Nullable private RemotePeer preJoinPeer;
|
||||
@Nullable private SparseArray<RemotePeer> peerMap;
|
||||
private long callStartTimestamp;
|
||||
|
||||
@Nullable private EglBase eglBase;
|
||||
@Nullable private BroadcastVideoSink localSink;
|
||||
@ -422,7 +422,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
Log.i(TAG, "PSTN line is busy.");
|
||||
intent.putExtra(EXTRA_BROADCAST, true);
|
||||
handleSendBusy(intent);
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, serverReceivedTimestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -431,11 +431,12 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
intent.putExtra(EXTRA_BROADCAST, true);
|
||||
intent.putExtra(EXTRA_HANGUP_TYPE, HangupMessage.Type.NEED_PERMISSION.getCode());
|
||||
handleSendHangup(intent);
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, serverReceivedTimestamp);
|
||||
return;
|
||||
}
|
||||
|
||||
peerMap.append(remotePeer.hashCode(), remotePeer);
|
||||
callStartTimestamp = serverReceivedTimestamp;
|
||||
Log.i(TAG, "add remotePeer callId: " + remotePeer.getCallId() + " key: " + remotePeer.hashCode());
|
||||
|
||||
isRemoteVideoOffer = offerType == OfferMessage.Type.VIDEO_CALL;
|
||||
@ -523,6 +524,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
EventBus.getDefault().removeStickyEvent(WebRtcViewModel.class);
|
||||
|
||||
peerMap.append(remotePeer.hashCode(), remotePeer);
|
||||
callStartTimestamp = System.currentTimeMillis();
|
||||
Log.i(TAG, "add remotePeer callId: " + remotePeer.getCallId() + " key: " + remotePeer.hashCode());
|
||||
|
||||
initializeVideo();
|
||||
@ -552,8 +554,8 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
}
|
||||
}
|
||||
|
||||
private void insertMissedCall(@NonNull RemotePeer remotePeer, boolean signal) {
|
||||
Pair<Long, Long> messageAndThreadId = DatabaseFactory.getSmsDatabase(this).insertMissedCall(remotePeer.getId());
|
||||
private void insertMissedCall(@NonNull RemotePeer remotePeer, boolean signal, long timestamp) {
|
||||
Pair<Long, Long> messageAndThreadId = DatabaseFactory.getSmsDatabase(this).insertMissedCall(remotePeer.getId(), timestamp);
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(this, messageAndThreadId.second(), signal);
|
||||
}
|
||||
|
||||
@ -572,7 +574,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
|
||||
try {
|
||||
callManager.hangup();
|
||||
DatabaseFactory.getSmsDatabase(this).insertMissedCall(activePeer.getId());
|
||||
DatabaseFactory.getSmsDatabase(this).insertMissedCall(activePeer.getId(), System.currentTimeMillis());
|
||||
terminate(activePeer);
|
||||
} catch (CallException e) {
|
||||
callFailure("hangup() failed: ", e);
|
||||
@ -1166,7 +1168,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
|
||||
Log.i(TAG, "handleReceivedOfferExpired(): call_id: " + remotePeer.getCallId());
|
||||
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, callStartTimestamp);
|
||||
|
||||
terminate(remotePeer);
|
||||
}
|
||||
@ -1195,7 +1197,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
stopForeground(true);
|
||||
}
|
||||
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, callStartTimestamp);
|
||||
|
||||
terminate(remotePeer);
|
||||
}
|
||||
@ -1216,7 +1218,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
|
||||
boolean incomingBeforeAccept = remotePeer.getState() == CallState.ANSWERING || remotePeer.getState() == CallState.LOCAL_RINGING;
|
||||
if (incomingBeforeAccept) {
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, callStartTimestamp);
|
||||
}
|
||||
|
||||
terminate(remotePeer);
|
||||
@ -1303,7 +1305,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
|
||||
boolean incomingBeforeAccept = remotePeer.getState() == CallState.ANSWERING || remotePeer.getState() == CallState.LOCAL_RINGING;
|
||||
if (incomingBeforeAccept) {
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, callStartTimestamp);
|
||||
}
|
||||
|
||||
terminate(remotePeer);
|
||||
@ -1319,7 +1321,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
|
||||
}
|
||||
|
||||
if (remotePeer.getState() == CallState.ANSWERING || remotePeer.getState() == CallState.LOCAL_RINGING) {
|
||||
insertMissedCall(remotePeer, true);
|
||||
insertMissedCall(remotePeer, true, callStartTimestamp);
|
||||
}
|
||||
|
||||
terminate(remotePeer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user