From bbf7ee451db3ff2b8e588ce375724748a6b14daa Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 30 May 2018 10:52:53 -0400 Subject: [PATCH] Limit the scope of the 'incomplete contacts fetch' fix. --- SignalMessaging/contacts/OWSContactsManager.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SignalMessaging/contacts/OWSContactsManager.m b/SignalMessaging/contacts/OWSContactsManager.m index 44c8a1111..d7f453127 100644 --- a/SignalMessaging/contacts/OWSContactsManager.m +++ b/SignalMessaging/contacts/OWSContactsManager.m @@ -140,7 +140,16 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification updatedContacts:(NSArray *)contacts isUserRequested:(BOOL)isUserRequested { - [self updateWithContacts:contacts shouldClearStaleCache:isUserRequested]; + BOOL shouldClearStaleCache; + // On iOS 11.2, only clear the contacts cache if the fetch was initiated by the user. + // iOS 11.2 rarely returns partial fetches and we use the cache to prevent contacts from + // periodically disappearing from the UI. + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 2) && !SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 3)) { + shouldClearStaleCache = isUserRequested; + } else { + shouldClearStaleCache = YES; + } + [self updateWithContacts:contacts shouldClearStaleCache:shouldClearStaleCache]; } #pragma mark - Intersection