From e463896f7cab7eb9482085cf39a025e83408a14c Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Wed, 2 Oct 2019 21:00:34 +0300
Subject: Cleanup notifications
---
Juick/Main.storyboard | 4 ++--
Juick/ViewControllers/ChatViewController.m | 2 +-
Juick/ViewControllers/JuickNavigationController.m | 26 +++++++++++++++++------
Juick/ViewControllers/ThreadViewController.m | 8 -------
4 files changed, 22 insertions(+), 18 deletions(-)
(limited to 'Juick')
diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard
index 4ab443e..20364fe 100644
--- a/Juick/Main.storyboard
+++ b/Juick/Main.storyboard
@@ -8,10 +8,10 @@
-
+
-
+
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m
index 4f9481c..989b531 100644
--- a/Juick/ViewControllers/ChatViewController.m
+++ b/Juick/ViewControllers/ChatViewController.m
@@ -21,7 +21,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
- [self.navigationController.navigationItem setTitle:self.uname];
+ [self.navigationController.visibleViewController setTitle:self.uname];
[self.tableView registerNib:[UINib nibWithNibName:@"BubbleMessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"bubbleMessageCell"];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
diff --git a/Juick/ViewControllers/JuickNavigationController.m b/Juick/ViewControllers/JuickNavigationController.m
index a066dbd..8673866 100644
--- a/Juick/ViewControllers/JuickNavigationController.m
+++ b/Juick/ViewControllers/JuickNavigationController.m
@@ -12,6 +12,7 @@
#import "APIClient.h"
#import "MessagesViewController.h"
#import "ThreadViewController.h"
+#import "NewPostViewController.h"
#import "Message.h"
@@ -43,19 +44,30 @@
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"threadSegue"]) {
- if ([sender isKindOfClass:[MessagesViewController class]]) {
+ ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
+ [threadVC setShouldScrollToUnreadOnRefresh:NO];
+ NSNumber *pushedThread = [AppDelegate shared].pushedThread;
+ if (pushedThread) {
+ [threadVC setParams:@{@"mid": pushedThread }];
+ if ([AppDelegate shared].pushedReplyId) {
+ [threadVC setFirstUnread:[AppDelegate shared].pushedReplyId];
+ [threadVC setShouldScrollToUnreadOnRefresh:YES];
+ }
+ } else {
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];
- }*/
+ }
+ if ([segue.identifier isEqualToString:@"editorSegue"]) {
+ if ([sender isKindOfClass:[ThreadViewController class]]) {
+ ThreadViewController *thread = (ThreadViewController *) sender;
+ Message *msg = [thread.messages objectAtIndex:[thread.tableView indexPathForSelectedRow].row];
+ NewPostViewController *postVC = [[((UINavigationController *)segue.destinationViewController) viewControllers] firstObject];
+ [postVC setReplyTo:msg];
+ }
}
}
diff --git a/Juick/ViewControllers/ThreadViewController.m b/Juick/ViewControllers/ThreadViewController.m
index 646dbc4..c345822 100644
--- a/Juick/ViewControllers/ThreadViewController.m
+++ b/Juick/ViewControllers/ThreadViewController.m
@@ -28,14 +28,6 @@
}
}
--(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- if ([segue.identifier isEqual: @"editorSegue"]) {
- Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
- NewPostViewController *postVC = (NewPostViewController *)segue.destinationViewController;
- [postVC setReplyTo:msg];
- }
-}
-
- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender {
if ([identifier isEqualToString:@"editorSegue"]) {
if ([[APIClient sharedClient] isAuthenticated]) {
--
cgit v1.2.3