Commit fa410a84 by Sebastián Katzer

Update project

parent d069f808
......@@ -109,26 +109,6 @@
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="AndroidView">
<subPane>
<PATH>
......@@ -172,6 +152,26 @@
</subPane>
</pane>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="cordova-example-local-notifications" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="android" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
......@@ -189,7 +189,7 @@
<property name="android.project.structure.proportion" value="0.15" />
<property name="recentsLimit" value="5" />
<property name="restartRequiresConfirmation" value="true" />
<property name="ANDROID_EXTENDED_DEVICE_CHOOSER_SERIALS" value="emulator-5554" />
<property name="ANDROID_EXTENDED_DEVICE_CHOOSER_SERIALS" value="" />
<property name="ANDROID_EXTENDED_DEVICE_CHOOSER_AVD" value="Nexus_5_API_21" />
<property name="FullScreen" value="false" />
</component>
......@@ -323,13 +323,12 @@
</option>
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="809" extended-state="6" />
<frame x="0" y="23" width="1440" height="809" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3997114" sideWeight="0.46280402" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32900432" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
......@@ -337,18 +336,19 @@
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32900432" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Android" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Android" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32756132" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.2532189" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21888413" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.22460657" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Memory Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3997114" sideWeight="0.53648067" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756132" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
......
......@@ -10,16 +10,16 @@
</intent-filter>
</activity>
<service android:name="de.appplant.cordova.plugin.background.ForegroundService" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.ClearReceiver" />
<activity android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.localnotification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.ClearReceiver" />
<receiver android:name="de.appplant.cordova.plugin.localnotification.RestoreReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.ClearReceiver" />
<activity android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.localnotification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.TriggerReceiver" />
<receiver android:exported="false" android:name="de.appplant.cordova.plugin.notification.ClearReceiver" />
<activity android:launchMode="singleInstance" android:name="de.appplant.cordova.plugin.notification.ClickActivity" android:theme="@android:style/Theme.NoDisplay" />
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />
......
......@@ -169,7 +169,7 @@
<script type="text/javascript">
schedule = function () {
cordova.plugins.notification.local.schedule({
id: 1,
// id: 1,
text: 'Test Message 1',
icon: 'http://www.optimizeordie.de/wp-content/plugins/social-media-widget/images/default/64/googleplus.png',
sound: null,
......
......@@ -30,7 +30,7 @@ var exec = require('cordova/exec'),
*************/
/**
* Returns the default settings
* Returns the default settings.
*
* @return {Object}
*/
......@@ -39,7 +39,7 @@ exports.getDefaults = function () {
};
/**
* Overwrite default settings
* Overwrite default settings.
*
* @param {Object} defaults
*/
......@@ -423,17 +423,25 @@ exports.registerPermission = function (callback, scope) {
exec(fn, null, 'LocalNotification', 'registerPermission', []);
};
/****************
* DEPRECATIONS *
****************/
/**
* @deprecated
*
* Register permission to show notifications if not already granted.
*
* @param {Function} callback
* The function to be exec as the callback
* @param {Object?} scope
* The callback function's scope
* Schedule a new local notification.
*/
exports.add = function () {
console.warn('Depreated: Please use `notification.local.schedule` instead.');
exports.schedule.apply(this, arguments);
};
/**
* Register permission to show notifications
* if not already granted.
*/
exports.promptForPermission = function (callback, scope) {
exports.promptForPermission = function () {
console.warn('Depreated: Please use `notification.local.registerPermission` instead.');
exports.registerPermission.apply(this, arguments);
......@@ -500,7 +508,7 @@ exports._defaults = {
title: '',
sound: 'res://platform_default',
badge: 0,
id: 0,
id: "0",
data: undefined,
every: undefined,
at: undefined
......
......@@ -180,7 +180,10 @@ public class LocalNotification extends CordovaPlugin {
for (int i = 0; i < notifications.length(); i++) {
JSONObject options = notifications.optJSONObject(i);
getNotificationMgr().schedule(options, TriggerReceiver.class);
Notification notification =
getNotificationMgr().schedule(options, TriggerReceiver.class);
fireEvent("schedule", notification);
}
}
......
......@@ -5,13 +5,11 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
07EF7CA952804739B03CB4EB /* APPBackgroundMode.m in Sources */ = {isa = PBXBuildFile; fileRef = FC90C5F7655742F7A2F6260D /* APPBackgroundMode.m */; };
1A68BCF10CCF44E68E4D5A1F /* Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = 861D9C8A19C8479794031087 /* Toast.m */; };
1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; };
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
22C378B88FE54751A0556F3D /* AppDelegate+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 83EB835EE2E5471A823EDD79 /* AppDelegate+APPLocalNotification.m */; };
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
2E82A380B0E9459D817476B6 /* Toast+UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = BDA3511B19544DD1A3B57680 /* Toast+UIView.m */; };
301BF552109A68D80062928A /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF535109A57CC0062928A /* libCordova.a */; };
......@@ -32,8 +30,6 @@
30B4F30219D5E07200D9F7D8 /* Default-Landscape-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */; };
30C1856619D5FC0A00212699 /* icon-60@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30C1856519D5FC0A00212699 /* icon-60@3x.png */; };
30FC414916E50CA1004E6F35 /* icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30FC414816E50CA1004E6F35 /* icon-72@2x.png */; };
3646009FCF7A45A08AB820A1 /* APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = A84ECB8A98AF4281A94E2988 /* APPLocalNotification.m */; };
4334127EA09C4EAAAAA21A98 /* UILocalNotification+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = C982EC49496C41DD90E3E3A4 /* UILocalNotification+APPLocalNotification.m */; };
5B1594DD16A7569C00FEF299 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */; };
7E7966DE1810823500FA85AD /* icon-40.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D41810823500FA85AD /* icon-40.png */; };
7E7966DF1810823500FA85AD /* icon-40@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D51810823500FA85AD /* icon-40@2x.png */; };
......@@ -46,11 +42,14 @@
7E7966E61810823500FA85AD /* icon-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DC1810823500FA85AD /* icon-small.png */; };
7E7966E71810823500FA85AD /* icon-small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DD1810823500FA85AD /* icon-small@2x.png */; };
95F7B7CD58D042F1A21EA9F2 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6049F41C5141414CB5E334F8 /* CDVDevice.m */; };
9BD25DB76D82460F960FB5B0 /* APPLocalNotificationOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A885252710547A5A2E13246 /* APPLocalNotificationOptions.m */; };
A4947EFB031A45529C300D6B /* appbeep.wav in Resources */ = {isa = PBXBuildFile; fileRef = D06E9448A3634B2CB28C3E99 /* appbeep.wav */; };
D4A0D8761607E02300AEF8BB /* Default-568h@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */; };
D7451B5B16B04543A0ED7055 /* UIApplication+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 95218A551820453C8FE5FBE8 /* UIApplication+APPLocalNotification.m */; };
E599728187B84453A916B456 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C8ED2EA1A59441ED986119EC /* QuartzCore.framework */; };
DAE5FB23C7C74A1C80E7F4A4 /* AppDelegate+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A4BD730EE0D4D32ABF56195 /* AppDelegate+APPLocalNotification.m */; };
48A15F545C6D42D8A7F9429B /* APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 26E442D70C7F4E15ADF9912C /* APPLocalNotification.m */; };
EFF5F943C4F048C0B00625C5 /* APPLocalNotificationOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 355C08D4AA654159A413873A /* APPLocalNotificationOptions.m */; };
7D5BA8D77AE34D169DEC092E /* UIApplication+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = C664471D641C40A49C2A28B6 /* UIApplication+APPLocalNotification.m */; };
433170AA61BE433BA00B15A4 /* UILocalNotification+APPLocalNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = E06ECFF0D7E2417DB1D26D79 /* UILocalNotification+APPLocalNotification.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -71,15 +70,12 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
0E713C3E317D48D2A68F1968 /* APPLocalNotificationOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APPLocalNotificationOptions.h; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotificationOptions.h"; sourceTree = "<group>"; };
1D3623240D0F684500981E51 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
1D3623250D0F684500981E51 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
1D6058910D05DD3D006BFB54 /* NotificationExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NotificationExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
1FC65370B4C5477EA42CE5ED /* APPLocalNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APPLocalNotification.h; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotification.h"; sourceTree = "<group>"; };
27600AF2F1504E6BB54CC047 /* Toast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Toast.h; path = "nl.x-services.plugins.toast/Toast.h"; sourceTree = "<group>"; };
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2A885252710547A5A2E13246 /* APPLocalNotificationOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = APPLocalNotificationOptions.m; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotificationOptions.m"; sourceTree = "<group>"; };
301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = CordovaLib/CordovaLib.xcodeproj; sourceTree = "<group>"; };
301BF56E109A69640062928A /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = SOURCE_ROOT; };
302D95EE14D2391D003F00A1 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
......@@ -103,7 +99,6 @@
32CA4F630368D1EE00C91783 /* NotificationExample-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NotificationExample-Prefix.pch"; sourceTree = "<group>"; };
5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; };
6049F41C5141414CB5E334F8 /* CDVDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVDevice.m; path = org.apache.cordova.device/CDVDevice.m; sourceTree = "<group>"; };
75B33918FF7B452AA6F2BA79 /* UIApplication+APPLocalNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIApplication+APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/UIApplication+APPLocalNotification.h"; sourceTree = "<group>"; };
7E7966D41810823500FA85AD /* icon-40.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-40.png"; sourceTree = "<group>"; };
7E7966D51810823500FA85AD /* icon-40@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-40@2x.png"; sourceTree = "<group>"; };
7E7966D61810823500FA85AD /* icon-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-50.png"; sourceTree = "<group>"; };
......@@ -114,25 +109,29 @@
7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; };
7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; };
7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; };
83EB835EE2E5471A823EDD79 /* AppDelegate+APPLocalNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "AppDelegate+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/AppDelegate+APPLocalNotification.m"; sourceTree = "<group>"; };
861D9C8A19C8479794031087 /* Toast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Toast.m; path = "nl.x-services.plugins.toast/Toast.m"; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* NotificationExample-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "NotificationExample-Info.plist"; path = "../NotificationExample-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
935C3E0E1BF94057A38D37C1 /* UILocalNotification+APPLocalNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UILocalNotification+APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/UILocalNotification+APPLocalNotification.h"; sourceTree = "<group>"; };
95218A551820453C8FE5FBE8 /* UIApplication+APPLocalNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIApplication+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/UIApplication+APPLocalNotification.m"; sourceTree = "<group>"; };
A280A4A360AC4E419CE00FBB /* APPBackgroundMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APPBackgroundMode.h; path = "de.appplant.cordova.plugin.background-mode/APPBackgroundMode.h"; sourceTree = "<group>"; };
A84ECB8A98AF4281A94E2988 /* APPLocalNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = APPLocalNotification.m; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotification.m"; sourceTree = "<group>"; };
B2CA862435D347FFB2213A84 /* CDVDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDevice.h; path = org.apache.cordova.device/CDVDevice.h; sourceTree = "<group>"; };
BDA3511B19544DD1A3B57680 /* Toast+UIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "Toast+UIView.m"; path = "nl.x-services.plugins.toast/Toast+UIView.m"; sourceTree = "<group>"; };
C8ED2EA1A59441ED986119EC /* QuartzCore.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
C982EC49496C41DD90E3E3A4 /* UILocalNotification+APPLocalNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UILocalNotification+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/UILocalNotification+APPLocalNotification.m"; sourceTree = "<group>"; };
D06E9448A3634B2CB28C3E99 /* appbeep.wav */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = unknown; path = appbeep.wav; sourceTree = "<group>"; };
D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; };
DFD661802D014B7EADCA5C18 /* AppDelegate+APPLocalNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "AppDelegate+APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/AppDelegate+APPLocalNotification.h"; sourceTree = "<group>"; };
EB87FDF31871DA8E0020F90C /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; name = www; path = ../../www; sourceTree = "<group>"; };
EB87FDF41871DAF40020F90C /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = ../../config.xml; sourceTree = "<group>"; };
F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = NotificationExample/config.xml; sourceTree = "<group>"; };
FC90C5F7655742F7A2F6260D /* APPBackgroundMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = APPBackgroundMode.m; path = "de.appplant.cordova.plugin.background-mode/APPBackgroundMode.m"; sourceTree = "<group>"; };
FF1EED1034F04D93903F6A34 /* Toast+UIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Toast+UIView.h"; path = "nl.x-services.plugins.toast/Toast+UIView.h"; sourceTree = "<group>"; };
9A4BD730EE0D4D32ABF56195 /* AppDelegate+APPLocalNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "AppDelegate+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/AppDelegate+APPLocalNotification.m"; sourceTree = "<group>"; fileEncoding = 4; };
26E442D70C7F4E15ADF9912C /* APPLocalNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotification.m"; sourceTree = "<group>"; fileEncoding = 4; };
355C08D4AA654159A413873A /* APPLocalNotificationOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "APPLocalNotificationOptions.m"; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotificationOptions.m"; sourceTree = "<group>"; fileEncoding = 4; };
C664471D641C40A49C2A28B6 /* UIApplication+APPLocalNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "UIApplication+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/UIApplication+APPLocalNotification.m"; sourceTree = "<group>"; fileEncoding = 4; };
E06ECFF0D7E2417DB1D26D79 /* UILocalNotification+APPLocalNotification.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "UILocalNotification+APPLocalNotification.m"; path = "de.appplant.cordova.plugin.local-notification/UILocalNotification+APPLocalNotification.m"; sourceTree = "<group>"; fileEncoding = 4; };
E1E710695E454B14B381AAA7 /* AppDelegate+APPLocalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "AppDelegate+APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/AppDelegate+APPLocalNotification.h"; sourceTree = "<group>"; fileEncoding = 4; };
51B78CEFCD3345EFA4891F09 /* APPLocalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotification.h"; sourceTree = "<group>"; fileEncoding = 4; };
AC6C9F9E2B5E4AF690052423 /* APPLocalNotificationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "APPLocalNotificationOptions.h"; path = "de.appplant.cordova.plugin.local-notification/APPLocalNotificationOptions.h"; sourceTree = "<group>"; fileEncoding = 4; };
5CE44461FC4946B0AD50F90D /* UIApplication+APPLocalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "UIApplication+APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/UIApplication+APPLocalNotification.h"; sourceTree = "<group>"; fileEncoding = 4; };
A744955EE7434F9A95AAC9CA /* UILocalNotification+APPLocalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "UILocalNotification+APPLocalNotification.h"; path = "de.appplant.cordova.plugin.local-notification/UILocalNotification+APPLocalNotification.h"; sourceTree = "<group>"; fileEncoding = 4; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -241,16 +240,16 @@
861D9C8A19C8479794031087 /* Toast.m */,
FF1EED1034F04D93903F6A34 /* Toast+UIView.h */,
27600AF2F1504E6BB54CC047 /* Toast.h */,
83EB835EE2E5471A823EDD79 /* AppDelegate+APPLocalNotification.m */,
A84ECB8A98AF4281A94E2988 /* APPLocalNotification.m */,
2A885252710547A5A2E13246 /* APPLocalNotificationOptions.m */,
95218A551820453C8FE5FBE8 /* UIApplication+APPLocalNotification.m */,
C982EC49496C41DD90E3E3A4 /* UILocalNotification+APPLocalNotification.m */,
DFD661802D014B7EADCA5C18 /* AppDelegate+APPLocalNotification.h */,
1FC65370B4C5477EA42CE5ED /* APPLocalNotification.h */,
0E713C3E317D48D2A68F1968 /* APPLocalNotificationOptions.h */,
75B33918FF7B452AA6F2BA79 /* UIApplication+APPLocalNotification.h */,
935C3E0E1BF94057A38D37C1 /* UILocalNotification+APPLocalNotification.h */,
9A4BD730EE0D4D32ABF56195 /* AppDelegate+APPLocalNotification.m */,
26E442D70C7F4E15ADF9912C /* APPLocalNotification.m */,
355C08D4AA654159A413873A /* APPLocalNotificationOptions.m */,
C664471D641C40A49C2A28B6 /* UIApplication+APPLocalNotification.m */,
E06ECFF0D7E2417DB1D26D79 /* UILocalNotification+APPLocalNotification.m */,
E1E710695E454B14B381AAA7 /* AppDelegate+APPLocalNotification.h */,
51B78CEFCD3345EFA4891F09 /* APPLocalNotification.h */,
AC6C9F9E2B5E4AF690052423 /* APPLocalNotificationOptions.h */,
5CE44461FC4946B0AD50F90D /* UIApplication+APPLocalNotification.h */,
A744955EE7434F9A95AAC9CA /* UILocalNotification+APPLocalNotification.h */,
);
name = Plugins;
path = NotificationExample/Plugins;
......@@ -440,11 +439,11 @@
07EF7CA952804739B03CB4EB /* APPBackgroundMode.m in Sources */,
2E82A380B0E9459D817476B6 /* Toast+UIView.m in Sources */,
1A68BCF10CCF44E68E4D5A1F /* Toast.m in Sources */,
22C378B88FE54751A0556F3D /* AppDelegate+APPLocalNotification.m in Sources */,
3646009FCF7A45A08AB820A1 /* APPLocalNotification.m in Sources */,
9BD25DB76D82460F960FB5B0 /* APPLocalNotificationOptions.m in Sources */,
D7451B5B16B04543A0ED7055 /* UIApplication+APPLocalNotification.m in Sources */,
4334127EA09C4EAAAAA21A98 /* UILocalNotification+APPLocalNotification.m in Sources */,
DAE5FB23C7C74A1C80E7F4A4 /* AppDelegate+APPLocalNotification.m in Sources */,
48A15F545C6D42D8A7F9429B /* APPLocalNotification.m in Sources */,
EFF5F943C4F048C0B00625C5 /* APPLocalNotificationOptions.m in Sources */,
7D5BA8D77AE34D169DEC092E /* UIApplication+APPLocalNotification.m in Sources */,
433170AA61BE433BA00B15A4 /* UILocalNotification+APPLocalNotification.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -27,8 +27,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@interface APPLocalNotification ()
// Retrieves the application state
......@@ -411,16 +409,17 @@
*/
- (void) registerPermission:(CDVInvokedUrlCommand*)command
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
_command = command;
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
_command = command;
[self.commandDelegate runInBackground:^{
[self.app registerPermissionToScheduleLocalNotifications];
}];
#else
[self hasPermission:command];
#endif
[self.commandDelegate runInBackground:^{
[self.app registerPermissionToScheduleLocalNotifications];
}];
} else {
[self hasPermission:command];
}
}
#pragma mark -
......
......@@ -159,7 +159,7 @@ NSString* const DEFAULT_SOUND = @"res://platform_default";
else if ([interval isEqualToString:@"minute"]) {
return NSCalendarUnitMinute;
}
else if ([interval isEqualToString:@"houre"]) {
else if ([interval isEqualToString:@"hour"]) {
return NSCalendarUnitHour;
}
else if ([interval isEqualToString:@"day"]) {
......
......@@ -24,8 +24,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@implementation UIApplication (APPLocalNotification)
#pragma mark -
......@@ -36,19 +34,21 @@
*/
- (BOOL) hasPermissionToScheduleLocalNotifications
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType types;
UIUserNotificationSettings *settings;
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType types;
UIUserNotificationSettings *settings;
settings = [[UIApplication sharedApplication]
currentUserNotificationSettings];
settings = [[UIApplication sharedApplication]
currentUserNotificationSettings];
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
return (settings.types & types);
#else
return YES;
#endif
return (settings.types & types);
} else {
return YES;
}
}
/**
......@@ -56,18 +56,20 @@
*/
- (void) registerPermissionToScheduleLocalNotifications
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType types;
UIUserNotificationSettings *settings;
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType types;
UIUserNotificationSettings *settings;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
settings = [UIUserNotificationSettings settingsForTypes:types
categories:nil];
settings = [UIUserNotificationSettings settingsForTypes:types
categories:nil];
[[UIApplication sharedApplication]
registerUserNotificationSettings:settings];
#endif
[[UIApplication sharedApplication]
registerUserNotificationSettings:settings];
}
}
#pragma mark -
......
......@@ -166,7 +166,6 @@ NSInteger const APPLocalNotificationTypeTriggered = 2;
NSData* data;
NSMutableDictionary* obj = [self.userInfo mutableCopy];
[obj removeObjectForKey:@"json"];
[obj removeObjectForKey:@"updatedAt"];
data = [NSJSONSerialization dataWithJSONObject:obj
......
......@@ -289,48 +289,48 @@
<!-- IDs -->
<script type="text/javascript">
var callback = function (ids) {
var fn = function (ids) {
showToast(ids.length === 0 ? '- none -' : ids.join(' ,'));
};
getIds = function () {
cordova.plugins.notification.local.getIds(callback);
cordova.plugins.notification.local.getIds(fn);
};
getScheduledIds = function () {
cordova.plugins.notification.local.getScheduledIds(callback);
cordova.plugins.notification.local.getScheduledIds(fn);
};
getTriggeredIds = function () {
cordova.plugins.notification.local.getTriggeredIds(callback);
cordova.plugins.notification.local.getTriggeredIds(fn);
};
</script>
<!-- notifications -->
<script type="text/javascript">
var callback = function (notifications) {
var fn = function (notifications) {
console.log(notifications);
showToast(notifications.length === 0 ? '- none -' : notifications.join(' ,'));
};
get = function () {
cordova.plugins.notification.local.get(1, callback);
cordova.plugins.notification.local.get(1, fn);
};
getMultiple = function () {
cordova.plugins.notification.local.get([1, 2], callback);
cordova.plugins.notification.local.get([1, 2], fn);
};
getAll = function () {
cordova.plugins.notification.local.getAll(callback);
cordova.plugins.notification.local.getAll(fn);
};
getScheduled = function () {
cordova.plugins.notification.local.getScheduled(callback);
cordova.plugins.notification.local.getScheduled(fn);
};
getTriggered = function () {
cordova.plugins.notification.local.getTriggered(callback);
cordova.plugins.notification.local.getTriggered(fn);
};
</script>
......
......@@ -30,7 +30,7 @@ var exec = require('cordova/exec'),
*************/
/**
* Returns the default settings
* Returns the default settings.
*
* @return {Object}
*/
......@@ -39,7 +39,7 @@ exports.getDefaults = function () {
};
/**
* Overwrite default settings
* Overwrite default settings.
*
* @param {Object} defaults
*/
......@@ -423,17 +423,25 @@ exports.registerPermission = function (callback, scope) {
exec(fn, null, 'LocalNotification', 'registerPermission', []);
};
/****************
* DEPRECATIONS *
****************/
/**
* @deprecated
*
* Register permission to show notifications if not already granted.
*
* @param {Function} callback
* The function to be exec as the callback
* @param {Object?} scope
* The callback function's scope
* Schedule a new local notification.
*/
exports.add = function () {
console.warn('Depreated: Please use `notification.local.schedule` instead.');
exports.schedule.apply(this, arguments);
};
/**
* Register permission to show notifications
* if not already granted.
*/
exports.promptForPermission = function (callback, scope) {
exports.promptForPermission = function () {
console.warn('Depreated: Please use `notification.local.registerPermission` instead.');
exports.registerPermission.apply(this, arguments);
......@@ -500,7 +508,7 @@ exports._defaults = {
title: '',
sound: 'res://platform_default',
badge: 0,
id: 0,
id: "0",
data: undefined,
every: undefined,
at: undefined
......
......@@ -59,7 +59,7 @@
"count": 1
},
{
"xml": "<receiver android:name=\"de.appplant.cordova.plugin.notification.RestoreReceiver\"><intent-filter><action android:name=\"android.intent.action.BOOT_COMPLETED\" /></intent-filter></receiver>",
"xml": "<receiver android:name=\"de.appplant.cordova.plugin.localnotification.RestoreReceiver\"><intent-filter><action android:name=\"android.intent.action.BOOT_COMPLETED\" /></intent-filter></receiver>",
"count": 1
},
{
......
......@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2013-2015 appPlant UG, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
......
<p align="right">
<a href="https://github.com/katzer/cordova-plugin-local-notifications/tree/example">EXAMPLE :point_right:</a>
</p>
Cordova Local-Notification Plugin
==================================
......@@ -145,8 +150,7 @@ The method takes a hash as an argument to specify the notification's properties
Scheduling a local notification will override an earlier one with the same ID.
All properties are optional. If no date object is given, the notification pops-up immediately.
**Note:** On Android the notification id needs to be a string which can be converted to a number.
If the ID has an invalid format, it will be ignored, but cancelling the notification will fail.
**Note:** The notification ID must be a string which can be converted to a number (that is, `isNaN()` returns false for). If the ID has an invalid format, it will silently be changed to `0` and will override an earlier one with the same ID.
#### Further information
- See the [onadd][onadd] event for registering a listener to be notified when a local notification has been scheduled.
......
......@@ -14,12 +14,16 @@
<author>Sebastián Katzer</author>
<!-- cordova -->
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<dependency id="org.apache.cordova.device" url="https://github.com/apache/cordova-plugin-device" />
<dependency
id="org.apache.cordova.device"
url="https://github.com/apache/cordova-plugin-device" />
<!-- js -->
<js-module src="www/local-notification.js" name="LocalNotification">
<clobbers target="cordova.plugins.notification.local" />
<clobbers target="plugin.notification.local" />
......@@ -81,7 +85,7 @@
android:name="de.appplant.cordova.plugin.notification.ClearReceiver"
android:exported="false" />
<receiver android:name="de.appplant.cordova.plugin.notification.RestoreReceiver" >
<receiver android:name="de.appplant.cordova.plugin.localnotification.RestoreReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
......
......@@ -180,7 +180,10 @@ public class LocalNotification extends CordovaPlugin {
for (int i = 0; i < notifications.length(); i++) {
JSONObject options = notifications.optJSONObject(i);
getNotificationMgr().schedule(options, TriggerReceiver.class);
Notification notification =
getNotificationMgr().schedule(options, TriggerReceiver.class);
fireEvent("schedule", notification);
}
}
......
......@@ -27,8 +27,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@interface APPLocalNotification ()
// Retrieves the application state
......@@ -411,16 +409,17 @@
*/
- (void) registerPermission:(CDVInvokedUrlCommand*)command
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
_command = command;
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
_command = command;
[self.commandDelegate runInBackground:^{
[self.app registerPermissionToScheduleLocalNotifications];
}];
#else
[self hasPermission:command];
#endif
[self.commandDelegate runInBackground:^{
[self.app registerPermissionToScheduleLocalNotifications];
}];
} else {
[self hasPermission:command];
}
}
#pragma mark -
......
......@@ -159,7 +159,7 @@ NSString* const DEFAULT_SOUND = @"res://platform_default";
else if ([interval isEqualToString:@"minute"]) {
return NSCalendarUnitMinute;
}
else if ([interval isEqualToString:@"houre"]) {
else if ([interval isEqualToString:@"hour"]) {
return NSCalendarUnitHour;
}
else if ([interval isEqualToString:@"day"]) {
......
......@@ -24,8 +24,6 @@
#import "UIApplication+APPLocalNotification.h"
#import "UILocalNotification+APPLocalNotification.h"
#import <Availability.h>
@implementation UIApplication (APPLocalNotification)
#pragma mark -
......@@ -36,19 +34,21 @@
*/
- (BOOL) hasPermissionToScheduleLocalNotifications
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType types;
UIUserNotificationSettings *settings;
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType types;
UIUserNotificationSettings *settings;
settings = [[UIApplication sharedApplication]
currentUserNotificationSettings];
settings = [[UIApplication sharedApplication]
currentUserNotificationSettings];
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
return (settings.types & types);
#else
return YES;
#endif
return (settings.types & types);
} else {
return YES;
}
}
/**
......@@ -56,18 +56,20 @@
*/
- (void) registerPermissionToScheduleLocalNotifications
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType types;
UIUserNotificationSettings *settings;
if ([[UIApplication sharedApplication]
respondsToSelector:@selector(registerUserNotificationSettings:)])
{
UIUserNotificationType types;
UIUserNotificationSettings *settings;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
types = UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
settings = [UIUserNotificationSettings settingsForTypes:types
categories:nil];
settings = [UIUserNotificationSettings settingsForTypes:types
categories:nil];
[[UIApplication sharedApplication]
registerUserNotificationSettings:settings];
#endif
[[UIApplication sharedApplication]
registerUserNotificationSettings:settings];
}
}
#pragma mark -
......
......@@ -166,7 +166,6 @@ NSInteger const APPLocalNotificationTypeTriggered = 2;
NSData* data;
NSMutableDictionary* obj = [self.userInfo mutableCopy];
[obj removeObjectForKey:@"json"];
[obj removeObjectForKey:@"updatedAt"];
data = [NSJSONSerialization dataWithJSONObject:obj
......
......@@ -30,7 +30,7 @@ var exec = require('cordova/exec'),
*************/
/**
* Returns the default settings
* Returns the default settings.
*
* @return {Object}
*/
......@@ -39,7 +39,7 @@ exports.getDefaults = function () {
};
/**
* Overwrite default settings
* Overwrite default settings.
*
* @param {Object} defaults
*/
......@@ -423,17 +423,25 @@ exports.registerPermission = function (callback, scope) {
exec(fn, null, 'LocalNotification', 'registerPermission', []);
};
/****************
* DEPRECATIONS *
****************/
/**
* @deprecated
*
* Register permission to show notifications if not already granted.
*
* @param {Function} callback
* The function to be exec as the callback
* @param {Object?} scope
* The callback function's scope
* Schedule a new local notification.
*/
exports.add = function () {
console.warn('Depreated: Please use `notification.local.schedule` instead.');
exports.schedule.apply(this, arguments);
};
/**
* Register permission to show notifications
* if not already granted.
*/
exports.promptForPermission = function (callback, scope) {
exports.promptForPermission = function () {
console.warn('Depreated: Please use `notification.local.registerPermission` instead.');
exports.registerPermission.apply(this, arguments);
......@@ -500,7 +508,7 @@ exports._defaults = {
title: '',
sound: 'res://platform_default',
badge: 0,
id: 0,
id: "0",
data: undefined,
every: undefined,
at: undefined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment