Merge branch 'mkirk/moreRetainUntilComplete'

pull/1/head
Michael Kirk 6 years ago
commit 585ed0c31f

@ -56,7 +56,7 @@ class ConversationConfigurationSyncOperation: OWSOperation {
return return
} }
syncManager.syncContacts(for: [signalAccount]) syncManager.syncContacts(for: [signalAccount]).retainUntilComplete()
} }
private func sync(groupThread: TSGroupThread) { private func sync(groupThread: TSGroupThread) {

@ -8,6 +8,7 @@
#import "Signal-Swift.h" #import "Signal-Swift.h"
#import "ThreadUtil.h" #import "ThreadUtil.h"
#import <AxolotlKit/PreKeyBundle.h> #import <AxolotlKit/PreKeyBundle.h>
#import <PromiseKit/AnyPromise.h>
#import <SignalCoreKit/Randomness.h> #import <SignalCoreKit/Randomness.h>
#import <SignalMessaging/Environment.h> #import <SignalMessaging/Environment.h>
#import <SignalServiceKit/OWSBatchMessageProcessor.h> #import <SignalServiceKit/OWSBatchMessageProcessor.h>
@ -102,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)sendContactsSyncMessage + (void)sendContactsSyncMessage
{ {
[self.syncManager syncAllContacts]; [[self.syncManager syncAllContacts] retainUntilComplete];
} }
+ (void)sendGroupSyncMessage + (void)sendGroupSyncMessage

@ -77,7 +77,7 @@ NSError *OWSBackupErrorWithDescription(NSString *description);
- (void)allRecipientIdsWithManifestsInCloud:(OWSBackupStringListBlock)success failure:(OWSBackupErrorBlock)failure; - (void)allRecipientIdsWithManifestsInCloud:(OWSBackupStringListBlock)success failure:(OWSBackupErrorBlock)failure;
- (AnyPromise *)ensureCloudKitAccess; - (AnyPromise *)ensureCloudKitAccess __attribute__((warn_unused_result));
- (void)checkCanImportBackup:(OWSBackupBoolBlock)success failure:(OWSBackupErrorBlock)failure; - (void)checkCanImportBackup:(OWSBackupBoolBlock)success failure:(OWSBackupErrorBlock)failure;
@ -98,7 +98,7 @@ NSError *OWSBackupErrorWithDescription(NSString *description);
- (NSArray<NSString *> *)attachmentIdsForLazyRestore; - (NSArray<NSString *> *)attachmentIdsForLazyRestore;
- (AnyPromise *)lazyRestoreAttachment:(TSAttachmentPointer *)attachment backupIO:(OWSBackupIO *)backupIO; - (AnyPromise *)lazyRestoreAttachment:(TSAttachmentPointer *)attachment backupIO:(OWSBackupIO *)backupIO __attribute__((warn_unused_result));
@end @end

@ -85,7 +85,7 @@ typedef void (^OWSBackupJobManifestFailure)(NSError *error);
#pragma mark - Manifest #pragma mark - Manifest
- (AnyPromise *)downloadAndProcessManifestWithBackupIO:(OWSBackupIO *)backupIO; - (AnyPromise *)downloadAndProcessManifestWithBackupIO:(OWSBackupIO *)backupIO __attribute__((warn_unused_result));
@end @end

@ -244,7 +244,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
// //
// NOTE: We also inform the desktop in the failure case, // NOTE: We also inform the desktop in the failure case,
// since that _may have_ affected service state. // since that _may have_ affected service state.
[self.syncManager syncLocalContact]; [[self.syncManager syncLocalContact] retainUntilComplete];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
failureBlockParameter(); failureBlockParameter();
@ -256,7 +256,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
// We use a "self-only" contact sync to indicate to desktop // We use a "self-only" contact sync to indicate to desktop
// that we've changed our profile and that it should do a // that we've changed our profile and that it should do a
// profile fetch for "self". // profile fetch for "self".
[self.syncManager syncLocalContact]; [[self.syncManager syncLocalContact] retainUntilComplete];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
successBlockParameter(); successBlockParameter();

@ -3,6 +3,7 @@
// //
#import "OWSUserProfile.h" #import "OWSUserProfile.h"
#import <PromiseKit/AnyPromise.h>
#import <SignalCoreKit/Cryptography.h> #import <SignalCoreKit/Cryptography.h>
#import <SignalCoreKit/NSData+OWS.h> #import <SignalCoreKit/NSData+OWS.h>
#import <SignalCoreKit/NSString+SSK.h> #import <SignalCoreKit/NSString+SSK.h>
@ -11,6 +12,7 @@
#import <SignalServiceKit/OWSFileSystem.h> #import <SignalServiceKit/OWSFileSystem.h>
#import <SignalServiceKit/OWSPrimaryStorage.h> #import <SignalServiceKit/OWSPrimaryStorage.h>
#import <SignalServiceKit/SSKEnvironment.h> #import <SignalServiceKit/SSKEnvironment.h>
#import <SignalServiceKit/SignalServiceKit-Swift.h>
#import <SignalServiceKit/TSAccountManager.h> #import <SignalServiceKit/TSAccountManager.h>
#import <YapDatabase/YapDatabaseConnection.h> #import <YapDatabase/YapDatabaseConnection.h>
#import <YapDatabase/YapDatabaseTransaction.h> #import <YapDatabase/YapDatabaseTransaction.h>
@ -227,7 +229,7 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
// we have a registered account, syncing will fail (and there could not be any // we have a registered account, syncing will fail (and there could not be any
// linked device to sync to at this point anyway). // linked device to sync to at this point anyway).
if ([self.tsAccountManager isRegistered] && CurrentAppContext().isMainApp) { if ([self.tsAccountManager isRegistered] && CurrentAppContext().isMainApp) {
[self.syncManager syncLocalContact]; [[self.syncManager syncLocalContact] retainUntilComplete];
} }
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:kNSNotificationName_LocalProfileDidChange [[NSNotificationCenter defaultCenter] postNotificationNameAsync:kNSNotificationName_LocalProfileDidChange

@ -148,16 +148,16 @@ typedef NS_ENUM(NSUInteger, OWSRegistrationState) {
#pragma mark - Manual Message Fetch #pragma mark - Manual Message Fetch
- (BOOL)isManualMessageFetchEnabled; - (BOOL)isManualMessageFetchEnabled;
- (AnyPromise *)setIsManualMessageFetchEnabled:(BOOL)value; - (AnyPromise *)setIsManualMessageFetchEnabled:(BOOL)value __attribute__((warn_unused_result));
#ifdef DEBUG #ifdef DEBUG
- (void)registerForTestsWithLocalNumber:(NSString *)localNumber; - (void)registerForTestsWithLocalNumber:(NSString *)localNumber;
#endif #endif
- (AnyPromise *)updateAccountAttributes; - (AnyPromise *)updateAccountAttributes __attribute__((warn_unused_result));
// This should only be used during the registration process. // This should only be used during the registration process.
- (AnyPromise *)performUpdateAccountAttributes; - (AnyPromise *)performUpdateAccountAttributes __attribute__((warn_unused_result));
@end @end

@ -901,7 +901,7 @@ NS_ASSUME_NONNULL_BEGIN
// In rare cases this means we won't respond to the sync request, but that's // In rare cases this means we won't respond to the sync request, but that's
// acceptable. // acceptable.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self.syncManager syncAllContacts]; [[self.syncManager syncAllContacts] retainUntilComplete];
}); });
} else if (syncMessage.request.type == SSKProtoSyncMessageRequestTypeGroups) { } else if (syncMessage.request.type == SSKProtoSyncMessageRequestTypeGroups) {
OWSSyncGroupsMessage *syncGroupsMessage = [[OWSSyncGroupsMessage alloc] init]; OWSSyncGroupsMessage *syncGroupsMessage = [[OWSSyncGroupsMessage alloc] init];

@ -11,11 +11,11 @@ NS_ASSUME_NONNULL_BEGIN
- (void)sendConfigurationSyncMessage; - (void)sendConfigurationSyncMessage;
- (AnyPromise *)syncLocalContact; - (AnyPromise *)syncLocalContact __attribute__((warn_unused_result));
- (AnyPromise *)syncAllContacts; - (AnyPromise *)syncAllContacts __attribute__((warn_unused_result));
- (AnyPromise *)syncContactsForSignalAccounts:(NSArray<SignalAccount *> *)signalAccounts; - (AnyPromise *)syncContactsForSignalAccounts:(NSArray<SignalAccount *> *)signalAccounts __attribute__((warn_unused_result));
@end @end

Loading…
Cancel
Save