diff --git a/.gitignore b/.gitignore index e3b99070c..4046fc67e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,34 @@ -.project -.settings -.classpath +*~ target +.DS_Store +.faces-config.xml.faceside +.faces-config.xml.jsfdia +MANIFEST.MF +bin +.openshift +*/.gitignore +/helloworld-jsp +CONTRIBUTING.html +.errai +demo/src/main/gwt-unitCache +demo/src/main/webapp/BookingMonitor +demo/src/main/webapp/WEB-INF/deploy +out .idea +*.ipr *.iws *.iml -*.ipr +atlassian-ide-plugin.xml +.classpath +.project +.settings +.metadata +bin +.nbattrs +*.log +.clover +*.swp +_site +_tmp +classes +.forge_settings diff --git a/README.html b/README.html new file mode 100644 index 000000000..04f0358b7 --- /dev/null +++ b/README.html @@ -0,0 +1,14 @@ +README +

What is this?

+ +

This is the TicketMonster distribution, a showcase application for JBoss Developer Framework.

+ +

What can you find here?

+ +

The content of the underlying directories is as follows:

+ + + diff --git a/README.md b/README.md new file mode 100644 index 000000000..0283f2f50 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# What is this? + +This is the TicketMonster distribution, a showcase application for [JBoss Developer Framework](http://jboss.org/jdf). + +## What can you find here? + +The content of the underlying directories is as follows: + +* `demo` - the sources of TicketMonster application - you can build and run it! Follow the [instructions](demo/README.md). Or you can see it at work [here](http://ticketmonster-jdf.rhcloud.com). +* `cordova` - the sources of the TicketMonster Hybrid Mobile (Cordova) application. Follow the [instructions](cordova/README.md) to build and run it. \ No newline at end of file diff --git a/cordova/.cordova/config.json b/cordova/.cordova/config.json new file mode 100644 index 000000000..c0474c9d9 --- /dev/null +++ b/cordova/.cordova/config.json @@ -0,0 +1 @@ +{"id":"org.jboss.examples.ticketmonster.cordova","name":"TicketMonster-Cordova","engine":{"id":"cordova","ver":"3.4.0"}} \ No newline at end of file diff --git a/cordova/.project b/cordova/.project new file mode 100644 index 000000000..e2b418a85 --- /dev/null +++ b/cordova/.project @@ -0,0 +1,18 @@ + + + TicketMonster-Cordova + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + + org.eclipse.thym.core.HybridAppNature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/cordova/README.html b/cordova/README.html new file mode 100644 index 000000000..9188cea42 --- /dev/null +++ b/cordova/README.html @@ -0,0 +1,61 @@ +README +

What is this?

+ +

This is the Hybrid Mobile project for TicketMonster.

+ +

Importing and running the project

+ +

Prerequisites

+ + + +

For running on an Android emulator:

+ + + +

For running on an iOS simulator:

+ + + +

If you need more detailed instruction to setup a iOS Development Environment with Apache Cordova, you can take a look at Setting up your development environment to use Apache Cordova

+ +

Import the ticket-monster Code

+ +

First we need to import the existing Hybrid Mobile project code to JBDS.

+ +
    +
  1. In JBDS, click File then Import.
  2. +
  3. Select Import Cordova Project and click Next.
  4. +
  5. On Root Directory, click on Browse… button and navigate to the $TICKET-MONSTER_HOME/cordova/ directory on your filesystem.
  6. +
  7. After selecting the TicketMonster-Cordova project, you can click on Finish button to start the project import.
  8. +
  9. Make sure that $TICKET-MONSTER_HOME/cordova/www is a linked folder that resolves to ../demo/src/main/webapp.
  10. +
+ +

Troubleshooting Windows Operating Systems

+ +

As Windows doesn’t support symbolic links you must copy $TICKET-MONSTER_HOME/demo/src/main/webapp folder to $TICKET-MONSTER_HOME/cordova/www

+ +

Deploy the application on an Android Emulator

+ +
    +
  1. Select your project in JBDS.
  2. +
  3. Click on Run, then Run As and Run on Android Emulator.
  4. +
+ +

Deploy the application on an iOS Simulator

+ +
    +
  1. Select your project in JBDS.
  2. +
  3. Click on Run, then Run As and Run on iOS Simulator.
  4. +
