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
7307fe0c
Commit
7307fe0c
authored
May 21, 2021
by
JDDV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added AppTrackingTransparency permission
parent
ebe31370
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
140 additions
and
53 deletions
+140
-53
permission_handler/CHANGELOG.md
+4
-0
permission_handler/example/ios/Runner/Info.plist
+30
-49
permission_handler/example/lib/main.dart
+2
-1
permission_handler/ios/Classes/PermissionHandlerEnums.h
+10
-1
permission_handler/ios/Classes/PermissionManager.h
+1
-0
permission_handler/ios/Classes/PermissionManager.m
+2
-0
permission_handler/ios/Classes/strategies/AppTrackingTransparencyPermissionStrategy.h
+25
-0
permission_handler/ios/Classes/strategies/AppTrackingTransparencyPermissionStrategy.m
+64
-0
permission_handler/pubspec.yaml
+2
-2
No files found.
permission_handler/CHANGELOG.md
View file @
7307fe0c
## 7.3.0
*
Added support for the "AppTrackingTransparency" permission on iOS.
## 7.2.0
## 7.2.0
*
Added support for the "REQUEST_INSTALL_PACKAGES" permission on Android.
*
Added support for the "REQUEST_INSTALL_PACKAGES" permission on Android.
...
...
permission_handler/example/ios/Runner/Info.plist
View file @
7307fe0c
...
@@ -41,54 +41,35 @@
...
@@ -41,54 +41,35 @@
<
/
a
rr
a
y
>
<
/
a
rr
a
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
k
e
y
>
UIViewControllerBasedStatusBarAppearance
<
/k
e
y
>
<
fa
ls
e
/
>
<
fa
ls
e
/
>
<
k
e
y
>
NSLocationWhenInUseUsageDescription
<
/k
e
y
>
<
!--
P
e
rmission
options
f
or
th
e
`lo
ca
tion`
group
--
>
<
string
>
Need
location
when
in
use
<
/string
>
<
k
e
y
>
NSLocationWhenInUseUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSLocationAlwaysAndWhenInUseUsageDescription
<
/k
e
y
>
<
string
>
Need
location
when
in
use
<
/string
>
<
string
>
Always
and
when
in
use
!
<
/string
>
<
k
e
y
>
NSLocationAlwaysAndWhenInUseUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSLocationUsageDescription
<
/k
e
y
>
<
string
>
Always
and
when
in
use
!
<
/string
>
<
string
>
Older
devices
need
location.
<
/string
>
<
k
e
y
>
NSLocationUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSLocationAlwaysUsageDescription
<
/k
e
y
>
<
string
>
Older
devices
need
location.
<
/string
>
<
string
>
Can
I
have
location
always
?
<
/string
>
<
k
e
y
>
NSLocationAlwaysUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSAppleMusicUsageDescription
<
/k
e
y
>
<
string
>
Can
I
have
location
always
?
<
/string
>
<
string
>
Music
!
<
/string
>
<
k
e
y
>
kTCCServiceMediaLibrary
<
/k
e
y
>
<
!--
P
e
rmission
options
f
or
th
e
`m
ed
i
a
Li
b
r
a
ry`
group
--
>
<
string
>
media
<
/string
>
<
k
e
y
>
NSAppleMusicUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSCalendarsUsageDescription
<
/k
e
y
>
<
string
>
Music
!
<
/string
>
<
string
>
Calendars
<
/string
>
<
k
e
y
>
kTCCServiceMediaLibrary
<
/k
e
y
>
<
k
e
y
>
NSCameraUsageDescription
<
/k
e
y
>
<
string
>
media
<
/string
>
<
string
>
camera
<
/string
>
<
k
e
y
>
NSContactsUsageDescription
<
/k
e
y
>
<
!--
P
e
rmission
options
f
or
th
e
`
ca
l
e
n
da
r`
group
--
>
<
string
>
contacts
<
/string
>
<
k
e
y
>
NSCalendarsUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSMicrophoneUsageDescription
<
/k
e
y
>
<
string
>
Calendars
<
/string
>
<
string
>
microphone
<
/string
>
<
k
e
y
>
NSSpeechRecognitionUsageDescription
<
/k
e
y
>
<
!--
P
e
rmission
options
f
or
th
e
`
ca
m
e
r
a
`
group
--
>
<
string
>
speech
<
/string
>
<
k
e
y
>
NSCameraUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSMotionUsageDescription
<
/k
e
y
>
<
string
>
camera
<
/string
>
<
string
>
motion
<
/string
>
<
k
e
y
>
NSPhotoLibraryUsageDescription
<
/k
e
y
>
<
!--
P
e
rmission
options
f
or
th
e
`
c
ont
ac
ts`
group
--
>
<
string
>
photos
<
/string
>
<
k
e
y
>
NSContactsUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSRemindersUsageDescription
<
/k
e
y
>
<
string
>
contacts
<
/string
>
<
string
>
reminders
<
/string
>
<
k
e
y
>
NSUserTrackingUsageDescription
<
/k
e
y
>
<
!--
P
e
rmission
options
f
or
th
e
`mi
c
rophon
e
`
group
--
>
<
string
>
appTrackingTransparency
<
/string
>
<
k
e
y
>
NSMicrophoneUsageDescription
<
/k
e
y
>
<
string
>
microphone
<
/string
>
<
!--
P
e
rmission
options
f
or
th
e
`sp
eec
h`
group
--
>
<
k
e
y
>
NSSpeechRecognitionUsageDescription
<
/k
e
y
>
<
string
>
speech
<
/string
>
<
!--
P
e
rmission
options
f
or
th
e
`s
e
nsors`
group
--
>
<
k
e
y
>
NSMotionUsageDescription
<
/k
e
y
>
<
string
>
motion
<
/string
>
<
!--
P
e
rmission
options
f
or
th
e
`photos`
group
--
>
<
k
e
y
>
NSPhotoLibraryUsageDescription
<
/k
e
y
>
<
string
>
photos
<
/string
>
<
!--
P
e
rmission
options
f
or
th
e
`r
e
min
de
r`
group
--
>
<
k
e
y
>
NSRemindersUsageDescription
<
/k
e
y
>
<
string
>
reminders
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
<
/plist
>
permission_handler/example/lib/main.dart
View file @
7307fe0c
...
@@ -50,7 +50,8 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
...
@@ -50,7 +50,8 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
permission
!=
Permission
.
mediaLibrary
&&
permission
!=
Permission
.
mediaLibrary
&&
permission
!=
Permission
.
photos
&&
permission
!=
Permission
.
photos
&&
permission
!=
Permission
.
photosAddOnly
&&
permission
!=
Permission
.
photosAddOnly
&&
permission
!=
Permission
.
reminders
;
permission
!=
Permission
.
reminders
&&
permission
!=
Permission
.
appTrackingTransparency
;
}
}
})
})
.
map
((
permission
)
=>
PermissionWidget
(
permission
))
.
map
((
permission
)
=>
PermissionWidget
(
permission
))
...
...
permission_handler/ios/Classes/PermissionHandlerEnums.h
View file @
7307fe0c
...
@@ -95,6 +95,13 @@
...
@@ -95,6 +95,13 @@
#define PERMISSION_BLUETOOTH 1
#define PERMISSION_BLUETOOTH 1
#endif
#endif
// ios: PermissionGroupAppTrackingTransparency
// Info.plist: [NSUserTrackingUsageDescription]
// dart: PermissionGroup.appTrackingTransparency
#ifndef PERMISSION_APP_TRACKING_TRANSPARENCY
#define PERMISSION_APP_TRACKING_TRANSPARENCY 1
#endif
typedef
NS_ENUM
(
int
,
PermissionGroup
)
{
typedef
NS_ENUM
(
int
,
PermissionGroup
)
{
PermissionGroupCalendar
=
0
,
PermissionGroupCalendar
=
0
,
PermissionGroupCamera
,
PermissionGroupCamera
,
...
@@ -119,7 +126,9 @@ typedef NS_ENUM(int, PermissionGroup) {
...
@@ -119,7 +126,9 @@ typedef NS_ENUM(int, PermissionGroup) {
PermissionGroupUnknown
,
PermissionGroupUnknown
,
PermissionGroupBluetooth
,
PermissionGroupBluetooth
,
PermissionGroupManageExternalStorage
,
PermissionGroupManageExternalStorage
,
PermissionGroupSystemAlertWindow
PermissionGroupSystemAlertWindow
,
PermissionGroupRequestInstallPackages
,
PermissionGroupAppTrackingTransparency
};
};
typedef
NS_ENUM
(
int
,
PermissionStatus
)
{
typedef
NS_ENUM
(
int
,
PermissionStatus
)
{
...
...
permission_handler/ios/Classes/PermissionManager.h
View file @
7307fe0c
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "AudioVideoPermissionStrategy.h"
#import "AudioVideoPermissionStrategy.h"
#import "AppTrackingTransparencyPermissionStrategy.h"
#import "BluetoothPermissionStrategy.h"
#import "BluetoothPermissionStrategy.h"
#import "ContactPermissionStrategy.h"
#import "ContactPermissionStrategy.h"
#import "EventPermissionStrategy.h"
#import "EventPermissionStrategy.h"
...
...
permission_handler/ios/Classes/PermissionManager.m
View file @
7307fe0c
...
@@ -125,6 +125,8 @@
...
@@ -125,6 +125,8 @@
return
[
StoragePermissionStrategy
new
];
return
[
StoragePermissionStrategy
new
];
case
PermissionGroupBluetooth
:
case
PermissionGroupBluetooth
:
return
[
BluetoothPermissionStrategy
new
];
return
[
BluetoothPermissionStrategy
new
];
case
PermissionGroupAppTrackingTransparency
:
return
[
AppTrackingTransparencyPermissionStrategy
new
];
default
:
default
:
return
[
UnknownPermissionStrategy
new
];
return
[
UnknownPermissionStrategy
new
];
}
}
...
...
permission_handler/ios/Classes/strategies/AppTrackingTransparencyPermissionStrategy.h
0 → 100644
View file @
7307fe0c
//
// AppTrackingTransparency.h
// permission_handler
//
// Created by Jan-Derk on 21/05/2021.
//
#import <Foundation/Foundation.h>
#import "PermissionStrategy.h"
#if PERMISSION_APP_TRACKING_TRANSPARENCY
#import <AppTrackingTransparency/AppTrackingTransparency.h>
@interface
AppTrackingTransparencyPermissionStrategy
:
NSObject
<
PermissionStrategy
>
@end
#else
#import "UnknownPermissionStrategy.h"
@interface
AppTrackingTransparencyPermissionStrategy
:
UnknownPermissionStrategy
@end
#endif
permission_handler/ios/Classes/strategies/AppTrackingTransparencyPermissionStrategy.m
0 → 100644
View file @
7307fe0c
//
// AppTrackingTransparency.m
// permission_handler
//
// Created by Jan-Derk on 21/05/2021.
//
#import "AppTrackingTransparencyPermissionStrategy.h"
#if PERMISSION_APP_TRACKING_TRANSPARENCY
@implementation
AppTrackingTransparencyPermissionStrategy
-
(
PermissionStatus
)
checkPermissionStatus
:(
PermissionGroup
)
permission
{
if
(
@available
(
iOS
14
,
*
))
{
ATTrackingManagerAuthorizationStatus
attPermission
=
[
ATTrackingManager
trackingAuthorizationStatus
];
return
[
AppTrackingTransparencyPermissionStrategy
parsePermission
:
attPermission
];
}
return
PermissionStatusGranted
;
}
-
(
ServiceStatus
)
checkServiceStatus
:(
PermissionGroup
)
permission
{
return
ServiceStatusNotApplicable
;
}
-
(
void
)
requestPermission
:(
PermissionGroup
)
permission
completionHandler
:(
PermissionStatusHandler
)
completionHandler
{
PermissionStatus
status
=
[
self
checkPermissionStatus
:
permission
];
if
(
status
!=
PermissionStatusDenied
)
{
completionHandler
(
status
);
return
;
}
if
(
@available
(
iOS
14
,
*
)){
[
ATTrackingManager
requestTrackingAuthorizationWithCompletionHandler
:
^
(
ATTrackingManagerAuthorizationStatus
status
)
{
PermissionStatus
permissionStatus
=
[
AppTrackingTransparencyPermissionStrategy
parsePermission
:
status
];
completionHandler
(
permissionStatus
);
}];
}
else
{
completionHandler
(
PermissionStatusGranted
);
}
}
+
(
PermissionStatus
)
parsePermission
:(
ATTrackingManagerAuthorizationStatus
)
attPermission
API_AVAILABLE
(
ios
(
14
)){
switch
(
attPermission
){
case
ATTrackingManagerAuthorizationStatusAuthorized
:
return
PermissionStatusGranted
;
case
ATTrackingManagerAuthorizationStatusRestricted
:
return
PermissionStatusRestricted
;
case
ATTrackingManagerAuthorizationStatusDenied
:
return
PermissionStatusPermanentlyDenied
;
case
ATTrackingManagerAuthorizationStatusNotDetermined
:
return
PermissionStatusDenied
;
}
}
@end
#else
@implementation
AppTrackingTransparencyPermissionStrategy
@end
#endif
permission_handler/pubspec.yaml
View file @
7307fe0c
name
:
permission_handler
name
:
permission_handler
description
:
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
description
:
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
version
:
7.
2
.0
version
:
7.
3
.0
homepage
:
https://github.com/baseflowit/flutter-permission-handler
homepage
:
https://github.com/baseflowit/flutter-permission-handler
flutter
:
flutter
:
...
@@ -16,7 +16,7 @@ dependencies:
...
@@ -16,7 +16,7 @@ dependencies:
flutter
:
flutter
:
sdk
:
flutter
sdk
:
flutter
meta
:
^1.3.0
meta
:
^1.3.0
permission_handler_platform_interface
:
^3.
4
.0
permission_handler_platform_interface
:
^3.
5
.0
dev_dependencies
:
dev_dependencies
:
flutter_test
:
flutter_test
:
...
...
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