mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-18 14:39:09 +00:00
Request location access for trusted networks
Policy changed in iOS 13.
This commit is contained in:
parent
802a4a4586
commit
fbe7d776e7
@ -11,15 +11,15 @@
|
||||
<dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>All files</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>public.content</string>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
@ -42,6 +42,8 @@
|
||||
<true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<false/>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Trusted networks</string>
|
||||
<key>NSUserActivityTypes</key>
|
||||
<array>
|
||||
<string>ConnectVPNIntent</string>
|
||||
@ -82,10 +84,10 @@
|
||||
<false/>
|
||||
<key>com.algoritmico.Passepartout.config</key>
|
||||
<dict>
|
||||
<key>group_id</key>
|
||||
<string>group.$(CFG_GROUP_ID)</string>
|
||||
<key>appstore_id</key>
|
||||
<string>$(CFG_APPSTORE_ID)</string>
|
||||
<key>group_id</key>
|
||||
<string>group.$(CFG_GROUP_ID)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -26,6 +26,7 @@
|
||||
import UIKit
|
||||
import NetworkExtension
|
||||
import MBProgressHUD
|
||||
import CoreLocation
|
||||
import TunnelKit
|
||||
import PassepartoutCore
|
||||
import Convenience
|
||||
@ -39,6 +40,8 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
||||
|
||||
@IBOutlet private weak var itemEdit: UIBarButtonItem!
|
||||
|
||||
private let locationManager = CLLocationManager()
|
||||
|
||||
private let downloader = FileDownloader(
|
||||
temporaryURL: GroupConstants.App.cachesURL.appendingPathComponent("downloaded.tmp"),
|
||||
timeout: AppConstants.Web.timeout
|
||||
@ -339,6 +342,23 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
||||
}
|
||||
|
||||
private func trustCurrentWiFi() -> Bool {
|
||||
if #available(iOS 13, *) {
|
||||
let auth = CLLocationManager.authorizationStatus()
|
||||
switch auth {
|
||||
case .authorizedAlways, .authorizedWhenInUse:
|
||||
break
|
||||
|
||||
case .denied:
|
||||
// TODO: alert when location denied
|
||||
return false
|
||||
|
||||
default:
|
||||
locationManager.requestWhenInUseAuthorization()
|
||||
// TODO: auto-invoke trustCurrentWiFi() again when location granted
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if #available(iOS 12, *) {
|
||||
IntentDispatcher.donateTrustCurrentNetwork()
|
||||
IntentDispatcher.donateUntrustCurrentNetwork()
|
||||
|
Loading…
Reference in New Issue
Block a user