mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-17 21:47:28 +00:00
parent
432e229698
commit
2642f4f15d
@ -30,6 +30,7 @@ import android.support.annotation.Nullable;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.thoughtcrime.redphone.audio.IncomingRinger;
|
||||
import org.thoughtcrime.redphone.audio.OutgoingRinger;
|
||||
@ -228,7 +229,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
return;
|
||||
}
|
||||
|
||||
handleMissedCall(intent.getStringExtra(EXTRA_REMOTE_NUMBER));
|
||||
handleMissedCall(intent.getStringExtra(EXTRA_REMOTE_NUMBER), false);
|
||||
|
||||
try {
|
||||
SignalingSocket signalingSocket = new SignalingSocket(this, session.getFullServerName(),
|
||||
@ -243,9 +244,10 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
}
|
||||
}
|
||||
|
||||
private void handleMissedCall(String remoteNumber) {
|
||||
DatabaseFactory.getSmsDatabase(this).insertMissedCall(remoteNumber);
|
||||
MessageNotifier.updateNotification(this, KeyCachingService.getMasterSecret(this));
|
||||
private void handleMissedCall(String remoteNumber, boolean signal) {
|
||||
Pair<Long, Long> messageAndThreadId = DatabaseFactory.getSmsDatabase(this).insertMissedCall(remoteNumber);
|
||||
MessageNotifier.updateNotification(this, KeyCachingService.getMasterSecret(this),
|
||||
false, messageAndThreadId.second, signal);
|
||||
}
|
||||
|
||||
private void handleAnswerCall(Intent intent) {
|
||||
@ -381,7 +383,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
|
||||
public void notifyCallStale() {
|
||||
Log.w(TAG, "Got a stale call, probably an old SMS...");
|
||||
handleMissedCall(remoteNumber);
|
||||
handleMissedCall(remoteNumber, true);
|
||||
this.terminate();
|
||||
}
|
||||
|
||||
@ -431,7 +433,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
|
||||
public void notifyCallDisconnected() {
|
||||
if (state == STATE_RINGING)
|
||||
handleMissedCall(remoteNumber);
|
||||
handleMissedCall(remoteNumber, false);
|
||||
|
||||
sendMessage(Type.CALL_DISCONNECTED, getRecipient(), null);
|
||||
this.terminate();
|
||||
@ -458,7 +460,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
|
||||
public void notifyServerFailure() {
|
||||
if (state == STATE_RINGING)
|
||||
handleMissedCall(remoteNumber);
|
||||
handleMissedCall(remoteNumber, true);
|
||||
|
||||
state = STATE_IDLE;
|
||||
outgoingRinger.playFailure();
|
||||
@ -468,7 +470,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
|
||||
public void notifyClientFailure() {
|
||||
if (state == STATE_RINGING)
|
||||
handleMissedCall(remoteNumber);
|
||||
handleMissedCall(remoteNumber, false);
|
||||
|
||||
state = STATE_IDLE;
|
||||
outgoingRinger.playFailure();
|
||||
@ -478,7 +480,7 @@ public class RedPhoneService extends Service implements CallStateListener, CallS
|
||||
|
||||
public void notifyLoginFailed() {
|
||||
if (state == STATE_RINGING)
|
||||
handleMissedCall(remoteNumber);
|
||||
handleMissedCall(remoteNumber, true);
|
||||
|
||||
state = STATE_IDLE;
|
||||
outgoingRinger.playFailure();
|
||||
|
Loading…
x
Reference in New Issue
Block a user