diff options
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/Main.storyboard | 4 | ||||
-rw-r--r-- | Juick/Supporting Files/Juick-Info.plist | 2 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.h | 14 | ||||
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 37 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.h | 3 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.m | 21 |
6 files changed, 57 insertions, 24 deletions
diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 600b5ea..20bd3eb 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -63,13 +63,13 @@ <!--Discover--> <scene sceneID="uvH-u9-x7X"> <objects> - <tableViewController title="Discover" id="VCH-GK-jaH" customClass="MessagesViewController" sceneMemberID="viewController"> + <tableViewController title="Discover" id="VCH-GK-jaH" customClass="DiscoverViewController" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="tbe-Zb-PfB"> <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <prototypes> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="Orz-mD-PnE"> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="prototypeMessage" id="Orz-mD-PnE"> <rect key="frame" x="0.0" y="28" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Orz-mD-PnE" id="WRd-ev-Osb"> diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index d9325fa..c6816d5 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>1.0.21</string> + <string>1.0.22</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>LSApplicationCategoryType</key> diff --git a/Juick/ViewControllers/DiscoverViewController.h b/Juick/ViewControllers/DiscoverViewController.h new file mode 100644 index 0000000..6bec23d --- /dev/null +++ b/Juick/ViewControllers/DiscoverViewController.h @@ -0,0 +1,14 @@ +// +// DiscoverViewController.h +// Juick +// +// Created by Vitaly Takmazov on 03/12/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "MessagesViewController.h" + +@interface DiscoverViewController : MessagesViewController + +@end diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m new file mode 100644 index 0000000..4b22979 --- /dev/null +++ b/Juick/ViewControllers/DiscoverViewController.m @@ -0,0 +1,37 @@ +// +// DiscoverViewController.m +// Juick +// +// Created by Vitaly Takmazov on 03/12/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import "DiscoverViewController.h" +#import "ThreadViewController.h" +#import "MessageCell.h" +#import "APIClient.h" + +@interface DiscoverViewController () + +@end + +@implementation DiscoverViewController + + + +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSString * cellIdentifier = @"messageCell"; + MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; + [self performSegueWithIdentifier:@"threadViewSegue" sender:cell]; +} + +-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.identifier isEqual: @"threadViewSegue"]) { + Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; + ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; + [threadVC setPath:[APIClient threadUrl]]; + [threadVC setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]]; + } +} + +@end diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h index 33b86b6..7f5f274 100644 --- a/Juick/ViewControllers/MessagesViewController.h +++ b/Juick/ViewControllers/MessagesViewController.h @@ -12,4 +12,7 @@ @property(nonatomic, strong) NSString *path; @property(nonatomic, strong) NSMutableDictionary *params; - (void) refreshData; + +@property(nonatomic, strong) NSMutableArray *messages; +@property(nonatomic, assign) Boolean dataLoading; @end diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 5a1521d..5a5a794 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -21,12 +21,6 @@ #import "NSURL+PathParameters.h" -@interface MessagesViewController () - -@property(nonatomic, strong) NSMutableArray *messages; -@property(nonatomic, assign) Boolean dataLoading; -@end - @implementation MessagesViewController - (void) refreshData { @@ -115,21 +109,6 @@ return cell; } --(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSString * cellIdentifier = @"messageCell"; - MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; - [self performSegueWithIdentifier:@"threadViewSegue" sender:cell]; -} - --(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqual: @"threadViewSegue"]) { - Message *msg = [self.messages objectAtIndex:[self.tableView indexPathForSelectedRow].row]; - ThreadViewController *threadVC = (ThreadViewController *)segue.destinationViewController; - [threadVC setPath:[APIClient threadUrl]]; - [threadVC setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]]; - } -} - -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView_ { CGFloat actualPosition = scrollView_.contentOffset.y; CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2; |