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
5cc1eb23
Commit
5cc1eb23
authored
Aug 23, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split code for schedule into multiple helpers
parent
f3f4e4d5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
26 deletions
+56
-26
LocalNotificationProxy.js
src/windows/LocalNotificationProxy.js
+56
-26
No files found.
src/windows/LocalNotificationProxy.js
View file @
5cc1eb23
...
@@ -60,35 +60,11 @@ exports.request = function (success, error) {
...
@@ -60,35 +60,11 @@ exports.request = function (success, error) {
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
schedule
=
function
(
success
,
error
,
args
)
{
exports
.
schedule
=
function
(
success
,
error
,
args
)
{
var
options
=
[]
,
actions
=
[]
;
var
options
=
[];
for
(
var
i
=
0
,
props
,
opts
;
i
<
args
.
length
;
i
++
)
{
for
(
var
i
=
0
,
props
,
opts
;
i
<
args
.
length
;
i
++
)
{
props
=
args
[
i
];
props
=
args
[
i
];
opts
=
new
LocalNotification
.
Options
();
opts
=
exports
.
parseOptions
(
props
);
for
(
var
prop
in
opts
)
{
if
(
prop
!=
'actions'
&&
props
[
prop
])
opts
[
prop
]
=
props
[
prop
];
}
for
(
var
j
=
0
,
action
,
btn
;
j
<
props
.
actions
.
length
;
j
++
)
{
action
=
props
.
actions
[
j
];
if
(
!
action
.
type
||
action
.
type
==
'button'
)
{
btn
=
new
LocalNotification
.
Button
();
}
else
if
(
action
.
type
==
'input'
)
{
btn
=
new
LocalNotification
.
Input
();
}
for
(
prop
in
btn
)
{
if
(
action
[
prop
])
btn
[
prop
]
=
action
[
prop
];
}
actions
.
push
(
btn
);
}
opts
.
actions
=
actions
;
options
.
push
(
opts
);
options
.
push
(
opts
);
}
}
...
@@ -363,6 +339,60 @@ exports.clone = function (obj) {
...
@@ -363,6 +339,60 @@ exports.clone = function (obj) {
return
clone
;
return
clone
;
};
};
/**
* Parse notification spec into an instance of prefered type.
*
* @param [ Object ] obj The notification options map.
*
* @return [ LocalNotification.Options ]
*/
exports
.
parseOptions
=
function
(
obj
)
{
var
opts
=
new
LocalNotification
.
Options
();
for
(
var
prop
in
opts
)
{
if
(
prop
!=
'actions'
&&
obj
[
prop
])
{
opts
[
prop
]
=
obj
[
prop
];
}
}
var
actions
=
exports
.
parseActions
(
obj
);
opts
.
actions
=
actions
;
return
opts
;
};
/**
* Parse action specs into instances of prefered types.
*
* @param [ Object ] obj The notification options map.
*
* @return [ Array<LocalNotification.Action> ]
*/
exports
.
parseActions
=
function
(
obj
)
{
var
actions
=
[];
if
(
!
obj
.
actions
)
return
actions
;
for
(
var
i
=
0
,
action
,
btn
;
i
<
obj
.
actions
.
length
;
i
++
)
{
action
=
obj
.
actions
[
i
];
if
(
!
action
.
type
||
action
.
type
==
'button'
)
{
btn
=
new
LocalNotification
.
Button
();
}
else
if
(
action
.
type
==
'input'
)
{
btn
=
new
LocalNotification
.
Input
();
}
for
(
var
prop
in
btn
)
{
if
(
action
[
prop
])
btn
[
prop
]
=
action
[
prop
];
}
actions
.
push
(
btn
);
}
return
actions
;
};
// Handle onclick event
// Handle onclick event
document
.
addEventListener
(
'activated'
,
function
(
e
)
{
document
.
addEventListener
(
'activated'
,
function
(
e
)
{
if
(
e
.
kind
==
ActivationKind
.
toastNotification
)
{
if
(
e
.
kind
==
ActivationKind
.
toastNotification
)
{
...
...
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