feat: hanging up and bottom sheet behaviors should work now

This commit is contained in:
Harris
2021-09-06 17:06:03 +10:00
parent b3576336d9
commit 459dfa72c2
4 changed files with 126 additions and 61 deletions

View File

@@ -13,7 +13,8 @@ class CallMessage(): ControlMessage() {
override val ttl: Long = 5 * 60 * 1000
override fun isValid(): Boolean = super.isValid() && type != null && !sdps.isNullOrEmpty()
override fun isValid(): Boolean = super.isValid() && type != null
&& (!sdps.isNullOrEmpty() || type == SignalServiceProtos.CallMessage.Type.END_CALL)
constructor(type: SignalServiceProtos.CallMessage.Type,
sdps: List<String>,
@@ -28,6 +29,8 @@ class CallMessage(): ControlMessage() {
companion object {
const val TAG = "CallMessage"
fun endCall() = CallMessage(SignalServiceProtos.CallMessage.Type.END_CALL, emptyList(), emptyList(), emptyList())
fun fromProto(proto: SignalServiceProtos.Content): CallMessage? {
val callMessageProto = if (proto.hasCallMessage()) proto.callMessage else return null
val type = callMessageProto.type
@@ -56,4 +59,32 @@ class CallMessage(): ControlMessage() {
)
.build()
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as CallMessage
if (type != other.type) return false
if (sdps != other.sdps) return false
if (sdpMLineIndexes != other.sdpMLineIndexes) return false
if (sdpMids != other.sdpMids) return false
if (isSelfSendValid != other.isSelfSendValid) return false
if (ttl != other.ttl) return false
return true
}
override fun hashCode(): Int {
var result = type?.hashCode() ?: 0
result = 31 * result + sdps.hashCode()
result = 31 * result + sdpMLineIndexes.hashCode()
result = 31 * result + sdpMids.hashCode()
result = 31 * result + isSelfSendValid.hashCode()
result = 31 * result + ttl.hashCode()
return result
}
}