diff options
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/APIClient.m | 2 | ||||
-rw-r--r-- | Juick/Main.storyboard | 22 | ||||
-rw-r--r-- | Juick/Supporting Files/Juick-Info.plist | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 3 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 15 | ||||
-rw-r--r-- | Juick/ViewControllers/NewPostViewController.m | 24 |
6 files changed, 35 insertions, 33 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m index aa5530b..079db5a 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -86,7 +86,7 @@ [self.backgroundQueue addOperationWithBlock:^{ [manager POST:@"/comment" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> _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 @@ </objects> <point key="canvasLocation" x="-223" y="-1072"/> </scene> - <!--Item--> + <!--Navigation Controller--> <scene sceneID="NkO-CZ-YSO"> <objects> <navigationController id="k3X-uv-0IF" sceneMemberID="viewController"> - <tabBarItem key="tabBarItem" title="Item" id="Qml-qG-fK2"/> + <tabBarItem key="tabBarItem" title="" id="Qml-qG-fK2"/> <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="3ze-yo-W7s"> <rect key="frame" x="0.0" y="20" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> @@ -60,7 +60,7 @@ </objects> <point key="canvasLocation" x="-1160" y="-342"/> </scene> - <!--Discover--> + <!--Discover View Controller--> <scene sceneID="uvH-u9-x7X"> <objects> <tableViewController id="VCH-GK-jaH" customClass="DiscoverViewController" sceneMemberID="viewController"> @@ -86,7 +86,7 @@ <outlet property="delegate" destination="VCH-GK-jaH" id="a3g-k1-u9r"/> </connections> </tableView> - <tabBarItem key="tabBarItem" title="Discover" image="nearby_icon" id="Je4-Zm-Zbu"/> + <tabBarItem key="tabBarItem" title="" image="nearby_icon" id="Je4-Zm-Zbu"/> <toolbarItems/> <navigationItem key="navigationItem" id="M2f-nV-K0C"> <barButtonItem key="leftBarButtonItem" image="chats_icon" id="eaY-Yt-u9g"> @@ -229,11 +229,11 @@ </objects> <point key="canvasLocation" x="-657.5" y="665.88833333333332"/> </scene> - <!--Item--> + <!--Navigation Controller--> <scene sceneID="slX-NB-ZJR"> <objects> <navigationController id="bqF-EV-jyA" sceneMemberID="viewController"> - <tabBarItem key="tabBarItem" title="Item" id="uDU-Ru-VA7"/> + <tabBarItem key="tabBarItem" title="" id="uDU-Ru-VA7"/> <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="MLM-G7-sIv"> <rect key="frame" x="0.0" y="20" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> @@ -313,7 +313,13 @@ </constraints> <viewLayoutGuide key="safeArea" id="UJz-7C-l1q"/> </view> - <navigationItem key="navigationItem" id="Yd6-Yh-gtd"/> + <navigationItem key="navigationItem" id="Yd6-Yh-gtd"> + <barButtonItem key="rightBarButtonItem" title="Send" id="GOm-zk-CTO"> + <connections> + <action selector="sendAction:" destination="rr1-jx-MLx" id="Nd3-Zm-2GK"/> + </connections> + </barButtonItem> + </navigationItem> <connections> <outlet property="bottomConstraint" destination="7HQ-Ue-xFR" id="gZE-2Y-pQd"/> <outlet property="textView" destination="XYj-Y4-lfM" id="AhV-B8-GYd"/> @@ -356,7 +362,7 @@ <scene sceneID="R7v-av-S80"> <objects> <tabBarController id="XnR-Hh-t65" sceneMemberID="viewController"> - <navigationItem key="navigationItem" id="Ub2-5o-fwx"/> + <extendedEdge key="edgesForExtendedLayout"/> <tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Qqp-Yg-IzB"> <rect key="frame" x="0.0" y="0.0" width="375" height="49"/> <autoresizingMask key="autoresizingMask"/> 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 @@ <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>48</string> + <string>49</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSApplicationCategoryType</key> 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]; }]; } } |