From 6335782568194ff746813c29c719bcf2f00a2b90 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 29 Jun 2017 18:26:37 -1000 Subject: [PATCH] Make sure we're requesting access for contacts before checking access I'm actually not sure how I got my simulator wedged into this state - but my contacts access was "undetermined" and I had several messages. Maybe they appeared while the app was closed? I verified that the banner appears as expected when access is denied. // FREEBIE --- Signal/src/ViewControllers/SignalsViewController.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/SignalsViewController.m b/Signal/src/ViewControllers/SignalsViewController.m index ba16d1460..d681ff921 100644 --- a/Signal/src/ViewControllers/SignalsViewController.m +++ b/Signal/src/ViewControllers/SignalsViewController.m @@ -185,9 +185,6 @@ self.missingContactsPermissionView.tapAction = ^{ [[UIApplication sharedApplication] openSystemSettings]; }; - // Should only have to do this once per load (e.g. vs did appear) since app restarts when permissions change. - self.hideMissingContactsPermissionViewConstraint.active = !self.shouldShowMissingContactsPermissionView; - if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] && (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) { @@ -291,8 +288,13 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if ([TSThread numberOfKeysInCollection] > 0) { - [self.contactsManager requestSystemContactsOnce]; + [self.contactsManager requestSystemContactsOnceWithCompletion:^(NSError *_Nullable error) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.hideMissingContactsPermissionViewConstraint.active = !self.shouldShowMissingContactsPermissionView; + }); + }]; } + [self updateInboxCountLabel]; self.isViewVisible = YES;