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
4a81b72a
Commit
4a81b72a
authored
Jan 06, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update example
parent
6618cb2d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
25 deletions
+52
-25
project.pbxproj
platforms/ios/NotificationExample.xcodeproj/project.pbxproj
+0
-0
UserInterfaceState.xcuserstate
...data/sebastian.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
APPLocalNotification.m
....cordova.plugin.local-notification/APPLocalNotification.m
+10
-11
APPLocalNotificationOptions.h
...a.plugin.local-notification/APPLocalNotificationOptions.h
+2
-0
APPLocalNotificationOptions.m
...a.plugin.local-notification/APPLocalNotificationOptions.m
+14
-1
UILocalNotification+APPLocalNotification.h
...l-notification/UILocalNotification+APPLocalNotification.h
+2
-0
UILocalNotification+APPLocalNotification.m
...l-notification/UILocalNotification+APPLocalNotification.m
+12
-1
index.html
platforms/ios/www/index.html
+6
-6
index.html
www/index.html
+6
-6
No files found.
platforms/ios/NotificationExample.xcodeproj/project.pbxproj
View file @
4a81b72a
This diff is collapsed.
Click to expand it.
platforms/ios/NotificationExample.xcodeproj/project.xcworkspace/xcuserdata/sebastian.xcuserdatad/UserInterfaceState.xcuserstate
View file @
4a81b72a
No preview for this file type
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotification.m
View file @
4a81b72a
...
@@ -69,15 +69,21 @@
...
@@ -69,15 +69,21 @@
*/
*/
-
(
void
)
add
:(
CDVInvokedUrlCommand
*
)
command
-
(
void
)
add
:(
CDVInvokedUrlCommand
*
)
command
{
{
NSArray
*
notifications
=
command
.
arguments
;
[
self
.
commandDelegate
runInBackground
:
^
{
[
self
.
commandDelegate
runInBackground
:
^
{
for
(
NS
Dictionary
*
options
in
command
.
argument
s
)
{
for
(
NS
MutableDictionary
*
options
in
notification
s
)
{
UILocalNotification
*
notification
;
UILocalNotification
*
notification
;
notification
=
[[
UILocalNotification
alloc
]
notification
=
[[
UILocalNotification
alloc
]
initWithOptions
:
options
];
initWithOptions
:
options
];
[
self
scheduleLocalNotification
:
notification
];
[
self
scheduleLocalNotification
:
[
notification
copy
]
];
[
self
fireEvent
:
@"add"
localNotification
:
notification
];
[
self
fireEvent
:
@"add"
localNotification
:
notification
];
if
(
notifications
.
count
>
1
)
{
[
NSThread
sleepForTimeInterval
:
0
.
01
];
}
}
}
[
self
execCallback
:
command
];
[
self
execCallback
:
command
];
...
@@ -266,14 +272,7 @@
...
@@ -266,14 +272,7 @@
-
(
void
)
scheduleLocalNotification
:(
UILocalNotification
*
)
notification
-
(
void
)
scheduleLocalNotification
:(
UILocalNotification
*
)
notification
{
{
[
self
cancelForerunnerLocalNotification
:
notification
];
[
self
cancelForerunnerLocalNotification
:
notification
];
NSString
*
state
=
self
.
applicationState
;
if
([
state
isEqualToString
:
@"background"
])
{
[[
UIApplication
sharedApplication
]
presentLocalNotificationNow
:
notification
];
}
[[
UIApplication
sharedApplication
]
[[
UIApplication
sharedApplication
]
scheduleLocalNotification
:
notification
];
scheduleLocalNotification
:
notification
];
}
}
...
...
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotificationOptions.h
View file @
4a81b72a
...
@@ -35,5 +35,7 @@
...
@@ -35,5 +35,7 @@
// Encode the user info dict to JSON
// Encode the user info dict to JSON
-
(
NSString
*
)
encodeToJSON
;
-
(
NSString
*
)
encodeToJSON
;
// If it's a repeating notification
-
(
BOOL
)
isRepeating
;
@end
@end
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/APPLocalNotificationOptions.m
View file @
4a81b72a
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
-
(
BOOL
)
autoCancel
-
(
BOOL
)
autoCancel
{
{
if
(
IsAtLeastiOSVersion
(
@"8.0"
)){
if
(
IsAtLeastiOSVersion
(
@"8.0"
)){
return
self
.
repeatInterval
==
NSCalendarUnitEra
;
return
!
[
self
isRepeating
]
;
}
else
{
}
else
{
return
[[
dict
objectForKey
:
@"autoCancel"
]
boolValue
];
return
[[
dict
objectForKey
:
@"autoCancel"
]
boolValue
];
}
}
...
@@ -201,6 +201,9 @@
...
@@ -201,6 +201,9 @@
return
NSCalendarUnitEra
;
return
NSCalendarUnitEra
;
}
}
#pragma mark -
#pragma mark Methods
/**
/**
* The notification's user info dict.
* The notification's user info dict.
*/
*/
...
@@ -231,6 +234,16 @@
...
@@ -231,6 +234,16 @@
withString
:
@""
];
withString
:
@""
];
}
}
/**
* If it's a repeating notification.
*/
-
(
BOOL
)
isRepeating
{
NSCalendarUnit
interval
=
self
.
repeatInterval
;
return
!
(
interval
==
NSCalendarUnitEra
||
interval
==
0
);
}
#pragma mark -
#pragma mark -
#pragma mark Helpers
#pragma mark Helpers
...
...
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/UILocalNotification+APPLocalNotification.h
View file @
4a81b72a
...
@@ -33,5 +33,7 @@
...
@@ -33,5 +33,7 @@
-
(
BOOL
)
wasInThePast
;
-
(
BOOL
)
wasInThePast
;
// If the notification was already triggered
// If the notification was already triggered
-
(
BOOL
)
wasTriggered
;
-
(
BOOL
)
wasTriggered
;
// If it's a repeating notification
-
(
BOOL
)
isRepeating
;
@end
@end
platforms/ios/NotificationExample/Plugins/de.appplant.cordova.plugin.local-notification/UILocalNotification+APPLocalNotification.m
View file @
4a81b72a
...
@@ -61,6 +61,9 @@ static char optionsKey;
...
@@ -61,6 +61,9 @@ static char optionsKey;
self
.
soundName
=
options
.
soundName
;
self
.
soundName
=
options
.
soundName
;
}
}
#pragma mark -
#pragma mark Methods
/**
/**
* The options provided by the plug-in.
* The options provided by the plug-in.
*/
*/
...
@@ -128,7 +131,7 @@ static char optionsKey;
...
@@ -128,7 +131,7 @@ static char optionsKey;
int
timespan
=
[
now
timeIntervalSinceDate
:
fireDate
];
int
timespan
=
[
now
timeIntervalSinceDate
:
fireDate
];
if
(
self
.
repeatInterval
!=
NSCalendarUnitEra
)
{
if
(
[
self
isRepeating
]
)
{
timespan
=
timespan
%
[
self
repeatIntervalInSeconds
];
timespan
=
timespan
%
[
self
repeatIntervalInSeconds
];
}
}
...
@@ -156,4 +159,12 @@ static char optionsKey;
...
@@ -156,4 +159,12 @@ static char optionsKey;
return
isLaterThanOrEqualTo
;
return
isLaterThanOrEqualTo
;
}
}
/**
* If it's a repeating notification.
*/
-
(
BOOL
)
isRepeating
{
return
[
self
.
options
isRepeating
];
}
@end
@end
platforms/ios/www/index.html
View file @
4a81b72a
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
<script
type=
"text/javascript"
src=
"js/index.js"
></script>
<script
type=
"text/javascript"
src=
"js/index.js"
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
counter
=
1
,
id
=
12
;
var
counter
=
0
,
id
=
1
;
var
callback
=
function
()
{
var
callback
=
function
()
{
alert
(
'finished or canceled'
);
alert
(
'finished or canceled'
);
...
@@ -138,15 +138,15 @@
...
@@ -138,15 +138,15 @@
scheduleMultiple
=
function
()
{
scheduleMultiple
=
function
()
{
plugin
.
notification
.
local
.
add
([{
plugin
.
notification
.
local
.
add
([{
id
:
id
,
id
:
id
,
message
:
'
Test
Message '
+
(
++
counter
),
message
:
'
Multi
Message '
+
(
++
counter
),
json
:
{
test
:
id
}
json
:
{
test
:
id
}
},{
},{
id
:
id
+
1
,
id
:
id
+
1
,
message
:
'
Test
Message '
+
(
++
counter
),
message
:
'
Multi
Message '
+
(
++
counter
),
json
:
{
test
:
id
+
1
}
json
:
{
test
:
id
+
1
}
},{
},{
id
:
id
+
2
,
id
:
id
+
2
,
message
:
'
Test
Message '
+
(
++
counter
),
message
:
'
Multi
Message '
+
(
++
counter
),
json
:
{
test
:
id
+
2
}
json
:
{
test
:
id
+
2
}
}]);
}]);
};
};
...
@@ -214,14 +214,14 @@
...
@@ -214,14 +214,14 @@
setDefaultTitle
=
function
()
{
setDefaultTitle
=
function
()
{
plugin
.
notification
.
local
.
setDefaults
({
plugin
.
notification
.
local
.
setDefaults
({
title
:
'Default Title'
,
title
:
'
New
Default Title'
,
});
});
};
};
</script>
</script>
<!-- callbacks -->
<!-- callbacks -->
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
document
.
addEventListener
(
'
s
deviceready'
,
function
()
{
document
.
addEventListener
(
'deviceready'
,
function
()
{
plugin
.
notification
.
local
.
onadd
=
function
(
id
,
state
,
json
)
{
plugin
.
notification
.
local
.
onadd
=
function
(
id
,
state
,
json
)
{
alert
(
'on add
\
n'
+
Array
.
apply
(
null
,
arguments
).
join
(
"
\
n"
));
alert
(
'on add
\
n'
+
Array
.
apply
(
null
,
arguments
).
join
(
"
\
n"
));
};
};
...
...
www/index.html
View file @
4a81b72a
...
@@ -109,7 +109,7 @@
...
@@ -109,7 +109,7 @@
<script
type=
"text/javascript"
src=
"js/index.js"
></script>
<script
type=
"text/javascript"
src=
"js/index.js"
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
var
counter
=
1
,
id
=
12
;
var
counter
=
0
,
id
=
1
;
var
callback
=
function
()
{
var
callback
=
function
()
{
alert
(
'finished or canceled'
);
alert
(
'finished or canceled'
);
...
@@ -138,15 +138,15 @@
...
@@ -138,15 +138,15 @@
scheduleMultiple
=
function
()
{
scheduleMultiple
=
function
()
{
plugin
.
notification
.
local
.
add
([{
plugin
.
notification
.
local
.
add
([{
id
:
id
,
id
:
id
,
message
:
'
Test
Message '
+
(
++
counter
),
message
:
'
Multi
Message '
+
(
++
counter
),
json
:
{
test
:
id
}
json
:
{
test
:
id
}
},{
},{
id
:
id
+
1
,
id
:
id
+
1
,
message
:
'
Test
Message '
+
(
++
counter
),
message
:
'
Multi
Message '
+
(
++
counter
),
json
:
{
test
:
id
+
1
}
json
:
{
test
:
id
+
1
}
},{
},{
id
:
id
+
2
,
id
:
id
+
2
,
message
:
'
Test
Message '
+
(
++
counter
),
message
:
'
Multi
Message '
+
(
++
counter
),
json
:
{
test
:
id
+
2
}
json
:
{
test
:
id
+
2
}
}]);
}]);
};
};
...
@@ -214,14 +214,14 @@
...
@@ -214,14 +214,14 @@
setDefaultTitle
=
function
()
{
setDefaultTitle
=
function
()
{
plugin
.
notification
.
local
.
setDefaults
({
plugin
.
notification
.
local
.
setDefaults
({
title
:
'Default Title'
,
title
:
'
New
Default Title'
,
});
});
};
};
</script>
</script>
<!-- callbacks -->
<!-- callbacks -->
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
document
.
addEventListener
(
'
s
deviceready'
,
function
()
{
document
.
addEventListener
(
'deviceready'
,
function
()
{
plugin
.
notification
.
local
.
onadd
=
function
(
id
,
state
,
json
)
{
plugin
.
notification
.
local
.
onadd
=
function
(
id
,
state
,
json
)
{
alert
(
'on add
\
n'
+
Array
.
apply
(
null
,
arguments
).
join
(
"
\
n"
));
alert
(
'on add
\
n'
+
Array
.
apply
(
null
,
arguments
).
join
(
"
\
n"
));
};
};
...
...
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