summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/DialogsViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-21 17:03:16 +0300
committerGravatar Vitaly Takmazov2018-10-21 17:03:16 +0300
commit4429035e2530f8362759d1933bbbdbf9c7d3a8a1 (patch)
tree4f78fc0bc9124f62342fbe8a9ce662ffa059a708 /Juick/ViewControllers/DialogsViewController.m
parent9137ade75773e004563c1057d80d90e89d5e4ccd (diff)
Refresh chats on swipe
Diffstat (limited to 'Juick/ViewControllers/DialogsViewController.m')
-rw-r--r--Juick/ViewControllers/DialogsViewController.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m
index d080176..e801627 100644
--- a/Juick/ViewControllers/DialogsViewController.m
+++ b/Juick/ViewControllers/DialogsViewController.m
@@ -20,7 +20,14 @@
self.navigationController.visibleViewController.navigationItem.title = @"Chats";
[self.view setBackgroundColor:[ColorScheme mainBackground]];
[self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"];
+ [self refreshData];
+ self.refreshControl = [UIRefreshControl new];
+ [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
+}
+
+- (void) refreshData {
self.chats = [NSMutableArray array];
+ [self.tableView reloadData];
[[APIClient sharedClient] fetchChats:^(NSArray *groups, NSError *err) {
if (err == nil) {
[self.chats addObjectsFromArray:groups];
@@ -31,6 +38,7 @@
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:YES];
[self.tableView endUpdates];
+ [self.refreshControl endRefreshing];
}
}];
}