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
46b8f4f6
Commit
46b8f4f6
authored
Oct 30, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set icon property to be null by default
parent
9a6d89b5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
40 deletions
+23
-40
LocalNotification.java
src/android/LocalNotification.java
+1
-2
Builder.java
src/android/notification/Builder.java
+3
-4
Options.java
src/android/notification/Options.java
+13
-32
local-notification-util.js
www/local-notification-util.js
+6
-2
No files found.
src/android/LocalNotification.java
View file @
46b8f4f6
...
@@ -293,8 +293,7 @@ public class LocalNotification extends CordovaPlugin {
...
@@ -293,8 +293,7 @@ public class LocalNotification extends CordovaPlugin {
/**
/**
* Update multiple local notifications.
* Update multiple local notifications.
*
*
* @param updates
* @param updates Notification properties including their IDs
* Notification properties including their IDs
*/
*/
private
void
update
(
JSONArray
updates
)
{
private
void
update
(
JSONArray
updates
)
{
for
(
int
i
=
0
;
i
<
updates
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
updates
.
length
();
i
++)
{
...
...
src/android/notification/Builder.java
View file @
46b8f4f6
...
@@ -116,7 +116,6 @@ public final class Builder {
...
@@ -116,7 +116,6 @@ public final class Builder {
return
new
Notification
(
context
,
options
);
return
new
Notification
(
context
,
options
);
}
}
int
smallIcon
=
options
.
getSmallIcon
();
Uri
sound
=
options
.
getSound
();
Uri
sound
=
options
.
getSound
();
Bundle
extras
=
new
Bundle
();
Bundle
extras
=
new
Bundle
();
...
@@ -151,11 +150,11 @@ public final class Builder {
...
@@ -151,11 +150,11 @@ public final class Builder {
options
.
isIndeterminateProgress
());
options
.
isIndeterminateProgress
());
}
}
if
(
smallIcon
!=
0
)
{
if
(
options
.
hasLargeIcon
()
)
{
builder
.
setSmallIcon
(
smallIcon
);
builder
.
setSmallIcon
(
options
.
getSmallIcon
()
);
builder
.
setLargeIcon
(
options
.
getLargeIcon
());
builder
.
setLargeIcon
(
options
.
getLargeIcon
());
}
else
{
}
else
{
builder
.
setSmallIcon
(
options
.
getIcon
());
builder
.
setSmallIcon
(
options
.
get
Small
Icon
());
}
}
applyStyle
(
builder
);
applyStyle
(
builder
);
...
...
src/android/notification/Options.java
View file @
46b8f4f6
...
@@ -332,27 +332,21 @@ public final class Options {
...
@@ -332,27 +332,21 @@ public final class Options {
return
assets
.
parse
(
options
.
optString
(
"sound"
,
null
));
return
assets
.
parse
(
options
.
optString
(
"sound"
,
null
));
}
}
public
long
[]
getVibrate
()
{
/**
JSONArray
array
=
options
.
optJSONArray
(
"vibrate"
);
* Icon resource ID for the local notification.
*/
if
(
array
==
null
)
public
boolean
hasLargeIcon
()
{
return
null
;
String
icon
=
options
.
optString
(
"icon"
,
null
);
return
icon
!=
null
;
long
[]
rv
=
new
long
[
array
.
length
()];
for
(
int
i
=
0
;
i
<
array
.
length
();
i
++)
{
rv
[
i
]
=
array
.
optInt
(
i
);
}
return
rv
;
}
}
/**
/**
* Icon bitmap for the local notification.
* Icon bitmap for the local notification.
*/
*/
Bitmap
getLargeIcon
()
{
Bitmap
getLargeIcon
()
{
Uri
uri
=
assets
.
parse
(
options
.
optString
(
"icon"
,
DEFAULT_ICON
));
String
icon
=
options
.
optString
(
"icon"
,
null
);
Bitmap
bmp
=
null
;
Uri
uri
=
assets
.
parse
(
icon
);
Bitmap
bmp
=
null
;
try
{
try
{
bmp
=
assets
.
getIconFromUri
(
uri
);
bmp
=
assets
.
getIconFromUri
(
uri
);
...
@@ -364,16 +358,11 @@ public final class Options {
...
@@ -364,16 +358,11 @@ public final class Options {
}
}
/**
/**
*
I
con resource ID for the local notification.
*
Small i
con resource ID for the local notification.
*/
*/
public
int
getIcon
()
{
int
getSmallIcon
()
{
String
icon
=
options
.
optString
(
"icon"
,
DEFAULT_ICON
);
String
icon
=
options
.
optString
(
"smallIcon"
,
DEFAULT_ICON
);
int
resId
=
assets
.
getResId
(
icon
);
int
resId
=
assets
.
getResId
(
icon
);
if
(
resId
==
0
)
{
resId
=
getSmallIcon
();
}
if
(
resId
==
0
)
{
if
(
resId
==
0
)
{
resId
=
assets
.
getResId
(
DEFAULT_ICON
);
resId
=
assets
.
getResId
(
DEFAULT_ICON
);
...
@@ -391,14 +380,6 @@ public final class Options {
...
@@ -391,14 +380,6 @@ public final class Options {
}
}
/**
/**
* Small icon resource ID for the local notification.
*/
int
getSmallIcon
()
{
String
icon
=
options
.
optString
(
"smallIcon"
,
""
);
return
assets
.
getResId
(
icon
);
}
/**
* If the phone should vibrate.
* If the phone should vibrate.
*/
*/
private
boolean
isWithVibration
()
{
private
boolean
isWithVibration
()
{
...
...
www/local-notification-util.js
View file @
46b8f4f6
...
@@ -55,8 +55,8 @@ exports.applyPlatformSpecificOptions = function () {
...
@@ -55,8 +55,8 @@ exports.applyPlatformSpecificOptions = function () {
defaults
.
group
=
null
;
defaults
.
group
=
null
;
defaults
.
groupSummary
=
false
;
defaults
.
groupSummary
=
false
;
defaults
.
summary
=
null
;
defaults
.
summary
=
null
;
defaults
.
icon
=
'res://icon'
;
defaults
.
icon
=
null
;
defaults
.
smallIcon
=
null
;
defaults
.
smallIcon
=
'res://icon'
;
defaults
.
sticky
=
false
;
defaults
.
sticky
=
false
;
defaults
.
autoClear
=
true
;
defaults
.
autoClear
=
true
;
defaults
.
led
=
true
;
defaults
.
led
=
true
;
...
@@ -146,6 +146,10 @@ exports.convertProperties = function (options) {
...
@@ -146,6 +146,10 @@ exports.convertProperties = function (options) {
options
.
defaults
=
parseToInt
(
'defaults'
,
options
);
options
.
defaults
=
parseToInt
(
'defaults'
,
options
);
}
}
if
(
options
.
smallIcon
&&
!
options
.
smallIcon
.
match
(
/^res:/
))
{
console
.
warn
(
'Property "smallIcon" must be of kind res://...'
);
}
options
.
data
=
JSON
.
stringify
(
options
.
data
);
options
.
data
=
JSON
.
stringify
(
options
.
data
);
this
.
convertTrigger
(
options
);
this
.
convertTrigger
(
options
);
...
...
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