summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/DiscoverViewController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-03 12:55:50 +0300
committerGravatar Vitaly Takmazov2017-12-03 12:55:50 +0300
commit95f73b34319b62df320dcaa43e9c7925dc4868df (patch)
treea4905d9b7423817528c24a187a26c46e65f0228e /Juick/ViewControllers/DiscoverViewController.m
parentdc73ee639bc902b7ef93cfa86630fa4ada758397 (diff)
Refactor
Diffstat (limited to 'Juick/ViewControllers/DiscoverViewController.m')
-rw-r--r--Juick/ViewControllers/DiscoverViewController.m37
1 files changed, 37 insertions, 0 deletions
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