Skip to content
This repository was archived by the owner on Aug 5, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions Examples/Messenger-Shared/MessageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,9 @@ - (BOOL)canShowTypingIndicator
#endif
}

- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text
- (BOOL)shouldProcessTextForAutoCompletion
{
return [super shouldProcessTextForAutoCompletion:text];
return [super shouldProcessTextForAutoCompletion];
}

- (BOOL)shouldDisableTypingSuggestionForAutoCompletion
Expand Down
2 changes: 1 addition & 1 deletion Examples/Messenger-Swift/MessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ extension MessageViewController {
}
}

override func shouldProcessText(forAutoCompletion text: String) -> Bool {
override func shouldProcessTextForAutoCompletion() -> Bool {
return true
}

Expand Down
14 changes: 13 additions & 1 deletion Examples/Messenger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Slack Technologies, Inc.";
TargetAttributes = {
4F3EDB48199ED00F004C15D6 = {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion Examples/Messenger.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions Examples/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@ source 'https://github.com/CocoaPods/Specs.git'
workspace 'Messenger.xcworkspace'
platform :ios, '7.0'

pod 'SlackTextViewController', :path => '../SlackTextViewController.podspec'
def shared_pods
pod 'SlackTextViewController', :path => '../SlackTextViewController.podspec'
pod 'LoremIpsum', '~> 1.0'
end

pod 'LoremIpsum', '~> 1.0'
target 'Messenger-Programatic' do
shared_pods
end

target 'Messenger-Storyboard' do
shared_pods
end

target 'Messenger-Swift' do
shared_pods
end

target 'Messenger-iPad-Sheet' do
shared_pods
end
39 changes: 30 additions & 9 deletions Examples/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Source/SLKTextInputbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 20 additions & 5 deletions Source/SLKTextInputbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

@interface SLKTextInputbar ()

@property (nonatomic, strong) UIView *hairlineView;

@property (nonatomic, strong) NSLayoutConstraint *textViewBottomMarginC;
@property (nonatomic, strong) NSLayoutConstraint *contentViewHC;
@property (nonatomic, strong) NSLayoutConstraint *leftButtonWC;
Expand Down Expand Up @@ -86,15 +88,17 @@ - (void)slk_commonInit
self.autoHideRightButton = YES;
self.editorContentViewHeight = 38.0;
self.contentInset = UIEdgeInsetsMake(5.0, 8.0, 5.0, 8.0);

self.backgroundColor = [UIColor colorWithRed:247.0/255.0 green:247.0/255.0 blue:247.0/255.0 alpha:1.0]; //UIToolbar native bar tint color

[self addSubview:self.editorContentView];
[self addSubview:self.leftButton];
[self addSubview:self.rightButton];
[self addSubview:self.textView];
[self addSubview:self.charCountLabel];
[self addSubview:self.contentView];
[self addSubview:self.imageView];

[self addSubview:self.imageView];
[self addSubview:self.hairlineView];

[self slk_setupViewConstraints];
[self slk_updateConstraintConstants];

Expand Down Expand Up @@ -238,6 +242,16 @@ - (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) {
Expand Down Expand Up @@ -519,7 +533,8 @@ - (NSUInteger)slk_defaultNumberOfLines

- (void)setBackgroundColor:(UIColor *)color
{
self.barTintColor = color;
[super setBackgroundColor:color];

self.editorContentView.backgroundColor = color;
}

Expand Down Expand Up @@ -774,7 +789,7 @@ - (void)slk_setupViewConstraints
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[editorContentView]|" options:0 metrics:metrics views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[contentView]|" options:0 metrics:metrics views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[contentView(0)]|" options:0 metrics:metrics views:views]];

self.textViewBottomMarginC = [self slk_constraintForAttribute:NSLayoutAttributeBottom firstItem:self secondItem:self.textView];
self.editorContentViewHC = [self slk_constraintForAttribute:NSLayoutAttributeHeight firstItem:self.editorContentView secondItem:nil];
self.contentViewHC = [self slk_constraintForAttribute:NSLayoutAttributeHeight firstItem:self.contentView secondItem:nil];;
Expand Down
1 change: 0 additions & 1 deletion Source/SLKTextViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,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.
Expand Down
13 changes: 4 additions & 9 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ - (void)textSelectionDidChange
}

if (self.textView.selectedRange.length > 0) {
if (self.isAutoCompleting && [self shouldProcessTextForAutoCompletion:self.textView.text]) {
if (self.isAutoCompleting && [self shouldProcessTextForAutoCompletion]) {
[self cancelAutoCompletion];
}
return;
Expand Down Expand Up @@ -906,7 +906,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;

Expand Down Expand Up @@ -1420,7 +1420,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) {
Expand Down Expand Up @@ -1649,11 +1649,6 @@ - (void)registerPrefixesForAutoCompletion:(NSArray <NSString *> *)prefixes
_registeredPrefixes = [NSSet setWithSet:set];
}

- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text
{
return [self shouldProcessTextForAutoCompletion];
}

- (BOOL)shouldProcessTextForAutoCompletion
{
if (!_registeredPrefixes || _registeredPrefixes.count == 0) {
Expand Down Expand Up @@ -1768,7 +1763,7 @@ - (void)slk_processTextForAutoCompletion
{
NSString *text = self.textView.text;

if ((!self.isAutoCompleting && text.length == 0) || self.isTransitioning || ![self shouldProcessTextForAutoCompletion:text]) {
if ((!self.isAutoCompleting && text.length == 0) || self.isTransitioning || ![self shouldProcessTextForAutoCompletion]) {
return;
}

Expand Down