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
82eb458e
Commit
82eb458e
authored
Jul 03, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added launchDetails object if app was launched by notification
parent
766ec4ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
5 deletions
+35
-5
APPLocalNotification.h
src/ios/APPLocalNotification.h
+2
-0
APPLocalNotification.m
src/ios/APPLocalNotification.m
+30
-4
local-notification-util.js
www/local-notification-util.js
+3
-1
No files found.
src/ios/APPLocalNotification.h
View file @
82eb458e
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
@interface
APPLocalNotification
:
CDVPlugin
<
UNUserNotificationCenterDelegate
>
@interface
APPLocalNotification
:
CDVPlugin
<
UNUserNotificationCenterDelegate
>
// Set launchDetails object
-
(
void
)
launchDetails
:
(
CDVInvokedUrlCommand
*
)
command
;
// Execute all queued events
// Execute all queued events
-
(
void
)
deviceready
:(
CDVInvokedUrlCommand
*
)
command
;
-
(
void
)
deviceready
:(
CDVInvokedUrlCommand
*
)
command
;
...
...
src/ios/APPLocalNotification.m
View file @
82eb458e
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
@property
(
strong
,
nonatomic
)
UIApplication
*
app
;
@property
(
strong
,
nonatomic
)
UIApplication
*
app
;
@property
(
strong
,
nonatomic
)
UNUserNotificationCenter
*
center
;
@property
(
strong
,
nonatomic
)
UNUserNotificationCenter
*
center
;
@property
(
readwrite
,
assign
)
BOOL
deviceready
;
@property
(
readwrite
,
assign
)
BOOL
deviceready
;
@property
(
readonly
,
nonatomic
,
retain
)
NSArray
*
launchDetails
;
@property
(
readonly
,
nonatomic
,
retain
)
NSMutableArray
*
eventQueue
;
@property
(
readonly
,
nonatomic
,
retain
)
NSMutableArray
*
eventQueue
;
@end
@end
...
@@ -44,6 +45,27 @@
...
@@ -44,6 +45,27 @@
#pragma mark Interface
#pragma mark Interface
/**
/**
* Set launchDetails object.
*
* @return [ Void ]
*/
-
(
void
)
launchDetails
:(
CDVInvokedUrlCommand
*
)
command
{
if
(
!
_launchDetails
)
return
;
NSString
*
js
;
js
=
[
NSString
stringWithFormat
:
@"cordova.plugins.notification.local.launchDetails = {id:%@, action:'%@'}"
,
_launchDetails
[
0
],
_launchDetails
[
1
]];
[
self
.
commandDelegate
evalJs
:
js
];
_launchDetails
=
NULL
;
}
/**
* Execute all queued events.
* Execute all queued events.
*
*
* @return [ Void ]
* @return [ Void ]
...
@@ -592,6 +614,10 @@
...
@@ -592,6 +614,10 @@
event
=
@"clear"
;
event
=
@"clear"
;
}
}
if
(
!
deviceready
&&
[
event
isEqualToString
:
@"click"
])
{
_launchDetails
=
@[
notification
.
options
.
id
,
event
];
}
if
(
!
[
event
isEqualToString
:
@"clear"
])
{
if
(
!
[
event
isEqualToString
:
@"clear"
])
{
[
self
fireEvent
:
@"clear"
notification
:
notification
];
[
self
fireEvent
:
@"clear"
notification
:
notification
];
}
}
...
@@ -667,12 +693,12 @@
...
@@ -667,12 +693,12 @@
-
(
void
)
fireEvent
:
(
NSString
*
)
event
-
(
void
)
fireEvent
:
(
NSString
*
)
event
notification
:
(
UNNotificationRequest
*
)
request
notification
:
(
UNNotificationRequest
*
)
request
{
{
NSString
*
j
s
;
NSString
*
js
,
*
arg
s
;
NSString
*
appState
=
[
self
applicationState
];
NSString
*
appState
=
[
self
applicationState
];
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
appState
];
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
appState
];
if
(
request
)
{
if
(
request
)
{
NSString
*
args
=
[
request
encodeToJSON
];
args
=
[
request
encodeToJSON
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
appState
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
appState
];
}
}
...
...
www/local-notification-util.js
View file @
82eb458e
...
@@ -302,11 +302,13 @@ exports.exec = function (action, args, callback, scope) {
...
@@ -302,11 +302,13 @@ exports.exec = function (action, args, callback, scope) {
channel
.
deviceready
.
subscribe
(
function
()
{
channel
.
deviceready
.
subscribe
(
function
()
{
// Device is ready now, the listeners are registered
// Device is ready now, the listeners are registered
// and all queued events can be executed.
// and all queued events can be executed.
ex
ec
(
null
,
null
,
'LocalNotification'
,
'deviceready'
,
[]
);
ex
ports
.
exec
(
'deviceready'
);
});
});
// Called before 'deviceready' event
// Called before 'deviceready' event
channel
.
onCordovaReady
.
subscribe
(
function
()
{
channel
.
onCordovaReady
.
subscribe
(
function
()
{
// Store launchedBy notification
exports
.
exec
(
'launchDetails'
);
// Device plugin is ready now
// Device plugin is ready now
channel
.
onCordovaInfoReady
.
subscribe
(
function
()
{
channel
.
onCordovaInfoReady
.
subscribe
(
function
()
{
// Merge platform specifics into defaults
// Merge platform specifics into defaults
...
...
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