summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers/JuickNavigationController.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-02 17:16:01 +0300
committerGravatar Vitaly Takmazov2019-10-02 17:16:01 +0300
commitbf573afb9d05ce34ecd22b3dca85aca2c3896ae6 (patch)
tree2b55dfddb6d31f81294f2554d85bf41607a63f07 /Juick/ViewControllers/JuickNavigationController.m
parent33539a3c9c8534776722aa1148499f984e0019e7 (diff)
Shared navigation
Diffstat (limited to 'Juick/ViewControllers/JuickNavigationController.m')
-rw-r--r--Juick/ViewControllers/JuickNavigationController.m65
1 files changed, 65 insertions, 0 deletions
diff --git a/Juick/ViewControllers/JuickNavigationController.m b/Juick/ViewControllers/JuickNavigationController.m
new file mode 100644
index 0000000..a066dbd
--- /dev/null
+++ b/Juick/ViewControllers/JuickNavigationController.m
@@ -0,0 +1,65 @@
+//
+// JuickNavigationController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 02/10/2019.
+// Copyright © 2019 com.juick. All rights reserved.
+//
+
+#import "JuickNavigationController.h"
+
+#import "AppDelegate.h"
+#import "APIClient.h"
+#import "MessagesViewController.h"
+#import "ThreadViewController.h"
+
+#import "Message.h"
+
+@interface JuickNavigationController ()
+
+
+@end
+
+@implementation JuickNavigationController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+}
+
+#pragma mark - Navigation
+
+- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
+ if ([identifier isEqualToString:@"editorSegue"]) {
+ if ([[APIClient sharedClient] isAuthenticated]) {
+ return YES;
+ } else {
+ [[AppDelegate shared] presentLoginView:self];
+ return NO;
+ }
+ }
+ return YES;
+}
+
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+ if ([segue.identifier isEqualToString:@"threadSegue"]) {
+ if ([sender isKindOfClass:[MessagesViewController class]]) {
+ MessagesViewController *vc = (MessagesViewController *) sender;
+ Message *msg = vc.messages[vc.tableView.indexPathForSelectedRow.row];
+ ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
+ [threadVC setMessages:[@[msg] mutableCopy]];
+ [threadVC setParams:@{@"mid": msg.mid }];
+ [threadVC setShouldScrollToUnreadOnRefresh:NO];
+ }
+ /*
+ if (rid) {
+ [threadVC setFirstUnread:rid];
+ [threadVC setShouldScrollToUnreadOnRefresh:YES];
+ }*/
+ }
+}
+
+- (IBAction)newMessage:(id)sender {
+ [[AppDelegate shared] presentLoginView:self];
+}
+@end