diff options
author | Vitaly Takmazov | 2019-03-21 16:20:26 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-03-21 16:20:26 +0300 |
commit | d86cbbf76ad40e9859df129656825086baa5fea9 (patch) | |
tree | 8bbbdf043b040da3be9add376e1a90bb18bd19c0 | |
parent | 2640c7fcb81e5900ea25e5b79a395052dd6814c0 (diff) |
Drop TagListView
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | Juick/Supporting Files/Juick-Prefix.pch | 1 | ||||
-rw-r--r-- | Juick/Views/MessageCell.h | 1 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 53 | ||||
-rw-r--r-- | Juick/Views/MessageCell.xib | 42 | ||||
-rw-r--r-- | Podfile | 1 | ||||
-rw-r--r-- | Podfile.lock | 6 |
7 files changed, 38 insertions, 68 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index b0e9a95..43c1319 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -531,7 +531,6 @@ "${PODS_ROOT}/Target Support Files/Pods-Juick/Pods-Juick-resources.sh", "${PODS_ROOT}/DateTools/DateTools/DateTools/DateTools.bundle", "${PODS_ROOT}/SAMKeychain/Support/SAMKeychain.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/TagListView-ObjC/TagListView-ObjC.bundle", ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( @@ -539,7 +538,6 @@ outputPaths = ( "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DateTools.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SAMKeychain.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TagListView-ObjC.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch index b2595f6..48932ba 100644 --- a/Juick/Supporting Files/Juick-Prefix.pch +++ b/Juick/Supporting Files/Juick-Prefix.pch @@ -22,7 +22,6 @@ #import <AFNetworking/AFNetworking.h> #import <AFNetworking/UIImageView+AFNetworking.h> #import <DateTools/DateTools.h> - #import <TagListView-ObjC/TagListView.h> #import <PHFComposeBarView/PHFComposeBarView.h> #import <UIView+Shimmer.h> #endif diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index 846bf30..931146a 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -18,7 +18,6 @@ @property (weak, nonatomic) IBOutlet UILabel *title; @property (weak, nonatomic) IBOutlet UILabel *timestamp; -@property (weak, nonatomic) IBOutlet TagListView *tags; @property (weak, nonatomic) IBOutlet UITextView *text; @property (weak, nonatomic) IBOutlet UIImageView *attach; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentHeight; diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 55e6054..6929436 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -11,6 +11,12 @@ #import "APIClient.h" #import "Entity.h" +@interface MessageCell() +@property(nonatomic, readonly) NSMutableParagraphStyle *quoteStyle; +@property(nonatomic, readonly) UIFont *boldFont; +@property(nonatomic, readonly) UIFont *italicFont; +@end + @implementation MessageCell - (void)awakeFromNib { @@ -21,11 +27,22 @@ self.title.textColor = [ColorScheme linkColor]; self.timestamp.textColor = [UIColor grayColor]; self.summary.textColor = [UIColor grayColor]; - self.tags.textFont = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; UIGestureRecognizer *avatarTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(avatarClicked:)]; [avatarTapRecognizer setEnabled:YES]; [self.avatar addGestureRecognizer:avatarTapRecognizer]; [self.avatar setUserInteractionEnabled:YES]; + _quoteStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + _quoteStyle.firstLineHeadIndent = 12.0f; + _quoteStyle.headIndent = 12.0f; + _quoteStyle.paragraphSpacing = 6.0f; + UIFontDescriptor* fontDescriptor = [UIFontDescriptor + preferredFontDescriptorWithTextStyle:UIFontTextStyleBody]; + UIFontDescriptor* boldFontDescriptor = [fontDescriptor + fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold]; + _boldFont = [UIFont fontWithDescriptor:boldFontDescriptor size: 0.0]; + UIFontDescriptor* italicFontDescriptor = [fontDescriptor + fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic]; + _italicFont = [UIFont fontWithDescriptor:italicFontDescriptor size: 0.0]; } - (void) configureWithMessage:(Message *)msg { @@ -88,28 +105,17 @@ } if ([entity.type isEqualToString:@"q"]) { [txt addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor] range:currentRange]; - NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - paragraphStyle.firstLineHeadIndent = 12.0f; - paragraphStyle.headIndent = 12.0f; - paragraphStyle.paragraphSpacing = 6.0f; - [txt addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:currentRange]; + [txt addAttribute:NSParagraphStyleAttributeName value:_quoteStyle range:currentRange]; } if ([entity.type isEqualToString:@"u"]) { [txt addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:currentRange]; } - UIFontDescriptor* fontDescriptor = [UIFontDescriptor - preferredFontDescriptorWithTextStyle:UIFontTextStyleBody]; + if ([entity.type isEqualToString:@"b"]) { - UIFontDescriptor* boldFontDescriptor = [fontDescriptor - fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold]; - UIFont* boldFont = [UIFont fontWithDescriptor:boldFontDescriptor size: 0.0]; - [txt addAttribute:NSFontAttributeName value:boldFont range:currentRange]; + [txt addAttribute:NSFontAttributeName value:_boldFont range:currentRange]; } if ([entity.type isEqualToString:@"i"]) { - UIFontDescriptor* italicFontDescriptor = [fontDescriptor - fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic]; - UIFont* italicFont = [UIFont fontWithDescriptor:italicFontDescriptor size: 0.0]; - [txt addAttribute:NSFontAttributeName value:italicFont range:currentRange]; + [txt addAttribute:NSFontAttributeName value:_italicFont range:currentRange]; } } [txt enumerateAttribute:@"displayText" inRange:NSMakeRange(0, [txt length]) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { @@ -117,15 +123,18 @@ [txt replaceCharactersInRange:range withString:value]; } }]; + if ([msg.tags count] > 0) { + NSString *tagsList = [NSString stringWithFormat:@"%@\n", [msg.tags componentsJoinedByString:@", "]]; + [txt insertAttributedString:[[NSAttributedString alloc] + initWithString:tagsList + attributes:@{ + NSFontAttributeName:_italicFont, + NSForegroundColorAttributeName:[UIColor darkGrayColor] + }] atIndex:0]; + } [txt endEditing]; self.text.attributedText = txt; } - [self.tags removeAllTags]; - if ([msg.tags count] > 0) { - [msg.tags enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - [self.tags addTag:obj]; - }]; - } } -(void) avatarClicked:(UIGestureRecognizer *)gestureRecognizer { diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index 3b40cf6..82c283f 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" 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="14283.14"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -51,51 +51,22 @@ </stackView> </subviews> </stackView> - <view contentMode="scaleToFill" verticalCompressionResistancePriority="749" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="N08-my-2Lr" customClass="TagListView"> - <rect key="frame" x="0.0" y="60" width="562" height="0.0"/> - <userDefinedRuntimeAttributes> - <userDefinedRuntimeAttribute type="number" keyPath="borderWidth"> - <real key="value" value="1"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="color" keyPath="borderColor"> - <color key="value" red="0.93333333333333335" green="0.93333333333333335" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="paddingY"> - <real key="value" value="6"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="number" keyPath="paddingX"> - <real key="value" value="12"/> - </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" red="0.53333333333333333" green="0.53333333333333333" blue="0.53333333333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - </userDefinedRuntimeAttribute> - <userDefinedRuntimeAttribute type="color" keyPath="tagBackgroundColor"> - <color key="value" red="0.93333333333333335" green="0.93333333333333335" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - </userDefinedRuntimeAttribute> - </userDefinedRuntimeAttributes> - </view> - <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" ambiguous="YES" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt"> - <rect key="frame" x="0.0" y="72" width="562" height="71.5"/> + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nZn-a4-oSt"> + <rect key="frame" x="0.0" y="60" width="562" height="192"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string> <fontDescription key="fontDescription" style="UICTFontTextStyleBody"/> <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> </textView> <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Uha-ow-kFJ"> - <rect key="frame" x="0.0" y="155.5" width="562" height="256"/> + <rect key="frame" x="0.0" y="264" width="562" height="149.5"/> <constraints> <constraint firstAttribute="height" priority="999" constant="256" identifier="attachHeight" id="Cuq-dQ-VYU"/> <constraint firstAttribute="width" priority="999" constant="256" id="oJg-1R-jp3"/> </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="423.5" width="562" height="2"/> + <rect key="frame" x="0.0" y="425.5" width="562" height="0.0"/> <fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -116,7 +87,6 @@ <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="nZn-a4-oSt" id="Bee-gX-BGk"/> <outlet property="timestamp" destination="AVu-qV-q84" id="Cyn-0y-V0R"/> <outlet property="title" destination="CHd-h0-hPk" id="BuC-dv-0sU"/> @@ -5,7 +5,6 @@ target "Juick" do pod 'AFNetworking' pod 'SAMKeychain' pod 'DateTools' - pod 'TagListView-ObjC' pod 'PHFComposeBarView' pod 'UIView+Shimmer' end diff --git a/Podfile.lock b/Podfile.lock index 53b1e88..1077d8e 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -19,7 +19,6 @@ PODS: - PHFDelegateChain (~> 1.0) - PHFDelegateChain (1.0.1) - SAMKeychain (1.5.3) - - TagListView-ObjC (0.1.1) - "UIView+Shimmer (1.0.0)" DEPENDENCIES: @@ -27,7 +26,6 @@ DEPENDENCIES: - DateTools - PHFComposeBarView - SAMKeychain - - TagListView-ObjC - "UIView+Shimmer" SPEC REPOS: @@ -37,7 +35,6 @@ SPEC REPOS: - PHFComposeBarView - PHFDelegateChain - SAMKeychain - - TagListView-ObjC - "UIView+Shimmer" SPEC CHECKSUMS: @@ -46,9 +43,8 @@ SPEC CHECKSUMS: PHFComposeBarView: 6382ab846e2f4d8634273c4a78d074bc5deed07f PHFDelegateChain: 491f9cd8a3fb8761f390ff05f74a0e168d48d285 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c - TagListView-ObjC: 432991e24c5177eb4fa7d721de7084f09f39a0b8 "UIView+Shimmer": ed634f95e8f4bda666b28b47bd85a4336a4117d8 -PODFILE CHECKSUM: cc35a42b2427e437120b816a942bf19b967d06b8 +PODFILE CHECKSUM: 0f12506a80c847aea53eee962c751242d19e03c7 COCOAPODS: 1.6.0 |