File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -180,20 +180,21 @@ class DefaultActiveCallManager(
180
180
}
181
181
182
182
override suspend fun hungUpCall (callType : CallType ) = mutex.withLock {
183
- if (activeCall.value?.callType != callType) {
183
+ Timber .tag(tag).d(" Hung up call: $callType " )
184
+ val currentActiveCall = activeCall.value ? : run {
185
+ Timber .tag(tag).w(" No active call, ignoring hang up" )
186
+ return
187
+ }
188
+ if (currentActiveCall.callType != callType) {
184
189
Timber .tag(tag).w(" Call type $callType does not match the active call type, ignoring" )
185
190
return
186
191
}
187
-
188
- Timber .tag(tag).d(" Hung up call: $callType " )
189
- if (activeCall.value?.callState is CallState .Ringing ) {
190
- val ringing = activeCall.value!! .callState as CallState .Ringing
192
+ if (currentActiveCall.callState is CallState .Ringing ) {
191
193
// Decline the call
192
- matrixClientProvider.getOrRestore(ringing.notificationData.sessionId).getOrNull()?.let { client ->
193
- client.getRoom(ringing.notificationData.roomId)?.let { room ->
194
- room.declineCall(ringing.notificationData.eventId)
195
- }
196
- }
194
+ val notificationData = currentActiveCall.callState.notificationData
195
+ matrixClientProvider.getOrRestore(notificationData.sessionId).getOrNull()
196
+ ?.getRoom(notificationData.roomId)
197
+ ?.declineCall(notificationData.eventId)
197
198
}
198
199
199
200
cancelIncomingCallNotification()
You can’t perform that action at this time.
0 commit comments