Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
77eec598
Commit
77eec598
authored
Feb 21, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check SDK version at runtime
parent
5416f1c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
32 deletions
+33
-32
APPLocalNotification.m
src/ios/APPLocalNotification.m
+10
-11
UIApplication+APPLocalNotification.m
src/ios/UIApplication+APPLocalNotification.m
+23
-21
No files found.
src/ios/APPLocalNotification.m
View file @
77eec598
...
...
@@ -27,8 +27,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@interface
APPLocalNotification
()
// Retrieves the application state
...
...
@@ -411,16 +409,17 @@
*/
-
(
void
)
registerPermission
:
(
CDVInvokedUrlCommand
*
)
command
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
_command
=
command
;
if
([[
UIApplication
sharedApplication
]
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
{
_command
=
command
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
}];
#else
[
self
hasPermission
:
command
];
#endif
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
}];
}
else
{
[
self
hasPermission
:
command
];
}
}
#pragma mark -
...
...
src/ios/UIApplication+APPLocalNotification.m
View file @
77eec598
...
...
@@ -24,8 +24,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@implementation
UIApplication
(
APPLocalNotification
)
#pragma mark -
...
...
@@ -36,19 +34,21 @@
*/
-
(
BOOL
)
hasPermissionToScheduleLocalNotifications
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType
types
;
UIUserNotificationSettings
*
settings
;
if
([[
UIApplication
sharedApplication
]
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
{
UIUserNotificationType
types
;
UIUserNotificationSettings
*
settings
;
settings
=
[[
UIApplication
sharedApplication
]
currentUserNotificationSettings
];
settings
=
[[
UIApplication
sharedApplication
]
currentUserNotificationSettings
];
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
return
(
settings
.
types
&
types
);
#else
return
YES
;
#endif
return
(
settings
.
types
&
types
);
}
else
{
return
YES
;
}
}
/**
...
...
@@ -56,18 +56,20 @@
*/
-
(
void
)
registerPermissionToScheduleLocalNotifications
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType
types
;
UIUserNotificationSettings
*
settings
;
if
([[
UIApplication
sharedApplication
]
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
{
UIUserNotificationType
types
;
UIUserNotificationSettings
*
settings
;
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
settings
=
[
UIUserNotificationSettings
settingsForTypes
:
types
categories
:
nil
];
settings
=
[
UIUserNotificationSettings
settingsForTypes
:
types
categories
:
nil
];
[[
UIApplication
sharedApplication
]
registerUserNotificationSettings
:
settings
];
#endif
[[
UIApplication
sharedApplication
]
registerUserNotificationSettings
:
settings
];
}
}
#pragma mark -
...
...
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