mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-05 06:50:28 +03:00
Provides correct behavior when call isn't active and no activeClientWidgetApi exists yet
This commit is contained in:
parent
b6afe3b968
commit
03cbecc3f9
1 changed files with 16 additions and 9 deletions
|
|
@ -243,17 +243,24 @@ export function CallProvider({ children }: CallProviderProps) {
|
|||
setIsCallActive(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isCallActive && activeClientWidgetApi && viewedClientWidgetApi) {
|
||||
activeClientWidgetApi?.removeAllListeners();
|
||||
activeClientWidgetApi?.transport.send(WIDGET_HANGUP_ACTION, {}).then(() => {
|
||||
setActiveClientWidgetApi(viewedClientWidgetApi, viewedCallRoomId);
|
||||
setActiveCallRoomIdState(viewedCallRoomId);
|
||||
setViewedClientWidgetApi(null, null);
|
||||
setIsPrimaryIframe(!isPrimaryIframe);
|
||||
if (activeClientWidgetApi) {
|
||||
if (isCallActive && viewedClientWidgetApi) {
|
||||
activeClientWidgetApi?.removeAllListeners();
|
||||
activeClientWidgetApi?.transport.send(WIDGET_HANGUP_ACTION, {}).then(() => {
|
||||
setActiveClientWidgetApi(viewedClientWidgetApi, viewedCallRoomId);
|
||||
setActiveCallRoomIdState(viewedCallRoomId);
|
||||
setViewedClientWidgetApi(null, null);
|
||||
setIsPrimaryIframe(!isPrimaryIframe);
|
||||
setIsCallActive(true);
|
||||
});
|
||||
} else {
|
||||
setIsCallActive(true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setIsPrimaryIframe(!isPrimaryIframe);
|
||||
setActiveClientWidgetApi(viewedClientWidgetApi, viewedCallRoomId);
|
||||
setActiveCallRoomIdState(viewedCallRoomId);
|
||||
setViewedClientWidgetApi(null, null);
|
||||
setIsCallActive(true);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue