From f6d13af17ec9eabca1dc55d50a6f457eae21fd92 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Tue, 15 Sep 2020 12:21:13 +0300 Subject: [PATCH] New custom keyboard for entering plate numbers --- AutoCat.xcodeproj/project.pbxproj | 29 +- .../xcshareddata/swiftpm/Package.resolved | 25 +- AutoCat/Assets.xcassets/Colors/Contents.json | 6 + .../DarkKeyBackground.colorset/Contents.json | 28 ++ .../KeyBackground.colorset/Contents.json | 38 +++ .../PlateBackground.colorset/Contents.json | 0 .../Contents.json | 0 .../PlateForeground.colorset/Contents.json | 0 AutoCat/Base.lproj/Main.storyboard | 72 ++++- AutoCat/Controllers/CheckController.swift | 35 ++- AutoCat/Controllers/RecordsController.swift | 2 +- AutoCat/Fonts/RoadNumbers.otf | Bin 0 -> 9520 bytes AutoCat/Info.plist | 1 + AutoCat/Models/PlateNumber.swift | 10 +- AutoCat/ThirdParty/SwiftMaskTextfield.swift | 269 ++++++++++++++++++ AutoCat/Utils/Constants.swift | 8 +- AutoCat/Views/PNKeyboard.swift | 201 +++++++++++++ 17 files changed, 651 insertions(+), 73 deletions(-) create mode 100644 AutoCat/Assets.xcassets/Colors/Contents.json create mode 100644 AutoCat/Assets.xcassets/Colors/DarkKeyBackground.colorset/Contents.json create mode 100644 AutoCat/Assets.xcassets/Colors/KeyBackground.colorset/Contents.json rename AutoCat/Assets.xcassets/{ => Colors}/PlateBackground.colorset/Contents.json (100%) rename AutoCat/Assets.xcassets/{ => Colors}/PlateBackgroundError.colorset/Contents.json (100%) rename AutoCat/Assets.xcassets/{ => Colors}/PlateForeground.colorset/Contents.json (100%) create mode 100644 AutoCat/Fonts/RoadNumbers.otf create mode 100644 AutoCat/ThirdParty/SwiftMaskTextfield.swift create mode 100644 AutoCat/Views/PNKeyboard.swift diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 15cb015..3955773 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -49,7 +49,6 @@ 7A488C3D24A74B990054D0B2 /* RxCollectionViewRealmDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A488C3924A74B990054D0B2 /* RxCollectionViewRealmDataSource.swift */; }; 7A488C3E24A74B990054D0B2 /* Reactive+RxRealmDataSources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A488C3A24A74B990054D0B2 /* Reactive+RxRealmDataSources.swift */; }; 7A488C3F24A74B990054D0B2 /* RealmBindObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A488C3B24A74B990054D0B2 /* RealmBindObserver.swift */; }; - 7A530B78240010D900CBFE6E /* InputMask in Frameworks */ = {isa = PBXBuildFile; productRef = 7A530B77240010D900CBFE6E /* InputMask */; }; 7A530B7A24001D3300CBFE6E /* CheckController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7924001D3300CBFE6E /* CheckController.swift */; }; 7A530B7E24017FEE00CBFE6E /* VehicleCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7D24017FEE00CBFE6E /* VehicleCell.swift */; }; 7A530B802401803A00CBFE6E /* Vehicle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A530B7F2401803A00CBFE6E /* Vehicle.swift */; }; @@ -94,6 +93,9 @@ 7AB67E8E2435D1A000258F61 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AB67E8D2435D1A000258F61 /* CustomButton.swift */; }; 7ADF6C93250B954900F237B2 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADF6C92250B954900F237B2 /* Navigation.swift */; }; 7ADF6C95250D037700F237B2 /* ShowEventController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADF6C94250D037700F237B2 /* ShowEventController.swift */; }; + 7ADF6C97250F41B000F237B2 /* PNKeyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADF6C96250F41B000F237B2 /* PNKeyboard.swift */; }; + 7ADF6C99250F872C00F237B2 /* RoadNumbers.otf in Resources */ = {isa = PBXBuildFile; fileRef = 7ADF6C98250F872C00F237B2 /* RoadNumbers.otf */; }; + 7ADF6C9D250FA96000F237B2 /* SwiftMaskTextfield.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ADF6C9C250FA96000F237B2 /* SwiftMaskTextfield.swift */; }; 7AE26A3324EEF9EC00625033 /* UIViewControllerExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE26A3224EEF9EC00625033 /* UIViewControllerExt.swift */; }; 7AE26A3524F31B0700625033 /* EventsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AE26A3424F31B0700625033 /* EventsController.swift */; }; 7AEFE728240455E200910EB7 /* SettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AEFE727240455E200910EB7 /* SettingsController.swift */; }; @@ -183,6 +185,9 @@ 7AB67E8D2435D1A000258F61 /* CustomButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButton.swift; sourceTree = ""; }; 7ADF6C92250B954900F237B2 /* Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Navigation.swift; sourceTree = ""; }; 7ADF6C94250D037700F237B2 /* ShowEventController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowEventController.swift; sourceTree = ""; }; + 7ADF6C96250F41B000F237B2 /* PNKeyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNKeyboard.swift; sourceTree = ""; }; + 7ADF6C98250F872C00F237B2 /* RoadNumbers.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = RoadNumbers.otf; sourceTree = ""; }; + 7ADF6C9C250FA96000F237B2 /* SwiftMaskTextfield.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMaskTextfield.swift; sourceTree = ""; }; 7AE26A3224EEF9EC00625033 /* UIViewControllerExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExt.swift; sourceTree = ""; }; 7AE26A3424F31B0700625033 /* EventsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventsController.swift; sourceTree = ""; }; 7AEFE727240455E200910EB7 /* SettingsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsController.swift; sourceTree = ""; }; @@ -209,7 +214,6 @@ 7A530B8B240181F500CBFE6E /* RxRealm in Frameworks */, 7A11471F23FEA18700B424AF /* RxRelay in Frameworks */, 7AF58D2F24029C5200CE01A0 /* MagazineLayout in Frameworks */, - 7A530B78240010D900CBFE6E /* InputMask in Frameworks */, 7A11471D23FEA18700B424AF /* RxSwift in Frameworks */, 7A11472623FEA1F400B424AF /* Realm in Frameworks */, ); @@ -285,6 +289,7 @@ 7A6DD90724329144009DE740 /* CenterTextLayer.swift */, 7A96AE32246C095700297C33 /* Base64FS.swift */, 7A15051124DB3E3000F39631 /* AnyEncodable.swift */, + 7ADF6C9C250FA96000F237B2 /* SwiftMaskTextfield.swift */, ); path = ThirdParty; sourceTree = ""; @@ -404,6 +409,7 @@ 7AB67E8B2435C38700258F61 /* CustomTextField.swift */, 7AB67E8D2435D1A000258F61 /* CustomButton.swift */, 7A1090EB24A4E3E100B4F0B2 /* CellProgressView.swift */, + 7ADF6C96250F41B000F237B2 /* PNKeyboard.swift */, ); path = Views; sourceTree = ""; @@ -411,6 +417,7 @@ 7A6DD90424326788009DE740 /* Fonts */ = { isa = PBXGroup; children = ( + 7ADF6C98250F872C00F237B2 /* RoadNumbers.otf */, 7A6DD90924329541009DE740 /* RoadNumbers2.0.otf */, ); path = Fonts; @@ -451,7 +458,6 @@ 7A11472223FEA18700B424AF /* RxBlocking */, 7A11472523FEA1F400B424AF /* Realm */, 7A11472723FEA1F400B424AF /* RealmSwift */, - 7A530B77240010D900CBFE6E /* InputMask */, 7A530B8A240181F500CBFE6E /* RxRealm */, 7AF58D2E24029C5200CE01A0 /* MagazineLayout */, 7AF58D332402A91C00CE01A0 /* Kingfisher */, @@ -492,7 +498,6 @@ packageReferences = ( 7A11471B23FEA18700B424AF /* XCRemoteSwiftPackageReference "RxSwift" */, 7A11472423FEA1F400B424AF /* XCRemoteSwiftPackageReference "realm-cocoa" */, - 7A530B76240010D900CBFE6E /* XCRemoteSwiftPackageReference "input-mask-ios" */, 7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */, 7AF58D2D24029C5200CE01A0 /* XCRemoteSwiftPackageReference "MagazineLayout" */, 7AF58D322402A91C00CE01A0 /* XCRemoteSwiftPackageReference "Kingfisher" */, @@ -515,6 +520,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7ADF6C99250F872C00F237B2 /* RoadNumbers.otf in Resources */, 7A7547DE2403180A004E8406 /* SectionHeader.xib in Resources */, 7A11470D23FDE7E600B424AF /* LaunchScreen.storyboard in Resources */, 7A6DD90A24329541009DE740 /* RoadNumbers2.0.otf in Resources */, @@ -537,6 +543,7 @@ 7A96AE31246B2FE400297C33 /* Constants.swift in Sources */, 7A64AE822469E16100ABE48E /* IHProgressHUD.swift in Sources */, 7A11470123FDE7E500B424AF /* AppDelegate.swift in Sources */, + 7ADF6C9D250FA96000F237B2 /* SwiftMaskTextfield.swift in Sources */, 7A27ADF924A09CAD0035F39E /* CocoaError.swift in Sources */, 7A813DC9250B5C9700CC93B9 /* LocationRow.swift in Sources */, 7A6DD90824329144009DE740 /* CenterTextLayer.swift in Sources */, @@ -600,6 +607,7 @@ 7A64AE752469DFB600ABE48E /* MediaBrowserViewController.swift in Sources */, 7A64AE732469DFB600ABE48E /* DismissAnimationController.swift in Sources */, 7A64AE812469E16100ABE48E /* ProgressAnimatedView.swift in Sources */, + 7ADF6C97250F41B000F237B2 /* PNKeyboard.swift in Sources */, 7A000AA224C2EEDE001F5B00 /* Location.swift in Sources */, 7A7547E024032CB6004E8406 /* VehiclePhotoCell.swift in Sources */, ); @@ -841,14 +849,6 @@ minimumVersion = 5.0.0; }; }; - 7A530B76240010D900CBFE6E /* XCRemoteSwiftPackageReference "input-mask-ios" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/RedMadRobot/input-mask-ios"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 5.0.0; - }; - }; 7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/RxSwiftCommunity/RxRealm"; @@ -937,11 +937,6 @@ package = 7A11472423FEA1F400B424AF /* XCRemoteSwiftPackageReference "realm-cocoa" */; productName = RealmSwift; }; - 7A530B77240010D900CBFE6E /* InputMask */ = { - isa = XCSwiftPackageProductDependency; - package = 7A530B76240010D900CBFE6E /* XCRemoteSwiftPackageReference "input-mask-ios" */; - productName = InputMask; - }; 7A530B8A240181F500CBFE6E /* RxRealm */ = { isa = XCSwiftPackageProductDependency; package = 7A530B89240181F500CBFE6E /* XCRemoteSwiftPackageReference "RxRealm" */; diff --git a/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ffef2dc..0e7c99d 100644 --- a/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AutoCat.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -19,22 +19,13 @@ "version": "1.1.0" } }, - { - "package": "InputMask", - "repositoryURL": "https://github.com/RedMadRobot/input-mask-ios", - "state": { - "branch": null, - "revision": "78a98f31d5b7fe2c0d84146748f22114c1c17c7c", - "version": "5.0.0" - } - }, { "package": "Kingfisher", "repositoryURL": "https://github.com/onevcat/Kingfisher", "state": { "branch": null, - "revision": "1339ebea9498ef6c3fc75cc195d7163d7c7167f9", - "version": "5.14.1" + "revision": "175eeb4618b0a6ef4d69a7409b6a74ddd235a093", + "version": "5.15.0" } }, { @@ -42,8 +33,8 @@ "repositoryURL": "https://github.com/airbnb/MagazineLayout", "state": { "branch": null, - "revision": "12dd2cc84b7f17c4f46c7d95cde64d521c588ee8", - "version": "1.6.1" + "revision": "4a5eff2203ad8d8c7e14ea1b283b64f9320752a9", + "version": "1.6.2" } }, { @@ -51,8 +42,8 @@ "repositoryURL": "https://github.com/realm/realm-cocoa", "state": { "branch": null, - "revision": "5d296d8a3750ac86e731263b44e2ba0c3c85f2cb", - "version": "5.3.2" + "revision": "6310911a38d55003f0b8acca96635aa2bfc3e2c0", + "version": "5.4.0" } }, { @@ -60,8 +51,8 @@ "repositoryURL": "https://github.com/realm/realm-core", "state": { "branch": null, - "revision": "55a0d32516c0f3a5fd3ab8c0224ee22efcc7cd58", - "version": "6.0.12" + "revision": "34d7fbcbab2a94bcad081bddf9d172961cd84659", + "version": "6.0.25" } }, { diff --git a/AutoCat/Assets.xcassets/Colors/Contents.json b/AutoCat/Assets.xcassets/Colors/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/AutoCat/Assets.xcassets/Colors/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AutoCat/Assets.xcassets/Colors/DarkKeyBackground.colorset/Contents.json b/AutoCat/Assets.xcassets/Colors/DarkKeyBackground.colorset/Contents.json new file mode 100644 index 0000000..546bd09 --- /dev/null +++ b/AutoCat/Assets.xcassets/Colors/DarkKeyBackground.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "ios", + "reference" : "systemGray2Color" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "ios", + "reference" : "systemGray3Color" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AutoCat/Assets.xcassets/Colors/KeyBackground.colorset/Contents.json b/AutoCat/Assets.xcassets/Colors/KeyBackground.colorset/Contents.json new file mode 100644 index 0000000..eb0fccd --- /dev/null +++ b/AutoCat/Assets.xcassets/Colors/KeyBackground.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.300", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AutoCat/Assets.xcassets/PlateBackground.colorset/Contents.json b/AutoCat/Assets.xcassets/Colors/PlateBackground.colorset/Contents.json similarity index 100% rename from AutoCat/Assets.xcassets/PlateBackground.colorset/Contents.json rename to AutoCat/Assets.xcassets/Colors/PlateBackground.colorset/Contents.json diff --git a/AutoCat/Assets.xcassets/PlateBackgroundError.colorset/Contents.json b/AutoCat/Assets.xcassets/Colors/PlateBackgroundError.colorset/Contents.json similarity index 100% rename from AutoCat/Assets.xcassets/PlateBackgroundError.colorset/Contents.json rename to AutoCat/Assets.xcassets/Colors/PlateBackgroundError.colorset/Contents.json diff --git a/AutoCat/Assets.xcassets/PlateForeground.colorset/Contents.json b/AutoCat/Assets.xcassets/Colors/PlateForeground.colorset/Contents.json similarity index 100% rename from AutoCat/Assets.xcassets/PlateForeground.colorset/Contents.json rename to AutoCat/Assets.xcassets/Colors/PlateForeground.colorset/Contents.json diff --git a/AutoCat/Base.lproj/Main.storyboard b/AutoCat/Base.lproj/Main.storyboard index 4ed0dc7..405da82 100644 --- a/AutoCat/Base.lproj/Main.storyboard +++ b/AutoCat/Base.lproj/Main.storyboard @@ -328,14 +328,14 @@ - + - + - + @@ -596,18 +596,14 @@ - + - - - - - - - - + + + +