Skip to content

Commit

Permalink
Update to 3.0.4
Browse files Browse the repository at this point in the history
Remove location type `locationAlways`.
  • Loading branch information
ivanvorobei committed Mar 26, 2019
1 parent 91868df commit 7ae38f8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 33 deletions.
9 changes: 6 additions & 3 deletions SPPermission.podspec
@@ -1,16 +1,19 @@
Pod::Spec.new do |s|

s.name = "SPPermission"
s.version = "3.0.3"
s.version = "3.0.4"
s.summary = "Simple request permissions with dialog alert"
s.homepage = "https://github.com/IvanVorobei/RequestPermission"
s.source = { :git => "https://github.com/IvanVorobei/RequestPermission.git", :tag => s.version }
s.license = { :type => "MIT", :file => "LICENSE" }

s.author = { "Ivan Vorobei" => "hello@ivanvorobei.by" }

s.swift_version = '4.2'
s.swift_version = '4.0'
s.platform = :ios
s.ios.framework = 'UIKit'
s.ios.deployment_target = "10.0"

s.source_files = "Source/SPPermission/**/*.swift"
end

end
Expand Up @@ -395,9 +395,7 @@ extension SPPermissionDialogController {
return "Application can create new task"
case .speech:
return "Allow check you voice"
case .locationAlways,
.locationWhenInUse,
.locationAlwaysAndWhenInUse:
case .locationWhenInUse, .locationAlwaysAndWhenInUse:
return "App will can check your location"
case .motion:
return "Allow reports motion and environment-related data"
Expand Down
Expand Up @@ -185,7 +185,7 @@ class SPPermissionDialogLineView: UIView {
self.iconView.type = .documents
case .speech:
self.iconView.type = .micro
case .locationWhenInUse, .locationAlways, .locationAlwaysAndWhenInUse:
case .locationWhenInUse, .locationAlwaysAndWhenInUse:
self.iconView.type = .compass
case .motion:
self.iconView.type = .windmill
Expand Down
26 changes: 5 additions & 21 deletions Source/SPPermission/SPPermission.swift
Expand Up @@ -88,8 +88,6 @@ extension SPPermission {
return SPRemindersPermission()
case .speech:
return SPSpeechPermission()
case .locationAlways:
return SPLocationPermission(type: SPLocationPermission.SPLocationType.Always)
case .locationWhenInUse:
return SPLocationPermission(type: SPLocationPermission.SPLocationType.WhenInUse)
case .locationAlwaysAndWhenInUse:
Expand Down Expand Up @@ -355,7 +353,6 @@ extension SPPermission {
var type: SPLocationType

enum SPLocationType {
case Always
case WhenInUse
case AlwaysAndWhenInUse
}
Expand All @@ -368,23 +365,10 @@ extension SPPermission {

let status = CLLocationManager.authorizationStatus()

switch self.type {
case .Always:
if status == .authorizedAlways {
return true
} else {
return false
}
case .WhenInUse, .AlwaysAndWhenInUse:
if status == .authorizedAlways {
return true
} else {
if status == .authorizedWhenInUse {
return true
} else {
return false
}
}
if status == .authorizedAlways {
return true
} else {
return status == .authorizedWhenInUse
}
}

Expand All @@ -395,7 +379,7 @@ extension SPPermission {
func request(withComlectionHandler complectionHandler: @escaping ()->()?) {

switch self.type {
case .Always, .AlwaysAndWhenInUse:
case .AlwaysAndWhenInUse:
if SPPermissionAlwaysAuthorizationLocationHandler.shared == nil {
SPPermissionAlwaysAuthorizationLocationHandler.shared = SPPermissionAlwaysAuthorizationLocationHandler()
}
Expand Down
6 changes: 1 addition & 5 deletions Source/SPPermission/SPPermissionType.swift
Expand Up @@ -31,8 +31,6 @@ import UIKit
case contacts = 5
case reminders = 6
case speech = 7
@available(iOS, obsoleted: 11, renamed: "locationAlwaysAndWhenInUse")
case locationAlways = 8
case locationWhenInUse = 9
case locationAlwaysAndWhenInUse = 10
case motion = 11
Expand All @@ -56,7 +54,7 @@ import UIKit
return "Reminders"
case .speech:
return "Speech"
case .locationAlways, .locationWhenInUse, .locationAlwaysAndWhenInUse:
case .locationWhenInUse, .locationAlwaysAndWhenInUse:
return "Location"
case .motion:
return "Motion"
Expand All @@ -83,8 +81,6 @@ import UIKit
return "NSRemindersUsageDescription"
case .speech:
return "NSSpeechRecognitionUsageDescription"
case .locationAlways:
return "NSLocationAlwaysUsageDescription"
case .locationWhenInUse:
return "NSLocationWhenInUseUsageDescription"
case .locationAlwaysAndWhenInUse:
Expand Down

0 comments on commit 7ae38f8

Please sign in to comment.