summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/DiscussionsController.m
blob: 607ac26dd8eb65217fd0dfd390c9822e4201ea36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
//  DiscussionsController.m
//  Juick
//
//  Created by Vitaly Takmazov on 21/03/2019.
//  Copyright © 2019 com.juick. All rights reserved.
//

#import "DiscussionsController.h"
#import "APIClient.h"

@interface DiscussionsController ()

@end

@implementation DiscussionsController

- (void)viewDidLoad {
    self.messagesDelegate = self;
    self.title = @"Discussions";
    self.path = [APIClient discussionsUrl];
    [self setShouldScrollToUnreadOnRefresh:NO];
    [super viewDidLoad];
}

- (void)loadMore {
    Message *lastMsg = [self.messages lastObject];
    if (lastMsg != nil) {
        NSDate *msgDate = [[APIClient sharedClient].dateFormatter dateFromString:lastMsg.timestamp];
        self.params = [@{@"to" : [NSString stringWithFormat:@"%.0f", [msgDate timeIntervalSince1970] * 1000]} mutableCopy];
        [self setShouldScrollToUnreadOnRefresh:NO];
        [self refreshData];
    }
}

@end