Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
var viewContext: NSManagedObjectContext { get }
func newBackgroundContext() -> NSManagedObjectContext
var syncContext: NSManagedObjectContext { get }
var searchContext: NSManagedObjectContext { get }
var eventContext: NSManagedObjectContext { get }

}
Expand Down Expand Up @@ -138,8 +137,6 @@
return context
}()

public lazy var searchContext: NSManagedObjectContext = messagesContainer.newBackgroundContext()

public lazy var eventContext: NSManagedObjectContext = eventsContainer.newBackgroundContext()

public let accountContainer: URL
Expand Down Expand Up @@ -253,7 +250,6 @@

viewContext.tearDown()
syncContext.tearDown()
searchContext.tearDown()
eventContext.tearDown()
closeStores()
}
Expand Down Expand Up @@ -311,7 +307,6 @@
await configureContextReferences()
await configureViewContext(viewContext)
await configureSyncContext(syncContext)
await configureSearchContext(searchContext)

} catch {
WireLogger.localStorage.critical(
Expand Down Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure

Check warning on line 372 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure
context.localDomain = self.localDomain
context.isFederationEnabled = self.isFederationEnabled
context.createDispatchGroups()
Expand All @@ -386,17 +381,17 @@
}

func configureContextReferences() async {
await viewContext.perform {

Check warning on line 384 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure

Check warning on line 384 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure
self.viewContext.zm_sync = self.syncContext
}
await syncContext.perform {

Check warning on line 387 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure

Check warning on line 387 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure
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

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure

Check warning on line 394 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure
context.localDomain = self.localDomain
context.isFederationEnabled = self.isFederationEnabled
context.createDispatchGroups()
Expand All @@ -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

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure

Check warning on line 413 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'self' with non-Sendable type 'CoreDataStack' in a '@sendable' closure
self.dispatchGroup.map(context.addGroup(_:))
}
}
Expand Down Expand Up @@ -557,7 +539,7 @@
}

// MARK: -

Check warning on line 542 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Class 'PersistentContainer' must restate inherited '@unchecked Sendable' conformance

Class 'PersistentContainer' must restate inherited '@unchecked Sendable' conformance

Check warning on line 542 in wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift

View workflow job for this annotation

GitHub Actions / Test Results

Class 'PersistentContainer' must restate inherited '@unchecked Sendable' conformance

Class 'PersistentContainer' must restate inherited '@unchecked Sendable' conformance
public class PersistentContainer: NSPersistentContainer {

var storeURL: URL? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@interface NSManagedObjectContext (zmessagingTests)

- (void)markAsSyncContext;
- (void)markAsSearchContext;
- (void)markAsUIContext;
- (void)disableObjectRefresh;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

extern NSString * _Nonnull const IsUserInterfaceContextKey;
extern NSString * _Nonnull const IsSyncContextKey;
extern NSString * _Nonnull const IsSearchContextKey;
extern NSString * _Nonnull const IsEventContextKey;

@interface NSManagedObjectContext (zmessaging)
Expand All @@ -37,9 +36,6 @@ extern NSString * _Nonnull const IsEventContextKey;
/// Inverse of @c zm_isSyncContext
@property (readonly) BOOL zm_isUserInterfaceContext;

/// Returns @c YES if the receiver is a context that is used for searching.
@property (readonly) BOOL zm_isSearchContext;

/// Returns @c YES if the context should refresh objects following the policy for the sync context
@property (readonly) BOOL zm_shouldRefreshObjectsWithSyncContextPolicy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#import <WireDataModel/WireDataModel-Swift.h>

NSString * const IsSyncContextKey = @"ZMIsSyncContext";
NSString * const IsSearchContextKey = @"ZMIsSearchContext";
NSString * const IsUserInterfaceContextKey = @"ZMIsUserInterfaceContext";
NSString * const IsEventContextKey = @"ZMIsEventDecoderContext";

Expand Down Expand Up @@ -88,7 +87,7 @@ @implementation NSManagedObjectContext (zmessaging)

- (BOOL)zm_isValidContext
{
return self.zm_isSyncContext || self.zm_isUserInterfaceContext || self.zm_isSearchContext;
return self.zm_isSyncContext || self.zm_isUserInterfaceContext;
}

- (id)validUserInfoValueOfClass:(Class)class forKey:(NSString *)key
Expand Down Expand Up @@ -128,11 +127,6 @@ - (BOOL)zm_isUserInterfaceContext
return [[self validUserInfoValueOfClass:[NSNumber class] forKey:IsUserInterfaceContextKey] boolValue];
}

