Skip to content

Commit

Permalink
Update Example
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed May 1, 2019
1 parent 0b1588d commit a6de1a8
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 160 deletions.
278 changes: 140 additions & 138 deletions Example/SPPermission/SPPermission.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Expand Up @@ -24,13 +24,21 @@ import UIKit
class ViewController: SPController {

@objc func presentPermissonDialog() {

SPAnimationAlpha.hideList(views: [self.presentButton, self.changeBackgroundButton])

SPPermission.Dialog.request(
/*SPPermission.Dialog.request(
with: [.camera, .calendar, .microphone],
on: self,
delegate: self,
dataSource: self
)*/

SPPermission.Dialog.request(
with: [.locationWhenInUse, .locationAlwaysAndWhenInUse, .camera],
on: self,
delegate: self,
dataSource: self
)
}

Expand All @@ -53,6 +61,7 @@ class ViewController: SPController {

override func viewDidLoad() {
super.viewDidLoad()

self.view.backgroundColor = SPNativeColors.customGray
self.backgroundView.contentMode = .scaleAspectFill
self.view.addSubview(self.backgroundView)
Expand Down
Expand Up @@ -64,6 +64,9 @@ public class SPPermissionDialogController: UIViewController {
override public func viewDidLoad() {
super.viewDidLoad()

let closeIconBackgroundColor = (self.colorSource?.closeIconBackgroundColor ?? SPPermissionStyle.DefaultColors.white) ?? SPPermissionStyle.DefaultColors.white
let closeIconColor = (self.colorSource?.closeIconColor ?? SPPermissionStyle.DefaultColors.blue) ?? SPPermissionStyle.DefaultColors.blue

self.colorScheme = ColorScheme(
white: self.colorSource?.whiteColor ?? SPPermissionStyle.DefaultColors.white,
black: self.colorSource?.blackColor ?? SPPermissionStyle.DefaultColors.black,
Expand All @@ -73,7 +76,9 @@ public class SPPermissionDialogController: UIViewController {
iconWhite: self.colorSource?.iconWhiteColor ?? SPPermissionStyle.DefaultColors.white,
iconLight: self.colorSource?.iconLightColor ?? SPPermissionStyle.DefaultColors.lightIcon,
iconMedium: self.colorSource?.iconMediumColor ?? SPPermissionStyle.DefaultColors.mediumIcon,
iconDark: self.colorSource?.iconDarkColor ?? SPPermissionStyle.DefaultColors.darkIcon
iconDark: self.colorSource?.iconDarkColor ?? SPPermissionStyle.DefaultColors.darkIcon,
closeIconBackgroundColor: closeIconBackgroundColor,
closeIconColor: closeIconColor
)

self.backgroundView.setGradeAlpha(0, blurRaius: 0)
Expand Down Expand Up @@ -119,8 +124,8 @@ public class SPPermissionDialogController: UIViewController {
self.view.addSubview(self.areaView)
self.areaView.layer.anchorPoint = CGPoint.init(x: 0.5, y: 0.5)

self.closeButton.backgroundColor = self.colorScheme.white
self.closeButton.color = self.colorScheme.base
self.closeButton.backgroundColor = self.colorScheme.closeIconBackgroundColor
self.closeButton.color = self.colorScheme.closeIconColor
self.closeButton.widthIconFactor = 0.36
self.closeButton.heightIconFactor = 0.36
self.closeButton.alpha = 0
Expand Down Expand Up @@ -420,5 +425,7 @@ extension SPPermissionDialogController {
var iconMedium: UIColor
var iconDark: UIColor

var closeIconBackgroundColor: UIColor
var closeIconColor: UIColor
}
}
Expand Up @@ -81,4 +81,7 @@ extension SPPermission {
@objc optional var iconLightColor: UIColor { get }
@objc optional var iconMediumColor: UIColor { get }
@objc optional var iconDarkColor: UIColor { get }

@objc optional var closeIconBackgroundColor: UIColor? { get }
@objc optional var closeIconColor: UIColor? { get }
}
Expand Up @@ -368,7 +368,11 @@ extension SPPermission {
if status == .authorizedAlways {
return true
} else {
return status == .authorizedWhenInUse
if type == .WhenInUse {
return status == .authorizedWhenInUse
} else {
return false
}
}
}

Expand Down
36 changes: 19 additions & 17 deletions Example/SPPermission/SPPermission/Info.plist
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>SPPermission</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -20,23 +22,6 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppleMusicUsageDescription</key>
<string>Example Describtion</string>
<key>NSCalendarsUsageDescription</key>
Expand Down Expand Up @@ -65,5 +50,22 @@
<string>Example Describtion</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Example Describtion</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

0 comments on commit a6de1a8

Please sign in to comment.