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
78bf5452
Commit
78bf5452
authored
Aug 11, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle action button click events
parent
b01a1375
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
20 deletions
+34
-20
LocalNotificationProxy.js
src/windows/LocalNotificationProxy.js
+4
-2
Button.cs
...nProxy/LocalNotificationProxy/LocalNotification/Button.cs
+0
-14
Content.cs
...Proxy/LocalNotificationProxy/LocalNotification/Content.cs
+5
-1
Options.cs
...Proxy/LocalNotificationProxy/LocalNotification/Options.cs
+25
-3
No files found.
src/windows/LocalNotificationProxy.js
View file @
78bf5452
...
...
@@ -104,8 +104,10 @@ exports.schedule = function (success, error, args) {
* @return [ Void ]
*/
exports
.
clicked
=
function
(
xml
)
{
var
notification
=
LocalNotification
.
Options
.
parse
(
xml
);
cordova
.
plugins
.
notification
.
local
.
core
.
fireEvent
(
'click'
,
notification
);
var
toast
=
LocalNotification
.
Options
.
parse
(
xml
),
event
=
toast
.
action
||
'click'
;
cordova
.
plugins
.
notification
.
local
.
core
.
fireEvent
(
event
,
toast
);
};
// Handle onclick event
...
...
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Button.cs
View file @
78bf5452
...
...
@@ -39,19 +39,5 @@ namespace LocalNotificationProxy.LocalNotification
/// Gets or sets a value indicating whether to launch the app.
/// </summary>
public
bool
Launch
{
get
;
set
;
}
/// <summary>
/// Gets the parsed toast button.
/// </summary>
internal
ToastButton
ToastButton
{
get
{
return
new
ToastButton
(
this
.
Title
,
this
.
ID
)
{
ActivationType
=
this
.
Launch
?
ToastActivationType
.
Foreground
:
ToastActivationType
.
Background
};
}
}
}
}
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Content.cs
View file @
78bf5452
...
...
@@ -178,7 +178,11 @@
foreach
(
var
action
in
this
.
Options
.
Buttons
)
{
buttons
.
Add
(
action
.
ToastButton
);
buttons
.
Add
(
new
ToastButton
(
action
.
Title
,
this
.
Options
.
GetXml
(
action
.
ID
))
{
ActivationType
=
action
.
Launch
?
ToastActivationType
.
Foreground
:
ToastActivationType
.
Background
});
}
return
buttons
;
...
...
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Options.cs
View file @
78bf5452
...
...
@@ -21,14 +21,16 @@
namespace
LocalNotificationProxy.LocalNotification
{
using
System
;
using
System.Collections.Generic
;
using
Microsoft.Toolkit.Uwp.Notifications
;
using
Windows.Data.Xml.Dom
;
public
sealed
class
Options
{
/// <summary>
/// Gets notification event.
/// </summary>
public
string
Action
{
get
;
private
set
;
}
=
"click"
;
/// <summary>
/// Gets or sets notification ID.
/// </summary>
public
int
ID
{
get
;
set
;
}
...
...
@@ -130,6 +132,11 @@ namespace LocalNotificationProxy.LocalNotification
options
.
Data
=
node
.
GetAttribute
(
"data"
);
}
if
(
node
.
GetAttributeNode
(
"action"
)
!=
null
)
{
options
.
Action
=
node
.
GetAttribute
(
"action"
);
}
return
options
;
}
...
...
@@ -139,6 +146,16 @@ namespace LocalNotificationProxy.LocalNotification
/// <returns>Element with all property values set as attributes.</returns>
public
string
GetXml
()
{
return
this
.
GetXml
(
null
);
}
/// <summary>
/// Gets the instance as an serialized xml element.
/// </summary>
/// <param name="action">Optional (internal) event name.</param>
/// <returns>Element with all property values set as attributes.</returns>
internal
string
GetXml
(
string
action
)
{
var
node
=
new
XmlDocument
().
CreateElement
(
"options"
);
node
.
SetAttribute
(
"id"
,
this
.
ID
.
ToString
());
...
...
@@ -175,6 +192,11 @@ namespace LocalNotificationProxy.LocalNotification
node
.
SetAttribute
(
"data"
,
this
.
Data
);
}
if
(
action
!=
null
)
{
node
.
SetAttribute
(
"action"
,
action
);
}
return
node
.
GetXml
();
}
}
...
...
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