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
ebee0373
Commit
ebee0373
authored
Jun 29, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed internal classes
parent
cac11bc1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
254 deletions
+87
-254
plugin.xml
plugin.xml
+5
-5
APPLocalNotification.m
src/ios/APPLocalNotification.m
+20
-11
APPNotificationContent.h
src/ios/APPNotificationContent.h
+3
-4
APPNotificationContent.m
src/ios/APPNotificationContent.m
+13
-40
APPNotificationOptions.h
src/ios/APPNotificationOptions.h
+1
-1
APPNotificationOptions.m
src/ios/APPNotificationOptions.m
+4
-4
UNNotificationRequest+APPLocalNotification.h
src/ios/UNNotificationRequest+APPLocalNotification.h
+2
-2
UNNotificationRequest+APPLocalNotification.m
src/ios/UNNotificationRequest+APPLocalNotification.m
+7
-7
UNUserNotificationCenter+APPLocalNotification.h
src/ios/UNUserNotificationCenter+APPLocalNotification.h
+1
-1
local-notification.js
www/local-notification.js
+31
-179
No files found.
plugin.xml
View file @
ebee0373
...
@@ -59,15 +59,15 @@
...
@@ -59,15 +59,15 @@
<header-file
src=
"src/ios/APPLocalNotification.h"
/>
<header-file
src=
"src/ios/APPLocalNotification.h"
/>
<source-file
src=
"src/ios/APPLocalNotification.m"
/>
<source-file
src=
"src/ios/APPLocalNotification.m"
/>
<header-file
src=
"src/ios/APPLocalNotificationOptions.h"
/>
<header-file
src=
"src/ios/APPNotificationContent.h"
/>
<source-file
src=
"src/ios/APPLocalNotificationOptions.m"
/>
<source-file
src=
"src/ios/APPNotificationContent.m"
/>
<header-file
src=
"src/ios/APPNotificationOptions.h"
/>
<source-file
src=
"src/ios/APPNotificationOptions.m"
/>
<header-file
src=
"src/ios/UNUserNotificationCenter+APPLocalNotification.h"
/>
<header-file
src=
"src/ios/UNUserNotificationCenter+APPLocalNotification.h"
/>
<source-file
src=
"src/ios/UNUserNotificationCenter+APPLocalNotification.m"
/>
<source-file
src=
"src/ios/UNUserNotificationCenter+APPLocalNotification.m"
/>
<header-file
src=
"src/ios/UNMutableNotificationContent+APPLocalNotification.h"
/>
<source-file
src=
"src/ios/UNMutableNotificationContent+APPLocalNotification.m"
/>
<header-file
src=
"src/ios/UNNotificationRequest+APPLocalNotification.h"
/>
<header-file
src=
"src/ios/UNNotificationRequest+APPLocalNotification.h"
/>
<source-file
src=
"src/ios/UNNotificationRequest+APPLocalNotification.m"
/>
<source-file
src=
"src/ios/UNNotificationRequest+APPLocalNotification.m"
/>
...
...
src/ios/APPLocalNotification.m
View file @
ebee0373
...
@@ -22,10 +22,10 @@
...
@@ -22,10 +22,10 @@
*/
*/
#import "APPLocalNotification.h"
#import "APPLocalNotification.h"
#import "APP
Local
NotificationOptions.h"
#import "APPNotificationOptions.h"
#import "UNUserNotificationCenter+APPLocalNotification.h"
#import "UNUserNotificationCenter+APPLocalNotification.h"
#import "UNNotificationRequest+APPLocalNotification.h"
#import "UNNotificationRequest+APPLocalNotification.h"
#import "
UNMutableNotificationContent+APPLocalNotification
.h"
#import "
APPNotificationContent
.h"
@interface
APPLocalNotification
()
@interface
APPLocalNotification
()
...
@@ -72,9 +72,9 @@
...
@@ -72,9 +72,9 @@
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NSDictionary
*
options
in
notifications
)
{
for
(
NSDictionary
*
options
in
notifications
)
{
UNMutable
NotificationContent
*
notification
;
APP
NotificationContent
*
notification
;
notification
=
[[
UNMutable
NotificationContent
alloc
]
notification
=
[[
APP
NotificationContent
alloc
]
initWithOptions
:
options
];
initWithOptions
:
options
];
[
self
scheduleNotification
:
notification
];
[
self
scheduleNotification
:
notification
];
...
@@ -547,9 +547,9 @@
...
@@ -547,9 +547,9 @@
/**
/**
* Schedule the local notification.
* Schedule the local notification.
*/
*/
-
(
void
)
scheduleNotification
:(
UNMutable
NotificationContent
*
)
notification
-
(
void
)
scheduleNotification
:(
APP
NotificationContent
*
)
notification
{
{
__weak
APPLocalNotification
*
weakSelf
=
self
;
__weak
APPLocalNotification
*
weakSelf
=
self
;
UNNotificationRequest
*
request
=
notification
.
request
;
UNNotificationRequest
*
request
=
notification
.
request
;
[
_center
addNotificationRequest
:
request
withCompletionHandler
:
^
(
NSError
*
e
)
{
[
_center
addNotificationRequest
:
request
withCompletionHandler
:
^
(
NSError
*
e
)
{
...
@@ -563,7 +563,7 @@
...
@@ -563,7 +563,7 @@
// */
// */
//- (void) updateNotification:(UILocalNotification*)notification
//- (void) updateNotification:(UILocalNotification*)notification
// withOptions:(NSDictionary*)newOptions
// withOptions:(NSDictionary*)newOptions
//{
//{
APPNotificationRequest*
// NSMutableDictionary* options = [notification.userInfo mutableCopy];
// NSMutableDictionary* options = [notification.userInfo mutableCopy];
//
//
// [options addEntriesFromDictionary:newOptions];
// [options addEntriesFromDictionary:newOptions];
...
@@ -686,6 +686,10 @@
...
@@ -686,6 +686,10 @@
/**
/**
* Fire general event.
* Fire general event.
*
* @param [ NSString* ] event The name of the event to fire.
*
* @return [ Void ]
*/
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
-
(
void
)
fireEvent
:
(
NSString
*
)
event
{
{
...
@@ -693,17 +697,22 @@
...
@@ -693,17 +697,22 @@
}
}
/**
/**
* Fire event for local notification.
* Fire event for about a local notification.
*
* @param [ NSString* ] event The name of the event to fire.
* @param [ APPNotificationRequest* ] notification The local notification.
*
* @return [ Void ]
*/
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
-
(
void
)
fireEvent
:
(
NSString
*
)
event
notification
:
(
UNNotificationRequest
*
)
notification
notification
:
(
UNNotificationRequest
*
)
request
{
{
NSString
*
js
;
NSString
*
js
;
NSString
*
appState
=
[
self
applicationState
];
NSString
*
appState
=
[
self
applicationState
];
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
appState
];
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
appState
];
if
(
notification
)
{
if
(
request
)
{
NSString
*
args
=
[
notification
encodeToJSON
];
NSString
*
args
=
[
request
encodeToJSON
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
appState
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
appState
];
}
}
...
...
src/ios/
UNMutableNotificationContent+APPLocalNotification
.h
→
src/ios/
APPNotificationContent
.h
View file @
ebee0373
...
@@ -21,15 +21,14 @@
...
@@ -21,15 +21,14 @@
* @APPPLANT_LICENSE_HEADER_END@
* @APPPLANT_LICENSE_HEADER_END@
*/
*/
#import "APP
Local
NotificationOptions.h"
#import "APPNotificationOptions.h"
@import
UserNotifications
;
@import
UserNotifications
;
@interface
UNMutableNotificationContent
(
APPLocalNotification
)
@interface
APPNotificationContent
:
UNMutableNotificationContent
-
(
id
)
initWithOptions
:(
NSDictionary
*
)
dict
;
-
(
id
)
initWithOptions
:(
NSDictionary
*
)
dict
;
-
(
APP
Local
NotificationOptions
*
)
options
;
-
(
APPNotificationOptions
*
)
options
;
-
(
UNNotificationRequest
*
)
request
;
-
(
UNNotificationRequest
*
)
request
;
-
(
NSString
*
)
encodeToJSON
;
@end
@end
src/ios/
UNMutableNotificationContent+APPLocalNotification
.m
→
src/ios/
APPNotificationContent
.m
View file @
ebee0373
...
@@ -21,15 +21,15 @@
...
@@ -21,15 +21,15 @@
* @APPPLANT_LICENSE_HEADER_END@
* @APPPLANT_LICENSE_HEADER_END@
*/
*/
#import "
UNMutableNotificationContent+APPLocalNotification
.h"
#import "
APPNotificationContent
.h"
#import "APP
Local
NotificationOptions.h"
#import "APPNotificationOptions.h"
#import <objc/runtime.h>
#import <objc/runtime.h>
@import
UserNotifications
;
@import
UserNotifications
;
static
char
optionsKey
;
static
char
optionsKey
;
@implementation
UNMutableNotificationContent
(
APPLocalNotification
)
@implementation
APPNotificationContent
:
UNMutableNotificationContent
#pragma mark -
#pragma mark -
#pragma mark Init
#pragma mark Init
...
@@ -58,7 +58,7 @@ static char optionsKey;
...
@@ -58,7 +58,7 @@ static char optionsKey;
*/
*/
-
(
void
)
__init
-
(
void
)
__init
{
{
APP
Local
NotificationOptions
*
options
=
self
.
options
;
APPNotificationOptions
*
options
=
self
.
options
;
self
.
title
=
options
.
title
;
self
.
title
=
options
.
title
;
self
.
subtitle
=
options
.
subtitle
;
self
.
subtitle
=
options
.
subtitle
;
...
@@ -73,14 +73,14 @@ static char optionsKey;
...
@@ -73,14 +73,14 @@ static char optionsKey;
/**
/**
* The options used to initialize the notification.
* The options used to initialize the notification.
*
*
* @return [ APP
Local
NotificationOptions* ] options
* @return [ APPNotificationOptions* ] options
*/
*/
-
(
APP
Local
NotificationOptions
*
)
options
-
(
APPNotificationOptions
*
)
options
{
{
APP
Local
NotificationOptions
*
options
=
[
self
getOptions
];
APPNotificationOptions
*
options
=
[
self
getOptions
];
if
(
!
options
)
{
if
(
!
options
)
{
options
=
[[
APP
Local
NotificationOptions
alloc
]
options
=
[[
APPNotificationOptions
alloc
]
initWithDict
:[
self
userInfo
]];
initWithDict
:[
self
userInfo
]];
[
self
setOptions
:
options
];
[
self
setOptions
:
options
];
...
@@ -97,49 +97,22 @@ static char optionsKey;
...
@@ -97,49 +97,22 @@ static char optionsKey;
*/
*/
-
(
UNNotificationRequest
*
)
request
-
(
UNNotificationRequest
*
)
request
{
{
APP
Local
NotificationOptions
*
opts
=
[
self
getOptions
];
APPNotificationOptions
*
opts
=
[
self
getOptions
];
return
[
UNNotificationRequest
requestWithIdentifier
:
opts
.
identifier
return
[
UNNotificationRequest
requestWithIdentifier
:
opts
.
identifier
content
:
self
content
:
self
trigger
:
opts
.
trigger
];
trigger
:
opts
.
trigger
];
}
}
/**
* Encode the user info dict to JSON.
*
* @return [ NSString* ]
*/
-
(
NSString
*
)
encodeToJSON
{
NSString
*
json
;
NSData
*
data
;
NSMutableDictionary
*
obj
=
[
self
.
userInfo
mutableCopy
];
[
obj
removeObjectForKey
:
@"updatedAt"
];
if
(
obj
==
NULL
||
obj
.
count
==
0
)
return
json
;
data
=
[
NSJSONSerialization
dataWithJSONObject
:
obj
options
:
NSJSONWritingPrettyPrinted
error
:
NULL
];
json
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
return
[
json
stringByReplacingOccurrencesOfString
:
@"
\n
"
withString
:
@""
];
}
#pragma mark -
#pragma mark -
#pragma mark Private
#pragma mark Private
/**
/**
* The options used to initialize the notification.
* The options used to initialize the notification.
*
*
* @return [ APP
Local
NotificationOptions* ]
* @return [ APPNotificationOptions* ]
*/
*/
-
(
APP
Local
NotificationOptions
*
)
getOptions
-
(
APPNotificationOptions
*
)
getOptions
{
{
return
objc_getAssociatedObject
(
self
,
&
optionsKey
);
return
objc_getAssociatedObject
(
self
,
&
optionsKey
);
}
}
...
@@ -151,7 +124,7 @@ static char optionsKey;
...
@@ -151,7 +124,7 @@ static char optionsKey;
*
*
* @return [ Void ]
* @return [ Void ]
*/
*/
-
(
void
)
setOptions
:
(
APP
Local
NotificationOptions
*
)
options
-
(
void
)
setOptions
:
(
APPNotificationOptions
*
)
options
{
{
objc_setAssociatedObject
(
self
,
&
optionsKey
,
objc_setAssociatedObject
(
self
,
&
optionsKey
,
options
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
options
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
...
...
src/ios/APP
Local
NotificationOptions.h
→
src/ios/APPNotificationOptions.h
View file @
ebee0373
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
@import
UserNotifications
;
@import
UserNotifications
;
@interface
APP
Local
NotificationOptions
:
NSObject
@interface
APPNotificationOptions
:
NSObject
@property
(
readonly
,
getter
=
id
)
NSNumber
*
id
;
@property
(
readonly
,
getter
=
id
)
NSNumber
*
id
;
@property
(
readonly
,
getter
=
identifier
)
NSString
*
identifier
;
@property
(
readonly
,
getter
=
identifier
)
NSString
*
identifier
;
...
...
src/ios/APP
Local
NotificationOptions.m
→
src/ios/APPNotificationOptions.m
View file @
ebee0373
...
@@ -21,18 +21,18 @@
...
@@ -21,18 +21,18 @@
* @APPPLANT_LICENSE_HEADER_END@
* @APPPLANT_LICENSE_HEADER_END@
*/
*/
#import "APP
Local
NotificationOptions.h"
#import "APPNotificationOptions.h"
@import
UserNotifications
;
@import
UserNotifications
;
@interface
APP
Local
NotificationOptions
()
@interface
APPNotificationOptions
()
// The dictionary which contains all notification properties
// The dictionary which contains all notification properties
@property
(
nonatomic
,
retain
)
NSDictionary
*
dict
;
@property
(
nonatomic
,
retain
)
NSDictionary
*
dict
;
@end
@end
@implementation
APP
LocalNotificationOptions
@implementation
APP
NotificationOptions
:
NSObject
@synthesize
dict
;
@synthesize
dict
;
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
*
*
* @param [ NSDictionary* ] dict A key-value property map.
* @param [ NSDictionary* ] dict A key-value property map.
*
*
* @return [ APP
Local
NotificationOptions ]
* @return [ APPNotificationOptions ]
*/
*/
-
(
id
)
initWithDict
:(
NSDictionary
*
)
dictionary
-
(
id
)
initWithDict
:(
NSDictionary
*
)
dictionary
{
{
...
...
src/ios/UNNotificationRequest+APPLocalNotification.h
View file @
ebee0373
...
@@ -21,14 +21,14 @@
...
@@ -21,14 +21,14 @@
* @APPPLANT_LICENSE_HEADER_END@
* @APPPLANT_LICENSE_HEADER_END@
*/
*/
#import "APP
Local
NotificationOptions.h"
#import "APPNotificationOptions.h"
@import
UserNotifications
;
@import
UserNotifications
;
@interface
UNNotificationRequest
(
APPLocalNotification
)
@interface
UNNotificationRequest
(
APPLocalNotification
)
// The options provided by the plug-in
// The options provided by the plug-in
-
(
APP
Local
NotificationOptions
*
)
options
;
-
(
APPNotificationOptions
*
)
options
;
// Encode the user info dict to JSON
// Encode the user info dict to JSON
-
(
NSString
*
)
encodeToJSON
;
-
(
NSString
*
)
encodeToJSON
;
...
...
src/ios/UNNotificationRequest+APPLocalNotification.m
View file @
ebee0373
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
* @APPPLANT_LICENSE_HEADER_END@
* @APPPLANT_LICENSE_HEADER_END@
*/
*/
#import "APP
Local
NotificationOptions.h"
#import "APPNotificationOptions.h"
#import "UNNotificationRequest+APPLocalNotification.h"
#import "UNNotificationRequest+APPLocalNotification.h"
#import "
UNMutableNotificationContent+APPLocalNotification
.h"
#import "
APPNotificationContent
.h"
#import <objc/runtime.h>
#import <objc/runtime.h>
@import
UserNotifications
;
@import
UserNotifications
;
...
@@ -35,7 +35,7 @@ static char optionsKey;
...
@@ -35,7 +35,7 @@ static char optionsKey;
/**
/**
* Get associated option object
* Get associated option object
*/
*/
-
(
APP
Local
NotificationOptions
*
)
getOptions
-
(
APPNotificationOptions
*
)
getOptions
{
{
return
objc_getAssociatedObject
(
self
,
&
optionsKey
);
return
objc_getAssociatedObject
(
self
,
&
optionsKey
);
}
}
...
@@ -43,7 +43,7 @@ static char optionsKey;
...
@@ -43,7 +43,7 @@ static char optionsKey;
/**
/**
* Set associated option object
* Set associated option object
*/
*/
-
(
void
)
setOptions
:
(
APP
Local
NotificationOptions
*
)
options
-
(
void
)
setOptions
:
(
APPNotificationOptions
*
)
options
{
{
objc_setAssociatedObject
(
self
,
&
optionsKey
,
objc_setAssociatedObject
(
self
,
&
optionsKey
,
options
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
options
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
...
@@ -52,12 +52,12 @@ static char optionsKey;
...
@@ -52,12 +52,12 @@ static char optionsKey;
/**
/**
* The options provided by the plug-in.
* The options provided by the plug-in.
*/
*/
-
(
APP
Local
NotificationOptions
*
)
options
-
(
APPNotificationOptions
*
)
options
{
{
APP
Local
NotificationOptions
*
options
=
[
self
getOptions
];
APPNotificationOptions
*
options
=
[
self
getOptions
];
if
(
!
options
)
{
if
(
!
options
)
{
options
=
[[
APP
Local
NotificationOptions
alloc
]
options
=
[[
APPNotificationOptions
alloc
]
initWithDict
:[
self
.
content
userInfo
]];
initWithDict
:[
self
.
content
userInfo
]];
[
self
setOptions
:
options
];
[
self
setOptions
:
options
];
...
...
src/ios/UNUserNotificationCenter+APPLocalNotification.h
View file @
ebee0373
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
* @APPPLANT_LICENSE_HEADER_END@
* @APPPLANT_LICENSE_HEADER_END@
*/
*/
#import "
UNMutableNotificationContent+APPLocalNotification
.h"
#import "
APPNotificationContent
.h"
@interface
UNUserNotificationCenter
(
APPLocalNotification
)
@interface
UNUserNotificationCenter
(
APPLocalNotification
)
...
...
www/local-notification.js
View file @
ebee0373
...
@@ -15,8 +15,6 @@
...
@@ -15,8 +15,6 @@
* limitations under the License.
* limitations under the License.
*/
*/
var
exec
=
require
(
'cordova/exec'
);
/**
/**
* Request permission to show notifications.
* Request permission to show notifications.
*
*
...
@@ -26,14 +24,7 @@ var exec = require('cordova/exec');
...
@@ -26,14 +24,7 @@ var exec = require('cordova/exec');
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
hasPermission
=
function
(
callback
,
scope
)
{
exports
.
hasPermission
=
function
(
callback
,
scope
)
{
var
fn
=
this
.
createCallbackFn
(
callback
,
scope
);
this
.
core
.
hasPermission
(
callback
,
scope
);
if
(
device
.
platform
!=
'iOS'
)
{
fn
(
true
);
return
;
}
exec
(
fn
,
null
,
'LocalNotification'
,
'check'
,
[]);
};
};
/**
/**
...
@@ -45,14 +36,7 @@ exports.hasPermission = function (callback, scope) {
...
@@ -45,14 +36,7 @@ exports.hasPermission = function (callback, scope) {
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
requestPermission
=
function
(
callback
,
scope
)
{
exports
.
requestPermission
=
function
(
callback
,
scope
)
{
var
fn
=
this
.
createCallbackFn
(
callback
,
scope
);
this
.
core
.
requestPermission
(
callback
,
scope
);
if
(
device
.
platform
!=
'iOS'
)
{
fn
(
true
);
return
;
}
exec
(
fn
,
null
,
'LocalNotification'
,
'request'
,
[]);
};
};
/**
/**
...
@@ -65,28 +49,8 @@ exports.requestPermission = function (callback, scope) {
...
@@ -65,28 +49,8 @@ exports.requestPermission = function (callback, scope) {
*
*
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
schedule
=
function
(
msgs
,
callback
,
scope
,
args
)
{
exports
.
schedule
=
function
(
notifications
,
callback
,
scope
,
args
)
{
var
fn
=
function
(
granted
)
{
this
.
core
.
schedule
(
notifications
,
callback
,
scope
,
args
);
if
(
!
granted
)
return
;
var
notifications
=
Array
.
isArray
(
msgs
)
?
msgs
:
[
msgs
];
for
(
var
i
=
0
;
i
<
notifications
.
length
;
i
++
)
{
var
notification
=
notifications
[
i
];
this
.
mergeWithDefaults
(
notification
);
this
.
convertProperties
(
notification
);
}
this
.
exec
(
'schedule'
,
notifications
,
callback
,
scope
);
};
if
(
args
&&
args
.
skipPermission
)
{
fn
.
call
(
this
,
true
);
}
else
{
this
.
requestPermission
(
fn
,
this
);
}
};
};
// /**
// /**
...
@@ -102,27 +66,8 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -102,27 +66,8 @@ exports.schedule = function (msgs, callback, scope, args) {
// * skipPermission:true schedules the notifications immediatly without
// * skipPermission:true schedules the notifications immediatly without
// * registering or checking for permission
// * registering or checking for permission
// */
// */
// exports.update = function (msgs, callback, scope, args) {
// exports.update = function (notifications, callback, scope, args) {
// var fn = function(granted) {
// this.core.update(notifications, callback, scope, args);
// if (!granted) return;
// var notifications = Array.isArray(msgs) ? msgs : [msgs];
// for (var i = 0; i < notifications.length; i++) {
// var notification = notifications[i];
// this.convertProperties(notification);
// }
// this.exec('update', notifications, callback, scope);
// };
// if (args && args.skipPermission) {
// fn.call(this, true);
// } else {
// this.registerPermission(fn, this);
// }
// };
// };
// /**
// /**
...
@@ -136,10 +81,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -136,10 +81,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.clear = function (ids, callback, scope) {
// exports.clear = function (ids, callback, scope) {
// ids = Array.isArray(ids) ? ids : [ids];
// this.core.clear(ids, callback, scope);
// ids = this.convertIds(ids);
// this.exec('clear', ids, callback, scope);
// };
// };
// /**
// /**
...
@@ -151,7 +93,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -151,7 +93,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.clearAll = function (callback, scope) {
// exports.clearAll = function (callback, scope) {
// this.
exec('clearAll', null,
callback, scope);
// this.
core.clearAll(
callback, scope);
// };
// };
// /**
// /**
...
@@ -165,10 +107,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -165,10 +107,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.cancel = function (ids, callback, scope) {
// exports.cancel = function (ids, callback, scope) {
// ids = Array.isArray(ids) ? ids : [ids];
// this.core.cancel(ids, callback, scope);
// ids = this.convertIds(ids);
// this.exec('cancel', ids, callback, scope);
// };
// };
// /**
// /**
...
@@ -180,7 +119,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -180,7 +119,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.cancelAll = function (callback, scope) {
// exports.cancelAll = function (callback, scope) {
// this.
exec('cancelAll', null,
callback, scope);
// this.
core.cancelAll(
callback, scope);
// };
// };
// /**
// /**
...
@@ -194,7 +133,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -194,7 +133,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.isPresent = function (id, callback, scope) {
// exports.isPresent = function (id, callback, scope) {
// this.
exec('isPresent', id || 0
, callback, scope);
// this.
core.isPresent(id
, callback, scope);
// };
// };
// /**
// /**
...
@@ -208,10 +147,10 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -208,10 +147,10 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.isScheduled = function (id, callback, scope) {
// exports.isScheduled = function (id, callback, scope) {
// this.
exec('isScheduled', id || 0
, callback, scope);
// this.
core.isScheduled(id
, callback, scope);
// };
// };
//
/*
*
// *
// * Check if a notification with an ID was triggered.
// * Check if a notification with an ID was triggered.
// *
// *
// * @param {String} id
// * @param {String} id
...
@@ -220,21 +159,21 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -220,21 +159,21 @@ exports.schedule = function (msgs, callback, scope, args) {
// * A callback function to be called with the list
// * A callback function to be called with the list
// * @param {Object?} scope
// * @param {Object?} scope
// * The scope for the callback function
// * The scope for the callback function
// */
// exports.isTriggered = function (id, callback, scope) {
// exports.isTriggered = function (id, callback, scope) {
// this.
exec('isTriggered', id || 0
, callback, scope);
// this.
core.isTriggered(id
, callback, scope);
// };
// };
// *
//
/*
*
// * List all local notification IDs.
// * List all local notification IDs.
// *
// *
// * @param {Function} callback
// * @param {Function} callback
// * A callback function to be called with the list
// * A callback function to be called with the list
// * @param {Object?} scope
// * @param {Object?} scope
// * The scope for the callback function
// * The scope for the callback function
// */
// exports.getAllIds = function (callback, scope) {
// exports.getAllIds = function (callback, scope) {
// this.
exec('getAllIds', null,
callback, scope);
// this.
core.getAllIds(
callback, scope);
// };
// };
// /**
// /**
...
@@ -253,7 +192,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -253,7 +192,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getScheduledIds = function (callback, scope) {
// exports.getScheduledIds = function (callback, scope) {
// this.
exec('getScheduledIds', null,
callback, scope);
// this.
core.getScheduledIds(
callback, scope);
// };
// };
// /**
// /**
...
@@ -265,7 +204,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -265,7 +204,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getTriggeredIds = function (callback, scope) {
// exports.getTriggeredIds = function (callback, scope) {
// this.
exec('getTriggeredIds', null,
callback, scope);
// this.
core.getTriggeredIds(
callback, scope);
// };
// };
// /**
// /**
...
@@ -280,24 +219,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -280,24 +219,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.get = function () {
// exports.get = function () {
// var args = Array.apply(null, arguments);
// this.core.get.apply(this.core, arguments);
// if (typeof args[0] == 'function') {
// args.unshift([]);
// }
// var ids = args[0],
// callback = args[1],
// scope = args[2];
// if (!Array.isArray(ids)) {
// this.exec('getSingle', Number(ids), callback, scope);
// return;
// }
// ids = this.convertIds(ids);
// this.exec('getAll', ids, callback, scope);
// };
// };
// /**
// /**
...
@@ -309,7 +231,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -309,7 +231,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getAll = function (callback, scope) {
// exports.getAll = function (callback, scope) {
// this.
exec('getAll', null,
callback, scope);
// this.
core.getAll(
callback, scope);
// };
// };
// /**
// /**
...
@@ -324,28 +246,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -324,28 +246,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getScheduled = function () {
// exports.getScheduled = function () {
// var args = Array.apply(null, arguments);
// this.core.getScheduled.apply(this.core, arguments);
// if (typeof args[0] == 'function') {
// args.unshift([]);
// }
// var ids = args[0],
// callback = args[1],
// scope = args[2];
// if (!Array.isArray(ids)) {
// ids = [ids];
// }
// if (!Array.isArray(ids)) {
// this.exec('getSingleScheduled', Number(ids), callback, scope);
// return;
// }
// ids = this.convertIds(ids);
// this.exec('getScheduled', ids, callback, scope);
// };
// };
// /**
// /**
...
@@ -357,7 +258,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -357,7 +258,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getAllScheduled = function (callback, scope) {
// exports.getAllScheduled = function (callback, scope) {
// this.
exec('getScheduled', null,
callback, scope);
// this.
core.getAllScheduled(
callback, scope);
// };
// };
// /**
// /**
...
@@ -372,28 +273,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -372,28 +273,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getTriggered = function () {
// exports.getTriggered = function () {
// var args = Array.apply(null, arguments);
// this.core.getTriggered.apply(this.core, arguments);
// if (typeof args[0] == 'function') {
// args.unshift([]);
// }
// var ids = args[0],
// callback = args[1],
// scope = args[2];
// if (!Array.isArray(ids)) {
// ids = [ids];
// }
// if (!Array.isArray(ids)) {
// this.exec('getSingleTriggered', Number(ids), callback, scope);
// return;
// }
// ids = this.convertIds(ids);
// this.exec('getTriggered', ids, callback, scope);
// };
// };
// /**
// /**
...
@@ -405,7 +285,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -405,7 +285,7 @@ exports.schedule = function (msgs, callback, scope, args) {
// * The scope for the callback function
// * The scope for the callback function
// */
// */
// exports.getAllTriggered = function (callback, scope) {
// exports.getAllTriggered = function (callback, scope) {
// this.
exec('getTriggered', null,
callback, scope);
// this.
core.getAllTriggered(
callback, scope);
// };
// };
/**
/**
...
@@ -414,7 +294,7 @@ exports.schedule = function (msgs, callback, scope, args) {
...
@@ -414,7 +294,7 @@ exports.schedule = function (msgs, callback, scope, args) {
* @return [ Object ]
* @return [ Object ]
*/
*/
exports
.
getDefaults
=
function
()
{
exports
.
getDefaults
=
function
()
{
return
this
.
_defaults
;
return
this
.
core
.
getDefaults
()
;
};
};
/**
/**
...
@@ -424,14 +304,8 @@ exports.getDefaults = function () {
...
@@ -424,14 +304,8 @@ exports.getDefaults = function () {
*
*
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
setDefaults
=
function
(
newDefaults
)
{
exports
.
setDefaults
=
function
(
defaults
)
{
var
defaults
=
this
.
getDefaults
();
this
.
core
.
setDefaults
(
defaults
);
for
(
var
key
in
defaults
)
{
if
(
newDefaults
.
hasOwnProperty
(
key
))
{
defaults
[
key
]
=
newDefaults
[
key
];
}
}
};
};
/**
/**
...
@@ -444,17 +318,7 @@ exports.setDefaults = function (newDefaults) {
...
@@ -444,17 +318,7 @@ exports.setDefaults = function (newDefaults) {
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
on
=
function
(
event
,
callback
,
scope
)
{
exports
.
on
=
function
(
event
,
callback
,
scope
)
{
this
.
core
.
on
(
event
,
callback
,
scope
);
if
(
typeof
callback
!==
"function"
)
return
;
if
(
!
this
.
_listener
[
event
])
{
this
.
_listener
[
event
]
=
[];
}
var
item
=
[
callback
,
scope
||
window
];
this
.
_listener
[
event
].
push
(
item
);
};
};
/**
/**
...
@@ -466,17 +330,5 @@ exports.on = function (event, callback, scope) {
...
@@ -466,17 +330,5 @@ exports.on = function (event, callback, scope) {
* @return [ Void ]
* @return [ Void ]
*/
*/
exports
.
un
=
function
(
event
,
callback
)
{
exports
.
un
=
function
(
event
,
callback
)
{
var
listener
=
this
.
_listener
[
event
];
this
.
core
.
un
(
event
,
callback
);
if
(
!
listener
)
return
;
for
(
var
i
=
0
;
i
<
listener
.
length
;
i
++
)
{
var
fn
=
listener
[
i
][
0
];
if
(
fn
==
callback
)
{
listener
.
splice
(
i
,
1
);
break
;
}
}
};
};
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