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

[CIS-994] Fix the issue with receiving .didBecomeActive before connecting the client for the first time #1256

Merged
merged 3 commits into from Jul 8, 2021

Conversation

dmigach
Copy link
Contributor

@dmigach dmigach commented Jul 8, 2021

We spotted one additional case when it's possible for ChatClientUpdater.connect to be called before obtaining credentials:
#1218

It happens because we subscribe for notifications in ChatClient's init
Two fixes to prevent this:

  1. Do not call ChatClientUpdater.connect if one of connect methods has not been called on ChatClient
  2. Only listen to app state notifications in connected state, i.e. only subscribe when we connect and unsubscribe on disconnect

@dmigach dmigach requested a review from VojtaStavik July 8, 2021 09:54
@Stream-iOS-Bot
Copy link
Collaborator

1 Message
📖 There seems to be app changes but CHANGELOG wasn't modified.
Please include an entry if the PR includes user-facing changes.
You can find it at CHANGELOG.md.

Generated by 🚫 Danger

@codecov-commenter
Copy link

codecov-commenter commented Jul 8, 2021

Codecov Report

Merging #1256 (f017c0a) into main (8dc565a) will decrease coverage by 0.12%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1256      +/-   ##
==========================================
- Coverage   91.52%   91.40%   -0.13%     
==========================================
  Files         219      219              
  Lines        9400     9419      +19     
==========================================
+ Hits         8603     8609       +6     
- Misses        797      810      +13     
Flag Coverage Δ
llc-tests 91.24% <50.00%> (-0.13%) ⬇️
llc-tests-ios12 88.09% <50.00%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...Chat/WebSocketClient/BackgroundTaskScheduler.swift 43.75% <0.00%> (-21.97%) ⬇️
Sources/StreamChat/ChatClient.swift 94.39% <100.00%> (+0.70%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dc565a...f017c0a. Read the comment docs.

Sources/StreamChat/ChatClient.swift Outdated Show resolved Hide resolved
Sources/StreamChat/ChatClient_Tests.swift Show resolved Hide resolved
@dmigach dmigach merged commit 8477028 into main Jul 8, 2021
@dmigach dmigach deleted the CIS-994-fix-didBecomeActiveNotification-issue branch July 8, 2021 12:41
dmigach added a commit that referenced this pull request Jul 8, 2021
dmigach added a commit that referenced this pull request Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants