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
94eaef3e
Commit
94eaef3e
authored
Oct 22, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic WP8 support through LiveTiles
parent
24360db0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
0 deletions
+141
-0
plugin.xml
plugin.xml
+1
-0
LocalNotification.cs
src/wp8/LocalNotification.cs
+81
-0
LocalNotificationOptions.cs
src/wp8/LocalNotificationOptions.cs
+59
-0
No files found.
plugin.xml
View file @
94eaef3e
...
@@ -77,6 +77,7 @@
...
@@ -77,6 +77,7 @@
<config-file
target=
"config.xml"
parent=
"/*"
>
<config-file
target=
"config.xml"
parent=
"/*"
>
<feature
name=
"LocalNotification"
>
<feature
name=
"LocalNotification"
>
<param
name=
"wp-package"
value=
"LocalNotification"
/>
<param
name=
"wp-package"
value=
"LocalNotification"
/>
<param
name=
"wp-package"
value=
"LocalNotificationOptions"
/>
</feature>
</feature>
</config-file>
</config-file>
...
...
src/wp8/LocalNotification.cs
View file @
94eaef3e
...
@@ -16,10 +16,91 @@ using WPCordovaClassLib.Cordova;
...
@@ -16,10 +16,91 @@ using WPCordovaClassLib.Cordova;
using
WPCordovaClassLib.Cordova.Commands
;
using
WPCordovaClassLib.Cordova.Commands
;
using
WPCordovaClassLib.Cordova.JSON
;
using
WPCordovaClassLib.Cordova.JSON
;
using
De.APPPlant.Cordova.Plugin.LocalNotification
;
namespace
Cordova.Extension.Commands
namespace
Cordova.Extension.Commands
{
{
/// <summary>
/// Implementes access to application live tiles
/// http://msdn.microsoft.com/en-us/library/hh202948(v=VS.92).aspx
/// </summary>
public
class
LocalNotification
:
BaseCommand
public
class
LocalNotification
:
BaseCommand
{
{
/// <summary>
/// Sets application live tile
/// </summary>
public
void
add
(
string
jsonArgs
)
{
string
[]
args
=
JsonHelper
.
Deserialize
<
string
[
]>
(
jsonArgs
);
LocalNotificationOptions
options
=
JsonHelper
.
Deserialize
<
LocalNotificationOptions
>(
args
[
0
]);
// Application Tile is always the first Tile, even if it is not pinned to Start.
ShellTile
AppTile
=
ShellTile
.
ActiveTiles
.
First
();
if
(
AppTile
!=
null
)
{
// Set the properties to update for the Application Tile
// Empty strings for the text values and URIs will result in the property being cleared.
StandardTileData
TileData
=
CreateTileData
(
options
);
// Update the Application Tile
AppTile
.
Update
(
TileData
);
}
DispatchCommandResult
();
}
/// <summary>
/// Clears the application live tile
/// </summary>
public
void
cancel
(
string
jsonArgs
)
{
cancelAll
(
jsonArgs
);
}
/// <summary>
/// Clears the application live tile
/// </summary>
public
void
cancelAll
(
string
jsonArgs
)
{
// Application Tile is always the first Tile, even if it is not pinned to Start.
ShellTile
AppTile
=
ShellTile
.
ActiveTiles
.
First
();
if
(
AppTile
!=
null
)
{
// Set the properties to update for the Application Tile
// Empty strings for the text values and URIs will result in the property being cleared.
StandardTileData
TileData
=
new
StandardTileData
{
Title
=
""
,
BackTitle
=
""
,
BackContent
=
""
};
// Update the Application Tile
AppTile
.
Update
(
TileData
);
}
DispatchCommandResult
();
}
/// <summary>
/// Creates tile data
/// </summary>
private
StandardTileData
CreateTileData
(
LocalNotificationOptions
options
)
{
StandardTileData
tile
=
new
StandardTileData
();
// Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde
if
(
options
.
Badge
!=
0
)
{
tile
.
Count
=
options
.
Badge
;
}
tile
.
BackTitle
=
options
.
Title
;
tile
.
Title
=
options
.
Title
;
tile
.
BackContent
=
options
.
Message
;
return
tile
;
}
}
}
}
}
src/wp8/LocalNotificationOptions.cs
0 → 100644
View file @
94eaef3e
using
System.Runtime.Serialization
;
namespace
De.APPPlant.Cordova.Plugin.LocalNotification
{
/// <summary>
/// Represents LiveTile options
/// </summary>
[
DataContract
]
class
LocalNotificationOptions
{
/// <summary>
/// The Title that is displayed
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"title"
)]
public
string
Title
{
get
;
set
;
}
/// <summary>
/// The message that is displayed
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"message"
)]
public
string
Message
{
get
;
set
;
}
/// <summary>
/// Displays number badge to notification
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"badge"
)]
public
int
Badge
{
get
;
set
;
}
/// <summary>
/// Tile count
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"Date"
)]
public
int
Date
{
get
;
set
;
}
/// <summary>
/// Has the options of daily', 'weekly',''monthly','yearly')
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"repeat"
)]
public
string
Repeat
{
get
;
set
;
}
/// <summary>
/// Message-ID
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"id"
)]
public
string
ID
{
get
;
set
;
}
/// <summary>
/// A javascript function to be called if the app is in the background
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"background"
)]
public
string
Background
{
get
;
set
;
}
/// <summary>
/// A javascript function to be called if the app is running
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"foreground"
)]
public
string
Foreground
{
get
;
set
;
}
}
}
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