summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-12-22 20:02:37 +0300
committerGravatar Vitaly Takmazov2016-12-22 20:02:37 +0300
commit87c992e9db9464215d12a3987fe384d65e96bc50 (patch)
treea50471f97c74a78ba2d89f49a7a7e473115cf0a7 /Juick/ViewControllers
parentb3de91bba52f309df4eabdd30b8cd189f0b3bdae (diff)
refactoring
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/MessagesViewController.m12
1 files changed, 6 insertions, 6 deletions
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 3a420e1..e8857a7 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -48,12 +48,12 @@ static NSString *CellIdentifier = @"MessageCell";
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
self.dataLoading = YES;
[Message pullNextFromPath:self.path params:self.params callback:^(NSArray *next) {
- dispatch_async(dispatch_get_main_queue(), ^{
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.messages addObjectsFromArray:next];
[self.tableView reloadData];
[self.refreshControl endRefreshing];
self.dataLoading = NO;
- });
+ }];
}];
});
}
@@ -128,12 +128,12 @@ static NSString *CellIdentifier = @"MessageCell";
[cell setMessage:msg];
if ([msg.attach length] > 0) {
[cell.attach yy_setImageWithURL:[NSURL URLWithString:msg.attach] placeholder:[UIImage imageNamed:@"AttachPlaceholder"] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
- dispatch_async(dispatch_get_main_queue(), ^{
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[cell setNeedsUpdateConstraints];
[cell updateConstraintsIfNeeded];
[cell setNeedsLayout];
[cell layoutIfNeeded];
- });
+ }];
}];
} else {
@@ -148,7 +148,7 @@ static NSString *CellIdentifier = @"MessageCell";
return;
Message *msg = [_messages objectAtIndex:indexPath.row];
MessagesViewController *threadViewController = [[MessagesViewController alloc] init];
- [threadViewController loadFromPath:[Message threadUrl] withParams:[NSDictionary dictionaryWithObjectsAndKeys:msg.MID, @"mid", nil] withTitle:@"Thread"];
+ [threadViewController loadFromPath:[Message threadUrl] withParams:[NSDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil] withTitle:@"Thread"];
[self.navigationController pushViewController:threadViewController animated:NO];
}
@@ -156,7 +156,7 @@ static NSString *CellIdentifier = @"MessageCell";
CGFloat actualPosition = scrollView_.contentOffset.y;
CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2;
if (actualPosition >= contentHeight && !self.dataLoading) {
- NSNumber *lastMid = ((Message *)[self.messages lastObject]).MID;
+ NSNumber *lastMid = ((Message *)[self.messages lastObject]).mid;
if (![self.path isEqualToString:[Message threadUrl]]) {
[self.params setValue:lastMid forKey:@"before_mid"];
}