+ diff --git a/cordova/README.md b/cordova/README.md new file mode 100644 index 000000000..e7ec1d6f7 --- /dev/null +++ b/cordova/README.md @@ -0,0 +1,53 @@ +# What is this? + +This is the Hybrid Mobile project for TicketMonster. + +## Importing and running the project + +Prerequisites +------------- + +* JBoss Developer Studio (JBDS) 8.0.0 GA +* The JBoss Hybrid Mobile Tools + CordovaSim feature is installed in JBDS. + +For running on an Android emulator: + +* The Android Developer Tools plug-in must be installed in JBDS. +* An Android Virtual Device (AVD) having a minimum API level 10 must be available. The recommended API level is 19 (KitKat). + +For running on an iOS simulator: + +* Mac OS X 10.7 (Lion) or higher. +* XCode 6.0 or higher, with iOS 6 SDK or higher. +* An iOS 5.x or higher simulator for the iPhone or iPad. + +If you need more detailed instruction to setup a iOS Development Environment with Apache Cordova, you can take a look at [Setting up your development environment to use Apache Cordova](http://aerogear.org/docs/guides/CordovaSetup/) + +Import the ticket-monster Code +------------------------------ + +First we need to import the existing Hybrid Mobile project code to JBDS. + +1. In JBDS, click File then Import. +2. Select *Import Cordova Project* and click *Next*. +3. On Root Directory, click on *Browse...* button and navigate to the `$TICKET-MONSTER_HOME/cordova/` directory on your filesystem. +4. After selecting the TicketMonster-Cordova project, you can click on *Finish* button to start the project import. +5. Make sure that `$TICKET-MONSTER_HOME/cordova/www` is a linked folder that resolves to `../demo/src/main/webapp`. + +#### Troubleshooting Windows Operating Systems + +As Windows doesn't support symbolic links you must copy `$TICKET-MONSTER_HOME/demo/src/main/webapp` folder to `$TICKET-MONSTER_HOME/cordova/www` + + +Deploy the application on an Android Emulator +-------------------------------------------- + +1. Select your project in JBDS. +2. Click on `Run`, then `Run As` and `Run on Android Emulator`. + + +Deploy the application on an iOS Simulator +-------------------------------------------- + +1. Select your project in JBDS. +2. Click on `Run`, then `Run As` and `Run on iOS Simulator`. diff --git a/cordova/merges/.gitkeep b/cordova/merges/.gitkeep new file mode 100644 index 000000000..1d3f01019 --- /dev/null +++ b/cordova/merges/.gitkeep @@ -0,0 +1 @@ +This file is added to ensure that the directory is retained in git even when no environment specific changes are present and/or used in the project. diff --git a/cordova/plugins/.gitkeep b/cordova/plugins/.gitkeep new file mode 100644 index 000000000..c210ac6e0 --- /dev/null +++ b/cordova/plugins/.gitkeep @@ -0,0 +1 @@ +This file is added to ensure that the directory is retained in git even when no Cordova plugins are present and/or used in the project. diff --git a/cordova/plugins/org.apache.cordova.device/.fetch.json b/cordova/plugins/org.apache.cordova.device/.fetch.json new file mode 100644 index 000000000..12b09c53d --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/.fetch.json @@ -0,0 +1 @@ +{"source":{"type":"registry","id":"org.apache.cordova.device"}} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/.npmignore b/cordova/plugins/org.apache.cordova.device/.npmignore new file mode 100644 index 000000000..52b558e40 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/.npmignore @@ -0,0 +1,23 @@ +#If ignorance is bliss, then somebody knock the smile off my face + +*.csproj.user +*.suo +*.cache +Thumbs.db +*.DS_Store + +*.bak +*.cache +*.log +*.swp +*.user + + + + + + + + + + \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/CONTRIBUTING.md b/cordova/plugins/org.apache.cordova.device/CONTRIBUTING.md new file mode 100644 index 000000000..f7dbcaba7 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/CONTRIBUTING.md @@ -0,0 +1,37 @@ + + +# Contributing to Apache Cordova + +Anyone can contribute to Cordova. And we need your contributions. + +There are multiple ways to contribute: report bugs, improve the docs, and +contribute code. + +For instructions on this, start with the +[contribution overview](http://cordova.apache.org/#contribute). + +The details are explained there, but the important items are: + - Sign and submit an Apache ICLA (Contributor License Agreement). + - Have a Jira issue open that corresponds to your contribution. + - Run the tests so your patch doesn't break existing functionality. + +We look forward to your contributions! diff --git a/cordova/plugins/org.apache.cordova.device/LICENSE b/cordova/plugins/org.apache.cordova.device/LICENSE new file mode 100644 index 000000000..7a4a3ea24 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/LICENSE @@ -0,0 +1,202 @@ + + 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/cordova/plugins/org.apache.cordova.device/NOTICE b/cordova/plugins/org.apache.cordova.device/NOTICE new file mode 100644 index 000000000..8ec56a524 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/NOTICE @@ -0,0 +1,5 @@ +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/cordova/plugins/org.apache.cordova.device/README.md b/cordova/plugins/org.apache.cordova.device/README.md new file mode 100644 index 000000000..5158f6f2e --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/README.md @@ -0,0 +1,22 @@ + + +# org.apache.cordova.device + +Plugin documentation: [doc/index.md](doc/index.md) diff --git a/cordova/plugins/org.apache.cordova.device/RELEASENOTES.md b/cordova/plugins/org.apache.cordova.device/RELEASENOTES.md new file mode 100644 index 000000000..34c89cbf6 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/RELEASENOTES.md @@ -0,0 +1,86 @@ + +# Release Notes + +### 0.2.1 (Sept 5, 2013) +* removed extraneous print statement +* [CB-4432] copyright notice change + +### 0.2.3 (Sept 25, 2013) +* CB-4889 bumping&resetting version +* [windows8] commandProxy has moved +* [BlackBerry10] removed uneeded permission tags in plugin.xml +* CB-4889 renaming org.apache.cordova.core.device to org.apache.cordova.device +* Rename CHANGELOG.md -> RELEASENOTES.md +* updated to use commandProxy for ffos +* add firefoxos support +* [CB-4752] Incremented plugin version on dev branch. + +### 0.2.4 (Oct 28, 2013) +* CB-5128: added repo + issue tag in plugin.xml for device plugin +* CB-5085 device.cordova returning wrong value +* [CB-4915] Incremented plugin version on dev branch. + +### 0.2.5 (Dec 4, 2013) +* CB-5316 Spell Cordova as a brand unless it's a command or script +* [ubuntu] use cordova/exec/proxy +* add ubuntu platform +* Modify Device.platform logic to use amazon-fireos as the platform for Amazon Devices +* 1. Added amazon-fireos platform. 2. Change to use cordova-amazon-fireos as the platform if user agent contains 'cordova-amazon-fireos' + +### 0.2.6 (Jan 02, 2014) +* CB-5658 Add doc/index.md for Device plugin +* CB-5504 Moving Telephony Logic out of Device + +### 0.2.7 (Jan 07, 2014) +* CB-5737 Fix exception on close caused by left over telephony code from CB-5504 + +### 0.2.8 (Feb 05, 2014) +* Tizen support added + +### 0.2.9 (Apr 17, 2014) +* CB-5105: [Android, windows8, WP, BlackBerry10] Removed dead code for device.version +* CB-6422: [windows8] use cordova/exec/proxy +* CB-6460: Update license headers +* Add NOTICE file + +### 0.2.10 (Jun 05, 2014) +* CB-6127 Spanish and French Translations added. Github close #12 +* Changing 1.5 to 2.0 +* added firefoxos version - conversion +* added firefoxos version +* CB-6800 Add license +* CB-6491 add CONTRIBUTING.md + +### 0.2.11 (Aug 06, 2014) +* [FFOS] update DeviceProxy.js +* CB-6127 Updated translations for docs +* Use Windows system calls to get better info + +### 0.2.12 (Sep 17, 2014) +* CB-7471 cordova-plugin-device documentation translation +* CB-7552 device.name docs have not been removed +* [fxos] Fix cordova version +* added status box and documentation to manual tests +* [fxos] Fix cordova version +* added status box and documentation to manual tests +* Added plugin support for the browser +* CB-7262 Adds support for universal windows apps. diff --git a/cordova/plugins/org.apache.cordova.device/doc/de/index.md b/cordova/plugins/org.apache.cordova.device/doc/de/index.md new file mode 100644 index 000000000..83e160a66 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/de/index.md @@ -0,0 +1,206 @@ + + +# org.apache.cordova.device + +Dieses Plugin definiert eine globale `device` -Objekt, das des Geräts Hard- und Software beschreibt. Das Objekt im globalen Gültigkeitsbereich ist es zwar nicht verfügbar bis nach dem `deviceready` Ereignis. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## Installation + + cordova plugin add org.apache.cordova.device + + +## Eigenschaften + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +Rufen Sie die Version von Cordova, die auf dem Gerät ausgeführt. + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Browser +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +## device.model + +Die `device.model` gibt den Namen der Modell- oder des Geräts zurück. Der Wert wird vom Gerätehersteller festgelegt und kann zwischen den Versionen des gleichen Produkts unterschiedlich sein. + +### Unterstützte Plattformen + +* Android +* BlackBerry 10 +* Browser +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Kleines Beispiel + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Finden Sie unter http://theiphonewiki.com/wiki/index.php?title=Models / / Var-Modell = device.model; + + +### Android Macken + +* Ruft den [Produktname][1] anstelle des [Modellnamens][2], das ist oft der Codename für die Produktion. Beispielsweise das Nexus One gibt `Passion` , und Motorola Droid gibt`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Tizen Macken + +* Gibt z. B. das Gerätemodell von dem Kreditor zugeordnet,`TIZEN` + +### Windows Phone 7 und 8 Macken + +* Gibt das vom Hersteller angegebenen Gerätemodell zurück. Beispielsweise gibt der Samsung-Fokus`SGH-i917`. + +## device.platform + +Name des Betriebssystems des Geräts zu erhalten. + + var string = device.platform; + + +### Unterstützte Plattformen + +* Android +* BlackBerry 10 +* Browser4 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Kleines Beispiel + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 Macken + +Windows Phone 7 Geräte melden die Plattform als`WinCE`. + +### Windows Phone 8 Macken + +Windows Phone 8 Geräte melden die Plattform als`Win32NT`. + +## device.uuid + +Des Geräts Universally Unique Identifier ([UUID][3] zu erhalten). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### Beschreibung + +Die Details wie eine UUID generiert wird werden vom Gerätehersteller und beziehen sich auf die Plattform oder das Modell des Geräts. + +### Unterstützte Plattformen + +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Kleines Beispiel + + / / Android: wird eine zufällige 64-Bit-Ganzzahl (als Zeichenfolge, wieder!) / / die ganze Zahl wird beim ersten Start des Geräts erzeugt / / / / BlackBerry: gibt die PIN-Nummer des Gerätes / / Dies ist eine neunstellige eindeutige Ganzzahl (als String, obwohl!) / / / / iPhone: (paraphrasiert aus der Dokumentation zur UIDevice-Klasse) / / liefert eine Reihe von Hash-Werte, die aus mehreren Hardware erstellt identifiziert. + / / Es ist gewährleistet, dass für jedes Gerät eindeutig sein und kann nicht gebunden werden / / an den Benutzer weitergeleitet. + / / Windows Phone 7: gibt einen Hash des Gerät + aktueller Benutzer, / / wenn der Benutzer nicht definiert ist, eine Guid generiert und wird weiter bestehen, bis die app deinstalliert wird / / Tizen: gibt das Gerät IMEI (International Mobile Equipment Identity oder IMEI ist eine Zahl / / einzigartig für jedes GSM- und UMTS-Handy. + var deviceID = device.uuid; + + +### iOS Quirk + +Die `uuid` auf iOS ist nicht eindeutig zu einem Gerät, aber für jede Anwendung, für jede Installation variiert. Es ändert sich, wenn Sie löschen und neu die app installieren, und möglicherweise auch beim iOS zu aktualisieren, oder auch ein Upgrade möglich die app pro Version (scheinbaren in iOS 5.1). Die `uuid` ist kein zuverlässiger Wert. + +### Windows Phone 7 und 8 Macken + +Die `uuid` für Windows Phone 7 die Berechtigung erfordert `ID_CAP_IDENTITY_DEVICE` . Microsoft wird diese Eigenschaft wahrscheinlich bald abzuschaffen. Wenn die Funktion nicht verfügbar ist, generiert die Anwendung eine persistente Guid, die für die Dauer der Installation der Anwendung auf dem Gerät gewährleistet ist. + +## device.version + +Version des Betriebssystems zu erhalten. + + var string = device.version; + + +### Unterstützte Plattformen + +* Android 2.1 + +* BlackBerry 10 +* Browser +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Kleines Beispiel + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/es/index.md b/cordova/plugins/org.apache.cordova.device/doc/es/index.md new file mode 100644 index 000000000..1e5c9b249 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/es/index.md @@ -0,0 +1,215 @@ + + +# org.apache.cordova.device + +Este plugin define un global `device` objeto que describe del dispositivo hardware y software. Aunque el objeto está en el ámbito global, no está disponible hasta después de la `deviceready` evento. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## Instalación + + cordova plugin add org.apache.cordova.device + + +## Propiedades + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +Obtener la versión de Córdoba en el dispositivo. + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* Explorador +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +## device.model + +El `device.model` devuelve el nombre del producto o modelo del dispositivo. El valor es fijado por el fabricante del dispositivo y puede variar entre versiones del mismo producto. + +### Plataformas soportadas + +* Android +* BlackBerry 10 +* Explorador +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Ejemplo rápido + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models + // + var model = device.model; + + +### Rarezas Android + +* Obtiene el [nombre del producto][1] en lugar del [nombre del modelo][2], que es a menudo el nombre de código de producción. Por ejemplo, el Nexus One devuelve `Passion` , y Motorola Droid devuelve`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Rarezas Tizen + +* Devuelve el modelo de dispositivo asignado por el proveedor, por ejemplo,`TIZEN` + +### Windows Phone 7 y 8 rarezas + +* Devuelve el modelo de dispositivo especificado por el fabricante. Por ejemplo, devuelve el Samsung Focus`SGH-i917`. + +## device.platform + +Obtener el nombre del sistema operativo del dispositivo. + + var string = device.platform; + + +### Plataformas soportadas + +* Android +* BlackBerry 10 +* Browser4 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Ejemplo rápido + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 rarezas + +Dispositivos Windows Phone 7 informe de la plataforma`WinCE`. + +### Windows Phone 8 rarezas + +Dispositivos Windows Phone 8 Informe la plataforma como`Win32NT`. + +## device.uuid + +Obtener identificador universalmente única del dispositivo ([UUID][3]). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### Descripción + +Los detalles de cómo se genera un UUID son determinados por el fabricante del dispositivo y son específicos a la plataforma del dispositivo o modelo. + +### Plataformas soportadas + +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Ejemplo rápido + + // Android: Returns a random 64-bit integer (as a string, again!) + // The integer is generated on the device's first boot + // + // BlackBerry: Returns the PIN number of the device + // This is a nine-digit unique integer (as a string, though!) + // + // iPhone: (Paraphrased from the UIDevice Class documentation) + // Returns a string of hash values created from multiple hardware identifies. + / / Está garantizado para ser único para cada dispositivo y no puede ser atado / / a la cuenta de usuario. + / / Windows Phone 7: devuelve un hash de dispositivo + usuario actual, / / si el usuario no está definido, un guid se genera y persistirá hasta que se desinstala la aplicación / / Tizen: devuelve el dispositivo IMEI (identidad de equipo móvil internacional o IMEI es un número / / único para cada teléfono móvil GSM y UMTS. + var deviceID = device.uuid; + + +### iOS chanfle + +El `uuid` en iOS no es exclusiva de un dispositivo, pero varía para cada aplicación, para cada instalación. Cambia si puedes borrar y volver a instalar la aplicación, y posiblemente también cuándo actualizar iOS, o incluso mejorar la aplicación por la versión (evidente en iOS 5.1). El `uuid` no es un valor confiable. + +### Windows Phone 7 y 8 rarezas + +El `uuid` para Windows Phone 7 requiere el permiso `ID_CAP_IDENTITY_DEVICE` . Microsoft pronto probablemente descartan esta propiedad. Si la capacidad no está disponible, la aplicación genera un guid persistente que se mantiene durante la duración de la instalación de la aplicación en el dispositivo. + +## device.version + +Obtiene la versión del sistema operativo. + + var string = device.version; + + +### Plataformas soportadas + +* Android 2.1 + +* BlackBerry 10 +* Explorador +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Ejemplo rápido + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/fr/index.md b/cordova/plugins/org.apache.cordova.device/doc/fr/index.md new file mode 100644 index 000000000..472fda532 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/fr/index.md @@ -0,0 +1,218 @@ + + +# org.apache.cordova.device + +Ce plugin définit un global `device` objet qui décrit le matériel et les logiciels de l'appareil. Bien que l'objet est dans la portée globale, il n'est pas disponible jusqu'après la `deviceready` événement. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## Installation + + cordova plugin add org.apache.cordova.device + + +## Propriétés + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +Retourne la version de Cordova en cours d'exécution sur l'appareil. + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Navigateur +* Firefox OS +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +## device.model + +L'objet `device.model` retourne le nom du modèle de l'appareil/produit. Cette valeur est définie par le fabricant du périphérique et peut varier entre les différentes versions d'un même produit. + +### Plates-formes prises en charge + +* Android +* BlackBerry 10 +* Navigateur +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +### Petit exemple + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Voir http://theiphonewiki.com/wiki/index.php?title=Models + // + var model = device.model; + + +### Quirks Android + +* Retourne le [nom du produit][1] au lieu du [nom du modèle][2], ce qui équivaut souvent au nom de code de production. Par exemple, `Passion` pour le Nexus One et `voles` pour le Motorola Droid. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Bizarreries de paciarelli + +* Retourne le modèle du dispositif, assigné par le vendeur, par exemple `TIZEN` + +### Windows Phone 7 et 8 Quirks + +* Retourne le modèle de l'appareil spécifié par le fabricant. Par exemple `SGH-i917` pour le Samsung Focus. + +## device.platform + +Obtenir le nom de système d'exploitation de l'appareil. + + var string = device.platform; + + +### Plates-formes prises en charge + +* Android +* BlackBerry 10 +* Browser4 +* Firefox OS +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +### Petit exemple + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 Quirks + +Appareils Windows Phone 7 rapport de la plate-forme comme`WinCE`. + +### Notes au sujet de Windows Phone 8 + +Appareils Windows Phone 8 rapport de la plate-forme comme`Win32NT`. + +## device.uuid + +Obtenir Universally Unique Identifier de l'appareil ([UUID][3]). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### Description + +Les détails de comment un UUID généré sont déterminées par le fabricant du périphérique et sont spécifiques à la plate-forme ou le modèle de l'appareil. + +### Plates-formes prises en charge + +* Android +* BlackBerry 10 +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +### Petit exemple + + // Android : retourne un nombre entier 64-bit aléatoire (sous la forme d'une chaîne de caractères, encore !) + // Ce nombre entier est généré lors du premier démarrage de l'appareil + // + // BlackBerry : retourne le numéro PIN de l'appareil + // Il s'agit d'un nombre entier unique à neuf chiffres (sous la forme d'une chaîne de caractères cependant !) + // + // iPhone : (copié depuis la documentation de la classe UIDevice) + // Retourne une chaîne de caractères générée à partir de plusieurs caractéristiques matérielles. + / / Il est garanti pour être unique pour chaque appareil et ne peut pas être lié / / pour le compte d'utilisateur. + // Windows Phone 7 : retourne un hashage généré à partir de appareil+utilisateur actuel, + // si aucun utilisateur n'est défini, un guid est généré persistera jusqu'à ce que l'application soit désinstallée + // Tizen : retourne le numéro IMEI (International Mobile Equipment Identity) de l'appareil, ce numéro est + // unique pour chaque téléphone GSM et UMTS. + var deviceID = device.uuid; + + +### Spécificités iOS + +Le `uuid` sur iOS n'est pas propre à un périphérique, mais varie pour chaque application, pour chaque installation. Elle change si vous supprimez, puis réinstallez l'application, et éventuellement aussi quand vous mettre à jour d'iOS, ou même mettre à jour le soft par version (apparent dans iOS 5.1). Le `uuid` n'est pas une valeur fiable. + +### Windows Phone 7 et 8 Quirks + +Le `uuid` pour Windows Phone 7 requiert l'autorisation `ID_CAP_IDENTITY_DEVICE` . Microsoft va probablement bientôt obsolète de cette propriété. Si la capacité n'est pas disponible, l'application génère un guid persistant qui est maintenu pendant toute la durée de l'installation de l'application sur le périphérique. + +## device.version + +Téléchargez la version de système d'exploitation. + + var string = device.version; + + +### Plates-formes prises en charge + +* Android 2.1+ +* BlackBerry 10 +* Navigateur +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +### Petit exemple + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/index.md b/cordova/plugins/org.apache.cordova.device/doc/index.md new file mode 100644 index 000000000..b3acc9f61 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/index.md @@ -0,0 +1,218 @@ + + +# org.apache.cordova.device + +This plugin defines a global `device` object, which describes the device's hardware and software. +Although the object is in the global scope, it is not available until after the `deviceready` event. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + +## Installation + + cordova plugin add org.apache.cordova.device + +## Properties + +- device.cordova +- device.model +- device.platform +- device.uuid +- device.version + +## device.cordova + +Get the version of Cordova running on the device. + +### Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- Browser +- Firefox OS +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +## device.model + +The `device.model` returns the name of the device's model or +product. The value is set by the device manufacturer and may be +different across versions of the same product. + +### Supported Platforms + +- Android +- BlackBerry 10 +- Browser +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +### Quick Example + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models + // + var model = device.model; + +### Android Quirks + +- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL), which is often the production code name. For example, the Nexus One returns `Passion`, and Motorola Droid returns `voles`. + +### Tizen Quirks + +- Returns the device model assigned by the vendor, for example, `TIZEN` + +### Windows Phone 7 and 8 Quirks + +- Returns the device model specified by the manufacturer. For example, the Samsung Focus returns `SGH-i917`. + +## device.platform + +Get the device's operating system name. + + var string = device.platform; + +### Supported Platforms + +- Android +- BlackBerry 10 +- Browser4 +- Firefox OS +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +### Quick Example + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + +### Windows Phone 7 Quirks + +Windows Phone 7 devices report the platform as `WinCE`. + +### Windows Phone 8 Quirks + +Windows Phone 8 devices report the platform as `Win32NT`. + +## device.uuid + +Get the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)). + + var string = device.uuid; + +### Description + +The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model. + +### Supported Platforms + +- Android +- BlackBerry 10 +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +### Quick Example + + // Android: Returns a random 64-bit integer (as a string, again!) + // The integer is generated on the device's first boot + // + // BlackBerry: Returns the PIN number of the device + // This is a nine-digit unique integer (as a string, though!) + // + // iPhone: (Paraphrased from the UIDevice Class documentation) + // Returns a string of hash values created from multiple hardware identifies. + // It is guaranteed to be unique for every device and can't be tied + // to the user account. + // Windows Phone 7 : Returns a hash of device+current user, + // if the user is not defined, a guid is generated and will persist until the app is uninstalled + // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number + // unique to every GSM and UMTS mobile phone. + var deviceID = device.uuid; + +### iOS Quirk + +The `uuid` on iOS is not unique to a device, but varies for each +application, for each installation. It changes if you delete and +re-install the app, and possibly also when you upgrade iOS, or even +upgrade the app per version (apparent in iOS 5.1). The `uuid` is not +a reliable value. + +### Windows Phone 7 and 8 Quirks + +The `uuid` for Windows Phone 7 requires the permission +`ID_CAP_IDENTITY_DEVICE`. Microsoft will likely deprecate this +property soon. If the capability is not available, the application +generates a persistent guid that is maintained for the duration of the +application's installation on the device. + +## device.version + +Get the operating system version. + + var string = device.version; + +### Supported Platforms + +- Android 2.1+ +- BlackBerry 10 +- Browser +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +### Quick Example + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; + diff --git a/cordova/plugins/org.apache.cordova.device/doc/it/index.md b/cordova/plugins/org.apache.cordova.device/doc/it/index.md new file mode 100644 index 000000000..0414dc6fc --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/it/index.md @@ -0,0 +1,206 @@ + + +# org.apache.cordova.device + +Questo plugin definisce un global `device` oggetto che descrive il dispositivo hardware e software. Sebbene l'oggetto sia in ambito globale, non è disponibile fino a dopo il `deviceready` evento. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## Installazione + + cordova plugin add org.apache.cordova.device + + +## Proprietà + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +Ottenere la versione di Cordova in esecuzione nel dispositivo. + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* Browser +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +## device.model + +Il `device.model` restituisce il nome del modello del dispositivo o del prodotto. Il valore viene impostato dal produttore del dispositivo e può essere differente tra le versioni dello stesso prodotto. + +### Piattaforme supportate + +* Android +* BlackBerry 10 +* Browser +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Esempio rapido + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Vedi http://theiphonewiki.com/wiki/index.php?title=Models / / modello var = device.model; + + +### Stranezze Android + +* Ottiene il [nome del prodotto][1] anziché il [nome del modello][2], che è spesso il nome di codice di produzione. Ad esempio, restituisce il Nexus One `Passion` , e Motorola Droid restituisce`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Tizen stranezze + +* Restituisce il modello di dispositivo assegnato dal fornitore, ad esempio,`TIZEN` + +### Windows Phone 7 e 8 stranezze + +* Restituisce il modello di dispositivo specificato dal produttore. Ad esempio, restituisce il Samsung Focus`SGH-i917`. + +## device.platform + +Ottenere il nome del sistema operativo del dispositivo. + + var string = device.platform; + + +### Piattaforme supportate + +* Android +* BlackBerry 10 +* Browser4 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Esempio rapido + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 capricci + +Windows Phone 7 dispositivi segnalano la piattaforma come`WinCE`. + +### Windows Phone 8 stranezze + +Dispositivi Windows Phone 8 segnalano la piattaforma come`Win32NT`. + +## device.uuid + +Ottenere identificatore del dispositivo univoco universale ([UUID][3]). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### Descrizione + +I dettagli di come viene generato un UUID sono determinati dal produttore del dispositivo e sono specifici per la piattaforma o il modello del dispositivo. + +### Piattaforme supportate + +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Esempio rapido + + / / Android: restituisce un intero casuale di 64 bit (come stringa, ancora una volta!) / / il numero intero è generato al primo avvio del dispositivo / / / / BlackBerry: restituisce il numero PIN del dispositivo / / questo è un valore integer univoco a nove cifre (come stringa, benchè!) / / / / iPhone: (parafrasato dalla documentazione della classe UIDevice) / / restituisce una stringa di valori hash creata dall'hardware più identifica. + / / È garantito per essere unica per ogni dispositivo e non può essere legato / / per l'account utente. + / / Windows Phone 7: restituisce un hash dell'utente corrente, + dispositivo / / se l'utente non è definito, un guid generato e persisterà fino a quando l'applicazione viene disinstallata / / Tizen: restituisce il dispositivo IMEI (International Mobile Equipment Identity o IMEI è un numero / / unico per ogni cellulare GSM e UMTS. + var deviceID = device.uuid; + + +### iOS Quirk + +Il `uuid` su iOS non è univoco per un dispositivo, ma varia per ogni applicazione, per ogni installazione. Cambia se si elimina e re-installare l'app, e possibilmente anche quando aggiornare iOS o anche aggiornare l'app per ogni versione (apparente in iOS 5.1). Il `uuid` non è un valore affidabile. + +### Windows Phone 7 e 8 stranezze + +Il `uuid` per Windows Phone 7 richiede l'autorizzazione `ID_CAP_IDENTITY_DEVICE` . Microsoft probabilmente sarà presto deprecare questa proprietà. Se la funzionalità non è disponibile, l'applicazione genera un guid persistente che viene mantenuto per la durata dell'installazione dell'applicazione sul dispositivo. + +## device.version + +Ottenere la versione del sistema operativo. + + var string = device.version; + + +### Piattaforme supportate + +* Android 2.1 + +* BlackBerry 10 +* Browser +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Esempio rapido + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/ja/index.md b/cordova/plugins/org.apache.cordova.device/doc/ja/index.md new file mode 100644 index 000000000..ee447202f --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/ja/index.md @@ -0,0 +1,206 @@ + + +# org.apache.cordova.device + +このプラグインをグローバル定義します `device` オブジェクトは、デバイスのハードウェアとソフトウェアについて説明します。 それは後まで利用可能なオブジェクトがグローバル スコープでは、 `deviceready` イベント。 + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## インストール + + cordova plugin add org.apache.cordova.device + + +## プロパティ + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +デバイスで実行されているコルドバのバージョンを取得します。 + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* ブラウザー +* Firefox の OS +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +## device.model + +`device.model`、デバイスのモデルまたは製品の名前を返します。値は、デバイスの製造元によって設定され、同じ製品のバージョン間で異なる可能性があります。 + +### サポートされているプラットフォーム + +* アンドロイド +* ブラックベリー 10 +* ブラウザー +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### 簡単な例 + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Http://theiphonewiki.com/wiki/index.php?title=Models を参照してください//var モデル = device.model; + + +### Android の癖 + +* 生産コード名は[モデル名][1]の代わりに[製品名][2]を取得します。 たとえば、ネクサス 1 つを返します `Passion` 、Motorola のドロイドを返します`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#MODEL + [2]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + +### Tizen の癖 + +* たとえば、ベンダーによって割り当てられているデバイスのモデルを返します`TIZEN` + +### Windows Phone 7 と 8 癖 + +* 製造元によって指定されたデバイスのモデルを返します。たとえば、三星フォーカスを返します`SGH-i917`. + +## device.platform + +デバイスのオペレーティング システム名を取得します。 + + var string = device.platform; + + +### サポートされているプラットフォーム + +* アンドロイド +* ブラックベリー 10 +* Browser4 +* Firefox の OS +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### 簡単な例 + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 の癖 + +Windows Phone 7 デバイスとプラットフォームを報告します。`WinCE`. + +### Windows Phone 8 癖 + +Windows Phone 8 デバイスとプラットフォームを報告します。`Win32NT`. + +## device.uuid + +デバイスのユニバーサル ・ ユニーク識別子 ([UUID][3]を取得します。). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### 説明 + +UUID を生成する方法の詳細は、デバイスの製造元によって決定され、デバイスのプラットフォームやモデルに固有です。 + +### サポートされているプラットフォーム + +* アンドロイド +* ブラックベリー 10 +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### 簡単な例 + + //アンドロイド: ランダムな 64 ビットの整数 (を文字列として返します、再び !)/デバイスの最初の起動時に生成される整数/////ブラックベリー: デバイスのピン番号を返します//これは 9 桁の一意な整数 (を文字列としても !)////iPhone: (UIDevice クラスのドキュメントから言い換え)//識別複数のハードウェアから作成されたハッシュ値の文字列を返します。。 + //それはすべてのデバイスに対して一意であることが保証され、接続することはできません//ユーザー アカウント。 + //Windows Phone 7: デバイス + 現在のユーザーのハッシュを返します//ユーザーが定義されていない場合 guid が生成され、アプリがアンインストールされるまで保持されます//Tizen: デバイスの IMEI を返します (国際モバイル機器アイデンティティまたは IMEI は番号です//すべての GSM および UMTS の携帯電話に固有です。 + var deviceID = device.uuid; + + +### iOS の気まぐれ + +`uuid`IOS で、デバイスに固有ではないインストールごと、アプリケーションごとに異なります。 削除、アプリを再インストールした場合に変更と多分またときアップグレード iOS の, またはもアップグレードするアプリ (iOS の 5.1 で明らかに) バージョンごと。 `uuid`は信頼性の高い値ではありません。 + +### Windows Phone 7 と 8 癖 + +`uuid`のために Windows Phone 7 には、権限が必要です `ID_CAP_IDENTITY_DEVICE` 。 Microsoft はすぐにこのプロパティを廃止して可能性があります。 機能が利用できない場合、アプリケーションはデバイスへのアプリケーションのインストールの持続期間のために保持されている永続的な guid を生成します。 + +## device.version + +オペレーティング システムのバージョンを取得します。 + + var string = device.version; + + +### サポートされているプラットフォーム + +* アンドロイド 2.1 + +* ブラックベリー 10 +* ブラウザー +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### 簡単な例 + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/ko/index.md b/cordova/plugins/org.apache.cordova.device/doc/ko/index.md new file mode 100644 index 000000000..af44d40a7 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/ko/index.md @@ -0,0 +1,206 @@ + + +# org.apache.cordova.device + +이 플러그인 정의 전역 `device` 개체, 디바이스의 하드웨어 및 소프트웨어에 설명 합니다. 개체는 전역 범위에서 비록 그것은 후까지 사용할 수 있는 `deviceready` 이벤트. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## 설치 + + cordova plugin add org.apache.cordova.device + + +## 속성 + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +코르도바는 장치에서 실행 중인 버전을 얻을. + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* 브라우저 +* Firefox 운영 체제 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +## device.model + +`device.model`소자의 모델 또는 제품의 이름을 반환 합니다. 값 장치 제조업체에서 설정 되 고 동일 제품의 버전 간에 다를 수 있습니다. + +### 지원 되는 플랫폼 + +* 안 드 로이드 +* 블랙베리 10 +* 브라우저 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### 빠른 예제 + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Http://theiphonewiki.com/wiki/index.php?title=Models 참조 / / var 모델 = device.model; + + +### 안 드 로이드 단점 + +* 어떤은 종종 프로덕션 코드 이름 대신 [제품 모델 이름][1], [제품 이름][2] 을 가져옵니다. 예를 들어 넥서스 하나 반환 합니다 `Passion` , 모토로라 Droid를 반환 합니다`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#MODEL + [2]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + +### Tizen 특수 + +* 예를 들어, 공급 업체에 의해 할당 된 디바이스 모델을 반환 합니다.`TIZEN` + +### Windows Phone 7, 8 특수 + +* 제조업체에서 지정 하는 장치 모델을 반환 합니다. 예를 들어 삼성 포커스를 반환 합니다.`SGH-i917`. + +## device.platform + +장치의 운영 체제 이름을 얻을. + + var string = device.platform; + + +### 지원 되는 플랫폼 + +* 안 드 로이드 +* 블랙베리 10 +* Browser4 +* Firefox 운영 체제 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### 빠른 예제 + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 단점 + +Windows Phone 7 장치 보고 플랫폼으로`WinCE`. + +### Windows Phone 8 단점 + +Windows Phone 8 장치 보고 플랫폼으로`Win32NT`. + +## device.uuid + +소자의 보편적으로 고유 식별자 ([UUID][3] 를 얻을합니다). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### 설명 + +UUID 생성 방법의 자세한 내용은 장치 제조업체에 의해 결정 됩니다 및 소자의 플랫폼 이나 모델. + +### 지원 되는 플랫폼 + +* 안 드 로이드 +* 블랙베리 10 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### 빠른 예제 + + / / 안 드 로이드: (문자열로 다시!) 임의의 64 비트 정수를 반환 합니다 / / 정수 장치의 첫 번째 부팅에서 생성 / / / / 블랙베리: 디바이스의 핀 번호를 반환 합니다 / / 이것은 9 자리 고유 정수 (문자열로 비록!) / / / / 아이폰: (UIDevice 클래스 설명서에서 읊 었) / / 문자열 여러 하드웨어에서 생성 하는 해시 값을 식별 하는 반환 합니다. + / 그것은 모든 장치에 대 한 고유 해야 보장 되 고 묶일 수 없습니다 / / / 사용자 계정에. + / / Windows Phone 7: 장치 + 현재 사용자의 해시를 반환 합니다 / / 사용자 정의 되지 않은 경우 guid 생성 되 고 응용 프로그램을 제거할 때까지 유지 됩니다 / / Tizen: 반환 장치 IMEI (국제 모바일 기기 식별 또는 IMEI 숫자입니다 / / 모든 GSM와 UMTS 휴대 전화 고유. + var deviceID = device.uuid; + + +### iOS 특질 + +`uuid`ios 장치에 고유 하지 않습니다 하지만 각 설치에 대 한 응용 프로그램 마다 다릅니다. 삭제 하 고 다시 애플 리 케이 션을 설치 하는 경우 변경 가능 하 게 또한 iOS를 업그레이드 하거나 때 버전 (iOS 5.1에에서 명백한) 당 응용 프로그램 업그레이드도 하 고. `uuid`은 신뢰할 수 있는 값이 아닙니다. + +### Windows Phone 7, 8 특수 + +`uuid`Windows Phone 7 필요 허가 `ID_CAP_IDENTITY_DEVICE` . Microsoft는 곧이 속성을 세웁니다 가능성이 것입니다. 기능을 사용할 수 없는 경우 응용 프로그램 장치에 응용 프로그램의 설치 하는 동안 유지 하는 영구 guid를 생성 합니다. + +## device.version + +운영 체제 버전을 얻을. + + var string = device.version; + + +### 지원 되는 플랫폼 + +* 안 드 로이드 2.1 + +* 블랙베리 10 +* 브라우저 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### 빠른 예제 + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/pl/index.md b/cordova/plugins/org.apache.cordova.device/doc/pl/index.md new file mode 100644 index 000000000..52907dd3e --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/pl/index.md @@ -0,0 +1,206 @@ + + +# org.apache.cordova.device + +Ten plugin określa globalne `device` obiekt, który opisuje urządzenia sprzętowe i programowe. Mimo, że obiekt jest w globalnym zasięgu, nie jest dostępne dopiero po `deviceready` zdarzenie. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## Instalacji + + cordova plugin add org.apache.cordova.device + + +## Właściwości + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +Pobierz wersję Cordova działa na urządzeniu. + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Jeżyna 10 +* Przeglądarka +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +## device.model + +`device.model`Zwraca nazwę modelu lub produktu. Wartość jest zestaw przez producenta urządzenia i mogą się różnić między wersjami tego samego produktu. + +### Obsługiwane platformy + +* Android +* Jeżyna 10 +* Przeglądarka +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Szybki przykład + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. Zobacz http://theiphonewiki.com/wiki/index.php?title=Models / / modelu var = device.model; + + +### Android dziwactwa + +* Pobiera [nazwę produktu][1] zamiast [nazwy modelu][2], który często jest nazwą kod produkcji. Na przykład, Nexus One zwraca `Passion` , i zwraca Motorola Droid`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Osobliwości Tizen + +* Zwraca modelu urządzenia przypisane przez dostawcę, na przykład,`TIZEN` + +### Windows Phone 7 i 8 dziwactwa + +* Zwraca modelu urządzenia, określonej przez producenta. Na przykład Samsung ostrości zwraca`SGH-i917`. + +## device.platform + +Uzyskać nazwę systemu operacyjnego urządzenia. + + var string = device.platform; + + +### Obsługiwane platformy + +* Android +* Jeżyna 10 +* Browser4 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Szybki przykład + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 dziwactwa + +Urządzenia Windows Phone 7 raport platformy jako`WinCE`. + +### Windows Phone 8 dziwactwa + +Urządzenia Windows Phone 8 raport platformy jako`Win32NT`. + +## device.uuid + +Się urządzenia uniwersalnie unikatowy identyfikator ([UUID][3]). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### Opis + +Szczegóły jak UUID jest generowane są określane przez producenta urządzenia i są specyficzne dla platformy lub modelu urządzenia. + +### Obsługiwane platformy + +* Android +* Jeżyna 10 +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Szybki przykład + + / / Android: zwraca losowe 64-bitowa liczba całkowita (jako ciąg, znowu!) / / liczba całkowita jest generowany na pierwszego uruchomienia urządzenia / / / / BlackBerry: zwraca numer PIN urządzenia / / to jest unikatową liczbą całkowitą dziewięciu cyfr (jako ciąg, choć!) / / / / iPhone: (zacytowana w dokumentacji klasy UIDevice) / / zwraca ciąg wartości mieszania utworzone z wielu sprzętu identyfikuje. + Zapewniona jest unikatowy dla każdego urządzenia i nie może być związane z / do konta użytkownika. + / / Windows Phone 7: zwraca wartość mieszania urządzenia + bieżący użytkownik, / / jeśli nie zdefiniowane przez użytkownika, identyfikator guid jest generowany i będzie trwać do czasu odinstalowania aplikacji / / Tizen: zwraca urządzenia IMEI (International Mobile Equipment Identity lub IMEI jest liczbą / / unikatowe dla każdego telefonu komórkowego GSM i UMTS. + var deviceID = device.uuid; + + +### iOS dziwactwo + +`uuid`Na iOS nie jest przypisany do urządzenia, ale różni się dla każdej aplikacji, dla każdej instalacji. Zmienia się jeśli możesz usunąć i ponownie zainstalować aplikację, a ewentualnie także po aktualizacji iOS czy nawet uaktualnienia aplikacji dla wersji (widoczny w iOS 5.1). `uuid`Jest nie wiarygodne wartości. + +### Windows Phone 7 i 8 dziwactwa + +`uuid`Dla Windows Phone 7 wymaga uprawnień `ID_CAP_IDENTITY_DEVICE` . Microsoft będzie prawdopodobnie potępiać ten wkrótce. Jeśli funkcja nie jest dostępna, aplikacja generuje trwałe identyfikator guid, który jest utrzymywany przez czas trwania instalacji aplikacji na urządzeniu. + +## device.version + +Pobierz wersję systemu operacyjnego. + + var string = device.version; + + +### Obsługiwane platformy + +* Android 2.1 + +* Jeżyna 10 +* Przeglądarka +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Szybki przykład + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/ru/index.md b/cordova/plugins/org.apache.cordova.device/doc/ru/index.md new file mode 100644 index 000000000..542115c8f --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/ru/index.md @@ -0,0 +1,219 @@ + + +# org.apache.cordova.device + +Этот плагин определяет глобальный объект `device`, который описывает оборудование и программное обеспечение устройства. Несмотря на то что объект в глобальной области видимости, он не доступен до того момента пока не произойдет событие `deviceready`. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## Установка + + cordova plugin add org.apache.cordova.device + + +## Свойства + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +Возвращает версию Cordova, работающую на устройстве. + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* BlackBerry 10 +* Обозреватель +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +## device.model + +Свойство `device.model` возвращает имя устройства модели или продукта. Значение устанавливается производителем устройства и могут отличаться в разных версиях одного и того же продукта. + +### Поддерживаемые платформы + +* Android +* BlackBerry 10 +* Обозреватель +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Краткий пример + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models + // + var model = device.model; + + +### Особенности Android + +* Возвращает [имя продукта][1] , а не [имя модели][2], которое часто является производственным кодом. Например, Nexus One из них возвращает `Passion` , и Motorola Droid возвращает `voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Особенности Tizen + +* Возвращает модель устройства, назначенного вендором, например,`TIZEN` + +### Особенности Windows Phone 7 и 8 + +* Возвращает модель устройства, указанной заводом-изготовителем. Например Samsung Focus возвращает `SGH-i917`. + +## device.platform + +Получите имя операционной системы устройства. + + var string = device.platform; + + +### Поддерживаемые платформы + +* Android +* BlackBerry 10 +* Браузером4 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Краткий пример + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Особенности Windows Phone 7 + +Windows Phone 7 устройства сообщают платформе как`WinCE`. + +### Особенности Windows Phone 8 + +Устройства Windows Phone 8 сообщают платформе как`Win32NT`. + +## device.uuid + +Получить универсального уникального идентификатора ([UUID][3] устройства). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### Описание + +Подробная информация о том, как UUID генерируется определяются изготовителем устройства и являются специфическими для платформы или модель устройства. + +### Поддерживаемые платформы + +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Краткий пример + + // Android: Возвращает случайное 64-разрядное целое число (в виде строки, опять!) + // целое число генерируется при первой загрузке устройства + // + // BlackBerry: Возвращает номер PIN устройства + // это 9 значный уникальный целочисленный (как строка, хотя!) + // + // iPhone: (Перефразировано из документации класса UIDevice) + // возвращает строку хэш-значения, созданные из нескольких аппаратных определяет. + // Это значение гарантированно является уникальным для каждого устройства и не может быть привязано + // к учетной записи пользователя. + // Windows Phone 7: Возвращает хэш устройство + текущего пользователя, + // если пользователь не определен, формируется guid который и будет сохраняться до тех пор, пока приложение не удалиться + // Tizen: возвращает IMEI устройства (Международный идентификатор мобильного оборудования или IMEI это число + // уникальное для каждого мобильного телефона GSM и UMTS. + var deviceID = device.uuid; + + +### Особенности iOS + +`uuid`На iOS не является уникальным для устройства, но различается для каждого приложения, для каждой установки. Она меняется, если удалить и повторно установить приложение, и возможно также когда вы обновить iOS, или даже обновить приложение в версии (явно в iOS 5.1). `uuid`Не является надежным. + +### Особенности Windows Phone 7 и 8 + +`uuid`Для Windows Phone 7 требует разрешения `ID_CAP_IDENTITY_DEVICE` . Microsoft будет скорее всего скоро Опознайте это свойство. Если возможности не предоставляется, приложение создает постоянный идентификатор guid, который поддерживается на время установки приложения на устройстве. + +## device.version + +Получите версию операционной системы. + + var string = device.version; + + +### Поддерживаемые платформы + +* Android 2.1 + +* BlackBerry 10 +* Обозреватель +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Краткий пример + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/doc/zh/index.md b/cordova/plugins/org.apache.cordova.device/doc/zh/index.md new file mode 100644 index 000000000..58818a852 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/doc/zh/index.md @@ -0,0 +1,206 @@ + + +# org.apache.cordova.device + +這個外掛程式定義全球 `device` 物件,描述該設備的硬體和軟體。 雖然物件是在全球範圍內,但不是可用,直到後 `deviceready` 事件。 + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(device.cordova); + } + + +## 安裝 + + cordova plugin add org.apache.cordova.device + + +## 屬性 + +* device.cordova +* device.model +* device.platform +* device.uuid +* device.version + +## device.cordova + +獲取科爾多瓦在設備上運行的版本。 + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* 瀏覽器 +* 火狐瀏覽器的作業系統 +* iOS +* 泰 +* Windows Phone 7 和 8 +* Windows 8 + +## device.model + +`device.model`返回設備的模型或產品的名稱。值由設備製造商設置和同一產品的不同版本可能不同。 + +### 支援的平臺 + +* Android 系統 +* 黑莓 10 +* 瀏覽器 +* iOS +* 泰 +* Windows Phone 7 和 8 +* Windows 8 + +### 快速的示例 + + // Android: Nexus One returns "Passion" (Nexus One code name) + // Motorola Droid returns "voles" + // BlackBerry: Torch 9800 returns "9800" + // Browser: Google Chrome returns "Chrome" + // Safari returns "Safari" + // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. 請參閱 HTTP://theiphonewiki.com/wiki/index.php?title=Models / / var 模型 = device.model ; + + +### Android 的怪癖 + +* 獲取[產品名稱][1]而不是[產品型號名稱][2],這往往是生產代碼名稱。 例如,Nexus One 返回 `Passion` ,和摩托羅拉 Droid 返回`voles`. + + [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT + [2]: http://developer.android.com/reference/android/os/Build.html#MODEL + +### Tizen 怪癖 + +* 例如,返回與供應商指派的設備模型`TIZEN` + +### Windows Phone 7 和 8 怪癖 + +* 返回由製造商指定的設備模型。例如,三星焦點返回`SGH-i917`. + +## device.platform + +獲取設備的作業系統名稱。 + + var string = device.platform; + + +### 支援的平臺 + +* Android 系統 +* 黑莓 10 +* Browser4 +* 火狐瀏覽器的作業系統 +* iOS +* 泰 +* Windows Phone 7 和 8 +* Windows 8 + +### 快速的示例 + + // Depending on the device, a few examples are: + // - "Android" + // - "BlackBerry 10" + // - Browser: returns "MacIntel" on Mac + // returns "Win32" on Windows + // - "iOS" + // - "WinCE" + // - "Tizen" + var devicePlatform = device.platform; + + +### Windows Phone 7 的怪癖 + +Windows Phone 7 設備報告作為平臺`WinCE`. + +### Windows Phone 8 怪癖 + +Windows Phone 8 設備報告作為平臺`Win32NT`. + +## device.uuid + +獲取設備的通用唯一識別碼 ([UUID][3]). + + [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier + + var string = device.uuid; + + +### 說明 + +如何生成一個 UUID 的細節由設備製造商和特定于設備的平臺或模型。 + +### 支援的平臺 + +* Android 系統 +* 黑莓 10 +* iOS +* Tizen +* Windows Phone 7 和 8 +* Windows 8 + +### 快速的示例 + + / / Android: 一個隨機的 64 位整數 (作為字串返回,再次!) / / 上設備的第一次啟動生成的整數 / / / / 黑莓手機: 返回設備的 PIN 號碼 / / 這是九個數字的唯一整數 (作為字串,雖然!) / / / / iPhone: (從 UIDevice 類文檔解釋) / / 返回一個字串的雜湊值創建的多個硬體標識。 + / / 它保證是唯一的每個設備並不能綁 / / 到使用者帳戶。 + / / Windows Phone 7: 返回的雜湊代碼的設備 + 當前使用者,/ / 如果未定義使用者,則一個 guid 生成的並且將會保留直到卸載該應用程式 / / Tizen: 返回設備 IMEI (國際行動裝置身份或 IMEI 是一個數位 / / 獨有的每一個 UMTS 和 GSM 行動電話。 + var deviceID = device.uuid; + + +### iOS 怪癖 + +`uuid`在 iOS 不是唯一的一種裝置,但對於每個應用程式,為每個安裝而異。 如果您刪除並重新安裝該應用程式,它更改和可能還當你升級 iOS,或甚至升級每個版本 (iOS 5.1 中存在明顯的) 的應用程式。 `uuid`不是一個可靠的值。 + +### Windows Phone 7 和 8 怪癖 + +`uuid`為 Windows Phone 7 須經許可 `ID_CAP_IDENTITY_DEVICE` 。 Microsoft 可能會很快棄用此屬性。 如果沒有可用的能力,應用程式將生成設備上應用程式的安裝過程中保持持續的 guid。 + +## device.version + +獲取作業系統版本。 + + var string = device.version; + + +### 支援的平臺 + +* Android 2.1 + +* 黑莓 10 +* 瀏覽器 +* iOS +* 泰 +* Windows Phone 7 和 8 +* Windows 8 + +### 快速的示例 + + // Android: Froyo OS would return "2.2" + // Eclair OS would return "2.1", "2.0.1", or "2.0" + // Version can also return update level "2.1-update1" + // + // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" + // + // Browser: Returns version number for the browser + // + // iPhone: iOS 3.2 returns "3.2" + // + // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 + // Tizen: returns "TIZEN_20120425_2" + var deviceVersion = device.version; \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/package.json b/cordova/plugins/org.apache.cordova.device/package.json new file mode 100644 index 000000000..e57f96057 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/package.json @@ -0,0 +1,29 @@ +{ + "version": "0.2.12", + "name": "org.apache.cordova.device", + "cordova_name": "Device", + "description": "Cordova Device Plugin", + "license": "Apache 2.0", + "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git", + "issue": "https://issues.apache.org/jira/browse/CB/component/12320648", + "keywords": [ + "cordova", + "device" + ], + "platforms": [ + "firefoxos", + "tizen", + "android", + "amazon-fireos", + "ubuntu", + "ios", + "blackberry10", + "wp7", + "wp8", + "windows8", + "windows", + "browser" + ], + "engines": [], + "englishdoc": "\n\n# org.apache.cordova.device\n\nThis plugin defines a global `device` object, which describes the device's hardware and software.\nAlthough the object is in the global scope, it is not available until after the `deviceready` event.\n\n document.addEventListener(\"deviceready\", onDeviceReady, false);\n function onDeviceReady() {\n console.log(device.cordova);\n }\n\n## Installation\n\n cordova plugin add org.apache.cordova.device\n\n## Properties\n\n- device.cordova\n- device.model\n- device.platform\n- device.uuid\n- device.version\n\n## device.cordova\n\nGet the version of Cordova running on the device.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Browser\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n## device.model\n\nThe `device.model` returns the name of the device's model or\nproduct. The value is set by the device manufacturer and may be\ndifferent across versions of the same product.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- Browser\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Nexus One returns \"Passion\" (Nexus One code name)\n // Motorola Droid returns \"voles\"\n // BlackBerry: Torch 9800 returns \"9800\"\n // Browser: Google Chrome returns \"Chrome\"\n // Safari returns \"Safari\"\n // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models\n //\n var model = device.model;\n\n### Android Quirks\n\n- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL), which is often the production code name. For example, the Nexus One returns `Passion`, and Motorola Droid returns `voles`.\n\n### Tizen Quirks\n\n- Returns the device model assigned by the vendor, for example, `TIZEN`\n\n### Windows Phone 7 and 8 Quirks\n\n- Returns the device model specified by the manufacturer. For example, the Samsung Focus returns `SGH-i917`.\n\n## device.platform\n\nGet the device's operating system name.\n\n var string = device.platform;\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- Browser4\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Depending on the device, a few examples are:\n // - \"Android\"\n // - \"BlackBerry 10\"\n // - Browser: returns \"MacIntel\" on Mac\n // returns \"Win32\" on Windows\n // - \"iOS\"\n // - \"WinCE\"\n // - \"Tizen\"\n var devicePlatform = device.platform;\n\n### Windows Phone 7 Quirks\n\nWindows Phone 7 devices report the platform as `WinCE`.\n\n### Windows Phone 8 Quirks\n\nWindows Phone 8 devices report the platform as `Win32NT`.\n\n## device.uuid\n\nGet the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)).\n\n var string = device.uuid;\n\n### Description\n\nThe details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Returns a random 64-bit integer (as a string, again!)\n // The integer is generated on the device's first boot\n //\n // BlackBerry: Returns the PIN number of the device\n // This is a nine-digit unique integer (as a string, though!)\n //\n // iPhone: (Paraphrased from the UIDevice Class documentation)\n // Returns a string of hash values created from multiple hardware identifies.\n // It is guaranteed to be unique for every device and can't be tied\n // to the user account.\n // Windows Phone 7 : Returns a hash of device+current user,\n // if the user is not defined, a guid is generated and will persist until the app is uninstalled\n // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number\n // unique to every GSM and UMTS mobile phone.\n var deviceID = device.uuid;\n\n### iOS Quirk\n\nThe `uuid` on iOS is not unique to a device, but varies for each\napplication, for each installation. It changes if you delete and\nre-install the app, and possibly also when you upgrade iOS, or even\nupgrade the app per version (apparent in iOS 5.1). The `uuid` is not\na reliable value.\n\n### Windows Phone 7 and 8 Quirks\n\nThe `uuid` for Windows Phone 7 requires the permission\n`ID_CAP_IDENTITY_DEVICE`. Microsoft will likely deprecate this\nproperty soon. If the capability is not available, the application\ngenerates a persistent guid that is maintained for the duration of the\napplication's installation on the device.\n\n## device.version\n\nGet the operating system version.\n\n var string = device.version;\n\n### Supported Platforms\n\n- Android 2.1+\n- BlackBerry 10\n- Browser\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Froyo OS would return \"2.2\"\n // Eclair OS would return \"2.1\", \"2.0.1\", or \"2.0\"\n // Version can also return update level \"2.1-update1\"\n //\n // BlackBerry: Torch 9800 using OS 6.0 would return \"6.0.0.600\"\n //\n // Browser: Returns version number for the browser\n //\n // iPhone: iOS 3.2 returns \"3.2\"\n //\n // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720\n // Tizen: returns \"TIZEN_20120425_2\"\n var deviceVersion = device.version;\n\n" +} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.device/plugin.xml b/cordova/plugins/org.apache.cordova.device/plugin.xml new file mode 100644 index 000000000..72a681b8e --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/plugin.xml @@ -0,0 +1,168 @@ + + + + + Device + Cordova Device Plugin + Apache 2.0 + cordova,device + https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git + https://issues.apache.org/jira/browse/CB/component/12320648 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + read_device_identifying_information + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cordova/plugins/org.apache.cordova.device/src/android/Device.java b/cordova/plugins/org.apache.cordova.device/src/android/Device.java new file mode 100644 index 000000000..ad9002baf --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/android/Device.java @@ -0,0 +1,156 @@ +/* + 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.device; + +import java.util.TimeZone; + +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CordovaInterface; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import android.provider.Settings; + +public class Device extends CordovaPlugin { + public static final String TAG = "Device"; + + public static String platform; // Device OS + public static String uuid; // Device UUID + + private static final String ANDROID_PLATFORM = "Android"; + private static final String AMAZON_PLATFORM = "amazon-fireos"; + private static final String AMAZON_DEVICE = "Amazon"; + + /** + * Constructor. + */ + public Device() { + } + + /** + * Sets the context of the Command. This can then be used to do things like + * get file paths associated with the Activity. + * + * @param cordova The context of the main Activity. + * @param webView The CordovaWebView Cordova is running in. + */ + public void initialize(CordovaInterface cordova, CordovaWebView webView) { + super.initialize(cordova, webView); + Device.uuid = getUuid(); + } + + /** + * Executes the request and returns PluginResult. + * + * @param action The action to execute. + * @param args JSONArry of arguments for the plugin. + * @param callbackContext The callback id used when calling back into JavaScript. + * @return True if the action was valid, false if not. + */ + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { + if (action.equals("getDeviceInfo")) { + JSONObject r = new JSONObject(); + r.put("uuid", Device.uuid); + r.put("version", this.getOSVersion()); + r.put("platform", this.getPlatform()); + r.put("model", this.getModel()); + callbackContext.success(r); + } + else { + return false; + } + return true; + } + + //-------------------------------------------------------------------------- + // LOCAL METHODS + //-------------------------------------------------------------------------- + + /** + * Get the OS name. + * + * @return + */ + public String getPlatform() { + String platform; + if (isAmazonDevice()) { + platform = AMAZON_PLATFORM; + } else { + platform = ANDROID_PLATFORM; + } + return platform; + } + + /** + * Get the device's Universally Unique Identifier (UUID). + * + * @return + */ + public String getUuid() { + String uuid = Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); + return uuid; + } + + public String getModel() { + String model = android.os.Build.MODEL; + return model; + } + + public String getProductName() { + String productname = android.os.Build.PRODUCT; + return productname; + } + + /** + * Get the OS version. + * + * @return + */ + public String getOSVersion() { + String osversion = android.os.Build.VERSION.RELEASE; + return osversion; + } + + public String getSDKVersion() { + @SuppressWarnings("deprecation") + String sdkversion = android.os.Build.VERSION.SDK; + return sdkversion; + } + + public String getTimeZoneID() { + TimeZone tz = TimeZone.getDefault(); + return (tz.getID()); + } + + /** + * Function to check if the device is manufactured by Amazon + * + * @return + */ + public boolean isAmazonDevice() { + if (android.os.Build.MANUFACTURER.equals(AMAZON_DEVICE)) { + return true; + } + return false; + } + +} diff --git a/cordova/plugins/org.apache.cordova.device/src/blackberry10/index.js b/cordova/plugins/org.apache.cordova.device/src/blackberry10/index.js new file mode 100644 index 000000000..4d094922b --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/blackberry10/index.js @@ -0,0 +1,68 @@ +/* + * + * 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 getModelName () { + var modelName = window.qnx.webplatform.device.modelName; + //Pre 10.2 (meaning Z10 or Q10) + if (typeof modelName === "undefined") { + if (window.screen.height === 720 && window.screen.width === 720) { + if ( window.matchMedia("(-blackberry-display-technology: -blackberry-display-oled)").matches) { + modelName = "Q10"; + } else { + modelName = "Q5"; + } + } else if ((window.screen.height === 1280 && window.screen.width === 768) || + (window.screen.height === 768 && window.screen.width === 1280)) { + modelName = "Z10"; + } else { + modelName = window.qnx.webplatform.deviceName; + } + } + + return modelName; +} + +function getUUID () { + var uuid = ""; + try { + //Must surround by try catch because this will throw if the app is missing permissions + uuid = window.qnx.webplatform.device.devicePin; + } catch (e) { + //DO Nothing + } + return uuid; +} + +module.exports = { + getDeviceInfo: function (success, fail, args, env) { + var result = new PluginResult(args, env), + modelName = getModelName(), + uuid = getUUID(), + info = { + platform: "blackberry10", + version: window.qnx.webplatform.device.scmBundle, + model: modelName, + uuid: uuid + }; + + result.ok(info); + } +}; diff --git a/cordova/plugins/org.apache.cordova.device/src/browser/DeviceProxy.js b/cordova/plugins/org.apache.cordova.device/src/browser/DeviceProxy.js new file mode 100644 index 000000000..45e1d88fb --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/browser/DeviceProxy.js @@ -0,0 +1,78 @@ +/* + * + * 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 browser = require('cordova/platform'); +var cordova = require('cordova'); + +function getPlatform() { + return navigator.platform; +} + +function getModel() { + return getBrowserInfo(true); +} + +function getVersion() { + return getBrowserInfo(false); +} + +function getBrowserInfo(getModel) { + var userAgent = navigator.userAgent; + var returnVal; + + if ((offset = userAgent.indexOf('Chrome')) !== -1) { + returnVal = (getModel) ? 'Chrome' : userAgent.substring(offset + 7); + } else if ((offset = userAgent.indexOf('Safari')) !== -1) { + if (getModel) { + returnVal = 'Safari'; + } else { + returnVal = userAgent.substring(offset + 7); + + if ((offset = userAgent.indexOf('Version')) !== -1) { + returnVal = userAgent.substring(offset + 8); + } + } + } else if ((offset = userAgent.indexOf('Firefox')) !== -1) { + returnVal = (getModel) ? 'Firefox' : userAgent.substring(offset + 8); + } + + if ((offset = returnVal.indexOf(';')) !== -1 || (offset = returnVal.indexOf(' ')) !== -1) { + returnVal = returnVal.substring(0, offset); + } + + return returnVal; +} + + +module.exports = { + getDeviceInfo: function (success, error) { + setTimeout(function () { + success({ + cordova: browser.cordovaVersion, + platform: getPlatform(), + model: getModel(), + version: getVersion(), + uuid: null + }); + }, 0); + } +}; + +require("cordova/exec/proxy").add("Device", module.exports); diff --git a/cordova/plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.js b/cordova/plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.js new file mode 100644 index 000000000..79f3a2b07 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.js @@ -0,0 +1,79 @@ +/* + * + * 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. + * + */ +//example UA String for Firefox OS +//Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0 +var firefoxos = require('cordova/platform'); +var cordova = require('cordova'); + +//UA parsing not recommended but currently this is the only way to get the Firefox OS version +//https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference + +//Should be replaced when better conversion to Firefox OS Version is available +function convertVersionNumber(ver) { + var hashVersion = { + '18.0': '1.0.1', + '18.1': '1.1', + '26.0': '1.2', + '28.0': '1.3', + '30.0': '1.4', + '32.0': '2.0' + }; + var rver = ver; + var sStr = ver.substring(0, 4); + if (hashVersion[sStr]) { + rver = hashVersion[sStr]; + } + return (rver); + +} +function getVersion() { + if (navigator.userAgent.match(/(mobile|tablet)/i)) { + var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/)); + if (ffVersionArray.length === 2) { + return (convertVersionNumber(ffVersionArray[1])); + } + } + return (null); +} + +function getModel() { + var uaArray = navigator.userAgent.split(/\s*[;)(]\s*/); + if (navigator.userAgent.match(/(mobile|tablet)/i)) { + if (uaArray.length === 5) { + return (uaArray[2]); + } + } + return (null); +} +module.exports = { + getDeviceInfo: function (success, error) { + setTimeout(function () { + success({ + platform: 'firefoxos', + model: getModel(), + version: getVersion(), + uuid: null + }); + }, 0); + } +}; + +require("cordova/exec/proxy").add("Device", module.exports); diff --git a/cordova/plugins/org.apache.cordova.device/src/ios/CDVDevice.h b/cordova/plugins/org.apache.cordova.device/src/ios/CDVDevice.h new file mode 100644 index 000000000..a146d8829 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/ios/CDVDevice.h @@ -0,0 +1,30 @@ +/* + 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 +#import + +@interface CDVDevice : CDVPlugin +{} + ++ (NSString*)cordovaVersion; + +- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command; + +@end diff --git a/cordova/plugins/org.apache.cordova.device/src/ios/CDVDevice.m b/cordova/plugins/org.apache.cordova.device/src/ios/CDVDevice.m new file mode 100644 index 000000000..7e18d92a2 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/ios/CDVDevice.m @@ -0,0 +1,90 @@ +/* + 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. + */ + +#include +#include + +#import +#import "CDVDevice.h" + +@implementation UIDevice (ModelVersion) + +- (NSString*)modelVersion +{ + size_t size; + + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char* machine = malloc(size); + sysctlbyname("hw.machine", machine, &size, NULL, 0); + NSString* platform = [NSString stringWithUTF8String:machine]; + free(machine); + + return platform; +} + +@end + +@interface CDVDevice () {} +@end + +@implementation CDVDevice + +- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command +{ + NSDictionary* deviceProperties = [self deviceProperties]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties]; + + /* Settings.plist + * Read the optional Settings.plist file and push these user-defined settings down into the web application. + * This can be useful for supplying build-time configuration variables down to the app to change its behavior, + * such as specifying Full / Lite version, or localization (English vs German, for instance). + */ + // TODO: turn this into an iOS only plugin + NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"]; + + if ([temp respondsToSelector:@selector(JSONString)]) { + NSLog(@"Deprecation warning: window.Setting will be removed Aug 2013. Refer to https://issues.apache.org/jira/browse/CB-2433"); + NSString* js = [NSString stringWithFormat:@"window.Settings = %@;", [temp JSONString]]; + [self.commandDelegate evalJs:js]; + } + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +- (NSDictionary*)deviceProperties +{ + UIDevice* device = [UIDevice currentDevice]; + NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4]; + + [devProps setObject:[device modelVersion] forKey:@"model"]; + [devProps setObject:@"iOS" forKey:@"platform"]; + [devProps setObject:[device systemVersion] forKey:@"version"]; + [devProps setObject:[device uniqueAppInstanceIdentifier] forKey:@"uuid"]; + [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"]; + + NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps]; + return devReturn; +} + ++ (NSString*)cordovaVersion +{ + return CDV_VERSION; +} + +@end diff --git a/cordova/plugins/org.apache.cordova.device/src/tizen/DeviceProxy.js b/cordova/plugins/org.apache.cordova.device/src/tizen/DeviceProxy.js new file mode 100644 index 000000000..2afc3243a --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/tizen/DeviceProxy.js @@ -0,0 +1,39 @@ +/* + * + * 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 tizen = require('cordova/platform'); +var cordova = require('cordova'); + +module.exports = { + getDeviceInfo: function(success, error) { + setTimeout(function () { + success({ + cordova: tizen.cordovaVersion, + platform: 'tizen', + model: null, + version: null, + uuid: null + }); + }, 0); + } +}; + +require("cordova/tizen/commandProxy").add("Device", module.exports); diff --git a/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.cpp b/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.cpp new file mode 100644 index 000000000..eb5a012d9 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.cpp @@ -0,0 +1,64 @@ +/* + * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ + * + * 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 +#include + +#include"device.h" + +#define CORDOVA "3.0.0" + +Device::Device(Cordova *cordova) : CPlugin(cordova) { +} + +static QString getOSName() { +#ifdef Q_OS_SYMBIAN + QString platform = "Symbian"; +#endif +#ifdef Q_OS_WIN + QString platform = "Windows"; +#endif +#ifdef Q_OS_WINCE + QString platform = "Windows CE"; +#endif +#ifdef Q_OS_LINUX + QString platform = "Linux"; +#endif + return platform; +} + +void Device::getInfo(int scId, int ecId) { + Q_UNUSED(ecId) + + QDeviceInfo systemDeviceInfo; + QDeviceInfo systemInfo; + + QString platform = getOSName(); + + QString uuid = systemDeviceInfo.uniqueDeviceID(); + if (uuid.isEmpty()) { + QString deviceDescription = systemInfo.imei(0) + ";" + systemInfo.manufacturer() + ";" + systemInfo.model() + ";" + systemInfo.productName() + ";" + platform; + QString user = qgetenv("USER"); + if (user.isEmpty()) { + user = qgetenv("USERNAME"); + if (user.isEmpty()) + user = QDir::homePath(); + } + uuid = QString(QCryptographicHash::hash((deviceDescription + ";" + user).toUtf8(), QCryptographicHash::Md5).toHex()); + } + + this->cb(scId, systemDeviceInfo.model(), CORDOVA, platform, uuid, systemInfo.version(QDeviceInfo::Os)); +} diff --git a/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.h b/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.h new file mode 100644 index 000000000..91cb93770 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.h @@ -0,0 +1,47 @@ +/* + * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ + * + * 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 DEVICE_H_FDSAFAS +#define DEVICE_H_FDSAFAS + +#include + +#include + +class Device: public CPlugin { + Q_OBJECT +public: + explicit Device(Cordova *cordova); + + virtual const QString fullName() override { + return Device::fullID(); + } + + virtual const QString shortName() override { + return "Device"; + } + + static const QString fullID() { + return "com.cordova.Device"; + } + +signals: + +public slots: + void getInfo(int scId, int ecId); +}; + +#endif diff --git a/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.js b/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.js new file mode 100644 index 000000000..3adb110b0 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/ubuntu/device.js @@ -0,0 +1,34 @@ +/* + * + * 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 cordova = require('cordova'); +var exec = require('cordova/exec'); + +module.exports = { + getInfo:function(win,fail,args) { + Cordova.exec(function (model, cordova, platform, uuid, version) { + win({name: name, model: model, cordova: cordova, + platform: platform, uuid: uuid, version: version}); + }, null, "com.cordova.Device", "getInfo", []); + } +}; + +require("cordova/exec/proxy").add("Device", module.exports); diff --git a/cordova/plugins/org.apache.cordova.device/src/windows/DeviceProxy.js b/cordova/plugins/org.apache.cordova.device/src/windows/DeviceProxy.js new file mode 100644 index 000000000..5c81a8614 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/windows/DeviceProxy.js @@ -0,0 +1,80 @@ +/* + * + * 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 = { + + getDeviceInfo:function(win, fail, args) { + + // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId + var deviceId; + var localSettings = Windows.Storage.ApplicationData.current.localSettings; + if (localSettings.values.deviceId) { + deviceId = localSettings.values.deviceId; + } + else { + // App-specific hardware id could be used as uuid, but it changes if the hardware changes... + try { + var ASHWID = Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(null).id; + deviceId = Windows.Storage.Streams.DataReader.fromBuffer(ASHWID).readGuid(); + } catch (e) { + // Couldn't get the hardware UUID + deviceId = createUUID(); + } + //...so cache it per-install + localSettings.values.deviceId = deviceId; + } + + var userAgent = window.clientInformation.userAgent, + // this will report "windows" in windows8.1 and windows phone 8.1 apps + // and "windows8" in windows 8.0 apps similar to cordova.js + // See https://github.com/apache/cordova-js/blob/master/src/windows/platform.js#L25 + devicePlatform = userAgent.indexOf("MSAppHost/1.0") == -1 ? "windows" : "windows8", + versionString = userAgent.match(/Windows (?:Phone |NT )?([0-9.]+)/)[1]; + + var ROOT_CONTAINER = "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}"; + var DEVICE_CLASS_KEY = "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10"; + var DEVICE_CLASS_KEY_NO_SEMICOLON = '{A45C254E-DF1C-4EFD-8020-67D146A850E0}10'; + var ROOT_CONTAINER_QUERY = "System.Devices.ContainerId:=\"" + ROOT_CONTAINER + "\""; + var HAL_DEVICE_CLASS = "4d36e966-e325-11ce-bfc1-08002be10318"; + var DEVICE_DRIVER_VERSION_KEY = "{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3"; + var pnpObject = Windows.Devices.Enumeration.Pnp.PnpObject; + pnpObject.findAllAsync(Windows.Devices.Enumeration.Pnp.PnpObjectType.device, + [DEVICE_DRIVER_VERSION_KEY, DEVICE_CLASS_KEY], ROOT_CONTAINER_QUERY) + .then(function(rootDevices) { + for (var i = 0; i < rootDevices.length; i++) { + var rootDevice = rootDevices[i]; + if (!rootDevice.properties) continue; + if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] == HAL_DEVICE_CLASS) { + versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY]; + break; + } + } + + setTimeout(function () { + win({ platform: devicePlatform, version: versionString, + uuid: deviceId, model: window.clientInformation.platform }); + }, 0); + }); + } + +}; + +require("cordova/exec/proxy").add("Device", module.exports); diff --git a/cordova/plugins/org.apache.cordova.device/src/windows8/DeviceProxy.js b/cordova/plugins/org.apache.cordova.device/src/windows8/DeviceProxy.js new file mode 100644 index 000000000..3ddc9b2b3 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/windows8/DeviceProxy.js @@ -0,0 +1,82 @@ +/* + * + * 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 cordova = require('cordova'); +var utils = require('cordova/utils'); + +module.exports = { + + getDeviceInfo:function(win,fail,args) { + + // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId + var deviceId; + + var localSettings = Windows.Storage.ApplicationData.current.localSettings; + + if (localSettings.values.deviceId) { + deviceId = localSettings.values.deviceId; + } + else { + // App-specific hardware id could be used as uuid, but it changes if the hardware changes... + try { + var ASHWID = Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(null).id; + deviceId = Windows.Storage.Streams.DataReader.fromBuffer(ASHWID).readGuid(); + } catch (e) { + // Couldn't get the hardware UUID + deviceId = createUUID(); + } + //...so cache it per-install + localSettings.values.deviceId = deviceId; + } + + var versionString = window.clientInformation.userAgent.match(/Windows NT ([0-9.]+)/)[1]; + + (function(self){ + var ROOT_CONTAINER = "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}"; + var DEVICE_CLASS_KEY = "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10"; + var DEVICE_CLASS_KEY_NO_SEMICOLON = '{A45C254E-DF1C-4EFD-8020-67D146A850E0}10'; + var ROOT_CONTAINER_QUERY = "System.Devices.ContainerId:=\"" + ROOT_CONTAINER + "\""; + var HAL_DEVICE_CLASS = "4d36e966-e325-11ce-bfc1-08002be10318"; + var DEVICE_DRIVER_VERSION_KEY = "{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3"; + var pnpObject = Windows.Devices.Enumeration.Pnp.PnpObject; + pnpObject.findAllAsync(Windows.Devices.Enumeration.Pnp.PnpObjectType.device, [DEVICE_DRIVER_VERSION_KEY, DEVICE_CLASS_KEY], ROOT_CONTAINER_QUERY).then(function(rootDevices) { + + for (var i = 0; i < rootDevices.length; i++) { + var rootDevice = rootDevices[i]; + if (!rootDevice.properties) continue; + if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] == HAL_DEVICE_CLASS) { + versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY]; + break; + } + } + + setTimeout(function () { + win({ platform: "windows8", version: versionString, uuid: deviceId, model: window.clientInformation.platform }); + }, 0); + }); + })(this); + } + +}; + +require("cordova/exec/proxy").add("Device", module.exports); + diff --git a/cordova/plugins/org.apache.cordova.device/src/wp/Device.cs b/cordova/plugins/org.apache.cordova.device/src/wp/Device.cs new file mode 100644 index 000000000..b8a804580 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/src/wp/Device.cs @@ -0,0 +1,123 @@ +/* + 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.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Ink; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; +using System.Windows.Shapes; +using Microsoft.Phone.Info; +using System.IO.IsolatedStorage; +using System.Windows.Resources; +using System.IO; +using System.Diagnostics; + +namespace WPCordovaClassLib.Cordova.Commands +{ + public class Device : BaseCommand + { + public void getDeviceInfo(string notused) + { + + string res = String.Format("\"name\":\"{0}\",\"platform\":\"{1}\",\"uuid\":\"{2}\",\"version\":\"{3}\",\"model\":\"{4}\"", + this.name, + this.platform, + this.uuid, + this.version, + this.model); + + res = "{" + res + "}"; + //Debug.WriteLine("Result::" + res); + DispatchCommandResult(new PluginResult(PluginResult.Status.OK, res)); + } + + public string model + { + get + { + return DeviceStatus.DeviceName; + //return String.Format("{0},{1},{2}", DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceHardwareVersion, DeviceStatus.DeviceFirmwareVersion); + } + } + + public string name + { + get + { + return DeviceStatus.DeviceName; + + } + } + + public string platform + { + get + { + return Environment.OSVersion.Platform.ToString(); + } + } + + public string uuid + { + get + { + string returnVal = ""; + object id; + UserExtendedProperties.TryGetValue("ANID", out id); + + if (id != null) + { + returnVal = id.ToString().Substring(2, 32); + } + else + { + returnVal = "???unknown???"; + + using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication()) + { + try + { + IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Open, FileAccess.Read, appStorage); + + using (StreamReader reader = new StreamReader(fileStream)) + { + returnVal = reader.ReadLine(); + } + } + catch (Exception /*ex*/) + { + + } + } + } + + return returnVal; + } + } + + public string version + { + get + { + return Environment.OSVersion.Version.ToString(); + } + } + + } +} diff --git a/cordova/plugins/org.apache.cordova.device/tests/plugin.xml b/cordova/plugins/org.apache.cordova.device/tests/plugin.xml new file mode 100644 index 000000000..be4e4893a --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/tests/plugin.xml @@ -0,0 +1,31 @@ + + + + + Cordova Device Plugin Tests + Apache 2.0 + + + + diff --git a/cordova/plugins/org.apache.cordova.device/tests/tests.js b/cordova/plugins/org.apache.cordova.device/tests/tests.js new file mode 100644 index 000000000..f7c30ef36 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/tests/tests.js @@ -0,0 +1,94 @@ +/* + * + * 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. + * +*/ + +exports.defineAutoTests = function() { + describe('Device Information (window.device)', function () { + it("should exist", function() { + expect(window.device).toBeDefined(); + }); + + it("should contain a platform specification that is a string", function() { + expect(window.device.platform).toBeDefined(); + expect((new String(window.device.platform)).length > 0).toBe(true); + }); + + it("should contain a version specification that is a string", function() { + expect(window.device.version).toBeDefined(); + expect((new String(window.device.version)).length > 0).toBe(true); + }); + + it("should contain a UUID specification that is a string or a number", function() { + expect(window.device.uuid).toBeDefined(); + if (typeof window.device.uuid == 'string' || typeof window.device.uuid == 'object') { + expect((new String(window.device.uuid)).length > 0).toBe(true); + } else { + expect(window.device.uuid > 0).toBe(true); + } + }); + + it("should contain a cordova specification that is a string", function() { + expect(window.device.cordova).toBeDefined(); + expect((new String(window.device.cordova)).length > 0).toBe(true); + }); + + it("should depend on the precense of cordova.version string", function() { + expect(window.cordova.version).toBeDefined(); + expect((new String(window.cordova.version)).length > 0).toBe(true); + }); + + it("should contain device.cordova equal to cordova.version", function() { + expect(window.device.cordova).toBe(window.cordova.version); + }); + + it("should contain a model specification that is a string", function() { + expect(window.device.model).toBeDefined(); + expect((new String(window.device.model)).length > 0).toBe(true); + }); + }); +}; + +exports.defineManualTests = function(contentEl, createActionButton) { + var logMessage = function (message, color) { + var log = document.getElementById('info'); + var logLine = document.createElement('div'); + if (color) { + logLine.style.color = color; + } + logLine.innerHTML = message; + log.appendChild(logLine); + } + + var clearLog = function () { + var log = document.getElementById('info'); + log.innerHTML = ''; + } + + var device_tests = '

Press Dump Device button to get device information

' + + '
' + + 'Expected result: Status box will get updated with device info. (i.e. platform, version, uuid, model, etc)'; + + contentEl.innerHTML = '
' + device_tests; + + createActionButton('Dump device', function() { + clearLog(); + logMessage(JSON.stringify(window.device, null, '\t')); + }, "dump_device"); +}; diff --git a/cordova/plugins/org.apache.cordova.device/www/device.js b/cordova/plugins/org.apache.cordova.device/www/device.js new file mode 100644 index 000000000..05f4c4741 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.device/www/device.js @@ -0,0 +1,77 @@ +/* + * + * 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 argscheck = require('cordova/argscheck'), + channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'), + cordova = require('cordova'); + +channel.createSticky('onCordovaInfoReady'); +// Tell cordova channel to wait on the CordovaInfoReady event +channel.waitForInitialization('onCordovaInfoReady'); + +/** + * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the + * phone, etc. + * @constructor + */ +function Device() { + this.available = false; + this.platform = null; + this.version = null; + this.uuid = null; + this.cordova = null; + this.model = null; + + var me = this; + + channel.onCordovaReady.subscribe(function() { + me.getInfo(function(info) { + //ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js + //TODO: CB-5105 native implementations should not return info.cordova + var buildLabel = cordova.version; + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.uuid = info.uuid; + me.cordova = buildLabel; + me.model = info.model; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); + }); +} + +/** + * Get device info + * + * @param {Function} successCallback The function to call when the heading data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) + */ +Device.prototype.getInfo = function(successCallback, errorCallback) { + argscheck.checkArgs('fF', 'Device.getInfo', arguments); + exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); +}; + +module.exports = new Device(); diff --git a/cordova/plugins/org.apache.cordova.dialogs/.fetch.json b/cordova/plugins/org.apache.cordova.dialogs/.fetch.json new file mode 100644 index 000000000..0a08cd6a3 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/.fetch.json @@ -0,0 +1 @@ +{"source":{"type":"registry","id":"org.apache.cordova.dialogs"}} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/.npmignore b/cordova/plugins/org.apache.cordova.dialogs/.npmignore new file mode 100644 index 000000000..52b558e40 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/.npmignore @@ -0,0 +1,23 @@ +#If ignorance is bliss, then somebody knock the smile off my face + +*.csproj.user +*.suo +*.cache +Thumbs.db +*.DS_Store + +*.bak +*.cache +*.log +*.swp +*.user + + + + + + + + + + \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/CONTRIBUTING.md b/cordova/plugins/org.apache.cordova.dialogs/CONTRIBUTING.md new file mode 100644 index 000000000..f7dbcaba7 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/CONTRIBUTING.md @@ -0,0 +1,37 @@ + + +# Contributing to Apache Cordova + +Anyone can contribute to Cordova. And we need your contributions. + +There are multiple ways to contribute: report bugs, improve the docs, and +contribute code. + +For instructions on this, start with the +[contribution overview](http://cordova.apache.org/#contribute). + +The details are explained there, but the important items are: + - Sign and submit an Apache ICLA (Contributor License Agreement). + - Have a Jira issue open that corresponds to your contribution. + - Run the tests so your patch doesn't break existing functionality. + +We look forward to your contributions! diff --git a/cordova/plugins/org.apache.cordova.dialogs/LICENSE b/cordova/plugins/org.apache.cordova.dialogs/LICENSE new file mode 100644 index 000000000..7a4a3ea24 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/LICENSE @@ -0,0 +1,202 @@ + + 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/cordova/plugins/org.apache.cordova.dialogs/NOTICE b/cordova/plugins/org.apache.cordova.dialogs/NOTICE new file mode 100644 index 000000000..8ec56a524 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/NOTICE @@ -0,0 +1,5 @@ +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/cordova/plugins/org.apache.cordova.dialogs/README.md b/cordova/plugins/org.apache.cordova.dialogs/README.md new file mode 100644 index 000000000..8fa5da43c --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/README.md @@ -0,0 +1,22 @@ + + +# org.apache.cordova.dialogs + +Plugin documentation: [doc/index.md](doc/index.md) diff --git a/cordova/plugins/org.apache.cordova.dialogs/RELEASENOTES.md b/cordova/plugins/org.apache.cordova.dialogs/RELEASENOTES.md new file mode 100644 index 000000000..673d15c74 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/RELEASENOTES.md @@ -0,0 +1,97 @@ + +# 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 + +### 0.2.8 (Jun 05, 2014) +* CB-6801 Add license +* running original windows.open, inAppBrowser is overriding it no need to place CSS in every page anymore +* CB-5945 [Windows8] do not call success callbacks until dialog is dismissed +* CB-4616 Returned index 0 was not documented for notification.prompt +* update docs to state that prompt is supported on windowsphone +* CB-6528 allow scroll on alert message content +* [CB-6628][amazon-fireos]dialogs plugin's confirm and prompt methods dont work confirm() method was missing amazon-fireos platform check. added that. prompt() method had bug. It is executed in a worker thread that does not have a message queue(or Looper object) associated with it and hence "can't create a handler" exception is thrown. To fix this issue, we need to create the EditText widget from within the UI thread. This was fixed sometime ago when we added fireos platform but commit got lost somewhere. So fixing it again now. +* CB-6491 add CONTRIBUTING.md +* Added check for isFinishing() on the parent activity to prevent crashes when trying to display dialogs when activity is in this phase of it's lifecycle +* CB-4966 Dialogs are in window now No need to add anything to manifest or index.html +* Removing FirefoxOS Quirks * no need to add special permission (it's different API with the same name) * notification.css is added automatically + +### 0.2.9 (Aug 06, 2014) +* ubuntu: pass proper arguments to prompt callback +* ubuntu: use TextField instead of TextInput +* ubuntu: proper message escaping before passing to qml +* **FFOS** update notification.js +* CB-6127 Updated translations for docs +* android: Explicitly apply default theme to dialogs +* Fix Beep exception on Android when no argument passed + +### 0.2.10 (Sep 17, 2014) +* CB-7538 Android beep thread fix Beep now executes in it's own thread. It was previously executing in the main UI thread which was causing the application to lock up will the beep was occurring. Closing pull request +* Set dialog text dir to locale +* Renamed test dir, added nested plugin.xml +* added documentation for manual tests +* CB-6965 Added manual tests +* CB-6965 Port notification tests to test-framework diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/de/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/de/index.md new file mode 100644 index 000000000..5b630f6a1 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/de/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +Dieses Plugin ermöglicht den Zugriff auf einige native Dialog-UI-Elemente. + +## Installation + + cordova plugin add org.apache.cordova.dialogs + + +## Methoden + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +Zeigt eine benutzerdefinierte Warnung oder Dialogfeld Feld. Die meisten Implementierungen von Cordova ein native Dialogfeld für dieses Feature verwenden, aber einige Plattformen des Browsers `alert` Funktion, die in der Regel weniger anpassbar ist. + + Navigator.Notification.Alert (Message, AlertCallback, [Titel], [ButtonName]) + + +* **Nachricht**: Dialogfeld Nachricht. *(String)* + +* **AlertCallback**: Callback aufgerufen wird, wenn Warnungs-Dialogfeld geschlossen wird. *(Funktion)* + +* **Titel**: Dialog "Titel". *(String)* (Optional, Standard ist`Alert`) + +* **ButtonName**: Name der Schaltfläche. *(String)* (Optional, Standard ist`OK`) + +### Beispiel + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Windows Phone 7 und 8 Macken + +* Es gibt keine eingebaute Datenbanksuchroutine-Warnung, aber Sie können binden, wie folgt zu nennen `alert()` im globalen Gültigkeitsbereich: + + window.alert = navigator.notification.alert; + + +* Beide `alert` und `confirm` sind nicht blockierende Aufrufe, die Ergebnisse davon nur asynchron sind. + +### Firefox OS Macken: + +Beide Native blockierenden `window.alert()` und nicht-blockierende `navigator.notification.alert()` stehen zur Verfügung. + +## navigator.notification.confirm + +Zeigt das Dialogfeld anpassbare Bestätigung. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **Nachricht**: Dialogfeld Nachricht. *(String)* + +* **ConfirmCallback**: Callback aufgerufen wird, mit Index gedrückt (1, 2 oder 3) oder wenn das Dialogfeld geschlossen wird, ohne einen Tastendruck (0). *(Funktion)* + +* **Titel**: Dialog "Titel". *(String)* (Optional, Standard ist`Confirm`) + +* **ButtonLabels**: Array von Zeichenfolgen, die Schaltflächenbezeichnungen angeben. *(Array)* (Optional, Standard ist [ `OK,Cancel` ]) + +### confirmCallback + +Die `confirmCallback` wird ausgeführt, wenn der Benutzer eine der Schaltflächen im Dialogfeld zur Bestätigung drückt. + +Der Rückruf dauert das Argument `buttonIndex` *(Anzahl)*, die der Index der Schaltfläche gedrückt ist. Beachten Sie, dass der Index 1-basierte Indizierung, verwendet, sodass der Wert ist `1` , `2` , `3` , etc.. + +### Beispiel + + 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 + ); + + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Windows Phone 7 und 8 Macken + +* Es gibt keine integrierte Browser-Funktion für `window.confirm` , aber Sie können es binden, indem Sie zuweisen: + + window.confirm = navigator.notification.confirm; + + +* Aufrufe von `alert` und `confirm` sind nicht blockierend, so dass das Ergebnis nur asynchron zur Verfügung steht. + +### Firefox OS Macken: + +Beide Native blockierenden `window.confirm()` und nicht-blockierende `navigator.notification.confirm()` stehen zur Verfügung. + +## navigator.notification.prompt + +Zeigt eine native Dialogfeld, das mehr als des Browsers anpassbar ist `prompt` Funktion. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **Nachricht**: Dialogfeld Nachricht. *(String)* + +* **PromptCallback**: Callback aufgerufen wird, mit Index gedrückt (1, 2 oder 3) oder wenn das Dialogfeld geschlossen wird, ohne einen Tastendruck (0). *(Funktion)* + +* **Titel**: Dialog Title *(String)* (Optional, Standard ist`Prompt`) + +* **ButtonLabels**: Array von Zeichenfolgen angeben Schaltfläche Etiketten *(Array)* (Optional, Standard ist`["OK","Cancel"]`) + +* **DefaultText**: Standard-Textbox Eingabewert ( `String` ) (Optional, Standard: leere Zeichenfolge) + +### promptCallback + +Die `promptCallback` wird ausgeführt, wenn der Benutzer eine der Schaltflächen im Eingabedialogfeld drückt. Die `results` an den Rückruf übergebene Objekt enthält die folgenden Eigenschaften: + +* **ButtonIndex**: der Index der Schaltfläche gedrückt. *(Anzahl)* Beachten Sie, dass der Index 1-basierte Indizierung, verwendet, sodass der Wert ist `1` , `2` , `3` , etc.. + +* **Eingang1**: in Eingabedialogfeld eingegebenen Text. *(String)* + +### Beispiel + + 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 + ); + + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* Firefox OS +* iOS +* Windows Phone 7 und 8 + +### Android Macken + +* Android unterstützt maximal drei Schaltflächen und mehr als das ignoriert. + +* Auf Android 3.0 und höher, werden die Schaltflächen in umgekehrter Reihenfolge für Geräte angezeigt, die das Holo-Design verwenden. + +### Firefox OS Macken: + +Beide Native blockierenden `window.prompt()` und nicht-blockierende `navigator.notification.prompt()` stehen zur Verfügung. + +## navigator.notification.beep + +Das Gerät spielt einen Signalton sound. + + navigator.notification.beep(times); + + +* **Zeiten**: die Anzahl der Wiederholungen des Signaltons. *(Anzahl)* + +### Beispiel + + // Beep twice! + navigator.notification.beep(2); + + +### Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 und 8 +* Windows 8 + +### Amazon Fire OS Macken + +* Amazon Fire OS spielt die Standardeinstellung **Akustische Benachrichtigung** unter **Einstellungen/Display & Sound** Bereich angegeben. + +### Android Macken + +* Android spielt die Standardeinstellung **Benachrichtigung Klingelton** unter **Einstellungen/Sound & Display** -Panel angegeben. + +### Windows Phone 7 und 8 Macken + +* Stützt sich auf eine generische Piepton-Datei aus der Cordova-Distribution. + +### Tizen Macken + +* Tizen implementiert Signaltöne durch Abspielen einer Audiodatei über die Medien API. + +* Die Beep-Datei muss kurz sein, befinden muss einem `sounds` Unterverzeichnis des Stammverzeichnisses der Anwendung, und muss den Namen`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/es/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/es/index.md new file mode 100644 index 000000000..3ccb5f7af --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/es/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +Este plugin proporciona acceso a algunos elementos de la interfaz nativa de diálogo. + +## Instalación + + cordova plugin add org.apache.cordova.dialogs + + +## Métodos + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +Muestra un cuadro de alerta o cuadro de diálogo personalizado. La mayoría de las implementaciones de Cordova utilizan un cuadro de diálogo nativa para esta característica, pero algunas plataformas utilizan el navegador `alert` la función, que es típicamente menos personalizable. + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **mensaje**: mensaje de diálogo. *(String)* + +* **alertCallback**: Callback para invocar al diálogo de alerta es desestimada. *(Función)* + +* **título**: título de diálogo. *(String)* (Opcional, por defecto`Alert`) + +* **buttonName**: nombre del botón. *(String)* (Opcional, por defecto`OK`) + +### Ejemplo + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Windows Phone 7 y 8 rarezas + +* No hay ninguna alerta del navegador integrado, pero puede enlazar uno proceda a llamar a `alert()` en el ámbito global: + + window.alert = navigator.notification.alert; + + +* Ambos `alert` y `confirm` son no-bloqueo llamadas, cuyos resultados sólo están disponibles de forma asincrónica. + +### Firefox OS rarezas: + +Dos nativos de bloqueo `window.alert()` y no-bloqueo `navigator.notification.alert()` están disponibles. + +## navigator.notification.confirm + +Muestra un cuadro de diálogo de confirmación personalizables. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **mensaje**: mensaje de diálogo. *(String)* + +* **confirmCallback**: Callback para invocar con índice del botón pulsado (1, 2 ó 3) o cuando el cuadro de diálogo es despedido sin la presión del botón (0). *(Función)* + +* **título**: título de diálogo. *(String)* (Opcional, por defecto`Confirm`) + +* **buttonLabels**: matriz de cadenas especificando las etiquetas de botón. *(Matriz)* (Opcional, por defecto [ `OK,Cancel` ]) + +### confirmCallback + +El `confirmCallback` se ejecuta cuando el usuario presiona uno de los botones en el cuadro de diálogo de confirmación. + +La devolución de llamada toma el argumento `buttonIndex` *(número)*, que es el índice del botón presionado. Observe que el índice utiliza indexación basada en uno, entonces el valor es `1` , `2` , `3` , etc.. + +### Ejemplo + + 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 + ); + + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Windows Phone 7 y 8 rarezas + +* No hay ninguna función de navegador incorporado para `window.confirm` , pero lo puede enlazar mediante la asignación: + + window.confirm = navigator.notification.confirm; + + +* Llama a `alert` y `confirm` son no-bloqueo, así que el resultado sólo está disponible de forma asincrónica. + +### Firefox OS rarezas: + +Dos nativos de bloqueo `window.confirm()` y no-bloqueo `navigator.notification.confirm()` están disponibles. + +## navigator.notification.prompt + +Muestra un cuadro de diálogo nativa que es más personalizable que del navegador `prompt` función. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **mensaje**: mensaje de diálogo. *(String)* + +* **promptCallback**: Callback para invocar con índice del botón pulsado (1, 2 ó 3) o cuando el cuadro de diálogo es despedido sin la presión del botón (0). *(Función)* + +* **título**: título *(String)* (opcional, por defecto de diálogo`Prompt`) + +* **buttonLabels**: matriz de cadenas especificando botón etiquetas *(Array)* (opcional, por defecto`["OK","Cancel"]`) + +* **defaultText**: valor de la entrada predeterminada textbox ( `String` ) (opcional, por defecto: cadena vacía) + +### promptCallback + +El `promptCallback` se ejecuta cuando el usuario presiona uno de los botones del cuadro de diálogo pronto. El `results` objeto que se pasa a la devolución de llamada contiene las siguientes propiedades: + +* **buttonIndex**: el índice del botón presionado. *(Número)* Observe que el índice utiliza indexación basada en uno, entonces el valor es `1` , `2` , `3` , etc.. + +* **INPUT1**: el texto introducido en el cuadro de diálogo pronto. *(String)* + +### Ejemplo + + 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 + ); + + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* Firefox OS +* iOS +* Windows Phone 7 y 8 + +### Rarezas Android + +* Android soporta un máximo de tres botones e ignora nada más. + +* En Android 3.0 y posteriores, los botones aparecen en orden inverso para dispositivos que utilizan el tema Holo. + +### Firefox OS rarezas: + +Dos nativos de bloqueo `window.prompt()` y no-bloqueo `navigator.notification.prompt()` están disponibles. + +## navigator.notification.beep + +El aparato reproduce un sonido sonido. + + navigator.notification.beep(times); + + +* **tiempos**: el número de veces a repetir la señal. *(Número)* + +### Ejemplo + + // Beep twice! + navigator.notification.beep(2); + + +### Plataformas soportadas + +* Amazon fuego OS +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 y 8 +* Windows 8 + +### Amazon fuego OS rarezas + +* Amazon fuego OS reproduce el **Sonido de notificación** especificados en el panel de **configuración/pantalla y sonido** por defecto. + +### Rarezas Android + +* Androide reproduce el **tono de notificación** especificados en el panel **ajustes de sonido y visualización** por defecto. + +### Windows Phone 7 y 8 rarezas + +* Se basa en un archivo de sonido genérico de la distribución de Córdoba. + +### Rarezas Tizen + +* Tizen implementa pitidos por reproducir un archivo de audio a través de los medios de comunicación API. + +* El archivo de sonido debe ser corto, debe estar ubicado en un `sounds` subdirectorio del directorio raíz de la aplicación y deben ser nombrados`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/fr/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/fr/index.md new file mode 100644 index 000000000..5e4398a22 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/fr/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +Ce plugin permet d'accéder à certains éléments d'interface utilisateur native de dialogue. + +## Installation + + cordova plugin add org.apache.cordova.dialogs + + +## Méthodes + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +Affiche une boîte de dialogue ou d'alerte personnalisé. La plupart des implémentations de Cordova utilisent une boîte de dialogue natives pour cette fonctionnalité, mais certaines plates-formes du navigateur `alert` fonction, qui est généralement moins personnalisable. + + Navigator.notification.Alert (message, alertCallback, [titre], [buttonName]) + + +* **message**: message de la boîte de dialogue. *(String)* + +* **alertCallback**: callback à appeler lorsque la boîte de dialogue d'alerte est rejetée. *(Fonction)* + +* **titre**: titre de la boîte de dialogue. *(String)* (Facultatif, par défaut`Alert`) + +* **buttonName**: nom du bouton. *(String)* (Facultatif, par défaut`OK`) + +### Exemple + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 et 8 +* Windows 8 + +### Windows Phone 7 et 8 Quirks + +* Il n'y a aucune boîte de dialogue d'alerte intégrée au navigateur, mais vous pouvez en lier une pour appeler `alert()` dans le scope global: + + window.alert = navigator.notification.alert; + + +* Les deux appels `alert` et `confirm` sont non-blocants, leurs résultats ne sont disponibles que de façon asynchrone. + +### Firefox OS Quirks : + +Les deux indigènes bloquant `window.alert()` et non-bloquante `navigator.notification.alert()` sont disponibles. + +## navigator.notification.confirm + +Affiche une boîte de dialogue de confirmation personnalisable. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **message**: message de la boîte de dialogue. *(String)* + +* **confirmCallback**: callback à appeler avec l'index du bouton pressé (1, 2 ou 3) ou lorsque la boîte de dialogue est fermée sans qu'un bouton ne soit pressé (0). *(Fonction)* + +* **titre**: titre de dialogue. *(String)* (Facultatif, par défaut`Confirm`) + +* **buttonLabels**: tableau de chaînes spécifiant les étiquettes des boutons. *(Array)* (Optionnel, par défaut, [ `OK,Cancel` ]) + +### confirmCallback + +Le `confirmCallback` s'exécute lorsque l'utilisateur appuie sur un bouton dans la boîte de dialogue de confirmation. + +Le rappel prend l'argument `buttonIndex` *(nombre)*, qui est l'index du bouton activé. Notez que l'index utilise base d'indexation, la valeur est `1` , `2` , `3` , etc.. + +### Exemple + + 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 + ); + + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +### Windows Phone 7 et 8 Quirks + +* Il n'y a aucune fonction intégrée au navigateur pour `window.confirm`, mais vous pouvez en lier une en affectant: + + window.confirm = navigator.notification.confirm ; + + +* Les appels à `alert` et `confirm` sont non-bloquants, donc le résultat est seulement disponible de façon asynchrone. + +### Firefox OS Quirks : + +Les deux indigènes bloquant `window.confirm()` et non-bloquante `navigator.notification.confirm()` sont disponibles. + +## navigator.notification.prompt + +Affiche une boîte de dialogue natif qui est plus personnalisable que le navigateur `prompt` fonction. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **message**: message de la boîte de dialogue. *(String)* + +* **promptCallback**: rappel d'invoquer avec l'index du bouton pressé (1, 2 ou 3) ou lorsque la boîte de dialogue est fermée sans une presse de bouton (0). *(Fonction)* + +* **titre**: titre de la boîte de dialogue. *(String)* (Facultatif, par défaut`Alert`) + +* **buttonLabels**: tableau de chaînes spécifiant les étiquettes de boutons *(Array)* (facultatif, par défaut, les étiquettes `["OK","Cancel"]`) + +* **defaultText**: texte par défaut de la zone de texte ( `String` ) (en option, par défaut : chaîne vide) + +### promptCallback + +Le `promptCallback` s'exécute lorsque l'utilisateur appuie sur un bouton dans la boîte de dialogue d'invite. Le `results` objet passé au rappel contient les propriétés suivantes : + +* **buttonIndex**: l'index du bouton activé. *(Nombre)* Notez que l'index utilise une indexation de base 1, donc la valeur est `1` , `2` , `3` , etc. + +* **entrée 1**: le texte entré dans la boîte de dialogue d'invite. *(String)* + +### Exemple + + 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 + ); + + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* Firefox OS +* iOS +* Windows Phone 7 et 8 + +### Quirks Android + +* Android prend en charge un maximum de trois boutons et ignore plus que cela. + +* Sur Android 3.0 et versions ultérieures, les boutons sont affichés dans l'ordre inverse pour les appareils qui utilisent le thème Holo. + +### Firefox OS Quirks : + +Les deux indigènes bloquant `window.prompt()` et non-bloquante `navigator.notification.prompt()` sont disponibles. + +## navigator.notification.beep + +Le dispositif joue un bip sonore. + + navigator.notification.beep(times); + + +* **temps**: le nombre de fois répéter le bip. *(Nombre)* + +### Exemple + + // Beep twice! + navigator.notification.beep(2); + + +### Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* iOS +* Paciarelli +* Windows Phone 7 et 8 +* Windows 8 + +### Amazon Fire OS Quirks + +* Amazon Fire OS joue la valeur par défaut le **Son de Notification** spécifié sous le panneau **d'affichage des réglages/& Sound** . + +### Quirks Android + +* Android joue la **sonnerie de Notification** spécifié sous le panneau des **réglages/son et affichage** de valeur par défaut. + +### Windows Phone 7 et 8 Quirks + +* S'appuie sur un fichier générique bip de la distribution de Cordova. + +### Bizarreries de paciarelli + +* Paciarelli implémente les bips en lisant un fichier audio via les médias API. + +* Le fichier sonore doit être court, doit se trouver dans un `sounds` sous-répertoire du répertoire racine de l'application et doit être nommé`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/index.md new file mode 100644 index 000000000..97ebf92ff --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/index.md @@ -0,0 +1,248 @@ + + +# org.apache.cordova.dialogs + +This plugin provides access to some native dialog UI elements. + +## Installation + + cordova plugin add org.apache.cordova.dialogs + +## 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 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 `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 +- Windows Phone 7 and 8 + +### 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/cordova/plugins/org.apache.cordova.dialogs/doc/it/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/it/index.md new file mode 100644 index 000000000..f0132c361 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/it/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +Questo plugin consente di accedere ad alcuni elementi di interfaccia utente nativa del dialogo. + +## Installazione + + cordova plugin add org.apache.cordova.dialogs + + +## Metodi + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +Mostra una finestra di avviso o la finestra di dialogo personalizzata. La maggior parte delle implementazioni di Cordova una dialogo nativa per questa caratteristica, ma alcune piattaforme utilizzano il browser `alert` funzione, che è in genere meno personalizzabile. + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **messaggio**: messaggio finestra di dialogo. *(String)* + +* **alertCallback**: Callback da richiamare quando viene chiusa la finestra di avviso. *(Funzione)* + +* **titolo**: titolo di dialogo. *(String)* (Opzionale, default è`Alert`) + +* **buttonName**: nome del pulsante. *(String)* (Opzionale, default è`OK`) + +### Esempio + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Windows Phone 7 e 8 stranezze + +* Non non c'è nessun avviso del browser integrato, ma è possibile associare uno come segue per chiamare `alert()` in ambito globale: + + window.alert = navigator.notification.alert; + + +* Entrambi `alert` e `confirm` sono non di blocco chiamate, risultati di cui sono disponibili solo in modo asincrono. + +### Firefox OS Stranezze: + +Entrambi nativi di blocco `window.alert()` e non bloccante `navigator.notification.alert()` sono disponibili. + +## navigator.notification.confirm + +Visualizza una finestra di dialogo conferma personalizzabile. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **messaggio**: messaggio finestra di dialogo. *(String)* + +* **confirmCallback**: Callback da richiamare con l'indice del pulsante premuto (1, 2 o 3) o quando la finestra di dialogo viene chiusa senza una pressione del pulsante (0). *(Funzione)* + +* **titolo**: titolo di dialogo. *(String)* (Opzionale, default è`Confirm`) + +* **buttonLabels**: matrice di stringhe che specificano le etichette dei pulsanti. *(Matrice)* (Opzionale, default è [ `OK,Cancel` ]) + +### confirmCallback + +Il `confirmCallback` viene eseguito quando l'utente preme uno dei pulsanti nella finestra di dialogo conferma. + +Il callback accetta l'argomento `buttonIndex` *(numero)*, che è l'indice del pulsante premuto. Nota che l'indice utilizza l'indicizzazione base uno, quindi il valore è `1` , `2` , `3` , ecc. + +### Esempio + + 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 + ); + + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Windows Phone 7 e 8 stranezze + +* Non non c'è nessuna funzione browser incorporato per `window.confirm` , ma è possibile associare assegnando: + + window.confirm = navigator.notification.confirm; + + +* Chiama al `alert` e `confirm` sono non bloccante, quindi il risultato è disponibile solo in modo asincrono. + +### Firefox OS Stranezze: + +Entrambi nativi di blocco `window.confirm()` e non bloccante `navigator.notification.confirm()` sono disponibili. + +## navigator.notification.prompt + +Visualizza una finestra di dialogo nativa che è più personalizzabile del browser `prompt` funzione. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **messaggio**: messaggio finestra di dialogo. *(String)* + +* **promptCallback**: Callback da richiamare con l'indice del pulsante premuto (1, 2 o 3) o quando la finestra di dialogo viene chiusa senza una pressione del pulsante (0). *(Funzione)* + +* **titolo**: dialogo titolo *(String)* (opzionale, default è`Prompt`) + +* **buttonLabels**: matrice di stringhe specificando il pulsante etichette *(Array)* (opzionale, default è`["OK","Cancel"]`) + +* **defaultText**: valore di input predefinito textbox ( `String` ) (opzionale, Default: stringa vuota) + +### promptCallback + +Il `promptCallback` viene eseguito quando l'utente preme uno dei pulsanti nella finestra di dialogo richiesta. Il `results` oggetto passato al metodo di callback contiene le seguenti proprietà: + +* **buttonIndex**: l'indice del pulsante premuto. *(Numero)* Nota che l'indice utilizza l'indicizzazione base uno, quindi il valore è `1` , `2` , `3` , ecc. + +* **INPUT1**: il testo immesso nella finestra di dialogo richiesta. *(String)* + +### Esempio + + 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 + ); + + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* Firefox OS +* iOS +* Windows Phone 7 e 8 + +### Stranezze Android + +* Android supporta un massimo di tre pulsanti e ignora di più di quello. + +* Su Android 3.0 e versioni successive, i pulsanti vengono visualizzati in ordine inverso per dispositivi che utilizzano il tema Holo. + +### Firefox OS Stranezze: + +Entrambi nativi di blocco `window.prompt()` e non bloccante `navigator.notification.prompt()` sono disponibili. + +## navigator.notification.beep + +Il dispositivo riproduce un bip sonoro. + + navigator.notification.beep(times); + + +* **volte**: il numero di volte per ripetere il segnale acustico. *(Numero)* + +### Esempio + + // Beep twice! + navigator.notification.beep(2); + + +### Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 e 8 +* Windows 8 + +### Amazon fuoco OS stranezze + +* Amazon fuoco OS riproduce il **Suono di notifica** specificato sotto il pannello **Impostazioni/Display e il suono** predefinito. + +### Stranezze Android + +* Android giochi default **Notification ringtone** specificato sotto il pannello **impostazioni/audio e Display** . + +### Windows Phone 7 e 8 stranezze + +* Si basa su un file generico bip dalla distribuzione di Cordova. + +### Tizen stranezze + +* Tizen implementa bip di riproduzione di un file audio tramite i media API. + +* Il file beep deve essere breve, deve essere situato un `sounds` sottodirectory della directory radice dell'applicazione e deve essere denominato`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/ja/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/ja/index.md new file mode 100644 index 000000000..eae820816 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/ja/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +このプラグインはいくつかのネイティブのダイアログの UI 要素へのアクセスを提供します。 + +## インストール + + cordova plugin add org.apache.cordova.dialogs + + +## メソッド + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +カスタムの警告またはダイアログ ボックスが表示されます。 ほとんどコルドバ ネイティブ] ダイアログ ボックスの使用この機能がいくつかのプラットフォームを使用して、ブラウザーの `alert` 関数は、通常より少なくカスタマイズ可能です。 + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **メッセージ**: ダイアログ メッセージ。*(文字列)* + +* **alertCallback**: 警告ダイアログが閉じられたときに呼び出すコールバック。*(機能)* + +* **タイトル**: ダイアログのタイトル。*(文字列)*(省略可能、既定値は`Alert`) + +* **buttonName**: ボタンの名前。*(文字列)*(省略可能、既定値は`OK`) + +### 例 + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* Firefox の OS +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### Windows Phone 7 と 8 癖 + +* 組み込みのブラウザー警告がない呼び出しを次のように 1 つをバインドすることができます `alert()` 、グローバル スコープで。 + + window.alert = navigator.notification.alert; + + +* 両方の `alert` と `confirm` は非ブロッキング呼び出し、結果は非同期的にのみ利用できます。 + +### Firefox OS 互換: + +両方のネイティブ ブロック `window.alert()` ノン ブロッキングと `navigator.notification.alert()` は利用できます。 + +## navigator.notification.confirm + +カスタマイズ可能な確認のダイアログ ボックスが表示されます。 + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **メッセージ**: ダイアログ メッセージ。*(文字列)* + +* **confirmCallback**: インデックス (1、2、または 3) を押されたボタンまたはダイアログ ボックスは、ボタンを押す (0) なしに解雇されたときに呼び出すコールバック。*(機能)* + +* **タイトル**: ダイアログのタイトル。*(文字列)*(省略可能、既定値は`Confirm`) + +* **buttonLabels**: ボタンのラベルを指定する文字列の配列。*(配列)*(省略可能、既定値は [ `OK,Cancel` ]) + +### confirmCallback + +`confirmCallback`の確認ダイアログ ボックスでボタンを押したときに実行されます。 + +コールバック引数 `buttonIndex` *(番号)*は、押されたボタンのインデックス。 メモこと、インデックスを使用して 1 ベースのインデックス化、ので、値は `1` 、 `2` 、 `3` 、等。 + +### 例 + + 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 + ); + + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* Firefox の OS +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### Windows Phone 7 と 8 癖 + +* 組み込みブラウザーの機能はありません `window.confirm` が割り当てることによってバインドすることができます。 + + window.confirm = navigator.notification.confirm; + + +* 呼び出しを `alert` と `confirm` では非ブロッキング、結果は非同期的にのみ使用できます。 + +### Firefox OS 互換: + +両方のネイティブ ブロック `window.confirm()` ノン ブロッキングと `navigator.notification.confirm()` は利用できます。 + +## navigator.notification.prompt + +ブラウザーのより詳細にカスタマイズはネイティブのダイアログ ボックスが表示されます `prompt` 関数。 + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **メッセージ**: ダイアログ メッセージ。*(文字列)* + +* **promptCallback**: インデックス (1、2、または 3) を押されたボタンまたはダイアログ ボックスは、ボタンを押す (0) なしに解雇されたときに呼び出すコールバック。*(機能)* + +* **タイトル**: *(文字列)* (省略可能、既定値のタイトル] ダイアログ`Prompt`) + +* **buttonLabels**: ボタンを指定する文字列の配列*(配列)* (省略可能、既定値のラベル`["OK","Cancel"]`) + +* **これら**: 既定テキスト ボックスの入力値 ( `String` ) (省略可能、既定: 空の文字列) + +### promptCallback + +`promptCallback`プロンプト ダイアログ ボックス内のボタンのいずれかを押したときに実行されます。`results`コールバックに渡されるオブジェクトに、次のプロパティが含まれています。 + +* **buttonIndex**: 押されたボタンのインデックス。*(数)*メモこと、インデックスを使用して 1 ベースのインデックス化、ので、値は `1` 、 `2` 、 `3` 、等。 + +* **input1**: プロンプト ダイアログ ボックスに入力したテキスト。*(文字列)* + +### 例 + + 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 + ); + + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* Firefox の OS +* iOS +* Windows Phone 7 と 8 + +### Android の癖 + +* Android は最大 3 つのボタンをサポートしているし、それ以上無視します。 + +* アンドロイド 3.0 と後、ホロのテーマを使用するデバイスを逆の順序でボタンが表示されます。 + +### Firefox OS 互換: + +両方のネイティブ ブロック `window.prompt()` ノン ブロッキングと `navigator.notification.prompt()` は利用できます。 + +## navigator.notification.beep + +デバイス サウンドをビープ音を再生します。 + + navigator.notification.beep(times); + + +* **回**: ビープ音を繰り返す回数。*(数)* + +### 例 + + // Beep twice! + navigator.notification.beep(2); + + +### サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* iOS +* Tizen +* Windows Phone 7 と 8 +* Windows 8 + +### アマゾン火 OS 癖 + +* アマゾン火 OS デフォルト**設定/表示 & サウンド**パネルの下に指定した**通知音**を果たしています。 + +### Android の癖 + +* アンドロイド デフォルト**通知着信音****設定/サウンド & ディスプレイ**パネルの下に指定を果たしています。 + +### Windows Phone 7 と 8 癖 + +* コルドバ分布からジェネリック ビープ音ファイルに依存します。 + +### Tizen の癖 + +* Tizen は、メディア API 経由でオーディオ ファイルを再生してビープ音を実装します。 + +* ビープ音ファイルする必要があります短いである必要があります、 `sounds` 、アプリケーションのルート ディレクトリのサブディレクトリと命名する必要があります`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/ko/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/ko/index.md new file mode 100644 index 000000000..2350421a0 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/ko/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +이 플러그인 몇 가지 기본 대화 상자 UI 요소에 액세스할 수 있습니다. + +## 설치 + + cordova plugin add org.apache.cordova.dialogs + + +## 메서드 + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +사용자 지정 경고 또는 대화 상자를 보여 줍니다. 이 기능에 대 한 기본 대화 상자를 사용 하는 대부분의 코르도바 구현 하지만 일부 플랫폼 사용 브라우저의 `alert` 함수는 일반적으로 덜 사용자 정의할 수 있습니다. + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **메시지**: 대화 메시지. *(문자열)* + +* **alertCallback**: 콜백을 호출할 때 경고 대화 기 각. *(기능)* + +* **제목**: 제목 대화 상자. *(문자열)* (옵션, 기본값:`Alert`) + +* **buttonName**: 단추 이름. *(문자열)* (옵션, 기본값:`OK`) + +### 예를 들어 + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* Firefox 운영 체제 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### Windows Phone 7, 8 특수 + +* 아니 내장 브라우저 경고 하지만 다음과 같이 전화를 바인딩할 수 있습니다 `alert()` 전역 범위에서: + + window.alert = navigator.notification.alert; + + +* 둘 다 `alert` 와 `confirm` 는 비차단 호출, 결과 비동기적으로 사용할 수 있습니다. + +### 파이어 폭스 OS 단점: + +두 기본 차단 `window.alert()` 및 비차단 `navigator.notification.alert()` 사용할 수 있습니다. + +## navigator.notification.confirm + +사용자 정의 확인 대화 상자가 표시 됩니다. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **메시지**: 대화 메시지. *(문자열)* + +* **confirmCallback**: 인덱스 버튼 (1, 2 또는 3) 또는 대화 상자 버튼을 누르면 (0) 없이 기 각 될 때 호출할 콜백 합니다. *(기능)* + +* **제목**: 제목 대화 상자. *(문자열)* (옵션, 기본값:`Confirm`) + +* **buttonLabels**: 단추 레이블을 지정 하는 문자열 배열입니다. *(배열)* (옵션, 기본값은 [ `OK,Cancel` ]) + +### confirmCallback + +`confirmCallback`사용자가 확인 대화 상자에서 단추 중 하나를 누를 때 실행 됩니다. + +콜백 인수 `buttonIndex` *(번호)를*누르면된 버튼의 인덱스입니다. 참고 인덱스에서는 인덱스 1부터 값은 `1` , `2` , `3` , 등등. + +### 예를 들어 + + 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 + ); + + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* Firefox 운영 체제 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### Windows Phone 7, 8 특수 + +* 에 대 한 기본 제공 브라우저 함수가 `window.confirm` , 그러나 할당 하 여 바인딩할 수 있습니다: + + window.confirm = navigator.notification.confirm; + + +* 호출 `alert` 및 `confirm` 되므로 차단 되지 않은 결과만 비동기적으로 사용할 수 있습니다. + +### 파이어 폭스 OS 단점: + +두 기본 차단 `window.confirm()` 및 비차단 `navigator.notification.confirm()` 사용할 수 있습니다. + +## navigator.notification.prompt + +브라우저의 보다 더 많은 사용자 정의 기본 대화 상자 표시 `prompt` 기능. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **메시지**: 대화 메시지. *(문자열)* + +* **promptCallback**: 인덱스 버튼 (1, 2 또는 3) 또는 대화 상자 버튼을 누르면 (0) 없이 기 각 될 때 호출할 콜백 합니다. *(기능)* + +* **제목**: 제목 *(문자열)* (옵션, 기본값 대화 상자`Prompt`) + +* **buttonLabels**: 단추를 지정 하는 문자열의 배열 *(배열)* (옵션, 기본값은 레이블`["OK","Cancel"]`) + +* **defaultText**: 기본 텍스트 상자 입력 값 ( `String` ) (옵션, 기본값: 빈 문자열) + +### promptCallback + +`promptCallback`사용자가 프롬프트 대화 상자에서 단추 중 하나를 누를 때 실행 됩니다. `results`콜백에 전달 된 개체에는 다음 속성이 포함 되어 있습니다: + +* **buttonIndex**: 눌려진된 버튼의 인덱스. *(수)* 참고 인덱스에서는 인덱스 1부터 값은 `1` , `2` , `3` , 등등. + +* **input1**: 프롬프트 대화 상자에 입력 한 텍스트. *(문자열)* + +### 예를 들어 + + 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 + ); + + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* Firefox 운영 체제 +* iOS +* Windows Phone 7과 8 + +### 안 드 로이드 단점 + +* 안 드 로이드 최대 3 개의 단추를 지원 하 고 그것 보다는 더 이상 무시 합니다. + +* 안 드 로이드 3.0 및 나중에, 단추는 홀로 테마를 사용 하는 장치에 대 한 반대 순서로 표시 됩니다. + +### 파이어 폭스 OS 단점: + +두 기본 차단 `window.prompt()` 및 비차단 `navigator.notification.prompt()` 사용할 수 있습니다. + +## navigator.notification.beep + +장치는 경고음 소리를 재생 합니다. + + navigator.notification.beep(times); + + +* **시간**: 경고음을 반복 하는 횟수. *(수)* + +### 예를 들어 + + // Beep twice! + navigator.notification.beep(2); + + +### 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* iOS +* Tizen +* Windows Phone 7과 8 +* 윈도우 8 + +### 아마존 화재 OS 단점 + +* 아마존 화재 운영 체제 기본 **설정/디스플레이 및 사운드** 패널에 지정 된 **알림 소리** 재생 됩니다. + +### 안 드 로이드 단점 + +* 안 드 로이드 기본 **알림 벨소리** **설정/사운드 및 디스플레이** 패널에서 지정 합니다. + +### Windows Phone 7, 8 특수 + +* 코르 도우 바 분포에서 일반 경고음 파일에 의존합니다. + +### Tizen 특수 + +* Tizen은 미디어 API 통해 오디오 파일을 재생 하 여 경고음을 구현 합니다. + +* 경고음 파일에 위치 해야 합니다, 짧은 해야 한 `sounds` 응용 프로그램의 루트 디렉터리의 하위 디렉터리 명명 해야 합니다`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/pl/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/pl/index.md new file mode 100644 index 000000000..c968310fe --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/pl/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +Ten plugin umożliwia dostęp do niektórych rodzimych okna dialogowego elementy interfejsu użytkownika. + +## Instalacji + + cordova plugin add org.apache.cordova.dialogs + + +## Metody + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +Pokazuje niestandardowe wpisu lub okno dialogowe. Większość implementacji Cordova używać rodzimych okno dialogowe dla tej funkcji, ale niektóre platformy używać przeglądarki `alert` funkcja, który jest zazwyczaj mniej konfigurowalny. + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **wiadomość**: komunikat okna dialogowego. *(String)* + +* **alertCallback**: wywołanie zwrotne do wywołania, gdy okno dialogowe alert jest oddalona. *(Funkcja)* + +* **tytuł**: okno tytuł. *(String)* (Opcjonalna, domyślnie`Alert`) + +* **buttonName**: Nazwa przycisku. *(String)* (Opcjonalna, domyślnie`OK`) + +### Przykład + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Jeżyna 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Windows Phone 7 i 8 dziwactwa + +* Istnieje wpis nie wbudowana przeglądarka, ale można powiązać w następujący sposób na wywołanie `alert()` w globalnym zasięgu: + + window.alert = navigator.notification.alert; + + +* Zarówno `alert` i `confirm` są bez blokowania połączeń, których wyniki są tylko dostępne asynchronicznie. + +### Firefox OS dziwactwa: + +Blokuje zarówno rodzimych `window.alert()` i bez blokowania `navigator.notification.alert()` są dostępne. + +## navigator.notification.confirm + +Wyświetla okno dialogowe potwierdzenia konfigurowalny. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **wiadomość**: komunikat okna dialogowego. *(String)* + +* **confirmCallback**: wywołanie zwrotne do wywołania z indeksu z przycisku (1, 2 lub 3), lub gdy okno jest zwolniony bez naciśnij przycisk (0). *(Funkcja)* + +* **tytuł**: okno tytuł. *(String)* (Opcjonalna, domyślnie`Confirm`) + +* **buttonLabels**: tablica ciągów, określając etykiety przycisków. *(Tablica)* (Opcjonalna, domyślnie [ `OK,Cancel` ]) + +### confirmCallback + +`confirmCallback`Wykonuje, gdy użytkownik naciśnie klawisz jeden z przycisków w oknie dialogowym potwierdzenia. + +Wywołania zwrotnego przyjmuje argument `buttonIndex` *(numer)*, który jest indeksem wciśnięty przycisk. Uwaga, że indeks używa, na podstawie jednego indeksowania, więc wartość jest `1` , `2` , `3` , itp. + +### Przykład + + 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 + ); + + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Jeżyna 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Windows Phone 7 i 8 dziwactwa + +* Istnieje funkcja wbudowana przeglądarka nie `window.confirm` , ale można go powiązać przypisując: + + window.confirm = navigator.notification.confirm; + + +* Wzywa do `alert` i `confirm` są bez blokowania, więc wynik jest tylko dostępnych asynchronicznie. + +### Firefox OS dziwactwa: + +Blokuje zarówno rodzimych `window.confirm()` i bez blokowania `navigator.notification.confirm()` są dostępne. + +## navigator.notification.prompt + +Wyświetla okno dialogowe macierzystego, który bardziej niż przeglądarki `prompt` funkcja. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **wiadomość**: komunikat okna dialogowego. *(String)* + +* **promptCallback**: wywołanie zwrotne do wywołania z indeksu z przycisku (1, 2 lub 3), lub gdy okno jest zwolniony bez naciśnij przycisk (0). *(Funkcja)* + +* **tytuł**: okno tytuł *(String)* (opcjonalna, domyślnie`Prompt`) + +* **buttonLabels**: tablica ciągów, określając przycisk etykiety *(tablica)* (opcjonalna, domyślnie`["OK","Cancel"]`) + +* **defaultText**: wartość wejściowa tekstowym domyślnego ( `String` ) (opcjonalna, domyślnie: pusty ciąg) + +### promptCallback + +`promptCallback`Wykonuje, gdy użytkownik naciśnie klawisz jeden z przycisków w oknie dialogowym polecenia. `results`Obiekt przekazywany do wywołania zwrotnego zawiera następujące właściwości: + +* **buttonIndex**: indeks wciśnięty przycisk. *(Liczba)* Uwaga, że indeks używa, na podstawie jednego indeksowania, więc wartość jest `1` , `2` , `3` , itp. + +* **input1**: Tekst wprowadzony w oknie polecenia. *(String)* + +### Przykład + + 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 + ); + + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Firefox OS +* iOS +* Windows Phone 7 i 8 + +### Android dziwactwa + +* Android obsługuje maksymalnie trzy przyciski i więcej niż to ignoruje. + +* Android 3.0 i nowszych przyciski są wyświetlane w kolejności odwrotnej do urządzenia, które używają tematu Holo. + +### Firefox OS dziwactwa: + +Blokuje zarówno rodzimych `window.prompt()` i bez blokowania `navigator.notification.prompt()` są dostępne. + +## navigator.notification.beep + +Urządzenie odtwarza sygnał ciągły dźwięk. + + navigator.notification.beep(times); + + +* **razy**: liczba powtórzeń po sygnale. *(Liczba)* + +### Przykład + + // Beep twice! + navigator.notification.beep(2); + + +### Obsługiwane platformy + +* Amazon ogień OS +* Android +* Jeżyna 10 +* iOS +* Tizen +* Windows Phone 7 i 8 +* Windows 8 + +### Amazon ogień OS dziwactwa + +* Amazon ogień OS gra domyślny **Dźwięk powiadomienia** określone w panelu **ekranu/ustawienia i dźwięk** . + +### Android dziwactwa + +* Android gra domyślnie **dzwonek powiadomienia** określone w panelu **ustawień/dźwięk i wyświetlacz** . + +### Windows Phone 7 i 8 dziwactwa + +* Opiera się na pliku rodzajowego sygnał z rozkładu Cordova. + +### Osobliwości Tizen + +* Tizen implementuje dźwięków przez odtwarzania pliku audio za pośrednictwem mediów API. + +* Plik dźwiękowy muszą być krótkie, musi znajdować się w `sounds` podkatalogu katalogu głównego aplikacji i musi być nazwany`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/ru/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/ru/index.md new file mode 100644 index 000000000..4dafab2b7 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/ru/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +Этот плагин обеспечивает доступ к некоторым элементам собственного диалогового окна пользовательского интерфейса. + +## Установка + + cordova plugin add org.apache.cordova.dialogs + + +## Методы + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +Показывает окно пользовательские оповещения или диалоговое окно. Большинство реализаций Cordova использовать диалоговое окно родной для этой функции, но некоторые платформы браузера `alert` функция, которая как правило менее настраивается. + + Navigator.Notification.Alert (сообщение, alertCallback, [название], [buttonName]) + + +* **сообщение**: сообщение диалога. *(Строка)* + +* **alertCallback**: обратного вызова для вызова, когда закрывается диалоговое окно оповещения. *(Функция)* + +* **название**: диалоговое окно название. *(Строка)* (Опционально, по умолчанию`Alert`) + +* **buttonName**: имя кнопки. *(Строка)* (Опционально, по умолчанию`OK`) + +### Пример + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Windows Phone 7 и 8 причуды + +* Существует предупреждение не встроенный браузер, но можно привязать один следующим позвонить `alert()` в глобальной области действия: + + window.alert = navigator.notification.alert; + + +* Оба `alert` и `confirm` являются не блокировка звонков, результаты которых доступны только асинхронно. + +### Firefox OS причуды: + +Как родной блокировка `window.alert()` и неблокирующий `navigator.notification.alert()` доступны. + +## navigator.notification.confirm + +Отображает диалоговое окно Настраиваемый подтверждения. + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **сообщение**: сообщение диалога. *(Строка)* + +* **confirmCallback**: обратного вызова с индексом кнопка нажата (1, 2 или 3) или когда диалоговое окно закрывается без нажатия кнопки (0). *(Функция)* + +* **название**: диалоговое окно название. *(Строка)* (Опционально, по умолчанию`Confirm`) + +* **buttonLabels**: массив строк, указав названия кнопок. *(Массив)* (Не обязательно, по умолчанию [ `OK,Cancel` ]) + +### confirmCallback + +`confirmCallback`Выполняется, когда пользователь нажимает одну из кнопок в диалоговом окне подтверждения. + +Аргументом функции обратного вызова `buttonIndex` *(номер)*, который является индекс нажатой кнопки. Обратите внимание, что индекс использует единицы индексации, поэтому значение `1` , `2` , `3` , и т.д. + +### Пример + + 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 + ); + + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* BlackBerry 10 +* Firefox OS +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Windows Phone 7 и 8 причуды + +* Нет встроенного браузера функция для `window.confirm` , но его можно привязать путем присвоения: + + window.confirm = navigator.notification.confirm; + + +* Вызовы `alert` и `confirm` являются не блокируется, поэтому результат доступен только асинхронно. + +### Firefox OS причуды: + +Как родной блокировка `window.confirm()` и неблокирующий `navigator.notification.confirm()` доступны. + +## navigator.notification.prompt + +Отображает родной диалоговое окно более настраиваемый, чем в браузере `prompt` функции. + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **сообщение**: сообщение диалога. *(Строка)* + +* **promptCallback**: обратного вызова с индексом кнопка нажата (1, 2 или 3) или когда диалоговое окно закрывается без нажатия кнопки (0). *(Функция)* + +* **название**: диалоговое окно название *(String)* (опционально, по умолчанию`Prompt`) + +* **buttonLabels**: массив строк, указав кнопку этикетки *(массив)* (опционально, по умолчанию`["OK","Cancel"]`) + +* **defaultText**: по умолчанию textbox входное значение ( `String` ) (опционально, по умолчанию: пустая строка) + +### promptCallback + +`promptCallback`Выполняется, когда пользователь нажимает одну из кнопок в диалоговом окне приглашения. `results`Объект, переданный в метод обратного вызова содержит следующие свойства: + +* **buttonIndex**: индекс нажатой кнопки. *(Число)* Обратите внимание, что индекс использует единицы индексации, поэтому значение `1` , `2` , `3` , и т.д. + +* **INPUT1**: текст, введенный в диалоговом окне приглашения. *(Строка)* + +### Пример + + 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 + ); + + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* Firefox OS +* iOS +* Windows Phone 7 и 8 + +### Android причуды + +* Android поддерживает максимум из трех кнопок и игнорирует больше, чем это. + +* На Android 3.0 и более поздних версиях кнопки отображаются в обратном порядке для устройств, которые используют тему холо. + +### Firefox OS причуды: + +Как родной блокировка `window.prompt()` и неблокирующий `navigator.notification.prompt()` доступны. + +## navigator.notification.beep + +Устройство воспроизводит звуковой сигнал звук. + + navigator.notification.beep(times); + + +* **раз**: количество раз, чтобы повторить сигнал. *(Число)* + +### Пример + + // Beep twice! + navigator.notification.beep(2); + + +### Поддерживаемые платформы + +* Amazon Fire ОС +* Android +* BlackBerry 10 +* iOS +* Tizen +* Windows Phone 7 и 8 +* Windows 8 + +### Amazon Fire OS причуды + +* Amazon Fire OS играет по умолчанию **Звук уведомления** , указанного на панели **параметров/дисплей и звук** . + +### Android причуды + +* Android играет по умолчанию **уведомления рингтон** указанных в панели **настройки/звук и дисплей** . + +### Windows Phone 7 и 8 причуды + +* Опирается на общий звуковой файл из дистрибутива Кордова. + +### Причуды Tizen + +* Tizen реализует гудков, воспроизведении аудиофайла через СМИ API. + +* Звуковой файл должен быть коротким, должен быть расположен в `sounds` подкаталог корневого каталога приложения и должны быть названы`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/doc/zh/index.md b/cordova/plugins/org.apache.cordova.dialogs/doc/zh/index.md new file mode 100644 index 000000000..f9abbb132 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/doc/zh/index.md @@ -0,0 +1,247 @@ + + +# org.apache.cordova.dialogs + +這個外掛程式提供了對一些本機對話方塊的使用者介面元素的訪問。 + +## 安裝 + + cordova plugin add org.apache.cordova.dialogs + + +## 方法 + +* `navigator.notification.alert` +* `navigator.notification.confirm` +* `navigator.notification.prompt` +* `navigator.notification.beep` + +## navigator.notification.alert + +顯示一個自訂的警報或對話方塊框。 大多數科爾多瓦實現使用本機對話方塊中的此項功能,但一些平臺使用瀏覽器的 `alert` 函數,這是通常不那麼可自訂。 + + navigator.notification.alert(message, alertCallback, [title], [buttonName]) + + +* **消息**: 消息對話方塊。*(字串)* + +* **alertCallback**: 當警報對話方塊的被解雇時要調用的回檔。*(函數)* + +* **標題**: 標題對話方塊。*(字串)*(可選,預設值為`Alert`) + +* **buttonName**: 按鈕名稱。*(字串)*(可選,預設值為`OK`) + +### 示例 + + function alertDismissed() { + // do something + } + + navigator.notification.alert( + 'You are the winner!', // message + alertDismissed, // callback + 'Game Over', // title + 'Done' // buttonName + ); + + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* 火狐瀏覽器作業系統 +* iOS +* Tizen +* Windows Phone 7 和 8 +* Windows 8 + +### Windows Phone 7 和 8 怪癖 + +* 有沒有內置瀏覽器警報,但你可以綁定一個,如下所示調用 `alert()` 在全球範圍內: + + window.alert = navigator.notification.alert; + + +* 兩個 `alert` 和 `confirm` 的非阻塞的調用,其中的結果才是可用的非同步。 + +### 火狐瀏覽器作業系統怪癖: + +這兩個本機阻止 `window.alert()` 和非阻塞 `navigator.notification.alert()` 可用。 + +## navigator.notification.confirm + +顯示一個可自訂的確認對話方塊。 + + navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]) + + +* **消息**: 消息對話方塊。*(字串)* + +* **confirmCallback**: 要用索引 (1、 2 或 3) 按下的按鈕,或者在沒有按下按鈕 (0) 駁回了對話方塊中時調用的回檔。*(函數)* + +* **標題**: 標題對話方塊。*(字串)*(可選,預設值為`Confirm`) + +* **buttonLabels**: 指定按鈕標籤的字串陣列。*(陣列)*(可選,預設值為 [ `OK,Cancel` ]) + +### confirmCallback + +`confirmCallback`當使用者按下確認對話方塊中的按鈕之一的時候執行。 + +回檔將參數 `buttonIndex` *(編號)*,它是按下的按鈕的索引。 請注意索引使用基於 1 的索引,所以值是 `1` , `2` , `3` ,等等。 + +### 示例 + + 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 + ); + + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* 火狐瀏覽器作業系統 +* iOS +* Tizen +* Windows Phone 7 和 8 +* Windows 8 + +### Windows Phone 7 和 8 怪癖 + +* 有沒有內置的瀏覽器功能的 `window.confirm` ,但你可以將它綁定通過分配: + + window.confirm = navigator.notification.confirm; + + +* 調用到 `alert` 和 `confirm` 的非阻塞,所以結果就是只可用以非同步方式。 + +### 火狐瀏覽器作業系統怪癖: + +這兩個本機阻止 `window.confirm()` 和非阻塞 `navigator.notification.confirm()` 可用。 + +## navigator.notification.prompt + +顯示本機的對話方塊,更可自訂的瀏覽器比 `prompt` 函數。 + + navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText]) + + +* **消息**: 消息對話方塊。*(字串)* + +* **promptCallback**: 要用索引 (1、 2 或 3) 按下的按鈕,或者在沒有按下按鈕 (0) 駁回了對話方塊中時調用的回檔。*(函數)* + +* **標題**: 對話方塊的標題*(字串)* (可選,預設值為`Prompt`) + +* **buttonLabels**: 陣列,這些字串指定按鈕標籤*(陣列)* (可選,預設值為`["OK","Cancel"]`) + +* **defaultText**: 預設文字方塊中輸入值 ( `String` ) (可選,預設值: 空字串) + +### promptCallback + +`promptCallback`當使用者按下一個提示對話方塊中的按鈕時執行。`results`物件傳遞給回檔的包含以下屬性: + +* **buttonIndex**: 按下的按鈕的索引。*(人數)*請注意索引使用基於 1 的索引,所以值是 `1` , `2` , `3` ,等等。 + +* **輸入 1**: 在提示對話方塊中輸入的文本。*(字串)* + +### 示例 + + 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 + ); + + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 火狐瀏覽器作業系統 +* iOS +* Windows Phone 7 和 8 + +### Android 的怪癖 + +* Android 支援最多的三個按鈕,並忽略任何更多。 + +* 關於 Android 3.0 及更高版本,使用全息主題的設備按相反的順序顯示按鈕。 + +### 火狐瀏覽器作業系統怪癖: + +這兩個本機阻止 `window.prompt()` 和非阻塞 `navigator.notification.prompt()` 可用。 + +## navigator.notification.beep + +該設備播放提示音聲音。 + + navigator.notification.beep(times); + + +* **時間**: 的次數重複發出蜂鳴音。*(人數)* + +### 示例 + + // Beep twice! + navigator.notification.beep(2); + + +### 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* iOS +* Tizen +* Windows Phone 7 和 8 +* Windows 8 + +### 亞馬遜火 OS 怪癖 + +* 亞馬遜火 OS 播放預設**設置/顯示 & 聲音**面板下指定的**通知聲音**。 + +### Android 的怪癖 + +* Android 系統播放的預設**通知鈴聲****設置/聲音和顯示**面板下指定。 + +### Windows Phone 7 和 8 怪癖 + +* 依賴泛型蜂鳴音檔從科爾多瓦分佈。 + +### Tizen 怪癖 + +* Tizen 通過播放音訊檔通過媒體 API 實現會發出蜂鳴聲。 + +* 蜂鳴音檔必須很短,必須設在 `sounds` 子目錄中的應用程式的根目錄中,並且必須命名`beep.wav`. \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/package.json b/cordova/plugins/org.apache.cordova.dialogs/package.json new file mode 100644 index 000000000..c598a82b5 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/package.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.10", + "name": "org.apache.cordova.dialogs", + "cordova_name": "Notification", + "description": "Cordova Notification Plugin", + "license": "Apache 2.0", + "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git", + "issue": "https://issues.apache.org/jira/browse/CB/component/12320642", + "keywords": [ + "cordova", + "notification" + ], + "platforms": [ + "firefoxos", + "android", + "amazon-fireos", + "ubuntu", + "ios", + "blackberry10", + "wp7", + "wp8", + "windows8" + ], + "engines": [], + "englishdoc": "\n\n# org.apache.cordova.dialogs\n\nThis plugin provides access to some native dialog UI elements.\n\n## Installation\n\n cordova plugin add org.apache.cordova.dialogs\n\n## Methods\n\n- `navigator.notification.alert`\n- `navigator.notification.confirm`\n- `navigator.notification.prompt`\n- `navigator.notification.beep`\n\n## navigator.notification.alert\n\nShows a custom alert or dialog box. Most Cordova implementations use a native\ndialog box for this feature, but some platforms use the browser's `alert`\nfunction, which is typically less customizable.\n\n navigator.notification.alert(message, alertCallback, [title], [buttonName])\n\n- __message__: Dialog message. _(String)_\n\n- __alertCallback__: Callback to invoke when alert dialog is dismissed. _(Function)_\n\n- __title__: Dialog title. _(String)_ (Optional, defaults to `Alert`)\n\n- __buttonName__: Button name. _(String)_ (Optional, defaults to `OK`)\n\n\n### Example\n\n function alertDismissed() {\n // do something\n }\n\n navigator.notification.alert(\n 'You are the winner!', // message\n alertDismissed, // callback\n 'Game Over', // title\n 'Done' // buttonName\n );\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Windows Phone 7 and 8 Quirks\n\n- There is no built-in browser alert, but you can bind one as follows to call `alert()` in the global scope:\n\n window.alert = navigator.notification.alert;\n\n- Both `alert` and `confirm` are non-blocking calls, results of which are only available asynchronously.\n\n### Firefox OS Quirks:\n\nBoth native-blocking `window.alert()` and non-blocking `navigator.notification.alert()` are available.\n\n## navigator.notification.confirm\n\nDisplays a customizable confirmation dialog box.\n\n navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])\n\n- __message__: Dialog message. _(String)_\n\n- __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)_\n\n- __title__: Dialog title. _(String)_ (Optional, defaults to `Confirm`)\n\n- __buttonLabels__: Array of strings specifying button labels. _(Array)_ (Optional, defaults to [`OK,Cancel`])\n\n\n### confirmCallback\n\nThe `confirmCallback` executes when the user presses one of the\nbuttons in the confirmation dialog box.\n\nThe callback takes the argument `buttonIndex` _(Number)_, which is the\nindex of the pressed button. Note that the index uses one-based\nindexing, so the value is `1`, `2`, `3`, etc.\n\n### Example\n\n function onConfirm(buttonIndex) {\n alert('You selected button ' + buttonIndex);\n }\n\n navigator.notification.confirm(\n 'You are the winner!', // message\n onConfirm, // callback to invoke with index of button pressed\n 'Game Over', // title\n ['Restart','Exit'] // buttonLabels\n );\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Windows Phone 7 and 8 Quirks\n\n- There is no built-in browser function for `window.confirm`, but you can bind it by assigning:\n\n window.confirm = navigator.notification.confirm;\n\n- Calls to `alert` and `confirm` are non-blocking, so the result is only available asynchronously.\n\n### Firefox OS Quirks:\n\nBoth native-blocking `window.confirm()` and non-blocking `navigator.notification.confirm()` are available.\n\n## navigator.notification.prompt\n\nDisplays a native dialog box that is more customizable than the browser's `prompt` function.\n\n navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText])\n\n- __message__: Dialog message. _(String)_\n\n- __promptCallback__: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). _(Function)_\n\n- __title__: Dialog title _(String)_ (Optional, defaults to `Prompt`)\n\n- __buttonLabels__: Array of strings specifying button labels _(Array)_ (Optional, defaults to `[\"OK\",\"Cancel\"]`)\n\n- __defaultText__: Default textbox input value (`String`) (Optional, Default: empty string)\n\n### promptCallback\n\nThe `promptCallback` executes when the user presses one of the buttons\nin the prompt dialog box. The `results` object passed to the callback\ncontains the following properties:\n\n- __buttonIndex__: The index of the pressed button. _(Number)_ Note that the index uses one-based indexing, so the value is `1`, `2`, `3`, etc.\n\n\n\n- __input1__: The text entered in the prompt dialog box. _(String)_\n\n### Example\n\n function onPrompt(results) {\n alert(\"You selected button number \" + results.buttonIndex + \" and entered \" + results.input1);\n }\n\n navigator.notification.prompt(\n 'Please enter your name', // message\n onPrompt, // callback to invoke\n 'Registration', // title\n ['Ok','Exit'], // buttonLabels\n 'Jane Doe' // defaultText\n );\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- Firefox OS\n- iOS\n- Windows Phone 7 and 8\n\n### Android Quirks\n\n- Android supports a maximum of three buttons, and ignores any more than that.\n\n- On Android 3.0 and later, buttons are displayed in reverse order for devices that use the Holo theme.\n\n### Firefox OS Quirks:\n\nBoth native-blocking `window.prompt()` and non-blocking `navigator.notification.prompt()` are available.\n\n## navigator.notification.beep\n\nThe device plays a beep sound.\n\n navigator.notification.beep(times);\n\n- __times__: The number of times to repeat the beep. _(Number)_\n\n### Example\n\n // Beep twice!\n navigator.notification.beep(2);\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Amazon Fire OS Quirks\n\n- Amazon Fire OS plays the default __Notification Sound__ specified under the __Settings/Display & Sound__ panel.\n\n### Android Quirks\n\n- Android plays the default __Notification ringtone__ specified under the __Settings/Sound & Display__ panel.\n\n### Windows Phone 7 and 8 Quirks\n\n- Relies on a generic beep file from the Cordova distribution.\n\n### Tizen Quirks\n\n- Tizen implements beeps by playing an audio file via the media API.\n\n- 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`.\n\n" +} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.dialogs/plugin.xml b/cordova/plugins/org.apache.cordova.dialogs/plugin.xml new file mode 100644 index 000000000..3aa213498 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/plugin.xml @@ -0,0 +1,157 @@ + + + + + + Notification + Cordova Notification Plugin + Apache 2.0 + cordova,notification + https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git + https://issues.apache.org/jira/browse/CB/component/12320642 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/android/Notification.java b/cordova/plugins/org.apache.cordova.dialogs/src/android/Notification.java new file mode 100644 index 000000000..1b05dbaa0 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/android/Notification.java @@ -0,0 +1,451 @@ +/* + 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; +import android.widget.TextView; + + +/** + * This class provides access to notifications on the device. + * + * Be aware that this implementation gets called on + * navigator.notification.{alert|confirm|prompt}, and that there is a separate + * implementation in org.apache.cordova.CordovaChromeClient that gets + * called on a simple window.{alert|confirm|prompt}. + */ +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(final long count) { + cordova.getThreadPool().execute(new Runnable() { + public void run() { + Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + Ringtone notification = RingtoneManager.getRingtone(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(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); + 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(); + AlertDialog dialog = dlg.show(); + TextView messageview = (TextView)dialog.findViewById(android.R.id.message); + messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE); + }; + }; + 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(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); + 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(); + AlertDialog dialog = dlg.show(); + TextView messageview = (TextView)dialog.findViewById(android.R.id.message); + messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE); + }; + }; + 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; + + Runnable runnable = new Runnable() { + public void run() { + final EditText promptInput = new EditText(cordova.getActivity()); + promptInput.setHint(defaultText); + AlertDialog.Builder dlg = new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); + 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(); + AlertDialog dialog = dlg.show(); + TextView messageview = (TextView)dialog.findViewById(android.R.id.message); + messageview.setTextDirection(android.view.View.TEXT_DIRECTION_LOCALE); + }; + }; + 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(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); + 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/cordova/plugins/org.apache.cordova.dialogs/src/blackberry10/index.js b/cordova/plugins/org.apache.cordova.dialogs/src/blackberry10/index.js new file mode 100644 index 000000000..b218eab6f --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/blackberry10/index.js @@ -0,0 +1,87 @@ +/* +* 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/cordova/plugins/org.apache.cordova.dialogs/src/firefoxos/notification.js b/cordova/plugins/org.apache.cordova.dialogs/src/firefoxos/notification.js new file mode 100644 index 000000000..b6986fd08 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/firefoxos/notification.js @@ -0,0 +1,154 @@ +/* + * + * 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 modulemapper = require('cordova/modulemapper'); + + +var origOpenFunc = modulemapper.getOriginalSymbol(window, 'window.open'); + + +function _empty() {} + + +function modal(message, callback, title, buttonLabels, domObjects) { + var mainWindow = window; + var modalWindow = origOpenFunc(); + var modalDocument = modalWindow.document; + + modalDocument.write( + '' + + '' + + '' + + ''); + + var box = modalDocument.createElement('form'); + box.setAttribute('role', 'dialog'); + // prepare and append empty section + var section = modalDocument.createElement('section'); + box.appendChild(section); + // add title + var boxtitle = modalDocument.createElement('h1'); + boxtitle.appendChild(modalDocument.createTextNode(title)); + section.appendChild(boxtitle); + // add message + var boxMessage = modalDocument.createElement('p'); + boxMessage.appendChild(modalDocument.createTextNode(message)); + section.appendChild(boxMessage); + // inject what's needed + if (domObjects) { + section.appendChild(domObjects); + } + // add buttons and assign callbackButton on click + var menu = modalDocument.createElement('menu'); + box.appendChild(menu); + for (var index = 0; index < buttonLabels.length; index++) { + addButton(buttonLabels[index], index, (index === 0)); + } + modalDocument.body.appendChild(box); + + function addButton(label, index, recommended) { + var thisButtonCallback = makeCallbackButton(index + 1); + var button = modalDocument.createElement('button'); + button.appendChild(modalDocument.createTextNode(label)); + button.addEventListener('click', thisButtonCallback, false); + if (recommended) { + // TODO: default one listens to Enter key + button.classList.add('recommend'); + } + menu.appendChild(button); + } + + // TODO: onUnload listens to the cancel key + function onUnload() { + var result = 0; + if (modalDocument.getElementById('prompt-input')) { + result = { + input1: '', + buttonIndex: 0 + } + } + mainWindow.setTimeout(function() { + callback(result); + }, 10); + }; + modalWindow.addEventListener('unload', onUnload, false); + + // call callback and destroy modal + function makeCallbackButton(labelIndex) { + return function() { + if (modalWindow) { + modalWindow.removeEventListener('unload', onUnload, false); + modalWindow.close(); + } + // checking if prompt + var promptInput = modalDocument.getElementById('prompt-input'); + var response; + if (promptInput) { + response = { + input1: promptInput.value, + buttonIndex: labelIndex + }; + } + response = response || labelIndex; + callback(response); + } + } +} + +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 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, successCallback, title, buttonLabels, inputParagraph); + } +}; + + +module.exports = Notification; +require('cordova/exec/proxy').add('Notification', Notification); diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.bundle/beep.wav b/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.bundle/beep.wav new file mode 100644 index 000000000..05f5997f9 Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.bundle/beep.wav differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.h b/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.h new file mode 100644 index 000000000..9253f6a9e --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.h @@ -0,0 +1,37 @@ +/* + 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 +#import +#import +#import + +@interface CDVNotification : CDVPlugin {} + +- (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/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.m b/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.m new file mode 100644 index 000000000..ac95cc645 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/ios/CDVNotification.m @@ -0,0 +1,157 @@ +/* + 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 +#import + +#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/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.cpp b/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.cpp new file mode 100644 index 000000000..d0adf892a --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.cpp @@ -0,0 +1,85 @@ +/* + * + * 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 + +void Dialogs::beep(int scId, int ecId, int times) { + Q_UNUSED(scId) + Q_UNUSED(ecId) + Q_UNUSED(times) + + _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); + + if (_alertCallback) { + qCritical() << "can't open second dialog"; + return; + } + _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: false, button1Text: %4, button2Text: %5, button3Text: %6 })") + .arg(CordovaInternal::format(path)).arg(CordovaInternal::format(title)).arg(CordovaInternal::format(message)) + .arg(CordovaInternal::format(s1)).arg(CordovaInternal::format(s2)).arg(CordovaInternal::format(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); + + if (_alertCallback) { + qCritical() << "can't open second dialog"; + return; + } + _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(CordovaInternal::format(path)).arg(CordovaInternal::format(title)).arg(CordovaInternal::format(message)) + .arg(CordovaInternal::format(s1)).arg(CordovaInternal::format(s2)) + .arg(CordovaInternal::format(s3)).arg(CordovaInternal::format(defaultText)); + + m_cordova->execQML(qml); +} diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.h b/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.h new file mode 100644 index 000000000..534307386 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.h @@ -0,0 +1,64 @@ +/* + * + * 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 +#include +#include +#include + +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, bool prompt) { + if (prompt) { + QVariantMap res; + res.insert("buttonIndex", buttonId); + res.insert("input1", text); + this->cb(_alertCallback, res); + } else { + this->cb(_alertCallback, buttonId); + } + _alertCallback = 0; + } + +private: + int _alertCallback; + QMediaPlayer _player; +}; + +#endif diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.qml b/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.qml new file mode 100644 index 000000000..5fdc7d31a --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/ubuntu/notification.qml @@ -0,0 +1,65 @@ +/* + * + * 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 + + TextField { + id: prompt + text: defaultPromptText + visible: promptVisible + focus: true + } + Button { + text: button1Text + color: "orange" + onClicked: { + root.exec("Notification", "notificationDialogButtonPressed", [1, prompt.text, promptVisible]); + PopupUtils.close(dialogue) + } + } + Button { + text: button2Text + visible: button2Text.length > 0 + color: "orange" + onClicked: { + root.exec("Notification", "notificationDialogButtonPressed", [2, prompt.text, promptVisible]); + PopupUtils.close(dialogue) + } + } + Button { + text: button3Text + visible: button3Text.length > 0 + onClicked: { + root.exec("Notification", "notificationDialogButtonPressed", [3, prompt.text, promptVisible]); + PopupUtils.close(dialogue) + } + } +} diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/windows8/NotificationProxy.js b/cordova/plugins/org.apache.cordova.dialogs/src/windows8/NotificationProxy.js new file mode 100644 index 000000000..c6bad95a6 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/windows8/NotificationProxy.js @@ -0,0 +1,123 @@ +/* + * + * 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 result; + + var btnList = []; + function commandHandler (command) { + result = btnList[command.label]; + } + + var md = new Windows.UI.Popups.MessageDialog(message, _title); + var button = _buttonLabels.split(','); + + for (var i = 0; i 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/cordova/plugins/org.apache.cordova.dialogs/src/wp/Notification.cs b/cordova/plugins/org.apache.cordova.dialogs/src/wp/Notification.cs new file mode 100644 index 000000000..4d5f40714 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/wp/Notification.cs @@ -0,0 +1,482 @@ +/* + 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"; + } + + /// + /// message to display in the alert box + /// + [DataMember] + public string message; + + /// + /// title displayed on the alert window + /// + [DataMember] + public string title; + + /// + /// text to display on the button + /// + [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(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(options); + string message = args[0]; + string title = args[1]; + string buttonLabelsArray = args[2]; + string[] buttonLabels = JSON.JsonHelper.Deserialize(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; + //textBox.AcceptsReturn = true; + //notifyBox.ContentScroller.Content = textBox; + + notifyBox.InputText.Text = defaultText; + notifyBox.InputText.Visibility = Visibility.Visible; + + 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.ButtonPanel.Orientation = Orientation.Vertical; + notifyBox.ButtonPanel.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(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(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) + { + NotificationBox box = promptBox as NotificationBox; + + text = box.InputText.Text; + + 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(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(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/cordova/plugins/org.apache.cordova.dialogs/src/wp/NotificationBox.xaml b/cordova/plugins/org.apache.cordova.dialogs/src/wp/NotificationBox.xaml new file mode 100644 index 000000000..5bf7aa684 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/wp/NotificationBox.xaml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cordova/plugins/org.apache.cordova.dialogs/src/wp/NotificationBox.xaml.cs b/cordova/plugins/org.apache.cordova.dialogs/src/wp/NotificationBox.xaml.cs new file mode 100644 index 000000000..50b2f2a84 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/src/wp/NotificationBox.xaml.cs @@ -0,0 +1,41 @@ +/* + 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/cordova/plugins/org.apache.cordova.dialogs/src/wp/notification-beep.wav b/cordova/plugins/org.apache.cordova.dialogs/src/wp/notification-beep.wav new file mode 100644 index 000000000..d0ad085fe Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/src/wp/notification-beep.wav differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/tests/plugin.xml b/cordova/plugins/org.apache.cordova.dialogs/tests/plugin.xml new file mode 100644 index 000000000..dec527667 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/tests/plugin.xml @@ -0,0 +1,29 @@ + + + + + Cordova Notification Plugin Tests + Apache 2.0 + + + + diff --git a/cordova/plugins/org.apache.cordova.dialogs/tests/tests.js b/cordova/plugins/org.apache.cordova.dialogs/tests/tests.js new file mode 100644 index 000000000..6e61b003b --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/tests/tests.js @@ -0,0 +1,189 @@ +/* + * + * 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. + * +*/ + +exports.defineAutoTests = function () { + describe('Notification (navigator.notification)', function () { + it("should exist", function () { + expect(navigator.notification).toBeDefined(); + }); + + it("should contain a beep function", function () { + expect(typeof navigator.notification.beep).toBeDefined(); + expect(typeof navigator.notification.beep).toBe("function"); + }); + + it("should contain an alert function", function () { + expect(typeof navigator.notification.alert).toBeDefined(); + expect(typeof navigator.notification.alert).toBe("function"); + }); + + it("should contain a confirm function", function () { + expect(typeof navigator.notification.confirm).toBeDefined(); + expect(typeof navigator.notification.confirm).toBe("function"); + }); + + it("should contain a prompt function", function () { + expect(typeof navigator.notification.prompt).toBeDefined(); + expect(typeof navigator.notification.prompt).toBe("function"); + }); + }); +}; + +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ + +exports.defineManualTests = function (contentEl, createActionButton) { + var logMessage = function (message) { + var log = document.getElementById('info'); + var logLine = document.createElement('div'); + logLine.innerHTML = message; + log.appendChild(logLine); + } + + var clearLog = function () { + var log = document.getElementById('info'); + log.innerHTML = ''; + } + + var beep = function () { + console.log("beep()"); + navigator.notification.beep(3); + }; + + var alertDialog = function (message, title, button) { + console.log("alertDialog()"); + navigator.notification.alert(message, + function () { + console.log("Alert dismissed."); + }, + title, button); + console.log("After alert"); + }; + + var confirmDialogA = function (message, title, buttons) { + clearLog(); + navigator.notification.confirm(message, + function (r) { + if (r === 0) { + logMessage("Dismissed dialog without making a selection."); + console.log("Dismissed dialog without making a selection."); + } else { + console.log("You selected " + r); + logMessage("You selected " + (buttons.split(","))[r - 1]); + } + }, + title, + buttons); + }; + + var confirmDialogB = function (message, title, buttons) { + clearLog(); + navigator.notification.confirm(message, + function (r) { + if (r === 0) { + logMessage("Dismissed dialog without making a selection."); + console.log("Dismissed dialog without making a selection."); + } else { + console.log("You selected " + r); + logMessage("You selected " + buttons[r - 1]); + } + }, + title, + buttons); + }; + + var promptDialog = function (message, title, buttons) { + clearLog(); + navigator.notification.prompt(message, + function (r) { + if (r && r.buttonIndex === 0) { + var msg = "Dismissed dialog"; + if (r.input1) { + msg += " with input: " + r.input1 + } + logMessage(msg); + console.log(msg); + } else { + console.log("You selected " + r.buttonIndex + " and entered: " + r.input1); + logMessage("You selected " + buttons[r.buttonIndex - 1] + " and entered: " + r.input1); + } + }, + title, + buttons); + }; + + /******************************************************************************/ + + var dialogs_tests = '
' + + 'Expected result: Device will beep (unless device is on silent). Nothing will get updated in status box.' + + '

