Files
Android/src/org/thoughtcrime/securesms/events/WebRtcViewModel.java
T
Moxie Marlinspike 737810475e Remove the Canonical Address Database
This was a holdover from Signal's origins as a pure SMS app.
It causes problems, depends on undefined device specific behavior,
and should no longer be necessary now that we have all the
information we need to E164 all numbers.

// FREEBIE
2017-07-31 12:02:29 -07:00

94 lines
2.6 KiB
Java

package org.thoughtcrime.securesms.events;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.whispersystems.libsignal.IdentityKey;
public class WebRtcViewModel {
public enum State {
// Normal states
CALL_INCOMING,
CALL_OUTGOING,
CALL_CONNECTED,
CALL_RINGING,
CALL_BUSY,
CALL_DISCONNECTED,
// Error states
NETWORK_FAILURE,
RECIPIENT_UNAVAILABLE,
NO_SUCH_USER,
UNTRUSTED_IDENTITY,
}
private final @NonNull State state;
private final @NonNull Recipient recipient;
private final @Nullable IdentityKey identityKey;
private final boolean remoteVideoEnabled;
private final boolean localVideoEnabled;
private final boolean isBluetoothAvailable;
private final boolean isMicrophoneEnabled;
public WebRtcViewModel(@NonNull State state, @NonNull Recipient recipient,
boolean localVideoEnabled, boolean remoteVideoEnabled,
boolean isBluetoothAvailable, boolean isMicrophoneEnabled)
{
this(state, recipient, null,
localVideoEnabled, remoteVideoEnabled,
isBluetoothAvailable, isMicrophoneEnabled);
}
public WebRtcViewModel(@NonNull State state, @NonNull Recipient recipient,
@Nullable IdentityKey identityKey,
boolean localVideoEnabled, boolean remoteVideoEnabled,
boolean isBluetoothAvailable, boolean isMicrophoneEnabled)
{
this.state = state;
this.recipient = recipient;
this.identityKey = identityKey;
this.localVideoEnabled = localVideoEnabled;
this.remoteVideoEnabled = remoteVideoEnabled;
this.isBluetoothAvailable = isBluetoothAvailable;
this.isMicrophoneEnabled = isMicrophoneEnabled;
}
public @NonNull State getState() {
return state;
}
public @NonNull Recipient getRecipient() {
return recipient;
}
@Nullable
public IdentityKey getIdentityKey() {
return identityKey;
}
public boolean isRemoteVideoEnabled() {
return remoteVideoEnabled;
}
public boolean isLocalVideoEnabled() {
return localVideoEnabled;
}
public boolean isBluetoothAvailable() {
return isBluetoothAvailable;
}
public boolean isMicrophoneEnabled() {
return isMicrophoneEnabled;
}
public String toString() {
return "[State: " + state + ", recipient: " + recipient.getAddress() + ", identity: " + identityKey + ", remoteVideo: " + remoteVideoEnabled + ", localVideo: " + localVideoEnabled + "]";
}
}