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
f5d4d432
Commit
f5d4d432
authored
Dec 16, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notification on iOS will be canceled if a new one with the same ID was added
parent
60b501ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
13 deletions
+33
-13
README.md
README.md
+1
-0
APPLocalNotification.m
src/ios/APPLocalNotification.m
+32
-13
No files found.
README.md
View file @
f5d4d432
...
...
@@ -49,6 +49,7 @@ More informations can be found [here](https://build.phonegap.com/plugins/331).
#### Version 0.7.0 (not yet released)
-
[
bugfix:
]
App throws an error on iOS if
`message`
is null.
-
[
bugfix:
]
Removed extra line break on iOS if
`title`
is null or empty.
-
[
bugfix:
]
Notification on iOS will be canceled if a new one with the same ID was added.
#### Version 0.6.3 (12.12.2013)
-
[
bugfix:
]
Black screen on Android.
...
...
src/ios/APPLocalNotification.m
View file @
f5d4d432
...
...
@@ -23,6 +23,8 @@
@interface
APPLocalNotification
(
Private
)
// Entfernt die zur ID passende Meldung
-
(
void
)
cancelNotificationWithId
:(
NSString
*
)
notificationId
;
-
(
NSMutableDictionary
*
)
repeatDict
;
// Alle zusätzlichen Metadaten der Notification als Hash
-
(
NSDictionary
*
)
userDict
:(
NSMutableDictionary
*
)
options
;
...
...
@@ -47,32 +49,24 @@
NSArray
*
arguments
=
[
command
arguments
];
NSMutableDictionary
*
options
=
[
arguments
objectAtIndex
:
0
];
UILocalNotification
*
notification
=
[
self
notificationWithProperties
:
options
];
NSString
*
notificationId
=
[
notification
.
userInfo
objectForKey
:
@"id"
];
[
self
cancelNotificationWithId
:
notificationId
];
[[
UIApplication
sharedApplication
]
scheduleLocalNotification
:
notification
];
}];
}
/**
* Entfernt den anhand der ID angegebenen Eintrag.
*
* @param {NSString} id Die ID der Notification
* Entfernt die zur ID passende Meldung.
*/
-
(
void
)
cancel
:(
CDVInvokedUrlCommand
*
)
command
{
[
self
.
commandDelegate
runInBackground
:
^
{
NSArray
*
arguments
=
[
command
arguments
];
NSString
*
notificationId
=
[
arguments
objectAtIndex
:
0
];
NSArray
*
notifications
=
[[
UIApplication
sharedApplication
]
scheduledLocalNotifications
];
for
(
UILocalNotification
*
notification
in
notifications
)
{
NSString
*
id
=
[
notification
.
userInfo
objectForKey
:
@"id"
];
if
([
notificationId
isEqualToString
:
id
])
{
[[
UIApplication
sharedApplication
]
cancelLocalNotification
:
notification
];
}
}
[
self
cancelNotificationWithId
:
notificationId
];
}];
}
...
...
@@ -85,6 +79,31 @@
}
/**
* Entfernt die zur ID passende Meldung.
*
* @param {NSString} id Die ID der Notification
*/
-
(
void
)
cancelNotificationWithId
:(
NSString
*
)
notificationId
{
NSArray
*
notifications
=
[[
UIApplication
sharedApplication
]
scheduledLocalNotifications
];
if
(
notificationId
==
(
NSString
*
)[
NSNull
null
]
||
[
notificationId
isEqualToString
:
@""
])
{
return
;
}
for
(
UILocalNotification
*
notification
in
notifications
)
{
NSString
*
id
=
[
notification
.
userInfo
objectForKey
:
@"id"
];
if
([
notificationId
isEqualToString
:
id
])
{
[[
UIApplication
sharedApplication
]
cancelLocalNotification
:
notification
];
}
}
}
/**
* @private
*/
-
(
NSMutableDictionary
*
)
repeatDict
...
...
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