chore: make a number of calls async to prevent app hangs - WPB-22986#4337
Draft
samwyndham wants to merge 1 commit intodevelopfrom
Draft
chore: make a number of calls async to prevent app hangs - WPB-22986#4337samwyndham wants to merge 1 commit intodevelopfrom
samwyndham wants to merge 1 commit intodevelopfrom
Conversation
samwyndham
commented
Feb 19, 2026
Comment on lines
-1249
to
-1297
| // Creates the user session for @c account given, calls @c completion when done. | ||
| @MainActor | ||
| private func startBackgroundSession( | ||
| for account: Account, | ||
| with coreDataStack: CoreDataStack, | ||
| journal: Journal, | ||
| logFilesProvider: LogFilesProviding | ||
| ) -> ZMUserSession { | ||
| guard let newSession = createUserSession( | ||
| for: account, | ||
| with: coreDataStack, | ||
| journal: journal, | ||
| logFilesProvider: logFilesProvider | ||
| ) else { | ||
| preconditionFailure("Unable to create session for \(account)") | ||
| } | ||
|
|
||
| finishSettingUpUserSession( | ||
| account: account, | ||
| newSession: newSession, | ||
| coreDataStack: coreDataStack | ||
| ) | ||
|
|
||
| return newSession | ||
| } | ||
|
|
||
| @MainActor | ||
| private func createUserSession( | ||
| for account: Account, | ||
| with coreDataStack: CoreDataStack, | ||
| journal: Journal, | ||
| logFilesProvider: LogFilesProviding | ||
| ) -> ZMUserSession? { | ||
| let sessionConfig = ZMUserSession.Configuration( | ||
| appLockConfig: configuration.legacyAppLockConfig | ||
| ) | ||
|
|
||
| return authenticatedSessionFactory.session( | ||
| for: account, | ||
| coreDataStack: coreDataStack, | ||
| configuration: sessionConfig, | ||
| sharedUserDefaults: sharedUserDefaults, | ||
| isDeveloperModeEnabled: isDeveloperModeEnabled, | ||
| journal: journal, | ||
| logFilesProvider: logFilesProvider, | ||
| faultyMLSRemovalKeysByDomain: configuration.faultyMLSRemovalKeysByDomain | ||
| ) | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
This code is not called
samwyndham
commented
Feb 19, 2026
| journal[.isInitialSyncRequired] = true | ||
| let isConsumableNotificationsCapable = userClient.isConsumableNotificationsCapable // TODO: Is it to early to get that here? | ||
| Task { | ||
| await setUpSyncAgent(clientID: selfClientID, isNewClient: true) |
Contributor
Author
There was a problem hiding this comment.
QUESTION: Is it safe to make this async escaping?
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue
Please describe the issue.
Optional: add details about technical approach, solutions etc.
Optional: reference dependencies to other pull requests etc.
Testing
Describe how to test.
Optional: attachments like images, videos, etc.
Checklist
[WPB-XXX].UI accessibility checklist
If your PR includes UI changes, please utilize this checklist: