-
Notifications
You must be signed in to change notification settings - Fork 25
chore: create searchContext on demand - WPB-20362 #4246
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
Changes from all commits
45ac179
9e23597
3c94a08
bfbe31f
d03e77a
cc6b255
76d7560
ffe95b7
bc95f36
cae02ce
3bc6a9d
b0ca485
1f2192e
7295e04
6e22fe1
18b47db
75f527f
ea8cf2b
c2b8c2a
3b9e4be
af607dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,6 @@ | |
| var viewContext: NSManagedObjectContext { get } | ||
| func newBackgroundContext() -> NSManagedObjectContext | ||
| var syncContext: NSManagedObjectContext { get } | ||
| var searchContext: NSManagedObjectContext { get } | ||
| var eventContext: NSManagedObjectContext { get } | ||
|
|
||
| } | ||
|
|
@@ -138,8 +137,6 @@ | |
| return context | ||
| }() | ||
|
|
||
| public lazy var searchContext: NSManagedObjectContext = messagesContainer.newBackgroundContext() | ||
|
|
||
| public lazy var eventContext: NSManagedObjectContext = eventsContainer.newBackgroundContext() | ||
|
|
||
| public let accountContainer: URL | ||
|
|
@@ -253,7 +250,6 @@ | |
|
|
||
| viewContext.tearDown() | ||
| syncContext.tearDown() | ||
| searchContext.tearDown() | ||
| eventContext.tearDown() | ||
| closeStores() | ||
| } | ||
|
|
@@ -311,7 +307,6 @@ | |
| await configureContextReferences() | ||
| await configureViewContext(viewContext) | ||
| await configureSyncContext(syncContext) | ||
| await configureSearchContext(searchContext) | ||
|
|
||
| } catch { | ||
| WireLogger.localStorage.critical( | ||
|
|
@@ -374,7 +369,7 @@ | |
|
|
||
| func configureViewContext(_ context: NSManagedObjectContext) async { | ||
| context.markAsUIContext() | ||
| await context.perform { | ||
|
Check warning on line 372 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
|
||
| context.localDomain = self.localDomain | ||
| context.isFederationEnabled = self.isFederationEnabled | ||
| context.createDispatchGroups() | ||
|
|
@@ -386,17 +381,17 @@ | |
| } | ||
|
|
||
| func configureContextReferences() async { | ||
| await viewContext.perform { | ||
|
Check warning on line 384 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
|
||
| self.viewContext.zm_sync = self.syncContext | ||
| } | ||
| await syncContext.perform { | ||
|
Check warning on line 387 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
|
||
| self.syncContext.zm_userInterface = self.viewContext | ||
| } | ||
| } | ||
|
|
||
| func configureSyncContext(_ context: NSManagedObjectContext) async { | ||
| // Note: markAsSyncContext() is now called in the lazy initializer | ||
| await context.perform { | ||
|
Check warning on line 394 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
|
||
| context.localDomain = self.localDomain | ||
| context.isFederationEnabled = self.isFederationEnabled | ||
| context.createDispatchGroups() | ||
|
|
@@ -413,22 +408,9 @@ | |
| } | ||
| } | ||
|
|
||
| func configureSearchContext(_ context: NSManagedObjectContext) async { | ||
| context.markAsSearch() | ||
| await context.perform { | ||
| context.localDomain = self.localDomain | ||
| context.isFederationEnabled = self.isFederationEnabled | ||
| context.createDispatchGroups() | ||
| self.dispatchGroup.map(context.addGroup(_:)) | ||
| context.setupLocalCachedSessionAndSelfUser() | ||
| context.undoManager = nil | ||
| context.mergePolicy = NSMergePolicy(merge: .rollbackMergePolicyType) | ||
| } | ||
| } | ||
|
|
||
| func configureEventContext(_ context: NSManagedObjectContext) async { | ||
| await context.perform { | ||
| context.createDispatchGroups() | ||
|
Check warning on line 413 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
|
||
| self.dispatchGroup.map(context.addGroup(_:)) | ||
| } | ||
| } | ||
|
|
@@ -557,7 +539,7 @@ | |
| } | ||
|
|
||
| // MARK: - | ||
|
|
||
|
Check warning on line 542 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
|
||
| public class PersistentContainer: NSPersistentContainer { | ||
|
|
||
| var storeURL: URL? { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -403,7 +403,7 @@ | |
| coreDataStack: CoreDataStack, | ||
| cookieStorage: CookieStorage | ||
| ) async -> ZMUserSession { | ||
| let selfClientID = await coreDataStack.viewContext.perform { | ||
|
Check warning on line 406 in wire-ios-sync-engine/Source/SessionManager/UserSessionLoader.swift
|
||
| ZMUser.selfUser(in: coreDataStack.viewContext).selfClient()?.remoteIdentifier | ||
| } | ||
| let legacyEnvironment = BackendEnvironment(environment) | ||
|
|
@@ -469,8 +469,7 @@ | |
| accountID: accountID, | ||
| databaseContexts: [ | ||
| coreDataStack.viewContext, | ||
| coreDataStack.syncContext, | ||
| coreDataStack.searchContext | ||
| coreDataStack.syncContext | ||
| ], | ||
| canPerformKeyMigration: true, | ||
| sharedUserDefaults: sharedUserDefaults, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.