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 @@
...
@@ -27,8 +27,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@interface
APPLocalNotification
()
@interface
APPLocalNotification
()
// Retrieves the application state
// Retrieves the application state
...
@@ -411,16 +409,17 @@
...
@@ -411,16 +409,17 @@
*/
*/
-
(
void
)
registerPermission
:
(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
registerPermission
:
(
CDVInvokedUrlCommand
*
)
command
{
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if
([[
UIApplication
sharedApplication
]
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
_command
=
command
;
{
_command
=
command
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
}];
}];
#else
}
else
{
[
self
hasPermission
:
command
];
[
self
hasPermission
:
command
];
#endif
}
}
}
#pragma mark -
#pragma mark -
...
...
src/ios/UIApplication+APPLocalNotification.m
View file @
77eec598
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@implementation
UIApplication
(
APPLocalNotification
)
@implementation
UIApplication
(
APPLocalNotification
)
#pragma mark -
#pragma mark -
...
@@ -36,19 +34,21 @@
...
@@ -36,19 +34,21 @@
*/
*/
-
(
BOOL
)
hasPermissionToScheduleLocalNotifications
-
(
BOOL
)
hasPermissionToScheduleLocalNotifications
{
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if
([[
UIApplication
sharedApplication
]
UIUserNotificationType
types
;
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
UIUserNotificationSettings
*
settings
;
{
UIUserNotificationType
types
;
UIUserNotificationSettings
*
settings
;
settings
=
[[
UIApplication
sharedApplication
]
settings
=
[[
UIApplication
sharedApplication
]
currentUserNotificationSettings
];
currentUserNotificationSettings
];
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
return
(
settings
.
types
&
types
);
return
(
settings
.
types
&
types
);
#else
}
else
{
return
YES
;
return
YES
;
#endif
}
}
}
/**
/**
...
@@ -56,18 +56,20 @@
...
@@ -56,18 +56,20 @@
*/
*/
-
(
void
)
registerPermissionToScheduleLocalNotifications
-
(
void
)
registerPermissionToScheduleLocalNotifications
{
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if
([[
UIApplication
sharedApplication
]
UIUserNotificationType
types
;
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
UIUserNotificationSettings
*
settings
;
{
UIUserNotificationType
types
;
UIUserNotificationSettings
*
settings
;
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
types
=
UIUserNotificationTypeAlert
|
UIUserNotificationTypeBadge
|
UIUserNotificationTypeSound
;
settings
=
[
UIUserNotificationSettings
settingsForTypes
:
types
settings
=
[
UIUserNotificationSettings
settingsForTypes
:
types
categories
:
nil
];
categories
:
nil
];
[[
UIApplication
sharedApplication
]
[[
UIApplication
sharedApplication
]
registerUserNotificationSettings
:
settings
];
registerUserNotificationSettings
:
settings
];
#endif
}
}
}
#pragma mark -
#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