From f153a400634d4aa726dafd2257921b904c92824b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 2 Apr 2018 00:31:43 +0300 Subject: multiple fixes --- Juick.xcodeproj/project.pbxproj | 6 +++++- .../vt.xcuserdatad/xcschemes/Juick.xcscheme | 4 +--- Juick/APIClient.m | 2 +- Juick/Main.storyboard | 22 ++++++++++++-------- Juick/Supporting Files/Juick-Info.plist | 2 +- Juick/ViewControllers/DialogsViewController.m | 3 ++- Juick/ViewControllers/DiscoverViewController.m | 15 +++++++++----- Juick/ViewControllers/NewPostViewController.m | 24 +++++++--------------- 8 files changed, 41 insertions(+), 37 deletions(-) diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index 79b5e00..7d6e3c1 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -407,7 +407,7 @@ 77317BA0181BBE8500D60005 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = com.juick; TargetAttributes = { 77317BA7181BBE8500D60005 = { @@ -635,12 +635,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -687,12 +689,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/Juick.xcodeproj/xcuserdata/vt.xcuserdatad/xcschemes/Juick.xcscheme b/Juick.xcodeproj/xcuserdata/vt.xcuserdatad/xcschemes/Juick.xcscheme index f10319e..8b9b816 100644 --- a/Juick.xcodeproj/xcuserdata/vt.xcuserdatad/xcschemes/Juick.xcscheme +++ b/Juick.xcodeproj/xcuserdata/vt.xcuserdatad/xcschemes/Juick.xcscheme @@ -1,6 +1,6 @@ _Nonnull formData) { [formData appendPartWithFormData:[[mid stringValue] dataUsingEncoding:NSUTF8StringEncoding] name:@"mid"]; - [formData appendPartWithFormData:[[rid stringValue] dataUsingEncoding:NSUTF8StringEncoding] name:@"rid"]; + [formData appendPartWithFormData:[[NSString stringWithFormat:@"%d", [rid intValue]] dataUsingEncoding:NSUTF8StringEncoding] name:@"rid"]; [formData appendPartWithFormData:[text dataUsingEncoding:NSUTF8StringEncoding] name:@"body"]; } progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { NSLog(@"Success!"); diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 0b2308a..e416be2 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -42,11 +42,11 @@ - + - + @@ -60,7 +60,7 @@ - + @@ -86,7 +86,7 @@ - + @@ -229,11 +229,11 @@ - + - + @@ -313,7 +313,13 @@ - + + + + + + + @@ -356,7 +362,7 @@ - + diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index 820c009..9a3f0e9 100644 --- a/Juick/Supporting Files/Juick-Info.plist +++ b/Juick/Supporting Files/Juick-Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 48 + 49 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index 4f89814..d40dd95 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -20,7 +20,8 @@ - (void)viewDidLoad { [super viewDidLoad]; - [self.navigationController.visibleViewController setTitle:@"Chats"]; + [self.tabBarItem setTitle:@"Chats"]; + self.navigationController.visibleViewController.navigationItem.title = @"Chats"; [self.view setBackgroundColor:[ColorScheme mainBackground]]; [self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"]; self.chats = [NSMutableArray array]; diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m index 11010ae..3b01297 100644 --- a/Juick/ViewControllers/DiscoverViewController.m +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -28,7 +28,8 @@ AppDelegate *appDelegate; if (success) { if ([self.path length] == 0) { self.path = [APIClient feedUrl]; - [self.navigationController.visibleViewController setTitle:@"My feed"]; + [self.tabBarItem setTitle:@"My feed"]; + self.navigationController.visibleViewController.navigationItem.title = @"My feed"; } [self refreshData:NO]; } else { @@ -39,7 +40,8 @@ AppDelegate *appDelegate; } else { if ([self.path length] == 0) { self.path = [APIClient messagesUrl]; - [self.navigationController.visibleViewController setTitle:@"Discover"]; + [self.tabBarItem setTitle:@"Discover"]; + self.navigationController.visibleViewController.navigationItem.title = @"Discover"; } [self refreshData:NO]; } @@ -81,24 +83,27 @@ AppDelegate *appDelegate; 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.navigationController.visibleViewController setTitle:@"My feed"]; self.path = [APIClient feedUrl]; + [self.tabBarItem setTitle:@"My feed"]; + self.navigationController.visibleViewController.navigationItem.title = @"My feed"; self.params = nil; [self.messages removeAllObjects]; [self.tableView reloadData]; [self refreshData:NO]; }]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Discover" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [self.navigationController.visibleViewController setTitle:@"Discover"]; self.path = [APIClient messagesUrl]; + [self.tabBarItem setTitle:@"Discover"]; + self.navigationController.visibleViewController.navigationItem.title = @"Discover"; self.params = nil; [self.messages removeAllObjects]; [self.tableView reloadData]; [self refreshData:NO]; }]]; [filterAlert addAction:[UIAlertAction actionWithTitle:@"Discussions" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - [self.navigationController.visibleViewController setTitle:@"Discussions"]; self.path = [APIClient discussionsUrl]; + [self.tabBarItem setTitle:@"Discussions"]; + self.navigationController.visibleViewController.navigationItem.title = @"Discussions"; self.params = nil; [self.messages removeAllObjects]; [self.tableView reloadData]; diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 02d810b..7b80a52 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -31,35 +31,25 @@ if (_replyTo != nil) { MessageInputView *inputView = (MessageInputView *) self.inputAccessoryView; inputView.quoteText.text = _replyTo.text; - self.navigationController.visibleViewController.title = [NSString stringWithFormat:@"Reply to %@", _replyTo.user.uname]; + self.title = [NSString stringWithFormat:@"Reply to %@", _replyTo.user.uname]; } else { - self.navigationController.visibleViewController.title = @"Post"; + self.title = @"Post"; } - self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target:self action:@selector(cancelCompose)]; - 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]; } -- (void) cancelCompose { - [self.textView resignFirstResponder]; - [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; -} - -- (void) doneCompose { +- (IBAction)sendAction:(id)sender { if (_replyTo == nil) { [[APIClient sharedClient] postMessage:self.textView.text result:^(Message *msg, NSError *err) { - [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; - MessagesViewController *target = (MessagesViewController *)self.navigationController.visibleViewController; - [target refreshData:YES]; + [self.navigationController popViewControllerAnimated:YES]; + [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES]; }]; } else { [[APIClient sharedClient] postReplyToThread:_replyTo.mid inReplyTo:_replyTo.rid text:self.textView.text result:^(Message *msg, NSError *err) { - [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; - MessagesViewController *target = (MessagesViewController *)self.navigationController.visibleViewController; - [target refreshData:YES]; + [self.navigationController popViewControllerAnimated:YES]; + [(MessagesViewController *)self.navigationController.visibleViewController refreshData:YES]; }]; } } -- cgit v1.2.3