Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#R Connecting state issue fixes #796

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

EgorovEI
Copy link
Contributor

@EgorovEI EgorovEI commented Oct 11, 2023

On SDK configuration, interactor instance is created and has .none state. When Call screen is loaded, its start() method is called which executes some updates based on current interactor.state. When configure method is called before each engagement start (like we currently do in WidgetsSDK Testing app), CallViewModel.start() does nothing, because interactor.state is .none. But when WidgesSDK is configured once (for example on the app launch), the same interactor instance is used for all subsequent engagements. When you end first engagement (Chat/Audio/Video, probably CV also), interactor.state is .ended. Then if you start new Audio/Video engagement, CallViewModel.start() calls CallViewModel.call.end() method, which breaks something and connecting state becomes infinite.

This commit fixes calling CallViewModel.call.end() on Audio/Video engagement start.
The toggle (UISwitch) was added to Main screen, that provides the ability to disable/enable SDK configuration before each engagement.

MOB-2730

@EgorovEI EgorovEI changed the title Connecting state issue fixes #R Connecting state issue fixes Oct 11, 2023
@EgorovEI
Copy link
Contributor Author

!squash

@sm-deployer sm-deployer force-pushed the fix/MOB-2730-connecting-state-issue branch from 4e29150 to 78755e5 Compare October 12, 2023 07:26
@EgorovEI EgorovEI marked this pull request as draft October 12, 2023 09:44
@EgorovEI EgorovEI marked this pull request as ready for review October 12, 2023 10:34
Copy link
Contributor

@igorkravchenko igorkravchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment about logging deinit of view model.

GliaWidgets/Sources/ViewModel/EngagementViewModel.swift Outdated Show resolved Hide resolved
@EgorovEI
Copy link
Contributor Author

!squash

On SDK configuration, interactor instance is created and has .none state. When Call screen is loaded, its start() method is called which executes some updates based on current interactor.state. When configure method is called before each engagement start (like we currently do in WidgetsSDK Testing app), CallViewModel.start() does nothing, because interactor.state is .none.
But when WidgesSDK is configured once (for example on the app launch), the same interactor instance is used for all subsequent engagements. When you end first engagement (Chat/Audio/Video, probably CV also), interactor.state is .ended. Then if you start new Audio/Video engagement, CallViewModel.start() calls CallViewModel.call.end() method, which breaks something and connecting state becomes infinite.
This commit fixes calling CallViewModel.call.end() on Audio/Video engagement start.
Commit also make two engagement references weak to avoid retaining it when CoreSDK already released it from memory.
The toggle (UISwitch) was added to Main screen, that provides the ability to disable/enable SDK configuration before each engagement.

MOB-2730
@sm-deployer sm-deployer force-pushed the fix/MOB-2730-connecting-state-issue branch from 2095a49 to 417bc57 Compare October 12, 2023 11:06
@EgorovEI EgorovEI merged commit 11d6a09 into development Oct 12, 2023
1 check passed
@EgorovEI EgorovEI deleted the fix/MOB-2730-connecting-state-issue branch October 12, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants