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
d2bd748f
Commit
d2bd748f
authored
Dec 08, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed crashing `get` if notification doesn't exist
parent
3a2ed5dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
LocalNotification.java
src/android/LocalNotification.java
+22
-7
No files found.
src/android/LocalNotification.java
View file @
d2bd748f
...
...
@@ -36,6 +36,7 @@ import org.json.JSONObject;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
de.appplant.cordova.plugin.notification.Manager
;
...
...
@@ -234,6 +235,9 @@ public class LocalNotification extends CordovaPlugin {
Notification
notification
=
getNotificationMgr
().
update
(
id
,
update
,
TriggerReceiver
.
class
);
if
(
notification
==
null
)
continue
;
fireEvent
(
"update"
,
notification
);
}
}
...
...
@@ -251,11 +255,12 @@ public class LocalNotification extends CordovaPlugin {
Notification
notification
=
getNotificationMgr
().
cancel
(
id
);
if
(
notification
!=
null
)
{
if
(
notification
==
null
)
continue
;
fireEvent
(
"cancel"
,
notification
);
}
}
}
/**
* Cancel all scheduled notifications.
...
...
@@ -278,11 +283,12 @@ public class LocalNotification extends CordovaPlugin {
Notification
notification
=
getNotificationMgr
().
clear
(
id
);
if
(
notification
!=
null
)
{
if
(
notification
==
null
)
continue
;
fireEvent
(
"clear"
,
notification
);
}
}
}
/**
* Clear all triggered notifications without canceling them.
...
...
@@ -469,11 +475,20 @@ public class LocalNotification extends CordovaPlugin {
CallbackContext
command
)
{
JSONArray
ids
=
new
JSONArray
().
put
(
id
);
PluginResult
result
;
JSONObject
options
=
getNotificationMgr
().
getOptionsBy
(
type
,
toList
(
ids
))
.
get
(
0
)
;
List
<
JSONObject
>
options
=
getNotificationMgr
().
getOptionsBy
(
type
,
toList
(
ids
));
command
.
success
(
options
);
if
(
options
.
isEmpty
())
{
// Status.NO_RESULT led to no callback invocation :(
// Status.OK led to no NPE and crash
result
=
new
PluginResult
(
PluginResult
.
Status
.
NO_RESULT
);
}
else
{
result
=
new
PluginResult
(
PluginResult
.
Status
.
OK
,
options
.
get
(
0
));
}
command
.
sendPluginResult
(
result
);
}
/**
...
...
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