Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ParentLockScreenPlugin-iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.3</string>
<string>1.0.4</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
Expand Down
52 changes: 39 additions & 13 deletions ParentLockScreenPlugin-iOS/ParentLockScreenPluginVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}
}
Expand All @@ -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()
}
}
}
Expand All @@ -239,7 +248,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()
}
Expand All @@ -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
}
}


Expand Down
57 changes: 57 additions & 0 deletions ParentLockScreenPlugin-iOS/StylesHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

2 changes: 1 addition & 1 deletion ParentLockScreenPlugin.podspec
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
16 changes: 8 additions & 8 deletions Resources/ParentLockScreenPluginVC.xib
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@
<rect key="frame" x="0.0" y="0.0" width="730" height="539"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="xf8-Nf-JqE" userLabel="background image view" customClass="APImageView">
<rect key="frame" x="0.0" y="0.0" width="730" height="539"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</imageView>
<view contentMode="scaleToFill" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="0Is-o4-kYM" userLabel="ParentLock view">
<rect key="frame" x="158" y="2" width="414" height="535"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="xf8-Nf-JqE" userLabel="background image view">
<rect key="frame" x="0.0" y="0.0" width="414" height="535"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6R6-SB-58x" userLabel="containerImageView" customClass="UIImageView">
<rect key="frame" x="62" y="138" width="290" height="320"/>
<subviews>
Expand Down Expand Up @@ -305,23 +305,23 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="6R6-SB-58x" firstAttribute="leading" secondItem="0Is-o4-kYM" secondAttribute="leading" constant="62" id="7YG-Pf-EQt"/>
<constraint firstAttribute="trailing" secondItem="xf8-Nf-JqE" secondAttribute="trailing" id="CDL-Fg-v1l"/>
<constraint firstItem="xf8-Nf-JqE" firstAttribute="top" secondItem="0Is-o4-kYM" secondAttribute="top" id="I5s-as-ltW"/>
<constraint firstItem="6R6-SB-58x" firstAttribute="top" secondItem="K9O-Qn-pqZ" secondAttribute="bottom" constant="-27" id="Iws-Vh-GJR"/>
<constraint firstAttribute="width" constant="414" id="IxW-WA-7X2"/>
<constraint firstItem="6R6-SB-58x" firstAttribute="top" secondItem="0Is-o4-kYM" secondAttribute="top" constant="138" id="TGL-WQ-z3m"/>
<constraint firstItem="6R6-SB-58x" firstAttribute="centerX" secondItem="0Is-o4-kYM" secondAttribute="centerX" id="hUX-JG-iP4"/>
<constraint firstItem="K9O-Qn-pqZ" firstAttribute="leading" secondItem="6R6-SB-58x" secondAttribute="trailing" constant="-27" id="i4R-ak-Slz"/>
<constraint firstItem="xf8-Nf-JqE" firstAttribute="leading" secondItem="0Is-o4-kYM" secondAttribute="leading" id="yfu-8B-BpA"/>
<constraint firstAttribute="bottom" secondItem="xf8-Nf-JqE" secondAttribute="bottom" id="zgE-pe-K8w"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="0Is-o4-kYM" secondAttribute="centerX" id="1pN-Jg-yjp"/>
<constraint firstAttribute="trailing" secondItem="xf8-Nf-JqE" secondAttribute="trailing" id="Bew-BQ-6Lq"/>
<constraint firstItem="xf8-Nf-JqE" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="HLk-3o-mDN"/>
<constraint firstItem="0Is-o4-kYM" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="2" id="KUe-jg-S2g"/>
<constraint firstItem="NjK-9U-TTk" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="Xwb-0f-EL2"/>
<constraint firstAttribute="bottom" secondItem="xf8-Nf-JqE" secondAttribute="bottom" id="jia-Ep-kog"/>
<constraint firstItem="xf8-Nf-JqE" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="pl5-m7-Go0"/>
<constraint firstItem="0Is-o4-kYM" firstAttribute="centerY" secondItem="i5M-Pr-FkT" secondAttribute="centerY" id="vPF-Bt-l68"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
Expand Down
8 changes: 1 addition & 7 deletions Resources/ParentLockScreenPluginVC~ipad.xib
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<outlet property="infoLabel" destination="GC2-Ra-1mC" id="HVw-HY-U8V"/>
<outlet property="randomNumbersLabel" destination="mYI-Sm-IUs" id="hvj-ZF-wap"/>
<outlet property="secondButtonsRow" destination="o0q-RG-j9P" id="yrY-Yg-lYA"/>
<outlet property="secondaryRandomNumbersLabel" destination="Zde-Wg-ABR" id="lGD-4V-eHV"/>
<outlet property="thirdButtonsRow" destination="dpa-8i-yO9" id="OEG-cf-wRi"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outletCollection property="numberButtonsCollection" destination="cM7-gk-XuW" collectionClass="NSMutableArray" id="rcZ-ft-CbI"/>
Expand Down Expand Up @@ -46,9 +47,6 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0Is-o4-kYM" userLabel="ParentLock view">
<rect key="frame" x="108" y="84" width="808" height="599"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xf8-Nf-JqE" userLabel="background image view" customClass="APImageView">
<rect key="frame" x="0.0" y="0.0" width="808" height="599"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qS2-AP-BCU" userLabel="containerImageView" customClass="UIImageView">
<rect key="frame" x="264" y="139.5" width="280" height="320"/>
<subviews>
Expand Down Expand Up @@ -309,11 +307,7 @@
<constraint firstItem="qS2-AP-BCU" firstAttribute="top" secondItem="K9O-Qn-pqZ" secondAttribute="bottom" constant="-27" id="4VM-ei-rZH"/>
<constraint firstItem="qS2-AP-BCU" firstAttribute="centerY" secondItem="0Is-o4-kYM" secondAttribute="centerY" id="5EQ-lm-e8Z"/>
<constraint firstItem="qS2-AP-BCU" firstAttribute="centerX" secondItem="0Is-o4-kYM" secondAttribute="centerX" id="5bT-4N-ne1"/>
<constraint firstAttribute="bottom" secondItem="xf8-Nf-JqE" secondAttribute="bottom" id="8dB-QM-LOr"/>
<constraint firstItem="xf8-Nf-JqE" firstAttribute="leading" secondItem="0Is-o4-kYM" secondAttribute="leading" id="BWJ-iQ-AXv"/>
<constraint firstItem="xf8-Nf-JqE" firstAttribute="top" secondItem="0Is-o4-kYM" secondAttribute="top" id="LdC-uS-HTf"/>
<constraint firstItem="K9O-Qn-pqZ" firstAttribute="leading" secondItem="qS2-AP-BCU" secondAttribute="trailing" constant="-27" id="W41-aY-9BJ"/>
<constraint firstAttribute="trailing" secondItem="xf8-Nf-JqE" secondAttribute="trailing" id="pEC-Xq-40u"/>
</constraints>
</view>
</subviews>
Expand Down
31 changes: 31 additions & 0 deletions Specs/ParentLockScreenPlugin/1.0.4/ParentLockScreenPlugin.podspec
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion parentLockManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"fields": [{
"key": "presentation",
"type": "hidden",
"initial_value": "present"
"initial_value": "push"
}, {
"key": "force_nav_bar_hidden",
"type": "hidden",
Expand Down