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 @@
<sortByType
/>
</navigator>
<panes>
<pane
id=
"PackagesPane"
/>
<pane
id=
"AndroidView"
>
<subPane>
<PATH>
...
...
@@ -151,6 +150,7 @@
</PATH>
</subPane>
</pane>
<pane
id=
"PackagesPane"
/>
<pane
id=
"Scope"
/>
<pane
id=
"ProjectPane"
>
<subPane>
...
...
@@ -323,7 +323,7 @@
</option>
</component>
<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"
/>
<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"
/>
...
...
@@ -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=
"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=
"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=
"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=
"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=
"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=
"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=
"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=
"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"
/>
...
...
@@ -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=
"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=
"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"
/>
</layout>
</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 @@
-
(
void
)
deviceready
:(
CDVInvokedUrlCommand
*
)
command
{
deviceready
=
YES
;
for
(
NSString
*
js
in
eventQueue
)
{
[
self
.
commandDelegate
evalJs
:
js
];
}
[
eventQueue
removeAllObjects
];
}
...
...
@@ -70,22 +70,22 @@
-
(
void
)
schedule
:(
CDVInvokedUrlCommand
*
)
command
{
NSArray
*
notifications
=
command
.
arguments
;
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSDictionary
*
options
in
notifications
)
{
UILocalNotification
*
notification
;
notification
=
[[
UILocalNotification
alloc
]
initWithOptions
:
options
];
[
self
scheduleLocalNotification
:[
notification
copy
]];
[
self
fireEvent
:
@"schedule"
notification
:
notification
];
if
(
notifications
.
count
>
1
)
{
[
NSThread
sleepForTimeInterval
:
0
.
01
];
}
}
[
self
execCallback
:
command
];
}];
}
...
...
@@ -99,27 +99,27 @@
-
(
void
)
update
:(
CDVInvokedUrlCommand
*
)
command
{
NSArray
*
notifications
=
command
.
arguments
;
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSDictionary
*
options
in
notifications
)
{
NSString
*
id
=
[
options
objectForKey
:
@"id"
];
UILocalNotification
*
notification
;
notification
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
notification
)
continue
;
[
self
updateLocalNotification
:[
notification
copy
]
withOptions
:
options
];
[
self
fireEvent
:
@"update"
notification
:
notification
];
if
(
notifications
.
count
>
1
)
{
[
NSThread
sleepForTimeInterval
:
0
.
01
];
}
}
[
self
execCallback
:
command
];
}];
}
...
...
@@ -135,16 +135,16 @@
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSString
*
id
in
command
.
arguments
)
{
UILocalNotification
*
notification
;
notification
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
notification
)
continue
;
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
}
[
self
execCallback
:
command
];
}];
}
...
...
@@ -172,16 +172,16 @@
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSString
*
id
in
command
.
arguments
)
{
UILocalNotification
*
notification
;
notification
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
notification
)
continue
;
[
self
.
app
clearLocalNotification
:
notification
];
[
self
fireEvent
:
@"clear"
notification
:
notification
];
}
[
self
execCallback
:
command
];
}];
}
...
...
@@ -243,18 +243,18 @@
[
self
.
commandDelegate
runInBackground
:
^
{
NSString
*
id
=
[
command
argumentAtIndex
:
0
];
BOOL
exist
;
CDVPluginResult
*
result
;
if
(
type
==
NotifcationTypeAll
)
{
exist
=
[
self
.
app
localNotificationExist
:
id
];
}
else
{
exist
=
[
self
.
app
localNotificationExist
:
id
type
:
type
];
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsBool
:
exist
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}];
...
...
@@ -293,21 +293,21 @@
* The IDs of the notifications
*/
-
(
void
)
getIds
:
(
CDVInvokedUrlCommand
*
)
command
byType
:
(
APPLocalNotificationType
)
type
;
byType
:
(
APPLocalNotificationType
)
type
;
{
[
self
.
commandDelegate
runInBackground
:
^
{
CDVPluginResult
*
result
;
NSArray
*
ids
;
if
(
type
==
NotifcationTypeAll
)
{
ids
=
[
self
.
app
localNotificationIds
];
}
else
{
ids
=
[
self
.
app
localNotificationIdsByType
:
type
];
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsArray
:
ids
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}];
...
...
@@ -361,7 +361,7 @@
NSArray
*
ids
=
command
.
arguments
;
NSArray
*
notifications
;
CDVPluginResult
*
result
;
if
(
type
==
NotifcationTypeAll
&&
ids
.
count
==
0
)
{
notifications
=
[
self
.
app
localNotificationOptions
];
}
...
...
@@ -375,10 +375,10 @@
notifications
=
[
self
.
app
localNotificationOptionsByType
:
type
andId
:
ids
];
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsArray
:
notifications
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}];
...
...
@@ -393,12 +393,12 @@
[
self
.
commandDelegate
runInBackground
:
^
{
CDVPluginResult
*
result
;
BOOL
hasPermission
;
hasPermission
=
[
self
.
app
hasPermissionToScheduleLocalNotifications
];
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsBool
:
hasPermission
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}];
...
...
@@ -410,10 +410,10 @@
-
(
void
)
registerPermission
:
(
CDVInvokedUrlCommand
*
)
command
{
if
([[
UIApplication
sharedApplication
]
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
respondsToSelector
:
@selector
(
registerUserNotificationSettings
:)])
{
_command
=
command
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
app
registerPermissionToScheduleLocalNotifications
];
}];
...
...
@@ -441,13 +441,13 @@
withOptions
:
(
NSDictionary
*
)
newOptions
{
NSMutableDictionary
*
options
=
[
notification
.
userInfo
mutableCopy
];
[
options
addEntriesFromDictionary
:
newOptions
];
[
options
setObject
:[
NSDate
date
]
forKey
:
@"updatedAt"
];
notification
=
[[
UILocalNotification
alloc
]
initWithOptions
:
options
];
[
self
scheduleLocalNotification
:
notification
];
}
...
...
@@ -476,32 +476,32 @@
{
NSString
*
id
=
notification
.
options
.
id
;
UILocalNotification
*
forerunner
;
forerunner
=
[
self
.
app
localNotificationWithId
:
id
];
if
(
!
forerunner
)
return
;
[
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
*/
-
(
void
)
cancelAllNotificationsWhichAreOlderThen
:
(
float
)
seconds
{
NSArray
*
notifications
;
notifications
=
[
self
.
app
scheduledL
ocalNotifications
];
notifications
=
[
self
.
app
l
ocalNotifications
];
for
(
UILocalNotification
*
notification
in
notifications
)
{
if
(
notification
&&
[
notification
isRepeating
]
if
(
!
[
notification
isRepeating
]
&&
notification
.
timeIntervalSinceFireDate
>
seconds
)
{
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
}
}
...
...
@@ -517,29 +517,29 @@
-
(
void
)
didReceiveLocalNotification
:
(
NSNotification
*
)
localNotification
{
UILocalNotification
*
notification
=
[
localNotification
object
];
if
([
notification
wasUpdated
])
return
;
NSTimeInterval
timeInterval
=
[
notification
timeIntervalSinceLastTrigger
];
NSString
*
event
=
(
timeInterval
<=
1
&&
deviceready
)
?
@"trigger"
:
@"click"
;
[
self
fireEvent
:
event
notification
:
notification
];
if
([
event
isEqualToString
:
@"click"
]
&&
!
[
notification
isRepeating
])
{
[
self
.
app
cancelLocalNotification
:
notification
];
[
self
fireEvent
:
@"cancel"
notification
:
notification
];
return
;
}
if
([
event
isEqualToString
:
@"click"
])
return
;
timeInterval
=
[
notification
timeIntervalSinceFireDate
];
if
(
timeInterval
>
1
&&
[
notification
isRepeating
])
{
[
self
fireEvent
:
@"fireUpdateEvent"
notification
:
notification
];
...
...
@@ -554,12 +554,12 @@
-
(
void
)
didFinishLaunchingWithOptions
:
(
NSNotification
*
)
notification
{
NSDictionary
*
launchOptions
=
[
notification
userInfo
];
UILocalNotification
*
localNotification
;
localNotification
=
[
launchOptions
objectForKey
:
UIApplicationLaunchOptionsLocalNotificationKey
];
if
(
localNotification
)
{
[
self
didReceiveLocalNotification
:
[
NSNotification
notificationWithName
:
CDVLocalNotification
...
...
@@ -589,19 +589,19 @@
{
NSNotificationCenter
*
center
=
[
NSNotificationCenter
defaultCenter
];
eventQueue
=
[[
NSMutableArray
alloc
]
init
];
[
center
addObserver
:
self
selector
:
@selector
(
didReceiveLocalNotification
:
)
name
:
CDVLocalNotification
object
:
nil
];
[
center
addObserver
:
self
selector
:
@selector
(
didFinishLaunchingWithOptions
:
)
name
:
UIApplicationDidFinishLaunchingNotification
object
:
nil
];
[
center
addObserver
:
self
selector
:
@selector
(
didRegisterUserNotificationSettings
:
)
name
:
UIApplicationRegisterUserNotificationSettings
...
...
@@ -629,20 +629,20 @@
-
(
NSString
*
)
applicationState
{
UIApplicationState
state
=
[
self
.
app
applicationState
];
bool
isActive
=
state
==
UIApplicationStateActive
;
return
isActive
?
@"foreground"
:
@"background"
;
}
/**
* Simply invokes the callback without any parameter.
*/
* Simply invokes the callback without any parameter.
*/
-
(
void
)
execCallback
:
(
CDVInvokedUrlCommand
*
)
command
{
CDVPluginResult
*
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
];
[
self
.
commandDelegate
sendPluginResult
:
result
callbackId
:
command
.
callbackId
];
}
...
...
@@ -671,19 +671,19 @@
NSString
*
js
;
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
self
.
applicationState
];
if
(
notification
)
{
NSString
*
args
=
[
notification
encodeToJSON
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
self
.
applicationState
];
}
js
=
[
NSString
stringWithFormat
:
@"cordova.plugins.notification.local.fireEvent('%@', %@)"
,
event
,
params
];
if
(
deviceready
)
{
[
self
.
commandDelegate
evalJs
:
js
];
}
else
{
...
...
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/UIApplication+APPLocalNotification.m
View file @
603e6b30
...
...
@@ -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
* 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