Dialog Tests

' + + '

Dialog boxes will pop up for each of the following tests

' + + '

' + + 'Expected result: Dialog will say "You pressed alert". Press continue to close dialog. Nothing will get updated in status box.' + + '

' + + 'Expected result: Dialog will say "You pressed confirm". Press Yes, No, or Maybe to close dialog. Status box will tell you what option you selected.' + + '

' + + 'Expected result: Dialog will say "You pressed confirm". Press Yes, No, or Maybe, Not Sure to close dialog. Status box will tell you what option you selected.' + + '

' + + 'Expected result: Dialog will say "You pressed prompt". Enter any message and press Yes, No, or Maybe, Not Sure to close dialog. Status box will tell you what option you selected and message you entered.' + + '

' + + 'Expected result: Dialog will have title "index.html" and say "You pressed alert" Press OK to close dialog. Nothing will get updated in status box.' + + '

' + + 'Expected result: Dialog will have title "index.html" and say "You selected confirm". Press Cancel or OK to close dialog. Nothing will get updated in status box.' + + '

' + + 'Expected result: Dialog will have title "index.html" and say "This is a prompt". "Default value" will be in text box. Press Cancel or OK to close dialog. Nothing will get updated in status box.'; + + contentEl.innerHTML = '
' + + dialogs_tests; + + createActionButton('Beep', function () { + beep(); + }, 'beep'); + + createActionButton('Alert Dialog', function () { + alertDialog('You pressed alert.', 'Alert Dialog', 'Continue'); + }, 'alert'); + + createActionButton('Confirm Dialog - Deprecated', function () { + confirmDialogA('You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe'); + }, 'confirm_deprecated'); + + createActionButton('Confirm Dialog', function () { + confirmDialogB('You pressed confirm.', 'Confirm Dialog', ['Yes', 'No', 'Maybe, Not Sure']); + }, 'confirm'); + + createActionButton('Prompt Dialog', function () { + promptDialog('You pressed prompt.', 'Prompt Dialog', ['Yes', 'No', 'Maybe, Not Sure']); + }, 'prompt'); + + createActionButton('Built-in Alert Dialog', function () { + alert('You pressed alert'); + }, 'built_in_alert'); + + createActionButton('Built-in Confirm Dialog', function () { + confirm('You selected confirm'); + }, 'built_in_confirm'); + + createActionButton('Built-in Prompt Dialog', function () { + prompt('This is a prompt', 'Default value'); + }, 'built_in_prompt'); +}; diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/android/notification.js b/cordova/plugins/org.apache.cordova.dialogs/www/android/notification.js new file mode 100644 index 000000000..8936a5c20 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/www/android/notification.js @@ -0,0 +1,74 @@ +/* + * + * 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/cordova/plugins/org.apache.cordova.dialogs/www/blackberry10/beep.js b/cordova/plugins/org.apache.cordova.dialogs/www/blackberry10/beep.js new file mode 100644 index 000000000..660510770 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/www/blackberry10/beep.js @@ -0,0 +1,42 @@ +/* + * + * 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/cordova/plugins/org.apache.cordova.dialogs/www/blackberry10/notification-beep.wav b/cordova/plugins/org.apache.cordova.dialogs/www/blackberry10/notification-beep.wav new file mode 100644 index 000000000..d0ad085fe Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/blackberry10/notification-beep.wav differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/danger-press.png b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/danger-press.png new file mode 100644 index 000000000..d7529b5bc Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/danger-press.png differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/danger.png b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/danger.png new file mode 100644 index 000000000..400e3ae35 Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/danger.png differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/default.png b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/default.png new file mode 100644 index 000000000..2ff298a1f Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/default.png differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/gradient.png b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/gradient.png new file mode 100644 index 000000000..b2885450b Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/gradient.png differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/notification.css b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/notification.css new file mode 100644 index 000000000..34d92b883 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/notification.css @@ -0,0 +1,248 @@ +/* + * + * 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/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/pattern.png b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/pattern.png new file mode 100644 index 000000000..af03f5690 Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/pattern.png differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/recommend.png b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/recommend.png new file mode 100644 index 000000000..42aed3900 Binary files /dev/null and b/cordova/plugins/org.apache.cordova.dialogs/www/firefoxos/recommend.png differ diff --git a/cordova/plugins/org.apache.cordova.dialogs/www/notification.js b/cordova/plugins/org.apache.cordova.dialogs/www/notification.js new file mode 100644 index 000000000..6bf815c02 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.dialogs/www/notification.js @@ -0,0 +1,111 @@ +/* + * + * 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 == "amazon-fireos" || platform.id == "android" || platform.id == "ios" || platform.id == "windowsphone" || platform.id == "firefoxos" || 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) { + var defaultedCount = count || 1; + exec(null, null, "Notification", "beep", [ defaultedCount ]); + } +}; diff --git a/cordova/plugins/org.apache.cordova.statusbar/.fetch.json b/cordova/plugins/org.apache.cordova.statusbar/.fetch.json new file mode 100644 index 000000000..6e11994e8 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/.fetch.json @@ -0,0 +1 @@ +{"source":{"type":"registry","id":"org.apache.cordova.statusbar"}} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/CONTRIBUTING.md b/cordova/plugins/org.apache.cordova.statusbar/CONTRIBUTING.md new file mode 100644 index 000000000..f7dbcaba7 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/CONTRIBUTING.md @@ -0,0 +1,37 @@ + + +# Contributing to Apache Cordova + +Anyone can contribute to Cordova. And we need your contributions. + +There are multiple ways to contribute: report bugs, improve the docs, and +contribute code. + +For instructions on this, start with the +[contribution overview](http://cordova.apache.org/#contribute). + +The details are explained there, but the important items are: + - Sign and submit an Apache ICLA (Contributor License Agreement). + - Have a Jira issue open that corresponds to your contribution. + - Run the tests so your patch doesn't break existing functionality. + +We look forward to your contributions! diff --git a/cordova/plugins/org.apache.cordova.statusbar/LICENSE b/cordova/plugins/org.apache.cordova.statusbar/LICENSE new file mode 100644 index 000000000..7a4a3ea24 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/LICENSE @@ -0,0 +1,202 @@ + + 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/cordova/plugins/org.apache.cordova.statusbar/NOTICE b/cordova/plugins/org.apache.cordova.statusbar/NOTICE new file mode 100644 index 000000000..8ec56a524 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/NOTICE @@ -0,0 +1,5 @@ +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/cordova/plugins/org.apache.cordova.statusbar/README.md b/cordova/plugins/org.apache.cordova.statusbar/README.md new file mode 100644 index 000000000..8b91de985 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/README.md @@ -0,0 +1,22 @@ + + +# org.apache.cordova.statusbar + +Plugin documentation: [doc/index.md](doc/index.md) \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/RELEASENOTES.md b/cordova/plugins/org.apache.cordova.statusbar/RELEASENOTES.md new file mode 100644 index 000000000..49d306af8 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/RELEASENOTES.md @@ -0,0 +1,53 @@ + +# Release Notes + +### 0.1.5 (Apr 17, 2014) (First release as a core Cordova Plugin) +* CB-6316: Added README.md which point to the new location for docs +* CB-6316: Added license header to the documentation. Added README.md which point to the new location for docs +* CB-6316: Moved StatusBar plugin documentation to docs folder +* CB-6314: [android] Add StatusBar.isVisible support to Android +* CB-6460: Update license headers + +### 0.1.6 (Jun 05, 2014) +* CB-6783 - added StatusBarStyle config preference, updated docs (closes #9) +* CB-6812 Add license +* CB-6491 add CONTRIBUTING.md +* CB-6264 minor formatting issue +* Update docs with recent WP changes, remove 'clear' from the loist of named colors in documentation +* CB-6513 - Statusbar plugin for Android is not compiling + +### 0.1.7 (Aug 06, 2014) +* Add LICENSE and NOTICE +* Update statusbar.js +* Update backgroundColorByHexString function +* ios: Use a persistent callbackId instead of calling sendJs +* CB-6626 ios: Add a JS event for tapping on statusbar +* ios: Fix hide to adjust webview's frame only when status bar is not overlaying webview +* CB-6127 Updated translations for docs +* android: Fix StatusBar.initialize() not running on UI thread + +### 0.1.8 (Sep 17, 2014) +* CB-7549 [StatusBar][iOS 8] Landscape issue +* CB-7486 Remove StatusBarBackgroundColor intial preference (black background) so background will be initially transparent +* Renamed test dir, added nested plugin.xml +* added documentation for manual tests, moved background color test below overlay test +* CB-7195 ported statusbar tests to framework diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/de/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/de/index.md new file mode 100644 index 000000000..4a8e20554 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/de/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> Das `StatusBar` Objekt stellt einige Funktionen zum Anpassen des iOS und Android StatusBar. + +## "Einstellungen" + +#### config.xml + +* **StatusBarOverlaysWebView** (Boolean, der Standardwert ist True). Stellen Sie auf iOS 7 die Statusbar-Overlay oder keine Überlagerung der WebView beim Start. + + + + +* **StatusBarBackgroundColor** (Farbe hex String, der Standardwert ist #000000). Legen Sie auf iOS 7 die Hintergrundfarbe der Statusbar von eine hexadezimale Zeichenfolge (#RRGGBB) beim Start. + + + + +* **StatusBarStyle** (Status Bar-Stil, der Standardwert ist Lightcontent). Legen Sie auf iOS 7 den Status-Bar-Stil. Verfügbaren Optionen Standard, Lightcontent, Blacktranslucent, Blackopaque. + + + + +## Beim Start ausblenden + +Während der Laufzeit können Sie die StatusBar.hide-Funktion unten, aber die StatusBar beim Start der app versteckt werden soll, müssen Sie Ihre app Info.plist Datei ändern. + +Diese beiden Attribute hinzufügen/bearbeiten, wenn nicht vorhanden. Legen Sie **"Statusleiste ist anfangs ausgeblendet"** auf **"YES"** und **"View Controller-basierte Status Bar aussehen"** auf **"NO"**. Wenn Sie es manuell ohne Xcode bearbeiten, werden die Schlüssel und Werte: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## Methoden + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Eigenschaften + +* StatusBar.isVisible + +## Berechtigungen + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +Stellen Sie auf iOS 7 Statusbar überlagern oder nicht überlagert die WebView. + + StatusBar.overlaysWebView(true); + + +## Beschreibung + +Auf iOS 7 zu der Statusbar wie iOS 6 erscheinen auf False festgelegt. Legen Sie die Stil und Hintergrund Farbe entsprechend mit den anderen Funktionen. + +## Unterstützte Plattformen + +* iOS + +## Kleines Beispiel + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +Verwenden Sie die Standard-Statusbar (dunkle Text, für helle Hintergründe). + + StatusBar.styleDefault(); + + +## Unterstützte Plattformen + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +Verwenden Sie die LightContent-Statusbar (heller Text, für dunkle Hintergründe). + + StatusBar.styleLightContent(); + + +## Unterstützte Plattformen + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +Verwenden Sie die BlackTranslucent-Statusbar (heller Text, für dunkle Hintergründe). + + StatusBar.styleBlackTranslucent(); + + +## Unterstützte Plattformen + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +Verwenden Sie die BlackOpaque-Statusbar (heller Text, für dunkle Hintergründe). + + StatusBar.styleBlackOpaque(); + + +## Unterstützte Plattformen + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +Auf iOS 7 Wenn Sie StatusBar.statusBarOverlaysWebView auf False festlegen, können Sie die Hintergrundfarbe der Statusbar von Farbnamen festlegen. + + StatusBar.backgroundColorByName("red"); + + +Unterstützte Farbnamen sind: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## Unterstützte Plattformen + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +Legt die Hintergrundfarbe der Statusbar von eine hexadezimale Zeichenfolge fest. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +CSS-Kurzschrift-Eigenschaften werden ebenfalls unterstützt. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +Auf iOS 7 Wenn Sie StatusBar.statusBarOverlaysWebView auf False festlegen, können Sie die Hintergrundfarbe der Statusbar von eine hexadezimale Zeichenfolge (#RRGGBB) festlegen. + +Auf WP7 und WP8 können Sie auch Werte wie #AARRGGBB, angeben wo AA einen alpha-Wert ist + +## Unterstützte Plattformen + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +Ausblenden der Statusleiste. + + StatusBar.hide(); + + +## Unterstützte Plattformen + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +Zeigt die Statusleiste. + + StatusBar.show(); + + +## Unterstützte Plattformen + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +Lesen Sie diese Eigenschaft, um festzustellen, ob die Statusbar sichtbar oder nicht ist. + + if (StatusBar.isVisible) { + // do something + } + + +## Unterstützte Plattformen + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/es/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/es/index.md new file mode 100644 index 000000000..13a7230fc --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/es/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> El `StatusBar` objeto proporciona algunas funciones para personalizar el iOS y Android StatusBar. + +## Preferencias + +#### config.xml + +* **StatusBarOverlaysWebView** (boolean, true por defecto). En iOS 7, hacer la superposición statusbar o no superponer la WebView al inicio. + + + + +* **StatusBarBackgroundColor** (cadena hexadecimal color, #000000 por defecto). En iOS 7, establecer el color de fondo de la barra de estado por una cadena hexadecimal (#RRGGBB) en el arranque. + + + + +* **StatusBarStyle** (status bar estilo por defecto lightcontent). En iOS 7, definir el estilo de barra de estado. Por defecto las opciones disponibles, lightcontent, blacktranslucent, blackopaque. + + + + +## Escondido en el arranque + +Durante el tiempo de ejecución puede utilizar la función StatusBar.hide abajo, pero si quieres la barra de estado que está escondido en el inicio de la aplicación, se debe modificar el archivo Info.plist de su aplicación. + +Agregar/editar estos dos atributos si no está presente. Defina **"inicialmente se esconde la barra de estado"** a **"YES"** y **"Aparición de vista basado en controlador estatus bar"** a **"NO"**. Si se edita manualmente sin Xcode, las claves y valores son: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## Métodos + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Propiedades + +* StatusBar.isVisible + +## Permisos + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +En iOS 7, hacer la barra de estado superposición o no superponer la vista Web. + + StatusBar.overlaysWebView(true); + + +## Descripción + +En iOS 7, establecida en false para que la barra de estado aparezca como iOS 6. Establece el color de fondo y estilo para utilizar las otras funciones. + +## Plataformas soportadas + +* iOS + +## Ejemplo rápido + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +Utilice la barra de estado por defecto (texto oscuro, para fondos de luz). + + StatusBar.styleDefault(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +Utilice la barra de estado lightContent (texto ligero, para fondos oscuros). + + StatusBar.styleLightContent(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +Utilice la barra de estado blackTranslucent (texto ligero, para fondos oscuros). + + StatusBar.styleBlackTranslucent(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +Utilice la barra de estado blackOpaque (texto ligero, para fondos oscuros). + + StatusBar.styleBlackOpaque(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +En iOS 7, al establecer StatusBar.statusBarOverlaysWebView a false, se puede establecer el color de fondo de la barra de estado nombre del color. + + StatusBar.backgroundColorByName("red"); + + +Nombres de los colores admitidos son: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +Establece el color de fondo de la barra de estado por una cadena hexadecimal. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +Propiedades CSS abreviada también son compatibles. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +En iOS 7, cuando se establece StatusBar.statusBarOverlaysWebView en false, se puede establecer el color de fondo de la barra de estado una cadena hexadecimal (#RRGGBB). + +En WP7 y WP8 también puede especificar valores como #AARRGGBB, donde AA es un valor alfa + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +Ocultar la barra de estado. + + StatusBar.hide(); + + +## Plataformas soportadas + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +Muestra la barra de estado. + + StatusBar.show(); + + +## Plataformas soportadas + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +Lea esta propiedad para ver si la barra de estado es visible o no. + + if (StatusBar.isVisible) { + // do something + } + + +## Plataformas soportadas + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/fr/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/fr/index.md new file mode 100644 index 000000000..28e4e103c --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/fr/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> Le `StatusBar` objet fournit quelques fonctions pour personnaliser les iOS et Android StatusBar. + +## Préférences + +#### config.xml + +* **StatusBarOverlaysWebView** (boolean, la valeur par défaut true). Sur iOS 7, faire la superposition de statusbar ou pas superposition le WebView au démarrage. + + + + +* **StatusBarBackgroundColor** (chaîne hexadécimale de couleur, par défaut, #000000). Sur iOS 7, définir la couleur d'arrière-plan de la barre d'État par une chaîne hexadécimale (#RRGGBB) au démarrage. + + + + +* **StatusBarStyle** (style de barre de statut, par défaut, lightcontent). Sur iOS 7, définir le style de barre de statut. Par défaut les options disponibles, lightcontent, blacktranslucent, blackopaque. + + + + +## Cacher au démarrage + +Pendant l'exécution, vous pouvez utiliser la fonction StatusBar.hide en bas, mais si vous souhaitez que la barre d'État pour être caché au démarrage de l'application, vous devez modifier le fichier Info.plist de votre application. + +Ajouter/modifier ces deux attributs si n'est pas présent. **"Barre d'État est initialement masqué"** la valeur **"** Yes" et **"À l'apparence vue sur contrôleur statut bar"** la valeur **"Non"**. Si vous modifiez manuellement sans Xcode, les clés et les valeurs sont : + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## Méthodes + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Propriétés + +* StatusBar.isVisible + +## Autorisations + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +Sur iOS 7, faire la statusbar superposition ou pas superposer le WebView. + + StatusBar.overlaysWebView(true); + + +## Description + +Sur iOS 7, la valeur false pour afficher la barre d'État comme iOS 6. Définissez la couleur de style et d'arrière-plan en fonction de l'utilisation des autres fonctions. + +## Plates-formes prises en charge + +* iOS + +## Petit exemple + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +Utilisez la barre de statut par défaut (texte sombre, pour les arrière-plans lumineux). + + StatusBar.styleDefault() ; + + +## Plates-formes prises en charge + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +Utilisez la barre d'État lightContent (texte clair, des arrière-plans sombres). + + StatusBar.styleLightContent(); + + +## Plates-formes prises en charge + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +Utilisez la barre d'État blackTranslucent (texte clair, des arrière-plans sombres). + + StatusBar.styleBlackTranslucent(); + + +## Plates-formes prises en charge + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +Utilisez la barre d'État blackOpaque (texte clair, des arrière-plans sombres). + + StatusBar.styleBlackOpaque(); + + +## Plates-formes prises en charge + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +Sur iOS 7, lorsque vous définissez StatusBar.statusBarOverlaysWebView sur false, vous pouvez définir la couleur d'arrière-plan de la barre d'État par nom de couleur. + + StatusBar.backgroundColorByName("red"); + + +Les noms de couleurs prises en charge sont : + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## Plates-formes prises en charge + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +Définit la couleur d'arrière-plan de la barre d'État par une chaîne hexadécimale. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +Propriétés de raccourci CSS sont également pris en charge. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +Sur iOS 7, lorsque vous définissez StatusBar.statusBarOverlaysWebView sur false, vous pouvez définir la couleur d'arrière-plan de la barre d'État par une chaîne hexadécimale (#RRGGBB). + +Sur WP7 et WP8, vous pouvez également spécifier des valeurs comme #AARRGGBB, où AA représente une valeur alpha + +## Plates-formes prises en charge + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +Masquer la barre d'État. + + StatusBar.hide(); + + +## Plates-formes prises en charge + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +Affiche la barre d'État. + + StatusBar.show(); + + +## Plates-formes prises en charge + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +Lire cette propriété afin de voir si la barre d'État est visible ou non. + + if (StatusBar.isVisible) { + // do something + } + + +## Plates-formes prises en charge + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/index.md new file mode 100644 index 000000000..aa773f4aa --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/index.md @@ -0,0 +1,263 @@ + +#org.apache.cordova.statusbar + +StatusBar +====== + +> The `StatusBar` object provides some functions to customize the iOS and Android StatusBar. + + +Preferences +----------- + +#### config.xml + +- __StatusBarOverlaysWebView__ (boolean, defaults to true). On iOS 7, make the statusbar overlay or not overlay the WebView at startup. + + + +- __StatusBarBackgroundColor__ (color hex string, defaults to #000000). On iOS 7, set the background color of the statusbar by a hex string (#RRGGBB) at startup. + + + +- __StatusBarStyle__ (status bar style, defaults to lightcontent). On iOS 7, set the status bar style. Available options default, lightcontent, blacktranslucent, blackopaque. + + + +Hiding at startup +----------- + +During runtime you can use the StatusBar.hide function below, but if you want the StatusBar to be hidden at app startup, you must modify your app's Info.plist file. + +Add/edit these two attributes if not present. Set **"Status bar is initially hidden"** to **"YES"** and set **"View controller-based status bar appearance"** to **"NO"**. If you edit it manually without Xcode, the keys and values are: + + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +Methods +------- + +- StatusBar.overlaysWebView +- StatusBar.styleDefault +- StatusBar.styleLightContent +- StatusBar.styleBlackTranslucent +- StatusBar.styleBlackOpaque +- StatusBar.backgroundColorByName +- StatusBar.backgroundColorByHexString +- StatusBar.hide +- StatusBar.show + +Properties +-------- + +- StatusBar.isVisible + +Permissions +----------- + +#### config.xml + + + + + +StatusBar.overlaysWebView +================= + +On iOS 7, make the statusbar overlay or not overlay the WebView. + + StatusBar.overlaysWebView(true); + +Description +----------- + +On iOS 7, set to false to make the statusbar appear like iOS 6. Set the style and background color to suit using the other functions. + + +Supported Platforms +------------------- + +- iOS + +Quick Example +------------- + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + +StatusBar.styleDefault +================= + +Use the default statusbar (dark text, for light backgrounds). + + StatusBar.styleDefault(); + + +Supported Platforms +------------------- + +- iOS +- Windows Phone 7 +- Windows Phone 8 + +StatusBar.styleLightContent +================= + +Use the lightContent statusbar (light text, for dark backgrounds). + + StatusBar.styleLightContent(); + + +Supported Platforms +------------------- + +- iOS +- Windows Phone 7 +- Windows Phone 8 + +StatusBar.styleBlackTranslucent +================= + +Use the blackTranslucent statusbar (light text, for dark backgrounds). + + StatusBar.styleBlackTranslucent(); + + +Supported Platforms +------------------- + +- iOS +- Windows Phone 7 +- Windows Phone 8 + +StatusBar.styleBlackOpaque +================= + +Use the blackOpaque statusbar (light text, for dark backgrounds). + + StatusBar.styleBlackOpaque(); + + +Supported Platforms +------------------- + +- iOS +- Windows Phone 7 +- Windows Phone 8 + + +StatusBar.backgroundColorByName +================= + +On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by color name. + + StatusBar.backgroundColorByName("red"); + +Supported color names are: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +Supported Platforms +------------------- + +- iOS +- Windows Phone 7 +- Windows Phone 8 + +StatusBar.backgroundColorByHexString +================= + +Sets the background color of the statusbar by a hex string. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + +CSS shorthand properties are also supported. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + +On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by a hex string (#RRGGBB). + +On WP7 and WP8 you can also specify values as #AARRGGBB, where AA is an alpha value + +Supported Platforms +------------------- + +- iOS +- Windows Phone 7 +- Windows Phone 8 + +StatusBar.hide +================= + +Hide the statusbar. + + StatusBar.hide(); + + +Supported Platforms +------------------- + +- iOS +- Android +- Windows Phone 7 +- Windows Phone 8 + +StatusBar.show +================= + +Shows the statusbar. + + StatusBar.show(); + + +Supported Platforms +------------------- + +- iOS +- Android +- Windows Phone 7 +- Windows Phone 8 + + +StatusBar.isVisible +================= + +Read this property to see if the statusbar is visible or not. + + if (StatusBar.isVisible) { + // do something + } + + +Supported Platforms +------------------- + +- iOS +- Android +- Windows Phone 7 +- Windows Phone 8 + + diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/it/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/it/index.md new file mode 100644 index 000000000..b40bcf5ff --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/it/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> Il `StatusBar` oggetto fornisce alcune funzioni per personalizzare l'iOS e Android StatusBar. + +## Preferenze + +#### config.xml + +* **StatusBarOverlaysWebView** (boolean, default è true). IOS 7, rendono la statusbar sovrapposizione o la non sovrapposizione WebView all'avvio. + + + + +* **StatusBarBackgroundColor** (stringa esadecimale colore, predefinito è #000000). IOS 7, impostare il colore di sfondo della barra di stato di una stringa esadecimale (#RRGGBB) all'avvio. + + + + +* **StatusBarStyle** (status bar in stile, default è lightcontent). IOS 7, impostare lo stile di barra di stato. Predefinita di opzioni disponibili, lightcontent, blacktranslucent, blackopaque. + + + + +## Nascondendo all'avvio + +In fase di esecuzione è possibile utilizzare la funzione di StatusBar.hide qui sotto, ma se si desidera che la barra di stato venga nascosta all'avvio di app, è necessario modificare il file info. plist dell'app. + +Aggiungere o modificare questi due attributi, se non presente. Impostare la **"barra di stato è inizialmente nascosto"** a **"YES"** e **"Aspetto di vista basati su controller status bar"** a **"NO"**. Se si modifica manualmente senza Xcode, le chiavi e i valori sono: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## Metodi + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Proprietà + +* StatusBar.isVisible + +## Autorizzazioni + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +IOS 7, rendono la statusbar sovrapposizione o non sovrapporre WebView. + + StatusBar.overlaysWebView(true); + + +## Descrizione + +IOS 7, impostato su false per rendere la barra di stato vengono visualizzati come iOS 6. Impostare il colore di sfondo e stile per soddisfare utilizzando altre funzioni. + +## Piattaforme supportate + +* iOS + +## Esempio rapido + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +Utilizzare la barra di stato predefinito (testo scuro, per sfondi di luce). + + StatusBar.styleDefault(); + + +## Piattaforme supportate + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +Utilizzare la barra di stato lightContent (testo in chiaro, per sfondi scuri). + + StatusBar.styleLightContent(); + + +## Piattaforme supportate + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +Utilizzare la barra di stato blackTranslucent (testo in chiaro, per sfondi scuri). + + StatusBar.styleBlackTranslucent(); + + +## Piattaforme supportate + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +Utilizzare la barra di stato blackOpaque (testo in chiaro, per sfondi scuri). + + StatusBar.styleBlackOpaque(); + + +## Piattaforme supportate + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +IOS 7, quando StatusBar.statusBarOverlaysWebView è impostata su false, è possibile impostare il colore di sfondo della barra di stato con il nome di colore. + + StatusBar.backgroundColorByName("red"); + + +Nomi di colore supportati sono: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## Piattaforme supportate + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +Imposta il colore di sfondo della barra di stato di una stringa esadecimale. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +Proprietà di scrittura stenografica CSS sono supportati anche. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +IOS 7, quando StatusBar.statusBarOverlaysWebView è impostata su false, è possibile impostare il colore di sfondo della barra di stato di una stringa esadecimale (#RRGGBB). + +Su WP7 e WP8 è inoltre possibile specificare i valori come #AARRGGBB, dove AA è un valore alfa + +## Piattaforme supportate + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +Nascondere la barra di stato. + + StatusBar.hide(); + + +## Piattaforme supportate + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +Mostra la barra di stato. + + StatusBar.show(); + + +## Piattaforme supportate + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +Leggere questa proprietà per vedere se la barra di stato è visibile o no. + + if (StatusBar.isVisible) { + // do something + } + + +## Piattaforme supportate + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/ja/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/ja/index.md new file mode 100644 index 000000000..7d6b976b5 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/ja/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> `StatusBar`オブジェクトは、iOS と Android ステータス バーをカスタマイズするいくつかの機能を提供します。 + +## 基本設定 + +#### config.xml + +* **StatusBarOverlaysWebView**(ブール値、デフォルトは true)。IOS 7、起動時にステータスバー オーバーレイまたはないオーバーレイ、WebView を作る。 + + + + +* **StatusBarBackgroundColor**(色 16 進文字列、デフォルトは # 000000)。Ios 7、起動時に 16 進文字列 (#RRGGBB) でステータス バーの背景色を設定します。 + + + + +* **StatusBarStyle**(ステータス バーのスタイル、既定値は lightcontent)。Ios 7、ステータス バーのスタイルを設定します。使用可能なオプションのデフォルト、lightcontent、blacktranslucent、blackopaque。 + + + + +## 起動時に非表示 + +実行時に下に、StatusBar.hide 関数を使用できますが、StatusBar アプリ起動時に非表示にする場合は、アプリの Info.plist ファイルを変更する必要があります。 + +これら 2 つの属性の追加/編集存在しない場合。 **「ステータス バーが非表示最初」** **"YES"**を設定し、 **「ビュー コント ローラー ベースのステータス バーの外観」** **"NO"**にします。 Xcode せず手動で編集する、キーと値は。 + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## メソッド + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## プロパティ + +* StatusBar.isVisible + +## アクセス許可 + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +IOS 7、statusbar オーバーレイまたはない WebView をオーバーレイします。 + + StatusBar.overlaysWebView(true); + + +## 説明 + +IOS 7、iOS の 6 のように表示されるステータスバーを false に設定します。他の関数の使用に合わせてスタイルや背景色を設定します。 + +## サポートされているプラットフォーム + +* iOS + +## 簡単な例 + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +既定ステータス バー (暗いテキスト、淡色の背景) を使用します。 + + StatusBar.styleDefault(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +LightContent ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleLightContent(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +BlackTranslucent ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleBlackTranslucent(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +BlackOpaque ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleBlackOpaque(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +Ios 7、StatusBar.statusBarOverlaysWebView を false に設定する場合はステータスバーの背景色の色の名前によって設定できます。 + + StatusBar.backgroundColorByName("red"); + + +サポートされている色の名前は次のとおりです。 + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +16 進文字列をステータス バーの背景色を設定します。 + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +速記の CSS プロパティもサポートされています。 + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +Ios 7、StatusBar.statusBarOverlaysWebView を false に設定する場合はステータスバーの背景色を 16 進文字列 (#RRGGBB) で設定できます。 + +WP7 と WP8 も指定できます値 #AARRGGBB, AA は、アルファ値として + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +ステータスバーを隠します。 + + StatusBar.hide(); + + +## サポートされているプラットフォーム + +* iOS +* アンドロイド +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +ステータス バーが表示されます。 + + StatusBar.show(); + + +## サポートされているプラットフォーム + +* iOS +* アンドロイド +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +このプロパティ、ステータスバーが表示されるかどうかをお読みください。 + + if (StatusBar.isVisible) { + // do something + } + + +## サポートされているプラットフォーム + +* iOS +* アンドロイド +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/ko/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/ko/index.md new file mode 100644 index 000000000..e30ee891c --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/ko/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> `StatusBar`개체 iOS와 안 드 로이드 상태 표시줄을 사용자 지정 하려면 몇 가지 기능을 제공 합니다. + +## 환경 설정 + +#### config.xml + +* **StatusBarOverlaysWebView** (boolean, 기본값: true)입니다. IOS 7, 시작 시 상태 표시줄 오버레이 또는 WebView 중첩 되지 확인 합니다. + + + + +* **StatusBarBackgroundColor** (색상 16 진수 문자열 기본값: #000000). Ios 7, 시작 시 16 진수 문자열 (#RRGGBB) 상태 표시줄의 배경색을 설정 합니다. + + + + +* **StatusBarStyle** (상태 표시줄 스타일, 기본값: lightcontent). Ios 7, 상태 표시줄 스타일을 설정 합니다. 사용 가능한 옵션 기본, lightcontent, blacktranslucent, blackopaque. + + + + +## 시작 시 숨기기 + +런타임 동안 아래의 StatusBar.hide 함수를 사용할 수 있습니다 하지만 당신이 원하는 응용 프로그램 시작 시 숨겨진 상태 표시줄, 응용 프로그램의 Info.plist 파일 수정 해야 합니다. + +추가 편집이 두 특성이 없는 경우. **"상태 표시줄 처음 숨겨진"** **"YES"** 로 설정 하 고 **"뷰 컨트롤러 기반 상태 표시줄 모양"** **"NO"**로 설정 합니다. Xcode, 열쇠 없이 수동으로 편집 하는 경우 값은: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## 메서드 + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## 속성 + +* StatusBar.isVisible + +## 사용 권한 + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +IOS 7, 오버레이 또는 하지 WebView 중첩 상태 표시줄을 확인 합니다. + + StatusBar.overlaysWebView(true); + + +## 설명 + +7 iOS, iOS 6 처럼 나타나는 상태 표시줄을 false로 설정 합니다. 다른 함수를 사용 하 여에 맞게 스타일과 배경 색상을 설정 합니다. + +## 지원 되는 플랫폼 + +* iOS + +## 빠른 예제 + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +기본 상태 표시줄 (어두운 텍스트, 밝은 배경에 대 한)를 사용 합니다. + + StatusBar.styleDefault(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +LightContent 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleLightContent(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +BlackTranslucent 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleBlackTranslucent(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +BlackOpaque 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleBlackOpaque(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +Ios 7, StatusBar.statusBarOverlaysWebView을 false로 설정 하면 설정할 수 있는 상태 표시줄의 배경색 색상 이름으로. + + StatusBar.backgroundColorByName("red"); + + +지원 되는 색 이름입니다. + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +16 진수 문자열 상태 표시줄의 배경색을 설정합니다. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +CSS 대표 속성 지원 됩니다. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +Ios 7, StatusBar.statusBarOverlaysWebView을 false로 설정 하면 설정할 수 있는 상태 표시줄의 배경색 16 진수 문자열 (#RRGGBB)에 의해. + +WP7 및 WP8에 당신은 또한 #AARRGGBB, AA는 알파 값으로 값을 지정할 수 있습니다. + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +숨기기 상태 표시줄. + + StatusBar.hide(); + + +## 지원 되는 플랫폼 + +* iOS +* 안 드 로이드 +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +상태 표시줄을 표시합니다. + + StatusBar.show(); + + +## 지원 되는 플랫폼 + +* iOS +* 안 드 로이드 +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +이 속성을 상태 표시줄 표시 되는 경우 읽기. + + if (StatusBar.isVisible) { + // do something + } + + +## 지원 되는 플랫폼 + +* iOS +* 안 드 로이드 +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/pl/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/pl/index.md new file mode 100644 index 000000000..af69ebdf0 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/pl/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> `StatusBar`Obiekt zawiera kilka funkcji, aby dostosować iOS i Android StatusBar. + +## Preferencje + +#### config.xml + +* **StatusBarOverlaysWebView** (boolean, domyślnie na wartość true). Na iOS 7 zrobić nakładki stanu lub nie nakładki widoku sieci Web podczas uruchamiania. + + + + +* **StatusBarBackgroundColor** (kolor szesnastkowy ciąg, domyślnie #000000). Na iOS 7 ustawić kolor tła stanu przez ciąg szesnastkowy (#RRGGBB) przy starcie systemu. + + + + +* **StatusBarStyle** (stan styl paska, domyślnie lightcontent.) Na iOS 7 ustawić styl paska stanu. Dostępne opcje domyślne, lightcontent, blacktranslucent, blackopaque. + + + + +## Przy starcie + +Podczas uruchamiania można użyć funkcji StatusBar.hide poniżej, ale jeśli chcesz StatusBar ukryty w uruchamiania aplikacji, należy zmodyfikować plik Info.plist Twojej aplikacji. + +Dodawanie/edycja tych dwóch atrybutów jeśli nie obecny. Ustawianie **"pasek stanu jest początkowo ukryte"** na **"Tak"** i **"Oparte na kontroler stanu paska wygląd"** na **"Nie"**. Jeśli możesz go edytować ręcznie bez Xcode, kluczy i wartości są: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## Metody + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Właściwości + +* StatusBar.isVisible + +## Uprawnienia + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +Na iOS 7 zrobić statusbar nakładki lub nie nakładka widoku sieci Web. + + StatusBar.overlaysWebView(true); + + +## Opis + +Na iOS 7 zestaw do false, aby na pasku stanu pojawia się jak iOS 6. Ustaw kolor tła i styl do korzystania z innych funkcji. + +## Obsługiwane platformy + +* iOS + +## Szybki przykład + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +Użyj domyślnego stanu (ciemny tekst, teł światła). + + StatusBar.styleDefault(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +Użyj lightContent stanu (światło tekst, ciemne tło). + + StatusBar.styleLightContent(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +Użyj blackTranslucent stanu (światło tekst, ciemne tło). + + StatusBar.styleBlackTranslucent(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +Użyj blackOpaque stanu (światło tekst, ciemne tło). + + StatusBar.styleBlackOpaque(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +Na iOS 7 gdy zostanie ustawiona wartość false, StatusBar.statusBarOverlaysWebView można ustawić kolor tła stanu przez nazwę koloru. + + StatusBar.backgroundColorByName("red"); + + +Nazwy kolorów obsługiwane są: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +Ustawia kolor tła stanu przez ciąg szesnastkowy. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +Obsługiwane są również właściwości CSS. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +Na iOS 7 gdy zostanie ustawiona wartość false, StatusBar.statusBarOverlaysWebView można ustawić kolor tła stanu przez ciąg szesnastkowy (#RRGGBB). + +Na WP7 i WP8 można również określić wartości jako #AARRGGBB, gdzie AA jest wartością alfa + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +Ukryj pasek stanu. + + StatusBar.hide(); + + +## Obsługiwane platformy + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +Pokazuje pasek stanu. + + StatusBar.show(); + + +## Obsługiwane platformy + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +Czytać tej właściwość, aby sprawdzić, czy stanu jest widoczne lub nie. + + if (StatusBar.isVisible) { + // do something + } + + +## Obsługiwane platformy + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/ru/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/ru/index.md new file mode 100644 index 000000000..2bb21acb7 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/ru/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> Объект `StatusBar` предоставляет некоторые функции для настройки статусной панели на iOS и Android. + +## Настройки + +#### config.xml + +* **StatusBarOverlaysWebView** (логическое значение, по умолчанию true). В iOS 7 определяет необходимо ли сделать наложение статусной панели на WebView при запуске или нет. + + + + +* **StatusBarBackgroundColor** (шестнадцатеричная строка цвета, значения по умолчанию #000000). На iOS 7 установит цвет фона статусной панели при запуске, на основании шестнадцатеричной строки цвета (#RRGGBB). + + + + +* **StatusBarStyle** (статус бар стиль, по умолчанию lightcontent). На iOS 7 установите стиль строки состояния. Доступные параметры по умолчанию, lightcontent, blacktranslucent, blackopaque. + + + + +## Скрытие при запуске + +Во время выполнения можно использовать функцию StatusBar.hide ниже, но если вы хотите StatusBar быть скрыты при запуске приложения, необходимо изменить файл Info.plist вашего приложения. + +Добавьте/измените эти два атрибута, если они не присутствуют или отличаются от нижеуказанных значений. Установите значение **«Status bar is initially hidden»** равное **«YES»** и установите значение **«View controller-based status bar appearance»** на **«NO»**. Если вы измените его вручную без Xcode, ключи и значения являются следующими: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## Методы + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Свойства + +* StatusBar.isVisible + +## Разрешения + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +На iOS 7 Сделайте statusbar overlay или не поверх WebView. + + StatusBar.overlaysWebView(true); + + +## Описание + +На iOS 7 Установите значение false чтобы сделать statusbar появляются как iOS 6. Задайте стиль и цвет фона в соответствии с использованием других функций. + +## Поддерживаемые платформы + +* iOS + +## Быстрый пример + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +Используйте по умолчанию statusbar (темный текст, для легких стола). + + StatusBar.styleDefault(); + + +## Поддерживаемые платформы + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +Используйте lightContent statusbar (светлый текст, на темном фоне). + + StatusBar.styleLightContent(); + + +## Поддерживаемые платформы + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +Используйте blackTranslucent statusbar (светлый текст, на темном фоне). + + StatusBar.styleBlackTranslucent(); + + +## Поддерживаемые платформы + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +Используйте blackOpaque statusbar (светлый текст, на темном фоне). + + StatusBar.styleBlackOpaque(); + + +## Поддерживаемые платформы + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +На iOS 7 когда StatusBar.statusBarOverlaysWebView присвоено значение false, можно задать цвет фона для объекта statusbar по имени цвета. + + StatusBar.backgroundColorByName("red"); + + +Имена поддерживаемых цветов являются: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## Поддерживаемые платформы + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +Задает цвет фона для объекта statusbar, шестнадцатеричная строка. + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +Также поддерживаются свойства CSS стенографию. + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +На iOS 7 когда StatusBar.statusBarOverlaysWebView присвоено значение false, можно задать цвет фона для объекта statusbar, шестнадцатеричная строка (#RRGGBB). + +На WP7 и WP8 также можно указать значения как #AARRGGBB, где AA — это альфа-значение + +## Поддерживаемые платформы + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +Скройте строку состояния statusbar. + + StatusBar.hide(); + + +## Поддерживаемые платформы + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +Показывает строку состояния statusbar. + + StatusBar.show(); + + +## Поддерживаемые платформы + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +Чтение это свойство, чтобы увидеть, если statusbar является видимым или нет. + + if (StatusBar.isVisible) { + // do something + } + + +## Поддерживаемые платформы + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/doc/zh/index.md b/cordova/plugins/org.apache.cordova.statusbar/doc/zh/index.md new file mode 100644 index 000000000..f2eaadd08 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/doc/zh/index.md @@ -0,0 +1,238 @@ + + +# org.apache.cordova.statusbar + +# StatusBar + +> `StatusBar`物件提供了一些功能,自訂的 iOS 和 Android 狀態列。 + +## 首選項 + +#### config.xml + +* **StatusBarOverlaysWebView**(布林值,預設值為 true)。在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖在啟動時。 + + + + +* **StatusBarBackgroundColor**(顏色十六進位字串,預設值為 #000000)。在 iOS 7,通過一個十六進位字串 (#RRGGBB) 在啟動時設置狀態列的背景色。 + + + + +* **狀態列**(狀態列樣式,預設值為 lightcontent)。在 iOS 7,設置的狀態橫條圖樣式。可用的選項預設,lightcontent,blacktranslucent,blackopaque。 + + + + +## 在啟動時隱藏 + +在運行時期間,你可以使用 StatusBar.hide 函數下面,但如果你想要顯示狀態列隱藏在應用程式啟動時,你必須修改你的應用程式的 Info.plist 檔。 + +添加編輯這兩個屬性,如果不存在。 將**"狀態列最初隱藏"**設置為**"YES"**和**"視圖基於控制器的狀態列外觀"**設置為**"否"**。 如果您手動編輯它沒有 Xcode,鍵和值是: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## 方法 + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## 屬性 + +* StatusBar.isVisible + +## 許可權 + +#### config.xml + + + + + + +# StatusBar.overlaysWebView + +在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖。 + + StatusBar.overlaysWebView(true); + + +## 描述 + +在 iOS 7,設置為 false,使狀態列出現像 iOS 6。設置的樣式和背景的顏色,以適應使用其他函數。 + +## 支援的平臺 + +* iOS + +## 快速的示例 + + StatusBar.overlaysWebView(true); + StatusBar.overlaysWebView(false); + + +# StatusBar.styleDefault + +使用預設狀態列 (淺色背景深色文本)。 + + StatusBar.styleDefault() ; + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleLightContent + +使用 lightContent 狀態列 (光文本,為深色的背景)。 + + StatusBar.styleLightContent(); + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackTranslucent + +使用 blackTranslucent 狀態列 (光文本,為深色的背景)。 + + StatusBar.styleBlackTranslucent(); + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.styleBlackOpaque + +使用 blackOpaque 狀態列 (光文本,為深色的背景)。 + + StatusBar.styleBlackOpaque(); + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByName + +在 iOS 7,當你將 StatusBar.statusBarOverlaysWebView 設置為 false,你可以設置狀態列的背景顏色由顏色名稱。 + + StatusBar.backgroundColorByName("red"); + + +支援的顏色名稱是: + + black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.backgroundColorByHexString + +由十六進位字串設置狀態列的背景色。 + + StatusBar.backgroundColorByHexString("#C0C0C0"); + + +此外支援 CSS 速記屬性。 + + StatusBar.backgroundColorByHexString("#333"); // => #333333 + StatusBar.backgroundColorByHexString("#FAB"); // => #FFAABB + + +在 iOS 7,當你將 StatusBar.statusBarOverlaysWebView 設置為 false,你可以設置狀態列的背景顏色由十六進位字串 (#RRGGBB)。 + +WP7 和 WP8 您還可以指定值為 #AARRGGBB,其中 AA 是 Alpha 值 + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.hide + +隱藏狀態列。 + + StatusBar.hide(); + + +## 支援的平臺 + +* iOS +* 安卓系統 +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.show + +顯示狀態列。 + + StatusBar.show(); + + +## 支援的平臺 + +* iOS +* 安卓系統 +* Windows Phone 7 +* Windows Phone 8 + +# StatusBar.isVisible + +讀取此屬性,以看看是否狀態列是可見的或不。 + + if (StatusBar.isVisible) { + // do something + } + + +## 支援的平臺 + +* iOS +* 安卓系統 +* Windows Phone 7 +* Windows Phone 8 \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/package.json b/cordova/plugins/org.apache.cordova.statusbar/package.json new file mode 100644 index 000000000..08d233513 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/package.json @@ -0,0 +1,24 @@ +{ + "version": "0.1.8", + "name": "org.apache.cordova.statusbar", + "cordova_name": "StatusBar", + "description": "Cordova StatusBar Plugin", + "license": "Apache 2.0", + "keywords": [ + "cordova", + "statusbar" + ], + "platforms": [ + "android", + "ios", + "wp7", + "wp8" + ], + "engines": [ + { + "name": "cordova", + "version": ">=3.0.0" + } + ], + "englishdoc": "\n#org.apache.cordova.statusbar\n\nStatusBar\n======\n\n> The `StatusBar` object provides some functions to customize the iOS and Android StatusBar.\n\n\nPreferences\n-----------\n\n#### config.xml\n\n- __StatusBarOverlaysWebView__ (boolean, defaults to true). On iOS 7, make the statusbar overlay or not overlay the WebView at startup.\n\n \n\n- __StatusBarBackgroundColor__ (color hex string, defaults to #000000). On iOS 7, set the background color of the statusbar by a hex string (#RRGGBB) at startup.\n\n \n\n- __StatusBarStyle__ (status bar style, defaults to lightcontent). On iOS 7, set the status bar style. Available options default, lightcontent, blacktranslucent, blackopaque.\n\n \n\nHiding at startup\n-----------\n\nDuring runtime you can use the StatusBar.hide function below, but if you want the StatusBar to be hidden at app startup, you must modify your app's Info.plist file.\n\nAdd/edit these two attributes if not present. Set **\"Status bar is initially hidden\"** to **\"YES\"** and set **\"View controller-based status bar appearance\"** to **\"NO\"**. If you edit it manually without Xcode, the keys and values are:\n\n\n\tUIStatusBarHidden\n\t\n\tUIViewControllerBasedStatusBarAppearance\n\t\n\n\nMethods\n-------\n\n- StatusBar.overlaysWebView\n- StatusBar.styleDefault\n- StatusBar.styleLightContent\n- StatusBar.styleBlackTranslucent\n- StatusBar.styleBlackOpaque\n- StatusBar.backgroundColorByName\n- StatusBar.backgroundColorByHexString\n- StatusBar.hide\n- StatusBar.show\n\nProperties\n--------\n\n- StatusBar.isVisible\n\nPermissions\n-----------\n\n#### config.xml\n\n \n \n \n\nStatusBar.overlaysWebView\n=================\n\nOn iOS 7, make the statusbar overlay or not overlay the WebView.\n\n StatusBar.overlaysWebView(true);\n\nDescription\n-----------\n\nOn iOS 7, set to false to make the statusbar appear like iOS 6. Set the style and background color to suit using the other functions.\n\n\nSupported Platforms\n-------------------\n\n- iOS\n\nQuick Example\n-------------\n\n StatusBar.overlaysWebView(true);\n StatusBar.overlaysWebView(false);\n\nStatusBar.styleDefault\n=================\n\nUse the default statusbar (dark text, for light backgrounds).\n\n StatusBar.styleDefault();\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Windows Phone 7\n- Windows Phone 8\n\nStatusBar.styleLightContent\n=================\n\nUse the lightContent statusbar (light text, for dark backgrounds).\n\n StatusBar.styleLightContent();\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Windows Phone 7\n- Windows Phone 8\n\nStatusBar.styleBlackTranslucent\n=================\n\nUse the blackTranslucent statusbar (light text, for dark backgrounds).\n\n StatusBar.styleBlackTranslucent();\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Windows Phone 7\n- Windows Phone 8\n\nStatusBar.styleBlackOpaque\n=================\n\nUse the blackOpaque statusbar (light text, for dark backgrounds).\n\n StatusBar.styleBlackOpaque();\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Windows Phone 7\n- Windows Phone 8\n\n\nStatusBar.backgroundColorByName\n=================\n\nOn iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by color name.\n\n StatusBar.backgroundColorByName(\"red\");\n\nSupported color names are:\n\n black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Windows Phone 7\n- Windows Phone 8\n\nStatusBar.backgroundColorByHexString\n=================\n\nSets the background color of the statusbar by a hex string.\n\n StatusBar.backgroundColorByHexString(\"#C0C0C0\");\n\nCSS shorthand properties are also supported.\n\n StatusBar.backgroundColorByHexString(\"#333\"); // => #333333\n StatusBar.backgroundColorByHexString(\"#FAB\"); // => #FFAABB\n\nOn iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, you can set the background color of the statusbar by a hex string (#RRGGBB).\n\nOn WP7 and WP8 you can also specify values as #AARRGGBB, where AA is an alpha value\n\nSupported Platforms\n-------------------\n\n- iOS\n- Windows Phone 7\n- Windows Phone 8\n\nStatusBar.hide\n=================\n\nHide the statusbar.\n\n StatusBar.hide();\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Android\n- Windows Phone 7\n- Windows Phone 8\n\nStatusBar.show\n=================\n\nShows the statusbar.\n\n StatusBar.show();\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Android\n- Windows Phone 7\n- Windows Phone 8\n\n\nStatusBar.isVisible\n=================\n\nRead this property to see if the statusbar is visible or not.\n\n if (StatusBar.isVisible) {\n \t// do something\n }\n\n\nSupported Platforms\n-------------------\n\n- iOS\n- Android\n- Windows Phone 7\n- Windows Phone 8\n\n\n" +} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/plugin.xml b/cordova/plugins/org.apache.cordova.statusbar/plugin.xml new file mode 100644 index 000000000..5a3459555 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/plugin.xml @@ -0,0 +1,85 @@ + + + + + StatusBar + Cordova StatusBar Plugin + Apache 2.0 + cordova,statusbar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cordova/plugins/org.apache.cordova.statusbar/src/android/StatusBar.java b/cordova/plugins/org.apache.cordova.statusbar/src/android/StatusBar.java new file mode 100644 index 000000000..e4f748f9d --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/src/android/StatusBar.java @@ -0,0 +1,101 @@ +/* + * 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.statusbar; + +import android.app.Activity; +import android.util.Log; +import android.view.Window; +import android.view.WindowManager; + +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaArgs; +import org.apache.cordova.CordovaInterface; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.PluginResult; +import org.json.JSONException; + +public class StatusBar extends CordovaPlugin { + private static final String TAG = "StatusBar"; + + /** + * Sets the context of the Command. This can then be used to do things like + * get file paths associated with the Activity. + * + * @param cordova The context of the main Activity. + * @param webView The CordovaWebView Cordova is running in. + */ + @Override + public void initialize(final CordovaInterface cordova, CordovaWebView webView) { + Log.v(TAG, "StatusBar: initialization"); + super.initialize(cordova, webView); + + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially + // by the Cordova. + Window window = cordova.getActivity().getWindow(); + window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + } + }); + } + + /** + * Executes the request and returns PluginResult. + * + * @param action The action to execute. + * @param args JSONArry of arguments for the plugin. + * @param callbackContext The callback id used when calling back into JavaScript. + * @return True if the action was valid, false otherwise. + */ + @Override + public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { + Log.v(TAG, "Executing action: " + action); + final Activity activity = this.cordova.getActivity(); + final Window window = activity.getWindow(); + if ("_ready".equals(action)) { + boolean statusBarVisible = (window.getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == 0; + callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, statusBarVisible)); + } + + if ("show".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + }); + return true; + } + + if ("hide".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + }); + return true; + } + + return false; + } +} diff --git a/cordova/plugins/org.apache.cordova.statusbar/src/ios/CDVStatusBar.h b/cordova/plugins/org.apache.cordova.statusbar/src/ios/CDVStatusBar.h new file mode 100644 index 000000000..84f37fa7d --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/src/ios/CDVStatusBar.h @@ -0,0 +1,49 @@ +/* + 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 +#import + +@interface CDVStatusBar : CDVPlugin { + @protected + BOOL _statusBarOverlaysWebView; + UIView* _statusBarBackgroundView; + BOOL _uiviewControllerBasedStatusBarAppearance; + UIColor* _statusBarBackgroundColor; + NSString* _eventsCallbackId; +} + +@property (atomic, assign) BOOL statusBarOverlaysWebView; + +- (void) overlaysWebView:(CDVInvokedUrlCommand*)command; + +- (void) styleDefault:(CDVInvokedUrlCommand*)command; +- (void) styleLightContent:(CDVInvokedUrlCommand*)command; +- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command; +- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command; + +- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command; +- (void) backgroundColorByHexString:(CDVInvokedUrlCommand*)command; + +- (void) hide:(CDVInvokedUrlCommand*)command; +- (void) show:(CDVInvokedUrlCommand*)command; + +- (void) _ready:(CDVInvokedUrlCommand*)command; + +@end diff --git a/cordova/plugins/org.apache.cordova.statusbar/src/ios/CDVStatusBar.m b/cordova/plugins/org.apache.cordova.statusbar/src/ios/CDVStatusBar.m new file mode 100644 index 000000000..e39424def --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/src/ios/CDVStatusBar.m @@ -0,0 +1,459 @@ +/* + 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. + */ + +/* + NOTE: plugman/cordova cli should have already installed this, + but you need the value UIViewControllerBasedStatusBarAppearance + in your Info.plist as well to set the styles in iOS 7 + */ + +#import "CDVStatusBar.h" +#import +#import + +static const void *kHideStatusBar = &kHideStatusBar; +static const void *kStatusBarStyle = &kStatusBarStyle; + +@interface CDVViewController (StatusBar) + +@property (nonatomic, retain) id sb_hideStatusBar; +@property (nonatomic, retain) id sb_statusBarStyle; + +@end + +@implementation CDVViewController (StatusBar) + +@dynamic sb_hideStatusBar; +@dynamic sb_statusBarStyle; + +- (id)sb_hideStatusBar { + return objc_getAssociatedObject(self, kHideStatusBar); +} + +- (void)setSb_hideStatusBar:(id)newHideStatusBar { + objc_setAssociatedObject(self, kHideStatusBar, newHideStatusBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (id)sb_statusBarStyle { + return objc_getAssociatedObject(self, kStatusBarStyle); +} + +- (void)setSb_statusBarStyle:(id)newStatusBarStyle { + objc_setAssociatedObject(self, kStatusBarStyle, newStatusBarStyle, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL) prefersStatusBarHidden { + return [self.sb_hideStatusBar boolValue]; +} + +- (UIStatusBarStyle)preferredStatusBarStyle +{ + return (UIStatusBarStyle)[self.sb_statusBarStyle intValue]; +} + +@end + + +@interface CDVStatusBar () +- (void)fireTappedEvent; +- (void)updateIsVisible:(BOOL)visible; +@end + +@implementation CDVStatusBar + +- (id)settingForKey:(NSString*)key +{ + return [self.commandDelegate.settings objectForKey:[key lowercaseString]]; +} + +- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context +{ + if ([keyPath isEqual:@"statusBarHidden"]) { + NSNumber* newValue = [change objectForKey:NSKeyValueChangeNewKey]; + [self updateIsVisible:![newValue boolValue]]; + } +} + +- (void)pluginInitialize +{ + BOOL isiOS7 = (IsAtLeastiOSVersion(@"7.0")); + + // init + NSNumber* uiviewControllerBasedStatusBarAppearance = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"]; + _uiviewControllerBasedStatusBarAppearance = (uiviewControllerBasedStatusBarAppearance == nil || [uiviewControllerBasedStatusBarAppearance boolValue]) && isiOS7; + + // observe the statusBarHidden property + [[UIApplication sharedApplication] addObserver:self forKeyPath:@"statusBarHidden" options:NSKeyValueObservingOptionNew context:NULL]; + + _statusBarOverlaysWebView = YES; // default + + [self initializeStatusBarBackgroundView]; + + self.viewController.view.autoresizesSubviews = YES; + + NSString* setting; + + setting = @"StatusBarOverlaysWebView"; + if ([self settingForKey:setting]) { + self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue]; + } + + setting = @"StatusBarBackgroundColor"; + if ([self settingForKey:setting]) { + [self _backgroundColorByHexString:[self settingForKey:setting]]; + } + + setting = @"StatusBarStyle"; + if ([self settingForKey:setting]) { + [self setStatusBarStyle:[self settingForKey:setting]]; + } + + // blank scroll view to intercept status bar taps + self.webView.scrollView.scrollsToTop = NO; + UIScrollView *fakeScrollView = [[UIScrollView alloc] initWithFrame:UIScreen.mainScreen.bounds]; + fakeScrollView.delegate = self; + fakeScrollView.scrollsToTop = YES; + [self.viewController.view addSubview:fakeScrollView]; // Add scrollview to the view heirarchy so that it will begin accepting status bar taps + [self.viewController.view sendSubviewToBack:fakeScrollView]; // Send it to the very back of the view heirarchy + fakeScrollView.contentSize = CGSizeMake(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height * 2.0f); // Make the scroll view longer than the screen itself + fakeScrollView.contentOffset = CGPointMake(0.0f, UIScreen.mainScreen.bounds.size.height); // Scroll down so a tap will take scroll view back to the top +} + +- (void)onReset { + _eventsCallbackId = nil; +} + +- (void)fireTappedEvent { + if (_eventsCallbackId == nil) { + return; + } + NSDictionary* payload = @{@"type": @"tap"}; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:payload]; + [result setKeepCallbackAsBool:YES]; + [self.commandDelegate sendPluginResult:result callbackId:_eventsCallbackId]; +} + +- (void)updateIsVisible:(BOOL)visible { + if (_eventsCallbackId == nil) { + return; + } + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:visible]; + [result setKeepCallbackAsBool:YES]; + [self.commandDelegate sendPluginResult:result callbackId:_eventsCallbackId]; +} + + +- (void) _ready:(CDVInvokedUrlCommand*)command +{ + _eventsCallbackId = command.callbackId; + [self updateIsVisible:![UIApplication sharedApplication].statusBarHidden]; +} + +- (void) initializeStatusBarBackgroundView +{ + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation) && !IsAtLeastiOSVersion(@"8.0")) { + // swap width and height. set origin to zero + statusBarFrame = CGRectMake(0, 0, statusBarFrame.size.height, statusBarFrame.size.width); + } + + _statusBarBackgroundView = [[UIView alloc] initWithFrame:statusBarFrame]; + _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor; + _statusBarBackgroundView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin); + _statusBarBackgroundView.autoresizesSubviews = YES; +} + +- (void) setStatusBarOverlaysWebView:(BOOL)statusBarOverlaysWebView +{ + // we only care about the latest iOS version or a change in setting + if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) { + return; + } + + CGRect bounds = [[UIScreen mainScreen] bounds]; + + if (statusBarOverlaysWebView) { + + [_statusBarBackgroundView removeFromSuperview]; + if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) { + self.webView.frame = CGRectMake(0, 0, bounds.size.height, bounds.size.width); + } else { + self.webView.frame = bounds; + } + + } else { + + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + + [self initializeStatusBarBackgroundView]; + + CGRect frame = self.webView.frame; + + if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation) && !IsAtLeastiOSVersion(@"8.0")) { + frame.origin.y = statusBarFrame.size.width; + frame.size.height -= statusBarFrame.size.width; + } else { + frame.origin.y = statusBarFrame.size.height; + frame.size.height -= statusBarFrame.size.height; + } + + self.webView.frame = frame; + [self.webView.superview addSubview:_statusBarBackgroundView]; + } + + _statusBarOverlaysWebView = statusBarOverlaysWebView; +} + +- (BOOL) statusBarOverlaysWebView +{ + return _statusBarOverlaysWebView; +} + +- (void) overlaysWebView:(CDVInvokedUrlCommand*)command +{ + id value = [command.arguments objectAtIndex:0]; + if (!([value isKindOfClass:[NSNumber class]])) { + value = [NSNumber numberWithBool:YES]; + } + + self.statusBarOverlaysWebView = [value boolValue]; +} + +- (void) refreshStatusBarAppearance +{ + SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate"); + if ([self.viewController respondsToSelector:sel]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [self.viewController performSelector:sel withObject:nil]; +#pragma clang diagnostic pop + } +} + +- (void) setStyleForStatusBar:(UIStatusBarStyle)style +{ + if (_uiviewControllerBasedStatusBarAppearance) { + CDVViewController* vc = (CDVViewController*)self.viewController; + vc.sb_statusBarStyle = [NSNumber numberWithInt:style]; + [self refreshStatusBarAppearance]; + + } else { + [[UIApplication sharedApplication] setStatusBarStyle:style]; + } +} + +- (void) setStatusBarStyle:(NSString*)statusBarStyle +{ + // default, lightContent, blackTranslucent, blackOpaque + NSString* lcStatusBarStyle = [statusBarStyle lowercaseString]; + + if ([lcStatusBarStyle isEqualToString:@"default"]) { + [self styleDefault:nil]; + } else if ([lcStatusBarStyle isEqualToString:@"lightcontent"]) { + [self styleLightContent:nil]; + } else if ([lcStatusBarStyle isEqualToString:@"blacktranslucent"]) { + [self styleBlackTranslucent:nil]; + } else if ([lcStatusBarStyle isEqualToString:@"blackopaque"]) { + [self styleBlackOpaque:nil]; + } +} + +- (void) styleDefault:(CDVInvokedUrlCommand*)command +{ + [self setStyleForStatusBar:UIStatusBarStyleDefault]; +} + +- (void) styleLightContent:(CDVInvokedUrlCommand*)command +{ + [self setStyleForStatusBar:UIStatusBarStyleLightContent]; +} + +- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command +{ + [self setStyleForStatusBar:UIStatusBarStyleBlackTranslucent]; +} + +- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command +{ + [self setStyleForStatusBar:UIStatusBarStyleBlackOpaque]; +} + +- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command +{ + id value = [command.arguments objectAtIndex:0]; + if (!([value isKindOfClass:[NSString class]])) { + value = @"black"; + } + + SEL selector = NSSelectorFromString([value stringByAppendingString:@"Color"]); + if ([UIColor respondsToSelector:selector]) { + _statusBarBackgroundView.backgroundColor = [UIColor performSelector:selector]; + } +} + +- (void) _backgroundColorByHexString:(NSString*)hexString +{ + unsigned int rgbValue = 0; + NSScanner* scanner = [NSScanner scannerWithString:hexString]; + [scanner setScanLocation:1]; + [scanner scanHexInt:&rgbValue]; + + _statusBarBackgroundColor = [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0]; + _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor; +} + +- (void) backgroundColorByHexString:(CDVInvokedUrlCommand*)command +{ + NSString* value = [command.arguments objectAtIndex:0]; + if (!([value isKindOfClass:[NSString class]])) { + value = @"#000000"; + } + + if (![value hasPrefix:@"#"] || [value length] < 7) { + return; + } + + [self _backgroundColorByHexString:value]; +} + +- (void) hideStatusBar +{ + if (_uiviewControllerBasedStatusBarAppearance) { + CDVViewController* vc = (CDVViewController*)self.viewController; + vc.sb_hideStatusBar = [NSNumber numberWithBool:YES]; + [self refreshStatusBarAppearance]; + + } else { + UIApplication* app = [UIApplication sharedApplication]; + [app setStatusBarHidden:YES]; + } +} + +- (void) hide:(CDVInvokedUrlCommand*)command +{ + UIApplication* app = [UIApplication sharedApplication]; + + if (!app.isStatusBarHidden) + { + self.viewController.wantsFullScreenLayout = YES; + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + + [self hideStatusBar]; + + if (IsAtLeastiOSVersion(@"7.0")) { + [_statusBarBackgroundView removeFromSuperview]; + } + + if (!_statusBarOverlaysWebView) { + + CGRect frame = self.webView.frame; + frame.origin.y = 0; + if (!self.statusBarOverlaysWebView) { + if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) { + frame.size.height += statusBarFrame.size.width; + } else { + frame.size.height += statusBarFrame.size.height; + } + } + + self.webView.frame = frame; + } + + _statusBarBackgroundView.hidden = YES; + } +} + +- (void) showStatusBar +{ + if (_uiviewControllerBasedStatusBarAppearance) { + CDVViewController* vc = (CDVViewController*)self.viewController; + vc.sb_hideStatusBar = [NSNumber numberWithBool:NO]; + [self refreshStatusBarAppearance]; + + } else { + UIApplication* app = [UIApplication sharedApplication]; + [app setStatusBarHidden:NO]; + } +} + +- (void) show:(CDVInvokedUrlCommand*)command +{ + UIApplication* app = [UIApplication sharedApplication]; + + if (app.isStatusBarHidden) + { + BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0")); + self.viewController.wantsFullScreenLayout = isIOS7; + + [self showStatusBar]; + + if (isIOS7) { + CGRect frame = self.webView.frame; + self.viewController.view.frame = [[UIScreen mainScreen] bounds]; + + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + + if (!self.statusBarOverlaysWebView) { + + // there is a possibility that when the statusbar was hidden, it was in a different orientation + // from the current one. Therefore we need to expand the statusBarBackgroundView as well to the + // statusBar's current size + CGRect sbBgFrame = _statusBarBackgroundView.frame; + + if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) { + frame.origin.y = statusBarFrame.size.width; + frame.size.height -= statusBarFrame.size.width; + sbBgFrame.size = CGSizeMake(statusBarFrame.size.height, statusBarFrame.size.width); + } else { + frame.origin.y = statusBarFrame.size.height; + frame.size.height -= statusBarFrame.size.height; + sbBgFrame.size = statusBarFrame.size; + } + + _statusBarBackgroundView.frame = sbBgFrame; + [self.webView.superview addSubview:_statusBarBackgroundView]; + } + + self.webView.frame = frame; + + } else { + + CGRect bounds = [[UIScreen mainScreen] applicationFrame]; + self.viewController.view.frame = bounds; + } + + _statusBarBackgroundView.hidden = NO; + } +} + +- (void) dealloc +{ + [[UIApplication sharedApplication] removeObserver:self forKeyPath:@"statusBarHidden"]; +} + + +#pragma mark - UIScrollViewDelegate + +- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView +{ + [self fireTappedEvent]; + return NO; +} + +@end diff --git a/cordova/plugins/org.apache.cordova.statusbar/src/wp/StatusBar.cs b/cordova/plugins/org.apache.cordova.statusbar/src/wp/StatusBar.cs new file mode 100644 index 000000000..ec83ca8ea --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/src/wp/StatusBar.cs @@ -0,0 +1,141 @@ +/* + 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 Microsoft.Phone.Shell; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Threading; +using System.Windows; +using System.Windows.Media; +using System.Windows.Threading; + + +/* + * http://www.idev101.com/code/User_Interface/StatusBar.html + * https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/Bars.html + * https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplication_Class/Reference/Reference.html#//apple_ref/c/econst/UIStatusBarStyleDefault + * */ + + +namespace WPCordovaClassLib.Cordova.Commands +{ + public class StatusBar : BaseCommand + { + + // returns an argb value, if the hex is only rgb, it will be full opacity + protected Color ColorFromHex(string hexString) + { + string cleanHex = hexString.Replace("#", "").Replace("0x", ""); + // turn #FFF into #FFFFFF + if (cleanHex.Length == 3) + { + cleanHex = "" + cleanHex[0] + cleanHex[0] + cleanHex[1] + cleanHex[1] + cleanHex[2] + cleanHex[2]; + } + // add an alpha 100% if it is missing + if (cleanHex.Length == 6) + { + cleanHex = "FF" + cleanHex; + } + int argb = Int32.Parse(cleanHex, NumberStyles.HexNumber); + Color clr = Color.FromArgb((byte)((argb & 0xff000000) >> 0x18), + (byte)((argb & 0xff0000) >> 0x10), + (byte)((argb & 0xff00) >> 8), + (byte)(argb & 0xff)); + return clr; + } + + public void _ready(string options) + { + Deployment.Current.Dispatcher.BeginInvoke(() => + { + bool isVis = SystemTray.IsVisible; + // TODO: pass this to JS + //Debug.WriteLine("Result::" + res); + DispatchCommandResult(new PluginResult(PluginResult.Status.OK, isVis)); + }); + } + + public void overlaysWebView(string options) + { //exec(null, null, "StatusBar", "overlaysWebView", [doOverlay]); + // string arg = JSON.JsonHelper.Deserialize(options)[0]; + } + + public void styleDefault(string options) + { //exec(null, null, "StatusBar", "styleDefault", []); + Deployment.Current.Dispatcher.BeginInvoke(() => + { + SystemTray.ForegroundColor = Colors.Black; + }); + } + + public void styleLightContent(string options) + { //exec(null, null, "StatusBar", "styleLightContent", []); + + Deployment.Current.Dispatcher.BeginInvoke(() => + { + SystemTray.ForegroundColor = Colors.White; + }); + } + + public void styleBlackTranslucent(string options) + { //exec(null, null, "StatusBar", "styleBlackTranslucent", []); + styleLightContent(options); + } + + public void styleBlackOpaque(string options) + { //exec(null, null, "StatusBar", "styleBlackOpaque", []); + styleLightContent(options); + } + + public void backgroundColorByName(string options) + { //exec(null, null, "StatusBar", "backgroundColorByName", [colorname]); + // this should NOT be called, js should now be using/converting color names to hex + } + + public void backgroundColorByHexString(string options) + { //exec(null, null, "StatusBar", "backgroundColorByHexString", [hexString]); + string argb = JSON.JsonHelper.Deserialize(options)[0]; + + Color clr = ColorFromHex(argb); + + Deployment.Current.Dispatcher.BeginInvoke(() => + { + SystemTray.Opacity = clr.A / 255.0d; + SystemTray.BackgroundColor = clr; + + }); + } + + public void hide(string options) + { //exec(null, null, "StatusBar", "hide", []); + Deployment.Current.Dispatcher.BeginInvoke(() => + { + SystemTray.IsVisible = false; + }); + + } + + public void show(string options) + { //exec(null, null, "StatusBar", "show", []); + Deployment.Current.Dispatcher.BeginInvoke(() => + { + SystemTray.IsVisible = true; + }); + } + } +} \ No newline at end of file diff --git a/cordova/plugins/org.apache.cordova.statusbar/tests/plugin.xml b/cordova/plugins/org.apache.cordova.statusbar/tests/plugin.xml new file mode 100644 index 000000000..065c90ae2 --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/tests/plugin.xml @@ -0,0 +1,31 @@ + + + + + Cordova StatusBar Plugin Tests + Apache 2.0 + + + + diff --git a/cordova/plugins/org.apache.cordova.statusbar/tests/tests.js b/cordova/plugins/org.apache.cordova.statusbar/tests/tests.js new file mode 100644 index 000000000..8b409ecaf --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/tests/tests.js @@ -0,0 +1,107 @@ +/* + * + * 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. + * +*/ + +exports.defineManualTests = function (contentEl, createActionButton) { + function log(msg) { + var el = document.getElementById("info"); + var logLine = document.createElement('div'); + logLine.innerHTML = msg; + el.appendChild(logLine); + } + + function doShow() { + StatusBar.show(); + log('StatusBar.isVisible=' + StatusBar.isVisible); + } + + function doHide() { + StatusBar.hide(); + log('StatusBar.isVisible=' + StatusBar.isVisible); + } + + function doColor1() { + log('set color=red'); + StatusBar.backgroundColorByName('red'); + } + + function doColor2() { + log('set style=translucent black'); + StatusBar.styleBlackTranslucent(); + } + + function doColor3() { + log('set style=default'); + StatusBar.styleDefault(); + } + + var showOverlay = true; + function doOverlay() { + showOverlay = !showOverlay; + StatusBar.overlaysWebView(showOverlay); + log('Set overlay=' + showOverlay); + } + + /******************************************************************************/ + + contentEl.innerHTML = '
' + + 'Also: tapping bar on iOS should emit a log.' + + '
' + + 'Expected result: Status bar will be visible' + + '

