Skip to content

Commit

Permalink
Bump version, cleanup, update README and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
taflanidi committed Feb 15, 2021
1 parent f6fc620 commit 40e33ad
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 25 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog

### `6.1.0`

##### Added:

* iOS suggestions support

### `6.0.0`

#### Removed:
Expand Down
2 changes: 1 addition & 1 deletion InputMask.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "InputMask"
spec.version = "6.0.0"
spec.version = "6.1.0"
spec.summary = "InputMask"
spec.description = "User input masking library."
spec.homepage = "https://github.com/RedMadRobot/input-mask-ios"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -77,7 +77,7 @@ git "https://github.com/RedMadRobot/input-mask-ios.git"

```swift
dependencies: [
.Package(url: "https://github.com/RedMadRobot/input-mask-ios", majorVersion: 5)
.Package(url: "https://github.com/RedMadRobot/input-mask-ios", majorVersion: 6)
]
```

Expand Down Expand Up @@ -182,6 +182,7 @@ These folks rock:
* Luiz [LuizZak](https://github.com/LuizZak) Fernando
* Ivan [vani](https://github.com/vani2) Vavilov
* Diego [diegotl](https://github.com/diegotl) Trevisan
* Martin [martintreurnicht](https://github.com/martintreurnicht) Treurnicht

# License

Expand Down
12 changes: 7 additions & 5 deletions Source/InputMask/InputMask.xcodeproj/project.pbxproj
Expand Up @@ -427,7 +427,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1240;
ORGANIZATIONNAME = "Egor Taflanidi";
TargetAttributes = {
518F8AAC1F36A98400065733 = {
Expand Down Expand Up @@ -660,6 +660,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -685,7 +686,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -721,6 +722,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -740,7 +742,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
Expand All @@ -762,7 +764,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/InputMask/Supporting Files/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.InputMask;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -783,7 +785,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/InputMask/Supporting Files/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.redmadrobot.InputMask;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8A808ECA1D5B0FEC00A75B9C"
BuildableName = "InputMask.framework"
BlueprintName = "InputMask"
ReferencedContainer = "container:InputMask.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8A808ECA1D5B0FEC00A75B9C"
BuildableName = "InputMask.framework"
BlueprintName = "InputMask"
ReferencedContainer = "container:InputMask.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -70,8 +68,6 @@
ReferencedContainer = "container:InputMask.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Expand Up @@ -47,10 +47,11 @@ open class MaskedTextFieldDelegate: NSObject, UITextFieldDelegate {
@IBInspectable open var autocompleteOnFocus: Bool
@IBInspectable open var autoskip: Bool
@IBInspectable open var rightToLeft: Bool

/**
Allows input suggestions from keyboard
*/
@IBInspectable open var allowSuggestions: Bool
@IBInspectable open var allowSuggestions: Bool

/**
Shortly after new text is being pasted from the clipboard, ```UITextField``` receives a new value for its
Expand Down Expand Up @@ -231,7 +232,7 @@ open class MaskedTextFieldDelegate: NSObject, UITextFieldDelegate {
) -> Bool {
let updatedText: String = replaceCharacters(inText: textField.text ?? "", range: range, withCharacters: string)
// https://stackoverflow.com/questions/52131894/shouldchangecharactersin-combined-with-suggested-text
if (allowSuggestions && string == " " && updatedText == " ") {
if (allowSuggestions && string == " " && updatedText == " ") {
return true
}
let isDeletion = 0 < range.length && 0 == string.count
Expand Down
Expand Up @@ -27,6 +27,11 @@ open class MaskedTextInputListener: NSObject {
@IBInspectable open var autoskip: Bool
@IBInspectable open var rightToLeft: Bool

/**
Allows input suggestions from keyboard
*/
@IBInspectable open var allowSuggestions: Bool

/**
Shortly after new text is being pasted from the clipboard, ```UITextInput``` receives a new value for its
`selectedTextRange` property from the system. This new range is not consistent with the formatted text and
Expand Down Expand Up @@ -56,7 +61,8 @@ open class MaskedTextInputListener: NSObject {
affineFormats: [String] = [],
affinityCalculationStrategy: AffinityCalculationStrategy = .wholeString,
customNotations: [Notation] = [],
onMaskedTextChangedCallback: ((_ textInput: UITextInput, _ value: String, _ complete: Bool) -> ())? = nil
onMaskedTextChangedCallback: ((_ textInput: UITextInput, _ value: String, _ complete: Bool) -> ())? = nil,
allowSuggestions: Bool = true
) {
self.primaryMaskFormat = primaryFormat
self.autocomplete = autocomplete
Expand All @@ -67,6 +73,7 @@ open class MaskedTextInputListener: NSObject {
self.affinityCalculationStrategy = affinityCalculationStrategy
self.customNotations = customNotations
self.onMaskedTextChangedCallback = onMaskedTextChangedCallback
self.allowSuggestions = allowSuggestions
super.init()
}

Expand All @@ -91,6 +98,7 @@ open class MaskedTextInputListener: NSObject {
self.affinityCalculationStrategy = .wholeString
self.customNotations = []
self.onMaskedTextChangedCallback = nil
self.allowSuggestions = true
super.init()
}

Expand Down Expand Up @@ -173,13 +181,18 @@ open class MaskedTextInputListener: NSObject {
isChangingCharactersIn range: NSRange,
replacementString string: String
) -> Mask.Result {
let updatedText: String = replaceCharacters(inText: textInput.allText, range: range, withCharacters: string)
// https://stackoverflow.com/questions/52131894/shouldchangecharactersin-combined-with-suggested-text
if (allowSuggestions && string == " " && updatedText == " ") {
// TODO:
// return true
}
let isDeletion = isThisDeletion(inRange: range, string: string, field: textInput)
let useAutocomplete = isDeletion ? false : autocomplete
let useAutoskip = isDeletion ? autoskip : false
let caretGravity: CaretString.CaretGravity =
isDeletion ? .backward(autoskip: useAutoskip) : .forward(autocomplete: useAutocomplete)

let updatedText: String = replaceCharacters(inText: textInput.allText, range: range, withCharacters: string)
let caretPositionInt: Int = isDeletion ? range.location : range.location + string.count
let caretPosition: String.Index = updatedText.startIndex(offsetBy: caretPositionInt)
let text = CaretString(string: updatedText, caretPosition: caretPosition, caretGravity: caretGravity)
Expand Down

0 comments on commit 40e33ad

Please sign in to comment.