diff options
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 18 | ||||
-rw-r--r-- | Juick/APIClient.h | 1 | ||||
-rw-r--r-- | Juick/APIClient.m | 21 | ||||
-rw-r--r-- | Juick/Main.storyboard | 59 | ||||
-rw-r--r-- | Juick/ViewControllers/ChatViewController.h | 15 | ||||
-rw-r--r-- | Juick/ViewControllers/ChatViewController.m | 65 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 13 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.h | 23 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.m | 43 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.xib | 29 | ||||
-rw-r--r-- | Juick/Views/FixedLabel.h | 13 | ||||
-rw-r--r-- | Juick/Views/FixedLabel.m | 21 |
12 files changed, 307 insertions, 14 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index e8c6344..79b5e00 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -26,6 +26,9 @@ 773E6397204BCB64008B8F8D /* ConversationCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E6396204BCB64008B8F8D /* ConversationCell.m */; }; 773E639A204BCE6D008B8F8D /* DialogsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E6399204BCE6D008B8F8D /* DialogsViewController.m */; }; 773E639D204BD0F2008B8F8D /* Chat.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E639C204BD0F2008B8F8D /* Chat.m */; }; + 773E63A0204BDF16008B8F8D /* ChatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E639F204BDF16008B8F8D /* ChatViewController.m */; }; + 773E63A3204BE036008B8F8D /* BubbleMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */; }; + 773E63A6204BE11B008B8F8D /* FixedLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E63A5204BE11B008B8F8D /* FixedLabel.m */; }; 773F231C1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 773F231B1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf */; }; 773F23331F76ECAC00B5B0DF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 773F23321F76ECAC00B5B0DF /* LaunchScreen.storyboard */; }; 773F23371F76ED5E00B5B0DF /* Splash.png in Resources */ = {isa = PBXBuildFile; fileRef = 773F23341F76ED5D00B5B0DF /* Splash.png */; }; @@ -94,6 +97,12 @@ 773E6399204BCE6D008B8F8D /* DialogsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DialogsViewController.m; sourceTree = "<group>"; }; 773E639B204BD0F2008B8F8D /* Chat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Chat.h; sourceTree = "<group>"; }; 773E639C204BD0F2008B8F8D /* Chat.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Chat.m; sourceTree = "<group>"; }; + 773E639E204BDF16008B8F8D /* ChatViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChatViewController.h; sourceTree = "<group>"; }; + 773E639F204BDF16008B8F8D /* ChatViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChatViewController.m; sourceTree = "<group>"; }; + 773E63A1204BE036008B8F8D /* BubbleMessageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BubbleMessageCell.h; sourceTree = "<group>"; }; + 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BubbleMessageCell.m; sourceTree = "<group>"; }; + 773E63A4204BE11B008B8F8D /* FixedLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixedLabel.h; sourceTree = "<group>"; }; + 773E63A5204BE11B008B8F8D /* FixedLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FixedLabel.m; sourceTree = "<group>"; }; 773F231B1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = SerpentineBoldItalic.ttf; sourceTree = "<group>"; }; 773F23321F76ECAC00B5B0DF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; }; 773F23341F76ED5D00B5B0DF /* Splash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Splash.png; sourceTree = "<group>"; }; @@ -302,6 +311,8 @@ 776C41C01FD3FF6E0063B82E /* DiscoverViewController.m */, 773E6398204BCE6D008B8F8D /* DialogsViewController.h */, 773E6399204BCE6D008B8F8D /* DialogsViewController.m */, + 773E639E204BDF16008B8F8D /* ChatViewController.h */, + 773E639F204BDF16008B8F8D /* ChatViewController.m */, ); path = ViewControllers; sourceTree = "<group>"; @@ -332,6 +343,10 @@ 77E61A5D1FD4682B00B4E304 /* MessageInputView.m */, 773E6395204BCB64008B8F8D /* ConversationCell.h */, 773E6396204BCB64008B8F8D /* ConversationCell.m */, + 773E63A1204BE036008B8F8D /* BubbleMessageCell.h */, + 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */, + 773E63A4204BE11B008B8F8D /* FixedLabel.h */, + 773E63A5204BE11B008B8F8D /* FixedLabel.m */, ); path = Views; sourceTree = "<group>"; @@ -547,6 +562,7 @@ 776C41C11FD3FF6E0063B82E /* DiscoverViewController.m in Sources */, 77FCADDF1D6A50DA00CBA649 /* APIClient.m in Sources */, 77A0954A181F1F25002BDECD /* Message.m in Sources */, + 773E63A0204BDF16008B8F8D /* ChatViewController.m in Sources */, 773E639D204BD0F2008B8F8D /* Chat.m in Sources */, 773E639A204BCE6D008B8F8D /* DialogsViewController.m in Sources */, 774528C51F93AC0F004D110B /* CoreDataStack.m in Sources */, @@ -554,6 +570,7 @@ 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */, 77B099A6189D57F000A84F59 /* User.m in Sources */, 77C6ADE41F7717BC000AEA8C /* ThreadViewController.m in Sources */, + 773E63A3204BE036008B8F8D /* BubbleMessageCell.m in Sources */, 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */, 77C67EE81828379700427098 /* ColorScheme.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, @@ -562,6 +579,7 @@ 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */, 77317BB8181BBE8500D60005 /* main.m in Sources */, 774528C21F930C06004D110B /* Attachment.m in Sources */, + 773E63A6204BE11B008B8F8D /* FixedLabel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Juick/APIClient.h b/Juick/APIClient.h index 668a0a9..46e86c7 100644 --- a/Juick/APIClient.h +++ b/Juick/APIClient.h @@ -20,6 +20,7 @@ -(void) postMessage:(NSString *)text result:(void(^)(Message *, NSError *))callback; -(void) postReplyToThread:(NSNumber *)mid inReplyTo:(NSNumber *)rid text:(NSString *)text result:(void(^)(Message *, NSError *))callback; -(void) fetchChats:(void(^)(NSArray *, NSError *))callback; +-(void) fetchChatWithUser:(NSString *)uname callback:(void(^)(NSArray *, NSError *))callback; +(NSString *) messagesUrl; +(NSString *) threadUrl; diff --git a/Juick/APIClient.m b/Juick/APIClient.m index 5352320..aa5530b 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -122,6 +122,27 @@ }]; }]; } +-(void) fetchChatWithUser:(NSString *)uname callback:(void (^)(NSArray *, NSError *))callback { + AFHTTPSessionManager *manager = [APIClient sharedClient].manager; + NSDictionary *params = @{@"uname": uname}; + [self.backgroundQueue addOperationWithBlock:^{ + [manager GET:@"/pm" parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + NSMutableArray *messages = [NSMutableArray new]; + NSArray *messagesList = (NSArray *)responseObject; + [messagesList enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [messages addObject:[Message yy_modelWithJSON:obj]]; + }]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + callback(messages, nil); + }]; + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSLog(@"Error: %@", [error localizedDescription]); + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + callback(nil, error); + }]; + }]; + }]; +} +(NSString *) messagesUrl { diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 3383f18..d6698e4 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -231,13 +231,16 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <prototypes> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" id="KSR-Fu-ZcK" customClass="ConversationCell"> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="notificationCell" id="KSR-Fu-ZcK" userLabel=" " customClass="ConversationCell"> <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="KSR-Fu-ZcK" id="BUc-6q-MYj"> - <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/> <autoresizingMask key="autoresizingMask"/> </tableViewCellContentView> + <connections> + <segue destination="jVt-4s-14k" kind="push" identifier="chatSegue" id="YUK-fh-DMd"/> + </connections> </tableViewCell> </prototypes> <connections> @@ -250,7 +253,24 @@ </tableViewController> <placeholder placeholderIdentifier="IBFirstResponder" id="8ge-Xf-wBN" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> - <point key="canvasLocation" x="-222.5" y="667"/> + <point key="canvasLocation" x="294" y="666"/> + </scene> + <!--Item--> + <scene sceneID="uim-Nh-TgZ"> + <objects> + <navigationController id="5uj-cs-Oeg" sceneMemberID="viewController"> + <tabBarItem key="tabBarItem" title="Item" id="V9z-ea-0Yt"/> + <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="z7X-OF-hhE"> + <rect key="frame" x="0.0" y="20" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + </navigationBar> + <connections> + <segue destination="vqF-gx-pZG" kind="relationship" relationship="rootViewController" id="ufB-2X-yDu"/> + </connections> + </navigationController> + <placeholder placeholderIdentifier="IBFirstResponder" id="klE-aM-KuP" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-202" y="666"/> </scene> <!--New post--> <scene sceneID="bF2-U0-WHJ"> @@ -296,6 +316,35 @@ </objects> <point key="canvasLocation" x="-222.5" y="-187.87166666666664"/> </scene> + <!--Chat View Controller--> + <scene sceneID="pvH-EU-EhQ"> + <objects> + <tableViewController id="jVt-4s-14k" customClass="ChatViewController" sceneMemberID="viewController"> + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="CGw-ia-Afb"> + <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="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <prototypes> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="bubbleMessageCell" id="LzB-jF-bmj" customClass="BubbleMessageCell"> + <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" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="LzB-jF-bmj" id="GOC-84-YKd"> + <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + </tableViewCellContentView> + </tableViewCell> + </prototypes> + <connections> + <outlet property="dataSource" destination="jVt-4s-14k" id="AmJ-8N-KSz"/> + <outlet property="delegate" destination="jVt-4s-14k" id="oAC-v1-Xqi"/> + </connections> + </tableView> + <navigationItem key="navigationItem" id="bwh-ES-OoM"/> + </tableViewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="a3c-tt-waA" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="294" y="-180"/> + </scene> <!--Tab Bar Controller--> <scene sceneID="R7v-av-S80"> <objects> @@ -307,7 +356,7 @@ </tabBar> <connections> <segue destination="meX-Jy-oiG" kind="relationship" relationship="viewControllers" id="XZu-DW-wVU"/> - <segue destination="vqF-gx-pZG" kind="relationship" relationship="viewControllers" id="mGQ-lO-sEh"/> + <segue destination="5uj-cs-Oeg" kind="relationship" relationship="viewControllers" id="rhN-wq-V4r"/> </connections> </tabBarController> <placeholder placeholderIdentifier="IBFirstResponder" id="AnM-ht-zf8" userLabel="First Responder" sceneMemberID="firstResponder"/> @@ -321,6 +370,6 @@ <image name="settings_icon" width="20" height="20"/> </resources> <inferredMetricsTieBreakers> - <segue reference="gw8-QZ-Hrt"/> + <segue reference="vj1-M0-h6U"/> </inferredMetricsTieBreakers> </document> diff --git a/Juick/ViewControllers/ChatViewController.h b/Juick/ViewControllers/ChatViewController.h new file mode 100644 index 0000000..7ea8030 --- /dev/null +++ b/Juick/ViewControllers/ChatViewController.h @@ -0,0 +1,15 @@ +// +// ChatViewController.h +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "User.h" + +@interface ChatViewController : UITableViewController +@property(nonatomic, strong) NSMutableArray *messages; +@property(nonatomic, strong) NSString *uname; +@end diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m new file mode 100644 index 0000000..f88bfa5 --- /dev/null +++ b/Juick/ViewControllers/ChatViewController.m @@ -0,0 +1,65 @@ +// +// ChatViewController.m +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "ChatViewController.h" +#import "BubbleMessageCell.h" +#import "APIClient.h" + +@interface ChatViewController () + +@end + +@implementation ChatViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self.tableView registerNib:[UINib nibWithNibName:@"BubbleMessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"bubbleMessageCell"]; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive; + self.tableView.allowsSelection = NO; + self.messages = [NSMutableArray array]; + [[APIClient sharedClient] fetchChatWithUser:self.uname callback:^(NSArray *messages, NSError *err) { + if (err == nil) { + [self.messages addObjectsFromArray:[[messages reverseObjectEnumerator] allObjects]]; + NSMutableArray *indexPaths = [NSMutableArray new]; + for (NSUInteger index = 0; index < [messages count]; index++) { + [indexPaths addObject:[NSIndexPath indexPathForRow:index inSection: 0]]; + } + [self.tableView beginUpdates]; + [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:YES]; + [self.tableView endUpdates]; + [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self.messages count]-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; + } + }]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.messages count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + BubbleMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"bubbleMessageCell" forIndexPath:indexPath]; + + [cell configureWithMessage:[self.messages objectAtIndex:indexPath.row]]; + + return cell; +} + +@end diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index 8eea017..878e912 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -7,6 +7,7 @@ // #import "DialogsViewController.h" +#import "ChatViewController.h" #import "ColorScheme.h" #import "ConversationCell.h" #import "APIClient.h" @@ -53,5 +54,17 @@ return cell; } +-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + [self performSegueWithIdentifier:@"chatSegue" sender:self]; +} + +-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.identifier isEqualToString:@"chatSegue"]) { + Chat *chat = [self.chats objectAtIndex:[self.tableView indexPathForSelectedRow].row]; + ChatViewController *vc = (ChatViewController *)segue.destinationViewController; + [vc setUname:chat.uname]; + } +} + @end diff --git a/Juick/Views/BubbleMessageCell.h b/Juick/Views/BubbleMessageCell.h new file mode 100644 index 0000000..1f5d2e9 --- /dev/null +++ b/Juick/Views/BubbleMessageCell.h @@ -0,0 +1,23 @@ +// +// BubbleMessageCell.h +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "Message.h" +#import "FixedLabel.h" + +@import TTTAttributedLabel; + +@interface BubbleMessageCell : UITableViewCell<TTTAttributedLabelDelegate> +@property (strong, nonatomic) IBOutlet UIImageView *avatarView; +@property (strong, nonatomic) IBOutlet UILabel *unreadMarker; +@property (strong, nonatomic) IBOutlet UILabel *name; +@property (strong, nonatomic) IBOutlet FixedLabel *message; + +-(void) configureWithMessage:(Message *) message; + +@end diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m new file mode 100644 index 0000000..b201664 --- /dev/null +++ b/Juick/Views/BubbleMessageCell.m @@ -0,0 +1,43 @@ +// +// BubbleMessageCell.m +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "BubbleMessageCell.h" +#import "ColorScheme.h" +@import YYWebImage; + +@implementation BubbleMessageCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +-(void) configureWithMessage:(Message *)message { + self.name.text = message.user.uname; + self.message.text = message.text; + self.unreadMarker.text = @""; + [self.avatarView yy_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [message.user.uid intValue]]] options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation]; + self.message.enabledTextCheckingTypes = NSTextCheckingTypeLink; + self.message.backgroundColor = [ColorScheme mainBackground]; + self.message.layer.cornerRadius = 4; + self.message.clipsToBounds = YES; + self.message.textInsets = UIEdgeInsetsMake(4.0f, 8.0f, 4.0f, 8.0f); +} + +-(void) attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { + [[UIApplication sharedApplication] openURL:url options: + @{} completionHandler:nil]; +} + +@end diff --git a/Juick/Views/BubbleMessageCell.xib b/Juick/Views/BubbleMessageCell.xib index a2b6bc3..b88ab17 100644 --- a/Juick/Views/BubbleMessageCell.xib +++ b/Juick/Views/BubbleMessageCell.xib @@ -1,30 +1,38 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="bubbleMessageCell" rowHeight="192" id="8qR-do-bgA" customClass="BubbleMessageCell" customModule="SawIM" customModuleProvider="target"> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="bubbleMessageCell" rowHeight="192" id="8qR-do-bgA" customClass="BubbleMessageCell"> <rect key="frame" x="0.0" y="0.0" width="320" height="192"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8qR-do-bgA" id="PhM-Oe-eqm"> - <frame key="frameInset" width="320" height="191.5"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="191.5"/> <autoresizingMask key="autoresizingMask"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="W9k-Ah-WF5"> + <rect key="frame" x="6" y="6" width="308" height="179.5"/> <subviews> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="qtf-Wj-Irh"> + <rect key="frame" x="0.0" y="60.5" width="42" height="58.5"/> <subviews> <imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ho8-hh-u3y"> + <rect key="frame" x="5" y="0.0" width="32" height="32"/> <constraints> <constraint firstAttribute="height" constant="32" id="9Sy-AS-4re"/> <constraint firstAttribute="width" constant="32" id="RrY-5f-4RF"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Y" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5rl-Qo-5oW"> + <rect key="frame" x="15.5" y="38" width="11" height="20.5"/> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <color key="textColor" red="0.90980392160000001" green="0.098039215690000001" blue="0.21960784310000001" alpha="1" colorSpace="calibratedRGB"/> <nil key="highlightedColor"/> @@ -35,13 +43,16 @@ </constraints> </stackView> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="xm7-By-6oe"> + <rect key="frame" x="54" y="0.0" width="254" height="179.5"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="ermine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UEj-yl-U0d"> + <rect key="frame" x="0.0" y="0.0" width="254" height="0.0"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <nil key="highlightedColor"/> </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yf3-FC-T1Y" customClass="FixedLabel" customModule="SawIM" customModuleProvider="target"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yf3-FC-T1Y" customClass="FixedLabel"> + <rect key="frame" x="0.0" y="12" width="254" height="167.5"/> <string key="text">Lorem sdsdasds sdsada ddas dsad asdsadas dasd asdsa sadsa dasdsad asd asdas dasd asdas dasd asdas dasdasdasd asdasdasdadasdasd asdasd asdas dasdsa dasdasdasdasdas dasdas</string> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> @@ -63,10 +74,10 @@ </tableViewCellContentView> <gestureRecognizers/> <connections> - <outlet property="avatarView" destination="ho8-hh-u3y" id="K5q-kz-70L"/> - <outlet property="message" destination="yf3-FC-T1Y" id="OjQ-pM-haS"/> - <outlet property="name" destination="UEj-yl-U0d" id="pow-Xt-INP"/> - <outlet property="unreadMarker" destination="5rl-Qo-5oW" id="jSH-ww-MO9"/> + <outlet property="avatarView" destination="ho8-hh-u3y" id="XnI-4Y-f3I"/> + <outlet property="message" destination="yf3-FC-T1Y" id="Iwg-L7-jm6"/> + <outlet property="name" destination="UEj-yl-U0d" id="unG-q9-Kwv"/> + <outlet property="unreadMarker" destination="5rl-Qo-5oW" id="an8-JJ-Gbb"/> </connections> <point key="canvasLocation" x="461" y="234"/> </tableViewCell> diff --git a/Juick/Views/FixedLabel.h b/Juick/Views/FixedLabel.h new file mode 100644 index 0000000..f05ac94 --- /dev/null +++ b/Juick/Views/FixedLabel.h @@ -0,0 +1,13 @@ +// +// FixedLabel.h +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import <TTTAttributedLabel/TTTAttributedLabel.h> + +@interface FixedLabel : TTTAttributedLabel + +@end diff --git a/Juick/Views/FixedLabel.m b/Juick/Views/FixedLabel.m new file mode 100644 index 0000000..24d8648 --- /dev/null +++ b/Juick/Views/FixedLabel.m @@ -0,0 +1,21 @@ +// +// FixedLabel.m +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "FixedLabel.h" + +@implementation FixedLabel + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end |