' + + 'Expected result: Status bar will be hidden' + + '

' + + 'Expected result: Status bar text will be a light (white) color' + + '

' + + 'Expected result: Status bar text will be a dark (black) color' + + '

' + + 'Expected result:
Overlay true = status bar will lay on top of web view content
Overlay false = status bar will be separate from web view and will not cover content' + + '

' + + 'Expected result: If overlay false, background color for status bar will be red'; + + log('StatusBar.isVisible=' + StatusBar.isVisible); + window.addEventListener('statusTap', function () { + log('tap!'); + }, false); + + createActionButton("Show", function () { + doShow(); + }, 'action-show'); + + createActionButton("Hide", function () { + doHide(); + }, 'action-hide'); + + createActionButton("Style=red (background)", function () { + doColor1(); + }, 'action-color1'); + + createActionButton("Style=translucent black", function () { + doColor2(); + }, 'action-color2'); + + createActionButton("Style=default", function () { + doColor3(); + }, 'action-color3'); + + createActionButton("Toggle Overlays", function () { + doOverlay(); + }, 'action-overlays'); +}; diff --git a/cordova/plugins/org.apache.cordova.statusbar/www/statusbar.js b/cordova/plugins/org.apache.cordova.statusbar/www/statusbar.js new file mode 100644 index 000000000..d6f68acce --- /dev/null +++ b/cordova/plugins/org.apache.cordova.statusbar/www/statusbar.js @@ -0,0 +1,109 @@ +/* + * + * 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 namedColors = { + "black": "#000000", + "darkGray": "#A9A9A9", + "lightGray": "#D3D3D3", + "white": "#FFFFFF", + "gray": "#808080", + "red": "#FF0000", + "green": "#00FF00", + "blue": "#0000FF", + "cyan": "#00FFFF", + "yellow": "#FFFF00", + "magenta": "#FF00FF", + "orange": "##FFA500", + "purple": "#800080", + "brown": "#A52A2A" +}; + +var StatusBar = { + + isVisible: true, + + overlaysWebView: function (doOverlay) { + exec(null, null, "StatusBar", "overlaysWebView", [doOverlay]); + }, + + styleDefault: function () { + // dark text ( to be used on a light background ) + exec(null, null, "StatusBar", "styleDefault", []); + }, + + styleLightContent: function () { + // light text ( to be used on a dark background ) + exec(null, null, "StatusBar", "styleLightContent", []); + }, + + styleBlackTranslucent: function () { + // #88000000 ? Apple says to use lightContent instead + exec(null, null, "StatusBar", "styleBlackTranslucent", []); + }, + + styleBlackOpaque: function () { + // #FF000000 ? Apple says to use lightContent instead + exec(null, null, "StatusBar", "styleBlackOpaque", []); + }, + + backgroundColorByName: function (colorname) { + return StatusBar.backgroundColorByHexString(namedColors[colorname]); + }, + + backgroundColorByHexString: function (hexString) { + if (hexString.charAt(0) !== "#") { + hexString = "#" + hexString; + } + + if (hexString.length === 4) { + var split = hexString.split(""); + hexString = "#" + split[1] + split[1] + split[2] + split[2] + split[3] + split[3]; + } + + exec(null, null, "StatusBar", "backgroundColorByHexString", [hexString]); + }, + + hide: function () { + exec(null, null, "StatusBar", "hide", []); + StatusBar.isVisible = false; + }, + + show: function () { + exec(null, null, "StatusBar", "show", []); + StatusBar.isVisible = true; + } + +}; + +// prime it +exec(function (res) { + if (typeof res == 'object') { + if (res.type == 'tap') { + cordova.fireWindowEvent('statusTap'); + } + } else { + StatusBar.isVisible = res; + } +}, null, "StatusBar", "_ready", []); + +module.exports = StatusBar; diff --git a/cordova/www b/cordova/www new file mode 120000 index 000000000..1feac97f4 --- /dev/null +++ b/cordova/www @@ -0,0 +1 @@ +../demo/src/main/webapp \ No newline at end of file diff --git a/demo/.settings/.jsdtscope b/demo/.settings/.jsdtscope new file mode 100644 index 000000000..2e64ef291 --- /dev/null +++ b/demo/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/demo/README.html b/demo/README.html new file mode 100644 index 000000000..9af1d6628 --- /dev/null +++ b/demo/README.html @@ -0,0 +1,197 @@ +README +

