From 45321cd9d82f46d756d015c5595340b4c9b2c935 Mon Sep 17 00:00:00 2001 From: Dylan Gattey Date: Fri, 1 Jun 2018 15:13:33 -0700 Subject: [PATCH 1/2] Adding configuration --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Hakawai/Mentions/HKWMentionsCreationStateMachine.m | 11 +++++++---- Hakawai/Mentions/HKWMentionsPlugin.h | 7 +++++++ Hakawai/Mentions/_HKWMentionsCreationStateMachine.h | 7 +++++++ 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 Hakawai.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Hakawai.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Hakawai.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Hakawai.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Hakawai/Mentions/HKWMentionsCreationStateMachine.m b/Hakawai/Mentions/HKWMentionsCreationStateMachine.m index 7c5ca80..bd8c1d7 100644 --- a/Hakawai/Mentions/HKWMentionsCreationStateMachine.m +++ b/Hakawai/Mentions/HKWMentionsCreationStateMachine.m @@ -788,10 +788,12 @@ - (void)handleFinalizedQueryWithNoResults:(HKWMentionsCreationAction)previousAct self.chooserState = HKWMentionsCreationChooserStateHidden; // However, there are two conditions under which mentions creation should actually end completely: - // 1. The user's initial query turned up no results + // 1. The user's initial query turned up no results and we should not continue searching after empty results // 2. There are no results because the last character the user typed was a whitespace or newline (whether or not - // the previous request resulted in results or not) - BOOL shouldStop = (self.resultsState == HKWMentionsCreationResultsStateAwaitingFirstResult + // the previous request resulted ifn results or not) + BOOL noResultsAndShouldStop = (!self.delegate.shouldContinueSearchingAfterEmptyResults + && self.resultsState == HKWMentionsCreationResultsStateAwaitingFirstResult); + BOOL shouldStop = (noResultsAndShouldStop || previousAction == HKWMentionsCreationActionWhitespaceCharacterInserted); if (shouldStop) { [self.delegate cancelMentionFromStartingLocation:self.startingLocation]; @@ -801,7 +803,8 @@ - (void)handleFinalizedQueryWithNoResults:(HKWMentionsCreationAction)previousAct // Advance the results state. The user could have been in one of two states formally: results existed, or there were // no results but the user hadn't typed a whitespace character since results stopped coming back - NSAssert(self.resultsState == HKWMentionsCreationResultsStateCreatingMentionWithResults + NSAssert((self.delegate.shouldContinueSearchingAfterEmptyResults && self.resultsState == HKWMentionsCreationResultsStateAwaitingFirstResult) + || self.resultsState == HKWMentionsCreationResultsStateCreatingMentionWithResults || self.resultsState == HKWMentionsCreationResultsStateNoResultsWithoutWhitespace, @"Logic error in dataReturnedForResults:...; resultsState is inconsistent. Got %@, which is invalid.", nameForResultsState(self.resultsState)); diff --git a/Hakawai/Mentions/HKWMentionsPlugin.h b/Hakawai/Mentions/HKWMentionsPlugin.h index f38d891..81c6b6d 100644 --- a/Hakawai/Mentions/HKWMentionsPlugin.h +++ b/Hakawai/Mentions/HKWMentionsPlugin.h @@ -355,6 +355,13 @@ typedef NS_ENUM(NSInteger, HKWMentionsPluginState) { */ @property (nonatomic) BOOL resumeMentionsCreationEnabled; +/*! + Whether or not we should continue searching for an explicit mention after we get back empty results. If this + is off, empty results will return the mentions creation state to \c HKWMentionsPluginStateQuiescent. If this is + on, empty results won't modify the mentions creation state. + */ +@property (nonatomic) BOOL shouldContinueSearchingAfterEmptyResults; + #pragma mark - Chooser UI Configuration diff --git a/Hakawai/Mentions/_HKWMentionsCreationStateMachine.h b/Hakawai/Mentions/_HKWMentionsCreationStateMachine.h index 8e15428..d8e2bf2 100644 --- a/Hakawai/Mentions/_HKWMentionsCreationStateMachine.h +++ b/Hakawai/Mentions/_HKWMentionsCreationStateMachine.h @@ -26,6 +26,13 @@ */ @property (nonatomic, readonly) BOOL loadingCellSupported; +/*! + Whether or not we should continue searching for an explicit mention after we get back empty results. If this + is off, empty results will return the mentions creation state to \c HKWMentionsPluginStateQuiescent. If this is + on, empty results won't modify the mentions creation state. + */ +@property (nonatomic, readonly) BOOL shouldContinueSearchingAfterEmptyResults; + /*! Request the bounds of the editor text view owning the delegate. */ From f4ae3511e90c146fb43af43cd4b3d81db0d73a81 Mon Sep 17 00:00:00 2001 From: Dylan Gattey Date: Fri, 1 Jun 2018 15:16:53 -0700 Subject: [PATCH 2/2] Version bump to 5.1.5 --- Hakawai.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Hakawai.podspec b/Hakawai.podspec index 8cc8919..215ab7c 100644 --- a/Hakawai.podspec +++ b/Hakawai.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "Hakawai" - s.version = "5.1.4" + s.version = "5.1.5" s.summary = "Hakawai aims to be a more powerful UITextView." s.description = <<-DESC Hakawai is a subclass of UITextView that exposes a number of convenience APIs, and supports further extension via 'plug-ins'. Hakawai ships with an easy-to-use, powerful, and customizable plug-in allowing users to create social media 'mentions'-style annotations. @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } s.authors = "Austin Zheng" s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/linkedin/Hakawai.git", :tag => "5.1.4" } + s.source = { :git => "https://github.com/linkedin/Hakawai.git", :tag => "5.1.5" } s.framework = "UIKit" s.requires_arc = true end