CB-6521: Remove development branch
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 7a4a3ea..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 8ec56a5..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Cordova
-Copyright 2012 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
diff --git a/README.md b/README.md
index 8fa5da4..b58feac 100644
--- a/README.md
+++ b/README.md
@@ -20,3 +20,5 @@
# org.apache.cordova.dialogs
Plugin documentation: [doc/index.md](doc/index.md)
+
+This is `dev` - the deprecated development branch of this plugin; development of this plugin has moved to the `master` branch
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
deleted file mode 100644
index aed8d0b..0000000
--- a/RELEASENOTES.md
+++ /dev/null
@@ -1,67 +0,0 @@
-<!--
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
--->
-# Release Notes
-
-### 0.2.2 (Sept 25, 2013)
-* CB-4889 bumping&resetting version
-* [windows8] commandProxy was moved
-* CB-4889 renaming reference in Notification.cs
-* CB-4889 renaming org.apache.cordova.core.dialogs to org.apache.cordova.dialogs
-* Rename CHANGELOG.md -> RELEASENOTES.md
-* [CB-4592] [Blackberry10] Added beep support
-* [CB-4752] Incremented plugin version on dev branch.
-
- ### 0.2.3 (Oct 28, 2013)
-* CB-5128: added repo + issue tag to plugin.xml for dialogs plugin
-* new plugin execute arguments supported
-* new plugin style
-* smaller fonts styling input
-* img files copied inside plugin
-* style added
-* prompt added
-* styling from James
-* fixed "exec" calls addedd css, but not working yet
-* first (blind) try
-* [CB-4915] Incremented plugin version on dev branch.
-
-
-### 0.2.4 (Dec 4, 2013)
-* add ubuntu platform
-* 1. Added amazon-fireos platform. 2. Change to use amazon-fireos as a platform if user agent string contains 'cordova-amazon-fireos'.
-* added beep funtionality using ms-winsoundevent:Notfication.Default
-
-### 0.2.5 (Jan 02, 2014)
-* CB-4696 Fix compile error for Xcode 4.5.
-* CB-5658 Add doc/index.md for Dialogs plugin
-* CB-3762 Change prompt default to empty string
-* Move images from css to img
-
-### 0.2.6 (Feb 05, 2014)
-* no need to recreate the manifest.webapp file after each `cordova prepare` for FFOS
-* FFOS description added
-
-### 0.2.7 (Apr 17, 2014)
-* CB-6212: [iOS] fix warnings compiled under arm64 64-bit
-* CB-6411: [BlackBerry10] Work around Audio playback issue
-* CB-6411: [BlackBerry10] Updates to beep
-* CB-6422: [windows8] use cordova/exec/proxy
-* CB-6460: Update license headers
-* Add NOTICE file
diff --git a/doc/index.md b/doc/index.md
deleted file mode 100644
index 1cb3e09..0000000
--- a/doc/index.md
+++ /dev/null
@@ -1,261 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# org.apache.cordova.dialogs
-
-This plugin provides access to some native dialog UI elements.
-
-## Installation
-
- cordova plugin add org.apache.cordova.dialogs
-
-### Firefox OS Quirks
-
-Create __www/manifest.webapp__ as described in
-[Manifest Docs](https://developer.mozilla.org/en-US/Apps/Developing/Manifest).
-Add permisions:
-
- "permissions": {
- "desktop-notification": {
- "description": "Describe why you need to enable notifications"
- }
- }
-
-Edit __www/index.html__ and add following in `head` section:
-
- <link rel="stylesheet" type="text/css" href="css/notification.css" />
-
-## Methods
-
-- `navigator.notification.alert`
-- `navigator.notification.confirm`
-- `navigator.notification.prompt`
-- `navigator.notification.beep`
-
-## navigator.notification.alert
-
-Shows a custom alert or dialog box. Most Cordova implementations use a native
-dialog box for this feature, but some platforms use the browser's `alert`
-function, which is typically less customizable.
-
- navigator.notification.alert(message, alertCallback, [title], [buttonName])
-
-- __message__: Dialog message. _(String)_
-
-- __alertCallback__: Callback to invoke when alert dialog is dismissed. _(Function)_
-
-- __title__: Dialog title. _(String)_ (Optional, defaults to `Alert`)
-
-- __buttonName__: Button name. _(String)_ (Optional, defaults to `OK`)
-
-
-### Example
-
- function alertDismissed() {
- // do something
- }
-
- navigator.notification.alert(
- 'You are the winner!', // message
- alertDismissed, // callback
- 'Game Over', // title
- 'Done' // buttonName
- );
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Tizen
-- Windows Phone 7 and 8
-- Windows 8
-
-### Windows Phone 7 and 8 Quirks
-
-- There is no built-in browser alert, but you can bind one as follows to call `alert()` in the global scope:
-
- window.alert = navigator.notification.alert;
-
-- Both `alert` and `confirm` are non-blocking calls, results of which are only available asynchronously.
-
-### Firefox OS Quirks:
-
-Both native-blocking `window.alert()` and non-blocking `navigator.notification.alert()` are available.
-
-## navigator.notification.confirm
-
-Displays a customizable confirmation dialog box.
-
- navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
-
-- __message__: Dialog message. _(String)_
-
-- __confirmCallback__: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). _(Function)_
-
-- __title__: Dialog title. _(String)_ (Optional, defaults to `Confirm`)
-
-- __buttonLabels__: Array of strings specifying button labels. _(Array)_ (Optional, defaults to [`OK,Cancel`])
-
-
-### confirmCallback
-
-The `confirmCallback` executes when the user presses one of the
-buttons in the confirmation dialog box.
-
-The callback takes the argument `buttonIndex` _(Number)_, which is the
-index of the pressed button. Note that the index uses one-based
-indexing, so the value is `1`, `2`, `3`, etc.
-
-### Example
-
- function onConfirm(buttonIndex) {
- alert('You selected button ' + buttonIndex);
- }
-
- navigator.notification.confirm(
- 'You are the winner!', // message
- onConfirm, // callback to invoke with index of button pressed
- 'Game Over', // title
- ['Restart','Exit'] // buttonLabels
- );
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- Firefox OS
-- iOS
-- Tizen
-- Windows Phone 7 and 8
-- Windows 8
-
-### Windows Phone 7 and 8 Quirks
-
-- There is no built-in browser function for `window.confirm`, but you can bind it by assigning:
-
- window.confirm = navigator.notification.confirm;
-
-- Calls to `alert` and `confirm` are non-blocking, so the result is only available asynchronously.
-
-### Firefox OS Quirks:
-
-Both native-blocking `window.confirm()` and non-blocking `navigator.notification.confirm()` are available.
-
-## navigator.notification.prompt
-
-Displays a native dialog box that is more customizable than the browser's `prompt` function.
-
- navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText])
-
-- __message__: Dialog message. _(String)_
-
-- __promptCallback__: Callback to invoke when a button is pressed. _(Function)_
-
-- __title__: Dialog title _(String)_ (Optional, defaults to `Prompt`)
-
-- __buttonLabels__: Array of strings specifying button labels _(Array)_ (Optional, defaults to `["OK","Cancel"]`)
-
-- __defaultText__: Default textbox input value (`String`) (Optional, Default: empty string)
-
-### promptCallback
-
-The `promptCallback` executes when the user presses one of the buttons
-in the prompt dialog box. The `results` object passed to the callback
-contains the following properties:
-
-- __buttonIndex__: The index of the pressed button. _(Number)_ Note that the index uses one-based indexing, so the value is `1`, `2`, `3`, etc.
-
-- __input1__: The text entered in the prompt dialog box. _(String)_
-
-### Example
-
- function onPrompt(results) {
- alert("You selected button number " + results.buttonIndex + " and entered " + results.input1);
- }
-
- navigator.notification.prompt(
- 'Please enter your name', // message
- onPrompt, // callback to invoke
- 'Registration', // title
- ['Ok','Exit'], // buttonLabels
- 'Jane Doe' // defaultText
- );
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- Firefox OS
-- iOS
-
-### Android Quirks
-
-- Android supports a maximum of three buttons, and ignores any more than that.
-
-- On Android 3.0 and later, buttons are displayed in reverse order for devices that use the Holo theme.
-
-### Firefox OS Quirks:
-
-Both native-blocking `window.prompt()` and non-blocking `navigator.notification.prompt()` are available.
-
-## navigator.notification.beep
-
-The device plays a beep sound.
-
- navigator.notification.beep(times);
-
-- __times__: The number of times to repeat the beep. _(Number)_
-
-### Example
-
- // Beep twice!
- navigator.notification.beep(2);
-
-### Supported Platforms
-
-- Amazon Fire OS
-- Android
-- BlackBerry 10
-- iOS
-- Tizen
-- Windows Phone 7 and 8
-- Windows 8
-
-### Amazon Fire OS Quirks
-
-- Amazon Fire OS plays the default __Notification Sound__ specified under the __Settings/Display & Sound__ panel.
-
-### Android Quirks
-
-- Android plays the default __Notification ringtone__ specified under the __Settings/Sound & Display__ panel.
-
-### Windows Phone 7 and 8 Quirks
-
-- Relies on a generic beep file from the Cordova distribution.
-
-### Tizen Quirks
-
-- Tizen implements beeps by playing an audio file via the media API.
-
-- The beep file must be short, must be located in a `sounds` subdirectory of the application's root directory, and must be named `beep.wav`.
-
diff --git a/plugin.xml b/plugin.xml
deleted file mode 100644
index 928fc04..0000000
--- a/plugin.xml
+++ /dev/null
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
- id="org.apache.cordova.dialogs"
- version="0.2.8-dev">
-
- <name>Notification</name>
- <description>Cordova Notification Plugin</description>
- <license>Apache 2.0</license>
- <keywords>cordova,notification</keywords>
- <repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git</repo>
- <issue>https://issues.apache.org/jira/browse/CB/component/12320642</issue>
-
- <js-module src="www/notification.js" name="notification">
- <merges target="navigator.notification" />
- </js-module>
-
- <!-- firefoxos -->
- <platform name="firefoxos">
- <config-file target="config.xml" parent="/*">
- <feature name="Notification">
- <param name="firefoxos-package" value="Notification" />
- </feature>
- </config-file>
-
- <asset src="www/firefoxos/notification.css" target="css/notification.css" />
- <asset src="www/firefoxos/danger-press.png" target="img/danger-press.png" />
- <asset src="www/firefoxos/danger.png" target="img/danger.png" />
- <asset src="www/firefoxos/default.png" target="img/default.png" />
- <asset src="www/firefoxos/gradient.png" target="img/gradient.png" />
- <asset src="www/firefoxos/pattern.png" target="img/pattern.png" />
- <asset src="www/firefoxos/recommend.png" target="img/recommend.png" />
- <js-module src="src/firefoxos/notification.js" name="dialogs-impl">
- <runs />
- </js-module>
- </platform>
-
- <!-- android -->
- <platform name="android">
- <config-file target="res/xml/config.xml" parent="/*">
- <feature name="Notification">
- <param name="android-package" value="org.apache.cordova.dialogs.Notification"/>
- </feature>
- </config-file>
-
- <source-file src="src/android/Notification.java" target-dir="src/org/apache/cordova/dialogs" />
-
- <!-- android specific notification apis -->
- <js-module src="www/android/notification.js" name="notification_android">
- <merges target="navigator.notification" />
- </js-module>
-
- </platform>
-
- <!-- amazon-fireos -->
- <platform name="amazon-fireos">
- <config-file target="res/xml/config.xml" parent="/*">
- <feature name="Notification">
- <param name="android-package" value="org.apache.cordova.dialogs.Notification"/>
- </feature>
- </config-file>
-
- <source-file src="src/android/Notification.java" target-dir="src/org/apache/cordova/dialogs" />
-
- <!-- android specific notification apis -->
- <js-module src="www/android/notification.js" name="notification_android">
- <merges target="navigator.notification" />
- </js-module>
-
- </platform>
-
- <!-- ubuntu -->
- <platform name="ubuntu">
- <header-file src="src/ubuntu/notification.h" />
- <source-file src="src/ubuntu/notification.cpp" />
- <resource-file src="src/ubuntu/notification.qml" />
- </platform>
-
- <!-- ubuntu -->
- <platform name="ubuntu">
- <header-file src="src/ubuntu/notification.h" />
- <source-file src="src/ubuntu/notification.cpp" />
- <resource-file src="src/ubuntu/notification.qml" />
- </platform>
-
- <!-- ubuntu -->
- <platform name="ubuntu">
- <header-file src="src/ubuntu/notification.h" />
- <source-file src="src/ubuntu/notification.cpp" />
- <resource-file src="src/ubuntu/notification.qml" />
- </platform>
-
- <!-- ios -->
- <platform name="ios">
- <config-file target="config.xml" parent="/*">
- <feature name="Notification">
- <param name="ios-package" value="CDVNotification"/>
- </feature>
- </config-file>
- <header-file src="src/ios/CDVNotification.h" />
- <source-file src="src/ios/CDVNotification.m" />
- <resource-file src="src/ios/CDVNotification.bundle" />
- <framework src="AudioToolbox.framework" weak="true" />
- </platform>
-
- <!-- blackberry10 -->
- <platform name="blackberry10">
- <source-file src="src/blackberry10/index.js" target-dir="Notification" />
- <config-file target="www/config.xml" parent="/widget">
- <feature name="Notification" value="Notification"/>
- </config-file>
- <js-module src="www/blackberry10/beep.js" name="beep">
- <clobbers target="window.navigator.notification.beep" />
- </js-module>
- <source-file src="www/blackberry10/notification-beep.wav" />
- </platform>
-
- <!-- wp7 -->
- <platform name="wp7">
- <config-file target="config.xml" parent="/*">
- <feature name="Notification">
- <param name="wp-package" value="Notification"/>
- </feature>
- </config-file>
-
- <source-file src="src/wp/Notification.cs" />
- <source-file src="src/wp/NotificationBox.xaml.cs" />
- <source-file src="src/wp/NotificationBox.xaml" />
- <source-file src="src/wp/notification-beep.wav" />
- </platform>
-
- <!-- wp8 -->
- <platform name="wp8">
- <config-file target="config.xml" parent="/*">
- <feature name="Notification">
- <param name="wp-package" value="Notification"/>
- </feature>
- </config-file>
-
- <source-file src="src/wp/Notification.cs" />
- <source-file src="src/wp/NotificationBox.xaml.cs" />
- <source-file src="src/wp/NotificationBox.xaml" />
- <source-file src="src/wp/notification-beep.wav" />
- </platform>
-
- <!-- windows8 -->
- <platform name="windows8">
- <js-module src="src/windows8/NotificationProxy.js" name="NotificationProxy">
- <merges target="" />
- </js-module>
- </platform>
-
-</plugin>
diff --git a/src/android/Notification.java b/src/android/Notification.java
deleted file mode 100755
index d068612..0000000
--- a/src/android/Notification.java
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-package org.apache.cordova.dialogs;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaInterface;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import android.app.AlertDialog;
-import android.app.ProgressDialog;
-import android.content.DialogInterface;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.widget.EditText;
-
-/**
- * This class provides access to notifications on the device.
- */
-public class Notification extends CordovaPlugin {
-
- public int confirmResult = -1;
- public ProgressDialog spinnerDialog = null;
- public ProgressDialog progressDialog = null;
-
- /**
- * Constructor.
- */
- public Notification() {
- }
-
- /**
- * Executes the request and returns PluginResult.
- *
- * @param action The action to execute.
- * @param args JSONArray of arguments for the plugin.
- * @param callbackContext The callback context used when calling back into JavaScript.
- * @return True when the action was valid, false otherwise.
- */
- public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
- /*
- * Don't run any of these if the current activity is finishing
- * in order to avoid android.view.WindowManager$BadTokenException
- * crashing the app. Just return true here since false should only
- * be returned in the event of an invalid action.
- */
- if(this.cordova.getActivity().isFinishing()) return true;
-
- if (action.equals("beep")) {
- this.beep(args.getLong(0));
- }
- else if (action.equals("alert")) {
- this.alert(args.getString(0), args.getString(1), args.getString(2), callbackContext);
- return true;
- }
- else if (action.equals("confirm")) {
- this.confirm(args.getString(0), args.getString(1), args.getJSONArray(2), callbackContext);
- return true;
- }
- else if (action.equals("prompt")) {
- this.prompt(args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), callbackContext);
- return true;
- }
- else if (action.equals("activityStart")) {
- this.activityStart(args.getString(0), args.getString(1));
- }
- else if (action.equals("activityStop")) {
- this.activityStop();
- }
- else if (action.equals("progressStart")) {
- this.progressStart(args.getString(0), args.getString(1));
- }
- else if (action.equals("progressValue")) {
- this.progressValue(args.getInt(0));
- }
- else if (action.equals("progressStop")) {
- this.progressStop();
- }
- else {
- return false;
- }
-
- // Only alert and confirm are async.
- callbackContext.success();
- return true;
- }
-
- //--------------------------------------------------------------------------
- // LOCAL METHODS
- //--------------------------------------------------------------------------
-
- /**
- * Beep plays the default notification ringtone.
- *
- * @param count Number of times to play notification
- */
- public void beep(long count) {
- Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
- Ringtone notification = RingtoneManager.getRingtone(this.cordova.getActivity().getBaseContext(), ringtone);
-
- // If phone is not set to silent mode
- if (notification != null) {
- for (long i = 0; i < count; ++i) {
- notification.play();
- long timeout = 5000;
- while (notification.isPlaying() && (timeout > 0)) {
- timeout = timeout - 100;
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- }
- }
- }
- }
- }
-
- /**
- * Builds and shows a native Android alert with given Strings
- * @param message The message the alert should display
- * @param title The title of the alert
- * @param buttonLabel The label of the button
- * @param callbackContext The callback context
- */
- public synchronized void alert(final String message, final String title, final String buttonLabel, final CallbackContext callbackContext) {
- final CordovaInterface cordova = this.cordova;
-
- Runnable runnable = new Runnable() {
- public void run() {
-
- AlertDialog.Builder dlg = new AlertDialog.Builder(cordova.getActivity());
- dlg.setMessage(message);
- dlg.setTitle(title);
- dlg.setCancelable(true);
- dlg.setPositiveButton(buttonLabel,
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 0));
- }
- });
- dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
- public void onCancel(DialogInterface dialog)
- {
- dialog.dismiss();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 0));
- }
- });
-
- dlg.create();
- dlg.show();
- };
- };
- this.cordova.getActivity().runOnUiThread(runnable);
- }
-
- /**
- * Builds and shows a native Android confirm dialog with given title, message, buttons.
- * This dialog only shows up to 3 buttons. Any labels after that will be ignored.
- * The index of the button pressed will be returned to the JavaScript callback identified by callbackId.
- *
- * @param message The message the dialog should display
- * @param title The title of the dialog
- * @param buttonLabels A comma separated list of button labels (Up to 3 buttons)
- * @param callbackContext The callback context.
- */
- public synchronized void confirm(final String message, final String title, final JSONArray buttonLabels, final CallbackContext callbackContext) {
- final CordovaInterface cordova = this.cordova;
-
- Runnable runnable = new Runnable() {
- public void run() {
- AlertDialog.Builder dlg = new AlertDialog.Builder(cordova.getActivity());
- dlg.setMessage(message);
- dlg.setTitle(title);
- dlg.setCancelable(true);
-
- // First button
- if (buttonLabels.length() > 0) {
- try {
- dlg.setNegativeButton(buttonLabels.getString(0),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 1));
- }
- });
- } catch (JSONException e) { }
- }
-
- // Second button
- if (buttonLabels.length() > 1) {
- try {
- dlg.setNeutralButton(buttonLabels.getString(1),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 2));
- }
- });
- } catch (JSONException e) { }
- }
-
- // Third button
- if (buttonLabels.length() > 2) {
- try {
- dlg.setPositiveButton(buttonLabels.getString(2),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 3));
- }
- });
- } catch (JSONException e) { }
- }
- dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
- public void onCancel(DialogInterface dialog)
- {
- dialog.dismiss();
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 0));
- }
- });
-
- dlg.create();
- dlg.show();
- };
- };
- this.cordova.getActivity().runOnUiThread(runnable);
- }
-
- /**
- * Builds and shows a native Android prompt dialog with given title, message, buttons.
- * This dialog only shows up to 3 buttons. Any labels after that will be ignored.
- * The following results are returned to the JavaScript callback identified by callbackId:
- * buttonIndex Index number of the button selected
- * input1 The text entered in the prompt dialog box
- *
- * @param message The message the dialog should display
- * @param title The title of the dialog
- * @param buttonLabels A comma separated list of button labels (Up to 3 buttons)
- * @param callbackContext The callback context.
- */
- public synchronized void prompt(final String message, final String title, final JSONArray buttonLabels, final String defaultText, final CallbackContext callbackContext) {
-
- final CordovaInterface cordova = this.cordova;
- final EditText promptInput = new EditText(cordova.getActivity());
- promptInput.setHint(defaultText);
-
- Runnable runnable = new Runnable() {
- public void run() {
- AlertDialog.Builder dlg = new AlertDialog.Builder(cordova.getActivity());
- dlg.setMessage(message);
- dlg.setTitle(title);
- dlg.setCancelable(true);
-
- dlg.setView(promptInput);
-
- final JSONObject result = new JSONObject();
-
- // First button
- if (buttonLabels.length() > 0) {
- try {
- dlg.setNegativeButton(buttonLabels.getString(0),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- try {
- result.put("buttonIndex",1);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
- } catch (JSONException e) { }
- }
-
- // Second button
- if (buttonLabels.length() > 1) {
- try {
- dlg.setNeutralButton(buttonLabels.getString(1),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- try {
- result.put("buttonIndex",2);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
- } catch (JSONException e) { }
- }
-
- // Third button
- if (buttonLabels.length() > 2) {
- try {
- dlg.setPositiveButton(buttonLabels.getString(2),
- new AlertDialog.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- try {
- result.put("buttonIndex",3);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
- } catch (JSONException e) { }
- }
- dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
- public void onCancel(DialogInterface dialog){
- dialog.dismiss();
- try {
- result.put("buttonIndex",0);
- result.put("input1", promptInput.getText().toString().trim().length()==0 ? defaultText : promptInput.getText());
- } catch (JSONException e) { e.printStackTrace(); }
- callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
- }
- });
-
- dlg.create();
- dlg.show();
-
- };
- };
- this.cordova.getActivity().runOnUiThread(runnable);
- }
-
- /**
- * Show the spinner.
- *
- * @param title Title of the dialog
- * @param message The message of the dialog
- */
- public synchronized void activityStart(final String title, final String message) {
- if (this.spinnerDialog != null) {
- this.spinnerDialog.dismiss();
- this.spinnerDialog = null;
- }
- final CordovaInterface cordova = this.cordova;
- Runnable runnable = new Runnable() {
- public void run() {
- Notification.this.spinnerDialog = ProgressDialog.show(cordova.getActivity(), title, message, true, true,
- new DialogInterface.OnCancelListener() {
- public void onCancel(DialogInterface dialog) {
- Notification.this.spinnerDialog = null;
- }
- });
- }
- };
- this.cordova.getActivity().runOnUiThread(runnable);
- }
-
- /**
- * Stop spinner.
- */
- public synchronized void activityStop() {
- if (this.spinnerDialog != null) {
- this.spinnerDialog.dismiss();
- this.spinnerDialog = null;
- }
- }
-
- /**
- * Show the progress dialog.
- *
- * @param title Title of the dialog
- * @param message The message of the dialog
- */
- public synchronized void progressStart(final String title, final String message) {
- if (this.progressDialog != null) {
- this.progressDialog.dismiss();
- this.progressDialog = null;
- }
- final Notification notification = this;
- final CordovaInterface cordova = this.cordova;
- Runnable runnable = new Runnable() {
- public void run() {
- notification.progressDialog = new ProgressDialog(cordova.getActivity());
- notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- notification.progressDialog.setTitle(title);
- notification.progressDialog.setMessage(message);
- notification.progressDialog.setCancelable(true);
- notification.progressDialog.setMax(100);
- notification.progressDialog.setProgress(0);
- notification.progressDialog.setOnCancelListener(
- new DialogInterface.OnCancelListener() {
- public void onCancel(DialogInterface dialog) {
- notification.progressDialog = null;
- }
- });
- notification.progressDialog.show();
- }
- };
- this.cordova.getActivity().runOnUiThread(runnable);
- }
-
- /**
- * Set value of progress bar.
- *
- * @param value 0-100
- */
- public synchronized void progressValue(int value) {
- if (this.progressDialog != null) {
- this.progressDialog.setProgress(value);
- }
- }
-
- /**
- * Stop progress dialog.
- */
- public synchronized void progressStop() {
- if (this.progressDialog != null) {
- this.progressDialog.dismiss();
- this.progressDialog = null;
- }
- }
-}
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
deleted file mode 100644
index b218eab..0000000
--- a/src/blackberry10/index.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-* Copyright 2013 Research In Motion Limited.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-function showDialog(args, dialogType, result) {
- //Unpack and map the args
- var msg = JSON.parse(decodeURIComponent(args[0])),
- title = JSON.parse(decodeURIComponent(args[1])),
- btnLabel = JSON.parse(decodeURIComponent(args[2]));
-
- if (!Array.isArray(btnLabel)) {
- //Converts to array for (string) and (string,string, ...) cases
- btnLabel = btnLabel.split(",");
- }
-
- if (msg && typeof msg === "string") {
- msg = msg.replace(/^"|"$/g, "").replace(/\\"/g, '"').replace(/\\\\/g, '\\');
- } else {
- result.error("message is undefined");
- return;
- }
-
- var messageObj = {
- title : title,
- htmlmessage : msg,
- dialogType : dialogType,
- optionalButtons : btnLabel
- };
-
- //TODO replace with getOverlayWebview() when available in webplatform
- qnx.webplatform.getWebViews()[2].dialog.show(messageObj, function (data) {
- if (typeof data === "number") {
- //Confirm dialog call back needs to be called with one-based indexing [1,2,3 etc]
- result.callbackOk(++data, false);
- } else {
- //Prompt dialog callback expects object
- result.callbackOk({
- buttonIndex: data.ok ? 1 : 0,
- input1: (data.oktext) ? decodeURIComponent(data.oktext) : ""
- }, false);
- }
- });
-
- result.noResult(true);
-}
-
-module.exports = {
- alert: function (success, fail, args, env) {
- var result = new PluginResult(args, env);
-
- if (Object.keys(args).length < 3) {
- result.error("Notification action - alert arguments not found.");
- } else {
- showDialog(args, "CustomAsk", result);
- }
- },
- confirm: function (success, fail, args, env) {
- var result = new PluginResult(args, env);
-
- if (Object.keys(args).length < 3) {
- result.error("Notification action - confirm arguments not found.");
- } else {
- showDialog(args, "CustomAsk", result);
- }
- },
- prompt: function (success, fail, args, env) {
- var result = new PluginResult(args, env);
-
- if (Object.keys(args).length < 3) {
- result.error("Notification action - prompt arguments not found.");
- } else {
- showDialog(args, "JavaScriptPrompt", result);
- }
- }
-};
diff --git a/src/firefoxos/notification.js b/src/firefoxos/notification.js
deleted file mode 100644
index ca7c5c0..0000000
--- a/src/firefoxos/notification.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-function _empty() {}
-
-function modal(message, callback, title, buttonLabels, domObjects) {
- /*
- <form role="dialog">
- <section>
- <h1>Some Title</h1>
- <p>Can't find a proper question for that ...</p>
- </section>
- <menu>
- <button>Cancel</button>
- <button class="danger">Delete</button>
- <button class="recommend">Recommend</button>
- <button>Standard</button>
- </menu>
- </form>
- */
- // create a modal window
- var box = document.createElement('form');
- box.setAttribute('role', 'dialog');
- // prepare and append empty section
- var section = document.createElement('section');
- box.appendChild(section);
- // add title
- var boxtitle = document.createElement('h1');
- boxtitle.appendChild(document.createTextNode(title));
- section.appendChild(boxtitle);
- // add message
- var boxMessage = document.createElement('p');
- boxMessage.appendChild(document.createTextNode(message));
- section.appendChild(boxMessage);
- // inject what's needed
- if (domObjects) {
- section.appendChild(domObjects);
- }
- // add buttons and assign callbackButton on click
- var menu = document.createElement('menu');
- box.appendChild(menu);
- for (var index = 0; index < buttonLabels.length; index++) {
- // TODO: last button listens to the cancel key
- addButton(buttonLabels[index], index, (index === 0));
- }
- document.body.appendChild(box);
-
- function addButton(label, index, recommended) {
- var button = document.createElement('button');
- button.appendChild(document.createTextNode(label));
- button.labelIndex = index + 1;
- button.addEventListener('click', callbackButton, false);
- if (recommended) {
- // TODO: default one listens to Enter key
- button.classList.add('recommend');
- }
- menu.appendChild(button);
- }
-
- // call callback and destroy modal
- function callbackButton() {
- var promptInput = document.getElementById('prompt-input');
- var promptValue;
- var response;
- if (promptInput) {
- response = {
- input1: promptInput.value,
- buttonIndex: this.labelIndex
- }
- }
- response = response || this.labelIndex;
- callback(response);
- box.parentNode.removeChild(box);
- }
-}
-
-var Notification = {
- vibrate: function(milliseconds) {
- navigator.vibrate(milliseconds);
- },
- alert: function(successCallback, errorCallback, args) {
- var message = args[0];
- var title = args[1];
- var _buttonLabels = [args[2]];
- var _callback = (successCallback || _empty);
- modal(message, _callback, title, _buttonLabels);
- },
- confirm: function(successCallback, errorCallback, args) {
- var message = args[0];
- var title = args[1];
- var buttonLabels = args[2];
- var _callback = (successCallback || _empty);
- modal(message, _callback, title, buttonLabels);
- },
- prompt: function(successCallback, errorCallback, args) {
- var message = args[0];
- var title = args[1];
- var buttonLabels = args[2];
- var defaultText = args[3];
- var _callback = (successCallback || _empty);
- // function _callback(labelIndex) {
- // console.log(content);
- // successCallback(labelIndex, content);
- // }
- var inputParagraph = document.createElement('p');
- inputParagraph.classList.add('input');
- var inputElement = document.createElement('input');
- inputElement.setAttribute('type', 'text');
- inputElement.id = 'prompt-input';
- if (defaultText) {
- inputElement.setAttribute('placeholder', defaultText);
- }
- inputParagraph.appendChild(inputElement);
- modal(message, _callback, title, buttonLabels, inputParagraph);
- }
-};
-
-module.exports = Notification;
-require('cordova/firefoxos/commandProxy').add('Notification', Notification);
diff --git a/src/ios/CDVNotification.bundle/beep.wav b/src/ios/CDVNotification.bundle/beep.wav
deleted file mode 100644
index 05f5997..0000000
--- a/src/ios/CDVNotification.bundle/beep.wav
+++ /dev/null
Binary files differ
diff --git a/src/ios/CDVNotification.h b/src/ios/CDVNotification.h
deleted file mode 100644
index 9253f6a..0000000
--- a/src/ios/CDVNotification.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-#import <AudioToolbox/AudioServices.h>
-#import <Cordova/CDVPlugin.h>
-
-@interface CDVNotification : CDVPlugin <UIAlertViewDelegate>{}
-
-- (void)alert:(CDVInvokedUrlCommand*)command;
-- (void)confirm:(CDVInvokedUrlCommand*)command;
-- (void)prompt:(CDVInvokedUrlCommand*)command;
-- (void)beep:(CDVInvokedUrlCommand*)command;
-
-@end
-
-@interface CDVAlertView : UIAlertView {}
-@property (nonatomic, copy) NSString* callbackId;
-
-@end
diff --git a/src/ios/CDVNotification.m b/src/ios/CDVNotification.m
deleted file mode 100644
index ac95cc6..0000000
--- a/src/ios/CDVNotification.m
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "CDVNotification.h"
-#import <Cordova/NSDictionary+Extensions.h>
-#import <Cordova/NSArray+Comparisons.h>
-
-#define DIALOG_TYPE_ALERT @"alert"
-#define DIALOG_TYPE_PROMPT @"prompt"
-
-static void soundCompletionCallback(SystemSoundID ssid, void* data);
-
-@implementation CDVNotification
-
-/*
- * showDialogWithMessage - Common method to instantiate the alert view for alert, confirm, and prompt notifications.
- * Parameters:
- * message The alert view message.
- * title The alert view title.
- * buttons The array of customized strings for the buttons.
- * defaultText The input text for the textbox (if textbox exists).
- * callbackId The commmand callback id.
- * dialogType The type of alert view [alert | prompt].
- */
-- (void)showDialogWithMessage:(NSString*)message title:(NSString*)title buttons:(NSArray*)buttons defaultText:(NSString*)defaultText callbackId:(NSString*)callbackId dialogType:(NSString*)dialogType
-{
- CDVAlertView* alertView = [[CDVAlertView alloc]
- initWithTitle:title
- message:message
- delegate:self
- cancelButtonTitle:nil
- otherButtonTitles:nil];
-
- alertView.callbackId = callbackId;
-
- NSUInteger count = [buttons count];
-
- for (int n = 0; n < count; n++) {
- [alertView addButtonWithTitle:[buttons objectAtIndex:n]];
- }
-
- if ([dialogType isEqualToString:DIALOG_TYPE_PROMPT]) {
- alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
- UITextField* textField = [alertView textFieldAtIndex:0];
- textField.text = defaultText;
- }
-
- [alertView show];
-}
-
-- (void)alert:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSString* buttons = [command argumentAtIndex:2];
-
- [self showDialogWithMessage:message title:title buttons:@[buttons] defaultText:nil callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
-}
-
-- (void)confirm:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSArray* buttons = [command argumentAtIndex:2];
-
- [self showDialogWithMessage:message title:title buttons:buttons defaultText:nil callbackId:callbackId dialogType:DIALOG_TYPE_ALERT];
-}
-
-- (void)prompt:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* message = [command argumentAtIndex:0];
- NSString* title = [command argumentAtIndex:1];
- NSArray* buttons = [command argumentAtIndex:2];
- NSString* defaultText = [command argumentAtIndex:3];
-
- [self showDialogWithMessage:message title:title buttons:buttons defaultText:defaultText callbackId:callbackId dialogType:DIALOG_TYPE_PROMPT];
-}
-
-/**
- * Callback invoked when an alert dialog's buttons are clicked.
- */
-- (void)alertView:(UIAlertView*)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
- CDVAlertView* cdvAlertView = (CDVAlertView*)alertView;
- CDVPluginResult* result;
-
- // Determine what gets returned to JS based on the alert view type.
- if (alertView.alertViewStyle == UIAlertViewStyleDefault) {
- // For alert and confirm, return button index as int back to JS.
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:(int)(buttonIndex + 1)];
- } else {
- // For prompt, return button index and input text back to JS.
- NSString* value0 = [[alertView textFieldAtIndex:0] text];
- NSDictionary* info = @{
- @"buttonIndex":@(buttonIndex + 1),
- @"input1":(value0 ? value0 : [NSNull null])
- };
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:info];
- }
- [self.commandDelegate sendPluginResult:result callbackId:cdvAlertView.callbackId];
-}
-
-static void playBeep(int count) {
- SystemSoundID completeSound;
- NSInteger cbDataCount = count;
- NSURL* audioPath = [[NSBundle mainBundle] URLForResource:@"CDVNotification.bundle/beep" withExtension:@"wav"];
- #if __has_feature(objc_arc)
- AudioServicesCreateSystemSoundID((__bridge CFURLRef)audioPath, &completeSound);
- #else
- AudioServicesCreateSystemSoundID((CFURLRef)audioPath, &completeSound);
- #endif
- AudioServicesAddSystemSoundCompletion(completeSound, NULL, NULL, soundCompletionCallback, (void*)(cbDataCount-1));
- AudioServicesPlaySystemSound(completeSound);
-}
-
-static void soundCompletionCallback(SystemSoundID ssid, void* data) {
- int count = (int)data;
- AudioServicesRemoveSystemSoundCompletion (ssid);
- AudioServicesDisposeSystemSoundID(ssid);
- if (count > 0) {
- playBeep(count);
- }
-}
-
-- (void)beep:(CDVInvokedUrlCommand*)command
-{
- NSNumber* count = [command.arguments objectAtIndex:0 withDefault:[NSNumber numberWithInt:1]];
- playBeep([count intValue]);
-}
-
-
-@end
-
-@implementation CDVAlertView
-
-@synthesize callbackId;
-
-@end
diff --git a/src/ubuntu/notification.cpp b/src/ubuntu/notification.cpp
deleted file mode 100644
index 77c5e25..0000000
--- a/src/ubuntu/notification.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "notification.h"
-
-#include <QApplication>
-
-#include <QMediaPlayer>
-#include <QMessageBox>
-
-void Dialogs::beep(int scId, int ecId, int times) {
- Q_UNUSED(scId)
- Q_UNUSED(ecId)
- Q_UNUSED(times)
- QMediaPlayer* player = new QMediaPlayer;
- player->setVolume(100);
- player->setMedia(QUrl::fromLocalFile("/usr/share/sounds/ubuntu/stereo/bell.ogg"));
- player->play();
-}
-
-void Dialogs::alert(int scId, int ecId, const QString &message, const QString &title, const QString &buttonLabel) {
- QStringList list;
- list.append(buttonLabel);
-
- confirm(scId, ecId, message, title, list);
-}
-
-void Dialogs::confirm(int scId, int ecId, const QString &message, const QString &title, const QStringList &buttonLabels) {
- Q_UNUSED(ecId);
-
- //FIXME:
- assert(!_alertCallback);
- _alertCallback = scId;
-
- QString s1, s2, s3;
- if (buttonLabels.size() > 0)
- s1 = buttonLabels[0];
- if (buttonLabels.size() > 1)
- s2 = buttonLabels[1];
- if (buttonLabels.size() > 2)
- s3 = buttonLabels[2];
-
- QString path = m_cordova->get_app_dir() + "/../qml/notification.qml";
- //FIXME:
- QString qml = QString("PopupUtils.open(\"%1\", root, { root: root, cordova: cordova, title: \"%2\", text: \"%3\", promptVisible: false, button1Text: \"%4\", button2Text: \"%5\", button3Text: \"%6\" })")
- .arg(path).arg(title).arg(message).arg(s1).arg(s2).arg(s3);
- m_cordova->execQML(qml);
-}
-
-void Dialogs::prompt(int scId, int ecId, const QString &message, const QString &title, const QStringList &buttonLabels, const QString &defaultText) {
- Q_UNUSED(ecId)
-
- assert(!_alertCallback);
- _alertCallback = scId;
-
- QString s1, s2, s3;
- if (buttonLabels.size() > 0)
- s1 = buttonLabels[0];
- if (buttonLabels.size() > 1)
- s2 = buttonLabels[1];
- if (buttonLabels.size() > 2)
- s3 = buttonLabels[2];
- QString path = m_cordova->get_app_dir() + "/../qml/notification.qml";
- QString qml = QString("PopupUtils.open(\"%1\", root, { root: root, cordova: cordova, title: \"%2\", text: \"%3\", promptVisible: true, defaultPromptText: \"%7\", button1Text: \"%4\", button2Text: \"%5\", button3Text: \"%6\" })")
- .arg(path).arg(title).arg(message).arg(s1).arg(s2).arg(s3).arg(defaultText);
-
- qDebug() << qml;
- m_cordova->execQML(qml);
-}
diff --git a/src/ubuntu/notification.h b/src/ubuntu/notification.h
deleted file mode 100644
index 3173d99..0000000
--- a/src/ubuntu/notification.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef NOTIFICATION_H
-#define NOTIFICATION_H
-
-#include <QtQuick>
-#include <cplugin.h>
-#include <cordova.h>
-
-class Dialogs: public CPlugin {
- Q_OBJECT
-public:
- explicit Dialogs(Cordova *cordova): CPlugin(cordova), _alertCallback(0) {
- }
-
- virtual const QString fullName() override {
- return Dialogs::fullID();
- }
-
- virtual const QString shortName() override {
- return "Notification";
- }
-
- static const QString fullID() {
- return "Notification";
- }
-public slots:
- void beep(int scId, int ecId, int times);
- void alert(int scId, int ecId, const QString &message, const QString &title, const QString &buttonLabel);
- void confirm(int scId, int ecId, const QString &message, const QString &title, const QStringList &buttonLabels);
- void prompt(int scId, int ecId, const QString &message, const QString &title, const QStringList &buttonLabels, const QString &defaultText);
-
- void notificationDialogButtonPressed(int buttonId, const QString &text) {
- if (text.size()) {
- QVariantMap res;
- res.insert("buttonIndex", buttonId);
- res.insert("input1", text);
- this->cb(_alertCallback, res);
- } else {
- this->cb(_alertCallback, buttonId);
- }
- _alertCallback = 0;
- }
-
-private:
- QQmlComponent *_component;
- int _alertCallback;
-};
-
-#endif
diff --git a/src/ubuntu/notification.qml b/src/ubuntu/notification.qml
deleted file mode 100644
index 8fd4885..0000000
--- a/src/ubuntu/notification.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-import QtQuick 2.0
-import Ubuntu.Components.Popups 0.1
-import Ubuntu.Components 0.1
-
-Dialog {
- id: dialogue
- property string button1Text
- property string button2Text
- property string button3Text
- property bool promptVisible
- property string defaultPromptText
- TextInput {// FIXME: swith to TextField(TextField should support visible property)
- id: prompt
- color: "white"
- text: defaultPromptText
- visible: promptVisible
- focus: true
- }
- Button {
- text: button1Text
- color: "orange"
- onClicked: {
- root.exec("Notification", "notificationDialogButtonPressed", [1, prompt.text]);
- PopupUtils.close(dialogue)
- }
- }
- Button {
- text: button2Text
- visible: button2Text.length > 0
- color: "orange"
- onClicked: {
- root.exec("Notification", "notificationDialogButtonPressed", [2, prompt.text]);
- PopupUtils.close(dialogue)
- }
- }
- Button {
- text: button3Text
- visible: button3Text.length > 0
- onClicked: {
- root.exec("Notification", "notificationDialogButtonPressed", [3, prompt.text]);
- PopupUtils.close(dialogue)
- }
- }
-}
diff --git a/src/windows8/NotificationProxy.js b/src/windows8/NotificationProxy.js
deleted file mode 100644
index d61adae..0000000
--- a/src/windows8/NotificationProxy.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/*global Windows:true */
-
-var cordova = require('cordova');
-
-var isAlertShowing = false;
-var alertStack = [];
-
-module.exports = {
- alert:function(win, loseX, args) {
-
- if (isAlertShowing) {
- var later = function () {
- module.exports.alert(win, loseX, args);
- };
- alertStack.push(later);
- return;
- }
- isAlertShowing = true;
-
- var message = args[0];
- var _title = args[1];
- var _buttonLabel = args[2];
-
- var md = new Windows.UI.Popups.MessageDialog(message, _title);
- md.commands.append(new Windows.UI.Popups.UICommand(_buttonLabel));
- md.showAsync().then(function() {
- isAlertShowing = false;
- win && win();
-
- if (alertStack.length) {
- setTimeout(alertStack.shift(), 0);
- }
-
- });
- },
-
- confirm:function(win, loseX, args) {
-
- if (isAlertShowing) {
- var later = function () {
- module.exports.confirm(win, loseX, args);
- };
- alertStack.push(later);
- return;
- }
-
- isAlertShowing = true;
-
- var message = args[0];
- var _title = args[1];
- var _buttonLabels = args[2];
-
- var btnList = [];
- function commandHandler (command) {
- win && win(btnList[command.label]);
- }
-
- var md = new Windows.UI.Popups.MessageDialog(message, _title);
- var button = _buttonLabels.split(',');
-
- for (var i = 0; i<button.length; i++) {
- btnList[button[i]] = i+1;
- md.commands.append(new Windows.UI.Popups.UICommand(button[i],commandHandler));
- }
- md.showAsync().then(function() {
- isAlertShowing = false;
- if (alertStack.length) {
- setTimeout(alertStack.shift(), 0);
- }
-
- });
- },
-
- beep:function(winX, loseX, args) {
-
- // set a default args if it is not set
- args = args && args.length ? args : ["1"];
-
- var snd = new Audio('ms-winsoundevent:Notification.Default');
- var count = parseInt(args[0]) || 1;
- snd.msAudioCategory = "Alerts";
-
- var onEvent = function () {
- if (count > 0) {
- snd.play();
- } else {
- snd.removeEventListener("ended", onEvent);
- snd = null;
- winX && winX(); // notification.js just sends null, but this is future friendly
- }
- count--;
- };
- snd.addEventListener("ended", onEvent);
- onEvent();
-
- }
-};
-
-require("cordova/exec/proxy").add("Notification",module.exports);
diff --git a/src/wp/Notification.cs b/src/wp/Notification.cs
deleted file mode 100644
index 84ec4de..0000000
--- a/src/wp/Notification.cs
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-using System;
-using System.Windows;
-using System.Windows.Controls;
-using Microsoft.Devices;
-using System.Runtime.Serialization;
-using System.Threading;
-using System.Windows.Resources;
-using Microsoft.Phone.Controls;
-using Microsoft.Xna.Framework.Audio;
-using WPCordovaClassLib.Cordova.UI;
-using System.Diagnostics;
-
-
-namespace WPCordovaClassLib.Cordova.Commands
-{
- public class Notification : BaseCommand
- {
- static ProgressBar progressBar = null;
- const int DEFAULT_DURATION = 5;
-
- private NotificationBox notifyBox;
-
- private class NotifBoxData
- {
- public NotificationBox previous {get;set;}
- public string callbackId { get; set; }
- }
-
- private PhoneApplicationPage Page
- {
- get
- {
- PhoneApplicationPage page = null;
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
- if (frame != null)
- {
- page = frame.Content as PhoneApplicationPage;
- }
- return page;
- }
- }
-
- // blink api - doesn't look like there is an equivalent api we can use...
-
- [DataContract]
- public class AlertOptions
- {
- [OnDeserializing]
- public void OnDeserializing(StreamingContext context)
- {
- // set defaults
- this.message = "message";
- this.title = "Alert";
- this.buttonLabel = "ok";
- }
-
- /// <summary>
- /// message to display in the alert box
- /// </summary>
- [DataMember]
- public string message;
-
- /// <summary>
- /// title displayed on the alert window
- /// </summary>
- [DataMember]
- public string title;
-
- /// <summary>
- /// text to display on the button
- /// </summary>
- [DataMember]
- public string buttonLabel;
- }
-
- [DataContract]
- public class PromptResult
- {
- [DataMember]
- public int buttonIndex;
-
- [DataMember]
- public string input1;
-
- public PromptResult(int index, string text)
- {
- this.buttonIndex = index;
- this.input1 = text;
- }
- }
-
- public void alert(string options)
- {
- string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
- AlertOptions alertOpts = new AlertOptions();
- alertOpts.message = args[0];
- alertOpts.title = args[1];
- alertOpts.buttonLabel = args[2];
- string aliasCurrentCommandCallbackId = args[3];
-
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- PhoneApplicationPage page = Page;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- var previous = notifyBox;
- notifyBox = new NotificationBox();
- notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId };
- notifyBox.PageTitle.Text = alertOpts.title;
- notifyBox.SubTitle.Text = alertOpts.message;
- Button btnOK = new Button();
- btnOK.Content = alertOpts.buttonLabel;
- btnOK.Click += new RoutedEventHandler(btnOK_Click);
- btnOK.Tag = 1;
- notifyBox.ButtonPanel.Children.Add(btnOK);
- grid.Children.Add(notifyBox);
-
- if (previous == null)
- {
- page.BackKeyPress += page_BackKeyPress;
- }
- }
- }
- else
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
- }
- });
- }
-
- public void prompt(string options)
- {
- string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
- string message = args[0];
- string title = args[1];
- string buttonLabelsArray = args[2];
- string[] buttonLabels = JSON.JsonHelper.Deserialize<string[]>(buttonLabelsArray);
- string defaultText = args[3];
- string aliasCurrentCommandCallbackId = args[4];
-
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- PhoneApplicationPage page = Page;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- var previous = notifyBox;
- notifyBox = new NotificationBox();
- notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId };
- notifyBox.PageTitle.Text = title;
- notifyBox.SubTitle.Text = message;
- TextBox textBox = new TextBox();
- textBox.Text = defaultText;
- notifyBox.TitlePanel.Children.Add(textBox);
-
- for (int i = 0; i < buttonLabels.Length; ++i)
- {
- Button button = new Button();
- button.Content = buttonLabels[i];
- button.Tag = i + 1;
- button.Click += promptBoxbutton_Click;
- notifyBox.TitlePanel.Children.Add(button);
- }
-
- grid.Children.Add(notifyBox);
- if (previous != null)
- {
- page.BackKeyPress += page_BackKeyPress;
- }
- }
- }
- else
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
- }
- });
- }
-
- public void confirm(string options)
- {
- string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
- AlertOptions alertOpts = new AlertOptions();
- alertOpts.message = args[0];
- alertOpts.title = args[1];
- alertOpts.buttonLabel = args[2];
- string aliasCurrentCommandCallbackId = args[3];
-
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- PhoneApplicationPage page = Page;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- var previous = notifyBox;
- notifyBox = new NotificationBox();
- notifyBox.Tag = new NotifBoxData { previous = previous, callbackId = aliasCurrentCommandCallbackId };
- notifyBox.PageTitle.Text = alertOpts.title;
- notifyBox.SubTitle.Text = alertOpts.message;
-
- string[] labels = JSON.JsonHelper.Deserialize<string[]>(alertOpts.buttonLabel);
-
- if (labels == null)
- {
- labels = alertOpts.buttonLabel.Split(',');
- }
-
- for (int n = 0; n < labels.Length; n++)
- {
- Button btn = new Button();
- btn.Content = labels[n];
- btn.Tag = n;
- btn.Click += new RoutedEventHandler(btnOK_Click);
- notifyBox.ButtonPanel.Children.Add(btn);
- }
-
- grid.Children.Add(notifyBox);
- if (previous == null)
- {
- page.BackKeyPress += page_BackKeyPress;
- }
- }
- }
- else
- {
- DispatchCommandResult(new PluginResult(PluginResult.Status.INSTANTIATION_EXCEPTION));
- }
- });
- }
-
- void promptBoxbutton_Click(object sender, RoutedEventArgs e)
- {
- Button button = sender as Button;
- FrameworkElement promptBox = null;
- int buttonIndex = 0;
- string callbackId = string.Empty;
- string text = string.Empty;
- if (button != null)
- {
- buttonIndex = (int)button.Tag;
- promptBox = button.Parent as FrameworkElement;
- while ((promptBox = promptBox.Parent as FrameworkElement) != null &&
- !(promptBox is NotificationBox)) ;
- }
-
- if (promptBox != null)
- {
- foreach (UIElement element in (promptBox as NotificationBox).TitlePanel.Children)
- {
- if (element is TextBox)
- {
- text = (element as TextBox).Text;
- break;
- }
- }
- PhoneApplicationPage page = Page;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- grid.Children.Remove(promptBox);
- }
-
- NotifBoxData data = promptBox.Tag as NotifBoxData;
- promptBox = data.previous as NotificationBox;
- callbackId = data.callbackId as string;
-
- if (promptBox == null)
- {
- page.BackKeyPress -= page_BackKeyPress;
- }
- }
- }
- DispatchCommandResult(new PluginResult(PluginResult.Status.OK, new PromptResult(buttonIndex, text)), callbackId);
- }
-
- void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
- {
- PhoneApplicationPage page = sender as PhoneApplicationPage;
- string callbackId = "";
- if (page != null && notifyBox != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- grid.Children.Remove(notifyBox);
- NotifBoxData notifBoxData = notifyBox.Tag as NotifBoxData;
- notifyBox = notifBoxData.previous as NotificationBox;
- callbackId = notifBoxData.callbackId as string;
- }
- if (notifyBox == null)
- {
- page.BackKeyPress -= page_BackKeyPress;
- }
- e.Cancel = true;
- }
-
- DispatchCommandResult(new PluginResult(PluginResult.Status.OK, 0), callbackId);
- }
-
- void btnOK_Click(object sender, RoutedEventArgs e)
- {
- Button btn = sender as Button;
- FrameworkElement notifBoxParent = null;
- int retVal = 0;
- string callbackId = "";
- if (btn != null)
- {
- retVal = (int)btn.Tag + 1;
-
- notifBoxParent = btn.Parent as FrameworkElement;
- while ((notifBoxParent = notifBoxParent.Parent as FrameworkElement) != null &&
- !(notifBoxParent is NotificationBox)) ;
- }
- if (notifBoxParent != null)
- {
- PhoneApplicationPage page = Page;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- grid.Children.Remove(notifBoxParent);
- }
-
- NotifBoxData notifBoxData = notifBoxParent.Tag as NotifBoxData;
- notifyBox = notifBoxData.previous as NotificationBox;
- callbackId = notifBoxData.callbackId as string;
-
- if (notifyBox == null)
- {
- page.BackKeyPress -= page_BackKeyPress;
- }
- }
-
- }
- DispatchCommandResult(new PluginResult(PluginResult.Status.OK, retVal), callbackId);
- }
-
-
-
- public void beep(string options)
- {
- string[] args = JSON.JsonHelper.Deserialize<string[]>(options);
- int times = int.Parse(args[0]);
-
- string resourcePath = BaseCommand.GetBaseURL() + "Plugins/org.apache.cordova.dialogs/notification-beep.wav";
-
- StreamResourceInfo sri = Application.GetResourceStream(new Uri(resourcePath, UriKind.Relative));
-
- if (sri != null)
- {
- SoundEffect effect = SoundEffect.FromStream(sri.Stream);
- SoundEffectInstance inst = effect.CreateInstance();
- ThreadPool.QueueUserWorkItem((o) =>
- {
- // cannot interact with UI !!
- do
- {
- inst.Play();
- Thread.Sleep(effect.Duration + TimeSpan.FromMilliseconds(100));
- }
- while (--times > 0);
-
- });
-
- }
-
- // TODO: may need a listener to trigger DispatchCommandResult after the alarm has finished executing...
- DispatchCommandResult();
- }
-
- // Display an indeterminate progress indicator
- public void activityStart(string unused)
- {
-
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
-
- if (frame != null)
- {
- PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
-
- if (page != null)
- {
- var temp = page.FindName("LayoutRoot");
- Grid grid = temp as Grid;
- if (grid != null)
- {
- if (progressBar != null)
- {
- grid.Children.Remove(progressBar);
- }
- progressBar = new ProgressBar();
- progressBar.IsIndeterminate = true;
- progressBar.IsEnabled = true;
-
- grid.Children.Add(progressBar);
- }
- }
- }
- });
- }
-
-
- // Remove our indeterminate progress indicator
- public void activityStop(string unused)
- {
- Deployment.Current.Dispatcher.BeginInvoke(() =>
- {
- if (progressBar != null)
- {
- progressBar.IsEnabled = false;
- PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
- if (frame != null)
- {
- PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
- if (page != null)
- {
- Grid grid = page.FindName("LayoutRoot") as Grid;
- if (grid != null)
- {
- grid.Children.Remove(progressBar);
- }
- }
- }
- progressBar = null;
- }
- });
- }
-
- public void vibrate(string vibrateDuration)
- {
-
- int msecs = 200; // set default
-
- try
- {
- string[] args = JSON.JsonHelper.Deserialize<string[]>(vibrateDuration);
-
- msecs = int.Parse(args[0]);
- if (msecs < 1)
- {
- msecs = 1;
- }
- }
- catch (FormatException)
- {
-
- }
-
- VibrateController.Default.Start(TimeSpan.FromMilliseconds(msecs));
-
- // TODO: may need to add listener to trigger DispatchCommandResult when the vibration ends...
- DispatchCommandResult();
- }
- }
-}
diff --git a/src/wp/NotificationBox.xaml b/src/wp/NotificationBox.xaml
deleted file mode 100644
index 1ca5d5f..0000000
--- a/src/wp/NotificationBox.xaml
+++ /dev/null
@@ -1,62 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<UserControl x:Class="WPCordovaClassLib.Cordova.UI.NotificationBox"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d"
- FontFamily="{StaticResource PhoneFontFamilyNormal}"
- FontSize="{StaticResource PhoneFontSizeNormal}"
- Foreground="{StaticResource PhoneForegroundBrush}"
- d:DesignHeight="800" d:DesignWidth="480" VerticalAlignment="Stretch">
-
- <Grid x:Name="LayoutRoot"
- Background="{StaticResource PhoneSemitransparentBrush}" VerticalAlignment="Stretch">
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
-
-
- <!--TitlePanel contains the name of the application and page title-->
- <StackPanel x:Name="TitlePanel"
- Grid.Row="0"
- Background="{StaticResource PhoneSemitransparentBrush}">
- <TextBlock x:Name="PageTitle"
- Text="Title"
- Margin="10,10"
- Style="{StaticResource PhoneTextTitle2Style}"/>
-
- <TextBlock x:Name="SubTitle"
- Text="Subtitle"
- TextWrapping="Wrap"
- Margin="10,10"
- Style="{StaticResource PhoneTextTitle3Style}"/>
-
- <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
- <StackPanel x:Name="ButtonPanel"
- Margin="10,10"
- Orientation="Horizontal"/>
- </ScrollViewer>
-
- </StackPanel>
- </Grid>
-</UserControl>
diff --git a/src/wp/NotificationBox.xaml.cs b/src/wp/NotificationBox.xaml.cs
deleted file mode 100644
index 50b2f2a..0000000
--- a/src/wp/NotificationBox.xaml.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Shapes;
-
-namespace WPCordovaClassLib.Cordova.UI
-{
- public partial class NotificationBox : UserControl
- {
- public NotificationBox()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/src/wp/notification-beep.wav b/src/wp/notification-beep.wav
deleted file mode 100644
index d0ad085..0000000
--- a/src/wp/notification-beep.wav
+++ /dev/null
Binary files differ
diff --git a/www/android/notification.js b/www/android/notification.js
deleted file mode 100644
index 8936a5c..0000000
--- a/www/android/notification.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var exec = require('cordova/exec');
-
-/**
- * Provides Android enhanced notification API.
- */
-module.exports = {
- activityStart : function(title, message) {
- // If title and message not specified then mimic Android behavior of
- // using default strings.
- if (typeof title === "undefined" && typeof message == "undefined") {
- title = "Busy";
- message = 'Please wait...';
- }
-
- exec(null, null, 'Notification', 'activityStart', [ title, message ]);
- },
-
- /**
- * Close an activity dialog
- */
- activityStop : function() {
- exec(null, null, 'Notification', 'activityStop', []);
- },
-
- /**
- * Display a progress dialog with progress bar that goes from 0 to 100.
- *
- * @param {String}
- * title Title of the progress dialog.
- * @param {String}
- * message Message to display in the dialog.
- */
- progressStart : function(title, message) {
- exec(null, null, 'Notification', 'progressStart', [ title, message ]);
- },
-
- /**
- * Close the progress dialog.
- */
- progressStop : function() {
- exec(null, null, 'Notification', 'progressStop', []);
- },
-
- /**
- * Set the progress dialog value.
- *
- * @param {Number}
- * value 0-100
- */
- progressValue : function(value) {
- exec(null, null, 'Notification', 'progressValue', [ value ]);
- }
-};
diff --git a/www/blackberry10/beep.js b/www/blackberry10/beep.js
deleted file mode 100644
index 6605107..0000000
--- a/www/blackberry10/beep.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-module.exports = function (quantity) {
- var count = 0,
- beepObj,
- play = function () {
- //create new object every time due to strage playback behaviour
- beepObj = new Audio('local:///chrome/plugin/org.apache.cordova.dialogs/notification-beep.wav');
- beepObj.addEventListener("ended", callback);
- beepObj.play();
- },
- callback = function () {
- if (--count > 0) {
- play();
- } else {
- delete beepObj;
- }
- };
- count += quantity || 1;
- if (count > 0) {
- play();
- }
-};
diff --git a/www/blackberry10/notification-beep.wav b/www/blackberry10/notification-beep.wav
deleted file mode 100644
index d0ad085..0000000
--- a/www/blackberry10/notification-beep.wav
+++ /dev/null
Binary files differ
diff --git a/www/firefoxos/danger-press.png b/www/firefoxos/danger-press.png
deleted file mode 100644
index d7529b5..0000000
--- a/www/firefoxos/danger-press.png
+++ /dev/null
Binary files differ
diff --git a/www/firefoxos/danger.png b/www/firefoxos/danger.png
deleted file mode 100644
index 400e3ae..0000000
--- a/www/firefoxos/danger.png
+++ /dev/null
Binary files differ
diff --git a/www/firefoxos/default.png b/www/firefoxos/default.png
deleted file mode 100644
index 2ff298a..0000000
--- a/www/firefoxos/default.png
+++ /dev/null
Binary files differ
diff --git a/www/firefoxos/gradient.png b/www/firefoxos/gradient.png
deleted file mode 100644
index b288545..0000000
--- a/www/firefoxos/gradient.png
+++ /dev/null
Binary files differ
diff --git a/www/firefoxos/notification.css b/www/firefoxos/notification.css
deleted file mode 100644
index 34d92b8..0000000
--- a/www/firefoxos/notification.css
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-/* Main dialog setup */
-form[role="dialog"] {
- background:
- url(../img/pattern.png) repeat left top,
- url(../img/gradient.png) no-repeat left top / 100% 100%;
- overflow: hidden;
- position: absolute;
- z-index: 100;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 1.5rem 0 7rem;
- font-family: "MozTT", Sans-serif;
- font-size: 0;
- /* Using font-size: 0; we avoid the unwanted visual space (about 3px)
- created by white-spaces and break lines in the code betewen inline-block elements */
- color: #fff;
- text-align: left;
-}
-
-form[role="dialog"]:before {
- content: "";
- display: inline-block;
- vertical-align: middle;
- width: 0.1rem;
- height: 100%;
- margin-left: -0.1rem;
-}
-
-form[role="dialog"] > section {
- font-weight: lighter;
- font-size: 1.8rem;
- color: #FAFAFA;
- padding: 0 1.5rem;
- -moz-box-sizing: padding-box;
- width: 100%;
- display: inline-block;
- overflow-y: scroll;
- max-height: 100%;
- vertical-align: middle;
- white-space: normal;
-}
-
-form[role="dialog"] h1 {
- font-weight: normal;
- font-size: 1.6rem;
- line-height: 1.5em;
- color: #fff;
- margin: 0;
- padding: 0 1.5rem 1rem;
- border-bottom: 0.1rem solid #686868;
-}
-
-/* Menu & buttons setup */
-form[role="dialog"] menu {
- margin: 0;
- padding: 1.5rem;
- padding-bottom: 0.5rem;
- border-top: solid 0.1rem rgba(255, 255, 255, 0.1);
- background: #2d2d2d url(../img/pattern.png) repeat left top;
- display: block;
- overflow: hidden;
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- text-align: center;
-}
-
-form[role="dialog"] menu button::-moz-focus-inner {
- border: none;
- outline: none;
-}
-form[role="dialog"] menu button {
- width: 100%;
- height: 2.4rem;
- margin: 0 0 1rem;
- padding: 0 1.5rem;
- -moz-box-sizing: border-box;
- display: inline-block;
- vertical-align: middle;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- background: #fafafa url(../img/default.png) repeat-x left bottom/ auto 100%;
- border: 0.1rem solid #a6a6a6;
- border-radius: 0.3rem;
- font: 500 1.2rem/2.4rem 'MozTT', Sans-serif;
- color: #333;
- text-align: center;
- text-shadow: 0.1rem 0.1rem 0 rgba(255,255,255,0.3);
- text-decoration: none;
- outline: none;
-}
-
-/* Press (default & recommend) */
-form[role="dialog"] menu button:active,
-form[role="dialog"] menu button.recommend:active,
-a.recommend[role="button"]:active {
- border-color: #008aaa;
- color: #333;
-}
-
-/* Recommend */
-form[role="dialog"] menu button.recommend {
- background-image: url(../img/recommend.png);
- background-color: #00caf2;
- border-color: #008eab;
-}
-
-/* Danger */
-form[role="dialog"] menu button.danger,
-a.danger[role="button"] {
- background-image: url(../img/danger.png);
- background-color: #b70404;
- color: #fff;
- text-shadow: none;
- border-color: #820000;
-}
-
-/* Danger Press */
-form[role="dialog"] menu button.danger:active {
- background-image: url(../img/danger-press.png);
- background-color: #890707;
-}
-
-/* Disabled */
-form[role="dialog"] > menu > button[disabled] {
- background: #5f5f5f;
- color: #4d4d4d;
- text-shadow: none;
- border-color: #4d4d4d;
- pointer-events: none;
-}
-
-
-form[role="dialog"] menu button:nth-child(even) {
- margin-left: 1rem;
-}
-
-form[role="dialog"] menu button,
-form[role="dialog"] menu button:nth-child(odd) {
- margin: 0 0 1rem 0;
-}
-
-form[role="dialog"] menu button {
- width: calc((100% - 1rem) / 2);
-}
-
-form[role="dialog"] menu button.full {
- width: 100%;
-}
-
-/* Specific component code */
-form[role="dialog"] p {
- word-wrap: break-word;
- margin: 1rem 0 0;
- padding: 0 1.5rem 1rem;
- line-height: 3rem;
-}
-
-form[role="dialog"] p img {
- float: left;
- margin-right: 2rem;
-}
-
-form[role="dialog"] p strong {
- font-weight: lighter;
-}
-
-form[role="dialog"] p small {
- font-size: 1.4rem;
- font-weight: normal;
- color: #cbcbcb;
- display: block;
-}
-
-form[role="dialog"] dl {
- border-top: 0.1rem solid #686868;
- margin: 1rem 0 0;
- overflow: hidden;
- padding-top: 1rem;
- font-size: 1.6rem;
- line-height: 2.2rem;
-}
-
-form[role="dialog"] dl > dt {
- clear: both;
- float: left;
- width: 7rem;
- padding-left: 1.5rem;
- font-weight: 500;
- text-align: left;
-}
-
-form[role="dialog"] dl > dd {
- padding-right: 1.5rem;
- font-weight: 300;
- text-overflow: ellipsis;
- vertical-align: top;
- overflow: hidden;
-}
-
-/* input areas */
-input[type="text"],
-input[type="password"],
-input[type="email"],
-input[type="tel"],
-input[type="search"],
-input[type="url"],
-input[type="number"],
-textarea {
- -moz-box-sizing: border-box;
- display: block;
- overflow: hidden;
- width: 100%;
- height: 3rem;
- resize: none;
- padding: 0 1rem;
- font-size: 1.6rem;
- line-height: 3rem;
- border: 0.1rem solid #ccc;
- border-radius: 0.3rem;
- box-shadow: none; /* override the box-shadow from the system (performance issue) */
- background: #fff url(input_areas/images/ui/shadow.png) repeat-x;
-}
diff --git a/www/firefoxos/pattern.png b/www/firefoxos/pattern.png
deleted file mode 100644
index af03f56..0000000
--- a/www/firefoxos/pattern.png
+++ /dev/null
Binary files differ
diff --git a/www/firefoxos/recommend.png b/www/firefoxos/recommend.png
deleted file mode 100644
index 42aed39..0000000
--- a/www/firefoxos/recommend.png
+++ /dev/null
Binary files differ
diff --git a/www/notification.js b/www/notification.js
deleted file mode 100644
index 23bcf18..0000000
--- a/www/notification.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var exec = require('cordova/exec');
-var platform = require('cordova/platform');
-
-/**
- * Provides access to notifications on the device.
- */
-
-module.exports = {
-
- /**
- * Open a native alert dialog, with a customizable title and button text.
- *
- * @param {String} message Message to print in the body of the alert
- * @param {Function} completeCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the alert dialog (default: Alert)
- * @param {String} buttonLabel Label of the close button (default: OK)
- */
- alert: function(message, completeCallback, title, buttonLabel) {
- var _title = (title || "Alert");
- var _buttonLabel = (buttonLabel || "OK");
- exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]);
- },
-
- /**
- * Open a native confirm dialog, with a customizable title and button text.
- * The result that the user selects is returned to the result callback.
- *
- * @param {String} message Message to print in the body of the alert
- * @param {Function} resultCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the alert dialog (default: Confirm)
- * @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel'])
- */
- confirm: function(message, resultCallback, title, buttonLabels) {
- var _title = (title || "Confirm");
- var _buttonLabels = (buttonLabels || ["OK", "Cancel"]);
-
- // Strings are deprecated!
- if (typeof _buttonLabels === 'string') {
- console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
- }
-
- // Some platforms take an array of button label names.
- // Other platforms take a comma separated list.
- // For compatibility, we convert to the desired type based on the platform.
- if (platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "ubuntu") {
- if (typeof _buttonLabels === 'string') {
- var buttonLabelString = _buttonLabels;
- _buttonLabels = _buttonLabels.split(","); // not crazy about changing the var type here
- }
- } else {
- if (Array.isArray(_buttonLabels)) {
- var buttonLabelArray = _buttonLabels;
- _buttonLabels = buttonLabelArray.toString();
- }
- }
- exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]);
- },
-
- /**
- * Open a native prompt dialog, with a customizable title and button text.
- * The following results are returned to the result callback:
- * buttonIndex Index number of the button selected.
- * input1 The text entered in the prompt dialog box.
- *
- * @param {String} message Dialog message to display (default: "Prompt message")
- * @param {Function} resultCallback The callback that is called when user clicks on a button.
- * @param {String} title Title of the dialog (default: "Prompt")
- * @param {Array} buttonLabels Array of strings for the button labels (default: ["OK","Cancel"])
- * @param {String} defaultText Textbox input value (default: empty string)
- */
- prompt: function(message, resultCallback, title, buttonLabels, defaultText) {
- var _message = (message || "Prompt message");
- var _title = (title || "Prompt");
- var _buttonLabels = (buttonLabels || ["OK","Cancel"]);
- var _defaultText = (defaultText || "");
- exec(resultCallback, null, "Notification", "prompt", [_message, _title, _buttonLabels, _defaultText]);
- },
-
- /**
- * Causes the device to beep.
- * On Android, the default notification ringtone is played "count" times.
- *
- * @param {Integer} count The number of beeps.
- */
- beep: function(count) {
- exec(null, null, "Notification", "beep", [count]);
- }
-};