summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/DialogsViewController.m
diff options
context:
space:
mode:
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];
}
}];
}