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
30de83bc
Commit
30de83bc
authored
Nov 25, 2020
by
Mathias Cochet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Permission status added.
parent
e38836b2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
2 deletions
+22
-2
permission_handler/example/lib/plugin_example/permission_widget.dart
+2
-0
permission_handler/ios/Classes/strategies/PhotoPermissionStrategy.m
+12
-1
permission_handler/lib/permission_handler.dart
+4
-0
permission_handler/pubspec.yaml
+4
-1
No files found.
permission_handler/example/lib/plugin_example/permission_widget.dart
View file @
30de83bc
...
@@ -37,6 +37,8 @@ class _PermissionState extends State<PermissionWidget> {
...
@@ -37,6 +37,8 @@ class _PermissionState extends State<PermissionWidget> {
return
Colors
.
red
;
return
Colors
.
red
;
case
PermissionStatus
.
granted
:
case
PermissionStatus
.
granted
:
return
Colors
.
green
;
return
Colors
.
green
;
case
PermissionStatus
.
limited
:
return
Colors
.
orange
;
default
:
default
:
return
Colors
.
grey
;
return
Colors
.
grey
;
}
}
...
...
permission_handler/ios/Classes/strategies/PhotoPermissionStrategy.m
View file @
30de83bc
...
@@ -24,13 +24,24 @@
...
@@ -24,13 +24,24 @@
return
;
return
;
}
}
if
(
@available
(
iOS
14
,
*
))
{
[
PHPhotoLibrary
requestAuthorizationForAccessLevel
:
PHAccessLevelReadWrite
handler
:
^
(
PHAuthorizationStatus
authorizationStatus
)
{
completionHandler
([
PhotoPermissionStrategy
determinePermissionStatus
:
authorizationStatus
]);
}];
}
else
{
[
PHPhotoLibrary
requestAuthorization
:
^
(
PHAuthorizationStatus
authorizationStatus
)
{
[
PHPhotoLibrary
requestAuthorization
:
^
(
PHAuthorizationStatus
authorizationStatus
)
{
completionHandler
([
PhotoPermissionStrategy
determinePermissionStatus
:
authorizationStatus
]);
completionHandler
([
PhotoPermissionStrategy
determinePermissionStatus
:
authorizationStatus
]);
}];
}];
}
}
}
+
(
PermissionStatus
)
permissionStatus
{
+
(
PermissionStatus
)
permissionStatus
{
PHAuthorizationStatus
status
=
[
PHPhotoLibrary
authorizationStatus
];
PHAuthorizationStatus
status
;
if
(
@available
(
iOS
14
,
*
)){
status
=
[
PHPhotoLibrary
authorizationStatusForAccessLevel
:
PHAccessLevelReadWrite
];
}
else
{
status
=
[
PHPhotoLibrary
authorizationStatus
];
}
return
[
PhotoPermissionStrategy
determinePermissionStatus
:
status
];
return
[
PhotoPermissionStrategy
determinePermissionStatus
:
status
];
}
}
...
...
permission_handler/lib/permission_handler.dart
View file @
30de83bc
...
@@ -67,6 +67,10 @@ extension PermissionCheckShortcuts on Permission {
...
@@ -67,6 +67,10 @@ extension PermissionCheckShortcuts on Permission {
/// *Only supported on iOS.*
/// *Only supported on iOS.*
Future
<
bool
>
get
isRestricted
=>
status
.
isRestricted
;
Future
<
bool
>
get
isRestricted
=>
status
.
isRestricted
;
///User has authorized this application for limited photo library access.
/// *Only supported on iOS.(iOS14+)*
Future
<
bool
>
get
isLimited
=>
status
.
isLimited
;
/// If the user denied this permission and selected to never again show a
/// If the user denied this permission and selected to never again show a
/// request for it. The user may still change the permission's status in the
/// request for it. The user may still change the permission's status in the
/// device settings.
/// device settings.
...
...
permission_handler/pubspec.yaml
View file @
30de83bc
...
@@ -16,7 +16,10 @@ dependencies:
...
@@ -16,7 +16,10 @@ dependencies:
flutter
:
flutter
:
sdk
:
flutter
sdk
:
flutter
meta
:
^1.1.6
meta
:
^1.1.6
permission_handler_platform_interface
:
^2.0.1
permission_handler_platform_interface
:
git
:
url
:
https://github.com/MathiasCochet/flutter-permission-handler.git
path
:
permission_handler_platform_interface
dev_dependencies
:
dev_dependencies
:
effective_dart
:
^1.2.1
effective_dart
:
^1.2.1
...
...
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