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
c4a5a7cb
Commit
c4a5a7cb
authored
Mar 21, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update project
parent
ccc2ad34
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
97 deletions
+133
-97
index.html
platforms/android/assets/www/index.html
+2
-1
index.html
platforms/ios/www/index.html
+2
-1
CordovaApp.v12.suo
platforms/windows/CordovaApp.v12.suo
+0
-0
AppxManifest.xml
platforms/windows/build/phone/Debug/AnyCPU/AppxManifest.xml
+1
-1
package.phone.appxmanifest
platforms/windows/package.phone.appxmanifest
+34
-39
index.html
platforms/windows/www/index.html
+2
-1
LocalNotificationCore.js
...n.local-notification/src/windows/LocalNotificationCore.js
+20
-1
LocalNotificationUtil.js
...n.local-notification/src/windows/LocalNotificationUtil.js
+70
-52
index.html
www/index.html
+2
-1
No files found.
platforms/android/assets/www/index.html
View file @
c4a5a7cb
...
@@ -218,7 +218,8 @@
...
@@ -218,7 +218,8 @@
title
:
'Scheduled with delay'
,
title
:
'Scheduled with delay'
,
text
:
'Test Message 1'
,
text
:
'Test Message 1'
,
at
:
_5_sec_from_now
,
at
:
_5_sec_from_now
,
sound
:
sound
sound
:
sound
,
badge
:
12
});
});
};
};
...
...
platforms/ios/www/index.html
View file @
c4a5a7cb
...
@@ -218,7 +218,8 @@
...
@@ -218,7 +218,8 @@
title
:
'Scheduled with delay'
,
title
:
'Scheduled with delay'
,
text
:
'Test Message 1'
,
text
:
'Test Message 1'
,
at
:
_5_sec_from_now
,
at
:
_5_sec_from_now
,
sound
:
sound
sound
:
sound
,
badge
:
12
});
});
};
};
...
...
platforms/windows/CordovaApp.v12.suo
View file @
c4a5a7cb
No preview for this file type
platforms/windows/build/phone/Debug/AnyCPU/AppxManifest.xml
View file @
c4a5a7cb
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
</Resources>
</Resources>
<Applications>
<Applications>
<Application
Id=
"de.appplant.localnotification.example"
StartPage=
"www/index.html"
>
<Application
Id=
"de.appplant.localnotification.example"
StartPage=
"www/index.html"
>
<m3:VisualElements
ToastCapable=
"true"
DisplayName=
"NotificationExample"
Square150x150Logo=
"images\Square150x150Logo.png"
Square44x44Logo=
"images\Square44x44Logo.png"
Description=
"CordovaApp"
ForegroundText=
"light"
BackgroundColor=
"transparent
"
>
<m3:VisualElements
DisplayName=
"NotificationExample"
Square150x150Logo=
"images\Square150x150Logo.png"
Square44x44Logo=
"images\Square44x44Logo.png"
Description=
"CordovaApp"
ForegroundText=
"light"
BackgroundColor=
"transparent"
ToastCapable=
"true
"
>
<m3:DefaultTile
Wide310x150Logo=
"images\Wide310x150Logo.png"
Square71x71Logo=
"images\Square71x71Logo.png"
>
<m3:DefaultTile
Wide310x150Logo=
"images\Wide310x150Logo.png"
Square71x71Logo=
"images\Square71x71Logo.png"
>
<m3:ShowNameOnTiles>
<m3:ShowNameOnTiles>
<m3:ShowOn
Tile=
"square150x150Logo"
/>
<m3:ShowOn
Tile=
"square150x150Logo"
/>
...
...
platforms/windows/package.phone.appxmanifest
View file @
c4a5a7cb
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
<!--
Licensed to the Apache Software Foundation (ASF) under one
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
or more contributor license agreements. See the NOTICE file
...
@@ -16,42 +16,36 @@
...
@@ -16,42 +16,36 @@
KIND, either express or implied. See the License for the
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
specific language governing permissions and limitations
under the License.
under the License.
-->
-->
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
<Identity Name="e8de53c0-cf2d-11e4-8bb0-9369d008f7b1" Version="1.0.0.0" Publisher="CN=$username$" />
<Identity Name="e8de53c0-cf2d-11e4-8bb0-9369d008f7b1" Version="1.0.0.0" Publisher="CN=$username$" />
<mp:PhoneIdentity PhoneProductId="e8de53c0-cf2d-11e4-8bb0-9369d008f7b1" PhonePublisherId="db093ed5-53b1-45f7-af72-751e8f36ab80" />
<mp:PhoneIdentity PhoneProductId="e8de53c0-cf2d-11e4-8bb0-9369d008f7b1" PhonePublisherId="db093ed5-53b1-45f7-af72-751e8f36ab80" />
<Properties>
<Properties>
<DisplayName>NotificationExample</DisplayName>
<DisplayName>NotificationExample</DisplayName>
<PublisherDisplayName>$username$</PublisherDisplayName>
<PublisherDisplayName>$username$</PublisherDisplayName>
<Logo>images\StoreLogo.png</Logo>
<Logo>images\StoreLogo.png</Logo>
</Properties>
</Properties>
<Prerequisites>
<Prerequisites>
<OSMinVersion>6.3.1</OSMinVersion>
<OSMinVersion>6.3.1</OSMinVersion>
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
</Prerequisites>
</Prerequisites>
<Resources>
<Resources>
<Resource Language="x-generate" />
<Resource Language="x-generate" />
</Resources>
</Resources>
<Applications>
<Applications>
<Application Id="de.appplant.localnotification.example" StartPage="www/index.html">
<Application Id="de.appplant.localnotification.example" StartPage="www/index.html">
<m3:VisualElements ToastCapable="true" DisplayName="NotificationExample"
<m3:VisualElements DisplayName="NotificationExample" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png" Description="CordovaApp" ForegroundText="light" BackgroundColor="transparent" ToastCapable="true">
Square150x150Logo="images\Square150x150Logo.png"
<m3:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png" Square71x71Logo="images\Square71x71Logo.png">
Square44x44Logo="images\Square44x44Logo.png"
<m3:ShowNameOnTiles>
Description="CordovaApp"
<m3:ShowOn Tile="square150x150Logo" />
ForegroundText="light"
<m3:ShowOn Tile="wide310x150Logo" />
BackgroundColor="transparent">
</m3:ShowNameOnTiles>
<m3:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png"
</m3:DefaultTile>
Square71x71Logo="images\Square71x71Logo.png">
<m3:SplashScreen Image="images\SplashScreenPhone.png" />
<m3:ShowNameOnTiles>
</m3:VisualElements>
<m3:ShowOn Tile="square150x150Logo" />
</Application>
<m3:ShowOn Tile="wide310x150Logo" />
</Applications>
</m3:ShowNameOnTiles>
<Capabilities>
</m3:DefaultTile>
<Capability Name="internetClientServer" />
<m3:SplashScreen Image="images\SplashScreenPhone.png" />
</Capabilities>
</m3:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClientServer" />
</Capabilities>
</Package>
</Package>
\ No newline at end of file
platforms/windows/www/index.html
View file @
c4a5a7cb
...
@@ -218,7 +218,8 @@
...
@@ -218,7 +218,8 @@
title
:
'Scheduled with delay'
,
title
:
'Scheduled with delay'
,
text
:
'Test Message 1'
,
text
:
'Test Message 1'
,
at
:
_5_sec_from_now
,
at
:
_5_sec_from_now
,
sound
:
sound
sound
:
sound
,
badge
:
12
});
});
};
};
...
...
platforms/windows/www/plugins/de.appplant.cordova.plugin.local-notification/src/windows/LocalNotificationCore.js
View file @
c4a5a7cb
...
@@ -54,8 +54,8 @@ exports.core = {
...
@@ -54,8 +54,8 @@ exports.core = {
* 'schedule' or 'update'
* 'schedule' or 'update'
*/
*/
schedule
:
function
(
notifications
)
{
schedule
:
function
(
notifications
)
{
var
triggerFn
=
function
(
notification
)
{
var
triggerFn
=
function
(
notification
)
{
this
.
updateBadge
(
notification
.
badge
);
this
.
fireEvent
(
'trigger'
,
notification
);
this
.
fireEvent
(
'trigger'
,
notification
);
};
};
...
@@ -128,6 +128,25 @@ exports.core = {
...
@@ -128,6 +128,25 @@ exports.core = {
},
},
/**
/**
* Updates the badge number of the active tile.
*
* @param {Number} badge
* The badge number. Zero will clean the badge.
*/
updateBadge
:
function
(
badge
)
{
var
notifications
=
Windows
.
UI
.
Notifications
,
type
=
notifications
.
BadgeTemplateType
.
badgeNumber
,
xml
=
notifications
.
BadgeUpdateManager
.
getTemplateContent
(
type
),
attrs
=
xml
.
getElementsByTagName
(
'badge'
),
notification
=
new
notifications
.
BadgeNotification
(
xml
);
attrs
[
0
].
setAttribute
(
'value'
,
badge
);
notifications
.
BadgeUpdateManager
.
createBadgeUpdaterForApplication
()
.
update
(
notification
);
},
/**
* Updates a single local notification.
* Updates a single local notification.
*
*
* @param {Object} notification
* @param {Object} notification
...
...
platforms/windows/www/plugins/de.appplant.cordova.plugin.local-notification/src/windows/LocalNotificationUtil.js
View file @
c4a5a7cb
...
@@ -87,58 +87,76 @@ exports.parseSound = function (path) {
...
@@ -87,58 +87,76 @@ exports.parseSound = function (path) {
return
audio
;
return
audio
;
};
};
/**
/**
* Builds the xml payload for a local notification based on its options.
* Builds the xml payload for a local notification based on its options.
*
*
* @param {Object} options
* @param {Object} options
* Local notification properties
* Local notification properties
*
*
* @return {String}
* @return Windows.Data.Xml.Dom.XmlDocument
* Windows.Data.Xml.Dom.XmlDocument
*/
*/
exports
.
build
=
function
(
options
)
{
exports
.
build
=
function
(
options
)
{
var
template
=
this
.
buildToastTemplate
(
options
),
var
title
=
options
.
title
,
notification
=
new
Windows
.
Data
.
Xml
.
Dom
.
XmlDocument
();
message
=
options
.
text
||
''
,
sound
=
''
;
try
{
notification
.
loadXml
(
template
);
if
(
!
title
||
title
===
''
)
{
}
catch
(
e
)
{
title
=
'Notification'
;
console
.
error
(
}
'LocalNotification#schedule'
,
'Error loading the xml, check for invalid characters.'
);
if
(
options
.
sound
)
{
}
sound
=
this
.
parseSound
(
options
.
sound
);
}
// Launch Attribute to enable onClick event
var
launchAttr
=
notification
.
createAttribute
(
'launch'
),
var
payload
=
toastNode
=
notification
.
selectSingleNode
(
'/toast'
);
"<toast> "
+
"<visual version='2'>"
+
launchAttr
.
value
=
options
.
id
.
toString
();
"<binding template='ToastText02'>"
+
toastNode
.
attributes
.
setNamedItem
(
launchAttr
);
"<text id='2'>"
+
message
+
"</text>"
+
"<text id='1'>"
+
title
+
"</text>"
+
return
notification
;
"</binding>"
+
};
"</visual>"
+
sound
+
/**
"<json>"
+
JSON
.
stringify
(
options
)
+
"</json>"
+
* Builds the toast template with the right style depend on the options.
"</toast>"
;
*
* @param {Object} options
var
notification
=
new
Windows
.
Data
.
Xml
.
Dom
.
XmlDocument
();
* Local notification properties
*
try
{
* @return String
notification
.
loadXml
(
payload
);
*/
}
catch
(
e
)
{
exports
.
buildToastTemplate
=
function
(
options
)
{
console
.
error
(
var
title
=
options
.
title
,
'LocalNotification#schedule'
,
message
=
options
.
text
||
''
,
'Error loading the xml, check for invalid characters.'
);
json
=
JSON
.
stringify
(
options
),
}
sound
=
''
;
// Launch Attribute to enable onClick event
if
(
options
.
sound
&&
options
.
sound
!==
''
)
{
var
launchAttr
=
notification
.
createAttribute
(
'launch'
),
sound
=
this
.
parseSound
(
options
.
sound
);
toastNode
=
notification
.
selectSingleNode
(
'/toast'
);
}
launchAttr
.
value
=
options
.
id
.
toString
();
if
(
title
&&
title
!==
''
)
{
toastNode
.
attributes
.
setNamedItem
(
launchAttr
);
return
"<toast>"
+
"<visual>"
+
return
notification
;
"<binding template='ToastText02'>"
+
"<text id='1'>"
+
title
+
"</text>"
+
"<text id='2'>"
+
message
+
"</text>"
+
"</binding>"
+
"</visual>"
+
sound
+
"<json>"
+
json
+
"</json>"
+
"</toast>"
;
}
else
{
return
"<toast>"
+
"<visual>"
+
"<binding template='ToastText01'>"
+
"<text id='1'>"
+
message
+
"</text>"
+
"</binding>"
+
"</visual>"
+
sound
+
"<json>"
+
json
+
"</json>"
+
"</toast>"
;
}
};
};
/**
/**
...
...
www/index.html
View file @
c4a5a7cb
...
@@ -218,7 +218,8 @@
...
@@ -218,7 +218,8 @@
title
:
'Scheduled with delay'
,
title
:
'Scheduled with delay'
,
text
:
'Test Message 1'
,
text
:
'Test Message 1'
,
at
:
_5_sec_from_now
,
at
:
_5_sec_from_now
,
sound
:
sound
sound
:
sound
,
badge
:
12
});
});
};
};
...
...
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