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
9f80dcbd
Commit
9f80dcbd
authored
Nov 16, 2013
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better WP8 support with the ability to specify different kinds of tile images.
parent
8e8546c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
9 deletions
+62
-9
LocalNotification.cs
src/wp8/LocalNotification.cs
+29
-9
LocalNotificationOptions.cs
src/wp8/LocalNotificationOptions.cs
+33
-0
No files found.
src/wp8/LocalNotification.cs
View file @
9f80dcbd
...
@@ -29,7 +29,7 @@ namespace Cordova.Extension.Commands
...
@@ -29,7 +29,7 @@ namespace Cordova.Extension.Commands
/// <summary>
/// <summary>
/// Sets application live tile
/// Sets application live tile
/// </summary>
/// </summary>
public
void
add
(
string
jsonArgs
)
public
void
add
(
string
jsonArgs
)
{
{
string
[]
args
=
JsonHelper
.
Deserialize
<
string
[
]>
(
jsonArgs
);
string
[]
args
=
JsonHelper
.
Deserialize
<
string
[
]>
(
jsonArgs
);
LocalNotificationOptions
options
=
JsonHelper
.
Deserialize
<
LocalNotificationOptions
>(
args
[
0
]);
LocalNotificationOptions
options
=
JsonHelper
.
Deserialize
<
LocalNotificationOptions
>(
args
[
0
]);
...
@@ -40,7 +40,7 @@ namespace Cordova.Extension.Commands
...
@@ -40,7 +40,7 @@ namespace Cordova.Extension.Commands
{
{
// Set the properties to update for the Application Tile
// Set the properties to update for the Application Tile
// Empty strings for the text values and URIs will result in the property being cleared.
// Empty strings for the text values and URIs will result in the property being cleared.
Standard
TileData
TileData
=
CreateTileData
(
options
);
Flip
TileData
TileData
=
CreateTileData
(
options
);
// Update the Application Tile
// Update the Application Tile
AppTile
.
Update
(
TileData
);
AppTile
.
Update
(
TileData
);
...
@@ -59,7 +59,7 @@ namespace Cordova.Extension.Commands
...
@@ -59,7 +59,7 @@ namespace Cordova.Extension.Commands
/// <summary>
/// <summary>
/// Clears the application live tile
/// Clears the application live tile
/// </summary>
/// </summary>
public
void
cancel
(
string
jsonArgs
)
public
void
cancel
(
string
jsonArgs
)
{
{
cancelAll
(
jsonArgs
);
cancelAll
(
jsonArgs
);
}
}
...
@@ -67,7 +67,7 @@ namespace Cordova.Extension.Commands
...
@@ -67,7 +67,7 @@ namespace Cordova.Extension.Commands
/// <summary>
/// <summary>
/// Clears the application live tile
/// Clears the application live tile
/// </summary>
/// </summary>
public
void
cancelAll
(
string
jsonArgs
)
public
void
cancelAll
(
string
jsonArgs
)
{
{
// Application Tile is always the first Tile, even if it is not pinned to Start.
// Application Tile is always the first Tile, even if it is not pinned to Start.
ShellTile
AppTile
=
ShellTile
.
ActiveTiles
.
First
();
ShellTile
AppTile
=
ShellTile
.
ActiveTiles
.
First
();
...
@@ -76,10 +76,14 @@ namespace Cordova.Extension.Commands
...
@@ -76,10 +76,14 @@ namespace Cordova.Extension.Commands
{
{
// Set the properties to update for the Application Tile
// Set the properties to update for the Application Tile
// Empty strings for the text values and URIs will result in the property being cleared.
// Empty strings for the text values and URIs will result in the property being cleared.
StandardTileData
TileData
=
new
Standard
TileData
FlipTileData
TileData
=
new
Flip
TileData
{
{
BackTitle
=
""
,
BackTitle
=
""
,
BackContent
=
""
BackContent
=
""
,
WideBackContent
=
""
,
SmallBackgroundImage
=
new
Uri
(
"appdata:Background.png"
),
BackgroundImage
=
new
Uri
(
"appdata:Background.png"
),
WideBackgroundImage
=
new
Uri
(
"/Assets/Tiles/FlipCycleTileLarge.png"
,
UriKind
.
Relative
),
};
};
// Update the Application Tile
// Update the Application Tile
...
@@ -92,9 +96,9 @@ namespace Cordova.Extension.Commands
...
@@ -92,9 +96,9 @@ namespace Cordova.Extension.Commands
/// <summary>
/// <summary>
/// Creates tile data
/// Creates tile data
/// </summary>
/// </summary>
private
StandardTileData
CreateTileData
(
LocalNotificationOptions
options
)
private
FlipTileData
CreateTileData
(
LocalNotificationOptions
options
)
{
{
StandardTileData
tile
=
new
Standard
TileData
();
FlipTileData
tile
=
new
Flip
TileData
();
// Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde
// Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde
if
(
options
.
Badge
!=
0
)
if
(
options
.
Badge
!=
0
)
...
@@ -103,7 +107,23 @@ namespace Cordova.Extension.Commands
...
@@ -103,7 +107,23 @@ namespace Cordova.Extension.Commands
}
}
tile
.
BackTitle
=
options
.
Title
;
tile
.
BackTitle
=
options
.
Title
;
tile
.
BackContent
=
options
.
Message
;
tile
.
BackContent
=
options
.
ShortMessage
;
tile
.
WideBackContent
=
options
.
Message
;
if
(!
String
.
IsNullOrEmpty
(
options
.
SmallImage
))
{
tile
.
SmallBackgroundImage
=
new
Uri
(
options
.
SmallImage
,
UriKind
.
RelativeOrAbsolute
);
}
if
(!
String
.
IsNullOrEmpty
(
options
.
Image
))
{
tile
.
BackgroundImage
=
new
Uri
(
options
.
Image
,
UriKind
.
RelativeOrAbsolute
);
}
if
(!
String
.
IsNullOrEmpty
(
options
.
WideImage
))
{
tile
.
WideBackgroundImage
=
new
Uri
(
options
.
WideImage
,
UriKind
.
RelativeOrAbsolute
);
}
return
tile
;
return
tile
;
}
}
...
...
src/wp8/LocalNotificationOptions.cs
View file @
9f80dcbd
using
System
;
using
System.Linq
;
using
System.Runtime.Serialization
;
using
System.Runtime.Serialization
;
namespace
De.APPPlant.Cordova.Plugin.LocalNotification
namespace
De.APPPlant.Cordova.Plugin.LocalNotification
...
@@ -21,6 +23,19 @@ namespace De.APPPlant.Cordova.Plugin.LocalNotification
...
@@ -21,6 +23,19 @@ namespace De.APPPlant.Cordova.Plugin.LocalNotification
public
string
Message
{
get
;
set
;
}
public
string
Message
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gekürzte Nachricht (alles ab dem Zeilenumbruch entfernt)
/// </summary>
public
string
ShortMessage
{
get
{
string
[]
separator
=
new
string
[]
{
"\r\n"
,
"\n"
};
return
Message
.
Split
(
separator
,
StringSplitOptions
.
RemoveEmptyEntries
).
First
();
}
}
/// <summary>
/// Displays number badge to notification
/// Displays number badge to notification
/// </summary>
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"badge"
)]
[
DataMember
(
IsRequired
=
false
,
Name
=
"badge"
)]
...
@@ -55,5 +70,23 @@ namespace De.APPPlant.Cordova.Plugin.LocalNotification
...
@@ -55,5 +70,23 @@ namespace De.APPPlant.Cordova.Plugin.LocalNotification
/// </summary>
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"foreground"
)]
[
DataMember
(
IsRequired
=
false
,
Name
=
"foreground"
)]
public
string
Foreground
{
get
;
set
;
}
public
string
Foreground
{
get
;
set
;
}
/// <summary>
/// The notification small background image to be displayed
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"smallImage"
)]
public
string
SmallImage
{
get
;
set
;
}
/// <summary>
/// The notification background image to be displayed
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"image"
)]
public
string
Image
{
get
;
set
;
}
/// <summary>
/// The notification wide background image to be displayed
/// </summary>
[
DataMember
(
IsRequired
=
false
,
Name
=
"wideImage"
)]
public
string
WideImage
{
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