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
603e6b30
Commit
603e6b30
authored
Mar 01, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update project
parent
fa410a84
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
99 deletions
+85
-99
workspace.xml
.idea/workspace.xml
+5
-5
UserInterfaceState.xcuserstate
...data/sebastian.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Breakpoints_v2.xcbkptlist
...ebastian.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+5
-0
APPLocalNotification.m
....cordova.plugin.local-notification/APPLocalNotification.m
+75
-75
UIApplication+APPLocalNotification.m
...n.local-notification/UIApplication+APPLocalNotification.m
+0
-19
No files found.
.idea/workspace.xml
View file @
603e6b30
...
@@ -108,7 +108,6 @@
...
@@ -108,7 +108,6 @@
<sortByType
/>
<sortByType
/>
</navigator>
</navigator>
<panes>
<panes>
<pane
id=
"PackagesPane"
/>
<pane
id=
"AndroidView"
>
<pane
id=
"AndroidView"
>
<subPane>
<subPane>
<PATH>
<PATH>
...
@@ -151,6 +150,7 @@
...
@@ -151,6 +150,7 @@
</PATH>
</PATH>
</subPane>
</subPane>
</pane>
</pane>
<pane
id=
"PackagesPane"
/>
<pane
id=
"Scope"
/>
<pane
id=
"Scope"
/>
<pane
id=
"ProjectPane"
>
<pane
id=
"ProjectPane"
>
<subPane>
<subPane>
...
@@ -323,7 +323,7 @@
...
@@ -323,7 +323,7 @@
</option>
</option>
</component>
</component>
<component
name=
"ToolWindowManager"
>
<component
name=
"ToolWindowManager"
>
<frame
x=
"0"
y=
"23"
width=
"1440"
height=
"809"
extended-state=
"
0
"
/>
<frame
x=
"0"
y=
"23"
width=
"1440"
height=
"809"
extended-state=
"
6
"
/>
<editor
active=
"false"
/>
<editor
active=
"false"
/>
<layout>
<layout>
<window_info
id=
"Palette	"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Palette	"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
...
@@ -335,13 +335,12 @@
...
@@ -335,13 +335,12 @@
<window_info
id=
"Version Control"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Version Control"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Build Variants"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Build Variants"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"2"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Gradle Console"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32900432"
sideWeight=
"0.5"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Gradle Console"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32900432"
sideWeight=
"0.5"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Messages"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"8"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Android"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Android"
active=
"true"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"TODO"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"TODO"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"6"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Structure"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.2532189"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Structure"
active=
"false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.2532189"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Commander"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"SLIDING"
type=
"SLIDING"
visible=
"false"
weight=
"0.4"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Commander"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"SLIDING"
type=
"SLIDING"
visible=
"false"
weight=
"0.4"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Application Servers"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Application Servers"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"7"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Project"
active=
"
false"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
weight=
"0.22460657
"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Project"
active=
"
true"
anchor=
"left"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"true"
weight=
"0.2274678
"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"combo"
/>
<window_info
id=
"Run"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Run"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"2"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Memory Monitor"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.3997114"
sideWeight=
"0.53648067"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Memory Monitor"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.3997114"
sideWeight=
"0.53648067"
order=
"7"
side_tool=
"true"
content_ui=
"tabs"
/>
<window_info
id=
"Ant Build"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.25"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Ant Build"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.25"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
...
@@ -350,6 +349,7 @@
...
@@ -350,6 +349,7 @@
<window_info
id=
"Message"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Message"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"0"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Palette"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Palette"
active=
"false"
anchor=
"right"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.33"
sideWeight=
"0.5"
order=
"3"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Find"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Find"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"1"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Messages"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.32756132"
sideWeight=
"0.5"
order=
"8"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Inspection"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.4"
sideWeight=
"0.5"
order=
"5"
side_tool=
"false"
content_ui=
"tabs"
/>
<window_info
id=
"Inspection"
active=
"false"
anchor=
"bottom"
auto_hide=
"false"
internal_type=
"DOCKED"
type=
"DOCKED"
visible=
"false"
weight=
"0.4"
sideWeight=
"0.5"
order=
"5"
side_tool=
"false"
content_ui=
"tabs"
/>
</layout>
</layout>
</component>
</component>
...
...
platforms/ios/NotificationExample.xcodeproj/project.xcworkspace/xcuserdata/sebastian.xcuserdatad/UserInterfaceState.xcuserstate
View file @
603e6b30
No preview for this file type
platforms/ios/NotificationExample.xcodeproj/xcuserdata/sebastian.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
0 → 100644
View file @
603e6b30
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type =
"1"
version =
"2.0"
>
</Bucket>
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotification.m
View file @
603e6b30
...
@@ -53,11 +53,11 @@
...
@@ -53,11 +53,11 @@
-
(
void
)
deviceready
:(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
deviceready
:(
CDVInvokedUrlCommand
*
)
command
{
{
deviceready
=
YES
;
deviceready
=
YES
;
for
(
NSString
*
js
in
eventQueue
)
{
for
(
NSString
*
js
in
eventQueue
)
{
[
self
.
commandDelegate
evalJs
:
js
];
[
self
.
commandDelegate
evalJs
:
js
];
}
}
[
eventQueue
removeAllObjects
];
[
eventQueue
removeAllObjects
];
}
}
...
@@ -70,22 +70,22 @@
...
@@ -70,22 +70,22 @@
-
(
void
)
schedule
:(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
schedule
:(
CDVInvokedUrlCommand
*
)
command
{
{
NSArray
*
notifications
=
command
.
arguments
;
NSArray
*
notifications
=
command
.
arguments
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSDictionary
*
options
in
notifications
)
{
for
(
NSDictionary
*
options
in
notifications
)
{
UILocalNotification
*
notification
;
UILocalNotification
*
notification
;
notification
=
[[
UILocalNotification
alloc
]
notification
=
[[
UILocalNotification
alloc
]
initWithOptions
:
options
];
initWithOptions
:
options
];
[
self
scheduleLocalNotification
:[
notification
copy
]];
[
self
scheduleLocalNotification
:[
notification
copy
]];
[
self
fireEvent
:
@"schedule"
notification
:
notification
];
[
self
fireEvent
:
@"schedule"
notification
:
notification
];
if
(
notifications
.
count
>
1
)
{
if
(
notifications
.
count
>
1
)
{
[
NSThread
sleepForTimeInterval
:
0
.
01
];
[
NSThread
sleepForTimeInterval
:
0
.
01
];
}
}
}
}
[
self
execCallback
:
command
];
[
self
execCallback
:
command
];
}];
}];
}
}
...
@@ -99,27 +99,27 @@
...
@@ -99,27 +99,27 @@
-
(
void
)
update
:(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
update
:(
CDVInvokedUrlCommand
*
)
command
{
{
NSArray
*
notifications
=
command
.
arguments
;
NSArray
*
notifications
=
command
.
arguments
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSDictionary
*
options
in
notifications
)
{
for
(
NSDictionary
*
options
in
notifications
)
{
NSString
*
id
=
[
options
objectForKey
:
@"id"
];
NSString
*
id
=
[
options
objectForKey
:
@"id"
];
UILocalNotification
*
notification
;
UILocalNotification
*
notification
;
notification
=
[
self
.
app
localNotificationWithId
:
id
];
notification
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
notification
)
if
(
!
notification
)
continue
;
continue
;
[
self
updateLocalNotification
:[
notification
copy
]
[
self
updateLocalNotification
:[
notification
copy
]
withOptions
:
options
];
withOptions
:
options
];
[
self
fireEvent
:
@"update"
notification
:
notification
];
[
self
fireEvent
:
@"update"
notification
:
notification
];
if
(
notifications
.
count
>
1
)
{
if
(
notifications
.
count
>
1
)
{
[
NSThread
sleepForTimeInterval
:
0
.
01
];
[
NSThread
sleepForTimeInterval
:
0
.
01
];
}
}
}
}
[
self
execCallback
:
command
];
[
self
execCallback
:
command
];
}];
}];
}
}
...
@@ -135,16 +135,16 @@
...
@@ -135,16 +135,16 @@
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSString
*
id
in
command
.
arguments
)
{
for
(
NSString
*
id
in
command
.
arguments
)
{
UILocalNotification
*
notification
;
UILocalNotification
*
notification
;
notification
=
[
self
.
app
localNotificationWithId
:
id
];
notification
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
notification
)
if
(
!
notification
)
continue
;
continue
;
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
}
}
[
self
execCallback
:
command
];
[
self
execCallback
:
command
];
}];
}];
}
}
...
@@ -172,16 +172,16 @@
...
@@ -172,16 +172,16 @@
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSString
*
id
in
command
.
arguments
)
{
for
(
NSString
*
id
in
command
.
arguments
)
{
UILocalNotification
*
notification
;
UILocalNotification
*
notification
;
notification
=
[
self
.
app
localNotificationWithId
:
id
];
notification
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
notification
)
if
(
!
notification
)
continue
;
continue
;
[
self
.
app
clearLocalNotification
:
notification
];
[
self
.
app
clearLocalNotification
:
notification
];
[
self
fireEvent
:
@"clear"
notification
:
notification
];
[
self
fireEvent
:
@"clear"
notification
:
notification
];
}
}
[
self
execCallback
:
command
];
[
self
execCallback
:
command
];
}];
}];
}
}
...
@@ -243,18 +243,18 @@
...
@@ -243,18 +243,18 @@
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
NSString
*
id
=
[
command
argumentAtIndex
:
0
];
NSString
*
id
=
[
command
argumentAtIndex
:
0
];
BOOL
exist
;
BOOL
exist
;
CDVPluginResult
*
result
;
CDVPluginResult
*
result
;
if
(
type
==
NotifcationTypeAll
)
{
if
(
type
==
NotifcationTypeAll
)
{
exist
=
[
self
.
app
localNotificationExist
:
id
];
exist
=
[
self
.
app
localNotificationExist
:
id
];
}
else
{
}
else
{
exist
=
[
self
.
app
localNotificationExist
:
id
type
:
type
];
exist
=
[
self
.
app
localNotificationExist
:
id
type
:
type
];
}
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsBool
:
exist
];
messageAsBool
:
exist
];
[
self
.
commandDelegate
sendPluginResult
:
result
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
callbackId
:
command
.
callbackId
];
}];
}];
...
@@ -293,21 +293,21 @@
...
@@ -293,21 +293,21 @@
* The IDs of the notifications
* The IDs of the notifications
*/
*/
-
(
void
)
getIds
:
(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
getIds
:
(
CDVInvokedUrlCommand
*
)
command
byType
:
(
APPLocalNotificationType
)
type
;
byType
:
(
APPLocalNotificationType
)
type
;
{
{
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
CDVPluginResult
*
result
;
CDVPluginResult
*
result
;
NSArray
*
ids
;
NSArray
*
ids
;
if
(
type
==
NotifcationTypeAll
)
{
if
(
type
==
NotifcationTypeAll
)
{
ids
=
[
self
.
app
localNotificationIds
];
ids
=
[
self
.
app
localNotificationIds
];
}
else
{
}
else
{
ids
=
[
self
.
app
localNotificationIdsByType
:
type
];
ids
=
[
self
.
app
localNotificationIdsByType
:
type
];
}
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsArray
:
ids
];
messageAsArray
:
ids
];
[
self
.
commandDelegate
sendPluginResult
:
result
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
callbackId
:
command
.
callbackId
];
}];
}];
...
@@ -361,7 +361,7 @@
...
@@ -361,7 +361,7 @@
NSArray
*
ids
=
command
.
arguments
;
NSArray
*
ids
=
command
.
arguments
;
NSArray
*
notifications
;
NSArray
*
notifications
;
CDVPluginResult
*
result
;
CDVPluginResult
*
result
;
if
(
type
==
NotifcationTypeAll
&&
ids
.
count
==
0
)
{
if
(
type
==
NotifcationTypeAll
&&
ids
.
count
==
0
)
{
notifications
=
[
self
.
app
localNotificationOptions
];
notifications
=
[
self
.
app
localNotificationOptions
];
}
}
...
@@ -375,10 +375,10 @@
...
@@ -375,10 +375,10 @@
notifications
=
[
self
.
app
localNotificationOptionsByType
:
type
notifications
=
[
self
.
app
localNotificationOptionsByType
:
type
andId
:
ids
];
andId
:
ids
];
}
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsArray
:
notifications
];
messageAsArray
:
notifications
];
[
self
.
commandDelegate
sendPluginResult
:
result
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
callbackId
:
command
.
callbackId
];
}];
}];
...
@@ -393,12 +393,12 @@
...
@@ -393,12 +393,12 @@
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
CDVPluginResult
*
result
;
CDVPluginResult
*
result
;
BOOL
hasPermission
;
BOOL
hasPermission
;
hasPermission
=
[
self
.
app
hasPermissionToScheduleLocalNotifications
];
hasPermission
=
[
self
.
app
hasPermissionToScheduleLocalNotifications
];
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsBool
:
hasPermission
];
messageAsBool
:
hasPermission
];
[
self
.
commandDelegate
sendPluginResult
:
result
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
callbackId
:
command
.
callbackId
];
}];
}];
...
@@ -410,10 +410,10 @@
...
@@ -410,10 +410,10 @@
-
(
void
)
registerPermission
:
(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
registerPermission
:
(
CDVInvokedUrlCommand
*
)
command
{
{
if
([[
UIApplication
sharedApplication
]
if
([[
UIApplication
sharedApplication
]
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
{
{
_command
=
command
;
_command
=
command
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
}];
}];
...
@@ -441,13 +441,13 @@
...
@@ -441,13 +441,13 @@
withOptions
:
(
NSDictionary
*
)
newOptions
withOptions
:
(
NSDictionary
*
)
newOptions
{
{
NSMutableDictionary
*
options
=
[
notification
.
userInfo
mutableCopy
];
NSMutableDictionary
*
options
=
[
notification
.
userInfo
mutableCopy
];
[
options
addEntriesFromDictionary
:
newOptions
];
[
options
addEntriesFromDictionary
:
newOptions
];
[
options
setObject
:[
NSDate
date
]
forKey
:
@"updatedAt"
];
[
options
setObject
:[
NSDate
date
]
forKey
:
@"updatedAt"
];
notification
=
[[
UILocalNotification
alloc
]
notification
=
[[
UILocalNotification
alloc
]
initWithOptions
:
options
];
initWithOptions
:
options
];
[
self
scheduleLocalNotification
:
notification
];
[
self
scheduleLocalNotification
:
notification
];
}
}
...
@@ -476,32 +476,32 @@
...
@@ -476,32 +476,32 @@
{
{
NSString
*
id
=
notification
.
options
.
id
;
NSString
*
id
=
notification
.
options
.
id
;
UILocalNotification
*
forerunner
;
UILocalNotification
*
forerunner
;
forerunner
=
[
self
.
app
localNotificationWithId
:
id
];
forerunner
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
forerunner
)
if
(
!
forerunner
)
return
;
return
;
[
self
.
app
cancelLocalNotification
:
forerunner
];
[
self
.
app
cancelLocalNotification
:
forerunner
];
}
}
/**
/**
* Cancels all
local notification with are
older then
* Cancels all
non-repeating local notification
older then
* a specific amount of seconds
* a specific amount of seconds
*/
*/
-
(
void
)
cancelAllNotificationsWhichAreOlderThen
:
(
float
)
seconds
-
(
void
)
cancelAllNotificationsWhichAreOlderThen
:
(
float
)
seconds
{
{
NSArray
*
notifications
;
NSArray
*
notifications
;
notifications
=
[
self
.
app
scheduledL
ocalNotifications
];
notifications
=
[
self
.
app
l
ocalNotifications
];
for
(
UILocalNotification
*
notification
in
notifications
)
for
(
UILocalNotification
*
notification
in
notifications
)
{
{
if
(
notification
&&
[
notification
isRepeating
]
if
(
!
[
notification
isRepeating
]
&&
notification
.
timeIntervalSinceFireDate
>
seconds
)
&&
notification
.
timeIntervalSinceFireDate
>
seconds
)
{
{
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
}
}
}
}
...
@@ -517,29 +517,29 @@
...
@@ -517,29 +517,29 @@
-
(
void
)
didReceiveLocalNotification
:
(
NSNotification
*
)
localNotification
-
(
void
)
didReceiveLocalNotification
:
(
NSNotification
*
)
localNotification
{
{
UILocalNotification
*
notification
=
[
localNotification
object
];
UILocalNotification
*
notification
=
[
localNotification
object
];
if
([
notification
wasUpdated
])
if
([
notification
wasUpdated
])
return
;
return
;
NSTimeInterval
timeInterval
=
[
notification
timeIntervalSinceLastTrigger
];
NSTimeInterval
timeInterval
=
[
notification
timeIntervalSinceLastTrigger
];
NSString
*
event
=
(
timeInterval
<=
1
&&
deviceready
)
?
@"trigger"
:
@"click"
;
NSString
*
event
=
(
timeInterval
<=
1
&&
deviceready
)
?
@"trigger"
:
@"click"
;
[
self
fireEvent
:
event
notification
:
notification
];
[
self
fireEvent
:
event
notification
:
notification
];
if
([
event
isEqualToString
:
@"click"
]
&&
!
[
notification
isRepeating
])
if
([
event
isEqualToString
:
@"click"
]
&&
!
[
notification
isRepeating
])
{
{
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
return
;
return
;
}
}
if
([
event
isEqualToString
:
@"click"
])
if
([
event
isEqualToString
:
@"click"
])
return
;
return
;
timeInterval
=
[
notification
timeIntervalSinceFireDate
];
timeInterval
=
[
notification
timeIntervalSinceFireDate
];
if
(
timeInterval
>
1
&&
[
notification
isRepeating
])
if
(
timeInterval
>
1
&&
[
notification
isRepeating
])
{
{
[
self
fireEvent
:
@"fireUpdateEvent"
notification
:
notification
];
[
self
fireEvent
:
@"fireUpdateEvent"
notification
:
notification
];
...
@@ -554,12 +554,12 @@
...
@@ -554,12 +554,12 @@
-
(
void
)
didFinishLaunchingWithOptions
:
(
NSNotification
*
)
notification
-
(
void
)
didFinishLaunchingWithOptions
:
(
NSNotification
*
)
notification
{
{
NSDictionary
*
launchOptions
=
[
notification
userInfo
];
NSDictionary
*
launchOptions
=
[
notification
userInfo
];
UILocalNotification
*
localNotification
;
UILocalNotification
*
localNotification
;
localNotification
=
[
launchOptions
objectForKey
:
localNotification
=
[
launchOptions
objectForKey
:
UIApplicationLaunchOptionsLocalNotificationKey
];
UIApplicationLaunchOptionsLocalNotificationKey
];
if
(
localNotification
)
{
if
(
localNotification
)
{
[
self
didReceiveLocalNotification
:
[
self
didReceiveLocalNotification
:
[
NSNotification
notificationWithName
:
CDVLocalNotification
[
NSNotification
notificationWithName
:
CDVLocalNotification
...
@@ -589,19 +589,19 @@
...
@@ -589,19 +589,19 @@
{
{
NSNotificationCenter
*
center
=
[
NSNotificationCenter
NSNotificationCenter
*
center
=
[
NSNotificationCenter
defaultCenter
];
defaultCenter
];
eventQueue
=
[[
NSMutableArray
alloc
]
init
];
eventQueue
=
[[
NSMutableArray
alloc
]
init
];
[
center
addObserver
:
self
[
center
addObserver
:
self
selector
:
@selector
(
didReceiveLocalNotification
:
)
selector
:
@selector
(
didReceiveLocalNotification
:
)
name
:
CDVLocalNotification
name
:
CDVLocalNotification
object
:
nil
];
object
:
nil
];
[
center
addObserver
:
self
[
center
addObserver
:
self
selector
:
@selector
(
didFinishLaunchingWithOptions
:
)
selector
:
@selector
(
didFinishLaunchingWithOptions
:
)
name
:
UIApplicationDidFinishLaunchingNotification
name
:
UIApplicationDidFinishLaunchingNotification
object
:
nil
];
object
:
nil
];
[
center
addObserver
:
self
[
center
addObserver
:
self
selector
:
@selector
(
didRegisterUserNotificationSettings
:
)
selector
:
@selector
(
didRegisterUserNotificationSettings
:
)
name
:
UIApplicationRegisterUserNotificationSettings
name
:
UIApplicationRegisterUserNotificationSettings
...
@@ -629,20 +629,20 @@
...
@@ -629,20 +629,20 @@
-
(
NSString
*
)
applicationState
-
(
NSString
*
)
applicationState
{
{
UIApplicationState
state
=
[
self
.
app
applicationState
];
UIApplicationState
state
=
[
self
.
app
applicationState
];
bool
isActive
=
state
==
UIApplicationStateActive
;
bool
isActive
=
state
==
UIApplicationStateActive
;
return
isActive
?
@"foreground"
:
@"background"
;
return
isActive
?
@"foreground"
:
@"background"
;
}
}
/**
/**
* Simply invokes the callback without any parameter.
* Simply invokes the callback without any parameter.
*/
*/
-
(
void
)
execCallback
:
(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
execCallback
:
(
CDVInvokedUrlCommand
*
)
command
{
{
CDVPluginResult
*
result
=
[
CDVPluginResult
CDVPluginResult
*
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
];
resultWithStatus
:
CDVCommandStatus_OK
];
[
self
.
commandDelegate
sendPluginResult
:
result
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
callbackId
:
command
.
callbackId
];
}
}
...
@@ -671,19 +671,19 @@
...
@@ -671,19 +671,19 @@
NSString
*
js
;
NSString
*
js
;
NSString
*
params
=
[
NSString
stringWithFormat
:
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
self
.
applicationState
];
@"
\"
%@
\"
"
,
self
.
applicationState
];
if
(
notification
)
{
if
(
notification
)
{
NSString
*
args
=
[
notification
encodeToJSON
];
NSString
*
args
=
[
notification
encodeToJSON
];
params
=
[
NSString
stringWithFormat
:
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
@"%@,'%@'"
,
args
,
self
.
applicationState
];
args
,
self
.
applicationState
];
}
}
js
=
[
NSString
stringWithFormat
:
js
=
[
NSString
stringWithFormat
:
@"cordova.plugins.notification.local.fireEvent('%@', %@)"
,
@"cordova.plugins.notification.local.fireEvent('%@', %@)"
,
event
,
params
];
event
,
params
];
if
(
deviceready
)
{
if
(
deviceready
)
{
[
self
.
commandDelegate
evalJs
:
js
];
[
self
.
commandDelegate
evalJs
:
js
];
}
else
{
}
else
{
...
...
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/UIApplication+APPLocalNotification.m
View file @
603e6b30
...
@@ -95,25 +95,6 @@
...
@@ -95,25 +95,6 @@
}
}
/**
/**
* List of all local notifications which have been scheduled
* and not yet removed from the notification center.
*/
-
(
NSArray
*
)
scheduledLocalNotifications2
{
NSArray
*
scheduledNotifications
=
self
.
scheduledLocalNotifications
;
NSMutableArray
*
notifications
=
[[
NSMutableArray
alloc
]
init
];
for
(
UILocalNotification
*
notification
in
scheduledNotifications
)
{
if
(
notification
&&
[
notification
isScheduled
])
{
[
notifications
addObject
:
notification
];
}
}
return
notifications
;
}
/**
* List of all triggered local notifications which have been scheduled
* List of all triggered local notifications which have been scheduled
* and not yet removed the notification center.
* and not yet removed the notification center.
*/
*/
...
...
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