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
452e572b
Commit
452e572b
authored
Oct 19, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup and added launch flag for Android
parent
3b97aa4a
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
73 additions
and
68 deletions
+73
-68
plugin.xml
plugin.xml
+7
-19
ClearReceiver.java
src/android/ClearReceiver.java
+3
-2
ClickActivity.java
src/android/ClickActivity.java
+21
-4
LocalNotification.java
src/android/LocalNotification.java
+1
-2
TriggerReceiver.java
src/android/TriggerReceiver.java
+3
-2
Builder.java
src/android/notification/Builder.java
+9
-7
Manager.java
src/android/notification/Manager.java
+0
-13
Notification.java
src/android/notification/Notification.java
+1
-8
Options.java
src/android/notification/Options.java
+13
-1
Request.java
src/android/notification/Request.java
+5
-1
Action.java
src/android/notification/action/Action.java
+4
-4
ActionGroup.java
src/android/notification/action/ActionGroup.java
+2
-2
AbstractClickActivity.java
src/android/notification/activity/AbstractClickActivity.java
+3
-3
local-notification-util.js
www/local-notification-util.js
+1
-0
No files found.
plugin.xml
View file @
452e572b
...
@@ -166,11 +166,15 @@
...
@@ -166,11 +166,15 @@
target-dir="src/de/appplant/cordova/plugin/localnotification" />
target-dir="src/de/appplant/cordova/plugin/localnotification" />
-->
-->
<source-file
<source-file
src=
"src/android/notification/acti
vity/AbstractClickActivity
.java"
src=
"src/android/notification/acti
on/Action
.java"
target-dir=
"src/de/appplant/cordova/plugin/notification/acti
vity
"
/>
target-dir=
"src/de/appplant/cordova/plugin/notification/acti
on
"
/>
<source-file
<source-file
src=
"src/android/notification/activity/ClickActivity.java"
src=
"src/android/notification/action/ActionGroup.java"
target-dir=
"src/de/appplant/cordova/plugin/notification/action"
/>
<source-file
src=
"src/android/notification/activity/AbstractClickActivity.java"
target-dir=
"src/de/appplant/cordova/plugin/notification/activity"
/>
target-dir=
"src/de/appplant/cordova/plugin/notification/activity"
/>
<source-file
<source-file
...
@@ -186,14 +190,6 @@
...
@@ -186,14 +190,6 @@
target-dir=
"src/de/appplant/cordova/plugin/notification/receiver"
/>
target-dir=
"src/de/appplant/cordova/plugin/notification/receiver"
/>
<source-file
<source-file
src=
"src/android/notification/receiver/ClearReceiver.java"
target-dir=
"src/de/appplant/cordova/plugin/notification/receiver"
/>
<source-file
src=
"src/android/notification/receiver/TriggerReceiver.java"
target-dir=
"src/de/appplant/cordova/plugin/notification/receiver"
/>
<source-file
src=
"src/android/notification/trigger/DateTrigger.java"
src=
"src/android/notification/trigger/DateTrigger.java"
target-dir=
"src/de/appplant/cordova/plugin/notification/trigger"
/>
target-dir=
"src/de/appplant/cordova/plugin/notification/trigger"
/>
...
@@ -214,14 +210,6 @@
...
@@ -214,14 +210,6 @@
target-dir=
"src/de/appplant/cordova/plugin/notification/util"
/>
target-dir=
"src/de/appplant/cordova/plugin/notification/util"
/>
<source-file
<source-file
src=
"src/android/notification/Action.java"
target-dir=
"src/de/appplant/cordova/plugin/notification"
/>
<source-file
src=
"src/android/notification/ActionGroup.java"
target-dir=
"src/de/appplant/cordova/plugin/notification"
/>
<source-file
src=
"src/android/notification/Builder.java"
src=
"src/android/notification/Builder.java"
target-dir=
"src/de/appplant/cordova/plugin/notification"
/>
target-dir=
"src/de/appplant/cordova/plugin/notification"
/>
...
...
src/android/ClearReceiver.java
View file @
452e572b
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.receiver.AbstractClearReceiver
;
/**
/**
...
@@ -29,7 +30,7 @@ import de.appplant.cordova.plugin.notification.Notification;
...
@@ -29,7 +30,7 @@ import de.appplant.cordova.plugin.notification.Notification;
* notification manually. It un-persists the cleared notification from the
* notification manually. It un-persists the cleared notification from the
* shared preferences.
* shared preferences.
*/
*/
public
class
ClearReceiver
extends
de
.
appplant
.
cordova
.
plugin
.
notification
.
receiver
.
ClearReceiver
{
public
class
ClearReceiver
extends
Abstract
ClearReceiver
{
/**
/**
* Called when a local notification was cleared from outside of the app.
* Called when a local notification was cleared from outside of the app.
...
@@ -38,7 +39,7 @@ public class ClearReceiver extends de.appplant.cordova.plugin.notification.recei
...
@@ -38,7 +39,7 @@ public class ClearReceiver extends de.appplant.cordova.plugin.notification.recei
*/
*/
@Override
@Override
public
void
onClear
(
Notification
notification
)
{
public
void
onClear
(
Notification
notification
)
{
super
.
onClear
(
notification
);
notification
.
clear
(
);
LocalNotification
.
fireEvent
(
"clear"
,
notification
);
LocalNotification
.
fireEvent
(
"clear"
,
notification
);
}
}
...
...
src/android/ClickActivity.java
View file @
452e572b
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
package
de
.
appplant
.
cordova
.
plugin
.
localnotification
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v4.app.RemoteInput
;
import
android.support.v4.app.RemoteInput
;
...
@@ -28,13 +29,15 @@ import org.json.JSONException;
...
@@ -28,13 +29,15 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Options
;
import
de.appplant.cordova.plugin.notification.activity.AbstractClickActivity
;
/**
/**
* The receiver activity is triggered when a notification is clicked by a user.
* The receiver activity is triggered when a notification is clicked by a user.
* The activity calls the background callback and brings the launch intent
* The activity calls the background callback and brings the launch intent
* up to foreground.
* up to foreground.
*/
*/
public
class
ClickActivity
extends
de
.
appplant
.
cordova
.
plugin
.
notification
.
activity
.
ClickActivity
{
public
class
ClickActivity
extends
Abstract
ClickActivity
{
/**
/**
* Called when local notification was clicked by the user.
* Called when local notification was clicked by the user.
...
@@ -44,8 +47,11 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.activ
...
@@ -44,8 +47,11 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.activ
*/
*/
@Override
@Override
public
void
onClick
(
String
action
,
Notification
notification
)
{
public
void
onClick
(
String
action
,
Notification
notification
)
{
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
Bundle
input
=
RemoteInput
.
getResultsFromIntent
(
getIntent
());
Intent
intent
=
getIntent
();
Bundle
bundle
=
intent
.
getExtras
();
Bundle
input
=
RemoteInput
.
getResultsFromIntent
(
intent
);
boolean
doLaunch
=
bundle
.
getBoolean
(
Options
.
EXTRA_LAUNCH
,
true
);
if
(
input
!=
null
)
{
if
(
input
!=
null
)
{
try
{
try
{
...
@@ -55,9 +61,20 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.activ
...
@@ -55,9 +61,20 @@ public class ClickActivity extends de.appplant.cordova.plugin.notification.activ
}
}
}
}
if
(
doLaunch
)
{
launchApp
();
}
LocalNotification
.
fireEvent
(
action
,
notification
,
data
);
LocalNotification
.
fireEvent
(
action
,
notification
,
data
);
super
.
onClick
(
action
,
notification
);
if
(
notification
.
getOptions
().
isSticky
())
return
;
if
(
notification
.
isRepeating
())
{
notification
.
clear
();
}
else
{
notification
.
cancel
();
}
}
}
}
}
src/android/LocalNotification.java
View file @
452e572b
...
@@ -34,10 +34,9 @@ import org.json.JSONObject;
...
@@ -34,10 +34,9 @@ import org.json.JSONObject;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.lang.Exception
;
import
java.lang.Exception
;
import
de.appplant.cordova.plugin.notification.ActionGroup
;
import
de.appplant.cordova.plugin.notification.
action.
ActionGroup
;
import
de.appplant.cordova.plugin.notification.Manager
;
import
de.appplant.cordova.plugin.notification.Manager
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Options
;
import
de.appplant.cordova.plugin.notification.Options
;
...
...
src/android/TriggerReceiver.java
View file @
452e572b
...
@@ -23,6 +23,7 @@ package de.appplant.cordova.plugin.localnotification;
...
@@ -23,6 +23,7 @@ package de.appplant.cordova.plugin.localnotification;
import
de.appplant.cordova.plugin.notification.Builder
;
import
de.appplant.cordova.plugin.notification.Builder
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.receiver.AbstractTriggerReceiver
;
/**
/**
* The alarm receiver is triggered when a scheduled alarm is fired. This class
* The alarm receiver is triggered when a scheduled alarm is fired. This class
...
@@ -30,7 +31,7 @@ import de.appplant.cordova.plugin.notification.Notification;
...
@@ -30,7 +31,7 @@ import de.appplant.cordova.plugin.notification.Notification;
* Android notification bar. The notification uses the default notification
* Android notification bar. The notification uses the default notification
* sound and it vibrates the phone.
* sound and it vibrates the phone.
*/
*/
public
class
TriggerReceiver
extends
de
.
appplant
.
cordova
.
plugin
.
notification
.
receiver
.
TriggerReceiver
{
public
class
TriggerReceiver
extends
Abstract
TriggerReceiver
{
/**
/**
* Called when a local notification was triggered. Does present the local
* Called when a local notification was triggered. Does present the local
...
@@ -41,7 +42,7 @@ public class TriggerReceiver extends de.appplant.cordova.plugin.notification.rec
...
@@ -41,7 +42,7 @@ public class TriggerReceiver extends de.appplant.cordova.plugin.notification.rec
*/
*/
@Override
@Override
public
void
onTrigger
(
Notification
notification
,
boolean
updated
)
{
public
void
onTrigger
(
Notification
notification
,
boolean
updated
)
{
super
.
onTrigger
(
notification
,
updated
);
notification
.
show
(
);
if
(!
updated
)
{
if
(!
updated
)
{
LocalNotification
.
fireEvent
(
"trigger"
,
notification
);
LocalNotification
.
fireEvent
(
"trigger"
,
notification
);
...
...
src/android/notification/Builder.java
View file @
452e572b
...
@@ -33,8 +33,7 @@ import android.support.v4.app.NotificationCompat.MessagingStyle.Message;
...
@@ -33,8 +33,7 @@ import android.support.v4.app.NotificationCompat.MessagingStyle.Message;
import
java.util.List
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.Random
;
import
de.appplant.cordova.plugin.notification.activity.ClickActivity
;
import
de.appplant.cordova.plugin.notification.action.Action
;
import
de.appplant.cordova.plugin.notification.receiver.ClearReceiver
;
/**
/**
* Builder class for local notifications. Build fully configured local
* Builder class for local notifications. Build fully configured local
...
@@ -49,10 +48,10 @@ public final class Builder {
...
@@ -49,10 +48,10 @@ public final class Builder {
private
final
Options
options
;
private
final
Options
options
;
// Receiver to handle the clear event
// Receiver to handle the clear event
private
Class
<?>
clearReceiver
=
ClearReceiver
.
class
;
private
Class
<?>
clearReceiver
;
// Activity to handle the click event
// Activity to handle the click event
private
Class
<?>
clickActivity
=
ClickActivity
.
class
;
private
Class
<?>
clickActivity
;
/**
/**
* Constructor
* Constructor
...
@@ -101,11 +100,12 @@ public final class Builder {
...
@@ -101,11 +100,12 @@ public final class Builder {
Bundle
extras
=
new
Bundle
();
Bundle
extras
=
new
Bundle
();
extras
.
putString
(
Options
.
EXTRA
,
options
.
toString
());
extras
.
putString
(
Options
.
EXTRA
,
options
.
toString
());
extras
.
putString
(
Options
.
SOUND_EXTRA
,
sound
.
toString
());
extras
.
putString
(
Options
.
EXTRA_SOUND
,
sound
.
toString
());
builder
=
new
NotificationCompat
.
Builder
(
context
,
Manager
.
CHANNEL_ID
)
builder
=
new
NotificationCompat
.
Builder
(
context
,
Manager
.
CHANNEL_ID
)
.
setDefaults
(
options
.
getDefaults
())
.
setDefaults
(
options
.
getDefaults
())
.
setExtras
(
extras
)
.
setExtras
(
extras
)
.
setOnlyAlertOnce
(
true
)
.
setChannelId
(
options
.
getChannel
())
.
setChannelId
(
options
.
getChannel
())
.
setContentTitle
(
options
.
getTitle
())
.
setContentTitle
(
options
.
getTitle
())
.
setContentText
(
options
.
getText
())
.
setContentText
(
options
.
getText
())
...
@@ -288,7 +288,8 @@ public final class Builder {
...
@@ -288,7 +288,8 @@ public final class Builder {
Intent
intent
=
new
Intent
(
context
,
clickActivity
)
Intent
intent
=
new
Intent
(
context
,
clickActivity
)
.
putExtra
(
Options
.
EXTRA
,
options
.
toString
())
.
putExtra
(
Options
.
EXTRA
,
options
.
toString
())
.
putExtra
(
Action
.
EXTRA
,
Action
.
CLICK_ACTION_ID
)
.
putExtra
(
Options
.
EXTRA_LAUNCH
,
options
.
isLaunchingApp
())
.
putExtra
(
Action
.
EXTRA_ID
,
Action
.
CLICK_ACTION_ID
)
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
int
reqCode
=
new
Random
().
nextInt
();
int
reqCode
=
new
Random
().
nextInt
();
...
@@ -333,7 +334,8 @@ public final class Builder {
...
@@ -333,7 +334,8 @@ public final class Builder {
private
PendingIntent
getPendingIntentForAction
(
Action
action
)
{
private
PendingIntent
getPendingIntentForAction
(
Action
action
)
{
Intent
intent
=
new
Intent
(
context
,
clickActivity
)
Intent
intent
=
new
Intent
(
context
,
clickActivity
)
.
putExtra
(
Options
.
EXTRA
,
options
.
toString
())
.
putExtra
(
Options
.
EXTRA
,
options
.
toString
())
.
putExtra
(
Action
.
EXTRA
,
action
.
getId
())
.
putExtra
(
Options
.
EXTRA_LAUNCH
,
action
.
isLaunchingApp
())
.
putExtra
(
Action
.
EXTRA_ID
,
action
.
getId
())
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NO_HISTORY
);
int
requestCode
=
new
Random
().
nextInt
();
int
requestCode
=
new
Random
().
nextInt
();
...
...
src/android/notification/Manager.java
View file @
452e572b
...
@@ -28,22 +28,9 @@ import android.app.PendingIntent;
...
@@ -28,22 +28,9 @@ import android.app.PendingIntent;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
import
android.os.Build
;
import
android.support.v4.app.NotificationManagerCompat
;
import
android.support.v4.app.NotificationManagerCompat
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
de.appplant.cordova.plugin.notification.receiver.TriggerReceiver
;
import
static
android
.
os
.
Build
.
VERSION
.
SDK_INT
;
import
static
android
.
os
.
Build
.
VERSION
.
SDK_INT
;
import
static
android
.
os
.
Build
.
VERSION_CODES
.
O
;
import
static
android
.
os
.
Build
.
VERSION_CODES
.
O
;
...
...
src/android/notification/Notification.java
View file @
452e572b
...
@@ -23,23 +23,16 @@ package de.appplant.cordova.plugin.notification;
...
@@ -23,23 +23,16 @@ package de.appplant.cordova.plugin.notification;
import
android.app.AlarmManager
;
import
android.app.AlarmManager
;
import
android.app.NotificationChannelGroup
;
import
android.app.NotificationManager
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.support.v4.app.NotificationCompat
;
import
android.support.v4.app.NotificationCompat
;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.util.Date
;
import
de.appplant.cordova.plugin.notification.receiver.TriggerReceiver
;
/**
/**
* Wrapper class around OS notification class. Handles basic operations
* Wrapper class around OS notification class. Handles basic operations
* like show, delete, cancel for a single local notification instance.
* like show, delete, cancel for a single local notification instance.
...
@@ -193,7 +186,7 @@ public final class Notification {
...
@@ -193,7 +186,7 @@ public final class Notification {
if
(
builder
==
null
)
if
(
builder
==
null
)
return
;
return
;
String
sound
=
builder
.
getExtras
().
getString
(
Options
.
SOUND_EXTRA
);
String
sound
=
builder
.
getExtras
().
getString
(
Options
.
EXTRA_SOUND
);
Uri
soundUri
=
Uri
.
parse
(
sound
);
Uri
soundUri
=
Uri
.
parse
(
sound
);
context
.
grantUriPermission
(
"com.android.systemui"
,
soundUri
,
context
.
grantUriPermission
(
"com.android.systemui"
,
soundUri
,
...
...
src/android/notification/Options.java
View file @
452e572b
...
@@ -36,6 +36,8 @@ import java.util.ArrayList;
...
@@ -36,6 +36,8 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
de.appplant.cordova.plugin.notification.action.Action
;
import
de.appplant.cordova.plugin.notification.action.ActionGroup
;
import
de.appplant.cordova.plugin.notification.util.AssetUtil
;
import
de.appplant.cordova.plugin.notification.util.AssetUtil
;
import
static
android
.
support
.
v4
.
app
.
NotificationCompat
.
DEFAULT_LIGHTS
;
import
static
android
.
support
.
v4
.
app
.
NotificationCompat
.
DEFAULT_LIGHTS
;
...
@@ -57,7 +59,10 @@ public final class Options {
...
@@ -57,7 +59,10 @@ public final class Options {
public
static
final
String
EXTRA
=
"NOTIFICATION_OPTIONS"
;
public
static
final
String
EXTRA
=
"NOTIFICATION_OPTIONS"
;
// Key name for bundled sound extra
// Key name for bundled sound extra
public
static
final
String
SOUND_EXTRA
=
"NOTIFICATION_SOUND"
;
static
final
String
EXTRA_SOUND
=
"NOTIFICATION_SOUND"
;
// Key name for bundled launch extra
public
static
final
String
EXTRA_LAUNCH
=
"NOTIFICATION_LAUNCH"
;
// Default icon path
// Default icon path
private
static
final
String
DEFAULT_ICON
=
"res://icon"
;
private
static
final
String
DEFAULT_ICON
=
"res://icon"
;
...
@@ -176,6 +181,13 @@ public final class Options {
...
@@ -176,6 +181,13 @@ public final class Options {
}
}
/**
/**
* launch flag for the notification.
*/
boolean
isLaunchingApp
()
{
return
options
.
optBoolean
(
"launch"
,
true
);
}
/**
* The channel id of that notification.
* The channel id of that notification.
*/
*/
String
getChannel
()
{
String
getChannel
()
{
...
...
src/android/notification/Request.java
View file @
452e572b
...
@@ -30,12 +30,16 @@ import java.util.Calendar;
...
@@ -30,12 +30,16 @@ import java.util.Calendar;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
de.appplant.cordova.plugin.notification.trigger.MatchTrigger
;
import
de.appplant.cordova.plugin.notification.trigger.DateTrigger
;
import
de.appplant.cordova.plugin.notification.trigger.DateTrigger
;
import
de.appplant.cordova.plugin.notification.trigger.IntervalTrigger
;
import
de.appplant.cordova.plugin.notification.trigger.IntervalTrigger
;
import
de.appplant.cordova.plugin.notification.trigger.MatchTrigger
;
import
static
de
.
appplant
.
cordova
.
plugin
.
notification
.
trigger
.
IntervalTrigger
.
Unit
;
import
static
de
.
appplant
.
cordova
.
plugin
.
notification
.
trigger
.
IntervalTrigger
.
Unit
;
/**
* An object you use to specify a notification’s content and the condition
* that triggers its delivery.
*/
public
final
class
Request
{
public
final
class
Request
{
// Key name for bundled extras
// Key name for bundled extras
...
...
src/android/notification/Action.java
→
src/android/notification/
action/
Action.java
View file @
452e572b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
de
.
appplant
.
cordova
.
plugin
.
notification
;
package
de
.
appplant
.
cordova
.
plugin
.
notification
.
action
;
import
android.content.Context
;
import
android.content.Context
;
import
android.support.v4.app.RemoteInput
;
import
android.support.v4.app.RemoteInput
;
...
@@ -38,7 +38,7 @@ import de.appplant.cordova.plugin.notification.util.AssetUtil;
...
@@ -38,7 +38,7 @@ import de.appplant.cordova.plugin.notification.util.AssetUtil;
public
final
class
Action
{
public
final
class
Action
{
// Key name for bundled extras
// Key name for bundled extras
public
static
final
String
EXTRA
=
"NOTIFICATION_ACTION_ID"
;
public
static
final
String
EXTRA
_ID
=
"NOTIFICATION_ACTION_ID"
;
// The id for the click action
// The id for the click action
public
static
final
String
CLICK_ACTION_ID
=
"click"
;
public
static
final
String
CLICK_ACTION_ID
=
"click"
;
...
@@ -100,7 +100,7 @@ public final class Action {
...
@@ -100,7 +100,7 @@ public final class Action {
/**
/**
* Gets the type for the action.
* Gets the type for the action.
*/
*/
boolean
isWithInput
()
{
public
boolean
isWithInput
()
{
String
type
=
options
.
optString
(
"type"
);
String
type
=
options
.
optString
(
"type"
);
return
type
.
equals
(
"input"
);
return
type
.
equals
(
"input"
);
}
}
...
@@ -108,7 +108,7 @@ public final class Action {
...
@@ -108,7 +108,7 @@ public final class Action {
/**
/**
* Gets the input config in case of the action is of type input.
* Gets the input config in case of the action is of type input.
*/
*/
RemoteInput
getInput
()
{
public
RemoteInput
getInput
()
{
return
new
RemoteInput
.
Builder
(
getId
())
return
new
RemoteInput
.
Builder
(
getId
())
.
setLabel
(
options
.
optString
(
"emptyText"
))
.
setLabel
(
options
.
optString
(
"emptyText"
))
.
setAllowFreeFormInput
(
options
.
optBoolean
(
"editable"
,
true
))
.
setAllowFreeFormInput
(
options
.
optBoolean
(
"editable"
,
true
))
...
...
src/android/notification/ActionGroup.java
→
src/android/notification/
action/
ActionGroup.java
View file @
452e572b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
de
.
appplant
.
cordova
.
plugin
.
notification
;
package
de
.
appplant
.
cordova
.
plugin
.
notification
.
action
;
import
android.content.Context
;
import
android.content.Context
;
import
android.util.Log
;
import
android.util.Log
;
...
@@ -57,7 +57,7 @@ public final class ActionGroup {
...
@@ -57,7 +57,7 @@ public final class ActionGroup {
*
*
* @return Null if no group was found.
* @return Null if no group was found.
*/
*/
static
ActionGroup
lookup
(
String
id
)
{
public
static
ActionGroup
lookup
(
String
id
)
{
return
groups
.
get
(
id
);
return
groups
.
get
(
id
);
}
}
...
...
src/android/notification/activity/AbstractClickActivity.java
View file @
452e572b
...
@@ -29,11 +29,11 @@ import android.os.Bundle;
...
@@ -29,11 +29,11 @@ import android.os.Bundle;
import
org.json.JSONException
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
de.appplant.cordova.plugin.notification.Action
;
import
de.appplant.cordova.plugin.notification.
action.
Action
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Notification
;
import
de.appplant.cordova.plugin.notification.Options
;
import
de.appplant.cordova.plugin.notification.Options
;
import
static
de
.
appplant
.
cordova
.
plugin
.
notification
.
Action
.
CLICK_ACTION_ID
;
import
static
de
.
appplant
.
cordova
.
plugin
.
notification
.
action
.
Action
.
CLICK_ACTION_ID
;
/**
/**
* Abstract content receiver activity for local notifications. Creates the
* Abstract content receiver activity for local notifications. Creates the
...
@@ -55,7 +55,7 @@ abstract public class AbstractClickActivity extends Activity {
...
@@ -55,7 +55,7 @@ abstract public class AbstractClickActivity extends Activity {
Context
context
=
getApplicationContext
();
Context
context
=
getApplicationContext
();
try
{
try
{
String
action
=
bundle
.
getString
(
Action
.
EXTRA
,
CLICK_ACTION_ID
);
String
action
=
bundle
.
getString
(
Action
.
EXTRA
_ID
,
CLICK_ACTION_ID
);
String
data
=
bundle
.
getString
(
Options
.
EXTRA
);
String
data
=
bundle
.
getString
(
Options
.
EXTRA
);
JSONObject
dict
=
new
JSONObject
(
data
);
JSONObject
dict
=
new
JSONObject
(
data
);
Options
options
=
new
Options
(
context
,
dict
);
Options
options
=
new
Options
(
context
,
dict
);
...
...
www/local-notification-util.js
View file @
452e572b
...
@@ -67,6 +67,7 @@ exports.applyPlatformSpecificOptions = function () {
...
@@ -67,6 +67,7 @@ exports.applyPlatformSpecificOptions = function () {
defaults
.
defaults
=
0
;
defaults
.
defaults
=
0
;
defaults
.
priority
=
0
;
defaults
.
priority
=
0
;
defaults
.
channel
=
undefined
;
defaults
.
channel
=
undefined
;
defaults
.
launch
=
true
;
break
;
break
;
}
}
};
};
...
...
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