Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
permission_handler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
permission_handler
Commits
c8012694
Unverified
Commit
c8012694
authored
Jul 27, 2018
by
Martijn van Dijk
Committed by
GitHub
Jul 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5 from BaseflowIT/feature/ios_open_appsettings
Open App settings in iOS
parents
5ff59880
09f34a70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
ios/Classes/PermissionManager.swift
+18
-0
ios/Classes/SwiftPermissionHandlerPlugin.swift
+2
-0
No files found.
ios/Classes/PermissionManager.swift
View file @
c8012694
...
@@ -5,7 +5,9 @@
...
@@ -5,7 +5,9 @@
// Created by Maurits van Beusekom on 26/07/2018.
// Created by Maurits van Beusekom on 26/07/2018.
//
//
import
Flutter
import
Foundation
import
Foundation
import
UIKit
class
PermissionManager
:
NSObject
{
class
PermissionManager
:
NSObject
{
...
@@ -16,6 +18,22 @@ class PermissionManager: NSObject {
...
@@ -16,6 +18,22 @@ class PermissionManager: NSObject {
result
(
Codec
.
encodePermissionStatus
(
permissionStatus
:
permissionStatus
))
result
(
Codec
.
encodePermissionStatus
(
permissionStatus
:
permissionStatus
))
}
}
static
func
openAppSettings
(
result
:
@escaping
FlutterResult
)
{
if
#available(iOS 8.0, *)
{
if
#available(iOS 10, *)
{
UIApplication
.
shared
.
open
(
URL
.
init
(
string
:
UIApplicationOpenSettingsURLString
)
!
,
options
:
[:],
completionHandler
:
{
(
success
)
in
result
(
success
)
})
}
else
{
let
success
=
UIApplication
.
shared
.
openURL
(
URL
.
init
(
string
:
UIApplicationOpenSettingsURLString
)
!
)
result
(
success
)
}
}
result
(
false
)
}
private
static
func
createPermissionStrategy
(
permission
:
PermissionGroup
)
->
PermissionStrategy
{
private
static
func
createPermissionStrategy
(
permission
:
PermissionGroup
)
->
PermissionStrategy
{
switch
permission
{
switch
permission
{
case
PermissionGroup
.
calendar
:
case
PermissionGroup
.
calendar
:
...
...
ios/Classes/SwiftPermissionHandlerPlugin.swift
View file @
c8012694
...
@@ -21,6 +21,8 @@ public class SwiftPermissionHandlerPlugin: NSObject, FlutterPlugin {
...
@@ -21,6 +21,8 @@ public class SwiftPermissionHandlerPlugin: NSObject, FlutterPlugin {
PermissionManager
.
checkPermissionStatus
(
PermissionManager
.
checkPermissionStatus
(
permission
:
Codec
.
decodePermissionGroup
(
from
:
call
.
arguments
),
permission
:
Codec
.
decodePermissionGroup
(
from
:
call
.
arguments
),
result
:
result
)
result
:
result
)
}
else
if
call
.
method
==
"openAppSettings"
{
PermissionManager
.
openAppSettings
(
result
:
result
)
}
else
{
}
else
{
result
(
FlutterMethodNotImplemented
)
result
(
FlutterMethodNotImplemented
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment