Remove pull to refresh that doesn’t do anything

This commit is contained in:
Max Radermacher 2023-05-10 10:46:01 -07:00 committed by GitHub
parent f5759cd17e
commit a3b46cd32c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 28 deletions

View File

@ -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

View File

@ -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...")