TicketMonster - a JBoss example

+ +

TicketMonster is an online ticketing demo application that gets you started with JBoss technologies, and helps you learn and evaluate them.

+ +

Here are a few instructions for building and running it. You can learn more about the example from the tutorial.

+ +

Updating the Performance dates

+ +

NOTE: This step is optional. It is necessary only if you want to update the dates of the Performances in the import.sql script in an automated manner. Updating the performance dates ensure that they are always set to some timestamp in the future, and ensures that all performances are visible in the Monitor section of the TicketMonster application.

+ +
    +
  1. Run the update_import_sql Perl script. You’ll need the DateTime, DateTime::Format::Strptime and Tie::File Perl modules. These are usually available by default in your Perl installation.

    +
    $ perl update_import_sql.pl src/main/resources/import.sql
    +
  2. +
+ +

Generating the administration site

+ +

NOTE: This step is optional. The administration site is already present in the source code. If you want to regenerate it from Forge, and apply the changes outlined in the tutorial, you may continue to follow the steps outlined here. Otherwise, you can skip this step and proceed to build TicketMonster.

+ +

Before building and running TicketMonster, you must generate the administration site with Forge.

+ +
    +
  1. Ensure that you have JBoss Forge installed. The current version of TicketMonster supports version 2.6.0.Final or higher of JBoss Forge. JBoss Developer Studio 8 is recommended, since it contains JBoss Forge 2 with all the necessary plugins for the TicketMonster app.

  2. +
  3. Start the JBoss Forge console in JBoss Developer Studio. This can be done from the Forge Console view. If the view is not already visible, it can be opened through the ‘Window’ menu: Window -> Show View -> Other…. Select the ‘Forge Console’ item in the dialog to open the Forge Console. Click the Start button in the Forge Console tab, to start Forge.

  4. +
  5. From the JBoss Forge prompt, browse to the ‘demo’ directory of the TicketMonster sources and execute the script for generating the administration site

    +
    $ cd ticket-monster/demo
    +$ run admin_layer.fsh
    +
    +

    The git patches need to be applied manually. Both the patches are located in the patches sub-directory. To apply the manual changes, first apply the patch located in file admin_layer_functional.patch. Then perform the same for the file admin_layer_graphics.patch if you want to apply the style changes for the generated administration site. You can do so in JBoss Developer Studio, by opening the context-menu on the project (Right-click on the project) and then apply a git patch via Team -> Apply Patch…. Locate the patch file in the Workspace, select it and click the ‘Next’ button. In the next dialog, select to apply the patch on the ‘ticket-monster’ project in the workspace. Click Finish in the final page of the wizard after satisfying that the patch applies cleanly.

  6. +
  7. Deployment to JBoss EAP 6.3 is optional. The project can be built and deployed to a running instance of JBoss EAP through the following command in JBoss Forge:

    +
    $ build clean package jboss-as:deploy
    +
  8. +
