Remove pull to refresh that doesn’t do anything
This commit is contained in:
parent
f5759cd17e
commit
a3b46cd32c
@ -189,13 +189,7 @@ NSString *const kArchiveButtonPseudoGroup = @"kArchiveButtonPseudoGroup";
|
||||
self.firstConversationCueView.accessibilityIdentifier = @"ChatListViewController.firstConversationCueView";
|
||||
self.firstConversationLabel.accessibilityIdentifier = @"ChatListViewController.firstConversationLabel";
|
||||
|
||||
UIRefreshControl *pullToRefreshView = [UIRefreshControl new];
|
||||
pullToRefreshView.tintColor = [UIColor grayColor];
|
||||
[pullToRefreshView addTarget:self
|
||||
action:@selector(pullToRefreshPerformed:)
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
self.tableView.refreshControl = pullToRefreshView;
|
||||
pullToRefreshView.accessibilityIdentifier = @"ChatListViewController.pullToRefreshView";
|
||||
[self addPullToRefreshIfNeeded];
|
||||
}
|
||||
|
||||
- (UIView *)createEmptyInboxView
|
||||
@ -711,27 +705,6 @@ NSString *const kArchiveButtonPseudoGroup = @"kArchiveButtonPseudoGroup";
|
||||
[self ensureSelectedThread:thread animated:animated];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)pullToRefreshPerformed:(UIRefreshControl *)refreshControl
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
OWSLogInfo(@"beginning refreshing.");
|
||||
|
||||
[self.messageFetcherJob runObjc]
|
||||
.then(^(id value) {
|
||||
if (TSAccountManager.shared.isRegisteredPrimaryDevice) {
|
||||
return [AnyPromise promiseWithValue:@1];
|
||||
}
|
||||
|
||||
return [SSKEnvironment.shared.syncManager sendAllSyncRequestMessagesWithTimeout:20];
|
||||
})
|
||||
.ensure(^{
|
||||
OWSLogInfo(@"ending refreshing.");
|
||||
[refreshControl endRefreshing];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - UISearchBarDelegate
|
||||
|
||||
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
|
||||
|
||||
@ -80,6 +80,29 @@ public extension ChatListViewController {
|
||||
|
||||
// MARK: -
|
||||
|
||||
func addPullToRefreshIfNeeded() {
|
||||
if tsAccountManager.isPrimaryDevice {
|
||||
return
|
||||
}
|
||||
|
||||
let pullToRefreshView = UIRefreshControl()
|
||||
pullToRefreshView.tintColor = .gray
|
||||
pullToRefreshView.addTarget(self, action: #selector(pullToRefreshPerformed), for: .valueChanged)
|
||||
pullToRefreshView.accessibilityIdentifier = "ChatListViewController.pullToRefreshView"
|
||||
self.tableView.refreshControl = pullToRefreshView
|
||||
}
|
||||
|
||||
private func pullToRefreshPerformed(_ refreshControl: UIRefreshControl) {
|
||||
AssertIsOnMainThread()
|
||||
owsAssert(!tsAccountManager.isPrimaryDevice)
|
||||
|
||||
syncManager.sendAllSyncRequestMessages(timeout: 20).ensure {
|
||||
refreshControl.endRefreshing()
|
||||
}.cauterize()
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
func showBadgeExpirationSheetIfNeeded() {
|
||||
Logger.info("[Donations] Checking whether we should show badge expiration sheet...")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user