mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-03-02 15:36:32 +00:00
Display proper error when call link deletion fails due to call link being in use.
This commit is contained in:
committed by
Greyson Parrelli
parent
a9c37a9668
commit
5f67bd9725
@@ -148,8 +148,12 @@ class CallLinkDetailsFragment : ComposeFragment(), CallLinkDetailsCallback {
|
||||
lifecycleDisposable += viewModel.delete().observeOn(AndroidSchedulers.mainThread()).subscribeBy(onSuccess = {
|
||||
when (it) {
|
||||
is UpdateCallLinkResult.Delete -> ActivityCompat.finishAfterTransition(requireActivity())
|
||||
is UpdateCallLinkResult.CallLinkIsInUse -> {
|
||||
Log.w(TAG, "Failed to delete in-use call link.")
|
||||
toastCouldNotDeleteCallLink()
|
||||
}
|
||||
else -> {
|
||||
Log.w(TAG, "Failed to revoke. $it")
|
||||
Log.w(TAG, "Failed to delete call link. $it")
|
||||
toastFailure()
|
||||
}
|
||||
}
|
||||
@@ -188,6 +192,10 @@ class CallLinkDetailsFragment : ComposeFragment(), CallLinkDetailsCallback {
|
||||
private fun toastFailure() {
|
||||
Toast.makeText(requireContext(), R.string.CallLinkDetailsFragment__couldnt_save_changes, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
private fun toastCouldNotDeleteCallLink() {
|
||||
Toast.makeText(requireContext(), R.string.CallLinkDetailsFragment__couldnt_delete_call_link, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
private interface CallLinkDetailsCallback {
|
||||
|
||||
@@ -226,7 +226,10 @@ class SignalCallLinkManager(
|
||||
if (result.isSuccess && result.value == true) {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Delete(credentials.roomId))
|
||||
} else {
|
||||
emitter.onSuccess(UpdateCallLinkResult.Failure(result.status))
|
||||
when (result.status) {
|
||||
409.toShort() -> emitter.onSuccess(UpdateCallLinkResult.CallLinkIsInUse)
|
||||
else -> emitter.onSuccess(UpdateCallLinkResult.Failure(result.status))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,11 @@ sealed interface UpdateCallLinkResult {
|
||||
val status: Short
|
||||
) : UpdateCallLinkResult
|
||||
|
||||
object NotAuthorized : UpdateCallLinkResult
|
||||
/**
|
||||
* Occurs when a user tries to delete a call link that
|
||||
* the call server believes is currently being utilized.
|
||||
*/
|
||||
data object CallLinkIsInUse : UpdateCallLinkResult
|
||||
|
||||
data object NotAuthorized : UpdateCallLinkResult
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user