diff options
author | Vitaly Takmazov | 2017-12-03 12:15:52 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-12-03 12:15:52 +0300 |
commit | dc73ee639bc902b7ef93cfa86630fa4ada758397 (patch) | |
tree | 866295247dc121f6b70673ef21ef85feeaff9b32 | |
parent | 3ded167cf5bd443e98015523614624225169ee6f (diff) |
Thread View
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 16 | ||||
-rw-r--r-- | Juick/Main.storyboard | 142 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.h | 3 | ||||
-rw-r--r-- | Juick/ViewControllers/MessagesViewController.m | 31 | ||||
-rw-r--r-- | Juick/ViewControllers/ThreadViewController.h | 5 | ||||
-rw-r--r-- | Juick/ViewControllers/ThreadViewController.m | 13 | ||||
-rw-r--r-- | Juick/Views/MessageCell.h | 4 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 10 | ||||
-rw-r--r-- | Juick/Views/MessageCell.xib | 123 |
9 files changed, 200 insertions, 147 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index a026387..aa2fdf3 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -30,6 +30,8 @@ 77418CBD182FB9B6004111B7 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77418CBC182FB9B6004111B7 /* ImageIO.framework */; }; 774528C21F930C06004D110B /* Attachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 774528C11F930C06004D110B /* Attachment.m */; }; 774528C51F93AC0F004D110B /* CoreDataStack.m in Sources */ = {isa = PBXBuildFile; fileRef = 774528C41F93AC0F004D110B /* CoreDataStack.m */; }; + 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 776C41BB1FD3EF180063B82E /* MessageCell.m */; }; + 776C41BE1FD3EF180063B82E /* MessageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 776C41BC1FD3EF180063B82E /* MessageCell.xib */; }; 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77975A1C182B6E9A00410C2B /* NewPostViewController.m */; }; 77975A1F182BDCE900410C2B /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77975A1E182BDCE900410C2B /* SystemConfiguration.framework */; }; 77975A21182BDCF300410C2B /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77975A20182BDCF300410C2B /* MobileCoreServices.framework */; }; @@ -44,7 +46,6 @@ 77C6ADE41F7717BC000AEA8C /* ThreadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C6ADE31F7717BC000AEA8C /* ThreadViewController.m */; }; 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77E35A81189A5B5A00B2D216 /* LoginViewController.m */; }; 77FCADDF1D6A50DA00CBA649 /* APIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 77FCADDE1D6A50DA00CBA649 /* APIClient.m */; }; - 77FFC0191D5FD186003BD81A /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 77FFC0171D5FD186003BD81A /* MessageCell.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -91,6 +92,9 @@ 774528C91F93EE83004D110B /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; 774528CB1F93EE9F004D110B /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 774528CD1F96B39C004D110B /* Juick.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Juick.entitlements; sourceTree = "<group>"; }; + 776C41BA1FD3EF180063B82E /* MessageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = "<group>"; }; + 776C41BB1FD3EF180063B82E /* MessageCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = "<group>"; }; + 776C41BC1FD3EF180063B82E /* MessageCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MessageCell.xib; sourceTree = "<group>"; }; 77975A1B182B6E9A00410C2B /* NewPostViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewPostViewController.h; sourceTree = "<group>"; }; 77975A1C182B6E9A00410C2B /* NewPostViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewPostViewController.m; sourceTree = "<group>"; }; 77975A1E182BDCE900410C2B /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; @@ -114,8 +118,6 @@ 77E35A81189A5B5A00B2D216 /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = "<group>"; }; 77FCADDE1D6A50DA00CBA649 /* APIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APIClient.m; sourceTree = "<group>"; }; 77FCADE01D6A50EC00CBA649 /* APIClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIClient.h; sourceTree = "<group>"; }; - 77FFC0161D5FD186003BD81A /* MessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = "<group>"; }; - 77FFC0171D5FD186003BD81A /* MessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = "<group>"; }; 9FF4AA695CB46B0E7AED628D /* Pods_JuickTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JuickTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; B3271B16DFB6247972806713 /* Pods-Juick.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Juick/Pods-Juick.debug.xcconfig"; sourceTree = "<group>"; }; EE63D145DADD14AE17A58456 /* Pods_Juick.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Juick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -293,8 +295,9 @@ 77FFC0151D5FD13C003BD81A /* Views */ = { isa = PBXGroup; children = ( - 77FFC0161D5FD186003BD81A /* MessageCell.h */, - 77FFC0171D5FD186003BD81A /* MessageCell.m */, + 776C41BA1FD3EF180063B82E /* MessageCell.h */, + 776C41BB1FD3EF180063B82E /* MessageCell.m */, + 776C41BC1FD3EF180063B82E /* MessageCell.xib */, ); path = Views; sourceTree = "<group>"; @@ -401,6 +404,7 @@ 773F23391F76ED5E00B5B0DF /* Splash@3x.png in Resources */, 77C6ADDE1F770EB2000AEA8C /* Main.storyboard in Resources */, 773F23381F76ED5E00B5B0DF /* Splash@2x.png in Resources */, + 776C41BE1FD3EF180063B82E /* MessageCell.xib in Resources */, 773F23371F76ED5E00B5B0DF /* Splash.png in Resources */, 773F231C1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf in Resources */, 77317BB6181BBE8500D60005 /* InfoPlist.strings in Resources */, @@ -518,8 +522,8 @@ 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */, 77C67EE81828379700427098 /* ColorScheme.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, - 77FFC0191D5FD186003BD81A /* MessageCell.m in Sources */, 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */, + 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */, 77317BB8181BBE8500D60005 /* main.m in Sources */, 774528C21F930C06004D110B /* Attachment.m in Sources */, ); diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard index 201ee3a..600b5ea 100644 --- a/Juick/Main.storyboard +++ b/Juick/Main.storyboard @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" 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="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="meX-Jy-oiG"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -31,6 +31,35 @@ </objects> <point key="canvasLocation" x="-1153.125" y="-186.75999999999999"/> </scene> + <!--Thread View Controller--> + <scene sceneID="hRe-9n-wGd"> + <objects> + <tableViewController id="egN-ti-sbh" customClass="ThreadViewController" 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="R7I-ps-E4b"> + <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="messageCell" id="6fG-tI-4kH"> + <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="6fG-tI-4kH" id="ifl-hK-faj"> + <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="egN-ti-sbh" id="ICi-1o-4VR"/> + <outlet property="delegate" destination="egN-ti-sbh" id="vNI-EP-kd4"/> + </connections> + </tableView> + <navigationItem key="navigationItem" id="ZnC-jI-JAu"/> + </tableViewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="woP-g5-FaQ" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-671" y="-958"/> + </scene> <!--Discover--> <scene sceneID="uvH-u9-x7X"> <objects> @@ -40,114 +69,15 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <prototypes> - <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="500" id="e1h-hQ-iWB" customClass="MessageCell"> - <rect key="frame" x="0.0" y="28" width="375" height="500"/> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="Orz-mD-PnE"> + <rect key="frame" x="0.0" y="28" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="e1h-hQ-iWB" id="LVD-Z8-CLG"> - <rect key="frame" x="0.0" y="0.0" width="375" height="499.5"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Orz-mD-PnE" id="WRd-ev-Osb"> + <rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/> <autoresizingMask key="autoresizingMask"/> - <subviews> - <stackView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="249" verticalCompressionResistancePriority="749" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="UAN-1F-VSl"> - <rect key="frame" x="8" y="8" width="359" height="483.5"/> - <subviews> - <stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="fcy-yR-0PD"> - <rect key="frame" x="0.0" y="0.0" width="359" height="48"/> - <subviews> - <imageView userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yLX-wS-bB1"> - <rect key="frame" x="0.0" y="0.0" width="48" height="48"/> - <constraints> - <constraint firstAttribute="width" constant="48" id="c8k-kD-iPC"/> - <constraint firstAttribute="height" constant="48" id="wSE-Wv-vu3"/> - </constraints> - </imageView> - <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="ZVR-KJ-pah"> - <rect key="frame" x="56" y="0.0" width="303" height="48"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jNN-1r-7dJ"> - <rect key="frame" x="0.0" y="0.0" width="303" height="20.5"/> - <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UiL-3x-RCt"> - <rect key="frame" x="0.0" y="24.5" width="303" height="23.5"/> - <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - </subviews> - </stackView> - </subviews> - </stackView> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jYp-Nz-sOJ" customClass="TagListView"> - <rect key="frame" x="0.0" y="60" width="359" height="29"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - <userDefinedRuntimeAttributes> - <userDefinedRuntimeAttribute type="color" keyPath="textColor"> - <color key="value" red="0.53333333329999999" green="0.53333333329999999" blue="0.53333333329999999" alpha="1" colorSpace="calibratedRGB"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="borderWidth"> - <real key="value" value="1"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="color" keyPath="borderColor"> - <color key="value" red="0.80000000000000004" green="0.80000000000000004" blue="0.80000000000000004" alpha="1" colorSpace="calibratedRGB"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="paddingY"> - <real key="value" value="6"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="paddingX"> - <real key="value" value="6"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="marginY"> - <real key="value" value="4"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="marginX"> - <real key="value" value="6"/> - </userDefinedRuntimeAttribute> - </userDefinedRuntimeAttributes> - </view> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="999" verticalHuggingPriority="249" horizontalCompressionResistancePriority="999" verticalCompressionResistancePriority="749" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zqL-hd-LLy" customClass="TTTAttributedLabel"> - <rect key="frame" x="0.0" y="101" width="359" height="86.5"/> - <string key="text">Блин, парился через teamviewer заокеан, там xcode, а к xcode подключен iphone, а в iphone торчит t-mobile, а на iphone наш Qt application, который не коннектиццо к серверу в упор. - -А в qt creator видно что приходит ошибка NetworkError, логи не пишет, а кто отправляет и почему — непонятно, а отладчик не ставит брякпойнты в сорцах Qt, а приходит qt сигнал — и понятно, что никаких тебе стектрейсов. Плакал, пока не запустил НЕ через отладчик Qt Creator, а прямо в xcode, там брякпойнты ставит.</string> - <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" verticalHuggingPriority="249" verticalCompressionResistancePriority="749" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XN9-V3-t43"> - <rect key="frame" x="0.0" y="199.5" width="359" height="256"/> - <constraints> - <constraint firstAttribute="height" priority="999" constant="256" id="J17-nb-wur"/> - </constraints> - </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FAF-xW-CXb"> - <rect key="frame" x="0.0" y="467.5" width="359" height="16"/> - <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> - <color key="textColor" red="0.53333333329999999" green="0.53333333329999999" blue="0.53333333329999999" alpha="1" colorSpace="calibratedRGB"/> - <nil key="highlightedColor"/> - </label> - </subviews> - </stackView> - </subviews> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - <constraints> - <constraint firstAttribute="bottom" secondItem="UAN-1F-VSl" secondAttribute="bottom" constant="8" id="9iJ-eR-JuR"/> - <constraint firstItem="UAN-1F-VSl" firstAttribute="leading" secondItem="LVD-Z8-CLG" secondAttribute="leading" constant="8" id="GxT-Ne-ZLT"/> - <constraint firstAttribute="trailing" secondItem="UAN-1F-VSl" secondAttribute="trailing" constant="8" id="KFg-Im-T1W"/> - <constraint firstItem="UAN-1F-VSl" firstAttribute="top" secondItem="LVD-Z8-CLG" secondAttribute="top" constant="8" id="WQ5-ab-cBr"/> - </constraints> </tableViewCellContentView> - <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <connections> - <outlet property="attach" destination="XN9-V3-t43" id="YAR-Rw-IHV"/> - <outlet property="attachmentHeight" destination="J17-nb-wur" id="xd5-EV-Cny"/> - <outlet property="avatar" destination="yLX-wS-bB1" id="31D-uh-uo9"/> - <outlet property="summary" destination="FAF-xW-CXb" id="Gmx-Po-GIW"/> - <outlet property="tags" destination="jYp-Nz-sOJ" id="xZ8-gu-UzS"/> - <outlet property="text" destination="zqL-hd-LLy" id="u0i-fj-3x4"/> - <outlet property="timestamp" destination="UiL-3x-RCt" id="P2X-dW-ycQ"/> - <outlet property="title" destination="jNN-1r-7dJ" id="B73-VP-D6l"/> + <segue destination="egN-ti-sbh" kind="push" identifier="threadViewSegue" id="Z1t-ZV-yVS"/> </connections> </tableViewCell> </prototypes> diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h index fc3545a..33b86b6 100644 --- a/Juick/ViewControllers/MessagesViewController.h +++ b/Juick/ViewControllers/MessagesViewController.h @@ -7,9 +7,8 @@ // #import <UIKit/UIKit.h> -@import PHFComposeBarView; -@interface MessagesViewController : UITableViewController<PHFComposeBarViewDelegate> +@interface MessagesViewController : UITableViewController @property(nonatomic, strong) NSString *path; @property(nonatomic, strong) NSMutableDictionary *params; - (void) refreshData; diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index b91f056..5a1521d 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -69,16 +69,18 @@ self.dataLoading = NO; [self.view setBackgroundColor:[ColorScheme mainBackground]]; + [self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"messageCell"]; self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.estimatedRowHeight = 500.0f; self.messages = [NSMutableArray array]; - self.params = [NSMutableDictionary new]; self.refreshControl = [UIRefreshControl new]; [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; if ([User isAuthenticated]) { [User checkIsValid:^(BOOL success) { if (success) { - self.path = [APIClient feedUrl]; + if ([self.path length] == 0) { + self.path = [APIClient feedUrl]; + } [self refreshData]; } else { [User throwUnableToLogin:self]; @@ -86,7 +88,9 @@ }]; } else { - self.path = [APIClient messagesUrl]; + if ([self.path length] == 0) { + self.path = [APIClient messagesUrl]; + } [self refreshData]; } } @@ -111,14 +115,19 @@ return cell; } -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if ([self.path isEqualToString:[APIClient threadUrl]]) - return; - Message *msg = [self.messages objectAtIndex:indexPath.row]; - ThreadViewController *threadViewController = [[ThreadViewController alloc] init]; - [threadViewController setPath:[APIClient threadUrl]]; - [threadViewController setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]]; - [self.navigationController pushViewController:threadViewController animated:NO]; +-(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_ { diff --git a/Juick/ViewControllers/ThreadViewController.h b/Juick/ViewControllers/ThreadViewController.h index 3f2b59c..484e2fb 100644 --- a/Juick/ViewControllers/ThreadViewController.h +++ b/Juick/ViewControllers/ThreadViewController.h @@ -7,9 +7,8 @@ // #import <UIKit/UIKit.h> +#include "MessagesViewController.h" @import PHFComposeBarView; -@interface ThreadViewController : UITableViewController<PHFComposeBarViewDelegate> -@property(nonatomic, strong) NSString *path; -@property(nonatomic, strong) NSMutableDictionary *params; +@interface ThreadViewController : MessagesViewController<PHFComposeBarViewDelegate> @end diff --git a/Juick/ViewControllers/ThreadViewController.m b/Juick/ViewControllers/ThreadViewController.m index 2ee4af5..893765b 100644 --- a/Juick/ViewControllers/ThreadViewController.m +++ b/Juick/ViewControllers/ThreadViewController.m @@ -8,6 +8,7 @@ #import "ThreadViewController.h" #import "ColorScheme.h" +#import "MessageCell.h" @interface ThreadViewController () @@ -27,18 +28,6 @@ // self.navigationItem.rightBarButtonItem = self.editButtonItem; } -#pragma mark - Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { -#warning Incomplete implementation, return the number of sections - return 0; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { -#warning Incomplete implementation, return the number of rows - return 0; -} - - (BOOL) canBecomeFirstResponder { return YES; diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index 92345d6..737ec89 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -2,8 +2,8 @@ // MessageCell.h // Juick // -// Created by Vitaly Takmazov on 14/08/16. -// Copyright © 2016 com.juick. All rights reserved. +// Created by Vitaly Takmazov on 03/12/2017. +// Copyright © 2017 com.juick. All rights reserved. // #import <UIKit/UIKit.h> diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 236b4a3..ca84053 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -2,11 +2,10 @@ // MessageCell.m // Juick // -// Created by Vitaly Takmazov on 14/08/16. -// Copyright © 2016 com.juick. All rights reserved. +// Created by Vitaly Takmazov on 03/12/2017. +// Copyright © 2017 com.juick. All rights reserved. // - #import "MessageCell.h" #import "ColorScheme.h" #import "UIImage+Utils.h" @@ -23,11 +22,11 @@ self.text.enabledTextCheckingTypes = NSTextCheckingTypeLink; self.text.delegate = self; self.text.linkAttributes = @{ (id)kCTForegroundColorAttributeName: [ColorScheme linkColor], - (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; + (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; self.title.textColor = [ColorScheme linkColor]; self.timestamp.textColor = [UIColor grayColor]; self.summary.textColor = [UIColor grayColor]; - self.tags.textFont = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; + self.tags.textFont = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; } - (void) configureWithMessage:(Message *)msg { @@ -69,4 +68,5 @@ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; } + @end diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib new file mode 100644 index 0000000..7a08ca9 --- /dev/null +++ b/Juick/Views/MessageCell.xib @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> + <capability name="Safe area layout guides" minToolsVersion="9.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 contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="messageCell" rowHeight="438" id="KGk-i7-Jjw" customClass="MessageCell"> + <rect key="frame" x="0.0" y="0.0" width="574" height="438"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> + <rect key="frame" x="0.0" y="0.0" width="574" height="437.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="top" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="Azj-pa-GEC"> + <rect key="frame" x="6" y="6" width="562" height="425.5"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="7FT-kJ-84d"> + <rect key="frame" x="0.0" y="0.0" width="103.5" height="48"/> + <subviews> + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="CZk-Q8-JqS"> + <rect key="frame" x="0.0" y="0.0" width="48" height="48"/> + <constraints> + <constraint firstAttribute="width" constant="48" id="Pw1-ZE-53h"/> + <constraint firstAttribute="height" constant="48" id="RAa-ds-3oT"/> + </constraints> + </imageView> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="o3h-ci-LWF"> + <rect key="frame" x="60" y="0.0" width="43.5" height="48"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CHd-h0-hPk"> + <rect key="frame" x="0.0" y="0.0" width="43.5" height="20"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AVu-qV-q84"> + <rect key="frame" x="0.0" y="32" width="43.5" height="16"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </stackView> + </subviews> + </stackView> + <view contentMode="scaleToFill" verticalCompressionResistancePriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="N08-my-2Lr" customClass="TagListView"> + <rect key="frame" x="0.0" y="60" width="240" height="36.5"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="number" keyPath="borderWidth"> + <real key="value" value="1"/> + </userDefinedRuntimeAttribute> + <userDefinedRuntimeAttribute type="color" keyPath="borderColor"> + <color key="value" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </userDefinedRuntimeAttribute> + <userDefinedRuntimeAttribute type="number" keyPath="paddingY"> + <real key="value" value="6"/> + </userDefinedRuntimeAttribute> + <userDefinedRuntimeAttribute type="number" keyPath="paddingX"> + <real key="value" value="6"/> + </userDefinedRuntimeAttribute> + <userDefinedRuntimeAttribute type="number" keyPath="marginY"> + <real key="value" value="7"/> + </userDefinedRuntimeAttribute> + <userDefinedRuntimeAttribute type="number" keyPath="marginX"> + <real key="value" value="7"/> + </userDefinedRuntimeAttribute> + <userDefinedRuntimeAttribute type="color" keyPath="textColor"> + <color key="value" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </userDefinedRuntimeAttribute> + </userDefinedRuntimeAttributes> + </view> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zZm-hh-bDO" customClass="TTTAttributedLabel"> + <rect key="frame" x="0.0" y="108.5" width="42" height="21"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Uha-ow-kFJ"> + <rect key="frame" x="0.0" y="141.5" width="240" height="256"/> + <constraints> + <constraint firstAttribute="height" priority="999" constant="256" identifier="attachHeight" id="Cuq-dQ-VYU"/> + </constraints> + </imageView> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aJE-mZ-MCS"> + <rect key="frame" x="0.0" y="409.5" width="33" height="16"/> + <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </stackView> + </subviews> + <constraints> + <constraint firstAttribute="bottom" secondItem="Azj-pa-GEC" secondAttribute="bottom" constant="6" id="OWY-DI-0dv"/> + <constraint firstItem="Azj-pa-GEC" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="6" id="Ohz-6B-bYr"/> + <constraint firstItem="Azj-pa-GEC" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="biD-O8-Mwb"/> + <constraint firstAttribute="trailing" secondItem="Azj-pa-GEC" secondAttribute="trailing" constant="6" id="ymN-qs-0pB"/> + </constraints> + </tableViewCellContentView> + <viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/> + <connections> + <outlet property="attach" destination="Uha-ow-kFJ" id="s6u-WS-Ybt"/> + <outlet property="attachmentHeight" destination="Cuq-dQ-VYU" id="5DR-sP-vQI"/> + <outlet property="avatar" destination="CZk-Q8-JqS" id="0Jh-5F-W9D"/> + <outlet property="summary" destination="aJE-mZ-MCS" id="lWR-A2-40d"/> + <outlet property="tags" destination="N08-my-2Lr" id="MwG-ij-n7e"/> + <outlet property="text" destination="zZm-hh-bDO" id="mqX-Cm-d4L"/> + <outlet property="timestamp" destination="AVu-qV-q84" id="Cyn-0y-V0R"/> + <outlet property="title" destination="CHd-h0-hPk" id="BuC-dv-0sU"/> + </connections> + <point key="canvasLocation" x="161" y="266"/> + </tableViewCell> + </objects> +</document> |