summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/DiscoverViewController.h14
-rw-r--r--Juick/ViewControllers/DiscoverViewController.m37
-rw-r--r--Juick/ViewControllers/MessagesViewController.h3
-rw-r--r--Juick/ViewControllers/MessagesViewController.m21
4 files changed, 54 insertions, 21 deletions
diff --git a/Juick/ViewControllers/DiscoverViewController.h b/Juick/ViewControllers/DiscoverViewController.h
new file mode 100644
index 0000000..6bec23d
--- /dev/null
+++ b/Juick/ViewControllers/DiscoverViewController.h
@@ -0,0 +1,14 @@
+//
+// DiscoverViewController.h
+// Juick
+//
+// Created by Vitaly Takmazov on 03/12/2017.
+// Copyright © 2017 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "MessagesViewController.h"
+
+@interface DiscoverViewController : MessagesViewController
+
+@end
diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m
new file mode 100644
index 0000000..4b22979
--- /dev/null
+++ b/Juick/ViewControllers/DiscoverViewController.m
@@ -0,0 +1,37 @@
+//
+// DiscoverViewController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 03/12/2017.
+// Copyright © 2017 com.juick. All rights reserved.
+//
+
+#import "DiscoverViewController.h"
+#import "ThreadViewController.h"
+#import "MessageCell.h"
+#import "APIClient.h"
+
+@interface DiscoverViewController ()
+
+@end
+
+@implementation DiscoverViewController
+
+
+
+-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ NSString * cellIdentifier = @"messageCell";
+ MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
+ [self performSegueWithIdentifier:@"threadViewSegue" sender:cell];
+}
+
+-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+ if ([segue.identifier isEqual: @"threadViewSegue"]) {
+ Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
+ ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
+ [threadVC setPath:[APIClient threadUrl]];
+ [threadVC setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]];
+ }
+}
+
+@end
diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h
index 33b86b6..7f5f274 100644
--- a/Juick/ViewControllers/MessagesViewController.h
+++ b/Juick/ViewControllers/MessagesViewController.h
@@ -12,4 +12,7 @@
@property(nonatomic, strong) NSString *path;
@property(nonatomic, strong) NSMutableDictionary *params;
- (void) refreshData;
+
+@property(nonatomic, strong) NSMutableArray *messages;
+@property(nonatomic, assign) Boolean dataLoading;
@end
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 5a1521d..5a5a794 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -21,12 +21,6 @@
#import "NSURL+PathParameters.h"
-@interface MessagesViewController ()
-
-@property(nonatomic, strong) NSMutableArray *messages;
-@property(nonatomic, assign) Boolean dataLoading;
-@end
-
@implementation MessagesViewController
- (void) refreshData {
@@ -115,21 +109,6 @@
return cell;
}
--(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- NSString * cellIdentifier = @"messageCell";
- MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
- [self performSegueWithIdentifier:@"threadViewSegue" sender:cell];
-}
-
--(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- if ([segue.identifier isEqual: @"threadViewSegue"]) {
- Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
- ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
- [threadVC setPath:[APIClient threadUrl]];
- [threadVC setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]];
- }
-}
-
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView_ {
CGFloat actualPosition = scrollView_.contentOffset.y;
CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2;