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
15bb160f
Commit
15bb160f
authored
Aug 09, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial basic support for action buttons
parent
df93be14
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
5 deletions
+110
-5
LocalNotificationProxy.js
src/windows/LocalNotificationProxy.js
+17
-1
Builder.cs
...Proxy/LocalNotificationProxy/LocalNotification/Builder.cs
+10
-0
Button.cs
...nProxy/LocalNotificationProxy/LocalNotification/Button.cs
+57
-0
Options.cs
...Proxy/LocalNotificationProxy/LocalNotification/Options.cs
+24
-3
LocalNotificationProxy.csproj
...roxy/LocalNotificationProxy/LocalNotificationProxy.csproj
+1
-0
local-notification-util.js
www/local-notification-util.js
+1
-1
No files found.
src/windows/LocalNotificationProxy.js
View file @
15bb160f
...
...
@@ -60,7 +60,7 @@ exports.request = function (success, error) {
* @return [ Void ]
*/
exports
.
schedule
=
function
(
success
,
error
,
args
)
{
var
options
=
[];
var
options
=
[]
,
buttons
=
[]
;
for
(
var
i
=
0
,
props
,
opts
;
i
<
args
.
length
;
i
++
)
{
props
=
args
[
i
];
...
...
@@ -72,6 +72,22 @@ exports.schedule = function (success, error, args) {
}
}
for
(
var
j
=
0
,
action
;
j
<
props
.
actions
.
length
;
j
++
)
{
action
=
props
.
actions
[
j
];
if
(
!
action
.
type
||
action
.
type
==
'button'
)
{
var
button
=
new
LocalNotification
.
Button
();
button
.
id
=
action
.
id
;
button
.
title
=
action
.
title
;
button
.
launch
=
action
.
launch
;
buttons
.
push
(
button
);
}
}
opts
.
buttons
=
buttons
;
options
.
push
(
opts
);
}
...
...
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Builder.cs
View file @
15bb160f
...
...
@@ -75,6 +75,11 @@ namespace LocalNotificationProxy.LocalNotification
AppLogoOverride
=
this
.
Options
.
ToastLogo
}
},
Actions
=
new
ToastActionsCustom
()
{
Buttons
=
{
}
}
};
...
...
@@ -83,6 +88,11 @@ namespace LocalNotificationProxy.LocalNotification
toast
.
Visual
.
BindingGeneric
.
Children
.
Add
(
image
);
}
foreach
(
var
btn
in
this
.
Options
.
ToastButtons
)
{
(
toast
.
Actions
as
ToastActionsCustom
).
Buttons
.
Add
(
btn
);
}
var
xml
=
toast
.
GetXml
();
var
at
=
this
.
Options
.
TriggerDate
;
ScheduledToastNotification
notification
;
...
...
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Button.cs
0 → 100644
View file @
15bb160f
/*
* Apache 2.0 License
*
* Copyright (c) Sebastian Katzer 2017
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apache License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://opensource.org/licenses/Apache-2.0/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*/
namespace
LocalNotificationProxy.LocalNotification
{
using
Microsoft.Toolkit.Uwp.Notifications
;
public
sealed
class
Button
{
/// <summary>
/// Gets or sets button ID.
/// </summary>
public
string
ID
{
get
;
set
;
}
/// <summary>
/// Gets or sets button title.
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 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/Options.cs
View file @
15bb160f
...
...
@@ -22,14 +22,12 @@
namespace
LocalNotificationProxy.LocalNotification
{
using
System
;
using
System.Collections.Generic
;
using
Microsoft.Toolkit.Uwp.Notifications
;
using
Windows.Data.Xml.Dom
;
using
System.Collections
;
using
System.Collections.Generic
;
public
sealed
class
Options
{
/// <summary>
/// Gets or sets notification ID.
/// </summary>
...
...
@@ -81,6 +79,11 @@ namespace LocalNotificationProxy.LocalNotification
public
string
[]
Attachments
{
get
;
set
;
}
/// <summary>
/// Gets or sets the notification buttons.
/// </summary>
public
Button
[]
Buttons
{
get
;
set
;
}
/// <summary>
/// Gets the date when to trigger the notification.
/// </summary>
internal
DateTime
TriggerDate
...
...
@@ -304,6 +307,24 @@ namespace LocalNotificationProxy.LocalNotification
}
/// <summary>
/// Gets all toast buttons.
/// </summary>
internal
List
<
ToastButton
>
ToastButtons
{
get
{
var
buttons
=
new
List
<
ToastButton
>();
foreach
(
var
action
in
this
.
Buttons
)
{
buttons
.
Add
(
action
.
ToastButton
);
}
return
buttons
;
}
}
/// <summary>
/// Deserializes the XML string into an instance of Options.
/// </summary>
/// <param name="identifier">The serialized instance of Options as an xml string.</param>
...
...
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotificationProxy.csproj
View file @
15bb160f
...
...
@@ -112,6 +112,7 @@
<ItemGroup>
<Compile Include="LocalNotificationProxy.cs" />
<Compile Include="LocalNotification\Builder.cs" />
<Compile Include="LocalNotification\Button.cs" />
<Compile Include="LocalNotification\Options.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
...
...
www/local-notification-util.js
View file @
15bb160f
...
...
@@ -33,7 +33,7 @@ exports._defaults = {
data
:
undefined
,
every
:
undefined
,
at
:
undefined
,
actions
:
undefined
,
actions
:
[]
,
actionGroupId
:
undefined
,
attachments
:
[]
};
...
...
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