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
54955460
Commit
54955460
authored
Jul 05, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update IOS to 0.9.0.beta
parent
9c65b6c2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
139 additions
and
71 deletions
+139
-71
project.pbxproj
platforms/ios/NotificationExample.xcodeproj/project.pbxproj
+0
-0
UserInterfaceState.xcuserstate
...data/sebastian.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
APPLocalNotification.m
...cordova-plugin-local-notifications/APPLocalNotification.m
+51
-24
APPNotificationOptions.m
...rdova-plugin-local-notifications/APPNotificationOptions.m
+4
-4
local-notification-util.js
...plugin-local-notifications/www/local-notification-util.js
+7
-5
index.js
platforms/ios/www/js/index.js
+4
-0
local-notification-util.js
...plugin-local-notifications/www/local-notification-util.js
+7
-5
APPLocalNotification.m
...plugin-local-notifications/src/ios/APPLocalNotification.m
+51
-24
APPNotificationOptions.m
...ugin-local-notifications/src/ios/APPNotificationOptions.m
+4
-4
local-notification-util.js
...plugin-local-notifications/www/local-notification-util.js
+7
-5
index.js
www/js/index.js
+4
-0
No files found.
platforms/ios/NotificationExample.xcodeproj/project.pbxproj
View file @
54955460
This diff is collapsed.
Click to expand it.
platforms/ios/NotificationExample.xcodeproj/project.xcworkspace/xcuserdata/sebastian.xcuserdatad/UserInterfaceState.xcuserstate
View file @
54955460
No preview for this file type
platforms/ios/NotificationExample/Plugins/cordova-plugin-local-notifications/APPLocalNotification.m
View file @
54955460
...
...
@@ -596,8 +596,9 @@
withCompletionHandler
:
(
void
(
^
)())
completionHandler
{
UNNotificationRequest
*
notification
=
response
.
notification
.
request
;
NSString
*
action
=
response
.
actionIdentifier
;
NSString
*
event
=
action
;
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
NSString
*
action
=
response
.
actionIdentifier
;
NSString
*
event
=
action
;
completionHandler
();
...
...
@@ -611,12 +612,17 @@
if
(
!
deviceready
&&
[
event
isEqualToString
:
@"click"
])
{
_launchDetails
=
@[
notification
.
options
.
id
,
event
];
}
if
(
!
[
event
isEqualToString
:
@"clear"
])
{
[
self
fireEvent
:
@"clear"
notification
:
notification
];
}
if
([
response
isKindOfClass
:
UNTextInputNotificationResponse
.
class
])
{
[
data
setObject
:((
UNTextInputNotificationResponse
*
)
response
).
userText
forKey
:
@"text"
];
}
[
self
fireEvent
:
event
notification
:
notification
];
[
self
fireEvent
:
event
notification
:
notification
data
:
data
];
}
#pragma mark -
...
...
@@ -639,20 +645,6 @@
#pragma mark Helper
/**
* Retrieve the state of the application.
*
* @return "background" or "foreground"
*/
-
(
NSString
*
)
applicationState
{
UIApplicationState
state
=
[
_app
applicationState
];
bool
isActive
=
state
==
UIApplicationStateActive
;
return
isActive
?
@"foreground"
:
@"background"
;
}
/**
* Simply invokes the callback without any parameter.
*/
-
(
void
)
execCallback
:
(
CDVInvokedUrlCommand
*
)
command
...
...
@@ -673,7 +665,9 @@
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
{
[
self
fireEvent
:
event
notification
:
NULL
];
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
self
fireEvent
:
event
notification
:
NULL
data
:
data
];
}
/**
...
...
@@ -685,15 +679,48 @@
* @return [ Void ]
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
notification
:
(
UNNotificationRequest
*
)
notitification
{
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
self
fireEvent
:
event
notification
:
notitification
data
:
data
];
}
/**
* Fire event for about a local notification.
*
* @param [ NSString* ] event The name of the event to fire.
* @param [ APPNotificationRequest* ] notification The local notification.
* @param [ NSMutableDictionary* ] data Event object with additional data.
*
* @return [ Void ]
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
notification
:
(
UNNotificationRequest
*
)
request
data
:
(
NSMutableDictionary
*
)
data
{
NSString
*
js
;
NSString
*
appState
=
[
self
applicationState
];
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
appState
];
BOOL
isActive
=
[
_app
applicationState
]
==
UIApplicationStateActive
;
NSString
*
js
,
*
params
,
*
notiAsJSON
,
*
dataAsJSON
;
NSData
*
dataAsData
;
[
data
setObject
:
event
forKey
:
@"event"
];
[
data
setObject
:
@
(
isActive
)
forKey
:
@"foreground"
];
if
(
request
)
{
NSString
*
args
=
[
request
encodeToJSON
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
appState
];
notiAsJSON
=
[
request
encodeToJSON
];
[
data
setObject
:
request
.
options
.
id
forKey
:
@"notification"
];
}
dataAsData
=
[
NSJSONSerialization
dataWithJSONObject
:
data
options
:
0
error
:
NULL
];
dataAsJSON
=
[[
NSString
alloc
]
initWithData
:
dataAsData
encoding
:
NSUTF8StringEncoding
];
if
(
request
)
{
params
=
[
NSString
stringWithFormat
:
@"%@,%@"
,
notiAsJSON
,
dataAsJSON
];
}
else
{
params
=
[
NSString
stringWithFormat
:
@"%@"
,
dataAsJSON
];
}
js
=
[
NSString
stringWithFormat
:
...
...
platforms/ios/NotificationExample/Plugins/cordova-plugin-local-notifications/APPNotificationOptions.m
View file @
54955460
...
...
@@ -61,9 +61,9 @@
*
* @return [ NSString* ]
*/
-
(
NSString
*
)
type
-
(
NSString
*
)
t
riggerT
ype
{
NSString
*
type
=
[
dict
objectForKey
:
@"t
ype
"
];
NSString
*
type
=
[
dict
objectForKey
:
@"t
rigger
"
];
return
type
.
length
?
type
:
@"normal"
;
}
...
...
@@ -276,12 +276,12 @@
*/
-
(
UNNotificationTrigger
*
)
trigger
{
NSString
*
type
=
[
self
type
];
NSString
*
type
=
[
self
t
riggerT
ype
];
if
([
type
isEqualToString
:
@"location"
])
return
[
self
triggerWithRegion
];
if
(
!
[
type
isEqualToString
:
@"
normal
"
])
if
(
!
[
type
isEqualToString
:
@"
date
"
])
NSLog
(
@"Unknown type: %@"
,
type
);
if
([
self
isRepeating
])
...
...
platforms/ios/platform_www/plugins/cordova-plugin-local-notifications/www/local-notification-util.js
View file @
54955460
...
...
@@ -22,16 +22,16 @@ var exec = require('cordova/exec'),
// Default values
exports
.
_defaults
=
{
id
:
0
,
type
:
'normal'
,
text
:
''
,
title
:
''
,
sound
:
'res://platform_default'
,
trigger
:
'date'
,
badge
:
undefined
,
data
:
undefined
,
every
:
undefined
,
at
:
undefined
,
actions
:
undefined
,
actionGroupId
:
undefined
actionGroupId
:
undefined
,
};
// Listener
...
...
@@ -55,9 +55,11 @@ exports.applyPlatformSpecificOptions = function () {
defaults
.
color
=
undefined
;
break
;
case
'iOS'
:
defaults
.
attachments
=
undefined
;
defaults
.
region
=
undefined
;
defaults
.
radius
=
undefined
;
defaults
.
attachments
=
undefined
;
defaults
.
region
=
undefined
;
defaults
.
radius
=
undefined
;
defaults
.
notifyOnEntry
=
true
;
defaults
.
notifyOnExit
=
false
;
break
;
}
};
...
...
platforms/ios/www/js/index.js
View file @
54955460
...
...
@@ -325,6 +325,10 @@ var app = {
console
.
log
(
'dislike'
,
arguments
);
showToast
(
'disliked'
);
});
cordova
.
plugins
.
notification
.
local
.
on
(
'feedback'
,
function
(
obj
,
e
)
{
console
.
log
(
'feedback'
,
arguments
);
showToast
(
'Feedback: '
+
e
.
text
);
});
}
};
...
...
platforms/ios/www/plugins/cordova-plugin-local-notifications/www/local-notification-util.js
View file @
54955460
...
...
@@ -22,16 +22,16 @@ var exec = require('cordova/exec'),
// Default values
exports
.
_defaults
=
{
id
:
0
,
type
:
'normal'
,
text
:
''
,
title
:
''
,
sound
:
'res://platform_default'
,
trigger
:
'date'
,
badge
:
undefined
,
data
:
undefined
,
every
:
undefined
,
at
:
undefined
,
actions
:
undefined
,
actionGroupId
:
undefined
actionGroupId
:
undefined
,
};
// Listener
...
...
@@ -55,9 +55,11 @@ exports.applyPlatformSpecificOptions = function () {
defaults
.
color
=
undefined
;
break
;
case
'iOS'
:
defaults
.
attachments
=
undefined
;
defaults
.
region
=
undefined
;
defaults
.
radius
=
undefined
;
defaults
.
attachments
=
undefined
;
defaults
.
region
=
undefined
;
defaults
.
radius
=
undefined
;
defaults
.
notifyOnEntry
=
true
;
defaults
.
notifyOnExit
=
false
;
break
;
}
};
...
...
plugins/cordova-plugin-local-notifications/src/ios/APPLocalNotification.m
View file @
54955460
...
...
@@ -596,8 +596,9 @@
withCompletionHandler
:
(
void
(
^
)())
completionHandler
{
UNNotificationRequest
*
notification
=
response
.
notification
.
request
;
NSString
*
action
=
response
.
actionIdentifier
;
NSString
*
event
=
action
;
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
NSString
*
action
=
response
.
actionIdentifier
;
NSString
*
event
=
action
;
completionHandler
();
...
...
@@ -611,12 +612,17 @@
if
(
!
deviceready
&&
[
event
isEqualToString
:
@"click"
])
{
_launchDetails
=
@[
notification
.
options
.
id
,
event
];
}
if
(
!
[
event
isEqualToString
:
@"clear"
])
{
[
self
fireEvent
:
@"clear"
notification
:
notification
];
}
if
([
response
isKindOfClass
:
UNTextInputNotificationResponse
.
class
])
{
[
data
setObject
:((
UNTextInputNotificationResponse
*
)
response
).
userText
forKey
:
@"text"
];
}
[
self
fireEvent
:
event
notification
:
notification
];
[
self
fireEvent
:
event
notification
:
notification
data
:
data
];
}
#pragma mark -
...
...
@@ -639,20 +645,6 @@
#pragma mark Helper
/**
* Retrieve the state of the application.
*
* @return "background" or "foreground"
*/
-
(
NSString
*
)
applicationState
{
UIApplicationState
state
=
[
_app
applicationState
];
bool
isActive
=
state
==
UIApplicationStateActive
;
return
isActive
?
@"foreground"
:
@"background"
;
}
/**
* Simply invokes the callback without any parameter.
*/
-
(
void
)
execCallback
:
(
CDVInvokedUrlCommand
*
)
command
...
...
@@ -673,7 +665,9 @@
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
{
[
self
fireEvent
:
event
notification
:
NULL
];
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
self
fireEvent
:
event
notification
:
NULL
data
:
data
];
}
/**
...
...
@@ -685,15 +679,48 @@
* @return [ Void ]
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
notification
:
(
UNNotificationRequest
*
)
notitification
{
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
self
fireEvent
:
event
notification
:
notitification
data
:
data
];
}
/**
* Fire event for about a local notification.
*
* @param [ NSString* ] event The name of the event to fire.
* @param [ APPNotificationRequest* ] notification The local notification.
* @param [ NSMutableDictionary* ] data Event object with additional data.
*
* @return [ Void ]
*/
-
(
void
)
fireEvent
:
(
NSString
*
)
event
notification
:
(
UNNotificationRequest
*
)
request
data
:
(
NSMutableDictionary
*
)
data
{
NSString
*
js
;
NSString
*
appState
=
[
self
applicationState
];
NSString
*
params
=
[
NSString
stringWithFormat
:
@"
\"
%@
\"
"
,
appState
];
BOOL
isActive
=
[
_app
applicationState
]
==
UIApplicationStateActive
;
NSString
*
js
,
*
params
,
*
notiAsJSON
,
*
dataAsJSON
;
NSData
*
dataAsData
;
[
data
setObject
:
event
forKey
:
@"event"
];
[
data
setObject
:
@
(
isActive
)
forKey
:
@"foreground"
];
if
(
request
)
{
NSString
*
args
=
[
request
encodeToJSON
];
params
=
[
NSString
stringWithFormat
:
@"%@,'%@'"
,
args
,
appState
];
notiAsJSON
=
[
request
encodeToJSON
];
[
data
setObject
:
request
.
options
.
id
forKey
:
@"notification"
];
}
dataAsData
=
[
NSJSONSerialization
dataWithJSONObject
:
data
options
:
0
error
:
NULL
];
dataAsJSON
=
[[
NSString
alloc
]
initWithData
:
dataAsData
encoding
:
NSUTF8StringEncoding
];
if
(
request
)
{
params
=
[
NSString
stringWithFormat
:
@"%@,%@"
,
notiAsJSON
,
dataAsJSON
];
}
else
{
params
=
[
NSString
stringWithFormat
:
@"%@"
,
dataAsJSON
];
}
js
=
[
NSString
stringWithFormat
:
...
...
plugins/cordova-plugin-local-notifications/src/ios/APPNotificationOptions.m
View file @
54955460
...
...
@@ -61,9 +61,9 @@
*
* @return [ NSString* ]
*/
-
(
NSString
*
)
type
-
(
NSString
*
)
t
riggerT
ype
{
NSString
*
type
=
[
dict
objectForKey
:
@"t
ype
"
];
NSString
*
type
=
[
dict
objectForKey
:
@"t
rigger
"
];
return
type
.
length
?
type
:
@"normal"
;
}
...
...
@@ -276,12 +276,12 @@
*/
-
(
UNNotificationTrigger
*
)
trigger
{
NSString
*
type
=
[
self
type
];
NSString
*
type
=
[
self
t
riggerT
ype
];
if
([
type
isEqualToString
:
@"location"
])
return
[
self
triggerWithRegion
];
if
(
!
[
type
isEqualToString
:
@"
normal
"
])
if
(
!
[
type
isEqualToString
:
@"
date
"
])
NSLog
(
@"Unknown type: %@"
,
type
);
if
([
self
isRepeating
])
...
...
plugins/cordova-plugin-local-notifications/www/local-notification-util.js
View file @
54955460
...
...
@@ -21,16 +21,16 @@ var exec = require('cordova/exec'),
// Default values
exports
.
_defaults
=
{
id
:
0
,
type
:
'normal'
,
text
:
''
,
title
:
''
,
sound
:
'res://platform_default'
,
trigger
:
'date'
,
badge
:
undefined
,
data
:
undefined
,
every
:
undefined
,
at
:
undefined
,
actions
:
undefined
,
actionGroupId
:
undefined
actionGroupId
:
undefined
,
};
// Listener
...
...
@@ -54,9 +54,11 @@ exports.applyPlatformSpecificOptions = function () {
defaults
.
color
=
undefined
;
break
;
case
'iOS'
:
defaults
.
attachments
=
undefined
;
defaults
.
region
=
undefined
;
defaults
.
radius
=
undefined
;
defaults
.
attachments
=
undefined
;
defaults
.
region
=
undefined
;
defaults
.
radius
=
undefined
;
defaults
.
notifyOnEntry
=
true
;
defaults
.
notifyOnExit
=
false
;
break
;
}
};
...
...
www/js/index.js
View file @
54955460
...
...
@@ -325,6 +325,10 @@ var app = {
console
.
log
(
'dislike'
,
arguments
);
showToast
(
'disliked'
);
});
cordova
.
plugins
.
notification
.
local
.
on
(
'feedback'
,
function
(
obj
,
e
)
{
console
.
log
(
'feedback'
,
arguments
);
showToast
(
'Feedback: '
+
e
.
text
);
});
}
};
...
...
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