Skip to content

Commit

Permalink
forward textView:shouldChangeTextInRange:replacementText: to external…
Browse files Browse the repository at this point in the history
… delegate if controlFlowPlugin allows
  • Loading branch information
Ryan Downing committed Apr 13, 2016
1 parent 99d8f60 commit 386bf08
Show file tree
Hide file tree
Showing 6 changed files with 982 additions and 3,723 deletions.
16 changes: 16 additions & 0 deletions Hakawai.xcodeproj/project.pbxproj
Expand Up @@ -359,6 +359,7 @@
E1C9676919A2A66000A4AA93 /* Frameworks */,
E1C9676A19A2A66000A4AA93 /* Resources */,
78EF1E9F7A6348EBBC9EC13B /* Copy Pods Resources */,
FE97749903D37C42118F6A37 /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -444,6 +445,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
FE97749903D37C42118F6A37 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HakawaiTests/Pods-HakawaiTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
7 changes: 5 additions & 2 deletions Hakawai/Core/HKWTextView.m
Expand Up @@ -345,8 +345,11 @@ - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range r
shouldChangeTextInRange:range
replacementText:replacementText];
}
// Forward to external delegate
if (!shouldUseCustomValue
// Forward to external delegate if:
// 1) There is no control flow plugin registered OR
// 2) Control flow plugin doesn't implement this delegate method OR
// 2) Control flow plugin has approved the replacement
if ((!shouldUseCustomValue || customValue)
&& [self.externalDelegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:)]) {
shouldUseCustomValue = YES;
customValue = [self.externalDelegate textView:textView
Expand Down
1 change: 1 addition & 0 deletions HakawaiDemo/HakawaiDemo.xcodeproj/project.pbxproj
Expand Up @@ -194,6 +194,7 @@
E1562B9319E72A6F00D68787 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0600;
ORGANIZATIONNAME = LinkedIn;
TargetAttributes = {
Expand Down
1 change: 0 additions & 1 deletion HakawaiDemo/HakawaiDemo/MentionsDemoViewController.m
Expand Up @@ -13,7 +13,6 @@
#import "MentionsDemoViewController.h"

#import "MentionsManager.h"
#import "HakawaiDemo-Swift.h"

#import "HKWTextView.h"
#import "HKWMentionsPlugin.h"
Expand Down
2 changes: 1 addition & 1 deletion HakawaiDemo/HakawaiDemo/SimpleChooserView.swift
Expand Up @@ -30,7 +30,7 @@ class SimpleChooserView : UIView, UIPickerViewDataSource, UIPickerViewDelegate,
pickerView.delegate = self
}

required init(coder: NSCoder) {
required init?(coder: NSCoder) {
super.init(coder: coder)
}

Expand Down

0 comments on commit 386bf08

Please sign in to comment.