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
16a38ade
Commit
16a38ade
authored
Jan 16, 2015
by
PKnittel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some Issues with Uri-parsing
Added more update-options Revised try/catch blocks
parent
992478a2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
20 deletions
+23
-20
Asset.java
src/android/notification/Asset.java
+1
-1
Manager.java
src/android/notification/Manager.java
+2
-2
NotificationWrapper.java
src/android/notification/NotificationWrapper.java
+18
-1
Options.java
src/android/notification/Options.java
+2
-16
No files found.
src/android/notification/Asset.java
View file @
16a38ade
...
@@ -114,7 +114,7 @@ public class Asset {
...
@@ -114,7 +114,7 @@ public class Asset {
}
else
if
(
path
.
startsWith
(
"http"
)){
}
else
if
(
path
.
startsWith
(
"http"
)){
return
getUriForHTTP
(
path
);
return
getUriForHTTP
(
path
);
}
}
return
Uri
.
parse
(
path
)
;
return
Uri
.
EMPTY
;
}
}
...
...
src/android/notification/Manager.java
View file @
16a38ade
...
@@ -281,9 +281,9 @@ public class Manager {
...
@@ -281,9 +281,9 @@ public class Manager {
/**
/**
* Retrieves a list with all currently pending notification JSONObject
.
* Retrieves a list with all currently pending notification JSONObject
s that matches with the given String-Array
*
*
* @return JSONArray with
all notification-JSONObjects
* @return JSONArray with
notification-JSONObjects
*/
*/
public
JSONArray
getAll
(
JSONArray
ids
){
public
JSONArray
getAll
(
JSONArray
ids
){
SharedPreferences
settings
=
getSharedPreferences
();
SharedPreferences
settings
=
getSharedPreferences
();
...
...
src/android/notification/NotificationWrapper.java
View file @
16a38ade
...
@@ -37,6 +37,7 @@ import android.content.SharedPreferences;
...
@@ -37,6 +37,7 @@ import android.content.SharedPreferences;
import
android.content.SharedPreferences.Editor
;
import
android.content.SharedPreferences.Editor
;
import
android.os.Build
;
import
android.os.Build
;
import
android.support.v4.app.NotificationCompat.Builder
;
import
android.support.v4.app.NotificationCompat.Builder
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
/**
/**
...
@@ -143,7 +144,7 @@ public class NotificationWrapper {
...
@@ -143,7 +144,7 @@ public class NotificationWrapper {
try
{
try
{
arguments
=
new
JSONObject
(
alarms
.
get
(
id
).
toString
());
arguments
=
new
JSONObject
(
alarms
.
get
(
id
).
toString
());
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
(
);
Log
.
e
(
"NotificationWrapper"
,
"Update failed. No Notification available for the given id: "
+
id
);
return
;
return
;
}
}
arguments
=
updateArguments
(
arguments
,
updates
);
arguments
=
updateArguments
(
arguments
,
updates
);
...
@@ -188,6 +189,7 @@ public class NotificationWrapper {
...
@@ -188,6 +189,7 @@ public class NotificationWrapper {
unpersist
(
notificationId
);
unpersist
(
notificationId
);
}
}
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
unpersist
(
notificationId
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
;
return
;
}
}
...
@@ -340,6 +342,21 @@ public class NotificationWrapper {
...
@@ -340,6 +342,21 @@ public class NotificationWrapper {
if
(!
updates
.
isNull
(
"icon"
)){
if
(!
updates
.
isNull
(
"icon"
)){
arguments
.
put
(
"icon"
,
updates
.
get
(
"icon"
));
arguments
.
put
(
"icon"
,
updates
.
get
(
"icon"
));
}
}
if
(!
updates
.
isNull
(
"date"
)){
arguments
.
put
(
"date"
,
updates
.
get
(
"date"
));
}
if
(!
updates
.
isNull
(
"repeat"
)){
arguments
.
put
(
"repeat"
,
updates
.
get
(
"repeat"
));
}
if
(!
updates
.
isNull
(
"json"
)){
arguments
.
put
(
"json"
,
updates
.
get
(
"json"
));
}
if
(!
updates
.
isNull
(
"autoCancel"
)){
arguments
.
put
(
"autoCancel"
,
updates
.
get
(
"autoCancel"
));
}
if
(!
updates
.
isNull
(
"ongoing"
)){
arguments
.
put
(
"ongoing"
,
updates
.
get
(
"ongoing"
));
}
}
catch
(
JSONException
jse
){
}
catch
(
JSONException
jse
){
jse
.
printStackTrace
();
jse
.
printStackTrace
();
}
}
...
...
src/android/notification/Options.java
View file @
16a38ade
...
@@ -164,18 +164,10 @@ public class Options {
...
@@ -164,18 +164,10 @@ public class Options {
Uri
iconUri
=
null
;
Uri
iconUri
=
null
;
try
{
try
{
iconUri
=
Uri
.
parse
(
options
.
optString
(
"iconUri"
));
iconUri
=
Uri
.
parse
(
options
.
optString
(
"iconUri"
));
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
if
(
iconUri
!=
null
)
{
bmp
=
getIconFromUri
(
iconUri
);
bmp
=
getIconFromUri
(
iconUri
);
}
}
catch
(
Exception
e
){
if
(
bmp
==
null
)
{
bmp
=
getIconFromRes
(
icon
);
bmp
=
getIconFromRes
(
icon
);
}
}
return
bmp
;
return
bmp
;
}
}
...
@@ -317,23 +309,17 @@ public class Options {
...
@@ -317,23 +309,17 @@ public class Options {
* @return
* @return
* The corresponding bitmap
* The corresponding bitmap
*/
*/
private
Bitmap
getIconFromUri
(
Uri
uri
)
{
private
Bitmap
getIconFromUri
(
Uri
uri
)
throws
IOException
{
Bitmap
bmp
=
null
;
Bitmap
bmp
=
null
;
try
{
InputStream
input
=
context
.
getContentResolver
().
openInputStream
(
uri
);
InputStream
input
=
context
.
getContentResolver
().
openInputStream
(
uri
);
bmp
=
BitmapFactory
.
decodeStream
(
input
);
bmp
=
BitmapFactory
.
decodeStream
(
input
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
bmp
;
return
bmp
;
}
}
/**
/**
* Function to set the value of "initialDate" in the JSONArray
* Function to set the value of "initialDate" in the JSONArray
* @param args The given JSONArray
* @return A new JSONArray with the parameter "initialDate" set.
*/
*/
public
void
setInitDate
(){
public
void
setInitDate
(){
long
initialDate
=
options
.
optLong
(
"date"
,
0
)
*
1000
;
long
initialDate
=
options
.
optLong
(
"date"
,
0
)
*
1000
;
...
...
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