From 8af785b209412b5d52dcd0503ccdbab108c506a7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 5 Nov 2018 22:45:49 +0300 Subject: Bye-bye, TTTAttributedLabel --- Juick.xcodeproj/project.pbxproj | 6 ------ Juick/Supporting Files/Juick-Prefix.pch | 1 - Juick/Views/BubbleMessageCell.h | 5 ++--- Juick/Views/BubbleMessageCell.m | 12 ++---------- Juick/Views/BubbleMessageCell.xib | 18 +++++++++--------- Juick/Views/FixedLabel.h | 13 ------------- Juick/Views/FixedLabel.m | 21 --------------------- Juick/Views/MessageCell.h | 4 ++-- Juick/Views/MessageCell.m | 11 ++--------- Juick/Views/MessageCell.xib | 31 ++++++++++++++++--------------- Podfile | 1 - Podfile.lock | 6 +----- 12 files changed, 34 insertions(+), 95 deletions(-) delete mode 100644 Juick/Views/FixedLabel.h delete mode 100644 Juick/Views/FixedLabel.m diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index faa7ccd..8072ad2 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -23,7 +23,6 @@ 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 */; }; @@ -111,8 +110,6 @@ 773E639F204BDF16008B8F8D /* ChatViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChatViewController.m; sourceTree = ""; }; 773E63A1204BE036008B8F8D /* BubbleMessageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BubbleMessageCell.h; sourceTree = ""; }; 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BubbleMessageCell.m; sourceTree = ""; }; - 773E63A4204BE11B008B8F8D /* FixedLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixedLabel.h; sourceTree = ""; }; - 773E63A5204BE11B008B8F8D /* FixedLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FixedLabel.m; sourceTree = ""; }; 773F231B1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = SerpentineBoldItalic.ttf; sourceTree = ""; }; 773F23321F76ECAC00B5B0DF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 773F23341F76ED5D00B5B0DF /* Splash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Splash.png; sourceTree = ""; }; @@ -355,8 +352,6 @@ 77E61A5C1FD4682B00B4E304 /* QuoteView.h */, 77E61A5D1FD4682B00B4E304 /* QuoteView.m */, 77E61A5A1FD467FC00B4E304 /* QuoteView.xib */, - 773E63A4204BE11B008B8F8D /* FixedLabel.h */, - 773E63A5204BE11B008B8F8D /* FixedLabel.m */, 77B8B39A207A5629005CB20C /* MessageInputView.h */, 77B8B39B207A5629005CB20C /* MessageInputView.m */, 77B8B398207A52BD005CB20C /* MessageInputView.xib */, @@ -569,7 +564,6 @@ 77317BB8181BBE8500D60005 /* main.m in Sources */, 77B8B39C207A5629005CB20C /* MessageInputView.m in Sources */, 774528C21F930C06004D110B /* Attachment.m in Sources */, - 773E63A6204BE11B008B8F8D /* FixedLabel.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch index 2123166..2f4b637 100644 --- a/Juick/Supporting Files/Juick-Prefix.pch +++ b/Juick/Supporting Files/Juick-Prefix.pch @@ -20,7 +20,6 @@ #import #import #import "UIImage+Utils.h" - #import #import #import #import diff --git a/Juick/Views/BubbleMessageCell.h b/Juick/Views/BubbleMessageCell.h index 933337b..bad2fc4 100644 --- a/Juick/Views/BubbleMessageCell.h +++ b/Juick/Views/BubbleMessageCell.h @@ -8,13 +8,12 @@ #import #import "Message.h" -#import "FixedLabel.h" -@interface BubbleMessageCell : UITableViewCell +@interface BubbleMessageCell : UITableViewCell @property (strong, nonatomic) IBOutlet UIImageView *avatarView; @property (strong, nonatomic) IBOutlet UILabel *unreadMarker; @property (strong, nonatomic) IBOutlet UILabel *name; -@property (strong, nonatomic) IBOutlet FixedLabel *message; +@property (strong, nonatomic) IBOutlet UITextView *message; -(void) configureWithMessage:(Message *) message isMe:(BOOL)isMe; diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m index 42b6019..87b482c 100644 --- a/Juick/Views/BubbleMessageCell.m +++ b/Juick/Views/BubbleMessageCell.m @@ -25,8 +25,8 @@ -(void) configureWithMessage:(Message *)message isMe:(BOOL)isMe { self.message.backgroundColor = isMe ? [ColorScheme secondaryBackground] : [ColorScheme mainBackground]; self.message.textColor = isMe ? [UIColor whiteColor] : [ColorScheme textColor]; - self.message.linkAttributes = @{ (id)kCTForegroundColorAttributeName: isMe ? [UIColor whiteColor] : [ColorScheme linkColor], - (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; + self.message.dataDetectorTypes = UIDataDetectorTypeAll; + self.message.tintColor = isMe? [UIColor whiteColor] : [ColorScheme linkColor]; self.name.text = message.user.uname; self.message.text = message.text; self.unreadMarker.text = @""; @@ -40,14 +40,6 @@ } completion:nil]; } failure:nil]; - self.message.enabledTextCheckingTypes = NSTextCheckingTypeLink; - 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 3f9670e..75afe92 100644 --- a/Juick/Views/BubbleMessageCell.xib +++ b/Juick/Views/BubbleMessageCell.xib @@ -43,21 +43,21 @@ - + - + + @@ -75,7 +75,7 @@ - + diff --git a/Juick/Views/FixedLabel.h b/Juick/Views/FixedLabel.h deleted file mode 100644 index f05ac94..0000000 --- a/Juick/Views/FixedLabel.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// FixedLabel.h -// Juick -// -// Created by Vitaly Takmazov on 04/03/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import - -@interface FixedLabel : TTTAttributedLabel - -@end diff --git a/Juick/Views/FixedLabel.m b/Juick/Views/FixedLabel.m deleted file mode 100644 index 24d8648..0000000 --- a/Juick/Views/FixedLabel.m +++ /dev/null @@ -1,21 +0,0 @@ -// -// 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 diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index abb1347..846bf30 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -13,13 +13,13 @@ -(void) avatarClicked:(NSString *)uname; @end -@interface MessageCell : UITableViewCell +@interface MessageCell : UITableViewCell @property (weak, nonatomic) IBOutlet UIImageView *avatar; @property (weak, nonatomic) IBOutlet UILabel *title; @property (weak, nonatomic) IBOutlet UILabel *timestamp; @property (weak, nonatomic) IBOutlet TagListView *tags; -@property (weak, nonatomic) IBOutlet TTTAttributedLabel *text; +@property (weak, nonatomic) IBOutlet UITextView *text; @property (weak, nonatomic) IBOutlet UIImageView *attach; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *attachmentHeight; @property (weak, nonatomic) IBOutlet UILabel *summary; diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index ffb564a..851e097 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -15,10 +15,8 @@ - (void)awakeFromNib { [super awakeFromNib]; self.text.textColor = [ColorScheme textColor]; - self.text.enabledTextCheckingTypes = NSTextCheckingTypeLink; - self.text.delegate = self; - self.text.linkAttributes = @{ (id)kCTForegroundColorAttributeName: [ColorScheme linkColor], - (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; + self.text.dataDetectorTypes = UIDataDetectorTypeAll; + self.text.tintColor = [ColorScheme linkColor]; self.title.textColor = [ColorScheme linkColor]; self.timestamp.textColor = [UIColor grayColor]; self.summary.textColor = [UIColor grayColor]; @@ -81,13 +79,8 @@ } } --(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { - [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil]; -} - -(void) avatarClicked:(UIGestureRecognizer *)gestureRecognizer { [self.delegate avatarClicked:self.title.text]; } - @end diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib index c1f9e83..3b40cf6 100644 --- a/Juick/Views/MessageCell.xib +++ b/Juick/Views/MessageCell.xib @@ -22,18 +22,18 @@ - - + + - + - + - + - - + + @@ -80,21 +80,22 @@ - + + - +