+ +

Building TicketMonster

+ +

TicketMonster can be built from Maven, by runnning the following Maven command:

+
mvn clean package
+
+

Building TicketMonster with tests

+ +

If you want to run the Arquillian tests as part of the build, you can enable one of the two available Arquillian profiles.

+ +

For running the tests in an already running application server instance, use the arq-jbossas-remote profile.

+
mvn clean package -Parq-jbossas-remote
+
+

If you want the test runner to start an application server instance, use the arq-jbossas-managed profile. You must set up the JBOSS_HOME property to point to the server location, or update the src/main/test/resources/arquillian.xml file.

+
mvn clean package -Parq-jbossas-managed
+
+

Building TicketMonster with Postgresql (for OpenShift)

+ +

If you intend to deploy into OpenShift, you can use the postgresql-openshift profile

+
mvn clean package -Ppostgresql-openshift
+
+

Building TicketMonster with MySQL (for OpenShift)

+ +

If you intend to deploy into OpenShift, you can use the mysql-openshift profile

+
mvn clean package -Pmysql-openshift
+
+

Running TicketMonster

+ +

You can run TicketMonster into a local JBoss EAP 6.3 instance or on OpenShift.

+ +

Running TicketMonster locally

+ +

Start JBoss Enterprise Application Platform 6.3

+ +
    +
  1. Open a command line and navigate to the root of the JBoss server directory.
  2. +
  3. The following shows the command line to start the server with the web profile:

    +
    For Linux:   JBOSS_HOME/bin/standalone.sh
    +For Windows: JBOSS_HOME\bin\standalone.bat
    +
  4. +
+ +

Deploy TicketMonster

+ +
    +
  1. Make sure you have started the JBoss Server as described above.
  2. +
  3. Type this command to build and deploy the archive into a running server instance.

    +
    mvn clean package jboss-as:deploy
    +
    +

    (You can use the arq-jbossas-remote profile for running tests as well)

  4. +
  5. This will deploy target/ticket-monster.war to the running instance of the server.

  6. +
  7. Now you can see the application running at http://localhost:8080/ticket-monster

  8. +
+ +

Running TicketMonster in OpenShift

+ +

Create an OpenShift project

+ +
+

The following variables are used in these instructions. Be sure to replace them as follows: +* APP_NAME should be replaced with the name of the application you create on OpenShift. +* YOUR_DOMAIN_NAME should be replaced with the OpenShift domain name. +* APPLICATION_UUID should be replaced with the UUID generated by OpenShift for your application, for example: 52864af85973ca430200006f +* TICKETMONSTER_MAVEN_PROJECT_ROOT is the location of the Maven project sources for the TicketMonster application.

+
+ +
    +
  1. Open a shell command prompt and change to a directory of your choice. Enter the following command to create a JBoss EAP 6 application:

    +
    rhc app create -a APP_NAME -t jbosseap-6
    +
  2. +
+ +

This command creates an OpenShift application named APP_NAME and will run the application inside the jbosseap-6 container. You should see some output similar to the following:

+
    Application Options
+    -------------------
+    Domain:     YOUR_DOMAIN
+    Cartridges: jbosseap-6 (addtl. costs may apply)
+    Gear Size:  default
+    Scaling:    no
+
+    Creating application 'APP_NAME' ... done
+
+
+    Waiting for your DNS name to be available ... done
+
+    Cloning into 'APP_NAME'...
+    Warning: Permanently added the RSA host key for IP address '54.90.10.115' to the list of known hosts.
+
+    Your application 'APP_NAME' is now available.
+
+      URL:        http://APP_NAME-YOUR_DOMAIN.rhcloud.com/
+      SSH to:     APPLICATION_UUID@APP_NAME-YOURDOMAIN.rhcloud.com
+      Git remote: ssh://APPLICATION_UUID@APP_NAME-YOUR_DOMAIN.rhcloud.com/~/git/APP_NAME.git/
+      Cloned to:  /Users/vineet/openshiftapps/APP_NAME
+
+    Run 'rhc show-app APP_NAME' for more details about your app.
+
+
    +
  1. The create command creates a git repository in the current directory with the same name as the application.
  2. +
+ +

You do not need the generated default application, so navigate to the new git repository directory created by the OpenShift command and tell git to remove the source and pom files:

+
    cd APP_NAME
+    git rm -r src pom.xml
+
+
    +
  1. Copy the TicketMonster application sources into this new git repository:

    +
    cp -r TICKETMONSTER_MAVEN_PROJECT_ROOT/src .
    +cp -r TICKETMONSTER_MAVEN_PROJECT_ROOT/pom.xml .
    +
  2. +
+ +

Use MySQL as the database

+ +
    +
  1. Add the MySQL 5.5 cartridge to the ticketmonster application:

    +
    rhc cartridge add mysql-5.5 -a ticketmonster
    +
  2. +
  3. Configure the OpenShift build process, to use the mysql-openshift profile within the project POM. To do so, create a file named pre_build_jbosseap under the .openshift/action_hooks directory located in the git repository of the OpenShift application, with the following contents:

    +
    export MAVEN_ARGS="clean package -Popenshift,mysql-openshift -DskipTests"
    +
  4. +
  5. Set the executable bit for the action hook:

    +
    chmod +x TICKET_MONSTER_OPENSHIFT_GIT_REPO/.openshift/build_hooks/pre_build_jbosseap
    +
  6. +
+ +

On Windows, you will need to run the following command to set the executable bit to the pre_build_jbosseap file:

+
    git update-index --chmod=+x .openshift/build_hooks/pre_build_jbosseap
+
+

Use PostgreSQL as the database

+ +
    +
  1. Add the PostgreSQL 9.2 cartridge to the ticketmonster application:

    +
    rhc cartridge add postgresql-9.2 -a ticketmonster
    +
  2. +
  3. Configure the OpenShift build process, to use the postgresql-openshift profile within the project POM. To do so, create a file named pre_build_jbosseap under the .openshift/action_hooks directory located in the git repository of the OpenShift application, with the following contents:

    +
    export MAVEN_ARGS="clean package -Popenshift,postgresql-openshift -DskipTests"
    +
  4. +
  5. Set the executable bit for the action hook:

    +
    chmod +x TICKET_MONSTER_OPENSHIFT_GIT_REPO/.openshift/build_hooks/pre_build_jbosseap
    +
  6. +
+ +

On Windows, you will need to run the following command to set the executable bit to the pre_build_jbosseap file:

+
    git update-index --chmod=+x .openshift/build_hooks/pre_build_jbosseap
+
+

Deploying to OpenShift

+ +
    +
  1. You can now deploy the changes to your OpenShift application using git as follows:

    +
    git add -A
    +git commit -m "TicketMonster on OpenShift"
    +git push
    +
  2. +
+ +

The final push command triggers the OpenShift infrastructure to build and deploy the changes.

+ +

Note that the openshift profile in pom.xml is activated by OpenShift, and causes the WAR build by OpenShift to be copied to the deployments/ directory, and deployed without a context path.

+ +

Now you can see the application running at http://APP_NAME-YOUR_DOMAIN.rhcloud.com/.

