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
0f630d5f
Commit
0f630d5f
authored
Oct 30, 2019
by
Tonghdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[iOS] update requestPermission
parent
28bb7af0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
23 deletions
+31
-23
example/ios/Runner/Runner.entitlements
+8
-0
ios/Classes/strategies/NotificationPermissionStrategy.m
+23
-23
No files found.
example/ios/Runner/Runner.entitlements
0 → 100644
View file @
0f630d5f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
com.apple.security.application-groups
</key>
<array/>
</dict>
</plist>
ios/Classes/strategies/NotificationPermissionStrategy.m
View file @
0f630d5f
...
@@ -23,30 +23,30 @@
...
@@ -23,30 +23,30 @@
completionHandler
(
status
);
completionHandler
(
status
);
return
;
return
;
}
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
if
(
@available
(
iOS
10
.
0
,
*
))
{
if
(
@available
(
iOS
10
.
0
,
*
))
{
UNUserNotificationCenter
*
center
=
[
UNUserNotificationCenter
currentNotificationCenter
];
UNUserNotificationCenter
*
center
=
[
UNUserNotificationCenter
currentNotificationCenter
];
UNAuthorizationOptions
authorizationOptions
=
0
;
UNAuthorizationOptions
authorizationOptions
=
0
;
authorizationOptions
+=
UNAuthorizationOptionSound
;
authorizationOptions
+=
UNAuthorizationOptionSound
;
authorizationOptions
+=
UNAuthorizationOptionAlert
;
authorizationOptions
+=
UNAuthorizationOptionAlert
;
authorizationOptions
+=
UNAuthorizationOptionBadge
;
authorizationOptions
+=
UNAuthorizationOptionBadge
;
[
center
requestAuthorizationWithOptions
:(
authorizationOptions
)
completionHandler
:
^
(
BOOL
granted
,
NSError
*
_Nullable
error
)
{
[
center
requestAuthorizationWithOptions
:(
authorizationOptions
)
completionHandler
:
^
(
BOOL
granted
,
NSError
*
_Nullable
error
)
{
if
(
!
granted
||
error
!=
nil
)
{
if
(
!
granted
||
error
!=
nil
)
{
completionHandler
(
PermissionStatusDenied
);
completionHandler
(
PermissionStatusDenied
)
;
return
;
return
;
}
}
}
];
completionHandler
(
PermissionStatusGranted
);
}
else
{
}]
;
UIUserNotificationType
notificationTypes
=
0
;
}
else
{
notificationTypes
|=
UIUserNotificationTypeSound
;
UIUserNotificationType
notificationTypes
=
0
;
notificationTypes
|=
UIUserNotificationTypeAlert
;
notificationTypes
|=
UIUserNotificationTypeSound
;
notificationTypes
|=
UIUserNotificationTypeBadge
;
notificationTypes
|=
UIUserNotificationTypeAlert
;
UIUserNotificationSettings
*
settings
=
[
UIUserNotificationSettings
settingsForTypes
:
notificationTypes
categories
:
nil
]
;
notificationTypes
|=
UIUserNotificationTypeBadge
;
[[
UIApplication
sharedApplication
]
registerUserNotificationSettings
:
settings
]
;
UIUserNotificationSettings
*
settings
=
[
UIUserNotificationSettings
settingsForTypes
:
notificationTypes
categories
:
nil
];
}
[[
UIApplication
sharedApplication
]
register
UserNotificationSettings
:
setting
s
];
[[
UIApplication
sharedApplication
]
register
ForRemoteNotification
s
];
completionHandler
(
PermissionStatusGranted
);
completionHandler
(
PermissionStatusGranted
);
}
}
);
}
}
+
(
PermissionStatus
)
permissionStatus
{
+
(
PermissionStatus
)
permissionStatus
{
...
...
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