diff --git a/CHANGELOG.md b/CHANGELOG.md index 69dc6abf..1d7bd555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## Version 1.9.6 + +##### Hot Fixes & Enhancements: +- Fixed the text input not being interactive on iOS. Making `SLKTextInputbar` a UIView subclass instead of `UIToolbar`. + +##### Deprecation: +- Deprecated `-shouldProcessTextForAutoCompletion:` in favor of `-shouldProcessTextForAutoCompletion` + + ## [Version 1.9.5](https://github.com/slackhq/SlackTextViewController/releases/tag/v1.9.5) ##### Features: diff --git a/Examples/Messenger-Shared/MessageViewController.m b/Examples/Messenger-Shared/MessageViewController.m index 65dc0c32..e5952ecd 100644 --- a/Examples/Messenger-Shared/MessageViewController.m +++ b/Examples/Messenger-Shared/MessageViewController.m @@ -519,9 +519,9 @@ - (BOOL)canShowTypingIndicator #endif } -- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text +- (BOOL)shouldProcessTextForAutoCompletion { - return [super shouldProcessTextForAutoCompletion:text]; + return [super shouldProcessTextForAutoCompletion]; } - (BOOL)shouldDisableTypingSuggestionForAutoCompletion diff --git a/Examples/Messenger.xcodeproj/project.pbxproj b/Examples/Messenger.xcodeproj/project.pbxproj index 6d68c32b..6b7851bf 100644 --- a/Examples/Messenger.xcodeproj/project.pbxproj +++ b/Examples/Messenger.xcodeproj/project.pbxproj @@ -422,7 +422,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Slack Technologies, Inc."; TargetAttributes = { 4F3EDB48199ED00F004C15D6 = { @@ -743,14 +743,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -788,14 +794,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; diff --git a/Examples/Messenger.xcworkspace/contents.xcworkspacedata b/Examples/Messenger.xcworkspace/contents.xcworkspacedata index 30f838d2..fce32a59 100644 --- a/Examples/Messenger.xcworkspace/contents.xcworkspacedata +++ b/Examples/Messenger.xcworkspace/contents.xcworkspacedata @@ -14,7 +14,13 @@ location = "group:../CHANGELOG.md"> + location = "group:../.github/CODE_OF_CONDUCT.md"> + + + + diff --git a/Examples/Pods/Pods.xcodeproj/project.pbxproj b/Examples/Pods/Pods.xcodeproj/project.pbxproj index aa09badf..9312eed8 100644 --- a/Examples/Pods/Pods.xcodeproj/project.pbxproj +++ b/Examples/Pods/Pods.xcodeproj/project.pbxproj @@ -369,7 +369,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0900; }; buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -452,18 +452,28 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -483,7 +493,7 @@ baseConfigurationReference = 98C98CDFB3F20F2925F6CD1F141BB14F /* Pods.release.xcconfig */; buildSettings = { ENABLE_STRICT_OBJC_MSGSEND = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ""; @@ -501,7 +511,7 @@ buildSettings = { ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_PREFIX_HEADER = "Target Support Files/SlackTextViewController/SlackTextViewController-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; @@ -518,7 +528,7 @@ baseConfigurationReference = 4E762F23EC34ED4A6FF3312D84E33A40 /* Pods.debug.xcconfig */; buildSettings = { ENABLE_STRICT_OBJC_MSGSEND = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; @@ -538,18 +548,29 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -575,7 +596,7 @@ buildSettings = { ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_PREFIX_HEADER = "Target Support Files/SlackTextViewController/SlackTextViewController-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; @@ -593,7 +614,7 @@ buildSettings = { ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_PREFIX_HEADER = "Target Support Files/LoremIpsum/LoremIpsum-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; @@ -611,7 +632,7 @@ buildSettings = { ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_PREFIX_HEADER = "Target Support Files/LoremIpsum/LoremIpsum-prefix.pch"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ""; OTHER_LIBTOOLFLAGS = ""; diff --git a/Source/SLKTextInputbar.h b/Source/SLKTextInputbar.h index 73388b4c..a8e327ff 100644 --- a/Source/SLKTextInputbar.h +++ b/Source/SLKTextInputbar.h @@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, SLKCounterPosition) { NS_ASSUME_NONNULL_BEGIN /** @name A custom tool bar encapsulating messaging controls. */ -@interface SLKTextInputbar : UIToolbar +@interface SLKTextInputbar : UIView /** The centered text input view. The maximum number of lines is configured by default, to best fit each devices dimensions. diff --git a/Source/SLKTextInputbar.m b/Source/SLKTextInputbar.m index 5c4adf2c..88019c01 100644 --- a/Source/SLKTextInputbar.m +++ b/Source/SLKTextInputbar.m @@ -19,6 +19,8 @@ @interface SLKTextInputbar () +@property (nonatomic, strong) UIView *hairlineView; + @property (nonatomic, strong) NSLayoutConstraint *textViewBottomMarginC; @property (nonatomic, strong) NSLayoutConstraint *leftMarginWC; @property (nonatomic, strong) NSLayoutConstraint *rightButtonWC; @@ -75,11 +77,15 @@ - (void)slk_commonInit self.autoHideRightButton = YES; self.contentInset = UIEdgeInsetsMake(5.0, 8.0, 54.0, 8.0); + [self addSubview:self.bottomButtonsStackView]; + [self addSubview:self.editorContentView]; + [self addSubview:self.leftButton]; [self addSubview:self.rightButton]; [self addSubview:self.textView]; [self addSubview:self.charCountLabel]; - [self addSubview:self.bottomButtonsStackView]; - + [self addSubview:self.contentView]; + [self addSubview:self.hairlineView]; + [self slk_setupViewConstraints]; [self slk_updateConstraintConstants]; @@ -137,6 +143,27 @@ - (SLKTextView *)textView return _textView; } +- (UIView *)hairlineView +{ + if (!_hairlineView) { + _hairlineView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, [UIScreen mainScreen].bounds.size.width, 0.5)]; + _hairlineView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin; + _hairlineView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3]; + } + return _hairlineView; +} + +- (UIView *)contentView +{ + if (!_contentView) { + _contentView = [UIView new]; + _contentView.translatesAutoresizingMaskIntoConstraints = NO; + _contentView.backgroundColor = [UIColor clearColor]; + _contentView.clipsToBounds = YES; + } + return _contentView; +} + - (SLKInputAccessoryView *)inputAccessoryView { if (!_inputAccessoryView) { @@ -284,6 +311,7 @@ - (NSUInteger)slk_defaultNumberOfLines - (void)setBackgroundColor:(UIColor *)color { self.barTintColor = color; + self.editorContentView.backgroundColor = color; } - (void)setAutoHideRightButton:(BOOL)hide @@ -478,11 +506,9 @@ - (void)slk_setupViewConstraints [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[textView(0@999)]-(0)-|" options:0 metrics:metrics views:views]]; [[self.bottomButtonsStackView.leftAnchor constraintEqualToAnchor:self.textView.leftAnchor] setActive: YES]; [[self.bottomButtonsStackView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor] setActive:YES]; - - self.textViewBottomMarginC = [self slk_constraintForAttribute:NSLayoutAttributeBottom firstItem:self secondItem:self.textView]; + self.textViewBottomMarginC = [self slk_constraintForAttribute:NSLayoutAttributeBottom firstItem:self secondItem:self.textView]; self.leftMarginWC = [[self slk_constraintsForAttribute:NSLayoutAttributeLeading] firstObject]; - self.rightButtonWC = [self slk_constraintForAttribute:NSLayoutAttributeWidth firstItem:self.rightButton secondItem:nil]; self.rightMarginWC = [[self slk_constraintsForAttribute:NSLayoutAttributeTrailing] firstObject]; } diff --git a/Source/SLKTextViewController.h b/Source/SLKTextViewController.h index dbc426a9..bc316db9 100644 --- a/Source/SLKTextViewController.h +++ b/Source/SLKTextViewController.h @@ -446,7 +446,6 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController @return YES if the controller is allowed to process the text for auto-completion. */ - (BOOL)shouldProcessTextForAutoCompletion; -- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text DEPRECATED_MSG_ATTRIBUTE("Use -shouldProcessTextForAutoCompletion instead."); /** During text autocompletion, by default, auto-correction and spell checking are disabled. diff --git a/Source/SLKTextViewController.m b/Source/SLKTextViewController.m index bda12933..1b6dccfc 100644 --- a/Source/SLKTextViewController.m +++ b/Source/SLKTextViewController.m @@ -848,7 +848,7 @@ - (void)setTextInputbarHidden:(BOOL)hidden animated:(BOOL)animated __weak typeof(self) weakSelf = self; - void (^animations)() = ^void(){ + void (^animations)(void) = ^void(){ weakSelf.textInputbarHC.constant = hidden ? 0.0 : weakSelf.textInputbar.appropriateHeight; @@ -1354,7 +1354,7 @@ - (void)slk_willShowOrHideKeyboard:(NSNotification *)notification CGRect beginFrame = [notification.userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue]; CGRect endFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; - void (^animations)() = ^void() { + void (^animations)(void) = ^void() { // Scrolls to bottom only if the keyboard is about to show. if (self.shouldScrollToBottomAfterKeyboardShows && self.keyboardStatus == SLKKeyboardStatusWillShow) { if (self.isInverted) { @@ -1583,11 +1583,6 @@ - (void)registerPrefixesForAutoCompletion:(NSArray *)prefixes _registeredPrefixes = [NSSet setWithSet:set]; } -- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text -{ - return [self shouldProcessTextForAutoCompletion]; -} - - (BOOL)shouldProcessTextForAutoCompletion { if (!_registeredPrefixes || _registeredPrefixes.count == 0) {