diff options
author | Vitaly Takmazov | 2018-03-04 10:22:28 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-04 10:22:28 +0300 |
commit | 782219f3cdc8cac644cc33657813a5f8319dbae7 (patch) | |
tree | 65591cd2beb07dd6364a78f6e1154798ae00cf0a | |
parent | 5d0e97b3c1a1910a036f455b67205bc5eece1c29 (diff) |
groups_pms
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 26 | ||||
-rw-r--r-- | Juick/APIClient.h | 1 | ||||
-rw-r--r-- | Juick/APIClient.m | 21 | ||||
-rw-r--r-- | Juick/Main.storyboard | 35 | ||||
-rw-r--r-- | Juick/Model/Chat.h | 17 | ||||
-rw-r--r-- | Juick/Model/Chat.m | 13 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.h | 15 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 57 | ||||
-rw-r--r-- | Juick/Views/BubbleMessageCell.xib | 74 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.h | 20 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.m | 26 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.xib | 83 |
12 files changed, 381 insertions, 7 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index a1cc004..e8c6344 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -21,6 +21,11 @@ 77317BD0181BBE8500D60005 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAF181BBE8500D60005 /* UIKit.framework */; }; 77317BD8181BBE8500D60005 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 77317BD6181BBE8500D60005 /* InfoPlist.strings */; }; 77317BDA181BBE8500D60005 /* JuickTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 77317BD9181BBE8500D60005 /* JuickTests.m */; }; + 773E6393204BCAD6008B8F8D /* BubbleMessageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */; }; + 773E6394204BCAD6008B8F8D /* ConversationCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 773E6392204BCAD6008B8F8D /* ConversationCell.xib */; }; + 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 */; }; 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 */; }; @@ -81,6 +86,14 @@ 77317BD5181BBE8500D60005 /* JuickTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JuickTests-Info.plist"; sourceTree = "<group>"; }; 77317BD7181BBE8500D60005 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 77317BD9181BBE8500D60005 /* JuickTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JuickTests.m; sourceTree = "<group>"; }; + 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BubbleMessageCell.xib; sourceTree = "<group>"; }; + 773E6392204BCAD6008B8F8D /* ConversationCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConversationCell.xib; sourceTree = "<group>"; }; + 773E6395204BCB64008B8F8D /* ConversationCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConversationCell.h; sourceTree = "<group>"; }; + 773E6396204BCB64008B8F8D /* ConversationCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConversationCell.m; sourceTree = "<group>"; }; + 773E6398204BCE6D008B8F8D /* DialogsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DialogsViewController.h; sourceTree = "<group>"; }; + 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>"; }; 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>"; }; @@ -268,6 +281,8 @@ 770A428F1E8881CB000B206A /* DeviceRegistration.h */, 774528C01F930C06004D110B /* Attachment.h */, 774528C11F930C06004D110B /* Attachment.m */, + 773E639B204BD0F2008B8F8D /* Chat.h */, + 773E639C204BD0F2008B8F8D /* Chat.m */, ); path = Model; sourceTree = "<group>"; @@ -285,6 +300,8 @@ 77C6ADE31F7717BC000AEA8C /* ThreadViewController.m */, 776C41BF1FD3FF6E0063B82E /* DiscoverViewController.h */, 776C41C01FD3FF6E0063B82E /* DiscoverViewController.m */, + 773E6398204BCE6D008B8F8D /* DialogsViewController.h */, + 773E6399204BCE6D008B8F8D /* DialogsViewController.m */, ); path = ViewControllers; sourceTree = "<group>"; @@ -305,12 +322,16 @@ 77FFC0151D5FD13C003BD81A /* Views */ = { isa = PBXGroup; children = ( + 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */, + 773E6392204BCAD6008B8F8D /* ConversationCell.xib */, 776C41BA1FD3EF180063B82E /* MessageCell.h */, 776C41BB1FD3EF180063B82E /* MessageCell.m */, 776C41BC1FD3EF180063B82E /* MessageCell.xib */, 77E61A5A1FD467FC00B4E304 /* MessageInputView.xib */, 77E61A5C1FD4682B00B4E304 /* MessageInputView.h */, 77E61A5D1FD4682B00B4E304 /* MessageInputView.m */, + 773E6395204BCB64008B8F8D /* ConversationCell.h */, + 773E6396204BCB64008B8F8D /* ConversationCell.m */, ); path = Views; sourceTree = "<group>"; @@ -423,6 +444,8 @@ 77317BB6181BBE8500D60005 /* InfoPlist.strings in Resources */, 773F23331F76ECAC00B5B0DF /* LaunchScreen.storyboard in Resources */, 77E61A5B1FD467FC00B4E304 /* MessageInputView.xib in Resources */, + 773E6394204BCAD6008B8F8D /* ConversationCell.xib in Resources */, + 773E6393204BCAD6008B8F8D /* BubbleMessageCell.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -524,6 +547,8 @@ 776C41C11FD3FF6E0063B82E /* DiscoverViewController.m in Sources */, 77FCADDF1D6A50DA00CBA649 /* APIClient.m in Sources */, 77A0954A181F1F25002BDECD /* Message.m in Sources */, + 773E639D204BD0F2008B8F8D /* Chat.m in Sources */, + 773E639A204BCE6D008B8F8D /* DialogsViewController.m in Sources */, 774528C51F93AC0F004D110B /* CoreDataStack.m in Sources */, 77B09994189D0B9900A84F59 /* UIImage+Utils.m in Sources */, 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */, @@ -533,6 +558,7 @@ 77C67EE81828379700427098 /* ColorScheme.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */, + 773E6397204BCB64008B8F8D /* ConversationCell.m in Sources */, 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */, 77317BB8181BBE8500D60005 /* main.m in Sources */, 774528C21F930C06004D110B /* Attachment.m in Sources */, diff --git a/Juick/APIClient.h b/Juick/APIClient.h index b336c8c..668a0a9 100644 --- a/Juick/APIClient.h +++ b/Juick/APIClient.h @@ -19,6 +19,7 @@ -(void) pullNextFromPath:(NSString *)path params:(NSDictionary *)params callback:(void(^)(NSArray *, NSError *))callback; -(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; +(NSString *) messagesUrl; +(NSString *) threadUrl; diff --git a/Juick/APIClient.m b/Juick/APIClient.m index 3190659..5352320 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -8,6 +8,7 @@ #import "APIClient.h" #import "PDKeychainBindings.h" #import "Message.h" +#import "Chat.h" @interface APIClient() @property(nonatomic, strong) NSOperationQueue *backgroundQueue; @@ -101,6 +102,26 @@ }]; }]; } +-(void) fetchChats:(void (^)(NSArray *, NSError *))callback { + AFHTTPSessionManager *manager = [APIClient sharedClient].manager; + [self.backgroundQueue addOperationWithBlock:^{ + [manager GET:@"/groups_pms" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + NSMutableArray *groups = [NSMutableArray new]; + NSArray *pms = [(NSDictionary *)responseObject objectForKey:@"pms"]; + [pms enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [groups addObject:[Chat yy_modelWithJSON:obj]]; + }]; + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ + callback(groups, 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 5c8cc68..3383f18 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="meX-Jy-oiG"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="XnR-Hh-t65"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> @@ -10,17 +10,18 @@ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> - <!--Navigation Controller--> + <!--Item--> <scene sceneID="97k-sM-CYI"> <objects> <navigationController toolbarHidden="NO" id="meX-Jy-oiG" sceneMemberID="viewController"> + <tabBarItem key="tabBarItem" title="Item" id="83t-gu-V4H"/> <toolbarItems/> <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Rtg-Ag-BXy"> <rect key="frame" x="0.0" y="20" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> </navigationBar> <toolbar key="toolbar" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="tdc-JF-lSX"> - <rect key="frame" x="0.0" y="623" width="375" height="44"/> + <rect key="frame" x="0.0" y="574" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> </toolbar> <connections> @@ -89,6 +90,7 @@ <outlet property="delegate" destination="VCH-GK-jaH" id="a3g-k1-u9r"/> </connections> </tableView> + <tabBarItem key="tabBarItem" title="Item" id="Je4-Zm-Zbu"/> <toolbarItems> <barButtonItem image="chats_icon" id="eaY-Yt-u9g"> <connections> @@ -123,7 +125,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iqI-7F-B8z"> - <rect key="frame" x="6" y="229.5" width="363" height="228"/> + <rect key="frame" x="6" y="205" width="363" height="228"/> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="7kK-2B-ICG"> <rect key="frame" x="0.0" y="0.0" width="363" height="228"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> @@ -223,13 +225,13 @@ <!--Notifications--> <scene sceneID="CAp-HD-pIQ"> <objects> - <tableViewController title="Notifications" id="vqF-gx-pZG" sceneMemberID="viewController"> + <tableViewController title="Notifications" id="vqF-gx-pZG" customClass="DialogsViewController" 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="ZQ7-23-Nqu"> <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" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" id="KSR-Fu-ZcK"> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" id="KSR-Fu-ZcK" 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"> @@ -243,6 +245,7 @@ <outlet property="delegate" destination="vqF-gx-pZG" id="xKF-Xt-zWe"/> </connections> </tableView> + <tabBarItem key="tabBarItem" title="Item" id="vxB-Z9-1il"/> <navigationItem key="navigationItem" title="Notifications" id="hVh-CA-hQo"/> </tableViewController> <placeholder placeholderIdentifier="IBFirstResponder" id="8ge-Xf-wBN" userLabel="First Responder" sceneMemberID="firstResponder"/> @@ -258,7 +261,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="XYj-Y4-lfM"> - <rect key="frame" x="4" y="60" width="367" height="559"/> + <rect key="frame" x="4" y="60" width="367" height="510"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> @@ -293,6 +296,24 @@ </objects> <point key="canvasLocation" x="-222.5" y="-187.87166666666664"/> </scene> + <!--Tab Bar Controller--> + <scene sceneID="R7v-av-S80"> + <objects> + <tabBarController id="XnR-Hh-t65" sceneMemberID="viewController"> + <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"/> + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </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"/> + </connections> + </tabBarController> + <placeholder placeholderIdentifier="IBFirstResponder" id="AnM-ht-zf8" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-1679" y="-189"/> + </scene> </scenes> <resources> <image name="Splash.png" width="96" height="96"/> diff --git a/Juick/Model/Chat.h b/Juick/Model/Chat.h new file mode 100644 index 0000000..42647b0 --- /dev/null +++ b/Juick/Model/Chat.h @@ -0,0 +1,17 @@ +// +// Chat.h +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import "User.h" + +@interface Chat : NSObject + +@property NSNumber *uid; +@property NSString *uname; +@property NSNumber *unreadCount; +@end diff --git a/Juick/Model/Chat.m b/Juick/Model/Chat.m new file mode 100644 index 0000000..ff5fb83 --- /dev/null +++ b/Juick/Model/Chat.m @@ -0,0 +1,13 @@ +// +// Chat.m +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "Chat.h" + +@implementation Chat + +@end diff --git a/Juick/ViewControllers/DialogsViewController.h b/Juick/ViewControllers/DialogsViewController.h new file mode 100644 index 0000000..c37f6a6 --- /dev/null +++ b/Juick/ViewControllers/DialogsViewController.h @@ -0,0 +1,15 @@ +// +// DialogsViewController.h +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "MessagesViewController.h" + +@interface DialogsViewController : UITableViewController + +@property(nonatomic, strong) NSMutableArray *chats; + +@end diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m new file mode 100644 index 0000000..8eea017 --- /dev/null +++ b/Juick/ViewControllers/DialogsViewController.m @@ -0,0 +1,57 @@ +// +// DialogsViewController.m +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "DialogsViewController.h" +#import "ColorScheme.h" +#import "ConversationCell.h" +#import "APIClient.h" + +@interface DialogsViewController () + +@end + +@implementation DialogsViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self.view setBackgroundColor:[ColorScheme mainBackground]]; + [self.tableView registerNib:[UINib nibWithNibName:@"ConversationCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"notificationCell"]; + self.chats = [NSMutableArray array]; + [[APIClient sharedClient] fetchChats:^(NSArray *groups, NSError *err) { + if (err == nil) { + [self.chats addObjectsFromArray:groups]; + NSMutableArray *indexPaths = [NSMutableArray new]; + for (NSUInteger index = 0; index < [groups count]; index++) { + [indexPaths addObject:[NSIndexPath indexPathForRow:index inSection: 0]]; + } + [self.tableView beginUpdates]; + [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:YES]; + [self.tableView endUpdates]; + } + }]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.chats.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + ConversationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"notificationCell" forIndexPath:indexPath]; + [cell configureWithChat:[self.chats objectAtIndex:indexPath.row]]; + return cell; +} + + +@end diff --git a/Juick/Views/BubbleMessageCell.xib b/Juick/Views/BubbleMessageCell.xib new file mode 100644 index 0000000..a2b6bc3 --- /dev/null +++ b/Juick/Views/BubbleMessageCell.xib @@ -0,0 +1,74 @@ +<?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"> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/> + <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"> + <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"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="W9k-Ah-WF5"> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="qtf-Wj-Irh"> + <subviews> + <imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ho8-hh-u3y"> + <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"> + <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> + <color key="textColor" red="0.90980392160000001" green="0.098039215690000001" blue="0.21960784310000001" alpha="1" colorSpace="calibratedRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <constraints> + <constraint firstAttribute="width" constant="42" id="yDF-xj-FsY"/> + </constraints> + </stackView> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="xm7-By-6oe"> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="ermine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UEj-yl-U0d"> + <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"> + <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"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </stackView> + </subviews> + <gestureRecognizers/> + </stackView> + </subviews> + <gestureRecognizers/> + <constraints> + <constraint firstAttribute="bottom" secondItem="W9k-Ah-WF5" secondAttribute="bottom" constant="6" id="CgD-bU-WMY"/> + <constraint firstAttribute="trailing" secondItem="W9k-Ah-WF5" secondAttribute="trailing" constant="6" id="RoA-b3-BQX"/> + <constraint firstItem="W9k-Ah-WF5" firstAttribute="top" secondItem="PhM-Oe-eqm" secondAttribute="top" constant="6" id="Rv2-RF-ZEt"/> + <constraint firstItem="W9k-Ah-WF5" firstAttribute="leading" secondItem="PhM-Oe-eqm" secondAttribute="leading" constant="6" id="qL4-Ze-A0a"/> + </constraints> + </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"/> + </connections> + <point key="canvasLocation" x="461" y="234"/> + </tableViewCell> + </objects> +</document> diff --git a/Juick/Views/ConversationCell.h b/Juick/Views/ConversationCell.h new file mode 100644 index 0000000..f31057b --- /dev/null +++ b/Juick/Views/ConversationCell.h @@ -0,0 +1,20 @@ +// +// ConversationCell.h +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> +#import "Chat.h" + +@interface ConversationCell : UITableViewCell +@property (strong, nonatomic) IBOutlet UILabel *chatName; +@property (strong, nonatomic) IBOutlet UIImageView *avatar; +@property (strong, nonatomic) IBOutlet UILabel *lastMessage; +@property (strong, nonatomic) IBOutlet UILabel *unreadMarker; + +-(void) configureWithChat:(Chat *)chat; + +@end diff --git a/Juick/Views/ConversationCell.m b/Juick/Views/ConversationCell.m new file mode 100644 index 0000000..750ab45 --- /dev/null +++ b/Juick/Views/ConversationCell.m @@ -0,0 +1,26 @@ +// +// ConversationCell.m +// Juick +// +// Created by Vitaly Takmazov on 04/03/2018. +// Copyright © 2018 com.juick. All rights reserved. +// + +#import "ConversationCell.h" +@import YYWebImage; + +@implementation ConversationCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +-(void) configureWithChat:(Chat *)chat { + self.chatName.text = chat.uname; + self.lastMessage.text = @""; + self.unreadMarker.text = @""; + [self.avatar yy_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [chat.uid intValue]]] options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation]; +} + +@end diff --git a/Juick/Views/ConversationCell.xib b/Juick/Views/ConversationCell.xib new file mode 100644 index 0000000..504f7a4 --- /dev/null +++ b/Juick/Views/ConversationCell.xib @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> + <capability name="Constraints to layout margins" minToolsVersion="6.0"/> + <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="notificationCell" rowHeight="127" id="eKX-ht-IFf" customClass="ConversationCell"> + <rect key="frame" x="0.0" y="0.0" width="478" height="127"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eKX-ht-IFf" id="3NU-ng-4QM"> + <rect key="frame" x="0.0" y="0.0" width="478" height="126.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="6O8-u9-Jvc"> + <rect key="frame" x="6" y="17" width="466" height="93"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="Sas-e1-iNF"> + <rect key="frame" x="0.0" y="17.5" width="42" height="58.5"/> + <subviews> + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="WsB-eh-dhD"> + <rect key="frame" x="5" y="0.0" width="32" height="32"/> + <constraints> + <constraint firstAttribute="width" constant="32" id="6ox-eq-Vlp"/> + <constraint firstAttribute="height" constant="32" id="e88-rG-unU"/> + </constraints> + </imageView> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="●" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jW2-kr-sJn"> + <rect key="frame" x="13.5" y="38" width="15" 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"/> + </label> + </subviews> + <constraints> + <constraint firstAttribute="width" constant="42" id="5Yp-OO-aaj"/> + </constraints> + </stackView> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="dJe-jR-n42"> + <rect key="frame" x="54" y="11.5" width="412" height="70.5"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TTg-gl-dzG"> + <rect key="frame" x="0.0" y="0.0" width="412" height="20.5"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> + <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EiA-lG-gV5"> + <rect key="frame" x="0.0" y="32.5" width="412" height="38"/> + <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="UICTFontTextStyleSubhead"/> + <color key="textColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </stackView> + </subviews> + </stackView> + </subviews> + <constraints> + <constraint firstAttribute="bottomMargin" secondItem="6O8-u9-Jvc" secondAttribute="bottom" constant="6" id="O4J-FE-mKI"/> + <constraint firstItem="6O8-u9-Jvc" firstAttribute="leading" secondItem="3NU-ng-4QM" secondAttribute="leading" constant="6" id="h0T-Kd-7A4"/> + <constraint firstAttribute="trailing" secondItem="6O8-u9-Jvc" secondAttribute="trailing" constant="6" id="igy-EX-VYt"/> + <constraint firstItem="6O8-u9-Jvc" firstAttribute="top" secondItem="3NU-ng-4QM" secondAttribute="topMargin" constant="6" id="lS8-Oc-I4J"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="avatar" destination="WsB-eh-dhD" id="idO-P8-5l8"/> + <outlet property="chatName" destination="TTg-gl-dzG" id="GDL-GY-n6E"/> + <outlet property="lastMessage" destination="EiA-lG-gV5" id="Eq9-zQ-ivW"/> + <outlet property="unreadMarker" destination="jW2-kr-sJn" id="E5Q-wn-yln"/> + </connections> + <point key="canvasLocation" x="-1164" y="-1"/> + </tableViewCell> + </objects> +</document> |