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
b9387a0d
Commit
b9387a0d
authored
Oct 19, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added back clearAll on Android
parent
a82fa397
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
45 deletions
+37
-45
LocalNotification.java
src/android/LocalNotification.java
+28
-31
Manager.java
src/android/notification/Manager.java
+7
-13
APPLocalNotification.m
src/ios/APPLocalNotification.m
+2
-1
No files found.
src/android/LocalNotification.java
View file @
b9387a0d
...
@@ -23,7 +23,6 @@ package de.appplant.cordova.plugin.localnotification;
...
@@ -23,7 +23,6 @@ package de.appplant.cordova.plugin.localnotification;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.util.Log
;
import
android.util.Pair
;
import
android.util.Pair
;
import
org.apache.cordova.CallbackContext
;
import
org.apache.cordova.CallbackContext
;
...
@@ -35,9 +34,7 @@ import org.json.JSONArray;
...
@@ -35,9 +34,7 @@ import org.json.JSONArray;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.lang.Exception
;
import
de.appplant.cordova.plugin.notification.action.ActionGroup
;
import
de.appplant.cordova.plugin.notification.action.ActionGroup
;
import
de.appplant.cordova.plugin.notification.Manager
;
import
de.appplant.cordova.plugin.notification.Manager
;
...
@@ -155,7 +152,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -155,7 +152,7 @@ public class LocalNotification extends CordovaPlugin {
if
(
action
.
equalsIgnoreCase
(
"schedule"
))
{
if
(
action
.
equalsIgnoreCase
(
"schedule"
))
{
schedule
(
args
);
schedule
(
args
);
command
.
success
();
command
.
success
();
}
}
else
// if (action.equals("update")) {
// if (action.equals("update")) {
// update(args);
// update(args);
// command.success();
// command.success();
...
@@ -172,10 +169,10 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -172,10 +169,10 @@ public class LocalNotification extends CordovaPlugin {
// clear(args);
// clear(args);
// command.success();
// command.success();
// } else
// } else
//
if (action.equals("clearAll")) {
if
(
action
.
equals
(
"clearAll"
))
{
//
clearAll();
clearAll
();
//
command.success();
command
.
success
();
// } else
}
// if (action.equals("isPresent")) {
// if (action.equals("isPresent")) {
// isPresent(args.optInt(0), command);
// isPresent(args.optInt(0), command);
// } else
// } else
...
@@ -250,7 +247,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -250,7 +247,7 @@ public class LocalNotification extends CordovaPlugin {
* JavaScript.
* JavaScript.
*/
*/
private
void
check
(
CallbackContext
command
)
{
private
void
check
(
CallbackContext
command
)
{
boolean
allowed
=
getNot
ification
Mgr
().
hasPermission
();
boolean
allowed
=
getNotMgr
().
hasPermission
();
PluginResult
result
=
new
PluginResult
(
PluginResult
.
Status
.
OK
,
allowed
);
PluginResult
result
=
new
PluginResult
(
PluginResult
.
Status
.
OK
,
allowed
);
command
.
sendPluginResult
(
result
);
command
.
sendPluginResult
(
result
);
...
@@ -285,7 +282,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -285,7 +282,7 @@ public class LocalNotification extends CordovaPlugin {
* @param notifications The notifications to schedule.
* @param notifications The notifications to schedule.
*/
*/
private
void
schedule
(
JSONArray
notifications
)
{
private
void
schedule
(
JSONArray
notifications
)
{
Manager
mgr
=
getNot
ification
Mgr
();
Manager
mgr
=
getNotMgr
();
for
(
int
i
=
0
;
i
<
notifications
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
notifications
.
length
();
i
++)
{
JSONObject
dict
=
notifications
.
optJSONObject
(
i
);
JSONObject
dict
=
notifications
.
optJSONObject
(
i
);
...
@@ -311,7 +308,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -311,7 +308,7 @@ public class LocalNotification extends CordovaPlugin {
// int id = update.optInt("id", 0);
// int id = update.optInt("id", 0);
// Notification notification =
// Notification notification =
// getNot
ification
Mgr().update(id, update, TriggerReceiver.class);
// getNotMgr().update(id, update, TriggerReceiver.class);
// if (notification == null)
// if (notification == null)
// continue;
// continue;
...
@@ -331,7 +328,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -331,7 +328,7 @@ public class LocalNotification extends CordovaPlugin {
// int id = ids.optInt(i, 0);
// int id = ids.optInt(i, 0);
// Notification notification =
// Notification notification =
// getNot
ification
Mgr().cancel(id);
// getNotMgr().cancel(id);
// if (notification == null)
// if (notification == null)
// continue;
// continue;
...
@@ -344,7 +341,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -344,7 +341,7 @@ public class LocalNotification extends CordovaPlugin {
// * Cancel all scheduled notifications.
// * Cancel all scheduled notifications.
// */
// */
// private void cancelAll() {
// private void cancelAll() {
// getNot
ification
Mgr().cancelAll();
// getNotMgr().cancelAll();
// fireEvent("cancelall");
// fireEvent("cancelall");
// }
// }
...
@@ -359,7 +356,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -359,7 +356,7 @@ public class LocalNotification extends CordovaPlugin {
// int id = ids.optInt(i, 0);
// int id = ids.optInt(i, 0);
// Notification notification =
// Notification notification =
// getNot
ification
Mgr().clear(id);
// getNotMgr().clear(id);
// if (notification == null)
// if (notification == null)
// continue;
// continue;
...
@@ -368,13 +365,13 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -368,13 +365,13 @@ public class LocalNotification extends CordovaPlugin {
// }
// }
// }
// }
/
/ /
**
/**
//
* Clear all triggered notifications without canceling them.
* Clear all triggered notifications without canceling them.
//
*/
*/
//
private void clearAll() {
private
void
clearAll
()
{
// getNotification
Mgr().clearAll();
getNot
Mgr
().
clearAll
();
//
fireEvent("clearall");
fireEvent
(
"clearall"
);
//
}
}
// /**
// /**
// * If a notification with an ID is present.
// * If a notification with an ID is present.
...
@@ -385,7 +382,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -385,7 +382,7 @@ public class LocalNotification extends CordovaPlugin {
// * The callback context used when calling back into JavaScript.
// * The callback context used when calling back into JavaScript.
// */
// */
// private void isPresent (int id, CallbackContext command) {
// private void isPresent (int id, CallbackContext command) {
// boolean exist = getNot
ification
Mgr().exist(id);
// boolean exist = getNotMgr().exist(id);
// PluginResult result = new PluginResult(
// PluginResult result = new PluginResult(
// PluginResult.Status.OK, exist);
// PluginResult.Status.OK, exist);
...
@@ -402,7 +399,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -402,7 +399,7 @@ public class LocalNotification extends CordovaPlugin {
// * The callback context used when calling back into JavaScript.
// * The callback context used when calling back into JavaScript.
// */
// */
// private void isScheduled (int id, CallbackContext command) {
// private void isScheduled (int id, CallbackContext command) {
// boolean exist = getNot
ification
Mgr().exist(
// boolean exist = getNotMgr().exist(
// id, Notification.Type.SCHEDULED);
// id, Notification.Type.SCHEDULED);
// PluginResult result = new PluginResult(
// PluginResult result = new PluginResult(
...
@@ -420,7 +417,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -420,7 +417,7 @@ public class LocalNotification extends CordovaPlugin {
// * The callback context used when calling back into JavaScript.
// * The callback context used when calling back into JavaScript.
// */
// */
// private void isTriggered (int id, CallbackContext command) {
// private void isTriggered (int id, CallbackContext command) {
// boolean exist = getNot
ification
Mgr().exist(
// boolean exist = getNotMgr().exist(
// id, Notification.Type.TRIGGERED);
// id, Notification.Type.TRIGGERED);
// PluginResult result = new PluginResult(
// PluginResult result = new PluginResult(
...
@@ -436,7 +433,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -436,7 +433,7 @@ public class LocalNotification extends CordovaPlugin {
// * The callback context used when calling back into JavaScript.
// * The callback context used when calling back into JavaScript.
// */
// */
// private void getAllIds (CallbackContext command) {
// private void getAllIds (CallbackContext command) {
// List<Integer> ids = getNot
ification
Mgr().getIds();
// List<Integer> ids = getNotMgr().getIds();
// command.success(new JSONArray(ids));
// command.success(new JSONArray(ids));
// }
// }
...
@@ -448,7 +445,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -448,7 +445,7 @@ public class LocalNotification extends CordovaPlugin {
// * The callback context used when calling back into JavaScript.
// * The callback context used when calling back into JavaScript.
// */
// */
// private void getScheduledIds (CallbackContext command) {
// private void getScheduledIds (CallbackContext command) {
// List<Integer> ids = getNot
ification
Mgr().getIdsByType(
// List<Integer> ids = getNotMgr().getIdsByType(
// Notification.Type.SCHEDULED);
// Notification.Type.SCHEDULED);
// command.success(new JSONArray(ids));
// command.success(new JSONArray(ids));
...
@@ -461,7 +458,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -461,7 +458,7 @@ public class LocalNotification extends CordovaPlugin {
// * The callback context used when calling back into JavaScript.
// * The callback context used when calling back into JavaScript.
// */
// */
// private void getTriggeredIds (CallbackContext command) {
// private void getTriggeredIds (CallbackContext command) {
// List<Integer> ids = getNot
ification
Mgr().getIdsByType(
// List<Integer> ids = getNotMgr().getIdsByType(
// Notification.Type.TRIGGERED);
// Notification.Type.TRIGGERED);
// command.success(new JSONArray(ids));
// command.success(new JSONArray(ids));
...
@@ -556,7 +553,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -556,7 +553,7 @@ public class LocalNotification extends CordovaPlugin {
// PluginResult result;
// PluginResult result;
// List<JSONObject> options =
// List<JSONObject> options =
// getNot
ification
Mgr().getOptionsBy(type, toList(ids));
// getNotMgr().getOptionsBy(type, toList(ids));
// if (options.isEmpty()) {
// if (options.isEmpty()) {
// // Status.NO_RESULT led to no callback invocation :(
// // Status.NO_RESULT led to no callback invocation :(
...
@@ -585,9 +582,9 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -585,9 +582,9 @@ public class LocalNotification extends CordovaPlugin {
// List<JSONObject> options;
// List<JSONObject> options;
// if (ids.length() == 0) {
// if (ids.length() == 0) {
// options = getNot
ification
Mgr().getOptionsByType(type);
// options = getNotMgr().getOptionsByType(type);
// } else {
// } else {
// options = getNot
ification
Mgr().getOptionsBy(type, toList(ids));
// options = getNotMgr().getOptionsBy(type, toList(ids));
// }
// }
// command.success(new JSONArray(options));
// command.success(new JSONArray(options));
...
@@ -702,7 +699,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -702,7 +699,7 @@ public class LocalNotification extends CordovaPlugin {
/**
/**
* Notification manager instance.
* Notification manager instance.
*/
*/
private
Manager
getNot
ification
Mgr
()
{
private
Manager
getNotMgr
()
{
return
Manager
.
getInstance
(
cordova
.
getActivity
());
return
Manager
.
getInstance
(
cordova
.
getActivity
());
}
}
...
...
src/android/notification/Manager.java
View file @
b9387a0d
...
@@ -205,6 +205,13 @@ public final class Manager {
...
@@ -205,6 +205,13 @@ public final class Manager {
// return notification;
// return notification;
// }
// }
/**
* Clear all local notifications.
*/
public
void
clearAll
()
{
getNotMgr
().
cancelAll
();
}
// /**
// /**
// * Clear local notification specified by ID.
// * Clear local notification specified by ID.
// *
// *
...
@@ -222,19 +229,6 @@ public final class Manager {
...
@@ -222,19 +229,6 @@ public final class Manager {
// }
// }
// /**
// /**
// * Clear all local notifications.
// */
// public void clearAll () {
// List<Notification> notifications = getAll();
// for (Notification notification : notifications) {
// notification.clear();
// }
// getNotMgr().cancelAll();
// }
// /**
// * Cancel all local notifications.
// * Cancel all local notifications.
// */
// */
// public void cancelAll () {
// public void cancelAll () {
...
...
src/ios/APPLocalNotification.m
View file @
b9387a0d
...
@@ -49,10 +49,11 @@
...
@@ -49,10 +49,11 @@
*/
*/
-
(
void
)
launch
:(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
launch
:(
CDVInvokedUrlCommand
*
)
command
{
{
NSString
*
js
;
if
(
!
_launchDetails
)
if
(
!
_launchDetails
)
return
;
return
;
NSString
*
js
;
js
=
[
NSString
stringWithFormat
:
js
=
[
NSString
stringWithFormat
:
@"cordova.plugins.notification.local.launchDetails = {id:%@, action:'%@'}"
,
@"cordova.plugins.notification.local.launchDetails = {id:%@, action:'%@'}"
,
_launchDetails
[
0
],
_launchDetails
[
1
]];
_launchDetails
[
0
],
_launchDetails
[
1
]];
...
...
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