restrict more syncing on iPad

This commit is contained in:
Michael Kirk 2019-10-17 17:49:25 -06:00
parent 1f0a822335
commit 5701a4eab0
2 changed files with 6 additions and 2 deletions

View File

@ -292,10 +292,13 @@ NSString *const kSyncManagerLastContactSyncKey = @"kTSStorageManagerOWSSyncManag
skipIfRedundant:(BOOL)skipIfRedundant
debounce:(BOOL)debounce
{
if (!self.tsAccountManager.isRegisteredPrimaryDevice) {
return [AnyPromise promiseWithValue:OWSErrorMakeAssertionError(@"should not sync from secondary device")];
}
AnyPromise *promise = [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve) {
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
dispatch_async(self.serialQueue, ^{
OWSAssertDebug(self.tsAccountManager.isRegisteredPrimaryDevice);
if (debounce && self.isRequestInFlight) {
// De-bounce. It's okay if we ignore some new changes;
// `sendSyncContactsMessageIfPossible` is called fairly

View File

@ -320,7 +320,8 @@ NSUInteger const kUserProfileSchemaVersion = 1;
// We populate an initial (empty) profile on launch of a new install, but
// until we have a registered account, syncing will fail (and there could not
// be any linked device to sync to at this point anyway).
if ([self.tsAccountManager isRegistered] && CurrentAppContext().isMainApp) {
if (self.tsAccountManager.isRegisteredPrimaryDevice
&& CurrentAppContext().isMainApp) {
[[self.syncManager syncLocalContact] retainUntilComplete];
}