Skip to content
Snippets Groups Projects
Commit 423e2d89 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

UI/UX: support multiple calls

When an incoming call was received during another call a new call
was rejected. There is no reason for this behaviour because calls
should be managed by the user. Moreover sometimes it did prevent
displaying call window when receiving call when app was suspended.

Change-Id: I261ab2be997baefbd3329f2b8002e8e169093e79
parent 32db579b
No related branches found
No related tags found
No related merge requests found
......@@ -139,10 +139,6 @@ class ConversationsCoordinator: Coordinator, StateableResponsive, ConversationNa
.disposed(by: self.disposeBag)
return
}
guard let topController = getTopController(),
!topController.isKind(of: (CallViewController).self) else {
return
}
let callViewController = CallViewController
.instantiate(with: self.injectionBag)
callViewController.viewModel.call = call
......@@ -160,8 +156,12 @@ class ConversationsCoordinator: Coordinator, StateableResponsive, ConversationNa
.getEventInput(ServiceEventInput.callUUID) else { return false }
return callUUID == call.callUUID.uuidString
})
.subscribe(onNext: { _ in
topController.dismiss(animated: false, completion: nil)
.subscribe(onNext: { [weak self] _ in
guard let self = self else { return }
if let topController = self.getTopController(),
!topController.isKind(of: (CallViewController).self) {
topController.dismiss(animated: false, completion: nil)
}
self.popToSmartList()
if account.id != call.accountId {
self.accountService.currentAccount = self.accountService.getAccount(fromAccountId: call.accountId)
......
......@@ -674,26 +674,15 @@ class CallsService: CallsAdapterDelegate {
func receivingCall(withAccountId accountId: String, callId: String, fromURI uri: String, withMedia mediaList: [[String: String]]) {
if let callDictionary = self.callsAdapter.callDetails(withCallId: callId, accountId: accountId) {
if !isCurrentCall() {
var call = self.calls.value[callId]
if call == nil {
call = CallModel(withCallId: callId, callDetails: callDictionary, withMedia: mediaList)
} else {
call?.update(withDictionary: callDictionary, withMedia: mediaList)
}
// Emit the call to the observers
guard let newCall = call else { return }
self.newCall.accept(newCall)
var call = self.calls.value[callId]
if call == nil {
call = CallModel(withCallId: callId, callDetails: callDictionary, withMedia: mediaList)
} else {
self.refuse(callId: callId)
.subscribe(onCompleted: { [weak self] in
self?.log.debug("call refused")
}, onError: { [weak self] _ in
self?.log.debug("Could not to refuse a call")
})
.disposed(by: self.disposeBag)
call?.update(withDictionary: callDictionary, withMedia: mediaList)
}
// Emit the call to the observers
guard let newCall = call else { return }
self.newCall.accept(newCall)
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment