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
1baf850e
Commit
1baf850e
authored
Mar 14, 2014
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `isNotificationScheduled:` helper
parent
edbf05ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
15 deletions
+28
-15
APPLocalNotification.m
src/ios/APPLocalNotification.m
+28
-15
No files found.
src/ios/APPLocalNotification.m
View file @
1baf850e
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
-
(
void
)
didFinishLaunchingWithOptions
:(
NSNotification
*
)
notification
;
-
(
void
)
didFinishLaunchingWithOptions
:(
NSNotification
*
)
notification
;
// Hilfsmethode gibt an, ob er String NULL oder Empty ist
// Hilfsmethode gibt an, ob er String NULL oder Empty ist
-
(
BOOL
)
strIsNullOrEmpty
:(
NSString
*
)
str
;
-
(
BOOL
)
strIsNullOrEmpty
:(
NSString
*
)
str
;
// Checks wether a notification with an ID is scheduled or not.
-
(
BOOL
)
isNotificationScheduledWithId
:(
NSString
*
)
id
;
// Fires the given event
// Fires the given event
-
(
void
)
fireEvent
:(
NSString
*
)
event
id
:
(
NSString
*
)
id
json
:
(
NSString
*
)
json
;
-
(
void
)
fireEvent
:(
NSString
*
)
event
id
:
(
NSString
*
)
id
json
:
(
NSString
*
)
json
;
...
@@ -123,22 +125,9 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
...
@@ -123,22 +125,9 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
NSArray
*
arguments
=
[
command
arguments
];
NSArray
*
arguments
=
[
command
arguments
];
NSString
*
id
=
[
arguments
objectAtIndex
:
0
];
NSString
*
id
=
[
arguments
objectAtIndex
:
0
];
bool
isScheduled
=
NO
;
bool
isScheduled
=
[
self
isNotificationScheduledWithId
:
id
]
;
CDVPluginResult
*
result
;
CDVPluginResult
*
result
;
NSArray
*
notifications
=
[[
UIApplication
sharedApplication
]
scheduledLocalNotifications
];
for
(
UILocalNotification
*
notification
in
notifications
)
{
NSString
*
notId
=
[
notification
.
userInfo
objectForKey
:
@"id"
];
if
([
notId
isEqualToString
:
id
])
{
isScheduled
=
YES
;
break
;
}
}
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
result
=
[
CDVPluginResult
resultWithStatus
:
CDVCommandStatus_OK
messageAsBool
:
isScheduled
];
messageAsBool
:
isScheduled
];
...
@@ -416,13 +405,37 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
...
@@ -416,13 +405,37 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION";
}
}
/**
/**
* Checks wether a notification with an ID is scheduled or not.
*
* @param id
* The ID of the notification
* @return BOOL
*/
-
(
BOOL
)
isNotificationScheduledWithId
:
(
NSString
*
)
id
{
NSArray
*
notifications
=
[[
UIApplication
sharedApplication
]
scheduledLocalNotifications
];
for
(
UILocalNotification
*
notification
in
notifications
)
{
NSString
*
notId
=
[
notification
.
userInfo
objectForKey
:
@"id"
];
if
([
notId
isEqualToString
:
id
])
{
return
YES
;
}
}
return
NO
;
}
/**
* Fires the given event.
* Fires the given event.
*
*
* @param {String} event The Name of the event
* @param {String} event The Name of the event
* @param {String} id The ID of the notification
* @param {String} id The ID of the notification
* @param {String} json A custom (JSON) string
* @param {String} json A custom (JSON) string
*/
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
id
:
(
NSString
*
)
id
json
:
(
NSString
*
)
json
-
(
void
)
fireEvent
:
(
NSString
*
)
event
id
:
(
NSString
*
)
id
json
:
(
NSString
*
)
json
{
{
UIApplicationState
state
=
[[
UIApplication
sharedApplication
]
applicationState
];
UIApplicationState
state
=
[[
UIApplication
sharedApplication
]
applicationState
];
bool
isActive
=
state
==
UIApplicationStateActive
;
bool
isActive
=
state
==
UIApplicationStateActive
;
...
...
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