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
5cfb725c
Commit
5cfb725c
authored
Feb 13, 2018
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore non-repeating notifications which havent been trigger yet [see #1449]
parent
6b2cc24e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
RestoreReceiver.java
src/android/RestoreReceiver.java
+12
-3
Request.java
src/android/notification/Request.java
+1
-1
AbstractRestoreReceiver.java
...ndroid/notification/receiver/AbstractRestoreReceiver.java
+8
-0
No files found.
src/android/RestoreReceiver.java
View file @
5cfb725c
...
...
@@ -23,6 +23,11 @@
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
import
android.content.Context
;
import
android.util.Log
;
import
java.util.Date
;
import
de.appplant.cordova.plugin.notification.Builder
;
import
de.appplant.cordova.plugin.notification.Manager
;
import
de.appplant.cordova.plugin.notification.Notification
;
...
...
@@ -44,15 +49,19 @@ public class RestoreReceiver extends AbstractRestoreReceiver {
*/
@Override
public
void
onRestore
(
Request
request
,
Notification
toast
)
{
Manager
mgr
=
Manager
.
getInstance
(
toast
.
getContext
());
Date
date
=
request
.
getTriggerDate
();
boolean
after
=
date
!=
null
&&
date
.
after
(
new
Date
());
if
(
toast
.
isHighPrio
())
{
if
(
!
after
&&
toast
.
isHighPrio
())
{
toast
.
show
();
}
else
{
toast
.
clear
();
}
if
(
toast
.
isRepeating
())
{
Context
ctx
=
toast
.
getContext
();
Manager
mgr
=
Manager
.
getInstance
(
ctx
);
if
(
after
||
toast
.
isRepeating
())
{
mgr
.
schedule
(
request
,
TriggerReceiver
.
class
);
}
}
...
...
src/android/notification/Request.java
View file @
5cfb725c
...
...
@@ -138,7 +138,7 @@ public final class Request {
*
* @return null if there's no trigger date.
*/
Date
getTriggerDate
()
{
public
Date
getTriggerDate
()
{
Calendar
now
=
Calendar
.
getInstance
();
if
(
triggerDate
==
null
)
...
...
src/android/notification/receiver/AbstractRestoreReceiver.java
View file @
5cfb725c
...
...
@@ -37,6 +37,9 @@ import de.appplant.cordova.plugin.notification.Notification;
import
de.appplant.cordova.plugin.notification.Options
;
import
de.appplant.cordova.plugin.notification.Request
;
import
static
android
.
content
.
Intent
.
ACTION_BOOT_COMPLETED
;
import
static
android
.
os
.
Build
.
VERSION
.
SDK_INT
;
/**
* This class is triggered upon reboot of the device. It needs to re-register
* the alarms with the AlarmManager since these alarms are lost in case of
...
...
@@ -52,6 +55,11 @@ abstract public class AbstractRestoreReceiver extends BroadcastReceiver {
*/
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
if
(
action
.
equals
(
ACTION_BOOT_COMPLETED
)
&&
SDK_INT
>=
24
)
return
;
Manager
mgr
=
Manager
.
getInstance
(
context
);
List
<
JSONObject
>
toasts
=
mgr
.
getOptions
();
...
...
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