mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
@@ -171,7 +171,7 @@ class SignalCallLinkManager(
|
||||
name
|
||||
) { result ->
|
||||
if (result.isSuccess) {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Success(result.value!!.toAppState()))
|
||||
emitter.onSuccess(UpdateCallLinkResult.Update(result.value!!.toAppState()))
|
||||
} else {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Failure(result.status))
|
||||
}
|
||||
@@ -198,7 +198,7 @@ class SignalCallLinkManager(
|
||||
restrictions
|
||||
) { result ->
|
||||
if (result.isSuccess) {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Success(result.value!!.toAppState()))
|
||||
emitter.onSuccess(UpdateCallLinkResult.Update(result.value!!.toAppState()))
|
||||
} else {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Failure(result.status))
|
||||
}
|
||||
@@ -206,9 +206,8 @@ class SignalCallLinkManager(
|
||||
}
|
||||
}
|
||||
|
||||
fun updateCallLinkRevoked(
|
||||
credentials: CallLinkCredentials,
|
||||
revoked: Boolean
|
||||
fun deleteCallLink(
|
||||
credentials: CallLinkCredentials
|
||||
): Single<UpdateCallLinkResult> {
|
||||
if (credentials.adminPassBytes == null) {
|
||||
return Single.just(UpdateCallLinkResult.NotAuthorized)
|
||||
@@ -217,15 +216,14 @@ class SignalCallLinkManager(
|
||||
return Single.create { emitter ->
|
||||
val credentialPresentation = requestCallLinkAuthCredentialPresentation(credentials.linkKeyBytes)
|
||||
|
||||
callManager.updateCallLinkRevoked(
|
||||
callManager.deleteCallLink(
|
||||
SignalStore.internalValues().groupCallingServer(),
|
||||
credentialPresentation.serialize(),
|
||||
CallLinkRootKey(credentials.linkKeyBytes),
|
||||
credentials.adminPassBytes,
|
||||
revoked
|
||||
credentials.adminPassBytes
|
||||
) { result ->
|
||||
if (result.isSuccess) {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Success(result.value!!.toAppState()))
|
||||
if (result.isSuccess && result.value == true) {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Delete(credentials.roomId))
|
||||
} else {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Failure(result.status))
|
||||
}
|
||||
|
||||
@@ -9,10 +9,14 @@ package org.thoughtcrime.securesms.service.webrtc.links
|
||||
* Result type for call link updates.
|
||||
*/
|
||||
sealed interface UpdateCallLinkResult {
|
||||
data class Success(
|
||||
data class Update(
|
||||
val state: SignalCallLinkState
|
||||
) : UpdateCallLinkResult
|
||||
|
||||
data class Delete(
|
||||
val roomId: CallLinkRoomId
|
||||
) : UpdateCallLinkResult
|
||||
|
||||
data class Failure(
|
||||
val status: Short
|
||||
) : UpdateCallLinkResult
|
||||
|
||||
Reference in New Issue
Block a user