From 6797990dbd0df7c05b461b9a3ac5c606fe9903bd Mon Sep 17 00:00:00 2001 From: Roi Date: Wed, 22 May 2019 16:03:51 +0300 Subject: [PATCH 1/5] update manifest and fix small bug with dots view --- ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift | 2 +- parentLockManifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift b/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift index 3a8b6d7..3740f83 100644 --- a/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift +++ b/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift @@ -239,7 +239,7 @@ class ParentLockScreenPluginVC: UIViewController,ZPPluggableScreenProtocol,ZPScr dot.layer.cornerRadius = cornerRadius * dot.bounds.size.width dot.clipsToBounds = true dot.layer.borderWidth = 1 - dot.layer.borderColor = StylesHelper.getColorForKey(key: "indicator_highlighted", from: pluginStyles).cgColor + dot.layer.borderColor = StylesHelper.getColorForKey(key: "indicator_highlighted", from: pluginGeneralSettings).cgColor } clearValidationIndicators() } diff --git a/parentLockManifest.json b/parentLockManifest.json index 92da494..b5e0b69 100644 --- a/parentLockManifest.json +++ b/parentLockManifest.json @@ -69,7 +69,7 @@ "fields": [{ "key": "presentation", "type": "hidden", - "initial_value": "present" + "initial_value": "push" }, { "key": "force_nav_bar_hidden", "type": "hidden", From 1cc6a4f266c87f09923d0e4c96640e2f33872622 Mon Sep 17 00:00:00 2001 From: Roi Date: Wed, 22 May 2019 16:05:43 +0300 Subject: [PATCH 2/5] update version --- ParentLockScreenPlugin-iOS/Info.plist | 2 +- ParentLockScreenPlugin.podspec | 2 +- .../1.0.4/ParentLockScreenPlugin.podspec | 31 +++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 Specs/ParentLockScreenPlugin/1.0.4/ParentLockScreenPlugin.podspec diff --git a/ParentLockScreenPlugin-iOS/Info.plist b/ParentLockScreenPlugin-iOS/Info.plist index fd850b9..f7063e0 100644 --- a/ParentLockScreenPlugin-iOS/Info.plist +++ b/ParentLockScreenPlugin-iOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0.3 + 1.0.4 CFBundleVersion $(CURRENT_PROJECT_VERSION) diff --git a/ParentLockScreenPlugin.podspec b/ParentLockScreenPlugin.podspec index ebcb06e..f0aeade 100644 --- a/ParentLockScreenPlugin.podspec +++ b/ParentLockScreenPlugin.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ParentLockScreenPlugin" - s.version = '1.0.3' + s.version = '1.0.4' s.summary = "ParentLockScreenPlugin" s.description = <<-DESC plugin that provides a parent Validation before entering a specific area. diff --git a/Specs/ParentLockScreenPlugin/1.0.4/ParentLockScreenPlugin.podspec b/Specs/ParentLockScreenPlugin/1.0.4/ParentLockScreenPlugin.podspec new file mode 100644 index 0000000..f0aeade --- /dev/null +++ b/Specs/ParentLockScreenPlugin/1.0.4/ParentLockScreenPlugin.podspec @@ -0,0 +1,31 @@ +Pod::Spec.new do |s| + s.name = "ParentLockScreenPlugin" + s.version = '1.0.4' + s.summary = "ParentLockScreenPlugin" + s.description = <<-DESC + plugin that provides a parent Validation before entering a specific area. + DESC + s.homepage = "https://github.com/applicaster-plugins/ParentLockScreenPlugin-iOS" + s.license = 'CMPS' + s.author = { "cmps" => "r.kedarya@applicaster.com" } + s.source = { :git => "git@github.com:applicaster-plugins/ParentLockScreenPlugin-iOS.git", :tag => s.version.to_s } + s.platform = :ios, '9.0' + s.requires_arc = true + + s.public_header_files = 'ParentLockScreenPlugin-iOS/**/*.h' + s.source_files = 'ParentLockScreenPlugin-iOS/**/*.{h,m,swift}' + + + s.resources = [ + "Resources/*.{png,xib}" + ] + + s.xcconfig = { + 'ENABLE_BITCODE' => 'YES', + 'FRAMEWORK_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}"/**', + 'SWIFT_VERSION' => '4.2' + } + + s.dependency 'ZappPlugins' + s.dependency 'ApplicasterSDK' +end From 0351dd6511cbe4b82630edf856f39cac96a25925 Mon Sep 17 00:00:00 2001 From: Roi Date: Wed, 22 May 2019 23:20:23 +0300 Subject: [PATCH 3/5] fix --- Resources/ParentLockScreenPluginVC~ipad.xib | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/ParentLockScreenPluginVC~ipad.xib b/Resources/ParentLockScreenPluginVC~ipad.xib index 1414742..bf312e5 100644 --- a/Resources/ParentLockScreenPluginVC~ipad.xib +++ b/Resources/ParentLockScreenPluginVC~ipad.xib @@ -18,6 +18,7 @@ + From 24289896d5ae86cb28ef1beeeae786c3ff7cb2a5 Mon Sep 17 00:00:00 2001 From: Roi Date: Thu, 23 May 2019 00:44:20 +0300 Subject: [PATCH 4/5] support different background images for different devices and different orientations --- .../ParentLockScreenPluginVC.swift | 50 ++++++++++++---- ParentLockScreenPlugin-iOS/StylesHelper.swift | 57 +++++++++++++++++++ 2 files changed, 95 insertions(+), 12 deletions(-) diff --git a/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift b/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift index 3740f83..0c638e3 100644 --- a/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift +++ b/ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift @@ -124,19 +124,24 @@ class ParentLockScreenPluginVC: UIViewController,ZPPluggableScreenProtocol,ZPScr setIndicatorsToMainColor() setNumberButtons() setInfoLabel() + setBackgroundImage() let containerBackgroundImageName = (numberOfValidationDigitsToPresent() == 3) ? "background_image_1_3" : "background_image_1_9" if let containerBackgroundImage = UIImage(named: containerBackgroundImageName) { self.containerImageView.image = containerBackgroundImage } - if let parentLockscreenBackgroundImage = UIImage(named: "parent_lock_background_image_736h") { - self.backgroundImageView.image = parentLockscreenBackgroundImage - } if let pluginGeneralSettings = pluginGeneralSettings { let screenBackgroundColor = StylesHelper.getColorForKey(key: "background_color", from: pluginGeneralSettings) self.backgroundImageView.backgroundColor = screenBackgroundColor } } + private func setBackgroundImage() { + let imageName = StylesHelper.localSplashImageNameForScreenSize() + if let parentLockscreenBackgroundImage = UIImage(named: imageName) { + self.backgroundImageView.image = parentLockscreenBackgroundImage + } + } + private func setCloseButtonImage() { if let closeButtonImage = UIImage(named: "close_button") { closeButton.setImage(closeButtonImage, for: .normal) @@ -203,7 +208,8 @@ class ParentLockScreenPluginVC: UIViewController,ZPPluggableScreenProtocol,ZPScr let error = success ? nil : NSError(domain: "User has closed hook execution failed", code: 0, userInfo: nil) hookCompletion(success, error, nil) } - if let screenPluginDelegate = self.screenPluginDelegate { + if let screenPluginDelegate = self.screenPluginDelegate, + success == true { screenPluginDelegate.removeScreenPluginFromNavigationStack() } } @@ -213,15 +219,18 @@ class ParentLockScreenPluginVC: UIViewController,ZPPluggableScreenProtocol,ZPScr updateIndicatorAtIndex(index: enterdValues.count) enterdValues.append(String(number + 1)) if enterdValues.count == ParentLockScreenNumberLimit { - if enterdValues == generatedValues { - self.isVlidated = true - closeScreenPlugin(with: true) - } else { - generatedValues.removeAll() - generateValues() + let weakSelf = self + DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(50)) { + if weakSelf.enterdValues == weakSelf.generatedValues { + weakSelf.isVlidated = true + weakSelf.closeScreenPlugin(with: true) + } else { + weakSelf.generatedValues.removeAll() + weakSelf.generateValues() + } + weakSelf.enterdValues.removeAll() + weakSelf.clearValidationIndicators() } - enterdValues.removeAll() - clearValidationIndicators() } } } @@ -250,6 +259,23 @@ class ParentLockScreenPluginVC: UIViewController,ZPPluggableScreenProtocol,ZPScr dot.backgroundColor = StylesHelper.getColorForKey(key: "indicator_highlighted", from: pluginGeneralSettings) } } + + //Support of changing between landscape and portrait background Image + override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { + setBackgroundImage() + } + + open override var supportedInterfaceOrientations : UIInterfaceOrientationMask { + if let presentingViewController = self.presentingViewController { + return presentingViewController.supportedInterfaceOrientations + } else { + return .portrait + } + } + + open override var shouldAutorotate: Bool { + return true + } } diff --git a/ParentLockScreenPlugin-iOS/StylesHelper.swift b/ParentLockScreenPlugin-iOS/StylesHelper.swift index 7edfd82..48dd460 100644 --- a/ParentLockScreenPlugin-iOS/StylesHelper.swift +++ b/ParentLockScreenPlugin-iOS/StylesHelper.swift @@ -86,5 +86,62 @@ class StylesHelper: NSObject { } return retVal } + + static private let backgroundImageIphone_568 = "parent_lock_background_image_568h" + static private let backgroundImageIphone_667 = "parent_lock_background_image_667h" + static private let backgroundImageIphone_736 = "parent_lock_background_image_736h" + static private let backgroundImageIphone_812 = "parent_lock_background_image_812h" + static private let backgroundImageIpadNonRetina_1024 = "parent_lock_background_image_landscape~ipad" + static private let backgroundImageIpad_1024 = "parent_lock_background_image_landscape@2x~ipad" + static private let backgroundImageIpad_1024_portrait = "parent_lock_background_image_portrait@2x~ipad" + static private let backgroundImageIpad_1366_portrait = "parent_lock_background_image_1366h_portrait@2x~ipad" + static private let backgroundImageIpad_1366 = "parent_lock_background_image_1366h@2x~ipad" + + @objc public class func localSplashImageNameForScreenSize() -> String { + var retVal = "" + + let devicePortraitWidth = APScreenMultiplierConverter.deviceWidth() + let devicePortraitHeight = APScreenMultiplierConverter.deviceHeight() + + if UIDevice.current.userInterfaceIdiom == .pad { + retVal = backgroundImageIpad_1024 + + if devicePortraitWidth == 768 { + if UIScreen.main.scale >= 2.0 { + if UIApplication.shared.statusBarOrientation.isLandscape { + retVal = backgroundImageIpad_1024 + } else { + retVal = backgroundImageIpad_1024_portrait + } + } else { + retVal = backgroundImageIpadNonRetina_1024 + } + } else if devicePortraitWidth == 1024 { + if UIApplication.shared.statusBarOrientation.isLandscape { + retVal = backgroundImageIpad_1366 + } else { + retVal = backgroundImageIpad_1366_portrait + } + } + } else if UIDevice.current.userInterfaceIdiom == .phone { + retVal = backgroundImageIphone_568 + if devicePortraitWidth == 320 { + let size = UIScreen.main.bounds.size + if size.width == 568 || size.height == 568 { + retVal = backgroundImageIphone_568 + } + } else if devicePortraitWidth == 375 { + if devicePortraitHeight == 812 { + retVal = backgroundImageIphone_812 + } + else { + retVal = backgroundImageIphone_667 + } + } else if devicePortraitWidth == 414 { + retVal = backgroundImageIphone_736 + } + } + return retVal + } } From 4ef7d49d5fb56be2dd89d654a2f7b6c3ee6bc7f8 Mon Sep 17 00:00:00 2001 From: Roi Date: Thu, 23 May 2019 08:22:25 +0300 Subject: [PATCH 5/5] update xibs --- Resources/ParentLockScreenPluginVC.xib | 16 ++++++++-------- Resources/ParentLockScreenPluginVC~ipad.xib | 7 ------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Resources/ParentLockScreenPluginVC.xib b/Resources/ParentLockScreenPluginVC.xib index 6549c3c..ed6deff 100644 --- a/Resources/ParentLockScreenPluginVC.xib +++ b/Resources/ParentLockScreenPluginVC.xib @@ -40,13 +40,13 @@ + + + + - - - - @@ -305,23 +305,23 @@ - - - - + + + + diff --git a/Resources/ParentLockScreenPluginVC~ipad.xib b/Resources/ParentLockScreenPluginVC~ipad.xib index bf312e5..824e2c2 100644 --- a/Resources/ParentLockScreenPluginVC~ipad.xib +++ b/Resources/ParentLockScreenPluginVC~ipad.xib @@ -47,9 +47,6 @@ - - - @@ -310,11 +307,7 @@ - - - -