Skip to content
This repository was archived by the owner on Oct 30, 2018. 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
3 changes: 3 additions & 0 deletions Examples/Messenger-Shared/MessageTableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
static CGFloat kMessageTableViewCellMinimumHeight = 50.0;
static CGFloat kMessageTableViewCellAvatarHeight = 30.0;

static NSString *MessengerCellIdentifier = @"MessengerCell";
static NSString *AutoCompletionCellIdentifier = @"AutoCompletionCell";

@interface MessageTableViewCell : UITableViewCell

@property (nonatomic, strong) UILabel *titleLabel;
Expand Down
11 changes: 8 additions & 3 deletions Examples/Messenger-Shared/MessageTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ - (void)configureSubviews
NSDictionary *metrics = @{@"tumbSize": @(kMessageTableViewCellAvatarHeight),
@"padding": @15,
@"right": @10,
@"left": @5,
@"attchSize": @80,
@"left": @5
};

[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-left-[thumbnailView(tumbSize)]-right-[titleLabel(>=0)]-right-|" options:0 metrics:metrics views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-left-[thumbnailView(tumbSize)]-right-[bodyLabel(>=0)]-right-|" options:0 metrics:metrics views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-right-[titleLabel(20)]-left-[bodyLabel(>=0@999)]-left-|" options:0 metrics:metrics views:views]];
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-right-[thumbnailView(tumbSize)]-(>=0)-|" options:0 metrics:metrics views:views]];

if ([self.reuseIdentifier isEqualToString:MessengerCellIdentifier]) {
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-right-[titleLabel(20)]-left-[bodyLabel(>=0@999)]-left-|" options:0 metrics:metrics views:views]];
}
else {
[self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[titleLabel]|" options:0 metrics:metrics views:views]];
}
}

- (void)prepareForReuse
Expand Down
12 changes: 4 additions & 8 deletions Examples/Messenger-Shared/MessageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

#define DEBUG_CUSTOM_TYPING_INDICATOR 0

static NSString *MessengerCellIdentifier = @"MessengerCell";
static NSString *AutoCompletionCellIdentifier = @"AutoCompletionCell";

@interface MessageViewController ()

@property (nonatomic, strong) NSMutableArray *messages;
Expand Down Expand Up @@ -570,17 +567,16 @@ - (MessageTableViewCell *)autoCompletionCellForRowAtIndexPath:(NSIndexPath *)ind
MessageTableViewCell *cell = (MessageTableViewCell *)[self.autoCompletionView dequeueReusableCellWithIdentifier:AutoCompletionCellIdentifier];
cell.indexPath = indexPath;

NSString *item = self.searchResult[indexPath.row];
NSString *text = self.searchResult[indexPath.row];

if ([self.foundPrefix isEqualToString:@"#"]) {
item = [NSString stringWithFormat:@"# %@", item];
text = [NSString stringWithFormat:@"# %@", text];
}
else if (([self.foundPrefix isEqualToString:@":"] || [self.foundPrefix isEqualToString:@"+:"])) {
item = [NSString stringWithFormat:@":%@:", item];
text = [NSString stringWithFormat:@":%@:", text];
}

cell.titleLabel.text = item;
cell.titleLabel.font = [UIFont systemFontOfSize:14.0];
cell.titleLabel.text = text;
cell.selectionStyle = UITableViewCellSelectionStyleDefault;

return cell;
Expand Down
2 changes: 1 addition & 1 deletion Examples/Messenger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
ORGANIZATIONNAME = "Slack Technologies, Inc.";
TargetAttributes = {
4F3EDB48199ED00F004C15D6 = {
DevelopmentTeam = BQR82RBBHL;
DevelopmentTeam = S6MX3RA9ZM;
};
4F86BF6419F011D0007A3D4A = {
CreatedOnToolsVersion = 6.0.1;
Expand Down
9 changes: 9 additions & 0 deletions Source/SLKInputAccessoryView.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
if (newSuperview) {
if (SLK_IS_IOS9_AND_HIGHER) {

// NOTE:
// Because the keyboard is on its own view hierarchy since iOS 9,
// we needed to lookup for its view so we can move the text input whenever its origin changed.
// We are disabling the detection of the keyboard on iOS 9 until a public API is available.
//
// Open Radar: http://openradar.appspot.com/radar?id=5021485877952512

/*
NSPredicate *windowPredicate = [NSPredicate predicateWithFormat:@"self isMemberOfClass: %@", NSClassFromString(@"UIRemoteKeyboardWindow")];
UIWindow *keyboardWindow = [[[UIApplication sharedApplication].windows filteredArrayUsingPredicate:windowPredicate] firstObject];

Expand All @@ -38,6 +46,7 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
}
}
}
*/
}
else {
_keyboardViewProxy = newSuperview;
Expand Down
6 changes: 4 additions & 2 deletions Source/SLKTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ typedef NS_OPTIONS(NSUInteger, SLKPastableMediaType) {
/** YES if quickly refreshed the textview without the intension to dismiss the keyboard. @view -disableQuicktypeBar: for more details. */
@property (nonatomic, readwrite) BOOL didNotResignFirstResponder;

/** YES if the magnifying glass is visible. */
@property (nonatomic, getter=isLoupeVisible) BOOL loupeVisible;
/** YES if the magnifying glass is visible.
This feature is deprecated since there are no legit alternatives to detect the magnifying glass.
*/
@property (nonatomic, getter=isLoupeVisible) BOOL loupeVisible DEPRECATED_ATTRIBUTE;

/** YES if the keyboard track pad has been recognized. iOS 9 only. */
@property (nonatomic, readonly, getter=isTrackpadEnabled) BOOL trackpadEnabled;
Expand Down
16 changes: 14 additions & 2 deletions Source/SLKTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,24 @@ - (void)forwardInvocation:(NSInvocation *)invocation

- (void)slk_gestureRecognized:(UIGestureRecognizer *)gesture
{
// In iOS 8 and earlier, the gesture recognizer responsible for the magnifying glass movement was 'UIVariableDelayLoupeGesture'
// Since iOS 9, that gesture is now called '_UITextSelectionForceGesture'
// NOTE:
// In iOS 8 and earlier, the gesture recognizer responsible for the magnifying glass movement was 'UIVariableDelayLoupeGesture'.
// That gesture is called '_UITextSelectionForceGesture' since iOS 9.
//
// We are disabling the detection of these gesture objects until a public API is available.
// Open Radar: http://openradar.appspot.com/radar?id=5021485877952512
//
// From now, the isLoupeVisible flag will always be false.
// Whenever a user activates the magnifying glass by long pressing on the text content area and moves the cursor into a range of text
// that requires auto-completion, the magnifying glass would disappear all of the sudden, causing erratic UI behaviours.
// Why, you say? Because we need to reload the textView and disable auto-correction since it overrides any auto-completion while typing.

/*
if ([gesture isMemberOfClass:NSClassFromString(@"UIVariableDelayLoupeGesture")] ||
[gesture isMemberOfClass:NSClassFromString(@"_UITextSelectionForceGesture")]) {
[self slk_willShowLoupe:gesture];
}
*/
}

- (void)slk_willShowLoupe:(UIGestureRecognizer *)gesture
Expand Down
5 changes: 4 additions & 1 deletion Source/SLKTextViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
/** YES if text view's content can be cleaned with a shake gesture. Default is NO. */
@property (nonatomic, assign) BOOL shakeToClearEnabled;

/** YES if keyboard can be dismissed gradually with a vertical panning gesture. Default is YES. */
/**
YES if keyboard can be dismissed gradually with a vertical panning gesture. Default is YES.
This feature is disabled on iOS 9 due to no legit alternatives to detect the keyboard frame.
*/
@property (nonatomic, assign, getter = isKeyboardPanningEnabled) BOOL keyboardPanningEnabled;

/** YES if an external keyboard has been detected (this value updates only when the text view becomes first responder). */
Expand Down
5 changes: 5 additions & 0 deletions Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,11 @@ - (void)slk_handlePanGestureRecognizer:(UIPanGestureRecognizer *)gesture

__block UIView *keyboardView = [self.textInputbar.inputAccessoryView keyboardViewProxy];

// When no keyboard view has been detecting, let's skip any handling.
if (!keyboardView) {
return;
}

// Dynamic variables
CGPoint gestureLocation = [gesture locationInView:self.view];
CGPoint gestureVelocity = [gesture velocityInView:self.view];
Expand Down