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
b3d010c7
Commit
b3d010c7
authored
Feb 12, 2019
by
Maurits van Beusekom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatted code
parent
203dd6ba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
example/ios/Runner.xcodeproj/project.pbxproj
+5
-1
example/lib/main.dart
+4
-3
lib/permission_handler.dart
+3
-6
No files found.
example/ios/Runner.xcodeproj/project.pbxproj
View file @
b3d010c7
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2
/* GeneratedPluginRegistrant.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
1498D2331E8E89220040F4C2
/* GeneratedPluginRegistrant.m */
;
};
1498D2341E8E89220040F4C2
/* GeneratedPluginRegistrant.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
1498D2331E8E89220040F4C2
/* GeneratedPluginRegistrant.m */
;
};
2D5378261FAA1A9400D5DBA9
/* flutter_assets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
2D5378251FAA1A9400D5DBA9
/* flutter_assets */
;
};
3B3967161E833CAA004F5970
/* AppFrameworkInfo.plist in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3B3967151E833CAA004F5970
/* AppFrameworkInfo.plist */
;
};
3B3967161E833CAA004F5970
/* AppFrameworkInfo.plist in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3B3967151E833CAA004F5970
/* AppFrameworkInfo.plist */
;
};
3B80C3941E831B6300D905FE
/* App.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3B80C3931E831B6300D905FE
/* App.framework */
;
};
3B80C3941E831B6300D905FE
/* App.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3B80C3931E831B6300D905FE
/* App.framework */
;
};
3B80C3951E831B6300D905FE
/* App.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3B80C3931E831B6300D905FE
/* App.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
3B80C3951E831B6300D905FE
/* App.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
3B80C3931E831B6300D905FE
/* App.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
...
@@ -38,6 +39,7 @@
...
@@ -38,6 +39,7 @@
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2
/* GeneratedPluginRegistrant.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GeneratedPluginRegistrant.h
;
sourceTree
=
"<group>"
;
};
1498D2321E8E86230040F4C2
/* GeneratedPluginRegistrant.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
GeneratedPluginRegistrant.h
;
sourceTree
=
"<group>"
;
};
1498D2331E8E89220040F4C2
/* GeneratedPluginRegistrant.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
GeneratedPluginRegistrant.m
;
sourceTree
=
"<group>"
;
};
1498D2331E8E89220040F4C2
/* GeneratedPluginRegistrant.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
GeneratedPluginRegistrant.m
;
sourceTree
=
"<group>"
;
};
2D5378251FAA1A9400D5DBA9
/* flutter_assets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder
;
name
=
flutter_assets
;
path
=
Flutter/flutter_assets
;
sourceTree
=
SOURCE_ROOT
;
};
36F84C9A972D968241208A7F
/* Pods_Runner.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Pods_Runner.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
36F84C9A972D968241208A7F
/* Pods_Runner.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
includeInIndex
=
0
;
path
=
Pods_Runner.framework
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
3B3967151E833CAA004F5970
/* AppFrameworkInfo.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
name
=
AppFrameworkInfo.plist
;
path
=
Flutter/AppFrameworkInfo.plist
;
sourceTree
=
"<group>"
;
};
3B3967151E833CAA004F5970
/* AppFrameworkInfo.plist */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
text.plist.xml
;
name
=
AppFrameworkInfo.plist
;
path
=
Flutter/AppFrameworkInfo.plist
;
sourceTree
=
"<group>"
;
};
3B80C3931E831B6300D905FE
/* App.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
App.framework
;
path
=
Flutter/App.framework
;
sourceTree
=
"<group>"
;
};
3B80C3931E831B6300D905FE
/* App.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
App.framework
;
path
=
Flutter/App.framework
;
sourceTree
=
"<group>"
;
};
...
@@ -81,6 +83,7 @@
...
@@ -81,6 +83,7 @@
children
=
(
children
=
(
3B80C3931E831B6300D905FE
/* App.framework */
,
3B80C3931E831B6300D905FE
/* App.framework */
,
3B3967151E833CAA004F5970
/* AppFrameworkInfo.plist */
,
3B3967151E833CAA004F5970
/* AppFrameworkInfo.plist */
,
2D5378251FAA1A9400D5DBA9
/* flutter_assets */
,
9740EEBA1CF902C7004384FC
/* Flutter.framework */
,
9740EEBA1CF902C7004384FC
/* Flutter.framework */
,
9740EEB21CF90195004384FC
/* Debug.xcconfig */
,
9740EEB21CF90195004384FC
/* Debug.xcconfig */
,
7AFA3C8E1D35360C0083082E
/* Release.xcconfig */
,
7AFA3C8E1D35360C0083082E
/* Release.xcconfig */
,
...
@@ -203,6 +206,7 @@
...
@@ -203,6 +206,7 @@
files
=
(
files
=
(
97C147011CF9000F007C117D
/* LaunchScreen.storyboard in Resources */
,
97C147011CF9000F007C117D
/* LaunchScreen.storyboard in Resources */
,
3B3967161E833CAA004F5970
/* AppFrameworkInfo.plist in Resources */
,
3B3967161E833CAA004F5970
/* AppFrameworkInfo.plist in Resources */
,
2D5378261FAA1A9400D5DBA9
/* flutter_assets in Resources */
,
97C146FE1CF9000F007C117D
/* Assets.xcassets in Resources */
,
97C146FE1CF9000F007C117D
/* Assets.xcassets in Resources */
,
97C146FC1CF9000F007C117D
/* Main.storyboard in Resources */
,
97C146FC1CF9000F007C117D
/* Main.storyboard in Resources */
,
);
);
...
@@ -218,7 +222,7 @@
...
@@ -218,7 +222,7 @@
);
);
inputPaths
=
(
inputPaths
=
(
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh"
,
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh"
,
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework"
,
"${PODS_ROOT}/../.symlinks/flutter/ios
-release
/Flutter.framework"
,
"${BUILT_PRODUCTS_DIR}/permission_handler/permission_handler.framework"
,
"${BUILT_PRODUCTS_DIR}/permission_handler/permission_handler.framework"
,
);
);
name
=
"[CP] Embed Pods Frameworks"
;
name
=
"[CP] Embed Pods Frameworks"
;
...
...
example/lib/main.dart
View file @
b3d010c7
...
@@ -110,10 +110,11 @@ class _PermissionState extends State<PermissionWidget> {
...
@@ -110,10 +110,11 @@ class _PermissionState extends State<PermissionWidget> {
}
}
void
checkServiceStatus
(
BuildContext
context
,
PermissionGroup
permission
)
{
void
checkServiceStatus
(
BuildContext
context
,
PermissionGroup
permission
)
{
PermissionHandler
().
checkServiceStatus
(
permission
)
PermissionHandler
()
.
checkServiceStatus
(
permission
)
.
then
((
ServiceStatus
serviceStatus
)
{
.
then
((
ServiceStatus
serviceStatus
)
{
final
SnackBar
snackBar
=
SnackBar
(
final
SnackBar
snackBar
=
content:
Text
(
serviceStatus
.
toString
()));
SnackBar
(
content:
Text
(
serviceStatus
.
toString
()));
Scaffold
.
of
(
context
).
showSnackBar
(
snackBar
);
Scaffold
.
of
(
context
).
showSnackBar
(
snackBar
);
});
});
...
...
lib/permission_handler.dart
View file @
b3d010c7
...
@@ -43,8 +43,7 @@ class PermissionHandler {
...
@@ -43,8 +43,7 @@ class PermissionHandler {
/// Check current service status.
/// Check current service status.
///
///
/// Returns a [Future] containing the current service status for the supplied [PermissionGroup].
/// Returns a [Future] containing the current service status for the supplied [PermissionGroup].
Future
<
ServiceStatus
>
checkServiceStatus
(
Future
<
ServiceStatus
>
checkServiceStatus
(
PermissionGroup
permission
)
async
{
PermissionGroup
permission
)
async
{
final
String
status
=
await
_methodChannel
.
invokeMethod
(
final
String
status
=
await
_methodChannel
.
invokeMethod
(
'checkServiceStatus'
,
Codec
.
encodePermissionGroup
(
permission
));
'checkServiceStatus'
,
Codec
.
encodePermissionGroup
(
permission
));
...
@@ -55,8 +54,7 @@ class PermissionHandler {
...
@@ -55,8 +54,7 @@ class PermissionHandler {
///
///
/// Returns [true] if the app settings page could be opened, otherwise [false] is returned.
/// Returns [true] if the app settings page could be opened, otherwise [false] is returned.
Future
<
bool
>
openAppSettings
()
async
{
Future
<
bool
>
openAppSettings
()
async
{
final
bool
hasOpened
=
await
_methodChannel
.
invokeMethod
(
final
bool
hasOpened
=
await
_methodChannel
.
invokeMethod
(
'openAppSettings'
);
'openAppSettings'
);
return
hasOpened
;
return
hasOpened
;
}
}
...
@@ -68,8 +66,7 @@ class PermissionHandler {
...
@@ -68,8 +66,7 @@ class PermissionHandler {
List
<
PermissionGroup
>
permissions
)
async
{
List
<
PermissionGroup
>
permissions
)
async
{
final
String
jsonData
=
Codec
.
encodePermissionGroups
(
permissions
);
final
String
jsonData
=
Codec
.
encodePermissionGroups
(
permissions
);
final
String
status
=
final
String
status
=
await
_methodChannel
.
invokeMethod
(
await
_methodChannel
.
invokeMethod
(
'requestPermissions'
,
jsonData
);
'requestPermissions'
,
jsonData
);
return
Codec
.
decodePermissionRequestResult
(
status
);
return
Codec
.
decodePermissionRequestResult
(
status
);
}
}
...
...
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