From 38d16e9d26b4f8653063ef2c572ccfc803ab165b Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sun, 10 Dec 2017 11:52:54 +0300
Subject: fix layout
---
Juick/Supporting Files/Juick-Info.plist | 2 +-
Juick/ViewControllers/DiscoverViewController.m | 26 +++++++++++++++++++++++---
Juick/ViewControllers/MessagesViewController.m | 20 +-------------------
Juick/ViewControllers/NewPostViewController.m | 3 +--
Juick/Views/MessageCell.xib | 19 +++++++++----------
5 files changed, 35 insertions(+), 35 deletions(-)
(limited to 'Juick')
diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist
index 53c5301..dcaee08 100644
--- a/Juick/Supporting Files/Juick-Info.plist
+++ b/Juick/Supporting Files/Juick-Info.plist
@@ -21,7 +21,7 @@
CFBundleSignature
????
CFBundleVersion
- 1.0.34
+ 1.0.35
ITSAppUsesNonExemptEncryption
LSApplicationCategoryType
diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m
index 2a109d4..26ec710 100644
--- a/Juick/ViewControllers/DiscoverViewController.m
+++ b/Juick/ViewControllers/DiscoverViewController.m
@@ -23,10 +23,25 @@ AppDelegate *appDelegate;
-(void) viewDidLoad {
[super viewDidLoad];
[self.navigationController.navigationBar setPrefersLargeTitles:YES];
- if ([self.path isEqualToString:[APIClient feedUrl]]) {
- [self setTitle:@"My feed"];
+ if ([User isAuthenticated]) {
+ [User checkIsValid:^(BOOL success) {
+ if (success) {
+ if ([self.path length] == 0) {
+ self.path = [APIClient feedUrl];
+ [self setTitle:@"My feed"];
+ }
+ [self refreshData:NO];
+ } else {
+ [User throwUnableToLogin:self];
+ }
+ }];
+
} else {
- [self setTitle:@"Discover"];
+ if ([self.path length] == 0) {
+ self.path = [APIClient messagesUrl];
+ [self setTitle:@"Discover"];
+ }
+ [self refreshData:NO];
}
appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
if (appDelegate.pushedThread != nil) {
@@ -43,9 +58,11 @@ AppDelegate *appDelegate;
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqual: @"threadViewSegue"]) {
NSNumber *mid;
+ BOOL scrollToEnd = NO;
if (appDelegate.pushedThread != nil) {
mid = appDelegate.pushedThread;
appDelegate.pushedThread = nil;
+ scrollToEnd = YES;
} else {
Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row];
mid = msg.mid;
@@ -53,12 +70,14 @@ AppDelegate *appDelegate;
ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController;
[threadVC setPath:[APIClient threadUrl]];
[threadVC setParams:[@{@"mid": mid } mutableCopy]];
+ [threadVC refreshData:scrollToEnd];
}
}
- (IBAction)filterAction:(id)sender {
UIAlertController *filterAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
[filterAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
[filterAlert addAction:[UIAlertAction actionWithTitle:@"My feed" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+ [self setTitle:@"My feed"];
self.path = [APIClient feedUrl];
self.params = nil;
[self.messages removeAllObjects];
@@ -66,6 +85,7 @@ AppDelegate *appDelegate;
[self refreshData:NO];
}]];
[filterAlert addAction:[UIAlertAction actionWithTitle:@"Discover" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+ [self setTitle:@"Discover"];
self.path = [APIClient messagesUrl];
self.params = nil;
[self.messages removeAllObjects];
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index 823d838..8e4835b 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -76,25 +76,7 @@
self.tableView.estimatedRowHeight = 500.0f;
self.messages = [NSMutableArray array];
self.refreshControl = [UIRefreshControl new];
- [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
- if ([User isAuthenticated]) {
- [User checkIsValid:^(BOOL success) {
- if (success) {
- if ([self.path length] == 0) {
- self.path = [APIClient feedUrl];
- }
- [self refreshData:NO];
- } else {
- [User throwUnableToLogin:self];
- }
- }];
-
- } else {
- if ([self.path length] == 0) {
- self.path = [APIClient messagesUrl];
- }
- [self refreshData:NO];
- }
+ [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
}
- (void) composePressed {
diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m
index 8a9bc0e..143dd96 100644
--- a/Juick/ViewControllers/NewPostViewController.m
+++ b/Juick/ViewControllers/NewPostViewController.m
@@ -35,8 +35,7 @@
}
self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self action:@selector(cancelCompose)];
- self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
- target:self action:@selector(doneCompose)];
+ self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send" style:UIBarButtonItemStyleDone target:self action:@selector(doneCompose)];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
[self.textView becomeFirstResponder];
diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib
index e54c8f9..d32defe 100644
--- a/Juick/Views/MessageCell.xib
+++ b/Juick/Views/MessageCell.xib
@@ -23,26 +23,25 @@
-
+
-
-
+
+
-
-
+
-
-
+
+
-
+
--
cgit v1.2.3