- (BOOL)zm_isSearchContext
{
return [self.userInfo[IsSearchContextKey] boolValue];
}

- (NSManagedObjectContext*)zm_syncContext
{
if (self.zm_isSyncContext) {
Expand Down Expand Up @@ -539,13 +533,6 @@ - (void)markAsSyncContext;
}];
}

- (void)markAsSearchContext;
{
[self performBlockAndWait:^{
self.userInfo[IsSearchContextKey] = @YES;
}];
}

- (void)markAsUIContext
{
[self performBlockAndWait:^{
Expand All @@ -558,7 +545,6 @@ - (void)resetContextType
[self performBlockAndWait:^{
self.userInfo[IsSyncContextKey] = @NO;
self.userInfo[IsUserInterfaceContextKey] = @NO;
self.userInfo[IsSearchContextKey] = @NO;
}];
}

Expand Down

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
Expand Up @@ -44,7 +44,6 @@
@property (nonatomic, readonly, nonnull) CoreDataStack *coreDataStack;
@property (nonatomic, readonly, nonnull) NSManagedObjectContext *uiMOC;
@property (nonatomic, readonly, nonnull) NSManagedObjectContext *syncMOC;
@property (nonatomic, readonly, nonnull) NSManagedObjectContext *searchMOC;

@property (nonatomic, readonly) BOOL shouldUseRealKeychain;
@property (nonatomic, readonly) BOOL shouldUseInMemoryStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ - (NSManagedObjectContext *)syncMOC
return self.coreDataStack.syncContext;
}

- (NSManagedObjectContext *)searchMOC
{
return self.coreDataStack.searchContext;
}

- (void)resetUIandSyncContextsAndResetPersistentStore:(BOOL)resetPersistentStore
{
self.coreDataStack = nil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / Test Results

Capture of 'coreDataStack' with non-Sendable type 'CoreDataStack' in a '@Sendable' closure

Capture of 'coreDataStack' with non-Sendable type 'CoreDataStack' in a '@sendable' closure
ZMUser.selfUser(in: coreDataStack.viewContext).selfClient()?.remoteIdentifier
}
let legacyEnvironment = BackendEnvironment(environment)
Expand Down Expand Up @@ -469,8 +469,7 @@
accountID: accountID,
databaseContexts: [
coreDataStack.viewContext,
coreDataStack.syncContext,
coreDataStack.searchContext
coreDataStack.syncContext
],
canPerformKeyMigration: true,
sharedUserDefaults: sharedUserDefaults,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Foundation
@objcMembers
public class SearchDirectory: NSObject {

let searchContext: NSManagedObjectContext
let contextProvider: ContextProvider
let transportSession: TransportSessionType
private let apiVersion: WireTransport.APIVersion?
Expand All @@ -39,7 +38,6 @@ public class SearchDirectory: NSObject {

public convenience init(userSession: ZMUserSession) {
self.init(
searchContext: userSession.searchManagedObjectContext,
contextProvider: userSession,
transportSession: userSession.transportSession,
searchUsersCache: userSession.searchUsersCache,
Expand All @@ -50,15 +48,13 @@ public class SearchDirectory: NSObject {
}

init(
searchContext: NSManagedObjectContext,
contextProvider: ContextProvider,
transportSession: TransportSessionType,
searchUsersCache: SearchUsersCache?,
refreshUsersMissingMetadataAction: RecurringAction,
refreshConversationsMissingMetadataAction: RecurringAction,
apiVersion: WireTransport.APIVersion?
) {
self.searchContext = searchContext
self.contextProvider = contextProvider
self.transportSession = transportSession
self.searchUsersCache = searchUsersCache
Expand All @@ -74,7 +70,6 @@ public class SearchDirectory: NSObject {
public func perform(_ request: SearchRequest) -> SearchTask {
let task = SearchTask(
task: .search(searchRequest: request),
searchContext: searchContext,
contextProvider: contextProvider,
transportSession: transportSession,
searchUsersCache: searchUsersCache,
Expand All @@ -96,7 +91,6 @@ public class SearchDirectory: NSObject {
public func lookup(qualifiedID: QualifiedID) -> SearchTask {
let task = SearchTask(
task: .lookup(qualifiedID: qualifiedID),
searchContext: searchContext,
contextProvider: contextProvider,
transportSession: transportSession,
searchUsersCache: searchUsersCache,
Expand Down
Loading
Loading