+ diff --git a/demo/README.md b/demo/README.md new file mode 100644 index 000000000..c08d50ec4 --- /dev/null +++ b/demo/README.md @@ -0,0 +1,192 @@ +# TicketMonster - a JBoss example + +TicketMonster is an online ticketing demo application that gets you started with JBoss technologies, and helps you learn and evaluate them. + +Here are a few instructions for building and running it. You can learn more about the example from the [tutorial](http://www.jboss.org/ticket-monster). + +## Updating the Performance dates + +_NOTE: This step is optional. It is necessary only if you want to update the dates of the Performances in the `import.sql` script in an automated manner. Updating the performance dates ensure that they are always set to some timestamp in the future, and ensures that all performances are visible in the Monitor section of the TicketMonster application._ + +1. Run the `update_import_sql` Perl script. You'll need the `DateTime`, `DateTime::Format::Strptime` and `Tie::File` Perl modules. These are usually available by default in your Perl installation. + + $ perl update_import_sql.pl src/main/resources/import.sql + +## Generating the administration site + +_NOTE: This step is optional. The administration site is already present in the source code. If you want to regenerate it from Forge, and apply the changes outlined in the tutorial, you may continue to follow the steps outlined here. Otherwise, you can skip this step and proceed to build TicketMonster._ + +Before building and running TicketMonster, you must generate the administration site with Forge. + +1. Ensure that you have [JBoss Forge](http://jboss.org/forge) installed. The current version of TicketMonster supports version 2.6.0.Final or higher of JBoss Forge. JBoss Developer Studio 8 is recommended, since it contains JBoss Forge 2 with all the necessary plugins for the TicketMonster app. + +2. Start the JBoss Forge console in JBoss Developer Studio. This can be done from the Forge Console view. If the view is not already visible, it can be opened through the 'Window' menu: _Window_ -> _Show View_ -> _Other..._. Select the 'Forge Console' item in the dialog to open the Forge Console. Click the _Start_ button in the Forge Console tab, to start Forge. + +3. From the JBoss Forge prompt, browse to the 'demo' directory of the TicketMonster sources and execute the script for generating the administration site + + $ cd ticket-monster/demo + $ run admin_layer.fsh + + The git patches need to be applied manually. Both the patches are located in the patches sub-directory. To apply the manual changes, first apply the patch located in file _admin_layer_functional.patch_. Then perform the same for the file _admin_layer_graphics.patch_ if you want to apply the style changes for the generated administration site. You can do so in JBoss Developer Studio, by opening the context-menu on the project (Right-click on the project) and then apply a git patch via _Team_ -> _Apply Patch..._. Locate the patch file in the Workspace, select it and click the 'Next' button. In the next dialog, select to apply the patch on the 'ticket-monster' project in the workspace. Click Finish in the final page of the wizard after satisfying that the patch applies cleanly. + +4. Deployment to JBoss EAP 6.3 is optional. The project can be built and deployed to a running instance of JBoss EAP through the following command in JBoss Forge: + + $ build clean package jboss-as:deploy + +## Building TicketMonster + +TicketMonster can be built from Maven, by runnning the following Maven command: + + mvn clean package + +### Building TicketMonster with tests + +If you want to run the Arquillian tests as part of the build, you can enable one of the two available Arquillian profiles. + +For running the tests in an _already running_ application server instance, use the `arq-jbossas-remote` profile. + + mvn clean package -Parq-jbossas-remote + +If you want the test runner to _start_ an application server instance, use the `arq-jbossas-managed` profile. You must set up the `JBOSS_HOME` property to point to the server location, or update the `src/main/test/resources/arquillian.xml` file. + + mvn clean package -Parq-jbossas-managed + +### Building TicketMonster with Postgresql (for OpenShift) + +If you intend to deploy into [OpenShift](http://openshift.com), you can use the `postgresql-openshift` profile + + mvn clean package -Ppostgresql-openshift + +### Building TicketMonster with MySQL (for OpenShift) + +If you intend to deploy into [OpenShift](http://openshift.com), you can use the `mysql-openshift` profile + + mvn clean package -Pmysql-openshift + +## Running TicketMonster + +You can run TicketMonster into a local JBoss EAP 6.3 instance or on OpenShift. + +### Running TicketMonster locally + +#### Start JBoss Enterprise Application Platform 6.3 + +1. Open a command line and navigate to the root of the JBoss server directory. +2. The following shows the command line to start the server with the web profile: + + For Linux: JBOSS_HOME/bin/standalone.sh + For Windows: JBOSS_HOME\bin\standalone.bat + +#### Deploy TicketMonster + +1. Make sure you have started the JBoss Server as described above. +2. Type this command to build and deploy the archive into a running server instance. + + mvn clean package jboss-as:deploy + + (You can use the `arq-jbossas-remote` profile for running tests as well) + +3. This will deploy `target/ticket-monster.war` to the running instance of the server. +4. Now you can see the application running at `http://localhost:8080/ticket-monster` + +### Running TicketMonster in OpenShift + +#### Create an OpenShift project + +> The following variables are used in these instructions. Be sure to replace them as follows: +* APP_NAME should be replaced with the name of the application you create on OpenShift. +* YOUR_DOMAIN_NAME should be replaced with the OpenShift domain name. +* APPLICATION_UUID should be replaced with the UUID generated by OpenShift for your application, for example: 52864af85973ca430200006f +* TICKETMONSTER_MAVEN_PROJECT_ROOT is the location of the Maven project sources for the TicketMonster application. + +1. Open a shell command prompt and change to a directory of your choice. Enter the following command to create a JBoss EAP 6 application: + + rhc app create -a APP_NAME -t jbosseap-6 + + This command creates an OpenShift application named APP_NAME and will run the application inside the jbosseap-6 container. You should see some output similar to the following: + + Application Options + ------------------- + Domain: YOUR_DOMAIN + Cartridges: jbosseap-6 (addtl. costs may apply) + Gear Size: default + Scaling: no + + Creating application 'APP_NAME' ... done + + + Waiting for your DNS name to be available ... done + + Cloning into 'APP_NAME'... + Warning: Permanently added the RSA host key for IP address '54.90.10.115' to the list of known hosts. + + Your application 'APP_NAME' is now available. + + URL: http://APP_NAME-YOUR_DOMAIN.rhcloud.com/ + SSH to: APPLICATION_UUID@APP_NAME-YOURDOMAIN.rhcloud.com + Git remote: ssh://APPLICATION_UUID@APP_NAME-YOUR_DOMAIN.rhcloud.com/~/git/APP_NAME.git/ + Cloned to: /Users/vineet/openshiftapps/APP_NAME + + Run 'rhc show-app APP_NAME' for more details about your app. + +2. The create command creates a git repository in the current directory with the same name as the application. + + You do not need the generated default application, so navigate to the new git repository directory created by the OpenShift command and tell git to remove the source and pom files: + + cd APP_NAME + git rm -r src pom.xml + +3. Copy the TicketMonster application sources into this new git repository: + + cp -r TICKETMONSTER_MAVEN_PROJECT_ROOT/src . + cp -r TICKETMONSTER_MAVEN_PROJECT_ROOT/pom.xml . + +#### Use MySQL as the database + +1. Add the MySQL 5.5 cartridge to the `ticketmonster` application: + + rhc cartridge add mysql-5.5 -a ticketmonster + +2. Configure the OpenShift build process, to use the `mysql-openshift` profile within the project POM. To do so, create a file named `pre_build_jbosseap` under the `.openshift/action_hooks` directory located in the git repository of the OpenShift application, with the following contents: + + export MAVEN_ARGS="clean package -Popenshift,mysql-openshift -DskipTests" + +3. Set the executable bit for the action hook: + + chmod +x TICKET_MONSTER_OPENSHIFT_GIT_REPO/.openshift/build_hooks/pre_build_jbosseap + + On Windows, you will need to run the following command to set the executable bit to the `pre_build_jbosseap` file: + + git update-index --chmod=+x .openshift/build_hooks/pre_build_jbosseap + +#### Use PostgreSQL as the database + +1. Add the PostgreSQL 9.2 cartridge to the `ticketmonster` application: + + rhc cartridge add postgresql-9.2 -a ticketmonster + +2. Configure the OpenShift build process, to use the `postgresql-openshift` profile within the project POM. To do so, create a file named `pre_build_jbosseap` under the `.openshift/action_hooks` directory located in the git repository of the OpenShift application, with the following contents: + + export MAVEN_ARGS="clean package -Popenshift,postgresql-openshift -DskipTests" + +3. Set the executable bit for the action hook: + + chmod +x TICKET_MONSTER_OPENSHIFT_GIT_REPO/.openshift/build_hooks/pre_build_jbosseap + + On Windows, you will need to run the following command to set the executable bit to the `pre_build_jbosseap` file: + + git update-index --chmod=+x .openshift/build_hooks/pre_build_jbosseap + +#### Deploying to OpenShift + +1. You can now deploy the changes to your OpenShift application using git as follows: + + git add -A + git commit -m "TicketMonster on OpenShift" + git push + + The final push command triggers the OpenShift infrastructure to build and deploy the changes. + + Note that the `openshift` profile in pom.xml is activated by OpenShift, and causes the WAR build by OpenShift to be copied to the deployments/ directory, and deployed without a context path. + + Now you can see the application running at http://APP_NAME-YOUR_DOMAIN.rhcloud.com/. diff --git a/demo/admin_layer.fsh b/demo/admin_layer.fsh new file mode 100644 index 000000000..51b769fea --- /dev/null +++ b/demo/admin_layer.fsh @@ -0,0 +1,11 @@ +clear; + +echo "Generating the scaffold."; +scaffold-generate --provider AngularJS --webRoot /admin --targets org.jboss.examples.ticketmonster.model.* --generator ROOT_AND_NESTED_DTO --packageName org.jboss.examples.ticketmonster.rest; + +echo "Don't forget to apply the manual changes described in tutorial provided in admin_layer_functional.patch and admin_layer_graphics.patch. Both files are in the patches sub-directory."; + +echo "To build and deploy the application to JBoss EAP, run the following command:" +echo " build clean package jboss-as:deploy"; + +echo "Examine the app deployed at http://localhost:8080/ticket-monster/admin/index.html"; diff --git a/demo/patches/admin_layer_functional.patch b/demo/patches/admin_layer_functional.patch new file mode 100644 index 000000000..f71ac7107 --- /dev/null +++ b/demo/patches/admin_layer_functional.patch @@ -0,0 +1,996 @@ +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/PerformanceEndpoint.java ./src/main/java/org/jboss/examples/ticketmonster/rest/PerformanceEndpoint.java +index 4d5c0b3..3f0e6ba 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/PerformanceEndpoint.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/PerformanceEndpoint.java +@@ -9,6 +9,10 @@ import javax.persistence.NoResultException; + import javax.persistence.OptimisticLockException; + import javax.persistence.PersistenceContext; + import javax.persistence.TypedQuery; ++import javax.persistence.criteria.CriteriaBuilder; ++import javax.persistence.criteria.CriteriaQuery; ++import javax.persistence.criteria.Predicate; ++import javax.persistence.criteria.Root; + import javax.ws.rs.Consumes; + import javax.ws.rs.DELETE; + import javax.ws.rs.GET; +@@ -21,8 +25,12 @@ import javax.ws.rs.QueryParam; + import javax.ws.rs.core.Response; + import javax.ws.rs.core.Response.Status; + import javax.ws.rs.core.UriBuilder; ++ + import org.jboss.examples.ticketmonster.rest.dto.PerformanceDTO; ++import org.jboss.examples.ticketmonster.model.Booking; + import org.jboss.examples.ticketmonster.model.Performance; ++import org.jboss.examples.ticketmonster.model.SectionAllocation; ++import org.jboss.examples.ticketmonster.model.Show; + + /** + * +@@ -52,6 +60,18 @@ public class PerformanceEndpoint + { + return Response.status(Status.NOT_FOUND).build(); + } ++ Show show = entity.getShow(); ++ show.getPerformances().remove(entity); ++ entity.setShow(null); ++ this.em.merge(show); ++ List sectionAllocations = findSectionAllocationsByPerformance(entity); ++ for(SectionAllocation sectionAllocation: sectionAllocations) { ++ this.em.remove(sectionAllocation); ++ } ++ List bookings = findBookingsByPerformance(entity); ++ for(Booking booking: bookings) { ++ this.em.remove(booking); ++ } + em.remove(entity); + return Response.noContent().build(); + } +@@ -130,4 +150,27 @@ public class PerformanceEndpoint + } + return Response.noContent().build(); + } ++ ++ public List findSectionAllocationsByPerformance(Performance performance) ++ { ++ CriteriaQuery criteria = this.em ++ .getCriteriaBuilder().createQuery(SectionAllocation.class); ++ Root from = criteria.from(SectionAllocation.class); ++ CriteriaBuilder builder = this.em.getCriteriaBuilder(); ++ Predicate performanceIsSame = builder.equal(from.get("performance"), performance); ++ return this.em.createQuery( ++ criteria.select(from).where(performanceIsSame)).getResultList(); ++ } ++ ++ public List findBookingsByPerformance(Performance performance) ++ { ++ CriteriaQuery criteria = this.em ++ .getCriteriaBuilder().createQuery(Booking.class); ++ Root from = criteria.from(Booking.class); ++ CriteriaBuilder builder = this.em.getCriteriaBuilder(); ++ Predicate performanceIsSame = builder.equal(from.get("performance"), performance); ++ return this.em.createQuery( ++ criteria.select(from).where(performanceIsSame)).getResultList(); ++ } ++ + } +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedPerformanceDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedPerformanceDTO.java +index 1fb77f9..421c55f 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedPerformanceDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedPerformanceDTO.java +@@ -11,6 +11,7 @@ public class NestedPerformanceDTO implements Serializable + + private Long id; + private Date date; ++ private String displayTitle; + + public NestedPerformanceDTO() + { +@@ -22,6 +23,7 @@ public class NestedPerformanceDTO implements Serializable + { + this.id = entity.getId(); + this.date = entity.getDate(); ++ this.displayTitle = entity.toString(); + } + } + +@@ -72,4 +74,9 @@ public class NestedPerformanceDTO implements Serializable + { + this.date = date; + } +-} +\ No newline at end of file ++ ++ public String getDisplayTitle() ++ { ++ return this.displayTitle; ++ } ++} +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedShowDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedShowDTO.java +index c5207cf..05f69e1 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedShowDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedShowDTO.java +@@ -9,6 +9,7 @@ public class NestedShowDTO implements Serializable + { + + private Long id; ++ private String displayTitle; + + public NestedShowDTO() + { +@@ -19,6 +20,7 @@ public class NestedShowDTO implements Serializable + if (entity != null) + { + this.id = entity.getId(); ++ this.displayTitle = entity.toString(); + } + } + +@@ -57,4 +59,9 @@ public class NestedShowDTO implements Serializable + { + this.id = id; + } +-} +\ No newline at end of file ++ ++ public String getDisplayTitle() ++ { ++ return this.displayTitle; ++ } ++} +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedTicketPriceDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedTicketPriceDTO.java +index 54d7f7d..0165de9 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedTicketPriceDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/NestedTicketPriceDTO.java +@@ -10,6 +10,7 @@ public class NestedTicketPriceDTO implements Serializable + + private Long id; + private float price; ++ private String displayTitle; + + public NestedTicketPriceDTO() + { +@@ -21,6 +22,7 @@ public class NestedTicketPriceDTO implements Serializable + { + this.id = entity.getId(); + this.price = entity.getPrice(); ++ this.displayTitle = entity.toString(); + } + } + +@@ -71,4 +73,9 @@ public class NestedTicketPriceDTO implements Serializable + { + this.price = price; + } +-} +\ No newline at end of file ++ ++ public String getDisplayTitle() ++ { ++ return this.displayTitle; ++ } ++} +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/PerformanceDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/PerformanceDTO.java +index 83d6bdf..b4a2e1f 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/PerformanceDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/PerformanceDTO.java +@@ -14,6 +14,7 @@ public class PerformanceDTO implements Serializable + private Long id; + private NestedShowDTO show; + private Date date; ++ private String displayTitle; + + public PerformanceDTO() + { +@@ -26,6 +27,7 @@ public class PerformanceDTO implements Serializable + this.id = entity.getId(); + this.show = new NestedShowDTO(entity.getShow()); + this.date = entity.getDate(); ++ this.displayTitle = entity.toString(); + } + } + +@@ -73,4 +75,9 @@ public class PerformanceDTO implements Serializable + { + this.date = date; + } +-} +\ No newline at end of file ++ ++ public String getDisplayTitle() ++ { ++ return this.displayTitle; ++ } ++} +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/ShowDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/ShowDTO.java +index 37b4b5e..2e4ceda 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/ShowDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/ShowDTO.java +@@ -1,17 +1,32 @@ + package org.jboss.examples.ticketmonster.rest.dto; + + import java.io.Serializable; ++ ++import org.jboss.examples.ticketmonster.model.Booking; ++import org.jboss.examples.ticketmonster.model.SectionAllocation; + import org.jboss.examples.ticketmonster.model.Show; ++ + import javax.persistence.EntityManager; ++import javax.persistence.criteria.CriteriaBuilder; ++import javax.persistence.criteria.CriteriaQuery; ++import javax.persistence.criteria.Predicate; ++import javax.persistence.criteria.Root; ++ + import org.jboss.examples.ticketmonster.rest.dto.NestedEventDTO; ++ ++import java.util.List; + import java.util.Set; + import java.util.HashSet; ++ + import org.jboss.examples.ticketmonster.rest.dto.NestedPerformanceDTO; + import org.jboss.examples.ticketmonster.model.Performance; ++ + import java.util.Iterator; ++ + import org.jboss.examples.ticketmonster.rest.dto.NestedVenueDTO; + import org.jboss.examples.ticketmonster.rest.dto.NestedTicketPriceDTO; + import org.jboss.examples.ticketmonster.model.TicketPrice; ++ + import javax.xml.bind.annotation.XmlRootElement; + + @XmlRootElement +@@ -23,6 +38,7 @@ public class ShowDTO implements Serializable + private Set performances = new HashSet(); + private NestedVenueDTO venue; + private Set ticketPrices = new HashSet(); ++ private String displayTitle; + + public ShowDTO() + { +@@ -49,6 +65,7 @@ public class ShowDTO implements Serializable + TicketPrice element = iterTicketPrices.next(); + this.ticketPrices.add(new NestedTicketPriceDTO(element)); + } ++ this.displayTitle = entity.toString(); + } + } + +@@ -83,6 +100,17 @@ public class ShowDTO implements Serializable + if (found == false) + { + iterPerformances.remove(); ++ List sectionAllocations = findSectionAllocationsByPerformance(performance, em); ++ for(SectionAllocation sectionAllocation: sectionAllocations) ++ { ++ em.remove(sectionAllocation); ++ } ++ List bookings = findBookingsByPerformance(performance, em); ++ for(Booking booking: bookings) ++ { ++ em.remove(booking); ++ } ++ em.remove(performance); + } + } + Iterator iterDtoPerformances = this +@@ -180,6 +208,27 @@ public class ShowDTO implements Serializable + return entity; + } + ++ public List findSectionAllocationsByPerformance(Performance performance, EntityManager em) ++ { ++ CriteriaQuery criteria = em ++ .getCriteriaBuilder().createQuery(SectionAllocation.class); ++ Root from = criteria.from(SectionAllocation.class); ++ CriteriaBuilder builder = em.getCriteriaBuilder(); ++ Predicate performanceIsSame = builder.equal(from.get("performance"), performance); ++ return em.createQuery( ++ criteria.select(from).where(performanceIsSame)).getResultList(); ++ } ++ ++ public List findBookingsByPerformance(Performance performance, EntityManager em) ++ { ++ CriteriaQuery criteria = em.getCriteriaBuilder().createQuery(Booking.class); ++ Root from = criteria.from(Booking.class); ++ CriteriaBuilder builder = em.getCriteriaBuilder(); ++ Predicate performanceIsSame = builder.equal(from.get("performance"), performance); ++ return em.createQuery( ++ criteria.select(from).where(performanceIsSame)).getResultList(); ++ } ++ + public Long getId() + { + return this.id; +@@ -229,4 +278,9 @@ public class ShowDTO implements Serializable + { + this.ticketPrices = ticketPrices; + } +-} +\ No newline at end of file ++ ++ public String getDisplayTitle() ++ { ++ return this.displayTitle; ++ } ++} +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/TicketPriceDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/TicketPriceDTO.java +index 455f614..bce2cb3 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/TicketPriceDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/TicketPriceDTO.java +@@ -17,6 +17,7 @@ public class TicketPriceDTO implements Serializable + private NestedSectionDTO section; + private NestedTicketCategoryDTO ticketCategory; + private float price; ++ private String displayTitle; + + public TicketPriceDTO() + { +@@ -32,6 +33,7 @@ public class TicketPriceDTO implements Serializable + this.ticketCategory = new NestedTicketCategoryDTO( + entity.getTicketCategory()); + this.price = entity.getPrice(); ++ this.displayTitle = entity.toString(); + } + } + +@@ -108,4 +110,9 @@ public class TicketPriceDTO implements Serializable + { + this.price = price; + } +-} +\ No newline at end of file ++ ++ public String getDisplayTitle() ++ { ++ return this.displayTitle; ++ } ++} +diff --git ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/VenueDTO.java ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/VenueDTO.java +index 2412c30..8048ddf 100644 +--- ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/VenueDTO.java ++++ ./src/main/java/org/jboss/examples/ticketmonster/rest/dto/VenueDTO.java +@@ -1,15 +1,30 @@ + package org.jboss.examples.ticketmonster.rest.dto; + + import java.io.Serializable; ++ ++import org.jboss.examples.ticketmonster.model.SectionAllocation; ++import org.jboss.examples.ticketmonster.model.Show; ++import org.jboss.examples.ticketmonster.model.TicketPrice; + import org.jboss.examples.ticketmonster.model.Venue; ++ + import javax.persistence.EntityManager; ++import javax.persistence.criteria.CriteriaBuilder; ++import javax.persistence.criteria.CriteriaQuery; ++import javax.persistence.criteria.Predicate; ++import javax.persistence.criteria.Root; ++ + import org.jboss.examples.ticketmonster.rest.dto.AddressDTO; + import org.jboss.examples.ticketmonster.rest.dto.NestedMediaItemDTO; ++ ++import java.util.List; + import java.util.Set; + import java.util.HashSet; ++ + import org.jboss.examples.ticketmonster.rest.dto.NestedSectionDTO; + import org.jboss.examples.ticketmonster.model.Section; ++ + import java.util.Iterator; ++ + import javax.xml.bind.annotation.XmlRootElement; + + @XmlRootElement +@@ -83,6 +98,19 @@ public class VenueDTO implements Serializable + if (found == false) + { + iterSections.remove(); ++ List sectionAllocations = findSectionAllocationBySection(section, em); ++ for(SectionAllocation sectionAllocation: sectionAllocations) ++ { ++ em.remove(sectionAllocation); ++ } ++ List ticketPrices = findTicketPricesBySection(section, em); ++ for(TicketPrice ticketPrice: ticketPrices) ++ { ++ Show show = ticketPrice.getShow(); ++ show.getTicketPrices().remove(ticketPrice); ++ em.remove(ticketPrice); ++ } ++ em.remove(section); + } + } + Iterator iterDtoSections = this.getSections() +@@ -122,6 +150,28 @@ public class VenueDTO implements Serializable + return entity; + } + ++ public List findSectionAllocationBySection(Section section, EntityManager em) ++ { ++ CriteriaQuery criteria = em ++ .getCriteriaBuilder().createQuery(SectionAllocation.class); ++ Root from = criteria.from(SectionAllocation.class); ++ CriteriaBuilder builder = em.getCriteriaBuilder(); ++ Predicate sectionIsSame = builder.equal(from.get("section"), section); ++ return em.createQuery( ++ criteria.select(from).where(sectionIsSame)).getResultList(); ++ } ++ ++ public List findTicketPricesBySection(Section section, EntityManager em) ++ { ++ CriteriaQuery criteria = em ++ .getCriteriaBuilder().createQuery(TicketPrice.class); ++ Root from = criteria.from(TicketPrice.class); ++ CriteriaBuilder builder = em.getCriteriaBuilder(); ++ Predicate sectionIsSame = builder.equal(from.get("section"), section); ++ return em.createQuery( ++ criteria.select(from).where(sectionIsSame)).getResultList(); ++ } ++ + public Long getId() + { + return this.id; +@@ -191,4 +241,4 @@ public class VenueDTO implements Serializable + { + this.capacity = capacity; + } +-} +\ No newline at end of file ++} +diff --git ./src/main/webapp/admin/scripts/controllers/editBookingController.js ./src/main/webapp/admin/scripts/controllers/editBookingController.js +index 91ddde7..6233ab4 100644 +--- ./src/main/webapp/admin/scripts/controllers/editBookingController.js ++++ ./src/main/webapp/admin/scripts/controllers/editBookingController.js +@@ -37,7 +37,7 @@ angular.module('ticketmonster').controller('EditBookingController', function($sc + }; + var labelObject = { + value : item.id, +- text : item.date ++ text : item.displayTitle + }; + if($scope.booking.performance && item.id == $scope.booking.performance.id) { + $scope.performanceSelection = labelObject; +@@ -103,4 +103,4 @@ angular.module('ticketmonster').controller('EditBookingController', function($sc + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/editEventController.js ./src/main/webapp/admin/scripts/controllers/editEventController.js +index 8bb871b..553bdf2 100644 +--- ./src/main/webapp/admin/scripts/controllers/editEventController.js ++++ ./src/main/webapp/admin/scripts/controllers/editEventController.js +@@ -16,7 +16,7 @@ angular.module('ticketmonster').controller('EditEventController', function($scop + }; + var labelObject = { + value : item.id, +- text : item.mediaType ++ text : item.url + }; + if($scope.event.mediaItem && item.id == $scope.event.mediaItem.id) { + $scope.mediaItemSelection = labelObject; +@@ -94,4 +94,4 @@ angular.module('ticketmonster').controller('EditEventController', function($scop + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/editPerformanceController.js ./src/main/webapp/admin/scripts/controllers/editPerformanceController.js +index fc93d6a..98e21fc 100644 +--- ./src/main/webapp/admin/scripts/controllers/editPerformanceController.js ++++ ./src/main/webapp/admin/scripts/controllers/editPerformanceController.js +@@ -16,7 +16,7 @@ angular.module('ticketmonster').controller('EditPerformanceController', function + }; + var labelObject = { + value : item.id, +- text : item.id ++ text : item.displayTitle + }; + if($scope.performance.show && item.id == $scope.performance.show.id) { + $scope.showSelection = labelObject; +@@ -71,4 +71,4 @@ angular.module('ticketmonster').controller('EditPerformanceController', function + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/editSectionAllocationController.js ./src/main/webapp/admin/scripts/controllers/editSectionAllocationController.js +index 763fa18..734baae 100644 +--- ./src/main/webapp/admin/scripts/controllers/editSectionAllocationController.js ++++ ./src/main/webapp/admin/scripts/controllers/editSectionAllocationController.js +@@ -16,7 +16,7 @@ angular.module('ticketmonster').controller('EditSectionAllocationController', fu + }; + var labelObject = { + value : item.id, +- text : item.date ++ text : item.displayTitle + }; + if($scope.sectionAllocation.performance && item.id == $scope.sectionAllocation.performance.id) { + $scope.performanceSelection = labelObject; +@@ -94,4 +94,4 @@ angular.module('ticketmonster').controller('EditSectionAllocationController', fu + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/editShowController.js ./src/main/webapp/admin/scripts/controllers/editShowController.js +index 04d537a..e863587 100644 +--- ./src/main/webapp/admin/scripts/controllers/editShowController.js ++++ ./src/main/webapp/admin/scripts/controllers/editShowController.js +@@ -33,7 +33,7 @@ angular.module('ticketmonster').controller('EditShowController', function($scope + }; + var labelObject = { + value : item.id, +- text : item.date ++ text : item.displayTitle + }; + if($scope.show.performances){ + $.each($scope.show.performances, function(idx, element) { +@@ -71,7 +71,7 @@ angular.module('ticketmonster').controller('EditShowController', function($scope + }; + var labelObject = { + value : item.id, +- text : item.price ++ text : item.displayTitle + }; + if($scope.show.ticketPrices){ + $.each($scope.show.ticketPrices, function(idx, element) { +@@ -158,4 +158,4 @@ angular.module('ticketmonster').controller('EditShowController', function($scope + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/editTicketPriceController.js ./src/main/webapp/admin/scripts/controllers/editTicketPriceController.js +index 532ab5e..0f5446d 100644 +--- ./src/main/webapp/admin/scripts/controllers/editTicketPriceController.js ++++ ./src/main/webapp/admin/scripts/controllers/editTicketPriceController.js +@@ -16,7 +16,7 @@ angular.module('ticketmonster').controller('EditTicketPriceController', function + }; + var labelObject = { + value : item.id, +- text : item.id ++ text : item.displayTitle + }; + if($scope.ticketPrice.show && item.id == $scope.ticketPrice.show.id) { + $scope.showSelection = labelObject; +@@ -101,6 +101,27 @@ angular.module('ticketmonster').controller('EditTicketPriceController', function + if (typeof selection != 'undefined') { + $scope.ticketPrice.show = {}; + $scope.ticketPrice.show.id = selection.value; ++ if($scope.showList) { ++ var selectedShow = $.map($scope.showList, function(show) { ++ if(show.id === $scope.ticketPrice.show.id) { ++ return show; ++ } ++ }); ++ if(selectedShow.length > 0) { ++ selectedShow = selectedShow[0]; ++ } ++ } ++ if($scope.sectionList && selectedShow) { ++ var venueSectionList = $.map($scope.sectionList, function(section) { ++ if(selectedShow.venue.id === section.venue.id) { ++ return ( { ++ value : section.id, ++ text : section.name ++ }); ++ } ++ }); ++ $scope.sectionSelectionList = venueSectionList; ++ } + } + }); + $scope.$watch("sectionSelection", function(selection) { +@@ -117,4 +138,4 @@ angular.module('ticketmonster').controller('EditTicketPriceController', function + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/editVenueController.js ./src/main/webapp/admin/scripts/controllers/editVenueController.js +index bc0cbeb..ac61a65 100644 +--- ./src/main/webapp/admin/scripts/controllers/editVenueController.js ++++ ./src/main/webapp/admin/scripts/controllers/editVenueController.js +@@ -16,7 +16,7 @@ angular.module('ticketmonster').controller('EditVenueController', function($scop + }; + var labelObject = { + value : item.id, +- text : item.mediaType ++ text : item.url + }; + if($scope.venue.mediaItem && item.id == $scope.venue.mediaItem.id) { + $scope.mediaItemSelection = labelObject; +@@ -103,4 +103,4 @@ angular.module('ticketmonster').controller('EditVenueController', function($scop + }); + + $scope.get(); +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newBookingController.js ./src/main/webapp/admin/scripts/controllers/newBookingController.js +index d68a202..4d29c29 100644 +--- ./src/main/webapp/admin/scripts/controllers/newBookingController.js ++++ ./src/main/webapp/admin/scripts/controllers/newBookingController.js +@@ -27,7 +27,7 @@ angular.module('ticketmonster').controller('NewBookingController', function ($sc + $scope.performanceSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.date ++ text : item.displayTitle + }); + }); + }); +@@ -54,4 +54,4 @@ angular.module('ticketmonster').controller('NewBookingController', function ($sc + $scope.cancel = function() { + $location.path("/Bookings"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newEventController.js ./src/main/webapp/admin/scripts/controllers/newEventController.js +index 069b0c3..2cc7120 100644 +--- ./src/main/webapp/admin/scripts/controllers/newEventController.js ++++ ./src/main/webapp/admin/scripts/controllers/newEventController.js +@@ -8,7 +8,7 @@ angular.module('ticketmonster').controller('NewEventController', function ($scop + $scope.mediaItemSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.mediaType ++ text : item.url + }); + }); + }); +@@ -50,4 +50,4 @@ angular.module('ticketmonster').controller('NewEventController', function ($scop + $scope.cancel = function() { + $location.path("/Events"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newPerformanceController.js ./src/main/webapp/admin/scripts/controllers/newPerformanceController.js +index 9899ee4..8ac2a3b 100644 +--- ./src/main/webapp/admin/scripts/controllers/newPerformanceController.js ++++ ./src/main/webapp/admin/scripts/controllers/newPerformanceController.js +@@ -8,7 +8,7 @@ angular.module('ticketmonster').controller('NewPerformanceController', function + $scope.showSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.id ++ text : item.displayTitle + }); + }); + }); +@@ -35,4 +35,4 @@ angular.module('ticketmonster').controller('NewPerformanceController', function + $scope.cancel = function() { + $location.path("/Performances"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newSectionAllocationController.js ./src/main/webapp/admin/scripts/controllers/newSectionAllocationController.js +index 4320cb5..52a8143 100644 +--- ./src/main/webapp/admin/scripts/controllers/newSectionAllocationController.js ++++ ./src/main/webapp/admin/scripts/controllers/newSectionAllocationController.js +@@ -8,7 +8,7 @@ angular.module('ticketmonster').controller('NewSectionAllocationController', fun + $scope.performanceSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.date ++ text : item.displayTitle + }); + }); + }); +@@ -50,4 +50,4 @@ angular.module('ticketmonster').controller('NewSectionAllocationController', fun + $scope.cancel = function() { + $location.path("/SectionAllocations"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newShowController.js ./src/main/webapp/admin/scripts/controllers/newShowController.js +index 01b4a50..087a23b 100644 +--- ./src/main/webapp/admin/scripts/controllers/newShowController.js ++++ ./src/main/webapp/admin/scripts/controllers/newShowController.js +@@ -23,7 +23,7 @@ angular.module('ticketmonster').controller('NewShowController', function ($scope + $scope.performancesSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.date ++ text : item.displayTitle + }); + }); + }); +@@ -57,7 +57,7 @@ angular.module('ticketmonster').controller('NewShowController', function ($scope + $scope.ticketPricesSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.price ++ text : item.displayTitle + }); + }); + }); +@@ -88,4 +88,4 @@ angular.module('ticketmonster').controller('NewShowController', function ($scope + $scope.cancel = function() { + $location.path("/Shows"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newTicketPriceController.js ./src/main/webapp/admin/scripts/controllers/newTicketPriceController.js +index daf214f..557e372 100644 +--- ./src/main/webapp/admin/scripts/controllers/newTicketPriceController.js ++++ ./src/main/webapp/admin/scripts/controllers/newTicketPriceController.js +@@ -8,7 +8,7 @@ angular.module('ticketmonster').controller('NewTicketPriceController', function + $scope.showSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.id ++ text : item.displayTitle + }); + }); + }); +@@ -16,6 +16,27 @@ angular.module('ticketmonster').controller('NewTicketPriceController', function + if ( typeof selection != 'undefined') { + $scope.ticketPrice.show = {}; + $scope.ticketPrice.show.id = selection.value; ++ if($scope.showList) { ++ var selectedShow = $.map($scope.showList, function(show) { ++ if(show.id === $scope.ticketPrice.show.id) { ++ return show; ++ } ++ }); ++ if(selectedShow.length > 0) { ++ selectedShow = selectedShow[0]; ++ } ++ } ++ if($scope.sectionList && selectedShow) { ++ var venueSectionList = $.map($scope.sectionList, function(section) { ++ if(selectedShow.venue.id === section.venue.id) { ++ return ( { ++ value : section.id, ++ text : section.name ++ }); ++ } ++ }); ++ $scope.sectionSelectionList = venueSectionList; ++ } + } + }); + +@@ -65,4 +86,4 @@ angular.module('ticketmonster').controller('NewTicketPriceController', function + $scope.cancel = function() { + $location.path("/TicketPrices"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/scripts/controllers/newVenueController.js ./src/main/webapp/admin/scripts/controllers/newVenueController.js +index 1e61887..b16736e 100644 +--- ./src/main/webapp/admin/scripts/controllers/newVenueController.js ++++ ./src/main/webapp/admin/scripts/controllers/newVenueController.js +@@ -8,7 +8,7 @@ angular.module('ticketmonster').controller('NewVenueController', function ($scop + $scope.mediaItemSelectionList = $.map(items, function(item) { + return ( { + value : item.id, +- text : item.mediaType ++ text : item.url + }); + }); + }); +@@ -54,4 +54,4 @@ angular.module('ticketmonster').controller('NewVenueController', function ($scop + $scope.cancel = function() { + $location.path("/Venues"); + }; +-}); +\ No newline at end of file ++}); +diff --git ./src/main/webapp/admin/views/Booking/search.html ./src/main/webapp/admin/views/Booking/search.html +index cefb023..c0bcf5a 100644 +--- ./src/main/webapp/admin/views/Booking/search.html ++++ ./src/main/webapp/admin/views/Booking/search.html +@@ -37,7 +37,7 @@ +
+ +
+- + + +
+@@ -87,4 +87,4 @@ + + + +-
+\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/Event/detail.html ./src/main/webapp/admin/views/Event/detail.html +index 78d55b3..4da1871 100644 +--- ./src/main/webapp/admin/views/Event/detail.html ++++ ./src/main/webapp/admin/views/Event/detail.html +@@ -23,6 +23,8 @@ + ++
++ + + + +@@ -54,4 +56,4 @@ + + + +- +\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/Event/search.html ./src/main/webapp/admin/views/Event/search.html +index c37f281..a2f614e 100644 +--- ./src/main/webapp/admin/views/Event/search.html ++++ ./src/main/webapp/admin/views/Event/search.html +@@ -21,7 +21,7 @@ +
+ +
+- + + +
+@@ -65,7 +65,7 @@ + + + {{result.name}} +- {{result.mediaItem.mediaType}} ++ {{result.mediaItem.url}} + {{result.category.description}} + {{result.description}} + +@@ -85,4 +85,4 @@ + + + +-
+\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/Performance/search.html ./src/main/webapp/admin/views/Performance/search.html +index ef13770..b315edf 100644 +--- ./src/main/webapp/admin/views/Performance/search.html ++++ ./src/main/webapp/admin/views/Performance/search.html +@@ -14,7 +14,7 @@ +
+ +
+- + + +
+@@ -40,7 +40,7 @@ + + + +- {{result.show.id}} ++ {{result.show.displayTitle}} + {{result.date| date:'yyyy-MM-dd HH:mm:ss Z'}} + + +@@ -59,4 +59,4 @@ + + + +-
+\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/SectionAllocation/search.html ./src/main/webapp/admin/views/SectionAllocation/search.html +index 820fdd5..b813ea8 100644 +--- ./src/main/webapp/admin/views/SectionAllocation/search.html ++++ ./src/main/webapp/admin/views/SectionAllocation/search.html +@@ -20,7 +20,7 @@ +
+ +
+- + + +
+@@ -57,7 +57,7 @@ + + + {{result.occupiedCount}} +- {{result.performance.date| date:'medium'}} ++ {{result.performance.displayTitle}} + {{result.section.name}} + + +@@ -76,4 +76,4 @@ + + + +-
+\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/TicketPrice/search.html ./src/main/webapp/admin/views/TicketPrice/search.html +index 2bf2648..4345e63 100644 +--- ./src/main/webapp/admin/views/TicketPrice/search.html ++++ ./src/main/webapp/admin/views/TicketPrice/search.html +@@ -14,7 +14,7 @@ +
+ +
+- + + +
+@@ -66,7 +66,7 @@ + + + +- {{result.show.id}} ++ {{result.show.displayTitle}} + {{result.section.name}} + {{result.ticketCategory.description}} + {{result.price}} +@@ -87,4 +87,4 @@ + + + +-
+\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/Venue/detail.html ./src/main/webapp/admin/views/Venue/detail.html +index 5bb6383..77904e1 100644 +--- ./src/main/webapp/admin/views/Venue/detail.html ++++ ./src/main/webapp/admin/views/Venue/detail.html +@@ -20,6 +20,8 @@ + ++
++ + + + +@@ -76,4 +78,4 @@ + + + +- +\ No newline at end of file ++ +diff --git ./src/main/webapp/admin/views/Venue/search.html ./src/main/webapp/admin/views/Venue/search.html +index 57bc1ff..ff04b44 100644 +--- ./src/main/webapp/admin/views/Venue/search.html ++++ ./src/main/webapp/admin/views/Venue/search.html +@@ -21,7 +21,7 @@ +
+ +
+- + + +
+@@ -88,7 +88,7 @@ + + + {{result.name}} +- {{result.mediaItem.mediaType}} ++ {{result.mediaItem.url}} + {{result.description}} + {{result.capacity}} + {{result.address.street}} +@@ -111,4 +111,4 @@ + + + +-
+\ No newline at end of file ++ diff --git a/demo/patches/admin_layer_graphics.patch b/demo/patches/admin_layer_graphics.patch new file mode 100644 index 000000000..19a43970a --- /dev/null +++ b/demo/patches/admin_layer_graphics.patch @@ -0,0 +1,61 @@ +diff --git ./src/main/webapp/admin/app.html ./src/main/webapp/admin/app.html +index 2e27e40..4e1f843 100644 +--- ./src/main/webapp/admin/app.html ++++ ./src/main/webapp/admin/app.html +@@ -4,25 +4,37 @@ + + + Ticket-monster ++ + + + ++ + + +
+ +-