Don't ask for contacts

pull/6/head
Niels Andriesse 6 years ago
parent 81dc2077e8
commit ef680a1cc2

@ -459,7 +459,10 @@ NS_ASSUME_NONNULL_BEGIN
// No Contacts
OWSTableSection *contactsSection = [OWSTableSection new];
if (self.contactsManager.isSystemContactsAuthorized) {
// Loki: Original code
// ========
// if (self.contactsManager.isSystemContactsAuthorized) {
// ========
if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce) {
[contactsSection
@ -490,7 +493,10 @@ NS_ASSUME_NONNULL_BEGIN
[OWSTableItem itemWithCustomCell:loadingCell customRowHeight:40 actionBlock:nil];
[contactsSection addItem:loadingItem];
}
}
// Loki: Original code
// ========
// }
// ========
return @[ contactsSection ];
}
@ -759,7 +765,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)showContactAppropriateViews
{
if (self.contactsManager.isSystemContactsAuthorized) {
// Loki: Original code
// ========
// if (self.contactsManager.isSystemContactsAuthorized) {
// ========
if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce && self.contactsViewHelper.signalAccounts.count < 1
&& ![Environment.shared.preferences hasDeclinedNoContactsView]) {
self.isNoContactsModeActive = YES;
@ -768,11 +777,14 @@ NS_ASSUME_NONNULL_BEGIN
}
[self showSearchBar:YES];
} else {
// don't show "no signal contacts", show "no contact access"
self.isNoContactsModeActive = NO;
[self showSearchBar:NO];
}
// Loki: Original code
// ========
// } else {
// // don't show "no signal contacts", show "no contact access"
// self.isNoContactsModeActive = NO;
// [self showSearchBar:NO];
// }
// ========
}
- (void)setIsNoContactsModeActive:(BOOL)isNoContactsModeActive

@ -231,29 +231,34 @@ public class SystemContactsFetcher: NSObject {
switch authorizationStatus {
case .notDetermined:
if CurrentAppContext().isInBackground() {
Logger.error("do not request contacts permission when app is in background")
completion(nil)
return
}
self.contactStoreAdapter.requestAccess { (granted, error) in
if let error = error {
Logger.error("error fetching contacts: \(error)")
completion(error)
return
}
guard granted else {
// This case should have been caught by the error guard a few lines up.
owsFailDebug("declined contact access.")
completion(nil)
return
}
DispatchQueue.main.async {
self.updateContacts(completion: completion)
}
}
return completion(nil)
// Loki: Original code
// ========
// if CurrentAppContext().isInBackground() {
// Logger.error("do not request contacts permission when app is in background")
// completion(nil)
// return
// }
// self.contactStoreAdapter.requestAccess { (granted, error) in
// if let error = error {
// Logger.error("error fetching contacts: \(error)")
// completion(error)
// return
// }
//
// guard granted else {
// // This case should have been caught by the error guard a few lines up.
// owsFailDebug("declined contact access.")
// completion(nil)
// return
// }
//
// DispatchQueue.main.async {
// self.updateContacts(completion: completion)
// }
// }
// ========
case .authorized:
self.updateContacts(completion: completion)
case .denied, .restricted:

Loading…
Cancel
Save