diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..9b88dae --- /dev/null +++ b/.babelrc @@ -0,0 +1,17 @@ +{ + "presets": [ + ["env", { + "targets": { + "browsers": ["last 2 versions"] + } + }] + ], + "plugins": [ + [ + "transform-react-jsx", + { + "pragma": "preact.h" + } + ] + ] +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8283c52 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +insert_final_newline = true +end_of_line = lf +# editorconfig-tools is unable to ignore longs strings or urls +max_line_length = null diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..d083bfb --- /dev/null +++ b/.eslintrc @@ -0,0 +1,34 @@ +{ + "extends": "airbnb", + "env": { + "browser": true + }, + "rules": { + "func-names": [ + "error", + "never" + ], + "indent": ["error", 4], + "react/jsx-indent": [1, 4], + "react/jsx-indent-props": [1, 4], + "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], + "react/react-in-jsx-scope": "off", + "react/no-array-index-key": "off", + "class-methods-use-this": "off", + "jsx-a11y/no-static-element-interactions": "off", + "import/no-dynamic-require": "off", + "comma-dangle": "off", + "global-require": "off", + "eqeqeq": "off", + "max-len": "off", + "no-new": "off", + "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false, "varsIgnorePattern": "preact" }], + "react/no-unknown-property": [2, { "ignore": ["stroke-linecap", "stroke-linejoin", "stop-color"] }] + }, + "globals": { + "vars": true, + "breadcrumbs": true, + "device": true, + "cordova": true + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d95596e --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +*.com +*.class +*.dll +*.exe +*.o +*.so +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip +*.log +*.sql +*.sqlite +build +build.zip +node_modules +app/www +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..1dab4ed --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact = true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..f628d2e --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +11.3.0 diff --git a/app/config.xml b/app/config.xml new file mode 100644 index 0000000..1585f13 --- /dev/null +++ b/app/config.xml @@ -0,0 +1,121 @@ + + + + App Name + App Description + Author Name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/hooks/README.md b/app/hooks/README.md new file mode 100644 index 0000000..574ad4c --- /dev/null +++ b/app/hooks/README.md @@ -0,0 +1,23 @@ + +# Cordova Hooks + +Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide. diff --git a/app/platforms/browser/browser.json b/app/platforms/browser/browser.json new file mode 100644 index 0000000..690a30d --- /dev/null +++ b/app/platforms/browser/browser.json @@ -0,0 +1,336 @@ +{ + "prepare_queue": { + "installed": [], + "uninstalled": [] + }, + "config_munge": { + "files": { + "config.xml": { + "parents": { + "/*": [ + { + "xml": "", + "count": 1 + } + ] + } + } + } + }, + "installed_plugins": { + "cordova-plugin-device": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-whitelist": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-statusbar": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-network-information": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-inappbrowser": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-app-version": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-file": { + "PACKAGE_NAME": "com.website.app" + }, + "cordova-plugin-file-transfer": { + "PACKAGE_NAME": "com.website.app" + } + }, + "dependent_plugins": {}, + "modules": [ + { + "file": "plugins/cordova-plugin-device/www/device.js", + "id": "cordova-plugin-device.device", + "pluginId": "cordova-plugin-device", + "clobbers": [ + "device" + ] + }, + { + "file": "plugins/cordova-plugin-device/src/browser/DeviceProxy.js", + "id": "cordova-plugin-device.DeviceProxy", + "pluginId": "cordova-plugin-device", + "runs": true + }, + { + "file": "plugins/cordova-plugin-statusbar/www/statusbar.js", + "id": "cordova-plugin-statusbar.statusbar", + "pluginId": "cordova-plugin-statusbar", + "clobbers": [ + "window.StatusBar" + ] + }, + { + "file": "plugins/cordova-plugin-statusbar/src/browser/StatusBarProxy.js", + "id": "cordova-plugin-statusbar.StatusBarProxy", + "pluginId": "cordova-plugin-statusbar", + "runs": true + }, + { + "file": "plugins/cordova-plugin-network-information/www/network.js", + "id": "cordova-plugin-network-information.network", + "pluginId": "cordova-plugin-network-information", + "clobbers": [ + "navigator.connection", + "navigator.network.connection" + ] + }, + { + "file": "plugins/cordova-plugin-network-information/www/Connection.js", + "id": "cordova-plugin-network-information.Connection", + "pluginId": "cordova-plugin-network-information", + "clobbers": [ + "Connection" + ] + }, + { + "file": "plugins/cordova-plugin-network-information/src/browser/network.js", + "id": "cordova-plugin-network-information.NetworkInfoProxy", + "pluginId": "cordova-plugin-network-information", + "runs": true + }, + { + "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", + "id": "cordova-plugin-inappbrowser.inappbrowser", + "pluginId": "cordova-plugin-inappbrowser", + "clobbers": [ + "cordova.InAppBrowser.open", + "window.open" + ] + }, + { + "file": "plugins/cordova-plugin-inappbrowser/src/browser/InAppBrowserProxy.js", + "id": "cordova-plugin-inappbrowser.InAppBrowserProxy", + "pluginId": "cordova-plugin-inappbrowser", + "runs": true + }, + { + "file": "plugins/cordova-plugin-app-version/www/AppVersionPlugin.js", + "id": "cordova-plugin-app-version.AppVersionPlugin", + "pluginId": "cordova-plugin-app-version", + "clobbers": [ + "cordova.getAppVersion" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/DirectoryEntry.js", + "id": "cordova-plugin-file.DirectoryEntry", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.DirectoryEntry" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/DirectoryReader.js", + "id": "cordova-plugin-file.DirectoryReader", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.DirectoryReader" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/Entry.js", + "id": "cordova-plugin-file.Entry", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.Entry" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/File.js", + "id": "cordova-plugin-file.File", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.File" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileEntry.js", + "id": "cordova-plugin-file.FileEntry", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileEntry" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileError.js", + "id": "cordova-plugin-file.FileError", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileError" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileReader.js", + "id": "cordova-plugin-file.FileReader", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileReader" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileSystem.js", + "id": "cordova-plugin-file.FileSystem", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileSystem" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileUploadOptions.js", + "id": "cordova-plugin-file.FileUploadOptions", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileUploadOptions" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileUploadResult.js", + "id": "cordova-plugin-file.FileUploadResult", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileUploadResult" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/FileWriter.js", + "id": "cordova-plugin-file.FileWriter", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.FileWriter" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/Flags.js", + "id": "cordova-plugin-file.Flags", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.Flags" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/LocalFileSystem.js", + "id": "cordova-plugin-file.LocalFileSystem", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.LocalFileSystem" + ], + "merges": [ + "window" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/Metadata.js", + "id": "cordova-plugin-file.Metadata", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.Metadata" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/ProgressEvent.js", + "id": "cordova-plugin-file.ProgressEvent", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.ProgressEvent" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/fileSystems.js", + "id": "cordova-plugin-file.fileSystems", + "pluginId": "cordova-plugin-file" + }, + { + "file": "plugins/cordova-plugin-file/www/requestFileSystem.js", + "id": "cordova-plugin-file.requestFileSystem", + "pluginId": "cordova-plugin-file", + "clobbers": [ + "window.requestFileSystem" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js", + "id": "cordova-plugin-file.resolveLocalFileSystemURI", + "pluginId": "cordova-plugin-file", + "merges": [ + "window" + ] + }, + { + "file": "plugins/cordova-plugin-file/www/browser/isChrome.js", + "id": "cordova-plugin-file.isChrome", + "pluginId": "cordova-plugin-file", + "runs": true + }, + { + "file": "plugins/cordova-plugin-file/www/browser/Preparing.js", + "id": "cordova-plugin-file.Preparing", + "pluginId": "cordova-plugin-file", + "runs": true + }, + { + "file": "plugins/cordova-plugin-file/src/browser/FileProxy.js", + "id": "cordova-plugin-file.browserFileProxy", + "pluginId": "cordova-plugin-file", + "runs": true + }, + { + "file": "plugins/cordova-plugin-file/www/fileSystemPaths.js", + "id": "cordova-plugin-file.fileSystemPaths", + "pluginId": "cordova-plugin-file", + "merges": [ + "cordova" + ], + "runs": true + }, + { + "file": "plugins/cordova-plugin-file/www/browser/FileSystem.js", + "id": "cordova-plugin-file.firefoxFileSystem", + "pluginId": "cordova-plugin-file", + "merges": [ + "window.FileSystem" + ] + }, + { + "file": "plugins/cordova-plugin-file-transfer/www/FileTransferError.js", + "id": "cordova-plugin-file-transfer.FileTransferError", + "pluginId": "cordova-plugin-file-transfer", + "clobbers": [ + "window.FileTransferError" + ] + }, + { + "file": "plugins/cordova-plugin-file-transfer/www/FileTransfer.js", + "id": "cordova-plugin-file-transfer.FileTransfer", + "pluginId": "cordova-plugin-file-transfer", + "clobbers": [ + "window.FileTransfer" + ] + }, + { + "file": "plugins/cordova-plugin-file-transfer/www/browser/FileTransfer.js", + "id": "cordova-plugin-file-transfer.BrowserFileTransfer", + "pluginId": "cordova-plugin-file-transfer", + "clobbers": [ + "window.FileTransfer" + ] + } + ], + "plugin_metadata": { + "cordova-plugin-device": "1.1.7", + "cordova-plugin-whitelist": "1.3.3", + "cordova-plugin-statusbar": "2.3.0", + "cordova-plugin-network-information": "1.3.4", + "cordova-plugin-inappbrowser": "1.7.2", + "cordova-plugin-app-version": "0.1.9", + "cordova-plugin-file": "6.0.1", + "cordova-plugin-file-transfer": "1.7.0" + } +} \ No newline at end of file diff --git a/app/platforms/browser/config.xml b/app/platforms/browser/config.xml new file mode 100644 index 0000000..cfb03a6 --- /dev/null +++ b/app/platforms/browser/config.xml @@ -0,0 +1,19 @@ + + + + + + Arilly + Find local bakers, make-up artists, photographers and other professionals + Arilly Limited + + + + + + + + + + + diff --git a/app/platforms/browser/cordova/build.bat b/app/platforms/browser/cordova/build.bat new file mode 100644 index 0000000..02641bc --- /dev/null +++ b/app/platforms/browser/cordova/build.bat @@ -0,0 +1,26 @@ +:: 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. + +@ECHO OFF +SET script_path="%~dp0build" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/app/platforms/browser/cordova/clean b/app/platforms/browser/cordova/clean new file mode 100644 index 0000000..da21bc7 --- /dev/null +++ b/app/platforms/browser/cordova/clean @@ -0,0 +1,37 @@ +#!/usr/bin/env node + +/* + 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 path = require('path'), + clean = require('./lib/clean'), + reqs = require('./lib/check_reqs'), + args = process.argv; + +// Support basic help commands +if ( args.length > 2 + || args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || + args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { + console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'clean')) ); + process.exit(0); +} else { + clean.cleanProject(); +} + diff --git a/app/platforms/browser/cordova/defaults.xml b/app/platforms/browser/cordova/defaults.xml new file mode 100644 index 0000000..a7b31c0 --- /dev/null +++ b/app/platforms/browser/cordova/defaults.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/app/platforms/browser/cordova/lib/build.js b/app/platforms/browser/cordova/lib/build.js new file mode 100644 index 0000000..fde7519 --- /dev/null +++ b/app/platforms/browser/cordova/lib/build.js @@ -0,0 +1,65 @@ +#!/usr/bin/env node + +/* + * 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 path = require('path'), + fs = require('fs'), + shjs = require('shelljs'), + zip = require('adm-zip'), + Q = require('q'), + clean = require('./clean'), + check_reqs = require('./check_reqs'), + platformWwwDir = path.join('platforms', 'browser', 'www'), + platformBuildDir = path.join('platforms', 'browser', 'build'), + packageFile = path.join(platformBuildDir, 'package.zip'); + +/** + * run + * Creates a zip file int platform/build folder + */ +module.exports.run = function(){ + + return check_reqs.run() + .then(function(){ + return clean.cleanProject(); + }, + function checkReqsError(err){ + console.error('Please make sure you meet the software requirements in order to build a browser cordova project'); + }) + .then(function(){ + + if (!fs.existsSync(platformBuildDir)) { + fs.mkdirSync(platformBuildDir); + } + + // add the project to a zipfile + var zipFile = zip(); + zipFile.addLocalFolder(platformWwwDir, '.'); + zipFile.writeZip(packageFile); + + return Q.resolve(); + + }); +}; + +module.exports.help = function() { + console.log('Usage: cordova build browser'); + console.log('Build will create the packaged app in \''+platformBuildDir+'\'.'); +}; diff --git a/app/platforms/browser/cordova/lib/check_reqs.js b/app/platforms/browser/cordova/lib/check_reqs.js new file mode 100644 index 0000000..720d7aa --- /dev/null +++ b/app/platforms/browser/cordova/lib/check_reqs.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +/* +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. +*/ + +//add methods as we determine what are the requirements + +var Q = require('q'); + +module.exports.run = function() { + return Q.resolve(); +}; diff --git a/app/platforms/browser/cordova/lib/clean.js b/app/platforms/browser/cordova/lib/clean.js new file mode 100644 index 0000000..2e4367d --- /dev/null +++ b/app/platforms/browser/cordova/lib/clean.js @@ -0,0 +1,46 @@ +#!/usr/bin/env node + +/* + * 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 fs = require('fs'), + shjs = require('shelljs'), + path = require('path'), + check_reqs = require('./check_reqs'), + platformBuildDir = path.join('platforms', 'browser', 'build'); + +exports.cleanProject = function(){ + + // Check that requirements are (stil) met + if (!check_reqs.run()) { + console.error('Please make sure you meet the software requirements in order to clean an browser cordova project'); + process.exit(2); + } + + console.log('Cleaning Browser project'); + try { + if (fs.existsSync(platformBuildDir)) { + shjs.rm('-r', platformBuildDir); + } + } + catch(err) { + console.log('could not remove '+platformBuildDir+' : '+err.message); + } +}; + diff --git a/app/platforms/browser/cordova/run b/app/platforms/browser/cordova/run new file mode 100644 index 0000000..d4c690b --- /dev/null +++ b/app/platforms/browser/cordova/run @@ -0,0 +1,70 @@ +#!/usr/bin/env node + +/* + 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 fs = require('fs'), + path = require('path'), + nopt = require('nopt'), + url = require('url'), + cordovaServe = require('cordova-serve'); + +var args = process.argv; + +start(args); + +function start(argv) { + var args = nopt({'help': Boolean, 'target': String, 'port': Number}, {'help': ['/?', '-h', 'help', '-help', '/help']}, argv); + if(args.help) { + help(); + } + + // defaults + args.port = args.port || 8000; + args.target = args.target || "chrome"; + + var root = path.join(__dirname, '../'), + configFile = path.resolve(path.join(root, 'config.xml')), + configXML = fs.readFileSync(configFile, 'utf8'), + sourceFile = / ] [ --port= ]"); + console.log(" --target= : Launches the specified browser. Chrome is default."); + console.log(" --port= : Http server uses specified port number."); + console.log("Examples:"); + console.log(" run"); + console.log(" run -- --target=ie"); + console.log(" run -- --target=chrome --port=8000"); + console.log(""); + process.exit(0); +} diff --git a/app/platforms/browser/cordova/run.bat b/app/platforms/browser/cordova/run.bat new file mode 100644 index 0000000..b9c4402 --- /dev/null +++ b/app/platforms/browser/cordova/run.bat @@ -0,0 +1,26 @@ +:: 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. + +@ECHO OFF +SET script_path="%~dp0run" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/app/platforms/browser/cordova/version b/app/platforms/browser/cordova/version new file mode 100644 index 0000000..8a13bae --- /dev/null +++ b/app/platforms/browser/cordova/version @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +/* + 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. +*/ + +// Coho updates this line: +var VERSION = "4.1.0"; + +console.log(VERSION); diff --git a/app/platforms/browser/cordova/version.bat b/app/platforms/browser/cordova/version.bat new file mode 100644 index 0000000..3610c17 --- /dev/null +++ b/app/platforms/browser/cordova/version.bat @@ -0,0 +1,26 @@ +:: 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. + +@ECHO OFF +SET script_path="%~dp0version" +IF EXIST %script_path% ( + node %script_path% %* +) ELSE ( + ECHO. + ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 + EXIT /B 1 +) diff --git a/app/platforms/browser/css/index.css b/app/platforms/browser/css/index.css new file mode 100644 index 0000000..51daa79 --- /dev/null +++ b/app/platforms/browser/css/index.css @@ -0,0 +1,115 @@ +/* + * 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. + */ +* { + -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ +} + +body { + -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ + -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ + -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ + background-color:#E4E4E4; + background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); + background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); + background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); + background-image:-webkit-gradient( + linear, + left top, + left bottom, + color-stop(0, #A7A7A7), + color-stop(0.51, #E4E4E4) + ); + background-attachment:fixed; + font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; + font-size:12px; + height:100%; + margin:0px; + padding:0px; + text-transform:uppercase; + width:100%; +} + +/* Portrait layout (default) */ +.app { + background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ + position:absolute; /* position in the center of the screen */ + left:50%; + top:50%; + height:50px; /* text area height */ + width:225px; /* text area width */ + text-align:center; + padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ + margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ + /* offset horizontal: half of text area width */ +} + +/* Landscape layout (with min-width) */ +@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { + .app { + background-position:left center; + padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ + margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ + /* offset horizontal: half of image width and text area width */ + } +} + +h1 { + font-size:24px; + font-weight:normal; + margin:0px; + overflow:visible; + padding:0px; + text-align:center; +} + +.event { + border-radius:4px; + -webkit-border-radius:4px; + color:#FFFFFF; + font-size:12px; + margin:0px 30px; + padding:2px 0px; +} + +.event.listening { + background-color:#333333; + display:block; +} + +.event.received { + background-color:#4B946A; + display:none; +} + +@keyframes fade { + from { opacity: 1.0; } + 50% { opacity: 0.4; } + to { opacity: 1.0; } +} + +@-webkit-keyframes fade { + from { opacity: 1.0; } + 50% { opacity: 0.4; } + to { opacity: 1.0; } +} + +.blink { + animation:fade 3000ms infinite; + -webkit-animation:fade 3000ms infinite; +} diff --git a/app/platforms/browser/img/logo.png b/app/platforms/browser/img/logo.png new file mode 100644 index 0000000..9519e7d Binary files /dev/null and b/app/platforms/browser/img/logo.png differ diff --git a/app/platforms/browser/index.html b/app/platforms/browser/index.html new file mode 100644 index 0000000..bde5741 --- /dev/null +++ b/app/platforms/browser/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + Hello World + + +
+

Apache Cordova

+ +
+ + + + + diff --git a/app/platforms/browser/js/index.js b/app/platforms/browser/js/index.js new file mode 100644 index 0000000..31d9064 --- /dev/null +++ b/app/platforms/browser/js/index.js @@ -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. + */ +var app = { + // Application Constructor + initialize: function() { + this.bindEvents(); + }, + // Bind Event Listeners + // + // Bind any events that are required on startup. Common events are: + // 'load', 'deviceready', 'offline', and 'online'. + bindEvents: function() { + document.addEventListener('deviceready', this.onDeviceReady, false); + }, + // deviceready Event Handler + // + // The scope of 'this' is the event. In order to call the 'receivedEvent' + // function, we must explicity call 'app.receivedEvent(...);' + onDeviceReady: function() { + app.receivedEvent('deviceready'); + }, + // Update DOM on a Received Event + receivedEvent: function(id) { + var parentElement = document.getElementById(id); + var listeningElement = parentElement.querySelector('.listening'); + var receivedElement = parentElement.querySelector('.received'); + + listeningElement.setAttribute('style', 'display:none;'); + receivedElement.setAttribute('style', 'display:block;'); + + console.log('Received Event: ' + id); + } +}; diff --git a/app/platforms/browser/manifest.webapp b/app/platforms/browser/manifest.webapp new file mode 100644 index 0000000..f24deb8 --- /dev/null +++ b/app/platforms/browser/manifest.webapp @@ -0,0 +1,10 @@ +{ + "name": "My App", + "description": "Description of your app", + "launch_path": "/index.html", + "icons": { + "128": "/img/logo.png" + }, + "default_locale": "en", + "type": "privileged" +} \ No newline at end of file diff --git a/app/platforms/browser/platform_www/confighelper.js b/app/platforms/browser/platform_www/confighelper.js new file mode 100644 index 0000000..b6d606e --- /dev/null +++ b/app/platforms/browser/platform_www/confighelper.js @@ -0,0 +1,95 @@ +/* + * + * 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 config; + +function Config(xhr) { + function loadPreferences(xhr) { + var parser = new DOMParser(); + var doc = parser.parseFromString(xhr.responseText, "application/xml"); + + var preferences = doc.getElementsByTagName("preference"); + return Array.prototype.slice.call(preferences); + } + + this.xhr = xhr; + this.preferences = loadPreferences(this.xhr); +} + +function readConfig(success, error) { + var xhr; + + if(typeof config != 'undefined') { + success(config); + } + + function fail(msg) { + console.error(msg); + + if(error) { + error(msg); + } + } + + var xhrStatusChangeHandler = function() { + if (xhr.readyState == 4) { + if (xhr.status == 200 || xhr.status == 304 || xhr.status === 0 /* file:// */) { + config = new Config(xhr); + success(config); + } + else { + fail('[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: ' + xhr.statusText); + } + } + }; + + if ("ActiveXObject" in window) { + // Needed for XHR-ing via file:// protocol in IE + xhr = new window.ActiveXObject("MSXML2.XMLHTTP"); + xhr.onreadystatechange = xhrStatusChangeHandler; + } else { + xhr = new XMLHttpRequest(); + xhr.addEventListener("load", xhrStatusChangeHandler); + } + + try { + xhr.open("get", "/config.xml", true); + xhr.send(); + } catch(e) { + fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e)); + } +} + +/** + * Reads a preference value from config.xml. + * Returns preference value or undefined if it does not exist. + * @param {String} preferenceName Preference name to read */ +Config.prototype.getPreferenceValue = function getPreferenceValue(preferenceName) { + var preferenceItem = this.preferences && this.preferences.filter(function(item) { + return item.attributes.name && item.attributes.name.value === preferenceName; + }); + + if(preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes.value) { + return preferenceItem[0].attributes.value.value; + } +}; + +exports.readConfig = readConfig; diff --git a/app/platforms/browser/platform_www/cordova-js-src/confighelper.js b/app/platforms/browser/platform_www/cordova-js-src/confighelper.js new file mode 100644 index 0000000..b6d606e --- /dev/null +++ b/app/platforms/browser/platform_www/cordova-js-src/confighelper.js @@ -0,0 +1,95 @@ +/* + * + * 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 config; + +function Config(xhr) { + function loadPreferences(xhr) { + var parser = new DOMParser(); + var doc = parser.parseFromString(xhr.responseText, "application/xml"); + + var preferences = doc.getElementsByTagName("preference"); + return Array.prototype.slice.call(preferences); + } + + this.xhr = xhr; + this.preferences = loadPreferences(this.xhr); +} + +function readConfig(success, error) { + var xhr; + + if(typeof config != 'undefined') { + success(config); + } + + function fail(msg) { + console.error(msg); + + if(error) { + error(msg); + } + } + + var xhrStatusChangeHandler = function() { + if (xhr.readyState == 4) { + if (xhr.status == 200 || xhr.status == 304 || xhr.status === 0 /* file:// */) { + config = new Config(xhr); + success(config); + } + else { + fail('[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: ' + xhr.statusText); + } + } + }; + + if ("ActiveXObject" in window) { + // Needed for XHR-ing via file:// protocol in IE + xhr = new window.ActiveXObject("MSXML2.XMLHTTP"); + xhr.onreadystatechange = xhrStatusChangeHandler; + } else { + xhr = new XMLHttpRequest(); + xhr.addEventListener("load", xhrStatusChangeHandler); + } + + try { + xhr.open("get", "/config.xml", true); + xhr.send(); + } catch(e) { + fail('[Browser][cordova.js][readConfig] Could not XHR config.xml: ' + JSON.stringify(e)); + } +} + +/** + * Reads a preference value from config.xml. + * Returns preference value or undefined if it does not exist. + * @param {String} preferenceName Preference name to read */ +Config.prototype.getPreferenceValue = function getPreferenceValue(preferenceName) { + var preferenceItem = this.preferences && this.preferences.filter(function(item) { + return item.attributes.name && item.attributes.name.value === preferenceName; + }); + + if(preferenceItem && preferenceItem[0] && preferenceItem[0].attributes && preferenceItem[0].attributes.value) { + return preferenceItem[0].attributes.value.value; + } +}; + +exports.readConfig = readConfig; diff --git a/app/platforms/browser/platform_www/cordova-js-src/exec.js b/app/platforms/browser/platform_www/cordova-js-src/exec.js new file mode 100644 index 0000000..97f736a --- /dev/null +++ b/app/platforms/browser/platform_www/cordova-js-src/exec.js @@ -0,0 +1,114 @@ +/* + * + * 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. + * +*/ + +/*jslint sloppy:true, plusplus:true*/ +/*global require, module, console */ + +var cordova = require('cordova'); +var execProxy = require('cordova/exec/proxy'); + +/** + * Execute a cordova command. It is up to the native side whether this action + * is synchronous or asynchronous. The native side can return: + * Synchronous: PluginResult object as a JSON string + * Asynchronous: Empty string "" + * If async, the native side will cordova.callbackSuccess or cordova.callbackError, + * depending upon the result of the action. + * + * @param {Function} success The success callback + * @param {Function} fail The fail callback + * @param {String} service The name of the service to use + * @param {String} action Action to be run in cordova + * @param {String[]} [args] Zero or more arguments to pass to the method + */ +module.exports = function (success, fail, service, action, args) { + + var proxy = execProxy.get(service, action); + + args = args || []; + + if (proxy) { + + var callbackId = service + cordova.callbackId++; + + if (typeof success === "function" || typeof fail === "function") { + cordova.callbacks[callbackId] = {success: success, fail: fail}; + } + try { + + + + // callbackOptions param represents additional optional parameters command could pass back, like keepCallback or + // custom callbackId, for example {callbackId: id, keepCallback: true, status: cordova.callbackStatus.JSON_EXCEPTION } + var onSuccess = function (result, callbackOptions) { + callbackOptions = callbackOptions || {}; + var callbackStatus; + // covering both undefined and null. + // strict null comparison was causing callbackStatus to be undefined + // and then no callback was called because of the check in cordova.callbackFromNative + // see CB-8996 Mobilespec app hang on windows + if (callbackOptions.status !== undefined && callbackOptions.status !== null) { + callbackStatus = callbackOptions.status; + } + else { + callbackStatus = cordova.callbackStatus.OK; + } + cordova.callbackSuccess(callbackOptions.callbackId || callbackId, + { + status: callbackStatus, + message: result, + keepCallback: callbackOptions.keepCallback || false + }); + }; + var onError = function (err, callbackOptions) { + callbackOptions = callbackOptions || {}; + var callbackStatus; + // covering both undefined and null. + // strict null comparison was causing callbackStatus to be undefined + // and then no callback was called because of the check in cordova.callbackFromNative + // note: status can be 0 + if (callbackOptions.status !== undefined && callbackOptions.status !== null) { + callbackStatus = callbackOptions.status; + } + else { + callbackStatus = cordova.callbackStatus.OK; + } + cordova.callbackError(callbackOptions.callbackId || callbackId, + { + status: callbackStatus, + message: err, + keepCallback: callbackOptions.keepCallback || false + }); + }; + proxy(onSuccess, onError, args); + + } catch (e) { + console.log("Exception calling native with command :: " + service + " :: " + action + " ::exception=" + e); + } + } else { + + console.log("Error: exec proxy not found for :: " + service + " :: " + action); + + if(typeof fail === "function" ) { + fail("Missing Command Error"); + } + } +}; diff --git a/app/platforms/browser/platform_www/cordova-js-src/platform.js b/app/platforms/browser/platform_www/cordova-js-src/platform.js new file mode 100644 index 0000000..0514059 --- /dev/null +++ b/app/platforms/browser/platform_www/cordova-js-src/platform.js @@ -0,0 +1,48 @@ +/* + * + * 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 = { + id: 'browser', + cordovaVersion: '3.4.0', + + bootstrap: function() { + + var modulemapper = require('cordova/modulemapper'); + var channel = require('cordova/channel'); + + modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy'); + + channel.onNativeReady.fire(); + + // FIXME is this the right place to clobber pause/resume? I am guessing not + // FIXME pause/resume should be deprecated IN CORDOVA for pagevisiblity api + document.addEventListener('webkitvisibilitychange', function() { + if (document.webkitHidden) { + channel.onPause.fire(); + } + else { + channel.onResume.fire(); + } + }, false); + + // End of bootstrap + } +}; diff --git a/app/platforms/browser/platform_www/cordova.js b/app/platforms/browser/platform_www/cordova.js new file mode 100644 index 0000000..80ad302 --- /dev/null +++ b/app/platforms/browser/platform_www/cordova.js @@ -0,0 +1,1863 @@ +// Platform: browser +// c517ca811b4948b630e0b74dbae6c9637939da24 +/* + 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() { +var PLATFORM_VERSION_BUILD_LABEL = '4.1.0'; +// file: src/scripts/require.js + +/*jshint -W079 */ +/*jshint -W020 */ + +var require, + define; + +(function () { + var modules = {}, + // Stack of moduleIds currently being built. + requireStack = [], + // Map of module ID -> index into requireStack of modules currently being built. + inProgressModules = {}, + SEPARATOR = "."; + + + + function build(module) { + var factory = module.factory, + localRequire = function (id) { + var resultantId = id; + //Its a relative path, so lop off the last portion and add the id (minus "./") + if (id.charAt(0) === ".") { + resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2); + } + return require(resultantId); + }; + module.exports = {}; + delete module.factory; + factory(localRequire, module.exports, module); + return module.exports; + } + + require = function (id) { + if (!modules[id]) { + throw "module " + id + " not found"; + } else if (id in inProgressModules) { + var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id; + throw "Cycle in require graph: " + cycle; + } + if (modules[id].factory) { + try { + inProgressModules[id] = requireStack.length; + requireStack.push(id); + return build(modules[id]); + } finally { + delete inProgressModules[id]; + requireStack.pop(); + } + } + return modules[id].exports; + }; + + define = function (id, factory) { + if (modules[id]) { + throw "module " + id + " already defined"; + } + + modules[id] = { + id: id, + factory: factory + }; + }; + + define.remove = function (id) { + delete modules[id]; + }; + + define.moduleMap = modules; +})(); + +//Export for use in node +if (typeof module === "object" && typeof require === "function") { + module.exports.require = require; + module.exports.define = define; +} + +// file: src/cordova.js +define("cordova", function(require, exports, module) { + +// Workaround for Windows 10 in hosted environment case +// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object +if (window.cordova && !(window.cordova instanceof HTMLElement)) { + throw new Error("cordova already defined"); +} + + +var channel = require('cordova/channel'); +var platform = require('cordova/platform'); + + +/** + * Intercept calls to addEventListener + removeEventListener and handle deviceready, + * resume, and pause events. + */ +var m_document_addEventListener = document.addEventListener; +var m_document_removeEventListener = document.removeEventListener; +var m_window_addEventListener = window.addEventListener; +var m_window_removeEventListener = window.removeEventListener; + +/** + * Houses custom event handlers to intercept on document + window event listeners. + */ +var documentEventHandlers = {}, + windowEventHandlers = {}; + +document.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof documentEventHandlers[e] != 'undefined') { + documentEventHandlers[e].subscribe(handler); + } else { + m_document_addEventListener.call(document, evt, handler, capture); + } +}; + +window.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } +}; + +document.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubscribing from an event that is handled by a plugin + if (typeof documentEventHandlers[e] != "undefined") { + documentEventHandlers[e].unsubscribe(handler); + } else { + m_document_removeEventListener.call(document, evt, handler, capture); + } +}; + +window.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubscribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } +}; + +function createEvent(type, data) { + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + } + return event; +} + + +var cordova = { + define:define, + require:require, + version:PLATFORM_VERSION_BUILD_LABEL, + platformVersion:PLATFORM_VERSION_BUILD_LABEL, + platformId:platform.id, + /** + * Methods to add/remove your own addEventListener hijacking on document + window. + */ + addWindowEventHandler:function(event) { + return (windowEventHandlers[event] = channel.create(event)); + }, + addStickyDocumentEventHandler:function(event) { + return (documentEventHandlers[event] = channel.createSticky(event)); + }, + addDocumentEventHandler:function(event) { + return (documentEventHandlers[event] = channel.create(event)); + }, + removeWindowEventHandler:function(event) { + delete windowEventHandlers[event]; + }, + removeDocumentEventHandler:function(event) { + delete documentEventHandlers[event]; + }, + /** + * Retrieve original event handlers that were replaced by Cordova + * + * @return object + */ + getOriginalHandlers: function() { + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + }, + /** + * Method to fire event from native code + * bNoDetach is required for events which cause an exception which needs to be caught in native code + */ + fireDocumentEvent: function(type, data, bNoDetach) { + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + if( bNoDetach ) { + documentEventHandlers[type].fire(evt); + } + else { + setTimeout(function() { + // Fire deviceready on listeners that were registered before cordova.js was loaded. + if (type == 'deviceready') { + document.dispatchEvent(evt); + } + documentEventHandlers[type].fire(evt); + }, 0); + } + } else { + document.dispatchEvent(evt); + } + }, + fireWindowEvent: function(type, data) { + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } + }, + + /** + * Plugin callback mechanism. + */ + // Randomize the starting callbackId to avoid collisions after refreshing or navigating. + // This way, it's very unlikely that any new callback would get the same callbackId as an old callback. + callbackId: Math.floor(Math.random() * 2000000000), + callbacks: {}, + callbackStatus: { + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 + }, + + /** + * Called by native code when returning successful result from an action. + */ + callbackSuccess: function(callbackId, args) { + cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback); + }, + + /** + * Called by native code when returning error result from an action. + */ + callbackError: function(callbackId, args) { + // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative. + // Derive success from status. + cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback); + }, + + /** + * Called by native code when returning the result from an action. + */ + callbackFromNative: function(callbackId, isSuccess, status, args, keepCallback) { + try { + var callback = cordova.callbacks[callbackId]; + if (callback) { + if (isSuccess && status == cordova.callbackStatus.OK) { + callback.success && callback.success.apply(null, args); + } else if (!isSuccess) { + callback.fail && callback.fail.apply(null, args); + } + /* + else + Note, this case is intentionally not caught. + this can happen if isSuccess is true, but callbackStatus is NO_RESULT + which is used to remove a callback from the list without calling the callbacks + typically keepCallback is false in this case + */ + // Clear callback if not expecting any more results + if (!keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + } + catch (err) { + var msg = "Error in " + (isSuccess ? "Success" : "Error") + " callbackId: " + callbackId + " : " + err; + console && console.log && console.log(msg); + cordova.fireWindowEvent("cordovacallbackerror", { 'message': msg }); + throw err; + } + }, + addConstructor: function(func) { + channel.onCordovaReady.subscribe(function() { + try { + func(); + } catch(e) { + console.log("Failed to run constructor: " + e); + } + }); + } +}; + + +module.exports = cordova; + +}); + +// file: src/common/argscheck.js +define("cordova/argscheck", function(require, exports, module) { + +var utils = require('cordova/utils'); + +var moduleExports = module.exports; + +var typeMap = { + 'A': 'Array', + 'D': 'Date', + 'N': 'Number', + 'S': 'String', + 'F': 'Function', + 'O': 'Object' +}; + +function extractParamName(callee, argIndex) { + return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex]; +} + +function checkArgs(spec, functionName, args, opt_callee) { + if (!moduleExports.enableChecks) { + return; + } + var errMsg = null; + var typeName; + for (var i = 0; i < spec.length; ++i) { + var c = spec.charAt(i), + cUpper = c.toUpperCase(), + arg = args[i]; + // Asterix means allow anything. + if (c == '*') { + continue; + } + typeName = utils.typeName(arg); + if ((arg === null || arg === undefined) && c == cUpper) { + continue; + } + if (typeName != typeMap[cUpper]) { + errMsg = 'Expected ' + typeMap[cUpper]; + break; + } + } + if (errMsg) { + errMsg += ', but got ' + typeName + '.'; + errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg; + // Don't log when running unit tests. + if (typeof jasmine == 'undefined') { + console.error(errMsg); + } + throw TypeError(errMsg); + } +} + +function getValue(value, defaultValue) { + return value === undefined ? defaultValue : value; +} + +moduleExports.checkArgs = checkArgs; +moduleExports.getValue = getValue; +moduleExports.enableChecks = true; + + +}); + +// file: src/common/base64.js +define("cordova/base64", function(require, exports, module) { + +var base64 = exports; + +base64.fromArrayBuffer = function(arrayBuffer) { + var array = new Uint8Array(arrayBuffer); + return uint8ToBase64(array); +}; + +base64.toArrayBuffer = function(str) { + var decodedStr = typeof atob != 'undefined' ? atob(str) : new Buffer(str,'base64').toString('binary'); + var arrayBuffer = new ArrayBuffer(decodedStr.length); + var array = new Uint8Array(arrayBuffer); + for (var i=0, len=decodedStr.length; i < len; i++) { + array[i] = decodedStr.charCodeAt(i); + } + return arrayBuffer; +}; + +//------------------------------------------------------------------------------ + +/* This code is based on the performance tests at http://jsperf.com/b64tests + * This 12-bit-at-a-time algorithm was the best performing version on all + * platforms tested. + */ + +var b64_6bit = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var b64_12bit; + +var b64_12bitTable = function() { + b64_12bit = []; + for (var i=0; i<64; i++) { + for (var j=0; j<64; j++) { + b64_12bit[i*64+j] = b64_6bit[i] + b64_6bit[j]; + } + } + b64_12bitTable = function() { return b64_12bit; }; + return b64_12bit; +}; + +function uint8ToBase64(rawData) { + var numBytes = rawData.byteLength; + var output=""; + var segment; + var table = b64_12bitTable(); + for (var i=0;i> 12]; + output += table[segment & 0xfff]; + } + if (numBytes - i == 2) { + segment = (rawData[i] << 16) + (rawData[i+1] << 8); + output += table[segment >> 12]; + output += b64_6bit[(segment & 0xfff) >> 6]; + output += '='; + } else if (numBytes - i == 1) { + segment = (rawData[i] << 16); + output += table[segment >> 12]; + output += '=='; + } + return output; +} + +}); + +// file: src/common/builder.js +define("cordova/builder", function(require, exports, module) { + +var utils = require('cordova/utils'); + +function each(objects, func, context) { + for (var prop in objects) { + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } + } +} + +function clobber(obj, key, value) { + exports.replaceHookForTesting(obj, key); + var needsProperty = false; + try { + obj[key] = value; + } catch (e) { + needsProperty = true; + } + // Getters can only be overridden by getters. + if (needsProperty || obj[key] !== value) { + utils.defineGetter(obj, key, function() { + return value; + }); + } +} + +function assignOrWrapInDeprecateGetter(obj, key, value, message) { + if (message) { + utils.defineGetter(obj, key, function() { + console.log(message); + delete obj[key]; + clobber(obj, key, value); + return value; + }); + } else { + clobber(obj, key, value); + } +} + +function include(parent, objects, clobber, merge) { + each(objects, function (obj, key) { + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] == 'undefined') { + assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated); + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch(e) { + utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"'); + } + }); +} + +/** + * Merge properties from one object onto another recursively. Properties from + * the src object will overwrite existing target property. + * + * @param target Object to merge properties into. + * @param src Object to merge properties from. + */ +function recursiveMerge(target, src) { + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + if (target.prototype && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + clobber(target.prototype, prop, src[prop]); + } else { + if (typeof src[prop] === 'object' && typeof target[prop] === 'object') { + recursiveMerge(target[prop], src[prop]); + } else { + clobber(target, prop, src[prop]); + } + } + } + } +} + +exports.buildIntoButDoNotClobber = function(objects, target) { + include(target, objects, false, false); +}; +exports.buildIntoAndClobber = function(objects, target) { + include(target, objects, true, false); +}; +exports.buildIntoAndMerge = function(objects, target) { + include(target, objects, true, true); +}; +exports.recursiveMerge = recursiveMerge; +exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter; +exports.replaceHookForTesting = function() {}; + +}); + +// file: src/common/channel.js +define("cordova/channel", function(require, exports, module) { + +var utils = require('cordova/utils'), + nextGuid = 1; + +/** + * Custom pub-sub "channel" that can have functions subscribed to it + * This object is used to define and control firing of events for + * cordova initialization, as well as for custom events thereafter. + * + * The order of events during page load and Cordova startup is as follows: + * + * onDOMContentLoaded* Internal event that is received when the web page is loaded and parsed. + * onNativeReady* Internal event that indicates the Cordova native side is ready. + * onCordovaReady* Internal event fired when all Cordova JavaScript objects have been created. + * onDeviceReady* User event fired to indicate that Cordova is ready + * onResume User event fired to indicate a start/resume lifecycle event + * onPause User event fired to indicate a pause lifecycle event + * + * The events marked with an * are sticky. Once they have fired, they will stay in the fired state. + * All listeners that subscribe after the event is fired will be executed right away. + * + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript + * pause App has moved to background + * resume App has returned to foreground + * + * Listeners can be registered as: + * document.addEventListener("deviceready", myDeviceReadyListener, false); + * document.addEventListener("resume", myResumeListener, false); + * document.addEventListener("pause", myPauseListener, false); + * + * The DOM lifecycle events should be used for saving and restoring state + * window.onload + * window.onunload + * + */ + +/** + * Channel + * @constructor + * @param type String the channel name + */ +var Channel = function(type, sticky) { + this.type = type; + // Map of guid -> function. + this.handlers = {}; + // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired. + this.state = sticky ? 1 : 0; + // Used in sticky mode to remember args passed to fire(). + this.fireArgs = null; + // Used by onHasSubscribersChange to know if there are any listeners. + this.numHandlers = 0; + // Function that is called when the first listener is subscribed, or when + // the last listener is unsubscribed. + this.onHasSubscribersChange = null; +}, + channel = { + /** + * Calls the provided function only after all of the channels specified + * have been fired. All channels must be sticky channels. + */ + join: function(h, c) { + var len = c.length, + i = len, + f = function() { + if (!(--i)) h(); + }; + for (var j=0; j + if (strategy == 'r') { + continue; + } + var symbolPath = symbolList[i + 2]; + var lastDot = symbolPath.lastIndexOf('.'); + var namespace = symbolPath.substr(0, lastDot); + var lastName = symbolPath.substr(lastDot + 1); + + var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; + var parentObj = prepareNamespace(namespace, context); + var target = parentObj[lastName]; + + if (strategy == 'm' && target) { + builder.recursiveMerge(target, module); + } else if ((strategy == 'd' && !target) || (strategy != 'd')) { + if (!(symbolPath in origSymbols)) { + origSymbols[symbolPath] = target; + } + builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); + } + } +}; + +exports.getOriginalSymbol = function(context, symbolPath) { + var origSymbols = context.CDV_origSymbols; + if (origSymbols && (symbolPath in origSymbols)) { + return origSymbols[symbolPath]; + } + var parts = symbolPath.split('.'); + var obj = context; + for (var i = 0; i < parts.length; ++i) { + obj = obj && obj[parts[i]]; + } + return obj; +}; + +exports.reset(); + + +}); + +// file: src/common/modulemapper_b.js +define("cordova/modulemapper_b", function(require, exports, module) { + +var builder = require('cordova/builder'), + symbolList = [], + deprecationMap; + +exports.reset = function() { + symbolList = []; + deprecationMap = {}; +}; + +function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) { + symbolList.push(strategy, moduleName, symbolPath); + if (opt_deprecationMessage) { + deprecationMap[symbolPath] = opt_deprecationMessage; + } +} + +// Note: Android 2.3 does have Function.bind(). +exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('c', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('m', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) { + addEntry('d', moduleName, symbolPath, opt_deprecationMessage); +}; + +exports.runs = function(moduleName) { + addEntry('r', moduleName, null); +}; + +function prepareNamespace(symbolPath, context) { + if (!symbolPath) { + return context; + } + var parts = symbolPath.split('.'); + var cur = context; + for (var i = 0, part; part = parts[i]; ++i) { + cur = cur[part] = cur[part] || {}; + } + return cur; +} + +exports.mapModules = function(context) { + var origSymbols = {}; + context.CDV_origSymbols = origSymbols; + for (var i = 0, len = symbolList.length; i < len; i += 3) { + var strategy = symbolList[i]; + var moduleName = symbolList[i + 1]; + var module = require(moduleName); + // + if (strategy == 'r') { + continue; + } + var symbolPath = symbolList[i + 2]; + var lastDot = symbolPath.lastIndexOf('.'); + var namespace = symbolPath.substr(0, lastDot); + var lastName = symbolPath.substr(lastDot + 1); + + var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null; + var parentObj = prepareNamespace(namespace, context); + var target = parentObj[lastName]; + + if (strategy == 'm' && target) { + builder.recursiveMerge(target, module); + } else if ((strategy == 'd' && !target) || (strategy != 'd')) { + if (!(symbolPath in origSymbols)) { + origSymbols[symbolPath] = target; + } + builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg); + } + } +}; + +exports.getOriginalSymbol = function(context, symbolPath) { + var origSymbols = context.CDV_origSymbols; + if (origSymbols && (symbolPath in origSymbols)) { + return origSymbols[symbolPath]; + } + var parts = symbolPath.split('.'); + var obj = context; + for (var i = 0; i < parts.length; ++i) { + obj = obj && obj[parts[i]]; + } + return obj; +}; + +exports.reset(); + + +}); + +// file: e:/cordova/cordova-browser/cordova-js-src/platform.js +define("cordova/platform", function(require, exports, module) { + +module.exports = { + id: 'browser', + cordovaVersion: '3.4.0', + + bootstrap: function() { + + var modulemapper = require('cordova/modulemapper'); + var channel = require('cordova/channel'); + + modulemapper.clobbers('cordova/exec/proxy', 'cordova.commandProxy'); + + channel.onNativeReady.fire(); + + // FIXME is this the right place to clobber pause/resume? I am guessing not + // FIXME pause/resume should be deprecated IN CORDOVA for pagevisiblity api + document.addEventListener('webkitvisibilitychange', function() { + if (document.webkitHidden) { + channel.onPause.fire(); + } + else { + channel.onResume.fire(); + } + }, false); + + // End of bootstrap + } +}; + +}); + +// file: src/common/pluginloader.js +define("cordova/pluginloader", function(require, exports, module) { + +var modulemapper = require('cordova/modulemapper'); +var urlutil = require('cordova/urlutil'); + +// Helper function to inject a + + + diff --git a/app/platforms/browser/www/js/bundle.c241d71744a259d2325e.js b/app/platforms/browser/www/js/bundle.c241d71744a259d2325e.js new file mode 100644 index 0000000..9e9fd8e --- /dev/null +++ b/app/platforms/browser/www/js/bundle.c241d71744a259d2325e.js @@ -0,0 +1,19 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=31)}([function(e,t,n){"use strict";function r(){}function i(e,t){var n,i,o,a,l=B;for(a=arguments.length;a-- >2;)L.push(arguments[a]);for(t&&null!=t.children&&(L.length||L.push(t.children),delete t.children);L.length;)if((i=L.pop())&&void 0!==i.pop)for(a=i.length;a--;)L.push(i[a]);else"boolean"==typeof i&&(i=null),(o="function"!=typeof e)&&(null==i?i="":"number"==typeof i?i=String(i):"string"!=typeof i&&(o=!1)),o&&n?l[l.length-1]+=i:l===B?l=[i]:l.push(i),n=o;var u=new r;return u.nodeName=e,u.children=l,u.attributes=null==t?void 0:t,u.key=null==t?void 0:t.key,void 0!==A.vnode&&A.vnode(u),u}function o(e,t){for(var n in t)e[n]=t[n];return e}function a(e,t){return i(e.nodeName,o(o({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function l(e){!e._dirty&&(e._dirty=!0)&&1==I.push(e)&&(A.debounceRendering||z)(u)}function u(){var e,t=I;for(I=[];e=t.pop();)e._dirty&&E(e)}function c(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&s(e,t.nodeName):n||e._componentConstructor===t.nodeName}function s(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function f(e){var t=o({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function d(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.normalizedNodeName=e,n}function p(e){var t=e.parentNode;t&&t.removeChild(e)}function h(e,t,n,r,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),r&&r(e);else if("class"!==t||i)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var o in n)o in r||(e.style[o]="");for(var o in r)e.style[o]="number"==typeof r[o]&&!1===D.test(o)?r[o]+"px":r[o]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var a=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,v,a):e.removeEventListener(t,v,a),(e._listeners||(e._listeners={}))[t]=r}else if("list"!==t&&"type"!==t&&!i&&t in e)y(e,t,null==r?"":r),null!=r&&!1!==r||e.removeAttribute(t);else{var l=i&&t!==(t=t.replace(/^xlink\:?/,""));null==r||!1===r?l?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(l?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function y(e,t,n){try{e[t]=n}catch(e){}}function v(e){return this._listeners[e.type](A.event&&A.event(e)||e)}function m(){for(var e;e=H.pop();)A.afterMount&&A.afterMount(e),e.componentDidMount&&e.componentDidMount()}function g(e,t,n,r,i,o){R++||(V=null!=i&&void 0!==i.ownerSVGElement,U=null!=e&&!("__preactattr_"in e));var a=b(e,t,n,r,o);return i&&a.parentNode!==i&&i.appendChild(a),--R||(U=!1,o||m()),a}function b(e,t,n,r,i){var o=e,a=V;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||i)?e.nodeValue!=t&&(e.nodeValue=t):(o=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(o,e),w(e,!0))),o.__preactattr_=!0,o;var l=t.nodeName;if("function"==typeof l)return P(e,t,n,r);if(V="svg"===l||"foreignObject"!==l&&V,l=String(l),(!e||!s(e,l))&&(o=d(l,V),e)){for(;e.firstChild;)o.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(o,e),w(e,!0)}var u=o.firstChild,c=o.__preactattr_,f=t.children;if(null==c){c=o.__preactattr_={};for(var p=o.attributes,h=p.length;h--;)c[p[h].name]=p[h].value}return!U&&f&&1===f.length&&"string"==typeof f[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=f[0]&&(u.nodeValue=f[0]):(f&&f.length||null!=u)&&x(o,f,n,r,U||null!=c.dangerouslySetInnerHTML),k(o,t.attributes,c),V=a,o}function x(e,t,n,r,i){var o,a,l,u,s,f=e.childNodes,d=[],h={},y=0,v=0,m=f.length,g=0,x=t?t.length:0;if(0!==m)for(var _=0;_0&&void 0!==arguments[0]?arguments[0]:"";return""!==e?window.appGlobals[e]:window.appGlobals}},{key:"set",value:function(e,t){window.appGlobals[e]=t}},{key:"updateViewState",value:function(e){var t=this.get("viewState");t[e.id]=e,this.set("viewState",t)}}]),e}();t.default=new o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=document.querySelectorAll("#app .views > .view"),r=document.getElementById(e.id),o=d.default.get("viewState"),a=h.default.get(),l=!1;if("title"in e&&(l=!0,d.default.updateViewState(e)),a=h.default.add(e.id),[].concat(i(new Set(a))).forEach(function(e,t){var n=document.getElementById(e),r=a.length-t;n&&(n.style.zIndex=r+5)}),o[e.id].backable&&!t){r.classList.add("animate-fade-in-right"),setTimeout(function(){r.classList.remove("animate-fade-in-right")},500),l&&this.backEvents(e.id,r)}if(o[e.id].slidable&&!t){r.classList.add("animate-fade-in-bottom"),setTimeout(function(){r.classList.remove("animate-fade-in-bottom")},500),l&&this.slideEvents(e.id,r)}[].slice.call(n).forEach(function(e){e.classList.remove("is-active")}),r.classList.contains("is-active")||r.classList.add("is-active")}},{key:"goBack",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"backed",r="has-"+n,i=document.getElementById(e);i.style.transform="",i.classList.add(r),h.default.removeFirst(),setTimeout(function(){t.run({id:h.default.get()[0]},!0),t.removeView(e)},100)}},{key:"backEvents",value:function(e){var t=this,n=document.getElementById(e),r={};n.addEventListener("touchstart",function(e){var t=e.touches[0].clientX;r={touching:!0,backed:!1,x:0},r.x=t}),n.addEventListener("touchmove",function(i){var o=parseInt(i.touches[0].clientX,10);r.touching&&o-r.x>0&&r.x<40&&(o-r.x>100&&!r.backed?(r.backed=!0,i.preventDefault(),t.goBack(e)):o>0&&!r.backed?n.style.transform="translateX("+(o-r.x)+"px)":o<0&&!r.backed&&(n.style.transform="translateX(0)"))}),n.addEventListener("touchend",function(){r.touching=!1,r.backed||(n.style.transform="translateX(0)")})}},{key:"slideEvents",value:function(e){var t=this,n=document.getElementById(e),r=n.querySelector(".view__container"),i=!1,o={};n.addEventListener("touchstart",function(e){var t=e.touches[0].clientY;o={touching:!0,backed:!1,y:0},o.y=t}),n.addEventListener("touchmove",function(a){var l=parseInt(a.touches[0].clientY,10);r.scrollTop>1&&(i=!0),r.scrollTop<2&&!i&&o.touching&&l-o.y>0&&(l-o.y>100&&!o.backed?(o.backed=!0,a.preventDefault(),t.goBack(e,"slid")):l>0&&!o.backed?n.style.transform="translateY("+(l-o.y)+"px)":l<0&&!o.backed&&(n.style.transform="translateY(0)"))}),n.addEventListener("touchend",function(){o.touching=!1,o.backed||(n.style.transform="translateY(0)"),r&&r.scrollTop<2&&(i=!1)})}},{key:"open",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.toLowerCase(),i=document.getElementById(r),o=this.components[e],a=d.default.get("views"),l=!0,c={};d.default.set("currentView",r),n&&i?i.remove():i&&(this.run({id:r}),l=!1);var s=function(e){c=e};l&&(u.default.render(u.default.h(o,{ref:s,params:t}),document.querySelector("#app .views")),a[r]=c)}},{key:"close",value:function(e){var t=document.getElementById(e);t&&(t.classList.contains("back")?this.goBack(e):t.classList.contains("slid")?this.goBack(e,"slid"):this.removeView(e))}},{key:"removeView",value:function(e){var t=document.getElementById(e),n=d.default.get("views");"unload"in n[e]&&n[e].unload(),delete n[e],t.remove()}}]),e}();t.default=new y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(16),a=r(o),l=n(1),u=r(l),c=n(9),s=r(c),f=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4&&void 0!==arguments[4]&&arguments[4],c=arguments.length>5&&void 0!==arguments[5]&&arguments[5];i(this,e);var f=u.default.get("endpoint"),d=""+f+n,p={url:d,method:t};if("POST"!=t&&"PUT"!=t||!r?"GET"==t&&r&&(p.params=r):(a.default.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",p.data=s.default.serialize(r)),c){var h=u.default.get("accessToken");p.headers={Authorization:"Bearer "+h}}(0,a.default)(p).then(function(e){o&&o(e.data)}).catch(function(e){if(console.log(e),"exitCode"in e.response.data)return void window.location.reload();l&&l(e.response.data)})};t.default=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Done",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=r;i||(i=function(){}),"notification"in navigator?navigator.notification.alert(e,i,t,n):alert(e)})},{key:"confirm",value:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"notification"in navigator?navigator.notification.confirm(e,r,t,n):r(confirm(e)?1:2)})},{key:"endpoint",value:function(e){return""+a.default.get("endpoint")+e}},{key:"loading",value:function(e){var t=document.getElementById("global-loading");"show"==e?t.classList.add("is-active"):"hide"==e&&t.classList.remove("is-active")}},{key:"isArray",value:function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{key:"textareaResize",value:function(e){var t=this,n=e.target;setTimeout(function(){n.style.height=t.chatFormOrigTAHeight+"px",n.style.height=n.scrollHeight+"px"},0)}}]),e}();t.default=new l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n6&&new y.default("GET","/emailcheck",{email:n},function(){delete r.email,t.setState({errors:r})},function(e){r.email=e.error.default,t.setState({errors:r})})}},{key:"clearField",value:function(e,t){if(void 0!==this.state.formData[e]&&this.state.formData[e].length){var n=this.state.formData,r=t.target;n[e]="",r.parentNode.querySelector("[name]").value="",r.parentNode.querySelector("[name]").focus(),this.setState(n)}}},{key:"handleResponse",value:function(e,t){var n=e.status,r=t.querySelector("button"),i="",o="",a={};return m.default.loading("hide"),this.setState({loading:!1}),200==n?"onSuccess"in this.props?this.props.onSuccess(e,this.state.formData):(i=e.message,o="Success"):(i=e.error.default,r&&r.removeAttribute("disabled"),a=e.error,o="Error"),this.setState({responseStatus:n,errors:a}),i.length>0&&200!==n&&m.default.alert(i,o),!0}},{key:"handleForm",value:function(e){var t=this;e.preventDefault();var n=this.props.method,r=e.target,i=r.querySelector("button"),o=!1;i&&i.setAttribute("disabled","disabled"),this.setState({loading:!0}),"auth"in this.props&&(o=!0,m.default.loading("show")),new y.default(n,this.props.action,this.state.formData,function(e){t.handleResponse(e,r)},function(e){t.handleResponse(e,r)},o)}},{key:"render",value:function(e){var t=this,n=e.fields,r=e.type,i=[];return void 0===r&&i.push("form"),c.default.h("form",{className:i.join(" "),onSubmit:function(e){return t.handleForm(e)}},n.map(function(e){return t.field(e)}))}}]),t}(c.default.Component);t.default=O},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n0&&"logo"!==e.avatar&&1!=e.id&&c.default.h("img",{className:"is-loadable",alt:"","data-src":e.avatar}))),c.default.h("div",{className:"user-list__item-details"},c.default.h("h3",null,e.title),"stars"in e&&c.default.h("span",null,c.default.h(f.default,{stars:e.stars,amount:e.reviews}),c.default.h("time",null,e.detail)),e.subtitle&&!e.presubtitle&&c.default.h("h4",null,e.subtitle),e.subtitle&&e.presubtitle&&c.default.h("h4",null,c.default.h("span",null,e.presubtitle)," - ",e.subtitle),e.description&&c.default.h("p",null,e.description),e.messagePreview&&c.default.h("div",{className:!e.read&&"is-unread"},e.messageDate&&c.default.h("i",null,e.messageDate," - "),e.messagePreview))))}},{key:"render",value:function(e){var t=this,n=e.list;return c.default.h("ul",{className:"user-list"},n.map(function(e){return t.formatUser(e)}))}}]),t}(c.default.Component);t.default=h},function(e,t,n){"use strict";(function(t){function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i=n(7),o=n(39),a={"Content-Type":"application/x-www-form-urlencoded"},l={adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(22):void 0!==t&&(e=n(22)),e}(),transformRequest:[function(e,t){return o(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){l.headers[e]={}}),i.forEach(["post","put","patch"],function(e){l.headers[e]=i.merge(a)}),e.exports=l}).call(t,n(38))},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r-1&&(r="("+e.amount+")"),c.default.h("span",{className:n.join(" "),"data-stars":e.stars},c.default.h("a",{onClick:function(){return t.clickStar(1)}},c.default.h(f.default,{name:"star"})),c.default.h("a",{onClick:function(){return t.clickStar(2)}},c.default.h(f.default,{name:"star"})),c.default.h("a",{onClick:function(){return t.clickStar(3)}},c.default.h(f.default,{name:"star"})),c.default.h("a",{onClick:function(){return t.clickStar(4)}},c.default.h(f.default,{name:"star"})),c.default.h("a",{onClick:function(){return t.clickStar(5)}},c.default.h(f.default,{name:"star"}))," ",r&&c.default.h("span",null,r))}}]),t}(c.default.Component);t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=parseInt(e.length,10)&&(n=!1),"submitting"in e&&e.submitting&&(t.push("is-submitting"),n=!0),c.default.h("button",{disabled:!!n&&"disabled",className:t.join(" "),type:"submit"},"submitting"in e&&e.submitting&&c.default.h(f.default,{size:"small"}))}}]),t}(c.default.Component);t.default=d},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n0?"https://www.facebook.com/"+this.state.user.facebook:"":"instagram"==e?t=this.state.user.instagram.length>0?"https://instagram.com/"+this.state.user.instagram:"":"website"==e&&(t=this.state.user.website.length>0?this.state.user.website:""),""!==t&&window.open(t,"_blank","location=yes")}},{key:"uploadImage",value:function(){var e=this;new m.default("gallery",function(t){var n=e.state.user,r={};r[t.data.id]=t.data,w.default.isArray(n.gallery)||Object.keys(n.gallery).forEach(function(e){r[e]=n.gallery[e]}),n.gallery=r,e.setState({user:n})})}},{key:"viewPhoto",value:function(e){b.default.open("Photo",{type:"profile",item:e})}},{key:"handleSubmit",value:function(e){var t=this;e.preventDefault(),!this.state.reviewing&&this.state.message.length>3&&(this.setState({reviewing:!0}),new y.default("POST","/reviews",{for_user_id:this.state.user.id,message:this.state.message,stars:this.state.stars},function(e){var n=t.state.user;n.reviews=e.data.reviews,n.hasReviewed=!0,t.setState({user:n,reviewing:!1})},function(e){w.default.alert(e.error.default,"Review Error"),t.setState({reviewing:!1})},!0))}},{key:"handleStars",value:function(e){this.setState({stars:e})}},{key:"likeUser",value:function(e){var t=this;e.preventDefault(),"current"===this.props.user||this.state.liking||(this.setState({liking:!0}),new y.default("POST","/likes",{for_user_id:this.state.user.id},function(){var e=t.state.user,n=p.default.get("views");e.hasLiked=!e.hasLiked,t.setState({user:e,liking:!1}),"likes"in n&&n.likes.getLikes()},!1,!0))}},{key:"messageUser",value:function(e){e.preventDefault(),"current"!==this.props.user&&this.state.user.bookable&&b.default.open("Message",{userId:this.state.user.id,userName:this.state.user.display_name})}},{key:"render",value:function(e,t){var r=this,i=t.media,o=t.user,a=t.message,l=t.stars,u=t.reviewing,s="";return"current"==e.user?s="is-inactive":o.hasLiked&&(s="has-liked"),c.default.h("div",{className:"user-profile"},o&&c.default.h("div",{className:"view__container"},c.default.h("section",{className:"user-details"},2==o.type&&0==o.bookable&&c.default.h("div",{className:"user-bookings"},"Currently not taking bookings"),0==o.verified&&1==o.bookable&&c.default.h("div",{className:"user-bookings"},"Please activate your account so that you can appear in search results"),c.default.h("div",{className:"user-info"},c.default.h("h1",{className:"user-info__avatar"},c.default.h("span",null,o.avatar.length>1&&c.default.h("img",{className:"is-loadable",alt:"","data-src":o.avatar}),0==o.avatar.length&&c.default.h("img",{alt:"",src:n(13),srcSet:n(14)+" 2x, "+n(15)+" 3x"}))),c.default.h("h2",{className:"user-info__full-name"},o.display_name),2==o.type&&c.default.h("h3",{className:"user-info__job-title"},o.occupation),c.default.h(S.default,{stars:o.reviewsStars,amount:o.reviewsCount,block:!0})),2==o.type&&c.default.h("div",{className:"user-contact"},c.default.h("ul",null,c.default.h("li",{className:0==o.facebook.length&&"is-inactive"},c.default.h("a",{onClick:function(){return r.openExtLink("facebook")}},c.default.h(P.default,{name:"facebook"}))),c.default.h("li",{className:0==o.instagram.length&&"is-inactive"},c.default.h("a",{onClick:function(){return r.openExtLink("instagram")}},c.default.h(P.default,{name:"instagram"}))),c.default.h("li",{className:0==o.website.length&&"is-inactive"},c.default.h("a",{onClick:function(){return r.openExtLink("website")}},c.default.h(P.default,{name:"globe"}))),c.default.h("li",{className:(0==o.bookable||"current"==e.user)&&"is-inactive"},c.default.h("a",{onClick:function(e){return r.messageUser(e)}},c.default.h(P.default,{name:"send"}))),c.default.h("li",{className:s},c.default.h("a",{onClick:function(e){return r.likeUser(e)}},c.default.h(P.default,{name:"heart"}))))),2==o.type&&o.about.length>0&&c.default.h("div",{className:"user-bio"},o.about,1==o.national&&c.default.h("p",{className:"user-national"},"Works nationally")),2==o.type&&c.default.h("div",{className:"user-media-tabs"},c.default.h("ul",{className:"user-media-tabs__nav"},c.default.h("li",{className:"gallery"==i?"is-active":null},c.default.h("a",{onClick:function(){return r.changeMediaTab("gallery")}},c.default.h("h3",null,"Gallery"))),c.default.h("li",{className:"reviews"==i?"is-active":null},c.default.h("a",{onClick:function(){return r.changeMediaTab("reviews")}},c.default.h("h3",null,"Reviews")))))),2==o.type&&c.default.h("section",{className:"user-media"},c.default.h("div",{className:"user-media__container"},c.default.h("div",{className:"user-media__content "+("gallery"==i?"is-active":"")},!w.default.isArray(o.gallery)&&c.default.h("div",{className:"user-gallery"},c.default.h("ul",null,Object.keys(o.gallery).reverse().map(function(e){return c.default.h("li",null,c.default.h("a",{onClick:function(){return r.viewPhoto(o.gallery[e])}},c.default.h("img",{className:"is-loadable",alt:"","data-src":o.gallery[e].thumbUrl})))}),"current"==e.user&&c.default.h("li",{className:"add-media"},c.default.h("a",{onClick:function(){return r.uploadImage()},className:"add-media__label"},c.default.h("p",null,"Add photo"),c.default.h(P.default,{name:"plus-circle"}))))),w.default.isArray(o.gallery)&&"current"==e.user&&c.default.h("div",{className:"user-gallery"},c.default.h("ul",null,c.default.h("li",{className:"add-media"},c.default.h("a",{onClick:function(){return r.uploadImage()},className:"add-media__label"},c.default.h("p",null,"Add photo"),c.default.h(P.default,{name:"plus-circle"}))))),w.default.isArray(o.gallery)&&"current"!==e.user&&c.default.h("h3",{className:"none"},"No photos found")),c.default.h("div",{className:"user-media__content "+("reviews"==i?"is-active":"null")},c.default.h("div",{className:"user-reviews"},"current"!==e.user&&!o.hasReviewed&&c.default.h("form",{onSubmit:function(e){return r.handleSubmit(e)}},c.default.h("div",{className:"add-review user-reviews__add"},c.default.h("div",{className:"add-review__avatar"},o.avatar.length>1&&c.default.h("img",{alt:"",src:n(13),srcSet:n(14)+" 2x, "+n(15)+" 3x"}),0==o.avatar.length&&c.default.h("img",{alt:"",src:n(13),srcSet:n(14)+" 2x, "+n(15)+" 3x"})),c.default.h("div",{className:"add-review__comment"},c.default.h("textarea",{onKeyPress:w.default.textareaResize,onKeyUp:w.default.textareaResize,onInput:(0,f.default)(this,"message"),maxLength:"255",placeholder:"Write your review here..."}),c.default.h(S.default,{stars:l,clickCallback:function(e){return r.handleStars(e)},large:!0})),c.default.h("div",{className:"add-review__submit"},c.default.h(T.default,{active:a,length:"4",submitting:u})))),c.default.h("section",{className:"user-reviews__list"},o.reviews.length>0&&c.default.h(j.default,{list:o.reviews}),0==o.reviews.length&&c.default.h("h3",{className:"none"},"No reviews found"))))))),!o&&c.default.h("div",{className:"view__container"},c.default.h(A.default,{full:!0})),"profile"in e&&c.default.h(k.default,{selected:"profile"}))}}]),t}(c.default.Component);t.default=L},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i(this,e);var a=c.default.get("user").avatar,l=["Take photo","Choose from gallery"];a.length>0&&"avatar"==t&&l.push("Remove photo"),l.push("Cancel"),navigator.notification.confirm("What would you like to do?",function(e){1==e?navigator.camera.getPicture(function(e){n.upload(e,t,r,o)},n.errorCallback,{destinationType:1}):2==e?navigator.camera.getPicture(function(e){n.upload(e,t,r,o)},n.errorCallback,{destinationType:1,sourceType:0}):3==e&&r("remove")},"Upload",l)}return o(e,[{key:"upload",value:function(e,t,n,r){var i=new FileUploadOptions,o=new FileTransfer,a={},u=n,s=r;u||(u=function(){}),s||(s=function(){}),l.default.loading("show"),i.fileKey="file",i.fileName=e.substr(e.lastIndexOf("/")+1),i.mimeType="image/jpeg",a.type=t,i.params=a,i.headers={Authorization:"Bearer "+c.default.get("accessToken")},o.upload(e,encodeURI(l.default.endpoint("/upload")),function(e){var t=JSON.parse(e.response);l.default.loading("hide"),200==t.status?u(t):(l.default.alert("Sorry we couldn't upload your photo at this time","Upload Error"),s(t))},function(e){l.default.loading("hide"),l.default.alert("Sorry we couldn't upload your photo at this time","Upload Error"),s(e.body)},i)}},{key:"errorCallback",value:function(e){console.log(e)}}]),e}();t.default=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(0),o=r(i),a=n(32),l=r(a);n(33);var u=n(34),c=r(u),s=function(){o.default.render(o.default.h(c.default,null),document.getElementById("app")),"undefined"!=typeof cordova&&(l.default.attach(document.body),window.open=cordova.InAppBrowser.open),"undefined"!=typeof device&&document.body.classList.add("device-"+device.platform)};navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)?document.addEventListener("deviceready",s,!1):s(),document.addEventListener("touchstart",function(){},!0)},function(e,t,n){var r;!function(){"use strict";/** + * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs. + * + * @codingstandard ftlabs-jsv2 + * @copyright The Financial Times Limited [All Rights Reserved] + * @license MIT License (see LICENSE.txt) + */ +function i(e,t){var n;if(t=t||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=t.touchBoundary||10,this.layer=e,this.tapDelay=t.tapDelay||200,this.tapTimeout=t.tapTimeout||700,!i.notNeeded(e)){for(var r=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],o=this,l=0,u=r.length;l=0,a=navigator.userAgent.indexOf("Android")>0&&!o,l=/iP(ad|hone|od)/.test(navigator.userAgent)&&!o,u=l&&/OS 4_\d(_\d)?/.test(navigator.userAgent),c=l&&/OS [6-7]_\d/.test(navigator.userAgent),s=navigator.userAgent.indexOf("BB10")>0;i.prototype.needsClick=function(e){switch(e.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(e.disabled)return!0;break;case"input":if(l&&"file"===e.type||e.disabled)return!0;break;case"label":case"iframe":case"video":return!0}return/\bneedsclick\b/.test(e.className)},i.prototype.needsFocus=function(e){switch(e.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!a;case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!e.disabled&&!e.readOnly;default:return/\bneedsfocus\b/.test(e.className)}},i.prototype.sendClick=function(e,t){var n,r;document.activeElement&&document.activeElement!==e&&document.activeElement.blur(),r=t.changedTouches[0],n=document.createEvent("MouseEvents"),n.initMouseEvent(this.determineEventType(e),!0,!0,window,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),n.forwardedTouchEvent=!0,e.dispatchEvent(n)},i.prototype.determineEventType=function(e){return a&&"select"===e.tagName.toLowerCase()?"mousedown":"click"},i.prototype.focus=function(e){var t;l&&e.setSelectionRange&&0!==e.type.indexOf("date")&&"time"!==e.type&&"month"!==e.type?(t=e.value.length,e.setSelectionRange(t,t)):e.focus()},i.prototype.updateScrollParent=function(e){var t,n;if(!(t=e.fastClickScrollParent)||!t.contains(e)){n=e;do{if(n.scrollHeight>n.offsetHeight){t=n,e.fastClickScrollParent=n;break}n=n.parentElement}while(n)}t&&(t.fastClickLastScrollTop=t.scrollTop)},i.prototype.getTargetElementFromEventTarget=function(e){return e.nodeType===Node.TEXT_NODE?e.parentNode:e},i.prototype.onTouchStart=function(e){var t,n,r;if(e.targetTouches.length>1)return!0;if(t=this.getTargetElementFromEventTarget(e.target),n=e.targetTouches[0],l){if(r=window.getSelection(),r.rangeCount&&!r.isCollapsed)return!0;if(!u){if(n.identifier&&n.identifier===this.lastTouchIdentifier)return e.preventDefault(),!1;this.lastTouchIdentifier=n.identifier,this.updateScrollParent(t)}}return this.trackingClick=!0,this.trackingClickStart=e.timeStamp,this.targetElement=t,this.touchStartX=n.pageX,this.touchStartY=n.pageY,e.timeStamp-this.lastClickTimen||Math.abs(t.pageY-this.touchStartY)>n},i.prototype.onTouchMove=function(e){return!this.trackingClick||((this.targetElement!==this.getTargetElementFromEventTarget(e.target)||this.touchHasMoved(e))&&(this.trackingClick=!1,this.targetElement=null),!0)},i.prototype.findControl=function(e){return void 0!==e.control?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},i.prototype.onTouchEnd=function(e){var t,n,r,i,o,s=this.targetElement;if(!this.trackingClick)return!0;if(e.timeStamp-this.lastClickTimethis.tapTimeout)return!0;if(this.cancelNextClick=!1,this.lastClickTime=e.timeStamp,n=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,c&&(o=e.changedTouches[0],s=document.elementFromPoint(o.pageX-window.pageXOffset,o.pageY-window.pageYOffset)||s,s.fastClickScrollParent=this.targetElement.fastClickScrollParent),"label"===(r=s.tagName.toLowerCase())){if(t=this.findControl(s)){if(this.focus(s),a)return!1;s=t}}else if(this.needsFocus(s))return e.timeStamp-n>100||l&&window.top!==window&&"input"===r?(this.targetElement=null,!1):(this.focus(s),this.sendClick(s,e),l&&"select"===r||(this.targetElement=null,e.preventDefault()),!1);return!(!l||u||!(i=s.fastClickScrollParent)||i.fastClickLastScrollTop===i.scrollTop)||(this.needsClick(s)||(e.preventDefault(),this.sendClick(s,e)),!1)},i.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},i.prototype.onMouse=function(e){return!this.targetElement||(!!e.forwardedTouchEvent||(!e.cancelable||(!(!this.needsClick(this.targetElement)||this.cancelNextClick)||(e.stopImmediatePropagation?e.stopImmediatePropagation():e.propagationStopped=!0,e.stopPropagation(),e.preventDefault(),!1))))},i.prototype.onClick=function(e){var t;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===e.target.type&&0===e.detail||(t=this.onMouse(e),t||(this.targetElement=null),t)},i.prototype.destroy=function(){var e=this.layer;a&&(e.removeEventListener("mouseover",this.onMouse,!0),e.removeEventListener("mousedown",this.onMouse,!0),e.removeEventListener("mouseup",this.onMouse,!0)),e.removeEventListener("click",this.onClick,!0),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchcancel",this.onTouchCancel,!1)},i.notNeeded=function(e){var t,n,r;if(void 0===window.ontouchstart)return!0;if(n=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!a)return!0;if(t=document.querySelector("meta[name=viewport]")){if(-1!==t.content.indexOf("user-scalable=no"))return!0;if(n>31&&document.documentElement.scrollWidth<=window.outerWidth)return!0}}if(s&&(r=navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/),r[1]>=10&&r[2]>=3&&(t=document.querySelector("meta[name=viewport]")))){if(-1!==t.content.indexOf("user-scalable=no"))return!0;if(document.documentElement.scrollWidth<=window.outerWidth)return!0}return"none"===e.style.msTouchAction||"manipulation"===e.style.touchAction||(!!(+(/Firefox\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]>=27&&(t=document.querySelector("meta[name=viewport]"))&&(-1!==t.content.indexOf("user-scalable=no")||document.documentElement.scrollWidth<=window.outerWidth))||("none"===e.style.touchAction||"manipulation"===e.style.touchAction))},i.attach=function(e,t){return new i(e,t)},void 0!==(r=function(){return i}.call(t,n,t,e))&&(e.exports=r)}()},function(e,t){},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n + * @license MIT + */ +e.exports=function(e){return null!=e&&(n(e)||r(e)||!!e._isBuffer)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new a,response:new a}}var i=n(20),o=n(7),a=n(47),l=n(48),u=n(50),c=n(51);r.prototype.request=function(e){"string"==typeof e&&(e=o.merge({url:arguments[0]},arguments[1])),e=o.merge(i,this.defaults,{method:"get"},e),e.method=e.method.toLowerCase(),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url));var t=[l,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(s===setTimeout)return setTimeout(e,0);if((s===n||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){y&&p&&(y=!1,p.length?h=p.concat(h):v=-1,h.length&&l())}function l(){if(!y){var e=i(a);y=!0;for(var t=h.length;t;){for(p=h,h=[];++v1)for(var n=1;n>8-l%1*8)){if((n=i.charCodeAt(l+=.75))>255)throw new r;t=t<<8|n}return a}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.prototype=new Error,r.prototype.code=5,r.prototype.name="InvalidCharacterError",e.exports=i},function(e,t,n){"use strict";var r=n(7);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,i,o,a){var l=[];l.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),r.isString(i)&&l.push("path="+i),r.isString(o)&&l.push("domain="+o),!0===a&&l.push("secure"),document.cookie=l.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var i=n(7);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){i.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var i=n(7),o=n(49),a=n(24),l=n(20);e.exports=function(e){return r(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),i.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||l.adapter)(e).then(function(t){return r(e),t.data=o(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(r(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(7);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new i(e),t(n.reason))})}var i=n(25);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(55),o=r(i),a=n(61),l=r(a),u=n(70),c=r(u),s=n(71),f=r(s),d=n(72),p=r(d),h=n(75),y=r(h),v=n(76),m=r(v),g=n(83),b=r(g),x=n(85),w=r(x),_=n(86),k=r(_),O=n(89),S=r(O),M=n(91),j=r(M),E=n(92),P=r(E),C=n(93),T=r(C),N=n(95),A=r(N),L=n(97),B=r(L),z=n(98),D=r(z);t.default={Forgot:o.default,Home:l.default,Likes:c.default,Login:f.default,Message:p.default,Messages:y.default,Onboarding:m.default,Photo:b.default,Privacy:w.default,Profile:k.default,Settings:S.default,SettingsNotifications:j.default,SettingsProfile:T.default,SettingsPassword:P.default,Signup:A.default,Terms:B.default,User:D.default}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nb;b++)if((v=t?g(a(h=e[b])[0],h[1]):g(e[b]))===c||v===s)return v}else for(y=m.call(e);!(h=y.next()).done;)if((v=i(y,g,h.value,t))===c||v===s)return v};t.BREAK=c,t.RETURN=s},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(52),i=n(3),o=n(10),a=n(8),l=n(6),u=n(13),c=n(53),s=n(24),f=n(59),d=n(0)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,y,v,m,g){c(n,t,y);var b,x,w,_=function(e){if(!p&&e in M)return M[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},k=t+" Iterator",O="values"==v,S=!1,M=e.prototype,j=M[d]||M["@@iterator"]||v&&M[v],E=j||_(v),P=v?O?_("entries"):E:void 0,C="Array"==t?M.entries||j:j;if(C&&(w=f(C.call(new e)))!==Object.prototype&&w.next&&(s(w,k,!0),r||l(w,d)||a(w,d,h)),O&&j&&"values"!==j.name&&(S=!0,E=function(){return j.call(this)}),r&&!g||!p&&!S&&M[d]||a(M,d,E),u[t]=E,u[k]=h,v)if(b={values:O?E:_("values"),keys:m?E:_("keys"),entries:P},g)for(x in b)x in M||o(M,x,b[x]);else i(i.P+i.F*(p||S),t,b);return b}},function(e,t,n){var r=n(55),i=n(37);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t,n){var r=n(18),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(36)("keys"),i=n(15);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(4).f,i=n(6),o=n(0)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){var r=n(19);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(35),i=n(0)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,l;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(l=r(t))&&"function"==typeof t.callee?"Arguments":l}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(86),o=r(i),a=n(88),l=r(a),u=n(89),c=r(u);t.default=Object.keys(l.default).map(function(e){return new o.default(e,l.default[e],c.default[e])}).reduce(function(e,t){return e[t.name]=t,e},{})},function(e,t,n){"use strict";var r=n(51)(!0);n(20)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){e.exports=!n(5)&&!n(12)(function(){return 7!=Object.defineProperty(n(30)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(2),i=n(1).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){var r=n(2);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(9),i=n(54),o=n(37),a=n(23)("IE_PROTO"),l=function(){},u=function(){var e,t=n(30)("iframe"),r=o.length;for(t.style.display="none",n(58).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(" + diff --git a/app/plugins/cordova-plugin-inappbrowser/tests/resources/inject.js b/app/plugins/cordova-plugin-inappbrowser/tests/resources/inject.js new file mode 100644 index 0000000..d704ab3 --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/tests/resources/inject.js @@ -0,0 +1,20 @@ +/* + * 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 d = document.getElementById('header'); +d.innerHTML = 'Script file successfully injected'; diff --git a/app/plugins/cordova-plugin-inappbrowser/tests/resources/local.html b/app/plugins/cordova-plugin-inappbrowser/tests/resources/local.html new file mode 100644 index 0000000..d23a714 --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/tests/resources/local.html @@ -0,0 +1,67 @@ + + + + + + + + + IAB test page + + + + + +

Local URL

+
+ You have successfully loaded a local URL: + +
+
+
User-Agent =
+
+
Likely running inAppBrowser: Device version from Cordova=not found, Back link should not work, toolbar may be present, logcat should show failed 'gap:' calls.
+
+
Visit Google (whitelisted)
+
Visit Yahoo (not whitelisted)
+ + +

Back +

+ +

tall div with border
+ + + diff --git a/app/plugins/cordova-plugin-inappbrowser/tests/resources/local.pdf b/app/plugins/cordova-plugin-inappbrowser/tests/resources/local.pdf new file mode 100644 index 0000000..b54f1b7 Binary files /dev/null and b/app/plugins/cordova-plugin-inappbrowser/tests/resources/local.pdf differ diff --git a/app/plugins/cordova-plugin-inappbrowser/tests/resources/video.html b/app/plugins/cordova-plugin-inappbrowser/tests/resources/video.html new file mode 100644 index 0000000..4f167f8 --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/tests/resources/video.html @@ -0,0 +1,45 @@ + + + + + + + + + Cordova Mobile Spec + + + + +
+ + +
+ + + diff --git a/app/plugins/cordova-plugin-inappbrowser/tests/tests.js b/app/plugins/cordova-plugin-inappbrowser/tests/tests.js new file mode 100644 index 0000000..abb2a6d --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/tests/tests.js @@ -0,0 +1,696 @@ +/* + * + * 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 MSApp */ + +var cordova = require('cordova'); +var isWindows = cordova.platformId === 'windows'; +var isBrowser = cordova.platformId === 'browser'; + +window.alert = window.alert || navigator.notification.alert; +if (isWindows && navigator && navigator.notification && navigator.notification.alert) { + // window.alert is defined but not functional on UWP + window.alert = navigator.notification.alert; +} + +exports.defineAutoTests = function () { + + describe('cordova.InAppBrowser', function () { + + it('inappbrowser.spec.1 should exist', function () { + expect(cordova.InAppBrowser).toBeDefined(); + }); + + it('inappbrowser.spec.2 should contain open function', function () { + expect(cordova.InAppBrowser.open).toBeDefined(); + expect(cordova.InAppBrowser.open).toEqual(jasmine.any(Function)); + }); + }); + + describe('open method', function () { + + if (cordova.platformId === 'osx') { + pending('Open method not fully supported on OSX.'); + return; + } + + var iabInstance; + var originalTimeout; + var url = 'https://dist.apache.org/repos/dist/dev/cordova/'; + var badUrl = 'http://bad-uri/'; + + beforeEach(function () { + // increase timeout to ensure test url could be loaded within test time + originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + + iabInstance = null; + }); + + afterEach(function (done) { + // restore original timeout + jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; + + if (iabInstance !== null && iabInstance.close) { + iabInstance.close(); + } + iabInstance = null; + // add some extra time so that iab dialog is closed + setTimeout(done, 2000); + }); + + function verifyEvent (evt, type) { + expect(evt).toBeDefined(); + expect(evt.type).toEqual(type); + // `exit` event does not have url field, browser returns null url for CORS requests + if (type !== 'exit' && !isBrowser) { + expect(evt.url).toEqual(url); + } + } + + function verifyLoadErrorEvent (evt) { + expect(evt).toBeDefined(); + expect(evt.type).toEqual('loaderror'); + expect(evt.url).toEqual(badUrl); + expect(evt.code).toEqual(jasmine.any(Number)); + expect(evt.message).toEqual(jasmine.any(String)); + } + + it('inappbrowser.spec.3 should return InAppBrowser instance with required methods', function () { + iabInstance = cordova.InAppBrowser.open(url, '_blank'); + + expect(iabInstance).toBeDefined(); + + expect(iabInstance.addEventListener).toEqual(jasmine.any(Function)); + expect(iabInstance.removeEventListener).toEqual(jasmine.any(Function)); + expect(iabInstance.close).toEqual(jasmine.any(Function)); + expect(iabInstance.show).toEqual(jasmine.any(Function)); + expect(iabInstance.hide).toEqual(jasmine.any(Function)); + expect(iabInstance.executeScript).toEqual(jasmine.any(Function)); + expect(iabInstance.insertCSS).toEqual(jasmine.any(Function)); + }); + + it('inappbrowser.spec.4 should support loadstart and loadstop events', function (done) { + var onLoadStart = jasmine.createSpy('loadstart event callback').and.callFake(function (evt) { + verifyEvent(evt, 'loadstart'); + }); + + iabInstance = cordova.InAppBrowser.open(url, '_blank'); + iabInstance.addEventListener('loadstart', onLoadStart); + iabInstance.addEventListener('loadstop', function (evt) { + verifyEvent(evt, 'loadstop'); + if (!isBrowser) { + // according to documentation, "loadstart" event is not supported on browser + // https://github.com/apache/cordova-plugin-inappbrowser#browser-quirks-1 + expect(onLoadStart).toHaveBeenCalled(); + } + done(); + }); + }); + + it('inappbrowser.spec.5 should support exit event', function (done) { + iabInstance = cordova.InAppBrowser.open(url, '_blank'); + iabInstance.addEventListener('exit', function (evt) { + verifyEvent(evt, 'exit'); + done(); + }); + iabInstance.close(); + iabInstance = null; + }); + + it('inappbrowser.spec.6 should support loaderror event', function (done) { + if (isBrowser) { + // according to documentation, "loaderror" event is not supported on browser + // https://github.com/apache/cordova-plugin-inappbrowser#browser-quirks-1 + pending('Browser platform doesn\'t support loaderror event'); + } + iabInstance = cordova.InAppBrowser.open(badUrl, '_blank'); + iabInstance.addEventListener('loaderror', function (evt) { + verifyLoadErrorEvent(evt); + done(); + }); + }); + }); +}; + +exports.defineManualTests = function (contentEl, createActionButton) { + + function doOpen (url, target, params, numExpectedRedirects, useWindowOpen) { + numExpectedRedirects = numExpectedRedirects || 0; + useWindowOpen = useWindowOpen || false; + console.log('Opening ' + url); + + var counts; + var lastLoadStartURL; + var wasReset = false; + function reset () { + counts = { + 'loaderror': 0, + 'loadstart': 0, + 'loadstop': 0, + 'exit': 0 + }; + lastLoadStartURL = ''; + } + reset(); + + var iab; + var callbacks = { + loaderror: logEvent, + loadstart: logEvent, + loadstop: logEvent, + exit: logEvent + }; + if (useWindowOpen) { + console.log('Use window.open() for url'); + iab = window.open(url, target, params, callbacks); + } else { + iab = cordova.InAppBrowser.open(url, target, params, callbacks); + } + if (!iab) { + alert('open returned ' + iab); // eslint-disable-line no-undef + return; + } + + function logEvent (e) { + console.log('IAB event=' + JSON.stringify(e)); + counts[e.type]++; + // Verify that event.url gets updated on redirects. + if (e.type === 'loadstart') { + if (e.url === lastLoadStartURL) { + alert('Unexpected: loadstart fired multiple times for the same URL.'); // eslint-disable-line no-undef + } + lastLoadStartURL = e.url; + } + // Verify the right number of loadstart events were fired. + if (e.type === 'loadstop' || e.type === 'loaderror') { + if (e.url !== lastLoadStartURL) { + alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url'); // eslint-disable-line no-undef + } + if (numExpectedRedirects === 0 && counts.loadstart !== 1) { + // Do allow a loaderror without a loadstart (e.g. in the case of an invalid URL). + if (!(e.type === 'loaderror' && counts.loadstart === 0)) { + alert('Unexpected: got multiple loadstart events. (' + counts.loadstart + ')'); // eslint-disable-line no-undef + } + } else if (numExpectedRedirects > 0 && counts.loadstart < (numExpectedRedirects + 1)) { + alert('Unexpected: should have got at least ' + (numExpectedRedirects + 1) + ' loadstart events, but got ' + counts.loadstart); // eslint-disable-line no-undef + } + wasReset = true; + numExpectedRedirects = 0; + reset(); + } + // Verify that loadend / loaderror was called. + if (e.type === 'exit') { + var numStopEvents = counts.loadstop + counts.loaderror; + if (numStopEvents === 0 && !wasReset) { + alert('Unexpected: browser closed without a loadstop or loaderror.'); // eslint-disable-line no-undef + } else if (numStopEvents > 1) { + alert('Unexpected: got multiple loadstop/loaderror events.'); // eslint-disable-line no-undef + } + } + } + + return iab; + } + + function doHookOpen (url, target, params, numExpectedRedirects) { + var originalFunc = window.open; + var wasClobbered = window.hasOwnProperty('open'); + window.open = cordova.InAppBrowser.open; + + try { + doOpen(url, target, params, numExpectedRedirects, true); + } finally { + if (wasClobbered) { + window.open = originalFunc; + } else { + console.log('just delete, to restore open from prototype'); + delete window.open; + } + } + } + + function openWithStyle (url, cssUrl, useCallback) { + var iab = doOpen(url, '_blank', 'location=yes'); + var callback = function (results) { + if (results && results.length === 0) { + alert('Results verified'); // eslint-disable-line no-undef + } else { + console.log(results); + alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results)); // eslint-disable-line no-undef + } + }; + if (cssUrl) { + iab.addEventListener('loadstop', function (event) { + iab.insertCSS({ file: cssUrl }, useCallback && callback); + }); + } else { + iab.addEventListener('loadstop', function (event) { + iab.insertCSS({ code: '#style-update-literal { \ndisplay: block !important; \n}' }, + useCallback && callback); + }); + } + } + + function openWithScript (url, jsUrl, useCallback) { + var iab = doOpen(url, '_blank', 'location=yes'); + if (jsUrl) { + iab.addEventListener('loadstop', function (event) { + iab.executeScript({ file: jsUrl }, useCallback && function (results) { + if (results && results.length === 0) { + alert('Results verified'); // eslint-disable-line no-undef + } else { + console.log(results); + alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results)); // eslint-disable-line no-undef + } + }); + }); + } else { + iab.addEventListener('loadstop', function (event) { + var code = '(function(){\n' + + ' var header = document.getElementById("header");\n' + + ' header.innerHTML = "Script literal successfully injected";\n' + + ' return "abc";\n' + + '})()'; + iab.executeScript({ code: code }, useCallback && function (results) { + if (results && results.length === 1 && results[0] === 'abc') { + alert('Results verified'); // eslint-disable-line no-undef + } else { + console.log(results); + alert('Got: ' + typeof (results) + '\n' + JSON.stringify(results)); // eslint-disable-line no-undef + } + }); + }); + } + } + var hiddenwnd = null; + var loadlistener = function (event) { alert('background window loaded '); }; // eslint-disable-line no-undef + function openHidden (url, startHidden) { + var shopt = (startHidden) ? 'hidden=yes' : ''; + hiddenwnd = cordova.InAppBrowser.open(url, 'random_string', shopt); + if (!hiddenwnd) { + alert('cordova.InAppBrowser.open returned ' + hiddenwnd); // eslint-disable-line no-undef + return; + } + if (startHidden) hiddenwnd.addEventListener('loadstop', loadlistener); + } + function showHidden () { + if (hiddenwnd) { + hiddenwnd.show(); + } + } + function closeHidden () { + if (hiddenwnd) { + hiddenwnd.removeEventListener('loadstop', loadlistener); + hiddenwnd.close(); + hiddenwnd = null; + } + } + + var info_div = '

InAppBrowser

' + + '
' + + 'Make sure http://cordova.apache.org and http://google.co.uk and https://www.google.co.uk are white listed.
' + + 'Make sure http://www.apple.com is not in the white list.
' + + 'In iOS, starred * tests will put the app in a state with no way to return.
' + + '

User-Agent: ' + + '

'; + + var local_tests = '

Local URL

' + + '
' + + 'Expected result: opens successfully in CordovaWebView.' + + '

' + + 'Expected result: opens successfully in CordovaWebView (using hook of window.open()).' + + '

' + + 'Expected result: opens successfully in CordovaWebView.' + + '

' + + 'Expected result: fails to open' + + '

' + + 'Expected result: opens successfully in InAppBrowser with locationBar at top.' + + '

' + + 'Expected result: opens successfully in InAppBrowser without locationBar.' + + '

' + + 'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the bottom.' + + '

' + + 'Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the top.' + + '

' + + 'Expected result: open successfully in InAppBrowser with no locationBar. On iOS the toolbar is at the top.'; + + var white_listed_tests = '

White Listed URL

' + + '
' + + 'Expected result: open successfully in CordovaWebView to cordova.apache.org' + + '

' + + 'Expected result: open successfully in CordovaWebView to cordova.apache.org (using hook of window.open())' + + '

' + + 'Expected result: open successfully in CordovaWebView to cordova.apache.org' + + '

' + + 'Expected result: open successfully in system browser to cordova.apache.org' + + '

' + + 'Expected result: open successfully in InAppBrowser to cordova.apache.org' + + '

' + + 'Expected result: open successfully in InAppBrowser to cordova.apache.org' + + '

' + + 'Expected result: open successfully in InAppBrowser to cordova.apache.org with no location bar.'; + + var non_white_listed_tests = '

Non White Listed URL

' + + '
' + + 'Expected result: open successfully in InAppBrowser to apple.com.' + + '

' + + 'Expected result: open successfully in InAppBrowser to apple.com (using hook of window.open()).' + + '

' + + 'Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).' + + '

' + + 'Expected result: open successfully in system browser to apple.com.' + + '

' + + 'Expected result: open successfully in InAppBrowser to apple.com.' + + '

' + + 'Expected result: open successfully in InAppBrowser to apple.com.' + + '

' + + 'Expected result: open successfully in InAppBrowser to apple.com without locationBar.'; + + var page_with_redirects_tests = '

Page with redirect

' + + '
' + + 'Expected result: should 301 and open successfully in InAppBrowser to https://www.google.co.uk.' + + '

' + + 'Expected result: should 302 and open successfully in InAppBrowser to www.zhihu.com/answer/16714076.'; + + var pdf_url_tests = '

PDF URL

' + + '
' + + 'Expected result: InAppBrowser opens. PDF should render on iOS.' + + '

' + + 'Expected result: InAppBrowser opens. PDF should render on iOS.'; + + var invalid_url_tests = '

Invalid URL

' + + '
' + + 'Expected result: fail to load in InAppBrowser.' + + '

' + + 'Expected result: fail to load in InAppBrowser.' + + '

' + + 'Expected result: fail to load in InAppBrowser (404).'; + + var css_js_injection_tests = '

CSS / JS Injection

' + + '
' + + 'Expected result: open successfully in InAppBrowser without text "Style updated from..."' + + '

' + + 'Expected result: open successfully in InAppBrowser with "Style updated from file".' + + '

' + + 'Expected result: open successfully in InAppBrowser with "Style updated from file", and alert dialog with text "Results verified".' + + '

' + + 'Expected result: open successfully in InAppBrowser with "Style updated from literal".' + + '

' + + 'Expected result: open successfully in InAppBrowser with "Style updated from literal", and alert dialog with text "Results verified".' + + '

' + + 'Expected result: open successfully in InAppBrowser with text "Script file successfully injected".' + + '

' + + 'Expected result: open successfully in InAppBrowser with text "Script file successfully injected" and alert dialog with the text "Results verified".' + + '

' + + 'Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" .' + + '

' + + 'Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" and alert dialog with the text "Results verified".'; + + var open_hidden_tests = '

Open Hidden

' + + '
' + + 'Expected result: no additional browser window. Alert appears with the text "background window loaded".' + + '

' + + 'Expected result: after first clicking on previous test "create hidden", open successfully in InAppBrowser to https://www.google.co.uk.' + + '

' + + 'Expected result: no output. But click on "show hidden" again and nothing should be shown.' + + '

' + + 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk' + + '

' + + 'Expected result: open successfully in InAppBrowser to https://www.google.co.uk. Hide after 2 seconds'; + + var clearing_cache_tests = '

Clearing Cache

' + + '
' + + 'Expected result: ?' + + '

' + + 'Expected result: ?'; + + var video_tag_tests = '

Video tag

' + + '
' + + 'Expected result: open successfully in InAppBrowser with an embedded video plays automatically on iOS and Android.' + + '
' + + 'Expected result: open successfully in InAppBrowser with an embedded video plays automatically on iOS and Android.' + + '
' + + 'Expected result: open successfully in InAppBrowser with an embedded video does not play automatically on iOS and Android but rather works after clicking the "play" button.'; + + var local_with_anchor_tag_tests = '

Local with anchor tag

' + + '
' + + 'Expected result: open successfully in InAppBrowser to the local page, scrolled to the top as normal.' + + '

' + + 'Expected result: open successfully in InAppBrowser to the local page, scrolled to the beginning of the tall div with border.'; + + var hardwareback_tests = '

HardwareBack

' + + '

' + + 'Expected result: By default hardwareback is yes so pressing back button should navigate backwards in history then close InAppBrowser' + + '

' + + 'Expected result: hardwareback=yes pressing back button should navigate backwards in history then close InAppBrowser' + + '

' + + 'Expected result: hardwareback=no pressing back button should close InAppBrowser regardless history' + + '

' + + 'Expected result: consistently open browsers with with the appropriate option: hardwareback=defaults to yes then hardwareback=no then hardwareback=defaults to yes. By default hardwareback is yes so pressing back button should navigate backwards in history then close InAppBrowser'; + + // CB-7490 We need to wrap this code due to Windows security restrictions + // see http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences for details + if (window.MSApp && window.MSApp.execUnsafeLocalFunction) { + MSApp.execUnsafeLocalFunction(function () { + contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests + + css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests + hardwareback_tests; + }); + } else { + contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests + + css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests + hardwareback_tests; + } + + document.getElementById('user-agent').textContent = navigator.userAgent; + + // we are already in cdvtests directory + var basePath = 'iab-resources/'; + var localhtml = basePath + 'local.html'; + var localpdf = basePath + 'local.pdf'; + var injecthtml = basePath + 'inject.html'; + var injectjs = isWindows ? basePath + 'inject.js' : 'inject.js'; + var injectcss = isWindows ? basePath + 'inject.css' : 'inject.css'; + var videohtml = basePath + 'video.html'; + + // Local + createActionButton('target=Default', function () { + doOpen(localhtml); + }, 'openLocal'); + createActionButton('target=Default (window.open)', function () { + doHookOpen(localhtml); + }, 'openLocalHook'); + createActionButton('target=_self', function () { + doOpen(localhtml, '_self'); + }, 'openLocalSelf'); + createActionButton('target=_system', function () { + doOpen(localhtml, '_system'); + }, 'openLocalSystem'); + createActionButton('target=_blank', function () { + doOpen(localhtml, '_blank'); + }, 'openLocalBlank'); + createActionButton('target=Random, location=no, disallowoverscroll=yes', function () { + doOpen(localhtml, 'random_string', 'location=no, disallowoverscroll=yes'); + }, 'openLocalRandomNoLocation'); + createActionButton('target=Random, toolbarposition=bottom', function () { + doOpen(localhtml, 'random_string', 'toolbarposition=bottom'); + }, 'openLocalRandomToolBarBottom'); + createActionButton('target=Random, toolbarposition=top', function () { + doOpen(localhtml, 'random_string', 'toolbarposition=top'); + }, 'openLocalRandomToolBarTop'); + createActionButton('target=Random, toolbarposition=top, location=no', function () { + doOpen(localhtml, 'random_string', 'toolbarposition=top,location=no'); + }, 'openLocalRandomToolBarTopNoLocation'); + + // White Listed + createActionButton('* target=Default', function () { + doOpen('http://cordova.apache.org'); + }, 'openWhiteListed'); + createActionButton('* target=Default (window.open)', function () { + doHookOpen('http://cordova.apache.org'); + }, 'openWhiteListedHook'); + createActionButton('* target=_self', function () { + doOpen('http://cordova.apache.org', '_self'); + }, 'openWhiteListedSelf'); + createActionButton('target=_system', function () { + doOpen('http://cordova.apache.org', '_system'); + }, 'openWhiteListedSystem'); + createActionButton('target=_blank', function () { + doOpen('http://cordova.apache.org', '_blank'); + }, 'openWhiteListedBlank'); + createActionButton('target=Random', function () { + doOpen('http://cordova.apache.org', 'random_string'); + }, 'openWhiteListedRandom'); + createActionButton('* target=Random, no location bar', function () { + doOpen('http://cordova.apache.org', 'random_string', 'location=no'); + }, 'openWhiteListedRandomNoLocation'); + + // Non White Listed + createActionButton('target=Default', function () { + doOpen('http://www.apple.com'); + }, 'openNonWhiteListed'); + createActionButton('target=Default (window.open)', function () { + doHookOpen('http://www.apple.com'); + }, 'openNonWhiteListedHook'); + createActionButton('target=_self', function () { + doOpen('http://www.apple.com', '_self'); + }, 'openNonWhiteListedSelf'); + createActionButton('target=_system', function () { + doOpen('http://www.apple.com', '_system'); + }, 'openNonWhiteListedSystem'); + createActionButton('target=_blank', function () { + doOpen('http://www.apple.com', '_blank'); + }, 'openNonWhiteListedBlank'); + createActionButton('target=Random', function () { + doOpen('http://www.apple.com', 'random_string'); + }, 'openNonWhiteListedRandom'); + createActionButton('* target=Random, no location bar', function () { + doOpen('http://www.apple.com', 'random_string', 'location=no'); + }, 'openNonWhiteListedRandomNoLocation'); + + // Page with redirect + createActionButton('http://google.co.uk', function () { + doOpen('http://google.co.uk', 'random_string', '', 1); + }, 'openRedirect301'); + createActionButton('http://goo.gl/pUFqg', function () { + doOpen('http://goo.gl/pUFqg', 'random_string', '', 2); + }, 'openRedirect302'); + + // PDF URL + createActionButton('Remote URL', function () { + doOpen('http://www.stluciadance.com/prospectus_file/sample.pdf'); + }, 'openPDF'); + createActionButton('Local URL', function () { + doOpen(localpdf, '_blank'); + }, 'openPDFBlank'); + + // Invalid URL + createActionButton('Invalid Scheme', function () { + doOpen('x-ttp://www.invalid.com/', '_blank'); + }, 'openInvalidScheme'); + createActionButton('Invalid Host', function () { + doOpen('http://www.inv;alid.com/', '_blank'); + }, 'openInvalidHost'); + createActionButton('Missing Local File', function () { + doOpen('nonexistent.html', '_blank'); + }, 'openInvalidMissing'); + + // CSS / JS injection + createActionButton('Original Document', function () { + doOpen(injecthtml, '_blank'); + }, 'openOriginalDocument'); + createActionButton('CSS File Injection', function () { + openWithStyle(injecthtml, injectcss); + }, 'openCSSInjection'); + createActionButton('CSS File Injection (callback)', function () { + openWithStyle(injecthtml, injectcss, true); + }, 'openCSSInjectionCallback'); + createActionButton('CSS Literal Injection', function () { + openWithStyle(injecthtml); + }, 'openCSSLiteralInjection'); + createActionButton('CSS Literal Injection (callback)', function () { + openWithStyle(injecthtml, null, true); + }, 'openCSSLiteralInjectionCallback'); + createActionButton('Script File Injection', function () { + openWithScript(injecthtml, injectjs); + }, 'openScriptInjection'); + createActionButton('Script File Injection (callback)', function () { + openWithScript(injecthtml, injectjs, true); + }, 'openScriptInjectionCallback'); + createActionButton('Script Literal Injection', function () { + openWithScript(injecthtml); + }, 'openScriptLiteralInjection'); + createActionButton('Script Literal Injection (callback)', function () { + openWithScript(injecthtml, null, true); + }, 'openScriptLiteralInjectionCallback'); + + // Open hidden + createActionButton('Create Hidden', function () { + openHidden('https://www.google.co.uk', true); + }, 'openHidden'); + createActionButton('Show Hidden', function () { + showHidden(); + }, 'showHidden'); + createActionButton('Close Hidden', function () { + closeHidden(); + }, 'closeHidden'); + createActionButton('google.co.uk Not Hidden', function () { + openHidden('https://www.google.co.uk', false); + }, 'openHiddenShow'); + createActionButton('google.co.uk shown for 2 seconds than hidden', function () { + var iab = doOpen('https://www.google.co.uk/', 'random_sting'); + setTimeout(function () { + iab.hide(); + }, 2000); + }, 'openVisibleAndHide'); + + // Clearing cache + createActionButton('Clear Browser Cache', function () { + doOpen('https://www.google.co.uk', '_blank', 'clearcache=yes'); + }, 'openClearCache'); + createActionButton('Clear Session Cache', function () { + doOpen('https://www.google.co.uk', '_blank', 'clearsessioncache=yes'); + }, 'openClearSessionCache'); + + // Video tag + createActionButton('Remote Video', function () { + doOpen(videohtml, '_blank'); + }, 'openRemoteVideo'); + createActionButton('Remote Need User No Video', function () { + doOpen(videohtml, '_blank', 'mediaPlaybackRequiresUserAction=no'); + }, 'openRemoteNeedUserNoVideo'); + createActionButton('Remote Need User Yes Video', function () { + doOpen(videohtml, '_blank', 'mediaPlaybackRequiresUserAction=yes'); + }, 'openRemoteNeedUserYesVideo'); + + // Local With Anchor Tag + createActionButton('Anchor1', function () { + doOpen(localhtml + '#bogusanchor', '_blank'); + }, 'openAnchor1'); + createActionButton('Anchor2', function () { + doOpen(localhtml + '#anchor2', '_blank'); + }, 'openAnchor2'); + + // Hardwareback + createActionButton('no hardwareback (defaults to yes)', function () { + doOpen('http://cordova.apache.org', '_blank'); + }, 'openHardwareBackDefault'); + createActionButton('hardwareback=yes', function () { + doOpen('http://cordova.apache.org', '_blank', 'hardwareback=yes'); + }, 'openHardwareBackYes'); + createActionButton('hardwareback=no', function () { + doOpen('http://cordova.apache.org', '_blank', 'hardwareback=no'); + }, 'openHardwareBackNo'); + createActionButton('no hardwareback -> hardwareback=no -> no hardwareback', function () { + var ref = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes'); + ref.addEventListener('loadstop', function () { + ref.close(); + }); + ref.addEventListener('exit', function () { + var ref2 = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes,hardwareback=no'); + ref2.addEventListener('loadstop', function () { + ref2.close(); + }); + ref2.addEventListener('exit', function () { + cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes'); + }); + }); + }, 'openHardwareBackDefaultAfterNo'); +}; diff --git a/app/plugins/cordova-plugin-inappbrowser/types/index.d.ts b/app/plugins/cordova-plugin-inappbrowser/types/index.d.ts new file mode 100644 index 0000000..ea3d3ad --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/types/index.d.ts @@ -0,0 +1,221 @@ +// Type definitions for Apache Cordova InAppBrowser plugin +// Project: https://github.com/apache/cordova-plugin-inappbrowser +// Definitions by: Microsoft Open Technologies Inc +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// +// Copyright (c) Microsoft Open Technologies Inc +// Licensed under the MIT license. + +interface Window { + /** + * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. + * @param url The URL to load. + * @param target The target in which to load the URL, an optional parameter that defaults to _self. + * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes. + * The options string must not contain any blank space, and each feature's + * name/value pairs must be separated by a comma. Feature names are case insensitive. + */ + open(url: string, target?: "_self", options?: string): InAppBrowser; + /** + * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. + * @param url The URL to load. + * @param target The target in which to load the URL, an optional parameter that defaults to _self. + * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes. + * The options string must not contain any blank space, and each feature's + * name/value pairs must be separated by a comma. Feature names are case insensitive. + */ + open(url: string, target?: "_blank", options?: string): InAppBrowser; + /** + * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. + * @param url The URL to load. + * @param target The target in which to load the URL, an optional parameter that defaults to _self. + * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes. + * The options string must not contain any blank space, and each feature's + * name/value pairs must be separated by a comma. Feature names are case insensitive. + */ + open(url: string, target?: "_system", options?: string): InAppBrowser; + /** + * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. + * @param url The URL to load. + * @param target The target in which to load the URL, an optional parameter that defaults to _self. + * @param options Options for the InAppBrowser. Optional, defaulting to: location=yes. + * The options string must not contain any blank space, and each feature's + * name/value pairs must be separated by a comma. Feature names are case insensitive. + */ + open(url: string, target?: string, options?: string, replace?: boolean): InAppBrowser; +} + +/** + * The object returned from a call to window.open. + * NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs. + */ +interface InAppBrowser extends Window { + onloadstart: (type: InAppBrowserEvent) => void; + onloadstop: (type: InAppBrowserEvent) => void; + onloaderror: (type: InAppBrowserEvent) => void; + onexit: (type: InAppBrowserEvent) => void; + // addEventListener overloads + /** + * Adds a listener for an event from the InAppBrowser. + * @param type the event to listen for + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; + /** + * Adds a listener for an event from the InAppBrowser. + * @param type the event to listen for + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void; + /** + * Adds a listener for an event from the InAppBrowser. + * @param type the event to listen for + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void; + /** + * Adds a listener for an event from the InAppBrowser. + * @param type the event to listen for + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void; + /** + * Adds a listener for an event from the InAppBrowser. + * @param type the event to listen for + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an Event object as a parameter. + */ + addEventListener(type: string, callback: (event: Event) => void): void; + // removeEventListener overloads + /** + * Removes a listener for an event from the InAppBrowser. + * @param type The event to stop listening for. + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; + /** + * Removes a listener for an event from the InAppBrowser. + * @param type The event to stop listening for. + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void; + /** + * Removes a listener for an event from the InAppBrowser. + * @param type The event to stop listening for. + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void; + /** + * Removes a listener for an event from the InAppBrowser. + * @param type The event to stop listening for. + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an InAppBrowserEvent object as a parameter. + */ + removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void; + /** + * Removes a listener for an event from the InAppBrowser. + * @param type The event to stop listening for. + * loadstart: event fires when the InAppBrowser starts to load a URL. + * loadstop: event fires when the InAppBrowser finishes loading a URL. + * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. + * exit: event fires when the InAppBrowser window is closed. + * @param callback the function that executes when the event fires. The function is + * passed an Event object as a parameter. + */ + removeEventListener(type: string, callback: (event: Event) => void): void; + /** Closes the InAppBrowser window. */ + close(): void; + /** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */ + hide(): void; + /** + * Displays an InAppBrowser window that was opened hidden. Calling this has no effect + * if the InAppBrowser was already visible. + */ + show(): void; + /** + * Injects JavaScript code into the InAppBrowser window. + * @param script Details of the script to run, specifying either a file or code key. + * @param callback The function that executes after the JavaScript code is injected. + * If the injected script is of type code, the callback executes with + * a single parameter, which is the return value of the script, wrapped in an Array. + * For multi-line scripts, this is the return value of the last statement, + * or the last expression evaluated. + */ + executeScript(script: { code: string }, callback: (result: any) => void): void; + /** + * Injects JavaScript code into the InAppBrowser window. + * @param script Details of the script to run, specifying either a file or code key. + * @param callback The function that executes after the JavaScript code is injected. + * If the injected script is of type code, the callback executes with + * a single parameter, which is the return value of the script, wrapped in an Array. + * For multi-line scripts, this is the return value of the last statement, + * or the last expression evaluated. + */ + executeScript(script: { file: string }, callback: (result: any) => void): void; + /** + * Injects CSS into the InAppBrowser window. + * @param css Details of the script to run, specifying either a file or code key. + * @param callback The function that executes after the CSS is injected. + */ + insertCSS(css: { code: string }, callback: () => void): void; + /** + * Injects CSS into the InAppBrowser window. + * @param css Details of the script to run, specifying either a file or code key. + * @param callback The function that executes after the CSS is injected. + */ + insertCSS(css: { file: string }, callback: () => void): void; +} + +interface InAppBrowserEvent extends Event { + /** the eventname, either loadstart, loadstop, loaderror, or exit. */ + type: string; + /** the URL that was loaded. */ + url: string; + /** the error code, only in the case of loaderror. */ + code: number; + /** the error message, only in the case of loaderror. */ + message: string; +} \ No newline at end of file diff --git a/app/plugins/cordova-plugin-inappbrowser/www/inappbrowser.css b/app/plugins/cordova-plugin-inappbrowser/www/inappbrowser.css new file mode 100644 index 0000000..5762c74 --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/www/inappbrowser.css @@ -0,0 +1,114 @@ +/* + * 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. + */ + +.inAppBrowserWrap { + margin: 0; + padding: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: 0 0; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 9999999; + box-sizing: border-box; + border: 40px solid #bfbfbf; + border: 40px solid rgba(0, 0, 0, 0.25); +} + +.inAppBrowserWrapFullscreen { + border: 0; +} + +.inappbrowser-app-bar { + height: 70px; + background-color: #404040; + z-index: 9999999; +} + +.inappbrowser-app-bar-inner { + padding-top: 10px; + height: 60px; + width: 155px; + margin: 0 auto; + background-color: #404040; + z-index: 9999999; +} + +.app-bar-action { + width: auto; + height: 40px; + margin-left: 20px; + font-family: "Segoe UI Symbol"; + float: left; + color: white; + font-size: 12px; + text-transform: lowercase; + text-align: center; + cursor: default; +} + +.app-bar-action[disabled] { + color: gray; + /*disable click*/ + pointer-events: none; +} + +.app-bar-action::before { + font-size: 28px; + display: block; + height: 36px; +} + +/* Back */ +.action-back { + margin-left: 0px; +} + +.action-back::before { + content: "\E0BA"; +} + +.action-back:not([disabled]):hover::before { + content: "\E0B3"; +} + +/* Forward */ +.action-forward::before { + content: "\E0AC"; +} + +.action-forward:not([disabled]):hover::before { + content: "\E0AF"; +} + +/* Close */ +.action-close::before { + content: "\E0C7"; + /* close icon is larger so we re-size it to fit other icons */ + font-size: 20px; + line-height: 40px; +} + +.action-close:not([disabled]):hover::before { + content: "\E0CA"; +} diff --git a/app/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js b/app/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js new file mode 100644 index 0000000..7c3e749 --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js @@ -0,0 +1,114 @@ +/* + * + * 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 () { + // special patch to correctly work on Ripple emulator (CB-9760) + if (window.parent && !!window.parent.ripple) { // https://gist.github.com/triceam/4658021 + module.exports = window.open.bind(window); // fallback to default window.open behaviour + return; + } + + var exec = require('cordova/exec'); + var channel = require('cordova/channel'); + var modulemapper = require('cordova/modulemapper'); + var urlutil = require('cordova/urlutil'); + + function InAppBrowser () { + this.channels = { + 'loadstart': channel.create('loadstart'), + 'loadstop': channel.create('loadstop'), + 'loaderror': channel.create('loaderror'), + 'exit': channel.create('exit') + }; + } + + InAppBrowser.prototype = { + _eventHandler: function (event) { + if (event && (event.type in this.channels)) { + this.channels[event.type].fire(event); + } + }, + close: function (eventname) { + exec(null, null, 'InAppBrowser', 'close', []); + }, + show: function (eventname) { + exec(null, null, 'InAppBrowser', 'show', []); + }, + hide: function (eventname) { + exec(null, null, 'InAppBrowser', 'hide', []); + }, + addEventListener: function (eventname, f) { + if (eventname in this.channels) { + this.channels[eventname].subscribe(f); + } + }, + removeEventListener: function (eventname, f) { + if (eventname in this.channels) { + this.channels[eventname].unsubscribe(f); + } + }, + + executeScript: function (injectDetails, cb) { + if (injectDetails.code) { + exec(cb, null, 'InAppBrowser', 'injectScriptCode', [injectDetails.code, !!cb]); + } else if (injectDetails.file) { + exec(cb, null, 'InAppBrowser', 'injectScriptFile', [injectDetails.file, !!cb]); + } else { + throw new Error('executeScript requires exactly one of code or file to be specified'); + } + }, + + insertCSS: function (injectDetails, cb) { + if (injectDetails.code) { + exec(cb, null, 'InAppBrowser', 'injectStyleCode', [injectDetails.code, !!cb]); + } else if (injectDetails.file) { + exec(cb, null, 'InAppBrowser', 'injectStyleFile', [injectDetails.file, !!cb]); + } else { + throw new Error('insertCSS requires exactly one of code or file to be specified'); + } + } + }; + + module.exports = function (strUrl, strWindowName, strWindowFeatures, callbacks) { + // Don't catch calls that write to existing frames (e.g. named iframes). + if (window.frames && window.frames[strWindowName]) { + var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open'); + return origOpenFunc.apply(window, arguments); + } + + strUrl = urlutil.makeAbsolute(strUrl); + var iab = new InAppBrowser(); + + callbacks = callbacks || {}; + for (var callbackName in callbacks) { + iab.addEventListener(callbackName, callbacks[callbackName]); + } + + var cb = function (eventname) { + iab._eventHandler(eventname); + }; + + strWindowFeatures = strWindowFeatures || ''; + + exec(cb, cb, 'InAppBrowser', 'open', [strUrl, strWindowName, strWindowFeatures]); + return iab; + }; +})(); diff --git a/app/plugins/cordova-plugin-inappbrowser/www/windows8/InAppBrowserProxy.js b/app/plugins/cordova-plugin-inappbrowser/www/windows8/InAppBrowserProxy.js new file mode 100644 index 0000000..13bb145 --- /dev/null +++ b/app/plugins/cordova-plugin-inappbrowser/www/windows8/InAppBrowserProxy.js @@ -0,0 +1,126 @@ +/* + * + * 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. + * + */ + +/* jslint sloppy:true */ +/* global Windows:true, require, document, setTimeout, window, module */ + +var browserWrap; + +var IAB = { + + close: function (win, lose) { + if (browserWrap) { + browserWrap.parentNode.removeChild(browserWrap); + browserWrap = null; + } + }, + show: function (win, lose) { + /* empty block, ran out of bacon? + if (browserWrap) { + + } */ + }, + hide: function (win, lose) { + /* empty block, ran out of bacon? + if (browserWrap) { + + } */ + }, + open: function (win, lose, args) { + var strUrl = args[0]; + var target = args[1]; + var url; + var elem; + + if (target === '_system') { + url = new Windows.Foundation.Uri(strUrl); + Windows.System.Launcher.launchUriAsync(url); + } else if (target === '_blank') { + if (!browserWrap) { + browserWrap = document.createElement('div'); + browserWrap.style.position = 'absolute'; + browserWrap.style.width = (window.innerWidth - 80) + 'px'; + browserWrap.style.height = (window.innerHeight - 80) + 'px'; + browserWrap.style.borderWidth = '40px'; + browserWrap.style.borderStyle = 'solid'; + browserWrap.style.borderColor = 'rgba(0,0,0,0.25)'; + browserWrap.style.zIndex = '9999999'; + + browserWrap.onclick = function () { + setTimeout(function () { + IAB.close(); + }, 0); + }; + + document.body.appendChild(browserWrap); + } + var localFile = (strUrl.indexOf('ms-appdata:///') > -1); + if (localFile) { + elem = document.createElement('x-ms-webview'); + elem.style.width = (window.innerWidth - 80) + 'px'; + elem.style.height = (window.innerHeight - 80) + 'px'; + elem.style.borderWidth = '0px'; + elem.name = 'targetFrame'; + elem.src = strUrl; + + window.addEventListener('resize', function () { + if (browserWrap && elem) { + elem.style.width = (window.innerWidth - 80) + 'px'; + elem.style.height = (window.innerHeight - 80) + 'px'; + } + }); + } else { + elem = document.createElement('iframe'); + elem.style.width = (window.innerWidth - 80) + 'px'; + elem.style.height = (window.innerHeight - 80) + 'px'; + elem.style.borderWidth = '0px'; + elem.name = 'targetFrame'; + elem.src = strUrl; + + window.addEventListener('resize', function () { + if (browserWrap && elem) { + elem.style.width = (window.innerWidth - 80) + 'px'; + elem.style.height = (window.innerHeight - 80) + 'px'; + } + }); + } + + browserWrap.appendChild(elem); + } else { + window.location = strUrl; + } + + // var object = new WinJS.UI.HtmlControl(elem, { uri: strUrl }); + }, + + injectScriptCode: function (code, bCB) { + + // "(function(d) { var c = d.createElement('script'); c.src = %@; d.body.appendChild(c); })(document)" + }, + + injectScriptFile: function (file, bCB) { + + } +}; + +module.exports = IAB; + +require('cordova/exec/proxy').add('InAppBrowser', module.exports); diff --git a/app/plugins/cordova-plugin-network-information/CONTRIBUTING.md b/app/plugins/cordova-plugin-network-information/CONTRIBUTING.md new file mode 100644 index 0000000..4c8e6a5 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/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/app/plugins/cordova-plugin-network-information/LICENSE b/app/plugins/cordova-plugin-network-information/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/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/app/plugins/cordova-plugin-network-information/NOTICE b/app/plugins/cordova-plugin-network-information/NOTICE new file mode 100644 index 0000000..fb19cbd --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/NOTICE @@ -0,0 +1,8 @@ +Apache Cordova +Copyright 2012 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +This product includes software developed by Apple Inc. License can be found in the header of the affected files. (src/ios/CDVReachability.h, src/ios/CDVReachability.m) + diff --git a/app/plugins/cordova-plugin-network-information/README.md b/app/plugins/cordova-plugin-network-information/README.md new file mode 100644 index 0000000..4ee2bb0 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/README.md @@ -0,0 +1,341 @@ +--- +title: Network Information +description: Get information about wireless connectivity. +--- + + +|AppVeyor|Travis CI| +|:-:|:-:| +|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-network-information?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-network-information)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-network-information)| + +# cordova-plugin-network-information + + +This plugin provides an implementation of an old version of the +[Network Information API](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/). +It provides information about the device's cellular and +wifi connection, and whether the device has an internet connection. + +> To get a few ideas how to use the plugin, check out the [sample](#sample) at the bottom of this page or go straight to the [reference](#reference) content. + +Report issues with this plugin on the [Apache Cordova issue tracker][Apache Cordova issue tracker]. + +##Reference + +## Installation + + cordova plugin add cordova-plugin-network-information + +## Supported Platforms + +- Amazon Fire OS +- Android +- BlackBerry 10 +- Browser +- iOS +- Windows Phone 7 and 8 +- Tizen +- Windows +- Firefox OS + +# Connection + +> The `connection` object, exposed via `navigator.connection`, provides information about the device's cellular and wifi connection. + +## Properties + +- connection.type + +## Constants + +- Connection.UNKNOWN +- Connection.ETHERNET +- Connection.WIFI +- Connection.CELL_2G +- Connection.CELL_3G +- Connection.CELL_4G +- Connection.CELL +- Connection.NONE + +## connection.type + +This property offers a fast way to determine the device's network +connection state, and type of connection. + +### Quick Example + +```js +function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); +} + +checkConnection(); +``` + +### API Change + +Until Cordova 2.3.0, the `Connection` object was accessed via +`navigator.network.connection`, after which it was changed to +`navigator.connection` to match the W3C specification. It's still +available at its original location, but is deprecated and will +eventually be removed. + +### iOS Quirks + +- + +The code examples in this section show examples of changing app behavior using the online and offline events and your network connection status. + +To start with, create a new FileEntry object (data.txt) to use for sample data. Call this function from the `deviceready` handler. + +>*Note* This code example requires the File plugin. + +```js +var dataFileEntry; + +function createSomeData() { + + window.requestFileSystem(window.TEMPORARY, 5 * 1024 * 1024, function (fs) { + + console.log('file system open: ' + fs.name); + // Creates a new file or returns an existing file. + fs.root.getFile("data.txt", { create: true, exclusive: false }, function (fileEntry) { + + dataFileEntry = fileEntry; + + }, onErrorCreateFile); + + }, onErrorLoadFs); +} +``` + +Next, add listeners for the online and offline events in the `deviceready` handler. + +```js +document.addEventListener("offline", onOffline, false); +document.addEventListener("online", onOnline, false); +``` + +The app's `onOnline` function handles the online event. In the event handler, check the current network state. In this app, treat any connection type as good except Connection.NONE. If you have a connection, you try to upload a file. + +```js +function onOnline() { + // Handle the online event + var networkState = navigator.connection.type; + + if (networkState !== Connection.NONE) { + if (dataFileEntry) { + tryToUploadFile(); + } + } + display('Connection type: ' + networkState); +} +``` + +When the online event fires in the preceding code, call the app's `tryToUploadFile` function. + +If the FileTransfer object's upload function fails, call the app's `offlineWrite` function to save the current data somewhere. + +>*Note* This example requires the FileTransfer plugin. + +```js +function tryToUploadFile() { + // !! Assumes variable fileURL contains a valid URL to a text file on the device, + var fileURL = getDataFileEntry().toURL(); + + var success = function (r) { + console.log("Response = " + r.response); + display("Uploaded. Response: " + r.response); + } + + var fail = function (error) { + console.log("An error has occurred: Code = " + error.code); + offlineWrite("Failed to upload: some offline data"); + } + + var options = new FileUploadOptions(); + options.fileKey = "file"; + options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1); + options.mimeType = "text/plain"; + + var ft = new FileTransfer(); + // Make sure you add the domain of your server URL to the + // Content-Security-Policy element in index.html. + ft.upload(fileURL, encodeURI(SERVER), success, fail, options); +}; +``` + +Here is the code for the `offlineWrite` function. + +>*Note* This code examples requires the File plugin. + +```js +function offlineWrite(offlineData) { + // Create a FileWriter object for our FileEntry. + dataFileEntry.createWriter(function (fileWriter) { + + fileWriter.onwriteend = function () { + console.log("Successful file write..."); + display(offlineData); + }; + + fileWriter.onerror = function (e) { + console.log("Failed file write: " + e.toString()); + }; + + fileWriter.write(offlineData); + }); +} +``` + +If the offline event occurs, just do something like notify the user (for this example, just log it). + +```js +function onOffline() { + // Handle the offline event + console.log("lost connection"); +} +``` + +[Apache Cordova issue tracker]: https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Network%20Information%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC diff --git a/app/plugins/cordova-plugin-network-information/RELEASENOTES.md b/app/plugins/cordova-plugin-network-information/RELEASENOTES.md new file mode 100644 index 0000000..0d1e150 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/RELEASENOTES.md @@ -0,0 +1,170 @@ + +# Release Notes + +### 1.3.4 (Nov 06, 2017) +* [CB-12751](https://issues.apache.org/jira/browse/CB-12751) (ios) Fix connection type when airplane mode is on +* [CB-13299](https://issues.apache.org/jira/browse/CB-13299) (CI) Fix **Android** builds +* [CB-12895](https://issues.apache.org/jira/browse/CB-12895) added `eslint` and removed `jshint` +* [CB-13028](https://issues.apache.org/jira/browse/CB-13028) (CI) **Browser** builds on Travis and AppVeyor +* [CB-12847](https://issues.apache.org/jira/browse/CB-12847) added `bugs` entry to `package.json`. + +### 1.3.3 (Apr 27, 2017) +* [CB-12622](https://issues.apache.org/jira/browse/CB-12622) Add **Android 6.0** build badge to `README` +* [CB-12685](https://issues.apache.org/jira/browse/CB-12685) added `package.json` to tests folder + +### 1.3.2 (Feb 28, 2017) +* [CB-12369](https://issues.apache.org/jira/browse/CB-12369) Add plugin typings from `DefinitelyTyped` +* [CB-12363](https://issues.apache.org/jira/browse/CB-12363) Added build badges for **iOS 9.3** and **iOS 10.0** +* [CB-11838](https://issues.apache.org/jira/browse/CB-11838) **iOS:** Unregister callback function at the right timing. +* [CB-12230](https://issues.apache.org/jira/browse/CB-12230) Removed **Windows 8.1** build badges + +### 1.3.1 (Dec 07, 2016) +* [CB-12224](https://issues.apache.org/jira/browse/CB-12224) Updated version and RELEASENOTES.md for release 1.3.1 +* [CB-11230](https://issues.apache.org/jira/browse/CB-11230) [CB-11505](https://issues.apache.org/jira/browse/CB-11505) iOS: Add compatibility with IPv6 +* [CB-11917](https://issues.apache.org/jira/browse/CB-11917) - Remove pull request template checklist item: "iCLA has been submitted…" +* [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Incremented plugin version. + +### 1.3.0 (Sep 08, 2016) +* [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies +* [CB-11734](https://issues.apache.org/jira/browse/CB-11734) Network Plugin uses `Android Log class` and not `Cordova LOG class` +* [CB-11300](https://issues.apache.org/jira/browse/CB-11300) (**android**) Recognize `2G`, `3G` and `4G` network connection subtype names +* Update `NetworkManager.java` +* Detection of Ethernet Network Type on **Android** +* fixed two potential memory leaks when doing Analyze on **iOS 9** +* [CB-11384](https://issues.apache.org/jira/browse/CB-11384) **android**: Does not pass sonarqube scan +* Add badges for paramedic builds on Jenkins +* Add pull request template. +* Readme: Add fenced code blocks with langauage hints +* [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to README.md + +### 1.2.1 (Apr 15, 2016) +* [CB-10763](https://issues.apache.org/jira/browse/CB-10763) Remove emoji in `cordova-plugin-network-information` +* [CB-10636](https://issues.apache.org/jira/browse/CB-10636) Add `JSHint` for plugins + +### 1.2.0 (Jan 15, 2016) +* Adding `CoreTelephony` to `plugin.xml` +* Adding notification for `CT radio` information +* Adding `CT radio` information +* [CB-10160](https://issues.apache.org/jira/browse/CB-10160) Fixed the case mismatch issue + +### 1.1.0 (Nov 18, 2015) +* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest +* Fixing contribute link. +* These notifications are objects so their address always evaluates to true. +* Update `NetworkManager.java` +* [CB-9542](https://issues.apache.org/jira/browse/CB-9542) `Browser Proxy` not defined correctly +* Solved `toLowerCase` issue with `Locale.US` + +### 1.0.1 (Jun 17, 2015) +* Adding .ratignore file. +* [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-plugin-network-information documentation translation: cordova-plugin-network-information +* fix npm md issue + +### 1.0.0 (Apr 15, 2015) +* [CB-8746](https://issues.apache.org/jira/browse/CB-8746) gave plugin major version bump +* [CB-8683](https://issues.apache.org/jira/browse/CB-8683) changed plugin-id to pacakge-name +* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) properly updated translated docs to use new id +* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) updated translated docs to use new id +* [CB-8185](https://issues.apache.org/jira/browse/CB-8185) Fixes typo in `cordova.platformId` +* Use TRAVIS_BUILD_DIR, install paramedic by npm +* [CB-8185](https://issues.apache.org/jira/browse/CB-8185) Use `navigator.onLine` as connection information source on browser platform +* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) Updated Readme +* [CB-8659](https://issues.apache.org/jira/browse/CB-8659): ios: 4.0.x Compatibility: Remove use of initWebView method +* [CB-8573](https://issues.apache.org/jira/browse/CB-8573) Integrate TravisCI +* [CB-8438](https://issues.apache.org/jira/browse/CB-8438) cordova-plugin-network-information documentation translation: cordova-plugin-network-information +* [CB-8538](https://issues.apache.org/jira/browse/CB-8538) Added package.json file + +### 0.2.15 (Feb 04, 2015) +* [CB-8384](https://issues.apache.org/jira/browse/CB-8384) Network status change support on Windows +* [CB-8384](https://issues.apache.org/jira/browse/CB-8384) Fixes the way we detect online status on Windows +* [CB-8384](https://issues.apache.org/jira/browse/CB-8384) Add Windows platform quirks +* [CB-8384](https://issues.apache.org/jira/browse/CB-8384) Add Windows section to Network Information plugin + +### 0.2.14 (Dec 02, 2014) +* [CB-7976](https://issues.apache.org/jira/browse/CB-7976) **Android**: Use webView's context rather than Activity's context for intent receiver +* [CB-7700](https://issues.apache.org/jira/browse/CB-7700) cordova-plugin-network-information documentation translation: cordova-plugin-network-information + +### 0.2.13 (Oct 03, 2014) +* [CB-7595](https://issues.apache.org/jira/browse/CB-7595): Android L changes the type from Mobile to Cellular, I'm pretty sure this isn't documented + +### 0.2.12 (Sep 17, 2014) +* [CB-7471](https://issues.apache.org/jira/browse/CB-7471) cordova-plugin-network-information documentation translation +* Fix network information type exception on fxos 2 +* Added support for the browser +* [CB-6724](https://issues.apache.org/jira/browse/CB-6724) added documentation for manual tests +* remove reference to test assets, they are optional +* Renamed test dir and added nested plugin.xml +* [CB-6964](https://issues.apache.org/jira/browse/CB-6964) ported manual tests +* Port network tests to plugin-test-framework +* Fix naviagtor typo + +### 0.2.11 (Aug 06, 2014) +* **FFOS** update NetworkProxy.js +* [CB-6127](https://issues.apache.org/jira/browse/CB-6127) Updated translations for docs +* [CB-7019](https://issues.apache.org/jira/browse/CB-7019) Updated version and RELEASENOTES.md for release 0.2.10 +* Fixed docs for online/offline event being backwards + +### 0.2.10 (Jun 24, 2014) +* [CB-6907](https://issues.apache.org/jira/browse/CB-6907): [android] Don't crash on startup if no networks available + +### 0.2.9 (Jun 05, 2014) +* updated notice file to include missing license +* Cached extra info to better detect changes. +* [CB-6809](https://issues.apache.org/jira/browse/CB-6809) Add license to CONTRIBUTING.md +* [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md +* [CB-6350](https://issues.apache.org/jira/browse/CB-6350) - Fix networkStatusForFlags return value type to work with 64-bit iOS (closes #8) +* Initial version of firefox os network information plugin +* there was an error in the object definition + +### 0.2.8 (Apr 17, 2014) +* [CB-6342](https://issues.apache.org/jira/browse/CB-6342): [iOS] iOS reports a cellular connection even when in Airplane mode +* [CB-6422](https://issues.apache.org/jira/browse/CB-6422): [windows8] use cordova/exec/proxy +* [CB-6460](https://issues.apache.org/jira/browse/CB-6460): Update license headers +* [CB-6465](https://issues.apache.org/jira/browse/CB-6465): Add license headers to Tizen code +* Add NOTICE file + +### 0.2.7 (Feb 05, 2014) +* Initial implementation of Tizen plugin. + +### 0.2.6 (Jan 02, 2014) +* [CB-5658](https://issues.apache.org/jira/browse/CB-5658) Add doc/index.md for netinfo plugin + +### 0.2.5 (Dec 4, 2013) +* [ubuntu] specify policy_group +* add ubuntu platform +* Added amazon-fireos platform. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos' + +### 0.2.4 (Oct 28, 2013) +* [CB-5128](https://issues.apache.org/jira/browse/CB-5128): add repo + issue tag to plugin.xml for network information plugin +* [CB-4915](https://issues.apache.org/jira/browse/CB-4915) Incremented plugin version on dev branch. + +### 0.2.3 (Sept 25, 2013) +* [CB-4889](https://issues.apache.org/jira/browse/CB-4889) bumping&resetting version +* [windows8] commandProxy was moved +* [CB-4889](https://issues.apache.org/jira/browse/CB-4889) renaming org.apache.cordova.core.network-information to org.apache.cordova.network-information +* removed duplicate comment line from plugin.xml +* added Network APIs for FirefoxOS +* Rename CHANGELOG.md -> RELEASENOTES.md +* [CB-4752](https://issues.apache.org/jira/browse/CB-4752) Incremented plugin version on dev branch. + +### 0.2.1 (Sept 5, 2013) +* [CB-4432](https://issues.apache.org/jira/browse/CB-4432) copyright notice change diff --git a/app/plugins/cordova-plugin-network-information/doc/de/README.md b/app/plugins/cordova-plugin-network-information/doc/de/README.md new file mode 100644 index 0000000..f6292b2 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/de/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +Dieses Plugin stellt eine Implementierung einer alten Version der [Netzwerk-Informationen-API](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/). Es werden Informationen über das Gerät Mobilfunk und Wifi-Anschluss, und ob das Gerät über eine Internetverbindung verfügt. + +## Installation + + cordova plugin add cordova-plugin-network-information + + +## Unterstützte Plattformen + + * Amazon Fire OS + * Android + * BlackBerry 10 + * Browser + * iOS + * Windows Phone 7 und 8 + * Tizen + * Windows + * Firefox OS + +# Connection + +> Das `connection` Objekt, verfügbar gemachten über `navigator.connection`, enthält Informationen über die Mobilfunk- und Wi-Fi-Verbindung des Gerätes. + +## Eigenschaften + + * connection.type + +## Konstanten + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +Diese Eigenschaft bietet eine schnelle Möglichkeit, um den Netzwerkverbindungsstatus und die Art der Verbindung zu bestimmen. + +### Kurzes Beispiel + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API Änderung + +Bis Cordova 2.3.0 wurde auf das `Connection` Objekt über `navigator.network.connection` zugegriffen, danach wurde der Zugriff auf `navigator.connection` geändert, um der W3C-Spezifikation zu entsprechen. Es steht immer noch an seiner ursprünglichen Stelle, aber ist veraltet und wird schliesslich entfernt. + +### iOS Macken + + * iOS kann Mobilfunknetz Verbindungstyp nicht erkennen. + * `navigator.connection.type`auf festgelegt ist `Connection.CELL` für alle Handy-Daten. + +### Windows Phone Macken + + * Wenn im Emulator ausgeführt wird, erkennt immer `navigator.connection.type` als`Connection.UNKNOWN`. + + * Windows Phone kann Mobilfunknetz Verbindungstyp nicht erkennen. + + * `navigator.connection.type`auf festgelegt ist `Connection.CELL` für alle Handy-Daten. + +### Windows-Eigenheiten + + * Wenn im Telefon 8.1 Emulator ausgeführt wird, erkennt immer `navigator.connection.type` als `Connection.ETHERNET`. + +### Tizen Macken + + * Tizen kann nur ein WiFi oder Mobilfunkverbindung erkennen. + * `Navigator.Connection.Type` ist für alle Handy-Daten auf `Connection.CELL_2G` festgelegt. + +### Firefox OS Macken + + * Firefox-OS kann Mobilfunknetz Verbindungstyp nicht erkennen. + * `navigator.connection.type`auf festgelegt ist `Connection.CELL` für alle Handy-Daten. + +### Browser-Eigenheiten + + * Browser kann die Art der Netzwerkverbindung nicht erkennen. `navigator.connection.type` ist immer auf `Connection.UNKNOWN` beim online gesetzt. + +# Netzwerk-Veranstaltungen + +## offline + +Das Ereignis wird ausgelöst, wenn eine Anwendung offline geht, und das Gerät nicht mit dem Internet verbunden ist. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Details + +Das `offline` -Ereignis wird ausgelöst, wenn ein bereits angeschlossenes Gerät eine Netzwerkverbindung verliert, so dass eine Anwendung nicht mehr auf das Internet zugreifen kann. Es stützt sich auf die gleichen Informationen wie die Verbindung-API und wird ausgelöst, wenn der Wert des `connection.type` wird`NONE`. + +Anwendungen sollten in der Regel verwenden `document.addEventListener` einmal einen Ereignis-Listener hinzufügen das `deviceready` -Ereignis ausgelöst. + +### Kurzes Beispiel + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS Macken + +Beim ersten Start dauert das erste offline-Event (falls zutreffend) mindestens eine Sekunde zu schießen. + +### Windows Phone 7 Macken + +Bei der Ausführung im Emulator, der `connection.status` ist immer unbekannt, so dass dieses Ereignis *nicht* Feuer. + +### Windows Phone 8 Macken + +Der Emulator meldet den Verbindungstyp als `Cellular` , die wird nicht geändert, so dass das Ereignis *nicht* Feuer. + +## online + +Dieses Ereignis wird ausgelöst, wenn eine Anwendung online geht, und das Gerät wird mit dem Internet verbunden. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Details + +Das `online` -Ereignis wird ausgelöst, wenn ein zuvor unverbundenen Gerät eine Netzwerkverbindung zu einem Anwendung Zugriff auf das Internet empfängt. Es stützt sich auf die gleichen Informationen wie die Verbindung-API und wird ausgelöst, wenn die `connection.type` ändert sich von `NONE` auf einen anderen Wert. + +Anwendungen sollten in der Regel verwenden `document.addEventListener` einmal einen Ereignis-Listener hinzufügen das `deviceready` -Ereignis ausgelöst. + +### Kurzes Beispiel + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS Macken + +Beim ersten Start die erste `online` Ereignis (falls zutreffend) dauert mindestens eine Sekunde vor dem Feuer `connection.type` ist`UNKNOWN`. + +### Windows Phone 7 Macken + +Bei der Ausführung im Emulator, der `connection.status` ist immer unbekannt, so dass dieses Ereignis *nicht* Feuer. + +### Windows Phone 8 Macken + +Der Emulator meldet den Verbindungstyp als `Cellular` , die wird nicht geändert, so dass Ereignisse *nicht* Feuer. \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/de/index.md b/app/plugins/cordova-plugin-network-information/doc/de/index.md new file mode 100644 index 0000000..537328a --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/de/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +Dieses Plugin stellt eine Implementierung einer alten Version der [Netzwerk-Informationen-API][1]. Es werden Informationen über das Gerät Mobilfunk und Wifi-Anschluss, und ob das Gerät über eine Internetverbindung verfügt. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## Installation + + cordova plugin add cordova-plugin-network-information + + +## Unterstützte Plattformen + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Browser +* iOS +* Windows Phone 7 und 8 +* Tizen +* Windows +* Firefox OS + +# Connection + +> Das `connection` Objekt, verfügbar gemachten über `navigator.connection`, enthält Informationen über die Mobilfunk- und Wi-Fi-Verbindung des Gerätes. + +## Eigenschaften + +* connection.type + +## Konstanten + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +Diese Eigenschaft bietet eine schnelle Möglichkeit, um den Netzwerkverbindungsstatus und die Art der Verbindung zu bestimmen. + +### Kurzes Beispiel + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API Änderung + +Bis Cordova 2.3.0 wurde auf das `Connection` Objekt über `navigator.network.connection` zugegriffen, danach wurde der Zugriff auf `navigator.connection` geändert, um der W3C-Spezifikation zu entsprechen. Es steht immer noch an seiner ursprünglichen Stelle, aber ist veraltet und wird schliesslich entfernt. + +### iOS Macken + +* iOS kann Mobilfunknetz Verbindungstyp nicht erkennen. + * `navigator.connection.type`auf festgelegt ist `Connection.CELL` für alle Handy-Daten. + +### Windows Phone Macken + +* Wenn im Emulator ausgeführt wird, erkennt immer `navigator.connection.type` als`Connection.UNKNOWN`. + +* Windows Phone kann Mobilfunknetz Verbindungstyp nicht erkennen. + + * `navigator.connection.type`auf festgelegt ist `Connection.CELL` für alle Handy-Daten. + +### Windows-Eigenheiten + +* Wenn im Telefon 8.1 Emulator ausgeführt wird, erkennt immer `navigator.connection.type` als `Connection.ETHERNET`. + +### Tizen Macken + +* Tizen kann nur ein WiFi oder Mobilfunkverbindung erkennen. + * `Navigator.Connection.Type` ist für alle Handy-Daten auf `Connection.CELL_2G` festgelegt. + +### Firefox OS Macken + +* Firefox-OS kann Mobilfunknetz Verbindungstyp nicht erkennen. + * `navigator.connection.type`auf festgelegt ist `Connection.CELL` für alle Handy-Daten. + +# Netzwerk-Veranstaltungen + +## offline + +Das Ereignis wird ausgelöst, wenn eine Anwendung offline geht, und das Gerät nicht mit dem Internet verbunden ist. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Details + +Das `offline` -Ereignis wird ausgelöst, wenn ein bereits angeschlossenes Gerät eine Netzwerkverbindung verliert, so dass eine Anwendung nicht mehr auf das Internet zugreifen kann. Es stützt sich auf die gleichen Informationen wie die Verbindung-API und wird ausgelöst, wenn der Wert des `connection.type` wird`NONE`. + +Anwendungen sollten in der Regel verwenden `document.addEventListener` einmal einen Ereignis-Listener hinzufügen das `deviceready` -Ereignis ausgelöst. + +### Kurzes Beispiel + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS Macken + +Beim ersten Start dauert das erste offline-Event (falls zutreffend) mindestens eine Sekunde zu schießen. + +### Windows Phone 7 Macken + +Bei der Ausführung im Emulator, der `connection.status` ist immer unbekannt, so dass dieses Ereignis *nicht* Feuer. + +### Windows Phone 8 Macken + +Der Emulator meldet den Verbindungstyp als `Cellular` , die wird nicht geändert, so dass das Ereignis *nicht* Feuer. + +## online + +Dieses Ereignis wird ausgelöst, wenn eine Anwendung online geht, und das Gerät wird mit dem Internet verbunden. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Details + +Das `online` -Ereignis wird ausgelöst, wenn ein zuvor unverbundenen Gerät eine Netzwerkverbindung zu einem Anwendung Zugriff auf das Internet empfängt. Es stützt sich auf die gleichen Informationen wie die Verbindung-API und wird ausgelöst, wenn die `connection.type` ändert sich von `NONE` auf einen anderen Wert. + +Anwendungen sollten in der Regel verwenden `document.addEventListener` einmal einen Ereignis-Listener hinzufügen das `deviceready` -Ereignis ausgelöst. + +### Kurzes Beispiel + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS Macken + +Beim ersten Start die erste `online` Ereignis (falls zutreffend) dauert mindestens eine Sekunde vor dem Feuer `connection.type` ist`UNKNOWN`. + +### Windows Phone 7 Macken + +Bei der Ausführung im Emulator, der `connection.status` ist immer unbekannt, so dass dieses Ereignis *nicht* Feuer. + +### Windows Phone 8 Macken + +Der Emulator meldet den Verbindungstyp als `Cellular` , die wird nicht geändert, so dass Ereignisse *nicht* Feuer. diff --git a/app/plugins/cordova-plugin-network-information/doc/es/README.md b/app/plugins/cordova-plugin-network-information/doc/es/README.md new file mode 100644 index 0000000..4e30593 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/es/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +Este plugin proporciona una implementación de una versión antigua de la [Red de información API](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/). Proporciona información acerca del dispositivo móvil y conexión wifi, y si el dispositivo tiene una conexión a internet. + +## Instalación + + cordova plugin add cordova-plugin-network-information + + +## Plataformas soportadas + + * Amazon fire OS + * Android + * BlackBerry 10 + * Explorador + * iOS + * Windows Phone 7 y 8 + * Tizen + * Windows + * Firefox OS + +# Connection + +> El objeto de `connection`, expuesto a través de `navigator.connection`, proporciona información sobre conexión celular y wifi del dispositivo. + +## Propiedades + + * connection.type + +## Constantes + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +Esta propiedad ofrece una forma rápida de determinar el estado de conexión de red del dispositivo y el tipo de conexión. + +### Ejemplo rápido + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Cambio de API + +Hasta Cordova 2.3.0, el objeto de `conexión` era acceder a través de `navigator.network.connection`, tras lo cual fue cambiada a `navigator.connection` para que coincida con la especificación del W3C. Sigue estando disponible en su ubicación original, pero es obsoleto y eventualmente desaparecerá. + +### iOS rarezas + + * iOS no puede detectar el tipo de conexión de red celular. + * `navigator.connection.type` está establecido en `Connection.CELL` para todos los datos de celulares. + +### Windows Phone rarezas + + * Cuando se ejecuta en el emulador, siempre detecta `navigator.connection.type` como `Connection.UNKNOWN`. + + * Windows Phone no puede detectar el tipo de conexión de red celular. + + * `navigator.connection.type` está establecido en `Connection.CELL` para todos los datos de celulares. + +### Windows rarezas + + * Cuando se ejecuta en el emulador de teléfono 8.1, siempre detecta `navigator.connection.type` como`Connection.ETHERNET`. + +### Rarezas Tizen + + * Tizen sólo puede detectar un Wi-Fi o conexión celular. + * `navigator.connection.type`se establece en `Connection.CELL_2G` para todos los datos celulares. + +### Firefox OS rarezas + + * Firefox OS no puede detectar el tipo de conexión de red celular. + * `navigator.connection.type` está establecido en `Connection.CELL` para todos los datos de celulares. + +### Navegador rarezas + + * Navegador no puede detectar el tipo de conexión de red. `Navigator.Connection.Type` se encuentra siempre a `Connection.UNKNOWN` cuando en línea. + +# Eventos relacionados con la red + +## offline + +El evento se desencadena cuando una aplicación está desconectada, y el dispositivo no está conectado a Internet. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Detalles + +El evento `offline` se desencadena cuando un dispositivo conectado previamente pierde una conexión de red para que una aplicación no puede acceder a Internet. Se basa en la misma información que la API de conexión y cuando se dispara el valor del `connection.type` se convierte`NONE`. + +Las aplicaciones normalmente deben utilizar `document.addEventListener` para conectar un detector de eventos una vez que se desencadene el evento `deviceready`. + +### Ejemplo rápido + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS rarezas + +Durante el arranque inicial, el primer evento offline (si es aplicable) tarda al menos un segundo en fuego. + +### Windows Phone 7 rarezas + +Cuando se ejecuta en el emulador, la `connection.status` siempre es desconocido, así que este evento no se ** fuego. + +### Windows Phone 8 rarezas + +El emulador informa el tipo de conexión como `celular`, que no cambia, así que el evento *no se* fuego. + +## online + +Este evento se desencadena cuando una aplicación va en línea, y el dispositivo se conecta a Internet. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Detalles + +El evento `online` se desencadena cuando un dispositivo previamente inconexos recibe una conexión de red para permitir un acceso a las aplicaciones para Internet. Se basa en la misma información que la API de conexión y se desencadena cuando el `connection.type` cambia de `ninguno` a cualquier otro valor. + +Las aplicaciones normalmente deben utilizar `document.addEventListener` para conectar un detector de eventos una vez que se desencadene el evento `deviceready`. + +### Ejemplo rápido + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS rarezas + +Durante el arranque inicial, el primer evento `en línea` (si procede) al menos toma un segundo para disparar, antes de que `connection.type` es `desconocido`. + +### Windows Phone 7 rarezas + +Cuando se ejecuta en el emulador, la `connection.status` siempre es desconocido, así que este evento no se ** fuego. + +### Windows Phone 8 rarezas + +El emulador, informa el tipo de conexión como `Cellular` , que no cambia, así que se lo eventos *no* fuego. \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/es/index.md b/app/plugins/cordova-plugin-network-information/doc/es/index.md new file mode 100644 index 0000000..65158ef --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/es/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +Este plugin proporciona una implementación de una versión antigua de la [Red de información API][1]. Proporciona información acerca del dispositivo móvil y conexión wifi, y si el dispositivo tiene una conexión a internet. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## Instalación + + cordova plugin add cordova-plugin-network-information + + +## Plataformas soportadas + +* Amazon fire OS +* Android +* BlackBerry 10 +* Explorador +* iOS +* Windows Phone 7 y 8 +* Tizen +* Windows +* Firefox OS + +# Conexión + +> El objeto de `connection`, expuesto a través de `navigator.connection`, proporciona información sobre conexión celular y wifi del dispositivo. + +## Propiedades + +* connection.type + +## Constantes + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_4G +* Connection.CELL_3G +* Connection.CELL +* Connection.NONE + +## connection.type + +Esta propiedad ofrece una forma rápida de determinar el estado de conexión de red del dispositivo y el tipo de conexión. + +### Ejemplo rápido + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Cambio de API + +Hasta Cordova 2.3.0, el objeto de `conexión` era acceder a través de `navigator.network.connection`, tras lo cual fue cambiada a `navigator.connection` para que coincida con la especificación del W3C. Sigue estando disponible en su ubicación original, pero es obsoleto y eventualmente desaparecerá. + +### iOS rarezas + +* iOS no puede detectar el tipo de conexión de red celular. + * `navigator.connection.type` está establecido en `Connection.CELL` para todos los datos de celulares. + +### Windows Phone rarezas + +* Cuando se ejecuta en el emulador, siempre detecta `navigator.connection.type` como `Connection.UNKNOWN`. + +* Windows Phone no puede detectar el tipo de conexión de red celular. + + * `navigator.connection.type` está establecido en `Connection.CELL` para todos los datos de celulares. + +### Windows rarezas + +* Cuando se ejecuta en el emulador de teléfono 8.1, siempre detecta `navigator.connection.type` como`Connection.ETHERNET`. + +### Rarezas Tizen + +* Tizen sólo puede detectar un Wi-Fi o conexión celular. + * `navigator.connection.type`se establece en `Connection.CELL_2G` para todos los datos celulares. + +### Firefox OS rarezas + +* Firefox OS no puede detectar el tipo de conexión de red celular. + * `navigator.connection.type`se establece en `Connection.CELL` para todos los datos celulares. + +# Eventos relacionados con la red + +## offline + +El evento se desencadena cuando una aplicación está desconectada, y el dispositivo no está conectado a Internet. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Detalles + +El evento `offline` se desencadena cuando un dispositivo conectado previamente pierde una conexión de red para que una aplicación no puede acceder a Internet. Se basa en la misma información que la API de conexión y cuando se dispara el valor del `connection.type` se convierte`NONE`. + +Las aplicaciones normalmente deben utilizar `document.addEventListener` para conectar un detector de eventos una vez que se desencadene el evento `deviceready`. + +### Ejemplo rápido + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS rarezas + +Durante el arranque inicial, el primer evento offline (si es aplicable) tarda al menos un segundo en fuego. + +### Windows Phone 7 rarezas + +Cuando se ejecuta en el emulador, la `connection.status` siempre es desconocido, así que este evento no se ** fuego. + +### Windows Phone 8 rarezas + +El emulador informa el tipo de conexión como `celular`, que no cambia, así que el evento *no se* fuego. + +## online + +Este evento se desencadena cuando una aplicación va en línea, y el dispositivo se conecta a Internet. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Detalles + +El evento `online` se desencadena cuando un dispositivo previamente inconexos recibe una conexión de red para permitir un acceso a las aplicaciones para Internet. Se basa en la misma información que la API de conexión y se desencadena cuando el `connection.type` cambia de `ninguno` a cualquier otro valor. + +Las aplicaciones normalmente deben utilizar `document.addEventListener` para conectar un detector de eventos una vez que se desencadene el evento `deviceready`. + +### Ejemplo rápido + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS rarezas + +Durante el arranque inicial, el primer evento `en línea` (si procede) al menos toma un segundo para disparar, antes de que `connection.type` es `desconocido`. + +### Windows Phone 7 rarezas + +Cuando se ejecuta en el emulador, la `connection.status` siempre es desconocido, así que este evento no se ** fuego. + +### Windows Phone 8 rarezas + +El emulador, informa el tipo de conexión como `Cellular` , que no cambia, así que se lo eventos *no* fuego. diff --git a/app/plugins/cordova-plugin-network-information/doc/fr/README.md b/app/plugins/cordova-plugin-network-information/doc/fr/README.md new file mode 100644 index 0000000..8f2b82c --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/fr/README.md @@ -0,0 +1,188 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +Ce plugin fournit une implémentation d'une ancienne version de l' [API Information Network](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/). Il fournit des informations sur l'appareil cellulaire et connexion wifi, et si l'appareil dispose d'une connexion internet. + +## Installation + + cordova plugin add cordova-plugin-network-information + + +## Plates-formes supportées + + * Amazon Fire OS + * Android + * BlackBerry 10 + * Navigateur + * iOS + * Windows Phone 7 et 8 + * Paciarelli + * Windows + * Firefox OS + +# Connexion + +> L'objet `connection`, disponible via `navigator.connection`, fournit des informations sur la connection cellulaire/wifi de l'appareil. + +## Propriétés + + * connection.type + +## Constantes + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +Cette propriété offre un moyen rapide pour déterminer l'état et le type de la connexion réseau de l'appareil. + +### Exemple court + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Changement d'API + +Jusqu'à Cordova 2.3.0, l'objet `Connection` était accessible via `navigator.network.connection` ; ceci a été changé pour `navigator.connection` afin de concorder avec la spécification du W3C. L'accès est toujours possible à l'emplacement d'origine, mais est considéré comme obsolète et sera bientôt supprimé. + +### Notes au sujet d'iOS + + * iOS ne peut pas détecter le type de connexion au réseau cellulaire. + * `navigator.connection.type`a la valeur `Connection.CELL` pour toutes les données cellulaires. + +### Windows Phone Quirks + + * Lors de l'exécution dans l'émulateur, détecte toujours `navigator.connection.type` comme`Connection.UNKNOWN`. + + * Windows Phone ne peut pas détecter le type de connexion au réseau cellulaire. + + * `navigator.connection.type`a la valeur `Connection.CELL` pour toutes les données cellulaires. + +### Bizarreries de Windows + + * Lors de l'exécution dans l'émulateur de téléphone 8.1, `Connection.ETHERNET` détecte toujours `navigator.connection.type`. + +### Bizarreries de paciarelli + + * Paciarelli ne peut détecter une connexion cellulaire ou le WiFi. + * `navigator.connection.type` a la valeur `Connection.CELL_2G` pour toutes les données cellulaires. + +### Firefox OS Quirks + + * Firefox OS ne peut pas détecter le type de connexion au réseau cellulaire. + * `navigator.connection.type`a la valeur `Connection.CELL` pour toutes les données cellulaires. + +### Bizarreries navigateur + + * Navigateur ne peut pas détecter le type de connexion réseau. `navigator.connection.type` est toujours définie sur `Connection.UNKNOWN` en ligne. + +# Événements liés au réseau + +## offline + +L'évènement se déclenche lorsqu'une application se déconnecte, quand l'appareil n'est pas connecté à Internet. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Détails + +L'évènement `offline` se déclenche lorsqu'un appareil précédemment connecté perd sa connexion au réseau, empêchant ainsi l'application d'accéder à Internet. Il s'appuie sur les mêmes informations que l'API de connexion et se déclenche lorsque la valeur de `connection.type` devient`NONE`. + +Les applications devraient en général utiliser `document.addEventListener` pour attacher un écouteur d'évènements, une fois l'évènement `deviceready` déclenché. + +### Exemple court + + document.addEventListener (« hors ligne », onOffline, false) ; + + function onOffline() {/ / gestion de l'événement en mode hors connexion} + + +### Notes au sujet d'iOS + +Lors du démarrage initial, le déclenchement du premier évènement offline (si applicable) prend au moins une seconde. + +### Windows Phone 7 Quirks + +Lors de l'exécution dans l'émulateur, le `connection.status` est toujours inconnu, ainsi cet événement ne fait *pas* de feu. + +### Notes au sujet de Windows Phone 8 + +L'émulateur signale le type de connexion comme `Cellular`, type qui ne change jamais, ainsi l'évènement n'est *pas* déclenché. + +## online + +L'évènement se déclenche lorsqu'une application se connecte, quand l'appareil est connecté à Internet. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Détails + +L'évènement `online` se déclenche lorsqu'un appareil précédemment non-connecté se connecte au réseau, permettant ainsi à l'application d'accéder à Internet. Il s'appuie sur les mêmes informations que l'API de connexion et se déclenche quand le `connection.type` passe de `NONE` à une autre valeur. + +Les applications devraient en général utiliser `document.addEventListener` pour attacher un écouteur d'évènements, une fois l'évènement `deviceready` déclenché. + +### Exemple court + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### Notes au sujet d'iOS + +Lors du démarrage initial, le déclenchement du premier évènement `online` (si applicable) prend au moins une seconde avant quoi `connection.type` vaut `UNKNOWN`. + +### Windows Phone 7 Quirks + +Lors de l'exécution dans l'émulateur, le `connection.status` est toujours inconnu, ainsi cet événement ne fait *pas* de feu. + +### Notes au sujet de Windows Phone 8 + +L'émulateur signale le type de connexion comme `Cellular` , qui ne change pas, aussi des événements ne fait *pas* de feu. \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/fr/index.md b/app/plugins/cordova-plugin-network-information/doc/fr/index.md new file mode 100644 index 0000000..e49c5d5 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/fr/index.md @@ -0,0 +1,184 @@ + + +# cordova-plugin-network-information + +Ce plugin fournit une implémentation d'une ancienne version de l' [API Information Network][1]. Il fournit des informations sur l'appareil cellulaire et connexion wifi, et si l'appareil dispose d'une connexion internet. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## Installation + + cordova plugin add cordova-plugin-network-information + + +## Plates-formes prises en charge + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Navigateur +* iOS +* Windows Phone 7 et 8 +* Paciarelli +* Windows +* Firefox OS + +# Connexion + +> L'objet `connection`, disponible via `navigator.connection`, fournit des informations sur la connection cellulaire/wifi de l'appareil. + +## Propriétés + +* connection.type + +## Constantes + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +Cette propriété offre un moyen rapide pour déterminer l'état et le type de la connexion réseau de l'appareil. + +### Petit exemple + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Changement d'API + +Jusqu'à Cordova 2.3.0, l'objet `Connection` était accessible via `navigator.network.connection` ; ceci a été changé pour `navigator.connection` afin de concorder avec la spécification du W3C. L'accès est toujours possible à l'emplacement d'origine, mais est considéré comme obsolète et sera bientôt supprimé. + +### iOS Quirks + +* iOS ne peut pas détecter le type de connexion au réseau cellulaire. + * `navigator.connection.type`a la valeur `Connection.CELL` pour toutes les données cellulaires. + +### Windows Phone Quirks + +* Lors de l'exécution dans l'émulateur, détecte toujours `navigator.connection.type` comme`Connection.UNKNOWN`. + +* Windows Phone ne peut pas détecter le type de connexion au réseau cellulaire. + + * `navigator.connection.type`a la valeur `Connection.CELL` pour toutes les données cellulaires. + +### Bizarreries de Windows + +* Lors de l'exécution dans l'émulateur de téléphone 8.1, `Connection.ETHERNET` détecte toujours `navigator.connection.type`. + +### Bizarreries de paciarelli + +* Paciarelli ne peut détecter une connexion cellulaire ou le WiFi. + * `navigator.connection.type` a la valeur `Connection.CELL_2G` pour toutes les données cellulaires. + +### Firefox OS Quirks + +* Firefox OS ne peut pas détecter le type de connexion au réseau cellulaire. + * `navigator.connection.type` a la valeur `Connection.CELL` pour toutes les données cellulaires. + +# Événements liés au réseau + +## offline + +L'évènement se déclenche lorsqu'une application se déconnecte, quand l'appareil n'est pas connecté à Internet. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Détails + +L'évènement `offline` se déclenche lorsqu'un appareil précédemment connecté perd sa connexion au réseau, empêchant ainsi l'application d'accéder à Internet. Il s'appuie sur les mêmes informations que l'API de connexion et se déclenche lorsque la valeur de `connection.type` devient`NONE`. + +Les applications doivent généralement utiliser `document.addEventListener` pour attacher un écouteur d'événements une fois le `deviceready` événement se déclenche. + +### Exemple court + + document.addEventListener (« hors ligne », onOffline, false) ; + + function onOffline() {/ / gestion de l'événement en mode hors connexion} + + +### Notes au sujet d'iOS + +Lors du démarrage initial, le déclenchement du premier évènement offline (si applicable) prend au moins une seconde. + +### Windows Phone 7 Quirks + +Lors de l'exécution dans l'émulateur, le `connection.status` est toujours inconnu, ainsi cet événement ne fait *pas* de feu. + +### Notes au sujet de Windows Phone 8 + +L'émulateur signale le type de connexion comme `Cellular`, type qui ne change jamais, ainsi l'évènement n'est *pas* déclenché. + +## online + +L'évènement se déclenche lorsqu'une application se connecte, quand l'appareil est connecté à Internet. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Détails + +L'évènement `online` se déclenche lorsqu'un appareil précédemment non-connecté se connecte au réseau, permettant ainsi à l'application d'accéder à Internet. Il s'appuie sur les mêmes informations que l'API de connexion et se déclenche quand le `connection.type` passe de `NONE` à une autre valeur. + +Les applications doivent généralement utiliser `document.addEventListener` pour attacher un écouteur d'événements une fois le `deviceready` événement se déclenche. + +### Exemple court + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### Notes au sujet d'iOS + +Lors du démarrage initial, le déclenchement du premier évènement `online` (si applicable) prend au moins une seconde avant quoi `connection.type` vaut `UNKNOWN`. + +### Windows Phone 7 Quirks + +Lors de l'exécution dans l'émulateur, le `connection.status` est toujours inconnu, ainsi cet événement ne fait *pas* de feu. + +### Notes au sujet de Windows Phone 8 + +L'émulateur signale le type de connexion comme `Cellular` , qui ne change pas, aussi des événements ne fait *pas* de feu. diff --git a/app/plugins/cordova-plugin-network-information/doc/it/README.md b/app/plugins/cordova-plugin-network-information/doc/it/README.md new file mode 100644 index 0000000..f434359 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/it/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +Questo plugin fornisce un'implementazione di una vecchia versione dell' [API di informazioni di rete](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/). Fornisce informazioni sul dispositivo cellulare e connessione wifi, e se il dispositivo dispone di una connessione internet. + +## Installazione + + cordova plugin add cordova-plugin-network-information + + +## Piattaforme supportate + + * Amazon fuoco OS + * Android + * BlackBerry 10 + * Browser + * iOS + * Windows Phone 7 e 8 + * Tizen + * Windows + * Firefox OS + +# Connessione + +> Il `connection` oggetto, esposto tramite `navigator.connection` , fornisce informazioni sulla connessione wifi e cellulare del dispositivo. + +## Proprietà + + * connection.type + +## Costanti + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +Questa proprietà offre un modo rapido per determinare stato della connessione di rete del dispositivo e il tipo di connessione. + +### Esempio rapido + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Cambiamento di API + +Fino a Cordova 2.3.0, il `Connection` oggetto era accessibile tramite `navigator.network.connection` , dopo che è stato cambiato in `navigator.connection` per abbinare la specifica W3C. È ancora disponibile nella sua posizione originale, ma è obsoleto e verrà rimosso alla fine. + +### iOS stranezze + + * iOS non è possibile rilevare il tipo di connessione di rete cellulare. + * `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare. + +### Stranezze di Windows Phone + + * Quando è in esecuzione nell'emulatore, rileva sempre `navigator.connection.type` come`Connection.UNKNOWN`. + + * Windows Phone non riesce a rilevare il tipo di connessione di rete cellulare. + + * `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare. + +### Stranezze di Windows + + * Quando è in esecuzione nell'emulatore Phone 8.1, sempre rileva `navigator.connection.type` come `Connection.ETHERNET`. + +### Tizen stranezze + + * Tizen può rilevare solo un WiFi o una connessione cellulare. + * `navigator.connection.type` è impostata su `Connection.CELL_2G` per tutti i dati cellulare. + +### Firefox OS stranezze + + * Sistema operativo Firefox non riesce a rilevare il tipo di connessione di rete cellulare. + * `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare. + +### Stranezze browser + + * Browser non è in grado di rilevare il tipo di connessione di rete. `navigator.connection.type` è sempre impostata su `Connection.UNKNOWN` quando si è online. + +# Eventi relativi alla rete + +## offline + +L'evento viene generato quando un'applicazione passa alla modalità offline, e il dispositivo non è connesso a Internet. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Dettagli + +Il `offline` evento viene generato quando un dispositivo precedentemente connesso perde una connessione di rete in modo che un'applicazione non è più possibile accedere a Internet. Esso si basa sulle stesse informazioni come l'API di connessione e viene generato quando il valore di `connection.type` diventa`NONE`. + +Applicazioni in genere è necessario utilizzare `document.addEventListener` per fissare un listener di eventi una volta il `deviceready` evento incendi. + +### Esempio rapido + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS stranezze + +Durante l'avvio iniziale, il primo evento offline (se applicabile) richiede almeno un secondo al fuoco. + +### Windows Phone 7 capricci + +Quando è in esecuzione nell'emulatore, il `connection.status` è sempre sconosciuto, così fa di questo evento *non* fuoco. + +### Windows Phone 8 stranezze + +L'emulatore riporta il tipo di connessione come `Cellular` , che non cambia, così fa l'evento *non* fuoco. + +## online + +Questo evento viene generato quando un'applicazione va online, e il dispositivo diventa collegato a Internet. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Dettagli + +Il `online` evento viene generato quando un dispositivo precedentemente scollegato riceve una connessione di rete per consentire un'accesso di applicazione a Internet. Esso si basa sulle stesse informazioni come l'API di connessione e viene attivato quando il `connection.type` cambia da `NONE` a qualsiasi altro valore. + +Applicazioni in genere è necessario utilizzare `document.addEventListener` per fissare un listener di eventi una volta il `deviceready` evento incendi. + +### Esempio rapido + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS stranezze + +Durante l'avvio iniziale, il primo `online` evento (se applicabile) richiede almeno un secondo al fuoco, prima che `connection.type` è`UNKNOWN`. + +### Windows Phone 7 capricci + +Quando è in esecuzione nell'emulatore, il `connection.status` è sempre sconosciuto, così fa di questo evento *non* fuoco. + +### Windows Phone 8 stranezze + +L'emulatore riporta il tipo di connessione come `Cellular` , che non cambia, quindi, non gli eventi *non* a fuoco. \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/it/index.md b/app/plugins/cordova-plugin-network-information/doc/it/index.md new file mode 100644 index 0000000..e191719 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/it/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +Questo plugin fornisce un'implementazione di una vecchia versione dell' [API di informazioni di rete][1]. Fornisce informazioni sul dispositivo cellulare e connessione wifi, e se il dispositivo dispone di una connessione internet. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## Installazione + + cordova plugin add cordova-plugin-network-information + + +## Piattaforme supportate + +* Amazon fuoco OS +* Android +* BlackBerry 10 +* Browser +* iOS +* Windows Phone 7 e 8 +* Tizen +* Windows +* Firefox OS + +# Connessione + +> Il `connection` oggetto, esposto tramite `navigator.connection` , fornisce informazioni sulla connessione wifi e cellulare del dispositivo. + +## Proprietà + +* connection.type + +## Costanti + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +Questa proprietà offre un modo rapido per determinare stato della connessione di rete del dispositivo e il tipo di connessione. + +### Esempio rapido + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Cambiamento di API + +Fino a Cordova 2.3.0, il `Connection` oggetto era accessibile tramite `navigator.network.connection` , dopo che è stato cambiato in `navigator.connection` per abbinare la specifica W3C. È ancora disponibile nella sua posizione originale, ma è obsoleto e verrà rimosso alla fine. + +### iOS stranezze + +* iOS non è possibile rilevare il tipo di connessione di rete cellulare. + * `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare. + +### Stranezze di Windows Phone + +* Quando è in esecuzione nell'emulatore, rileva sempre `navigator.connection.type` come`Connection.UNKNOWN`. + +* Windows Phone non riesce a rilevare il tipo di connessione di rete cellulare. + + * `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare. + +### Stranezze di Windows + +* Quando è in esecuzione nell'emulatore Phone 8.1, sempre rileva `navigator.connection.type` come `Connection.ETHERNET`. + +### Tizen stranezze + +* Tizen può rilevare solo un WiFi o una connessione cellulare. + * `navigator.connection.type` è impostata su `Connection.CELL_2G` per tutti i dati cellulare. + +### Firefox OS stranezze + +* Sistema operativo Firefox non riesce a rilevare il tipo di connessione di rete cellulare. + * `navigator.connection.type`è impostata su `Connection.CELL` per tutti i dati cellulare. + +# Eventi relativi alla rete + +## offline + +L'evento viene generato quando un'applicazione passa alla modalità offline, e il dispositivo non è connesso a Internet. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Dettagli + +Il `offline` evento viene generato quando un dispositivo precedentemente connesso perde una connessione di rete in modo che un'applicazione non è più possibile accedere a Internet. Esso si basa sulle stesse informazioni come l'API di connessione e viene generato quando il valore di `connection.type` diventa`NONE`. + +Applicazioni in genere è necessario utilizzare `document.addEventListener` per fissare un listener di eventi una volta il `deviceready` evento incendi. + +### Esempio rapido + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS stranezze + +Durante l'avvio iniziale, il primo evento offline (se applicabile) richiede almeno un secondo al fuoco. + +### Windows Phone 7 capricci + +Quando è in esecuzione nell'emulatore, il `connection.status` è sempre sconosciuto, così fa di questo evento *non* fuoco. + +### Windows Phone 8 stranezze + +L'emulatore riporta il tipo di connessione come `Cellular` , che non cambia, così fa l'evento *non* fuoco. + +## online + +Questo evento viene generato quando un'applicazione va online, e il dispositivo diventa collegato a Internet. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Dettagli + +Il `online` evento viene generato quando un dispositivo precedentemente scollegato riceve una connessione di rete per consentire un'accesso di applicazione a Internet. Esso si basa sulle stesse informazioni come l'API di connessione e viene attivato quando il `connection.type` cambia da `NONE` a qualsiasi altro valore. + +Applicazioni in genere è necessario utilizzare `document.addEventListener` per fissare un listener di eventi una volta il `deviceready` evento incendi. + +### Esempio rapido + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS stranezze + +Durante l'avvio iniziale, il primo `online` evento (se applicabile) richiede almeno un secondo al fuoco, prima che `connection.type` è`UNKNOWN`. + +### Windows Phone 7 capricci + +Quando è in esecuzione nell'emulatore, il `connection.status` è sempre sconosciuto, così fa di questo evento *non* fuoco. + +### Windows Phone 8 stranezze + +L'emulatore riporta il tipo di connessione come `Cellular` , che non cambia, quindi, non gli eventi *non* a fuoco. diff --git a/app/plugins/cordova-plugin-network-information/doc/ja/README.md b/app/plugins/cordova-plugin-network-information/doc/ja/README.md new file mode 100644 index 0000000..797b741 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/ja/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +このプラグインは、古いバージョンの[ネットワーク情報 API](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/)の実装を提供します。 デバイスの携帯電話や wifi 接続に関する情報を提供し、かどうか、デバイスがインターネットに接続します。 + +## インストール + + cordova plugin add cordova-plugin-network-information + + +## サポートされているプラットフォーム + + * アマゾン火 OS + * アンドロイド + * ブラックベリー 10 + * ブラウザー + * iOS + * Windows Phone 7 と 8 + * Tizen + * Windows + * Firefox の OS + +# Connection + +> `connection`オブジェクトによって公開されて `navigator.connection` 、デバイスの携帯電話や wifi 接続に関する情報を提供します。 + +## プロパティ + + * connection.type + +## 定数 + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +このプロパティはデバイスのネットワーク接続状態を確認する速い方法を提供し、接続の種類。 + +### 簡単な例 + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API の変更 + +コルドバ 2.3.0、まで、 `Connection` 経由でアクセスされたオブジェクトが `navigator.network.connection` 、それに変更されましたが後 `navigator.connection` W3C の仕様に一致します。 それはまだ元の場所は廃止され、最終的に削除されます。 + +### iOS の癖 + + * iOS は、携帯電話のネットワーク接続の種類を検出できません。 + * `navigator.connection.type`設定する `Connection.CELL` すべての携帯電話データの。 + +### Windows Phone の癖 + + * エミュレーターで実行しているときを常に検出 `navigator.connection.type` として`Connection.UNKNOWN`. + + * Windows Phone 携帯電話ネットワーク接続の種類を検出できません。 + + * `navigator.connection.type`設定する `Connection.CELL` すべての携帯電話データの。 + +### Windows の癖 + + * 電話 8.1 エミュレーターで実行する場合は、常に `Connection.ETHERNET` として `navigator.connection.type` を検出します. + +### Tizen の癖 + + * Tizen には、WiFi または携帯電話の接続だけを検出できます。 + * `navigator.connection.type` は、すべての携帯電話のデータを `Connection.CELL_2G` に設定されます。 + +### Firefox OS 癖 + + * Firefox の OS は、携帯電話のネットワーク接続の種類を検出できません。 + * `navigator.connection.type`設定する `Connection.CELL` すべての携帯電話データの。 + +### ブラウザーの癖 + + * ブラウザーは、ネットワーク接続の種類を検出できません。 `navigator.connection.type`は、 `Connection.UNKNOWN`オンライン時に常に設定されます。 + +# ネットワーク関連のイベント + +## offline + +アプリケーションがオフラインになり、デバイスがインターネットに接続されていないときに発生します。 + + document.addEventListener("offline", yourCallbackFunction, false); + + +### 詳細 + +`offline`アプリケーションはもはや、インターネットにアクセスできるように、以前接続されたデバイスは、ネットワーク接続が失われたときに発生します。 接続 API と同じ情報に依存しており、火災時の値 `connection.type` になります。`NONE`. + +通常アプリケーションに使用する必要があります `document.addEventListener` 一度のイベント リスナーをアタッチし、 `deviceready` イベントが発生します。 + +### 簡単な例 + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS の癖 + +初回起動時 (当てはまる場合) の最初のオフライン イベントは火に 1 秒以上かかります。 + +### Windows Phone 7 の癖 + +エミュレーターで実行しているとき、 `connection.status` は常に知られている、このイベントは*ない*火。 + +### Windows Phone 8 癖 + +エミュレーターと接続の種類のレポート `Cellular` は変化しません、イベントは*ない*火。 + +## online + +アプリケーションは、オンラインになるし、デバイスがインターネットに接続するときに発生します。 + + document.addEventListener("online", yourCallbackFunction, false); + + +### 詳細 + +`online`以前接続されていないデバイスが、インターネットへのアプリケーション アクセスを許可するネットワーク接続を受信するときに発生します。 接続 API と同じ情報に依存しており、場合に適用されます、 `connection.type` から変更 `NONE` 以外の値にします。 + +通常アプリケーションに使用する必要があります `document.addEventListener` 一度のイベント リスナーをアタッチし、 `deviceready` イベントが発生します。 + +### 簡単な例 + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS の癖 + +初回起動時には、最初の `online` (当てはまる場合) イベントが少なくとも火を前に第 2 `connection.type` は`UNKNOWN`. + +### Windows Phone 7 の癖 + +エミュレーターで実行しているとき、 `connection.status` は常に知られている、このイベントは*ない*火。 + +### Windows Phone 8 癖 + +エミュレーターと接続の種類のレポート `Cellular` は変化しません、イベントは*ない*火。 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/ja/index.md b/app/plugins/cordova-plugin-network-information/doc/ja/index.md new file mode 100644 index 0000000..71b6f82 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/ja/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +このプラグインは、古いバージョンの[ネットワーク情報 API][1]の実装を提供します。 デバイスの携帯電話や wifi 接続に関する情報を提供し、かどうか、デバイスがインターネットに接続します。 + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## インストール + + cordova plugin add cordova-plugin-network-information + + +## サポートされているプラットフォーム + +* アマゾン火 OS +* アンドロイド +* ブラックベリー 10 +* ブラウザー +* iOS +* Windows Phone 7 と 8 +* Tizen +* Windows +* Firefox の OS + +# Connection + +> `connection`オブジェクトによって公開されて `navigator.connection` 、デバイスの携帯電話や wifi 接続に関する情報を提供します。 + +## プロパティ + +* connection.type + +## 定数 + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +このプロパティはデバイスのネットワーク接続状態を確認する速い方法を提供し、接続の種類。 + +### 簡単な例 + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API の変更 + +コルドバ 2.3.0、まで、 `Connection` 経由でアクセスされたオブジェクトが `navigator.network.connection` 、それに変更されましたが後 `navigator.connection` W3C の仕様に一致します。 それはまだ元の場所は廃止され、最終的に削除されます。 + +### iOS の癖 + +* iOS は、携帯電話のネットワーク接続の種類を検出できません。 + * `navigator.connection.type`設定する `Connection.CELL` すべての携帯電話データの。 + +### Windows Phone の癖 + +* エミュレーターで実行しているときを常に検出 `navigator.connection.type` として`Connection.UNKNOWN`. + +* Windows Phone 携帯電話ネットワーク接続の種類を検出できません。 + + * `navigator.connection.type`設定する `Connection.CELL` すべての携帯電話データの。 + +### Windows の癖 + +* 電話 8.1 エミュレーターで実行する場合は、常に `Connection.ETHERNET` として `navigator.connection.type` を検出します. + +### Tizen の癖 + +* Tizen には、WiFi または携帯電話の接続だけを検出できます。 + * `navigator.connection.type` は、すべての携帯電話のデータを `Connection.CELL_2G` に設定されます。 + +### Firefox OS 癖 + +* Firefox の OS は、携帯電話のネットワーク接続の種類を検出できません。 + * `navigator.connection.type`設定する `Connection.CELL` すべての携帯電話データの。 + +# ネットワーク関連のイベント + +## offline + +アプリケーションがオフラインになり、デバイスがインターネットに接続されていないときに発生します。 + + document.addEventListener("offline", yourCallbackFunction, false); + + +### 詳細 + +`offline`アプリケーションはもはや、インターネットにアクセスできるように、以前接続されたデバイスは、ネットワーク接続が失われたときに発生します。 接続 API と同じ情報に依存しており、火災時の値 `connection.type` になります。`NONE`. + +通常アプリケーションに使用する必要があります `document.addEventListener` 一度のイベント リスナーをアタッチし、 `deviceready` イベントが発生します。 + +### 簡単な例 + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS の癖 + +初回起動時 (当てはまる場合) の最初のオフライン イベントは火に 1 秒以上かかります。 + +### Windows Phone 7 の癖 + +エミュレーターで実行しているとき、 `connection.status` は常に知られている、このイベントは*ない*火。 + +### Windows Phone 8 癖 + +エミュレーターと接続の種類のレポート `Cellular` は変化しません、イベントは*ない*火。 + +## online + +アプリケーションは、オンラインになるし、デバイスがインターネットに接続するときに発生します。 + + document.addEventListener("online", yourCallbackFunction, false); + + +### 詳細 + +`online`以前接続されていないデバイスが、インターネットへのアプリケーション アクセスを許可するネットワーク接続を受信するときに発生します。 接続 API と同じ情報に依存しており、場合に適用されます、 `connection.type` から変更 `NONE` 以外の値にします。 + +通常アプリケーションに使用する必要があります `document.addEventListener` 一度のイベント リスナーをアタッチし、 `deviceready` イベントが発生します。 + +### 簡単な例 + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS の癖 + +初回起動時には、最初の `online` (当てはまる場合) イベントが少なくとも火を前に第 2 `connection.type` は`UNKNOWN`. + +### Windows Phone 7 の癖 + +エミュレーターで実行しているとき、 `connection.status` は常に知られている、このイベントは*ない*火。 + +### Windows Phone 8 癖 + +エミュレーターと接続の種類のレポート `Cellular` は変化しません、イベントは*ない*火。 diff --git a/app/plugins/cordova-plugin-network-information/doc/ko/README.md b/app/plugins/cordova-plugin-network-information/doc/ko/README.md new file mode 100644 index 0000000..a667539 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/ko/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +이 플러그인 [네트워크 정보 API](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/)의 이전 버전에 대 한 구현을 제공합니다. 소자의 셀룰러와 와이파이 연결에 대 한 정보를 제공 합니다 장치는 인터넷 연결에 있는지 여부. + +## 설치 + + cordova plugin add cordova-plugin-network-information + + +## 지원 되는 플랫폼 + + * 아마존 화재 운영 체제 + * 안 드 로이드 + * 블랙베리 10 + * 브라우저 + * iOS + * Windows Phone 7과 8 + * Tizen + * 윈도우 + * Firefox 운영 체제 + +# 연결 + +> `connection`개체를 통해 노출 `navigator.connection` , 소자의 셀룰러와 와이파이 연결에 대 한 정보를 제공 합니다. + +## 속성 + + * connection.type + +## 상수 + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +이 디바이스의 네트워크 연결 상태를 확인 하는 빠른 방법을 제공 합니다 및 연결의 종류. + +### 빠른 예제 + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API 변경 + +코르 도우 바 2.3.0까지 `Connection` 개체를 통해 액세스 했습니다 `navigator.network.connection` , 후에 변경 된 `navigator.connection` W3C 사양에 맞게. 그것은 그것의 원래 위치에 계속 사용할 수 하지만 사용 되지 않습니다 및 결국 제거 될 것 이다. + +### iOS 단점 + + * iOS는 셀룰러 네트워크 연결의 종류를 감지할 수 없습니다. + * `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한. + +### Windows Phone 단점 + + * 에뮬레이터에서 실행할 때 항상 검색 `navigator.connection.type` 으로`Connection.UNKNOWN`. + + * Windows Phone 셀룰러 네트워크 연결 유형을 검색할 수 없습니다. + + * `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한. + +### 윈도우 특수 + + * 전화 8.1 에뮬레이터에서 실행 하는 경우 항상 `Connection.ETHERNET`로 `navigator.connection.type`를 감지합니다. + +### Tizen 특수 + + * Tizen은 와이파이 또는 휴대 전화 연결에만 검색할 수 있습니다. + * `navigator.connection.type`는 모든 셀룰러 데이터에 대 한 `Connection.CELL_2G`로 설정 됩니다. + +### 파이어 폭스 OS 단점 + + * 파이어 폭스 OS 셀룰러 네트워크 연결 유형을 검색할 수 없습니다. + * `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한. + +### 브라우저 만지면 + + * 브라우저는 네트워크 연결의 종류를 검색할 수 없습니다. `navigator.connection.type` `Connection.UNKNOWN` 때 온라인으로 항상 설정 됩니다. + +# 네트워크 관련 이벤트 + +## offline + +이벤트가 발생 하면 응용 프로그램 오프 라인, 이동 및 장치가 인터넷에 연결 되어 있지. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### 세부 정보 + +`offline`이벤트가 발생 하면 응용 프로그램이 더 이상 인터넷에 액세스할 수 있도록 이전 연결 된 장치가 네트워크 연결 손실. 그것은 연결 API와 동일한 정보에 의존 하 고 경우의 값 `connection.type` 된다`NONE`. + +일반적으로 응용 프로그램을 사용 해야 합니다 `document.addEventListener` 한번 이벤트 리스너를 연결 하는 `deviceready` 이벤트가 발생 합니다. + +### 빠른 예제 + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS 단점 + +처음 시작 하는 동안 첫 번째 오프 라인 이벤트 (있는 경우)를 적어도 초를 걸립니다. + +### Windows Phone 7 단점 + +에뮬레이터에서 실행 하는 경우는 `connection.status` 항상 불명 하다, 그래서이 이벤트는 *없는* 불. + +### Windows Phone 8 단점 + +에뮬레이터도 연결 형식을 보고 `Cellular` 는 변경 되지 않습니다, 그래서 이벤트 않습니다 *하지* 불. + +## online + +응용 프로그램은 온라인 및 장치가 인터넷에 연결 된다 때이 이벤트가 발생 합니다. + + document.addEventListener("online", yourCallbackFunction, false); + + +### 세부 정보 + +`online`이전 연결 되지 않은 장치는 인터넷에 대 한 응용 프로그램 액세스를 허용 하도록 네트워크 연결을 받을 때 이벤트가 발생 합니다. 그것은 연결 API와 동일한 정보에 의존 하 고 경우에 `connection.type` 에서 변경 `NONE` 다른 값으로. + +일반적으로 응용 프로그램을 사용 해야 합니다 `document.addEventListener` 한번 이벤트 리스너를 연결 하는 `deviceready` 이벤트가 발생 합니다. + +### 빠른 예제 + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS 단점 + +처음 시작 하는 동안 첫 번째 `online` 이벤트 (있는 경우) 이전에 불 초 걸립니다 이상 `connection.type` 입니다`UNKNOWN`. + +### Windows Phone 7 단점 + +에뮬레이터에서 실행 하는 경우는 `connection.status` 항상 불명 하다, 그래서이 이벤트는 *없는* 불. + +### Windows Phone 8 단점 + +에뮬레이터도 연결 형식을 보고 `Cellular` 는 변경 되지 않습니다, 그래서 이벤트 않습니다 *하지* 불. \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/ko/index.md b/app/plugins/cordova-plugin-network-information/doc/ko/index.md new file mode 100644 index 0000000..cb4c727 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/ko/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +이 플러그인 [네트워크 정보 API][1]의 이전 버전에 대 한 구현을 제공합니다. 소자의 셀룰러와 와이파이 연결에 대 한 정보를 제공 합니다 장치는 인터넷 연결에 있는지 여부. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## 설치 + + cordova plugin add cordova-plugin-network-information + + +## 지원 되는 플랫폼 + +* 아마존 화재 운영 체제 +* 안 드 로이드 +* 블랙베리 10 +* 브라우저 +* iOS +* Windows Phone 7과 8 +* Tizen +* 윈도우 +* Firefox 운영 체제 + +# 연결 + +> `connection`개체를 통해 노출 `navigator.connection` , 소자의 셀룰러와 와이파이 연결에 대 한 정보를 제공 합니다. + +## 속성 + +* connection.type + +## 상수 + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +이 디바이스의 네트워크 연결 상태를 확인 하는 빠른 방법을 제공 합니다 및 연결의 종류. + +### 빠른 예제 + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API 변경 + +코르 도우 바 2.3.0까지 `Connection` 개체를 통해 액세스 했습니다 `navigator.network.connection` , 후에 변경 된 `navigator.connection` W3C 사양에 맞게. 그것은 그것의 원래 위치에 계속 사용할 수 하지만 사용 되지 않습니다 및 결국 제거 될 것 이다. + +### iOS 단점 + +* iOS는 셀룰러 네트워크 연결의 종류를 감지할 수 없습니다. + * `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한. + +### Windows Phone 단점 + +* 에뮬레이터에서 실행할 때 항상 검색 `navigator.connection.type` 으로`Connection.UNKNOWN`. + +* Windows Phone 셀룰러 네트워크 연결 유형을 검색할 수 없습니다. + + * `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한. + +### 윈도우 특수 + +* 전화 8.1 에뮬레이터에서 실행 하는 경우 항상 `Connection.ETHERNET`로 `navigator.connection.type`를 감지합니다. + +### Tizen 특수 + +* Tizen은 와이파이 또는 휴대 전화 연결에만 검색할 수 있습니다. + * `navigator.connection.type`는 모든 셀룰러 데이터에 대 한 `Connection.CELL_2G`로 설정 됩니다. + +### 파이어 폭스 OS 단점 + +* 파이어 폭스 OS 셀룰러 네트워크 연결 유형을 검색할 수 없습니다. + * `navigator.connection.type`로 설정 된 `Connection.CELL` 모든 셀룰러 데이터에 대 한. + +# 네트워크 관련 이벤트 + +## offline + +이벤트가 발생 하면 응용 프로그램 오프 라인, 이동 및 장치가 인터넷에 연결 되어 있지. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### 세부 정보 + +`offline`이벤트가 발생 하면 응용 프로그램이 더 이상 인터넷에 액세스할 수 있도록 이전 연결 된 장치가 네트워크 연결 손실. 그것은 연결 API와 동일한 정보에 의존 하 고 경우의 값 `connection.type` 된다`NONE`. + +일반적으로 응용 프로그램을 사용 해야 합니다 `document.addEventListener` 한번 이벤트 리스너를 연결 하는 `deviceready` 이벤트가 발생 합니다. + +### 빠른 예제 + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS 단점 + +처음 시작 하는 동안 첫 번째 오프 라인 이벤트 (있는 경우)를 적어도 초를 걸립니다. + +### Windows Phone 7 단점 + +에뮬레이터에서 실행 하는 경우는 `connection.status` 항상 불명 하다, 그래서이 이벤트는 *없는* 불. + +### Windows Phone 8 단점 + +에뮬레이터도 연결 형식을 보고 `Cellular` 는 변경 되지 않습니다, 그래서 이벤트 않습니다 *하지* 불. + +## online + +응용 프로그램은 온라인 및 장치가 인터넷에 연결 된다 때이 이벤트가 발생 합니다. + + document.addEventListener("online", yourCallbackFunction, false); + + +### 세부 정보 + +`online`이전 연결 되지 않은 장치는 인터넷에 대 한 응용 프로그램 액세스를 허용 하도록 네트워크 연결을 받을 때 이벤트가 발생 합니다. 그것은 연결 API와 동일한 정보에 의존 하 고 경우에 `connection.type` 에서 변경 `NONE` 다른 값으로. + +일반적으로 응용 프로그램을 사용 해야 합니다 `document.addEventListener` 한번 이벤트 리스너를 연결 하는 `deviceready` 이벤트가 발생 합니다. + +### 빠른 예제 + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS 단점 + +처음 시작 하는 동안 첫 번째 `online` 이벤트 (있는 경우) 이전에 불 초 걸립니다 이상 `connection.type` 입니다`UNKNOWN`. + +### Windows Phone 7 단점 + +에뮬레이터에서 실행 하는 경우는 `connection.status` 항상 불명 하다, 그래서이 이벤트는 *없는* 불. + +### Windows Phone 8 단점 + +에뮬레이터도 연결 형식을 보고 `Cellular` 는 변경 되지 않습니다, 그래서 이벤트 않습니다 *하지* 불. diff --git a/app/plugins/cordova-plugin-network-information/doc/pl/README.md b/app/plugins/cordova-plugin-network-information/doc/pl/README.md new file mode 100644 index 0000000..4b66cbb --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/pl/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +Wtyczka stanowi implementację starą wersję [API informacji w sieci](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/). Udostępnia informacje na temat urządzenia komórkowe i wifi połączenie, i czy urządzenie ma połączenie z Internetem. + +## Instalacja + + cordova plugin add cordova-plugin-network-information + + +## Obsługiwane platformy + + * Amazon Fire OS + * Android + * BlackBerry 10 + * Przeglądarka + * iOS + * Windows Phone 7 i 8 + * Tizen + * Windows + * Firefox OS + +# Połączenie + +> `connection`Obiektu, wystawiony przez `navigator.connection` , zawiera informacje o połączeniu urządzenia komórkowe i wifi. + +## Właściwości + + * Connection.Type + +## Stałe + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## Connection.Type + +Oferuje szybki sposób ustalić stan połączenia sieciowego urządzenia i typ połączenia. + +### Szybki przykład + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Zmiana interfejsu API + +Do Cordova 2.3.0 `Connection` obiekt uzyskano za pośrednictwem `navigator.network.connection` , po którym został zmieniony na `navigator.connection` odpowiadać specyfikacji W3C. To jest nadal dostępne w jego oryginalnej lokalizacji, ale jest niezalecane i zostaną ostatecznie usunięte. + +### Dziwactwa iOS + + * iOS nie może wykryć typ połączenia w sieci komórkowej. + * `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych. + +### Windows Phone dziwactwa + + * Po uruchomieniu w emulatorze, zawsze wykrywa `navigator.connection.type` jako`Connection.UNKNOWN`. + + * Windows Phone nie może wykryć typ połączenia w sieci komórkowej. + + * `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych. + +### Windows dziwactwa + + * Po uruchomieniu w emulatorze telefonu 8.1, zawsze wykrywa `navigator.connection.type` jako `Connection.ETHERNET`. + +### Dziwactwa Tizen + + * Tizen można tylko dostrzegać Wi-Fi lub połączenia komórkowe. + * `Navigator.Connection.Type` jest zestaw do `Connection.CELL_2G` dla wszystkich komórek danych. + +### Firefox OS dziwactwa + + * Firefox OS nie można wykryć typ połączenia w sieci komórkowej. + * `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych. + +### Quirks przeglądarki + + * Przeglądarka nie może wykryć typ połączenia sieciowego. `Navigator.Connection.Type` jest zawsze zestaw do `Connection.UNKNOWN` podczas online. + +# Zdarzenia związane z sieci + +## offline + +Zdarzenie odpala gdy aplikacja przejdzie do trybu offline, a urządzenie nie jest podłączone do Internetu. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Szczegóły + +`offline`Zdarzenie fires po wcześniej podłączone urządzenie traci połączenia z siecią, dzięki czemu aplikacja może już dostęp do Internetu. Opiera się na te same informacje połączenia API i gdy odpalam wartość `connection.type` staje się`NONE`. + +Aplikacje zwykle należy użyć `document.addEventListener` Aby dołączyć słuchacza raz `deviceready` pożary zdarzenia. + +### Szybki przykład + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### Dziwactwa iOS + +Podczas uruchamiania systemu pierwsza impreza offline (jeśli dotyczy) trwa co najmniej drugi ognia. + +### Dziwactwa Windows Phone 7 + +Po uruchomieniu w emulatorze, `connection.status` zawsze jest nieznana, więc to wydarzenie *nie* ogień. + +### Windows Phone 8 dziwactwa + +Emulator raporty typ połączenia, jako `Cellular` , co nie zmienia, więc zdarzenie *nie* ogień. + +## online + +Wydarzenie to odpala gdy aplikacja przechodzi w tryb online i urządzenie staje się połączenie z Internetem. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Szczegóły + +`online`Zdarzenie odpala gdy wcześniej niezwiązane urządzenie odbiera połączenie sieciowe, aby umożliwić aplikacji dostęp do Internetu. Opiera się na te same informacje połączenia API i gdy odpalam `connection.type` zmienia się z `NONE` na inną wartość. + +Aplikacje zwykle należy użyć `document.addEventListener` Aby dołączyć słuchacza raz `deviceready` pożary zdarzenia. + +### Szybki przykład + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### Dziwactwa iOS + +Podczas uruchamiania systemu pierwszy `online` zdarzenia (w stosownych przypadkach) zajmuje co najmniej drugie ognia, przed którym `connection.type` jest`UNKNOWN`. + +### Dziwactwa Windows Phone 7 + +Po uruchomieniu w emulatorze, `connection.status` zawsze jest nieznana, więc to wydarzenie *nie* ogień. + +### Windows Phone 8 dziwactwa + +Emulator sprawozdania jako typ połączenia `Cellular` , które nie zmienia, więc wydarzenia czy *nie* ogień. \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/pl/index.md b/app/plugins/cordova-plugin-network-information/doc/pl/index.md new file mode 100644 index 0000000..a42b973 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/pl/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +Wtyczka stanowi implementację starą wersję [API informacji w sieci][1]. Udostępnia informacje na temat urządzenia komórkowe i wifi połączenie, i czy urządzenie ma połączenie z Internetem. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## Instalacja + + cordova plugin add cordova-plugin-network-information + + +## Obsługiwane platformy + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Przeglądarka +* iOS +* Windows Phone 7 i 8 +* Tizen +* Windows +* Firefox OS + +# Połączenie + +> `connection`Obiektu, wystawiony przez `navigator.connection` , zawiera informacje o połączeniu urządzenia komórkowe i wifi. + +## Właściwości + +* Connection.Type + +## Stałe + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## Connection.Type + +Oferuje szybki sposób ustalić stan połączenia sieciowego urządzenia i typ połączenia. + +### Szybki przykład + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Zmiana interfejsu API + +Do Cordova 2.3.0 `Connection` obiekt uzyskano za pośrednictwem `navigator.network.connection` , po którym został zmieniony na `navigator.connection` odpowiadać specyfikacji W3C. To jest nadal dostępne w jego oryginalnej lokalizacji, ale jest niezalecane i zostaną ostatecznie usunięte. + +### Dziwactwa iOS + +* iOS nie może wykryć typ połączenia w sieci komórkowej. + * `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych. + +### Windows Phone dziwactwa + +* Po uruchomieniu w emulatorze, zawsze wykrywa `navigator.connection.type` jako`Connection.UNKNOWN`. + +* Windows Phone nie może wykryć typ połączenia w sieci komórkowej. + + * `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych. + +### Windows dziwactwa + +* Po uruchomieniu w emulatorze telefonu 8.1, zawsze wykrywa `navigator.connection.type` jako `Connection.ETHERNET`. + +### Dziwactwa Tizen + +* Tizen można tylko dostrzegać Wi-Fi lub połączenia komórkowe. + * `Navigator.Connection.Type` jest zestaw do `Connection.CELL_2G` dla wszystkich komórek danych. + +### Firefox OS dziwactwa + +* Firefox OS nie można wykryć typ połączenia w sieci komórkowej. + * `navigator.connection.type`jest zestaw `Connection.CELL` dla wszystkich komórek danych. + +# Zdarzenia związane z sieci + +## offline + +Zdarzenie odpala gdy aplikacja przejdzie do trybu offline, a urządzenie nie jest podłączone do Internetu. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Szczegóły + +`offline`Zdarzenie fires po wcześniej podłączone urządzenie traci połączenia z siecią, dzięki czemu aplikacja może już dostęp do Internetu. Opiera się na te same informacje połączenia API i gdy odpalam wartość `connection.type` staje się`NONE`. + +Aplikacje zwykle należy użyć `document.addEventListener` Aby dołączyć słuchacza raz `deviceready` pożary zdarzenia. + +### Szybki przykład + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### Dziwactwa iOS + +Podczas uruchamiania systemu pierwsza impreza offline (jeśli dotyczy) trwa co najmniej drugi ognia. + +### Dziwactwa Windows Phone 7 + +Po uruchomieniu w emulatorze, `connection.status` zawsze jest nieznana, więc to wydarzenie *nie* ogień. + +### Windows Phone 8 dziwactwa + +Emulator raporty typ połączenia, jako `Cellular` , co nie zmienia, więc zdarzenie *nie* ogień. + +## online + +Wydarzenie to odpala gdy aplikacja przechodzi w tryb online i urządzenie staje się połączenie z Internetem. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Szczegóły + +`online`Zdarzenie odpala gdy wcześniej niezwiązane urządzenie odbiera połączenie sieciowe, aby umożliwić aplikacji dostęp do Internetu. Opiera się na te same informacje połączenia API i gdy odpalam `connection.type` zmienia się z `NONE` na inną wartość. + +Aplikacje zwykle należy użyć `document.addEventListener` Aby dołączyć słuchacza raz `deviceready` pożary zdarzenia. + +### Szybki przykład + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### Dziwactwa iOS + +Podczas uruchamiania systemu pierwszy `online` zdarzenia (w stosownych przypadkach) zajmuje co najmniej drugie ognia, przed którym `connection.type` jest`UNKNOWN`. + +### Dziwactwa Windows Phone 7 + +Po uruchomieniu w emulatorze, `connection.status` zawsze jest nieznana, więc to wydarzenie *nie* ogień. + +### Windows Phone 8 dziwactwa + +Emulator sprawozdania jako typ połączenia `Cellular` , które nie zmienia, więc wydarzenia czy *nie* ogień. diff --git a/app/plugins/cordova-plugin-network-information/doc/ru/index.md b/app/plugins/cordova-plugin-network-information/doc/ru/index.md new file mode 100644 index 0000000..481c1b1 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/ru/index.md @@ -0,0 +1,182 @@ + + +# cordova-plugin-network-information + +Этот плагин обеспечивает реализацию старой версии [API Сетевой информации][1]. Он предоставляет информацию о сотовых и Wi-Fi подключениях устройства, и информацию имеет ли устройство подключение к Интернету. + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## Установка + + cordova plugin add cordova-plugin-network-information + + +## Поддерживаемые платформы + +* Amazon Fire OS +* Android +* BlackBerry 10 +* Браузер +* iOS +* Windows Phone 7 и 8 +* Tizen +* Windows 8 +* Firefox OS + +# Connection + +> Объект `connection`, доступный через `navigator.connection`, предоставляет информацию о сотовых и wifi подключениях устройства. + +## Свойства + +* connection.type + +## Константы + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +Это свойство предоставляет быстрый способ для определения состояния подключения устройства к сети и тип этого подключения. + +### Краткий пример + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### Изменения в API + +До Cordova 2.3.0 объект `Connection` был доступен через `navigator.network.connection`, после чего это свойство было изменено на `navigator.connection` в соответствии со спецификацией консорциума W3C. Он все еще доступен в его исходном расположении, но это расположение является устаревшим и в конечном итоге будет удалено. + +### Особенности iOS + +* iOS не может определить тип подключения к сотовой сети. + * `navigator.connection.type` имеет значение `Connection.CELL` для всех сотовых данных. + +### Особенности Windows Phone + +* Когда работает в эмуляторе, тип подключения всегда определяется `navigator.connection.type` как `Connection.UNKNOWN`. + +* Windows Phone не может определить тип подключения к сотовой сети. + + * `navigator.connection.type` имеет значение `Connection.CELL` для всех сотовых данных. + +### Особенности Tizen + +* Tizen может обнаружить только соединения Wi-Fi или наличие сотовой связи. + * `navigator.connection.type` имеет значение `Connection.CELL_2G` для всех сотовых данных. + +### Особенности Firefox OS + +* Firefox OS не может определить тип подключения к сотовой сети. + * `navigator.connection.type` имеет значение `Connection.CELL` для всех сотовых данных. + +# События, связанные с сетью + +## offline + +Событие возникает, когда приложение переходит в автономный режим, и устройство не подключено к сети Интернет. + + document.addEventListener("offline", yourCallbackFunction, false); + + +### Подробности + +Событие `offline` возникает, когда ранее подключенное устройство теряет подключение к сети, так что приложение больше не может получить доступ к Интернет. Он опирается на ту же информацию, что и Connection API и срабатывает, когда значение `connection.type` становится равным `NONE`. + +Приложения обычно должно использовать `window.addEventListener` чтобы добавить обработчик события после того как произойдет событие `deviceready`. + +### Краткий пример + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### Особенности iOS + +Во время первоначального запуска первому событию offline (если применимо) требуется по крайней мере секунду на срабатывание. + +### Особенности Windows Phone 7 + +Когда работает в эмуляторе, `connection.status` всегда неизвестен, так что это событие *не* срабатывает. + +### Особенности Windows Phone 8 + +Эмулятор сообщает тип подключения как `Cellular` , которое не меняется, поэтому событие не *не* срабатывает. + +## online + +Это событие возникает, когда приложение выходит в онлайн, и устройство подключается к Интернету. + + document.addEventListener("online", yourCallbackFunction, false); + + +### Подробности + +Событие `online` возникает, когда ранее не подключенное к сети устройство получает сетевое подключение, разрешающее приложению доступ к Интернету. Оно опирается на ту же информацию, Connection API и вызывается когда `connection.type` меняется с `NONE` в любое другое значение. + +Приложения обычно должны использовать `window.addEventListener` чтобы добавить обработчик события после того как произойдет событие `deviceready`. + +### Краткий пример + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### Особенности iOS + +Во время первоначального запуска первое событие `online` (если применимо) занимает по меньшей мере секунду на срабатывание, до этого момента `connection.type` является равным `UNKNOWN`. + +### Особенности Windows Phone 7 + +Когда работает в эмуляторе, `connection.status` всегда неизвестен, так что это событие *не* срабатывает. + +### Особенности Windows Phone 8 + +Эмулятор сообщает тип подключения как `Cellular` , которое не меняется, поэтому событие не *не* срабатывает. diff --git a/app/plugins/cordova-plugin-network-information/doc/zh/README.md b/app/plugins/cordova-plugin-network-information/doc/zh/README.md new file mode 100644 index 0000000..09e11e7 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/zh/README.md @@ -0,0 +1,190 @@ + + +# cordova-plugin-network-information + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-network-information.svg)](https://travis-ci.org/apache/cordova-plugin-network-information) + +這個外掛程式提供的舊版本的[網路資訊 API](http://www.w3.org/TR/2011/WD-netinfo-api-20110607/)實現的。 它提供了有關該設備的行動電話和無線網路連接的資訊和設備是否已連接到 internet。 + +## 安裝 + + cordova plugin add cordova-plugin-network-information + + +## 支援的平臺 + + * 亞馬遜火 OS + * Android 系統 + * 黑莓 10 + * 瀏覽器 + * iOS + * Windows Phone 7 和 8 + * Tizen + * Windows + * 火狐瀏覽器作業系統 + +# 連接 + +> `connection`物件,通過公開 `navigator.connection` ,提供了有關該設備的行動電話和無線網路連接的資訊。 + +## 屬性 + + * connection.type + +## 常量 + + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + +## connection.type + +此屬性提供快速的方法來確定設備的網路連接狀態,和連線類型。 + +### 快速的示例 + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API 更改 + +科爾多瓦 2.3.0,直到 `Connection` 物件的訪問通過 `navigator.network.connection` 後才改為其中, `navigator.connection` 以匹配的 W3C 規範。 它在其原始位置,是仍然可用,但已廢棄,最終將被刪除。 + +### iOS 的怪癖 + + * iOS 無法檢測到蜂窩網路連接的類型。 + * `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。 + +### Windows Phone 怪癖 + + * 當運行在模擬器中,總能檢測到 `navigator.connection.type` 作為`Connection.UNKNOWN`. + + * Windows Phone 不能檢測的蜂窩網路連接的類型。 + + * `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。 + +### Windows 的怪癖 + + * 當電話 8.1 在模擬器中運行,總能檢測到 `navigator.connection.type` 作為 `Connection.ETHERNET`. + +### Tizen 怪癖 + + * 泰只能檢測一個 WiFi 或細胞連接。 + * `navigator.connection.type` 是所有蜂窩資料設置為 `Connection.CELL_2G`。 + +### 火狐瀏覽器作業系統的怪癖 + + * 火狐瀏覽器作業系統無法檢測到蜂窩網路連接的類型。 + * `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。 + +### 瀏覽器的怪癖 + + * 瀏覽器無法檢測到網路連接的類型。 `navigator.connection.type`總是被設置為`Connection.UNKNOWN`時線上。 + +# 與網路相關的事件 + +## offline + +當一個應用程式離線時,與該設備未連接到互聯網時,將觸發該事件。 + + document.addEventListener("offline", yourCallbackFunction, false); + + +### 詳細資訊 + +`offline`以前連接的設備失去網路連接,這樣,應用程式不再可以訪問互聯網時激發的事件。 它依賴于連接 API,相同的資訊和火災時的值 `connection.type` 變得`NONE`. + +應用程式通常應使用 `document.addEventListener` 將一個事件攔截器附加一次 `deviceready` 事件火災。 + +### 快速的示例 + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS 的怪癖 + +在初始啟動期間,第一次離線事件 (如果適用) 需至少一秒的火。 + +### Windows Phone 7 的怪癖 + +當運行在模擬器中, `connection.status` 始終是未知的因此此事件不會*不*火。 + +### Windows Phone 8 怪癖 + +模擬程式報告連線類型為 `Cellular` ,而不會更改,所以該事件不會*不*火。 + +## online + +當應用程式進入線上狀態,和該設備將成為連接到互聯網時觸發此事件。 + + document.addEventListener("online", yourCallbackFunction, false); + + +### 詳細資訊 + +`online`當先前連接的行動裝置接收到一個網路連接以允許應用程式訪問互聯網時激發的事件。 它依賴于連接 API,相同的資訊,則會激發 `connection.type` 從更改 `NONE` 為任何其他值。 + +應用程式通常應使用 `document.addEventListener` 將一個事件攔截器附加一次 `deviceready` 事件火災。 + +### 快速的示例 + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS 的怪癖 + +在初始啟動期間第一次 `online` 事件 (如果適用),至少需一秒的火災之前的, `connection.type` 是`UNKNOWN`. + +### Windows Phone 7 的怪癖 + +當運行在模擬器中, `connection.status` 始終是未知的因此此事件不會*不*火。 + +### Windows Phone 8 怪癖 + +模擬程式報告連線類型為 `Cellular` ,而不會更改,所以事件不**火。 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/doc/zh/index.md b/app/plugins/cordova-plugin-network-information/doc/zh/index.md new file mode 100644 index 0000000..2041467 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/doc/zh/index.md @@ -0,0 +1,186 @@ + + +# cordova-plugin-network-information + +這個外掛程式提供的舊版本的[網路資訊 API][1]實現的。 它提供了有關該設備的行動電話和無線網路連接的資訊和設備是否已連接到 internet。 + + [1]: http://www.w3.org/TR/2011/WD-netinfo-api-20110607/ + +## 安裝 + + cordova plugin add cordova-plugin-network-information + + +## 支援的平臺 + +* 亞馬遜火 OS +* Android 系統 +* 黑莓 10 +* 瀏覽器 +* iOS +* Windows Phone 7 和 8 +* 泰 +* Windows +* 火狐瀏覽器的作業系統 + +# 連接 + +> `connection`物件,通過公開 `navigator.connection` ,提供了有關該設備的行動電話和無線網路連接的資訊。 + +## 屬性 + +* connection.type + +## 常量 + +* Connection.UNKNOWN +* Connection.ETHERNET +* Connection.WIFI +* Connection.CELL_2G +* Connection.CELL_3G +* Connection.CELL_4G +* Connection.CELL +* Connection.NONE + +## connection.type + +此屬性提供快速的方法來確定設備的網路連接狀態,和連線類型。 + +### 快速的示例 + + function checkConnection() { + var networkState = navigator.connection.type; + + var states = {}; + states[Connection.UNKNOWN] = 'Unknown connection'; + states[Connection.ETHERNET] = 'Ethernet connection'; + states[Connection.WIFI] = 'WiFi connection'; + states[Connection.CELL_2G] = 'Cell 2G connection'; + states[Connection.CELL_3G] = 'Cell 3G connection'; + states[Connection.CELL_4G] = 'Cell 4G connection'; + states[Connection.CELL] = 'Cell generic connection'; + states[Connection.NONE] = 'No network connection'; + + alert('Connection type: ' + states[networkState]); + } + + checkConnection(); + + +### API 更改 + +科爾多瓦 2.3.0,直到 `Connection` 物件的訪問通過 `navigator.network.connection` 後才改為其中, `navigator.connection` 以匹配的 W3C 規範。 它在其原始位置,是仍然可用,但已廢棄,最終將被刪除。 + +### iOS 的怪癖 + +* iOS 無法檢測到蜂窩網路連接的類型。 + * `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。 + +### Windows Phone 怪癖 + +* 當運行在模擬器中,總能檢測到 `navigator.connection.type` 作為`Connection.UNKNOWN`. + +* Windows Phone 不能檢測的蜂窩網路連接的類型。 + + * `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。 + +### Windows 的怪癖 + +* 當電話 8.1 在模擬器中運行,總能檢測到 `navigator.connection.type` 作為 `Connection.ETHERNET`. + +### Tizen 怪癖 + +* 泰只能檢測一個 WiFi 或細胞連接。 + * `navigator.connection.type` 是所有蜂窩資料設置為 `Connection.CELL_2G`。 + +### 火狐瀏覽器作業系統的怪癖 + +* 火狐瀏覽器作業系統無法檢測到蜂窩網路連接的類型。 + * `navigator.connection.type`設置為 `Connection.CELL` 為所有蜂窩資料。 + +# 與網路相關的事件 + +## offline + +當一個應用程式離線時,與該設備未連接到互聯網時,將觸發該事件。 + + document.addEventListener("offline", yourCallbackFunction, false); + + +### 詳細資訊 + +`offline`以前連接的設備失去網路連接,這樣,應用程式不再可以訪問互聯網時激發的事件。 它依賴于連接 API,相同的資訊和火災時的值 `connection.type` 變得`NONE`. + +應用程式通常應使用 `document.addEventListener` 將一個事件攔截器附加一次 `deviceready` 事件火災。 + +### 快速的示例 + + document.addEventListener("offline", onOffline, false); + + function onOffline() { + // Handle the offline event + } + + +### iOS 的怪癖 + +在初始啟動期間,第一次離線事件 (如果適用) 需至少一秒的火。 + +### Windows Phone 7 的怪癖 + +當運行在模擬器中, `connection.status` 始終是未知的因此此事件不會*不*火。 + +### Windows Phone 8 怪癖 + +模擬程式報告連線類型為 `Cellular` ,而不會更改,所以該事件不會*不*火。 + +## online + +當應用程式進入線上狀態,和該設備將成為連接到互聯網時觸發此事件。 + + document.addEventListener("online", yourCallbackFunction, false); + + +### 詳細資訊 + +`online`當先前連接的行動裝置接收到一個網路連接以允許應用程式訪問互聯網時激發的事件。 它依賴于連接 API,相同的資訊,則會激發 `connection.type` 從更改 `NONE` 為任何其他值。 + +應用程式通常應使用 `document.addEventListener` 將一個事件攔截器附加一次 `deviceready` 事件火災。 + +### 快速的示例 + + document.addEventListener("online", onOnline, false); + + function onOnline() { + // Handle the online event + } + + +### iOS 的怪癖 + +在初始啟動期間第一次 `online` 事件 (如果適用),至少需一秒的火災之前的, `connection.type` 是`UNKNOWN`. + +### Windows Phone 7 的怪癖 + +當運行在模擬器中, `connection.status` 始終是未知的因此此事件不會*不*火。 + +### Windows Phone 8 怪癖 + +模擬程式報告連線類型為 `Cellular` ,而不會更改,所以事件不**火。 diff --git a/app/plugins/cordova-plugin-network-information/package.json b/app/plugins/cordova-plugin-network-information/package.json new file mode 100644 index 0000000..20bf1d6 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/package.json @@ -0,0 +1,70 @@ +{ + "name": "cordova-plugin-network-information", + "version": "1.3.4", + "description": "Cordova Network Information Plugin", + "types": "./types/index.d.ts", + "cordova": { + "id": "cordova-plugin-network-information", + "platforms": [ + "firefoxos", + "android", + "amazon-fireos", + "ubuntu", + "ios", + "blackberry10", + "wp7", + "wp8", + "windows8", + "windows", + "tizen", + "browser" + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/apache/cordova-plugin-network-information" + }, + "bugs": { + "url": "https://issues.apache.org/jira/browse/CB" + }, + "keywords": [ + "cordova", + "network", + "information", + "ecosystem:cordova", + "cordova-firefoxos", + "cordova-android", + "cordova-amazon-fireos", + "cordova-ubuntu", + "cordova-ios", + "cordova-blackberry10", + "cordova-wp7", + "cordova-wp8", + "cordova-windows8", + "cordova-windows", + "cordova-tizen", + "cordova-browser" + ], + "scripts": { + "test": "npm run eslint", + "eslint": "eslint www && eslint src && eslint tests" + }, + "author": "Apache Software Foundation", + "license": "Apache-2.0", + "engines": { + "cordovaDependencies": { + "2.0.0": { + "cordova": ">100" + } + } + }, + "devDependencies": { + "eslint": "^4.0.0", + "eslint-config-semistandard": "^11.0.0", + "eslint-config-standard": "^10.2.1", + "eslint-plugin-import": "^2.3.0", + "eslint-plugin-node": "^5.0.0", + "eslint-plugin-promise": "^3.5.0", + "eslint-plugin-standard": "^3.0.1" + } +} diff --git a/app/plugins/cordova-plugin-network-information/plugin.xml b/app/plugins/cordova-plugin-network-information/plugin.xml new file mode 100644 index 0000000..52cec1c --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/plugin.xml @@ -0,0 +1,174 @@ + + + + + + Network Information + Cordova Network Information Plugin + Apache 2.0 + cordova,network,information + https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git + https://issues.apache.org/jira/browse/CB/component/12320640 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/plugins/cordova-plugin-network-information/src/android/NetworkManager.java b/app/plugins/cordova-plugin-network-information/src/android/NetworkManager.java new file mode 100644 index 0000000..614b6e7 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/android/NetworkManager.java @@ -0,0 +1,287 @@ +/* + 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.networkinformation; + +import org.apache.cordova.CallbackContext; +import org.apache.cordova.CordovaInterface; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.LOG; +import org.apache.cordova.PluginResult; +import org.apache.cordova.CordovaWebView; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; + +import java.util.Locale; + +public class NetworkManager extends CordovaPlugin { + + public static int NOT_REACHABLE = 0; + public static int REACHABLE_VIA_CARRIER_DATA_NETWORK = 1; + public static int REACHABLE_VIA_WIFI_NETWORK = 2; + + public static final String WIFI = "wifi"; + public static final String WIMAX = "wimax"; + // mobile + public static final String MOBILE = "mobile"; + + // Android L calls this Cellular, because I have no idea! + public static final String CELLULAR = "cellular"; + // 2G network types + public static final String TWO_G = "2g"; + public static final String GSM = "gsm"; + public static final String GPRS = "gprs"; + public static final String EDGE = "edge"; + // 3G network types + public static final String THREE_G = "3g"; + public static final String CDMA = "cdma"; + public static final String UMTS = "umts"; + public static final String HSPA = "hspa"; + public static final String HSUPA = "hsupa"; + public static final String HSDPA = "hsdpa"; + public static final String ONEXRTT = "1xrtt"; + public static final String EHRPD = "ehrpd"; + // 4G network types + public static final String FOUR_G = "4g"; + public static final String LTE = "lte"; + public static final String UMB = "umb"; + public static final String HSPA_PLUS = "hspa+"; + // return type + public static final String TYPE_UNKNOWN = "unknown"; + public static final String TYPE_ETHERNET = "ethernet"; + public static final String TYPE_ETHERNET_SHORT = "eth"; + public static final String TYPE_WIFI = "wifi"; + public static final String TYPE_2G = "2g"; + public static final String TYPE_3G = "3g"; + public static final String TYPE_4G = "4g"; + public static final String TYPE_NONE = "none"; + + private static final String LOG_TAG = "NetworkManager"; + + private CallbackContext connectionCallbackContext; + + ConnectivityManager sockMan; + BroadcastReceiver receiver; + private JSONObject lastInfo = null; + + /** + * 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); + this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); + this.connectionCallbackContext = null; + + // We need to listen to connectivity events to update navigator.connection + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); + if (this.receiver == null) { + this.receiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + // (The null check is for the ARM Emulator, please use Intel Emulator for better results) + if(NetworkManager.this.webView != null) + updateConnectionInfo(sockMan.getActiveNetworkInfo()); + } + }; + webView.getContext().registerReceiver(this.receiver, intentFilter); + } + + } + + /** + * 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. + */ + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { + if (action.equals("getConnectionInfo")) { + this.connectionCallbackContext = callbackContext; + NetworkInfo info = sockMan.getActiveNetworkInfo(); + String connectionType = ""; + try { + connectionType = this.getConnectionInfo(info).get("type").toString(); + } catch (JSONException e) { + LOG.d(LOG_TAG, e.getLocalizedMessage()); + } + + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType); + pluginResult.setKeepCallback(true); + callbackContext.sendPluginResult(pluginResult); + return true; + } + return false; + } + + /** + * Stop network receiver. + */ + public void onDestroy() { + if (this.receiver != null) { + try { + webView.getContext().unregisterReceiver(this.receiver); + } catch (Exception e) { + LOG.e(LOG_TAG, "Error unregistering network receiver: " + e.getMessage(), e); + } finally { + receiver = null; + } + } + } + + //-------------------------------------------------------------------------- + // LOCAL METHODS + //-------------------------------------------------------------------------- + + /** + * Updates the JavaScript side whenever the connection changes + * + * @param info the current active network info + * @return + */ + private void updateConnectionInfo(NetworkInfo info) { + // send update to javascript "navigator.network.connection" + // Jellybean sends its own info + JSONObject thisInfo = this.getConnectionInfo(info); + if(!thisInfo.equals(lastInfo)) + { + String connectionType = ""; + try { + connectionType = thisInfo.get("type").toString(); + } catch (JSONException e) { + LOG.d(LOG_TAG, e.getLocalizedMessage()); + } + + sendUpdate(connectionType); + lastInfo = thisInfo; + } + } + + /** + * Get the latest network connection information + * + * @param info the current active network info + * @return a JSONObject that represents the network info + */ + private JSONObject getConnectionInfo(NetworkInfo info) { + String type = TYPE_NONE; + String extraInfo = ""; + if (info != null) { + // If we are not connected to any network set type to none + if (!info.isConnected()) { + type = TYPE_NONE; + } + else { + type = getType(info); + } + extraInfo = info.getExtraInfo(); + } + + LOG.d(LOG_TAG, "Connection Type: " + type); + LOG.d(LOG_TAG, "Connection Extra Info: " + extraInfo); + + JSONObject connectionInfo = new JSONObject(); + + try { + connectionInfo.put("type", type); + connectionInfo.put("extraInfo", extraInfo); + } catch (JSONException e) { + LOG.d(LOG_TAG, e.getLocalizedMessage()); + } + + return connectionInfo; + } + + /** + * Create a new plugin result and send it back to JavaScript + * + * @param connection the network info to set as navigator.connection + */ + private void sendUpdate(String type) { + if (connectionCallbackContext != null) { + PluginResult result = new PluginResult(PluginResult.Status.OK, type); + result.setKeepCallback(true); + connectionCallbackContext.sendPluginResult(result); + } + webView.postMessage("networkconnection", type); + } + + /** + * Determine the type of connection + * + * @param info the network info so we can determine connection type. + * @return the type of mobile network we are on + */ + private String getType(NetworkInfo info) { + if (info != null) { + String type = info.getTypeName().toLowerCase(Locale.US); + + LOG.d(LOG_TAG, "toLower : " + type.toLowerCase()); + LOG.d(LOG_TAG, "wifi : " + WIFI); + if (type.equals(WIFI)) { + return TYPE_WIFI; + } + else if (type.toLowerCase().equals(TYPE_ETHERNET) || type.toLowerCase().startsWith(TYPE_ETHERNET_SHORT)) { + return TYPE_ETHERNET; + } + else if (type.equals(MOBILE) || type.equals(CELLULAR)) { + type = info.getSubtypeName().toLowerCase(Locale.US); + if (type.equals(GSM) || + type.equals(GPRS) || + type.equals(EDGE) || + type.equals(TWO_G)) { + return TYPE_2G; + } + else if (type.startsWith(CDMA) || + type.equals(UMTS) || + type.equals(ONEXRTT) || + type.equals(EHRPD) || + type.equals(HSUPA) || + type.equals(HSDPA) || + type.equals(HSPA) || + type.equals(THREE_G)) { + return TYPE_3G; + } + else if (type.equals(LTE) || + type.equals(UMB) || + type.equals(HSPA_PLUS) || + type.equals(FOUR_G)) { + return TYPE_4G; + } + } + } + else { + return TYPE_NONE; + } + return TYPE_UNKNOWN; + } +} diff --git a/app/plugins/cordova-plugin-network-information/src/blackberry10/index.js b/app/plugins/cordova-plugin-network-information/src/blackberry10/index.js new file mode 100644 index 0000000..1c8588b --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/blackberry10/index.js @@ -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. + * +*/ + +/* global PluginResult */ + +// map from BB10 to cordova connection types: +// https://github.com/apache/cordova-js/blob/master/lib/common/plugin/Connection.js +function mapConnectionType (con) { + switch (con.type) { + case 'wired': + return 'ethernet'; + case 'wifi': + return 'wifi'; + case 'none': + return 'none'; + case 'cellular': + switch (con.technology) { + case 'edge': + case 'gsm': + return '2g'; + case 'evdo': + return '3g'; + case 'umts': + return '3g'; + case 'lte': + return '4g'; + } + return 'cellular'; + } + return 'unknown'; +} + +function currentConnectionType () { + try { + // possible for webplatform to throw pps exception + return mapConnectionType(window.qnx.webplatform.device.activeConnection || { type: 'none' }); + } catch (e) { + return 'unknown'; + } +} + +module.exports = { + getConnectionInfo: function (success, fail, args, env) { + var result = new PluginResult(args, env); + result.ok(currentConnectionType()); + } +}; diff --git a/app/plugins/cordova-plugin-network-information/src/browser/network.js b/app/plugins/cordova-plugin-network-information/src/browser/network.js new file mode 100644 index 0000000..6e453ee --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/browser/network.js @@ -0,0 +1,46 @@ +/* + * 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 proxy = require('cordova/exec/proxy'); +var Connection = require('./Connection'); + +var type = navigator.onLine ? Connection.UNKNOWN : Connection.NONE; + +// Subscribe to 'native' online/offline events +function onStatusChange (evt) { + type = navigator.onLine ? Connection.UNKNOWN : Connection.NONE; + // force async + setTimeout(function () { + cordova.fireDocumentEvent(evt.type); + }, 0); +} + +window.addEventListener('online', onStatusChange); +window.addEventListener('offline', onStatusChange); + +proxy.add('NetworkStatus', { + getConnectionInfo: function (cbSuccess) { + // force async + setTimeout(function () { + cbSuccess(type); + }, 0); + } +}); diff --git a/app/plugins/cordova-plugin-network-information/src/firefoxos/NetworkProxy.js b/app/plugins/cordova-plugin-network-information/src/firefoxos/NetworkProxy.js new file mode 100644 index 0000000..7d49b96 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/firefoxos/NetworkProxy.js @@ -0,0 +1,96 @@ +/* + * + * 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. + * + */ + +/* + Network API overview: http://www.w3.org/TR/netinfo-api/ + and http://w3c.github.io/netinfo/ +*/ + +var Connection = require('./Connection'); +var modulemapper = require('cordova/modulemapper'); + +var origConnection = modulemapper.getOriginalSymbol(window, 'navigator.connection'); + +module.exports = { + + getConnectionInfo: function (successCallback, errorCallback) { + var connection = origConnection || navigator.mozConnection; + var connectionType = Connection.UNKNOWN; + + if (!connection) { + setTimeout(function () { + successCallback(connectionType); + }, 0); + return; + } + + var bandwidth = connection.bandwidth; + var metered = connection.metered; + var type = connection.type; + + if (type !== undefined) { + // For more information see: + // https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API + + switch (type) { + case 'cellular': + connectionType = Connection.CELL; + break; + case 'ethernet': + connectionType = Connection.ETHERNET; + break; + case 'wifi': + connectionType = Connection.WIFI; + break; + case 'none': + connectionType = Connection.NONE; + break; + } + } else if (bandwidth !== undefined && metered !== undefined) { + /* + bandwidth of type double, readonly + The user agent must set the value of the bandwidth attribute to: + 0 if the user is currently offline; + Infinity if the bandwidth is unknown; + an estimation of the current bandwidth in MB/s (Megabytes per seconds) + available for communication with the browsing context active document's + domain. + + For more information see: + https://developer.mozilla.org/en-US/docs/Web/API/Connection + */ + + if (bandwidth === 0) { + connectionType = Connection.NONE; + } else if (metered && isFinite(bandwidth)) { + connectionType = Connection.CELL; + } else if (!metered && isFinite(bandwidth)) { + connectionType = Connection.WIFI; + } + } + + setTimeout(function () { + successCallback(connectionType); + }, 0); + } +}; + +require('cordova/exec/proxy').add('NetworkStatus', module.exports); diff --git a/app/plugins/cordova-plugin-network-information/src/ios/CDVConnection.h b/app/plugins/cordova-plugin-network-information/src/ios/CDVConnection.h new file mode 100644 index 0000000..8add027 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/ios/CDVConnection.h @@ -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. + */ + +#import +#import +#import "CDVReachability.h" + +@interface CDVConnection : CDVPlugin { + NSString* type; + NSString* _callbackId; + + CDVReachability* internetReach; +} + +@property (copy) NSString* connectionType; +@property (strong) CDVReachability* internetReach; + +@end diff --git a/app/plugins/cordova-plugin-network-information/src/ios/CDVConnection.m b/app/plugins/cordova-plugin-network-information/src/ios/CDVConnection.m new file mode 100644 index 0000000..40b2e42 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/ios/CDVConnection.m @@ -0,0 +1,162 @@ +/* + 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 "CDVConnection.h" +#import "CDVReachability.h" + +@interface CDVConnection (PrivateMethods) +- (void)updateOnlineStatus; +- (void)sendPluginResult; +@end + +@implementation CDVConnection + +@synthesize connectionType, internetReach; + +- (void)getConnectionInfo:(CDVInvokedUrlCommand*)command +{ + _callbackId = command.callbackId; + [self sendPluginResult]; +} + +- (void)sendPluginResult +{ + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:self.connectionType]; + + [result setKeepCallbackAsBool:YES]; + [self.commandDelegate sendPluginResult:result callbackId:_callbackId]; +} + +- (NSString*)w3cConnectionTypeFor:(CDVReachability*)reachability +{ + NetworkStatus networkStatus = [reachability currentReachabilityStatus]; + + switch (networkStatus) { + case NotReachable: + return @"none"; + + case ReachableViaWWAN: + { + BOOL isConnectionRequired = [reachability connectionRequired]; + if (isConnectionRequired) { + return @"none"; + } else { + if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) { + CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new]; + if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS]) { + return @"2g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge]) { + return @"2g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) { + return @"3g"; + } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) { + return @"4g"; + } + } + return @"cellular"; + } + } + case ReachableViaWiFi: + { + BOOL isConnectionRequired = [reachability connectionRequired]; + if (isConnectionRequired) { + return @"none"; + } else { + return @"wifi"; + } + } + default: + return @"unknown"; + } +} + +- (BOOL)isCellularConnection:(NSString*)theConnectionType +{ + return [theConnectionType isEqualToString:@"2g"] || + [theConnectionType isEqualToString:@"3g"] || + [theConnectionType isEqualToString:@"4g"] || + [theConnectionType isEqualToString:@"cellular"]; +} + +- (void)updateReachability:(CDVReachability*)reachability +{ + if (reachability) { + // check whether the connection type has changed + NSString* newConnectionType = [self w3cConnectionTypeFor:reachability]; + if ([newConnectionType isEqualToString:self.connectionType]) { // the same as before, remove dupes + return; + } else { + self.connectionType = [self w3cConnectionTypeFor:reachability]; + } + } + [self sendPluginResult]; +} + +- (void)updateConnectionType:(NSNotification*)note +{ + CDVReachability* curReach = [note object]; + + if ((curReach != nil) && [curReach isKindOfClass:[CDVReachability class]]) { + [self updateReachability:curReach]; + } +} + +- (void)onPause +{ + [self.internetReach stopNotifier]; +} + +- (void)onResume +{ + [self.internetReach startNotifier]; + [self updateReachability:self.internetReach]; +} + +- (void)pluginInitialize +{ + self.connectionType = @"none"; + self.internetReach = [CDVReachability reachabilityForInternetConnection]; + self.connectionType = [self w3cConnectionTypeFor:self.internetReach]; + [self.internetReach startNotifier]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:) + name:kReachabilityChangedNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:) + name:CTRadioAccessTechnologyDidChangeNotification object:nil]; + if (UIApplicationDidEnterBackgroundNotification && UIApplicationWillEnterForegroundNotification) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil]; + } +} + +@end diff --git a/app/plugins/cordova-plugin-network-information/src/ios/CDVReachability.h b/app/plugins/cordova-plugin-network-information/src/ios/CDVReachability.h new file mode 100644 index 0000000..852d37b --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/ios/CDVReachability.h @@ -0,0 +1,81 @@ +/* + + File: Reachability.h + Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs. + Version: 2.2 + + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. + ("Apple") in consideration of your agreement to the following terms, and your + use, installation, modification or redistribution of this Apple software + constitutes acceptance of these terms. If you do not agree with these terms, + please do not use, install, modify or redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and subject + to these terms, Apple grants you a personal, non-exclusive license, under + Apple's copyrights in this original Apple software (the "Apple Software"), to + use, reproduce, modify and redistribute the Apple Software, with or without + modifications, in source and/or binary forms; provided that if you redistribute + the Apple Software in its entirety and without modifications, you must retain + this notice and the following text and disclaimers in all such redistributions + of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. may be used + to endorse or promote products derived from the Apple Software without specific + prior written permission from Apple. Except as expressly stated in this notice, + no other rights or licenses, express or implied, are granted by Apple herein, + including but not limited to any patent rights that may be infringed by your + derivative works or by other works in which the Apple Software may be + incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN + COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR + DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF + CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF + APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Copyright (C) 2010 Apple Inc. All Rights Reserved. + +*/ + +#import +#import +#import + +typedef enum { + NotReachable = 0, + ReachableViaWWAN, // this value has been swapped with ReachableViaWiFi for Cordova backwards compat. reasons + ReachableViaWiFi // this value has been swapped with ReachableViaWWAN for Cordova backwards compat. reasons +} NetworkStatus; +#define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification" + +@interface CDVReachability : NSObject +{ + SCNetworkReachabilityRef reachabilityRef; +} + +// reachabilityWithHostName- Use to check the reachability of a particular host name. ++ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName; + +// reachabilityWithAddress- Use to check the reachability of a particular IP address. ++ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr*)hostAddress; + +// reachabilityForInternetConnection- checks whether the default route is available. +// Should be used by applications that do not connect to a particular host ++ (CDVReachability*)reachabilityForInternetConnection; + +// Start listening for reachability notifications on the current run loop +- (BOOL)startNotifier; +- (void)stopNotifier; + +- (NetworkStatus)currentReachabilityStatus; +// WWAN may be available, but not active until a connection has been established. +// WiFi may require a connection for VPN on Demand. +- (BOOL)connectionRequired; +@end diff --git a/app/plugins/cordova-plugin-network-information/src/ios/CDVReachability.m b/app/plugins/cordova-plugin-network-information/src/ios/CDVReachability.m new file mode 100644 index 0000000..b43a62d --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/ios/CDVReachability.m @@ -0,0 +1,237 @@ +/* + + File: Reachability.m + Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs. + Version: 2.2 + + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. + ("Apple") in consideration of your agreement to the following terms, and your + use, installation, modification or redistribution of this Apple software + constitutes acceptance of these terms. If you do not agree with these terms, + please do not use, install, modify or redistribute this Apple software. + + In consideration of your agreement to abide by the following terms, and subject + to these terms, Apple grants you a personal, non-exclusive license, under + Apple's copyrights in this original Apple software (the "Apple Software"), to + use, reproduce, modify and redistribute the Apple Software, with or without + modifications, in source and/or binary forms; provided that if you redistribute + the Apple Software in its entirety and without modifications, you must retain + this notice and the following text and disclaimers in all such redistributions + of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. may be used + to endorse or promote products derived from the Apple Software without specific + prior written permission from Apple. Except as expressly stated in this notice, + no other rights or licenses, express or implied, are granted by Apple herein, + including but not limited to any patent rights that may be infringed by your + derivative works or by other works in which the Apple Software may be + incorporated. + + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED + WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN + COMBINATION WITH YOUR PRODUCTS. + + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR + DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF + CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF + APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Copyright (C) 2010 Apple Inc. All Rights Reserved. + +*/ + +#import +#import +#import +#import +#import +#import + +#import + +#import "CDVReachability.h" + +#define kShouldPrintReachabilityFlags 0 + +static void CDVPrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment) +{ +#if kShouldPrintReachabilityFlags + NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n", + (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-', + (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-', + + (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-', + (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-', + (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-', + (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-', + (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', + (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-', + (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-', + comment + ); +#endif +} + +@implementation CDVReachability + +static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) +{ +#pragma unused (target, flags) + // NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback"); + // NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback"); + + // Converted the asserts above to conditionals, with safe return from the function + if (info == NULL) { + NSLog(@"info was NULL in ReachabilityCallback"); + return; + } + + if (![(__bridge NSObject*)info isKindOfClass :[CDVReachability class]]) { + NSLog(@"info was wrong class in ReachabilityCallback"); + return; + } + + // We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively + // in case someon uses the Reachability object in a different thread. + @autoreleasepool { + CDVReachability* noteObject = (__bridge CDVReachability*)info; + // Post a notification to notify the client that the network reachability changed. + [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject]; + } +} + +- (BOOL)startNotifier +{ + BOOL retVal = NO; + SCNetworkReachabilityContext context = {0, (__bridge void*)(self), NULL, NULL, NULL}; + + if (SCNetworkReachabilitySetCallback(reachabilityRef, CDVReachabilityCallback, &context)) { + if (SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) { + retVal = YES; + } + } + return retVal; +} + +- (void)stopNotifier +{ + if (reachabilityRef != NULL) { + SCNetworkReachabilitySetCallback(reachabilityRef, NULL, NULL); + SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + } +} + +- (void)dealloc +{ + [self stopNotifier]; + if (reachabilityRef != NULL) { + CFRelease(reachabilityRef); + } +} + ++ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName; +{ + CDVReachability* retVal = NULL; + SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]); + if (reachability != NULL) { + retVal = [[self alloc] init]; + if (retVal != NULL) { + retVal->reachabilityRef = reachability; + } + else { + CFRelease(reachability); + } + } + return retVal; +} + ++ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr*)hostAddress; +{ + SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, hostAddress); + CDVReachability* retVal = NULL; + if (reachability != NULL) { + retVal = [[self alloc] init]; + if (retVal != NULL) { + retVal->reachabilityRef = reachability; + } + else { + CFRelease(reachability); + } + } + return retVal; +} + +// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing +// status of the device, both IPv4 and IPv6. ++ (CDVReachability*)reachabilityForInternetConnection; +{ + struct sockaddr_in zeroAddress; + bzero(&zeroAddress, sizeof(zeroAddress)); + zeroAddress.sin_len = sizeof(zeroAddress); + zeroAddress.sin_family = AF_INET; + return [self reachabilityWithAddress:(const struct sockaddr*) &zeroAddress]; +} + +#pragma mark Network Flag Handling + +- (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags +{ + CDVPrintReachabilityFlags(flags, "networkStatusForFlags"); + if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) { + // if target host is not reachable + return NotReachable; + } + + NetworkStatus retVal = NotReachable; + + if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) { + // if target host is reachable and no connection is required + // then we'll assume (for now) that your on Wi-Fi + retVal = ReachableViaWiFi; + } + + if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0) || + ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))) { + // ... and the connection is on-demand (or on-traffic) if the + // calling application is using the CFSocketStream or higher APIs + + if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) { + // ... and no [user] intervention is needed + retVal = ReachableViaWiFi; + } + } + + if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) { + // ... but WWAN connections are OK if the calling application + // is using the CFNetwork (CFSocketStream?) APIs. + retVal = ReachableViaWWAN; + } + return retVal; +} + +- (BOOL)connectionRequired; +{ + NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef"); + SCNetworkReachabilityFlags flags; + if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) { + return flags & kSCNetworkReachabilityFlagsConnectionRequired; + } + return NO; +} + +- (NetworkStatus)currentReachabilityStatus +{ + NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef"); + NetworkStatus retVal = NotReachable; + SCNetworkReachabilityFlags flags; + if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) { + retVal = [self networkStatusForFlags:flags]; + } + return retVal; +} + +@end diff --git a/app/plugins/cordova-plugin-network-information/src/tizen/NetworkProxy.js b/app/plugins/cordova-plugin-network-information/src/tizen/NetworkProxy.js new file mode 100644 index 0000000..63684d1 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/tizen/NetworkProxy.js @@ -0,0 +1,89 @@ +/* + * + * 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 tizen */ + +var Connection = require('./Connection'); + +module.exports = { + getConnectionInfo: function (successCallback, errorCallback) { + var cncType = Connection.NONE; + var infoCount = 0; + var deviceCapabilities = null; + var timerId = 0; + var timeout = 300; + + function connectionCB () { + if (timerId !== null) { + clearTimeout(timerId); + timerId = null; + } + + infoCount++; + + if (infoCount > 1) { + if (successCallback) { + successCallback(cncType); + } + } + } + + function errorCB (error) { + console.log('Error: ' + error.code + ',' + error.name + ',' + error.message); + + if (errorCallback) { + errorCallback(); + } + } + + function wifiSuccessCB (wifi) { + if ((wifi.status === 'ON') && (wifi.ipAddress.length !== 0)) { + cncType = Connection.WIFI; + } + connectionCB(); + } + + function cellularSuccessCB (cell) { + if ((cncType === Connection.NONE) && (cell.status === 'ON') && (cell.ipAddress.length !== 0)) { + cncType = Connection.CELL_2G; + } + connectionCB(); + } + + deviceCapabilities = tizen.systeminfo.getCapabilities(); + + timerId = setTimeout(function () { + timerId = null; + infoCount = 1; + connectionCB(); + }, timeout); + + if (deviceCapabilities.wifi) { + tizen.systeminfo.getPropertyValue('WIFI_NETWORK', wifiSuccessCB, errorCB); + } + + if (deviceCapabilities.telephony) { + tizen.systeminfo.getPropertyValue('CELLULAR_NETWORK', cellularSuccessCB, errorCB); + } + } +}; + +require('cordova/tizen/commandProxy').add('NetworkStatus', module.exports); diff --git a/app/plugins/cordova-plugin-network-information/src/ubuntu/network_information.cpp b/app/plugins/cordova-plugin-network-information/src/ubuntu/network_information.cpp new file mode 100644 index 0000000..8fdb494 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/ubuntu/network_information.cpp @@ -0,0 +1,63 @@ +/* + * 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 "network_information.h" + +void NetworkInformation::getConnectionInfo(int scId, int ecId) { + Q_UNUSED(ecId); + + QString result; + QNetworkInfo::NetworkMode networkMode = m_systemNetworkInfo.currentNetworkMode(); + QNetworkInfo::NetworkStatus networkStatus = m_systemNetworkInfo.networkStatus(networkMode, 0); + QNetworkInfo::CellDataTechnology cellDataTechnology = m_systemNetworkInfo.currentCellDataTechnology(0); + + if (networkStatus == QNetworkInfo::NoNetworkAvailable) + result = "Connection.NONE"; + + switch (networkMode) { + case QNetworkInfo::WimaxMode: + case QNetworkInfo::WlanMode: + result = "Connection.WIFI"; + break; + case QNetworkInfo::EthernetMode: + result = "Connection.ETHERNET"; + break; + case QNetworkInfo::LteMode: + result = "Connection.CELL_4G"; + break; + case QNetworkInfo::GsmMode: + case QNetworkInfo::CdmaMode: + case QNetworkInfo::TdscdmaMode: + case QNetworkInfo::WcdmaMode: + switch (cellDataTechnology) { + case QNetworkInfo::UmtsDataTechnology: + case QNetworkInfo::HspaDataTechnology: + result = "Connection.CELL_3G"; + break; + case QNetworkInfo::EdgeDataTechnology: + case QNetworkInfo::GprsDataTechnology: + result = "Connection.CELL_2G"; + break; + case QNetworkInfo::UnknownDataTechnology: + result = "Connection.UNKNOWN"; + break; + } + case QNetworkInfo::BluetoothMode: + case QNetworkInfo::UnknownMode: + result = "Connection.UNKNOWN"; + break; + } + + this->callback(scId, result); +} diff --git a/app/plugins/cordova-plugin-network-information/src/ubuntu/network_information.h b/app/plugins/cordova-plugin-network-information/src/ubuntu/network_information.h new file mode 100644 index 0000000..aca20e7 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/ubuntu/network_information.h @@ -0,0 +1,47 @@ +/* + * 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 NETWORK_INFORMATION_H +#define NETWORK_INFORMATION_H + +#include + +#include +#include + +class NetworkInformation: public CPlugin { + Q_OBJECT +public: + explicit NetworkInformation(Cordova *cordova): CPlugin(cordova) {} + + virtual const QString fullName() override { + return NetworkInformation::fullID(); + } + + virtual const QString shortName() override { + return "Connection"; + } + + static const QString fullID() { + return "NetworkStatus"; + } + +public slots: + void getConnectionInfo(int scId, int ecId); + +private: + QNetworkInfo m_systemNetworkInfo; +}; + +#endif diff --git a/app/plugins/cordova-plugin-network-information/src/windows/NetworkInfoProxy.js b/app/plugins/cordova-plugin-network-information/src/windows/NetworkInfoProxy.js new file mode 100644 index 0000000..e07ecc6 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/windows/NetworkInfoProxy.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. + * +*/ + +/* global Windows:true */ + +var Connection = require('./Connection'); + +var winNetConn = Windows.Networking.Connectivity; +var networkInfo = winNetConn.NetworkInformation; + +function getCurrrentConnectionType () { + + var profile = networkInfo.getInternetConnectionProfile(); + + if (!profile) { + return Connection.NONE; + } + + var conLevel = profile.getNetworkConnectivityLevel(); + var interfaceType = profile.networkAdapter.ianaInterfaceType; + + // since we use this to detect whether we are online or offline we do check agains InternetAccess + // localAccess (airplane mode as an example) or constrainedInternetAccess mean there is no access to the internet available + // https://msdn.microsoft.com/library/windows/apps/windows.networking.connectivity.networkconnectivitylevel.aspx + if (conLevel !== Windows.Networking.Connectivity.NetworkConnectivityLevel.internetAccess) { + return Connection.NONE; + } + + var connectionType; + + switch (interfaceType) { + case 71: + connectionType = Connection.WIFI; + break; + case 6: + connectionType = Connection.ETHERNET; + break; + case 243: // (3GPP WWAN) // Fallthrough is intentional + case 244: // (3GPP2 WWAN) + connectionType = Connection.CELL_3G; + break; + default: + connectionType = Connection.UNKNOWN; + break; + } + + return connectionType; +} + +module.exports = { + + getConnectionInfo: function (win, fail, args) { + var reportConnectionInfoOnce = function () { + win(getCurrrentConnectionType(), { keepCallback: true }); + }; + + // report current connection type + setTimeout(reportConnectionInfoOnce, 0); + // start traking future changes + networkInfo.addEventListener('networkstatuschanged', reportConnectionInfoOnce); + } +}; + +require('cordova/exec/proxy').add('NetworkStatus', module.exports); diff --git a/app/plugins/cordova-plugin-network-information/src/wp/NetworkStatus.cs b/app/plugins/cordova-plugin-network-information/src/wp/NetworkStatus.cs new file mode 100644 index 0000000..12eb061 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/src/wp/NetworkStatus.cs @@ -0,0 +1,129 @@ +/* + 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.Diagnostics; +using System.Net; +using System.Net.NetworkInformation; +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.Net.NetworkInformation; + +namespace WPCordovaClassLib.Cordova.Commands +{ + + // http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation(v=VS.92).aspx + // http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation.devicenetworkinformation(v=VS.92).aspx + + public class NetworkStatus : BaseCommand + { + const string UNKNOWN = "unknown"; + const string ETHERNET = "ethernet"; + const string WIFI = "wifi"; + const string CELL_2G = "2g"; + const string CELL_3G = "3g"; + const string CELL_4G = "4g"; + const string NONE = "none"; + const string CELL = "cellular"; + + private bool HasCallback = false; + + public NetworkStatus() + { + DeviceNetworkInformation.NetworkAvailabilityChanged += new EventHandler(ChangeDetected); + } + + public override void OnResume(object sender, Microsoft.Phone.Shell.ActivatedEventArgs e) + { + this.getConnectionInfo(""); + } + + public void getConnectionInfo(string empty) + { + HasCallback = true; + updateConnectionType(checkConnectionType()); + } + + private string checkConnectionType() + { + if (DeviceNetworkInformation.IsNetworkAvailable) + { + if (DeviceNetworkInformation.IsWiFiEnabled) + { + return WIFI; + } + else + { + return DeviceNetworkInformation.IsCellularDataEnabled ? CELL : UNKNOWN; + } + } + return NONE; + } + + private string checkConnectionType(NetworkInterfaceSubType type) + { + switch (type) + { + case NetworkInterfaceSubType.Cellular_1XRTT: //cell + case NetworkInterfaceSubType.Cellular_GPRS: //cell + return CELL; + case NetworkInterfaceSubType.Cellular_EDGE: //2 + return CELL_2G; + case NetworkInterfaceSubType.Cellular_3G: + case NetworkInterfaceSubType.Cellular_EVDO: //3 + case NetworkInterfaceSubType.Cellular_EVDV: //3 + case NetworkInterfaceSubType.Cellular_HSPA: //3 + return CELL_3G; + case NetworkInterfaceSubType.WiFi: + return WIFI; + case NetworkInterfaceSubType.Unknown: + case NetworkInterfaceSubType.Desktop_PassThru: + default: + return UNKNOWN; + } + } + + void ChangeDetected(object sender, NetworkNotificationEventArgs e) + { + switch (e.NotificationType) + { + case NetworkNotificationType.InterfaceConnected: + updateConnectionType(checkConnectionType(e.NetworkInterface.InterfaceSubtype)); + break; + case NetworkNotificationType.InterfaceDisconnected: + updateConnectionType(NONE); + break; + default: + break; + } + } + + private void updateConnectionType(string type) + { + // This should also implicitly fire offline/online events as that is handled on the JS side + if (this.HasCallback) + { + PluginResult result = new PluginResult(PluginResult.Status.OK, type); + result.KeepCallback = true; + DispatchCommandResult(result); + } + } + } +} diff --git a/app/plugins/cordova-plugin-network-information/tests/package.json b/app/plugins/cordova-plugin-network-information/tests/package.json new file mode 100644 index 0000000..59b1005 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "cordova-plugin-network-information-tests", + "version": "1.3.3-dev", + "description": "", + "cordova": { + "id": "cordova-plugin-network-information-tests", + "platforms": [] + }, + "keywords": [ + "ecosystem:cordova" + ], + "author": "", + "license": "Apache 2.0" +} diff --git a/app/plugins/cordova-plugin-network-information/tests/plugin.xml b/app/plugins/cordova-plugin-network-information/tests/plugin.xml new file mode 100644 index 0000000..c0606ee --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/tests/plugin.xml @@ -0,0 +1,30 @@ + + + + + Cordova Network Information Plugin Tests + Apache 2.0 + + + + diff --git a/app/plugins/cordova-plugin-network-information/tests/tests.js b/app/plugins/cordova-plugin-network-information/tests/tests.js new file mode 100644 index 0000000..c28e7eb --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/tests/tests.js @@ -0,0 +1,104 @@ +/* + * + * 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. + * +*/ + +/* eslint-env jasmine */ +/* global Connection */ + +exports.defineAutoTests = function () { + describe('Network (navigator.connection)', function () { + it('network.spec.1 should exist', function () { + expect(navigator.network && navigator.network.connection).toBeDefined(); + expect(navigator.connection).toBeDefined(); + }); + + it('network.spec.2 should be set to a valid value', function () { + var validValues = { + 'unknown': 1, + 'ethernet': 1, + 'wifi': 1, + '2g': 1, + 'cellular': 1, + '3g': 1, + '4g': 1, + 'none': 1 + }; + expect(validValues[navigator.connection.type]).toBe(1); + }); + + it('network.spec.3 should have the same value in deprecated and non-deprecated apis', function () { + expect(navigator.network.connection.type).toBe(navigator.connection.type); + }); + + it('network.spec.4 should define constants for connection status', function () { + expect(Connection.UNKNOWN).toBe('unknown'); + expect(Connection.ETHERNET).toBe('ethernet'); + expect(Connection.WIFI).toBe('wifi'); + expect(Connection.CELL_2G).toBe('2g'); + expect(Connection.CELL_3G).toBe('3g'); + expect(Connection.CELL_4G).toBe('4g'); + expect(Connection.NONE).toBe('none'); + expect(Connection.CELL).toBe('cellular'); + }); + }); +}; + +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ + +exports.defineManualTests = function (contentEl, createActionButton) { + function eventOutput (s) { + var el = document.getElementById('results'); + el.innerHTML = el.innerHTML + s + '
'; + } + + function printNetwork () { + eventOutput('navigator.connection.type=' + navigator.connection.type); + eventOutput('navigator.network.connection.type=' + navigator.network.connection.type); + } + + function onEvent (e) { + eventOutput('Event of type: ' + e.type); + printNetwork(); + } + + /******************************************************************************/ + + var html = '
' + + 'Results:
' + + '' + + '
' + + 'Expected result: Status box will update with type of connection using two different methods. Both values must match.' + + ' The result will be unknown, ethernet, wifi, 2g, 3g, 4g, none, or cellular. Make sure it matches what the device is connected to.' + + '

'; + + document.addEventListener('online', onEvent, false); + document.addEventListener('offline', onEvent, false); + contentEl.innerHTML = html; + + createActionButton('Show Network Connection', function () { + printNetwork(); + }, 'connection'); + + createActionButton('Clear Log', function () { + document.getElementById('results').innerHTML = ''; + }, 'actions'); +}; diff --git a/app/plugins/cordova-plugin-network-information/types/index.d.ts b/app/plugins/cordova-plugin-network-information/types/index.d.ts new file mode 100644 index 0000000..60b6c26 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/types/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for Apache Cordova Network Information plugin +// Project: https://github.com/apache/cordova-plugin-network-information +// Definitions by: Microsoft Open Technologies Inc +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// +// Copyright (c) Microsoft Open Technologies Inc +// Licensed under the MIT license + +interface Navigator { + /** + * This plugin provides an implementation of an old version of the Network Information API. + * It provides information about the device's cellular and wifi connection, and whether the device has an internet connection. + */ + connection: Connection; + // see https://github.com/apache/cordova-plugin-network-information/blob/dev/doc/index.md#api-change + // for + network: { + /** + * This plugin provides an implementation of an old version of the Network Information API. + * It provides information about the device's cellular and wifi connection, and whether the device has an internet connection. + */ + connection: Connection + } +} + +interface Document { + addEventListener(type: "online", connectionStateCallback: () => any, useCapture?: boolean): void; + addEventListener(type: "offline", connectionStateCallback: () => any, useCapture?: boolean): void; +} + +/** + * The connection object, exposed via navigator.connection, provides information + * about the device's cellular and wifi connection. + */ +interface Connection { + /** + * This property offers a fast way to determine the device's network connection state, and type of connection. + * One of: + * Connection.UNKNOWN + * Connection.ETHERNET + * Connection.WIFI + * Connection.CELL_2G + * Connection.CELL_3G + * Connection.CELL_4G + * Connection.CELL + * Connection.NONE + */ + type: string; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var Connection: { + UNKNOWN: string; + ETHERNET: string; + WIFI: string; + CELL_2G: string; + CELL_3G: string; + CELL_4G: string; + CELL: string; + NONE: string; +} \ No newline at end of file diff --git a/app/plugins/cordova-plugin-network-information/www/Connection.js b/app/plugins/cordova-plugin-network-information/www/Connection.js new file mode 100644 index 0000000..fb1d0ad --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/www/Connection.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. + * +*/ + +/** + * Network status + */ +module.exports = { + UNKNOWN: 'unknown', + ETHERNET: 'ethernet', + WIFI: 'wifi', + CELL_2G: '2g', + CELL_3G: '3g', + CELL_4G: '4g', + CELL: 'cellular', + NONE: 'none' +}; diff --git a/app/plugins/cordova-plugin-network-information/www/network.js b/app/plugins/cordova-plugin-network-information/www/network.js new file mode 100644 index 0000000..87ff906 --- /dev/null +++ b/app/plugins/cordova-plugin-network-information/www/network.js @@ -0,0 +1,91 @@ +/* + * 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 cordova = require('cordova'); +var channel = require('cordova/channel'); +var utils = require('cordova/utils'); + +// Link the onLine property with the Cordova-supplied network info. +// This works because we clobber the navigator object with our own +// object in bootstrap.js. +// Browser platform do not need to define this property, because +// it is already supported by modern browsers +if (cordova.platformId !== 'browser' && typeof navigator !== 'undefined') { + utils.defineGetter(navigator, 'onLine', function () { + return this.connection.type !== 'none'; + }); +} + +function NetworkConnection () { + this.type = 'unknown'; +} + +/** + * Get connection info + * + * @param {Function} successCallback The function to call when the Connection data is available + * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL) + */ +NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) { + exec(successCallback, errorCallback, 'NetworkStatus', 'getConnectionInfo', []); +}; + +var me = new NetworkConnection(); +var timerId = null; +var timeout = 500; + +channel.createSticky('onCordovaConnectionReady'); +channel.waitForInitialization('onCordovaConnectionReady'); + +channel.onCordovaReady.subscribe(function () { + me.getInfo(function (info) { + me.type = info; + if (info === 'none') { + // set a timer if still offline at the end of timer send the offline event + timerId = setTimeout(function () { + cordova.fireDocumentEvent('offline'); + timerId = null; + }, timeout); + } else { + // If there is a current offline event pending clear it + if (timerId !== null) { + clearTimeout(timerId); + timerId = null; + } + cordova.fireDocumentEvent('online'); + } + + // should only fire this once + if (channel.onCordovaConnectionReady.state !== 2) { + channel.onCordovaConnectionReady.fire(); + } + }, + function (e) { + // If we can't get the network info we should still tell Cordova + // to fire the deviceready event. + if (channel.onCordovaConnectionReady.state !== 2) { + channel.onCordovaConnectionReady.fire(); + } + console.log('Error initializing Network Connection: ' + e); + }); +}); + +module.exports = me; diff --git a/app/plugins/cordova-plugin-statusbar/CONTRIBUTING.md b/app/plugins/cordova-plugin-statusbar/CONTRIBUTING.md new file mode 100644 index 0000000..4c8e6a5 --- /dev/null +++ b/app/plugins/cordova-plugin-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/app/plugins/cordova-plugin-statusbar/LICENSE b/app/plugins/cordova-plugin-statusbar/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/app/plugins/cordova-plugin-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/app/plugins/cordova-plugin-statusbar/NOTICE b/app/plugins/cordova-plugin-statusbar/NOTICE new file mode 100644 index 0000000..8ec56a5 --- /dev/null +++ b/app/plugins/cordova-plugin-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/app/plugins/cordova-plugin-statusbar/README.md b/app/plugins/cordova-plugin-statusbar/README.md new file mode 100644 index 0000000..7c3f8c7 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/README.md @@ -0,0 +1,341 @@ +--- +title: Statusbar +description: Control the device status bar. +--- + + +|AppVeyor|Travis CI| +|:-:|:-:| +|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-statusbar?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-statusbar)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-statusbar)| + +# cordova-plugin-statusbar + +StatusBar +====== + +> The `StatusBar` object provides some functions to customize the iOS and Android StatusBar. + +:warning: Report issues on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened)%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22cordova-plugin-statusbar%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC) + + +## Installation + +This installation method requires cordova 5.0+ + + cordova plugin add cordova-plugin-statusbar +Older versions of cordova can still install via the __deprecated__ id + + cordova plugin add org.apache.cordova.statusbar +It is also possible to install via repo url directly ( unstable ) + + cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git + + +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, no default value). On iOS 7, set the background color of the statusbar by a hex string (#RRGGBB) at startup. If this value is not set, the background color will be transparent. + + + +- __StatusBarStyle__ (status bar style, defaults to lightcontent). On iOS 7, set the status bar style. Available options default, lightcontent, blacktranslucent, blackopaque. + + + +- __StatusBarDefaultScrollToTop__ (boolean, defaults to false). On iOS 7, allows the Cordova WebView to use default scroll-to-top behavior. Defaults to false so you can listen to the "statusTap" event (described below) and customize the behavior instead. + + + +### Android Quirks +The Android 5+ guidelines specify using a different color for the statusbar than your main app color (unlike the uniform statusbar color of many iOS 7+ apps), so you may want to set the statusbar color at runtime instead via `StatusBar.backgroundColorByHexString` or `StatusBar.backgroundColorByName`. One way to do that would be: +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +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 +------- +This plugin defines global `StatusBar` object. + +Although in the global scope, it is not available until after the `deviceready` event. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + +- StatusBar.overlaysWebView +- StatusBar.styleDefault +- StatusBar.styleLightContent +- StatusBar.styleBlackTranslucent +- StatusBar.styleBlackOpaque +- StatusBar.backgroundColorByName +- StatusBar.backgroundColorByHexString +- StatusBar.hide +- StatusBar.show + +Properties +-------- + +- StatusBar.isVisible + +Events +------ + +- statusTap + +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 +- Android 6+ +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + +StatusBar.styleLightContent +================= + +Use the lightContent statusbar (light text, for dark backgrounds). + + StatusBar.styleLightContent(); + + +Supported Platforms +------------------- + +- iOS +- Android 6+ +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + +StatusBar.styleBlackTranslucent +================= + +Use the blackTranslucent statusbar (light text, for dark backgrounds). + + StatusBar.styleBlackTranslucent(); + + +Supported Platforms +------------------- + +- iOS +- Android 6+ +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + +StatusBar.styleBlackOpaque +================= + +Use the blackOpaque statusbar (light text, for dark backgrounds). + + StatusBar.styleBlackOpaque(); + + +Supported Platforms +------------------- + +- iOS +- Android 6+ +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + + +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 +- Android 5+ +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + +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 +- Android 5+ +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + +StatusBar.hide +================= + +Hide the statusbar. + + StatusBar.hide(); + + +Supported Platforms +------------------- + +- iOS +- Android +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + +StatusBar.show +================= + +Shows the statusbar. + + StatusBar.show(); + + +Supported Platforms +------------------- + +- iOS +- Android +- Windows Phone 7 +- Windows Phone 8 +- Windows Phone 8.1 + + +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 +- Windows Phone 8.1 + + +statusTap +========= + +Listen for this event to know if the statusbar was tapped. + + window.addEventListener('statusTap', function() { + // scroll-up with document.body.scrollTop = 0; or do whatever you want + }); + + +Supported Platforms +------------------- + +- iOS diff --git a/app/plugins/cordova-plugin-statusbar/RELEASENOTES.md b/app/plugins/cordova-plugin-statusbar/RELEASENOTES.md new file mode 100644 index 0000000..8f6e547 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/RELEASENOTES.md @@ -0,0 +1,163 @@ + +# Release Notes + +### 2.3.0 (Nov 06, 2017) +* [CB-13476](https://issues.apache.org/jira/browse/CB-13476) (iOS): handle double size statusbar on SDK 10 for **iOS 11** +* [CB-13394](https://issues.apache.org/jira/browse/CB-13394) (iOS): fix `iPhone X` StatusBar rendering in landscape +* [CB-11858](https://issues.apache.org/jira/browse/CB-11858) (android) Add `StatusBarStyle` feature support for **Android M+** +* [CB-13311](https://issues.apache.org/jira/browse/CB-13311) (iOS) Statusbar does not overlay correctly on `iPhone X` +* [CB-13028](https://issues.apache.org/jira/browse/CB-13028) (CI) **Browser** builds on Travis and AppVeyor +* [CB-12812](https://issues.apache.org/jira/browse/CB-12812) (browser) Fix statusbar plugin with **Browser** platform +* [CB-12847](https://issues.apache.org/jira/browse/CB-12847) added `bugs` entry to `package.json`. + +### 2.2.3 (Apr 27, 2017) +* [CB-12622](https://issues.apache.org/jira/browse/CB-12622) Added **Android 6.0** build badge to `README` +* [CB-10879](https://issues.apache.org/jira/browse/CB-10879) Enable overlaysWebView on **Android** API 21+ +* [CB-12685](https://issues.apache.org/jira/browse/CB-12685) added `package.json` to tests folder + +### 2.2.2 (Feb 28, 2017) +* [CB-12188](https://issues.apache.org/jira/browse/CB-12188) Status Bar is not changing in some specific **Android** phone (Red MI 3s Prime) +* [CB-12369](https://issues.apache.org/jira/browse/CB-12369) Add plugin typings from `DefinitelyTyped` +* [CB-12363](https://issues.apache.org/jira/browse/CB-12363) Added build badges for **iOS 9.3** and **iOS 10.0** +* [CB-12196](https://issues.apache.org/jira/browse/CB-12196) **iOS** fix Status Bar Not Hiding +* [CB-12141](https://issues.apache.org/jira/browse/CB-12141) **iOS** fix white app screen after camera overlay shown on iPad +* [CB-12230](https://issues.apache.org/jira/browse/CB-12230) Removed **Windows 8.1** build badges + +### 2.2.1 (Dec 07, 2016) +* [CB-12224](https://issues.apache.org/jira/browse/CB-12224) Updated version and RELEASENOTES.md for release 2.2.1 +* [CB-10288](https://issues.apache.org/jira/browse/CB-10288) statusbar plugin interaction with iOS multitasking +* [CB-10158](https://issues.apache.org/jira/browse/CB-10158) (ios) fix StatusBar issue when recovering from fullscreen video +* [CB-10341](https://issues.apache.org/jira/browse/CB-10341) ios, document statusTap event +* [CB-11191](https://issues.apache.org/jira/browse/CB-11191) Statusbar plugin causing issues with webview size +* [CB-11917](https://issues.apache.org/jira/browse/CB-11917) - Remove pull request template checklist item: "iCLA has been submitted…" +* [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Incremented plugin version. + +### 2.2.0 (Sep 08, 2016) +* [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies +* Handle extended status bar on **iOS** +* Plugin uses `Android Log class` and not `Cordova LOG class` +* [CB-11287](https://issues.apache.org/jira/browse/CB-11287) (**ios**) - fix webview resize after modal on **iPhones** +* [CB-11485](https://issues.apache.org/jira/browse/CB-11485) fix resize on rotation with popover +* Add badges for paramedic builds on Jenkins +* [CB-11197](https://issues.apache.org/jira/browse/CB-11197) Keep status bar hidden when keyboard pops up +* Add pull request template. +* [CB-10866](https://issues.apache.org/jira/browse/CB-10866) Adding engine info to `package.json` +* patched missing `_ready` method, and changed the way the proxy is installed +* [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to `README.md` + +### 2.1.3 (Apr 15, 2016) +* [CB-11018](https://issues.apache.org/jira/browse/CB-11018) Fix statusbar with `inappbrowser` causing incorrect orientation on **iOS8** +* [CB-10884](https://issues.apache.org/jira/browse/CB-10884) `Inappbrowser` breaks UI while Screen orientation changes from landscape to portrait on **iOS** + +### 2.1.2 (Mar 09, 2016) +* [CB-10752](https://issues.apache.org/jira/browse/CB-10752) for for status bar overlays the webview on **iOS** 6 in some cases +* [CB-10683](https://issues.apache.org/jira/browse/CB-10683) Fix wrong StatusBar.isVisible initial value on **Windows** +* [CB-10636](https://issues.apache.org/jira/browse/CB-10636) Add JSHint for plugins +* [CB-10047](https://issues.apache.org/jira/browse/CB-10047) fix **iOS** 8 deprecated warnings + +### 2.1.1 (Feb 09, 2016) +* [CB-10102](https://issues.apache.org/jira/browse/CB-10102) The removeObserver code was wrong and it might crash on plugin deallocation + +### 2.1.0 (Jan 15, 2016) +* [CB-9513](https://issues.apache.org/jira/browse/CB-9513) Allow to show/hide status bar in fullscreen mode. +* [CB-8720](https://issues.apache.org/jira/browse/CB-8720) Fix status bar position when app started upside down on **iOS 7**. +* [CB-10118](https://issues.apache.org/jira/browse/CB-10118) Fixes plugin loading error for **Browser** platform + +### 2.0.0 (Nov 18, 2015) +* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest +* Added `weakSelf` reference for block use +* Fixes [CB-4712](https://issues.apache.org/jira/browse/CB-4712), [CB-5439](https://issues.apache.org/jira/browse/CB-5439) statusbar issues +* Fixing contribute link. +* [CB-7965](https://issues.apache.org/jira/browse/CB-7965) Add cordova-plugin-statusbar support for **Browser** platform +* Don't use `IsAtLeastiOSVersion` macro to determine height +* Use correct statusbar height for landscape orientation in iOS >= 8 +* remove travis-ci +* [CB-9202](https://issues.apache.org/jira/browse/CB-9202) updated repo url to github mirror in package.json +* Added verbose install text for users on < cordova 5.0 +* update docs for `StatusBarBackgroundColor` + +### 1.0.1 (Jun 17, 2015) +* add auto-tests for basic api +* [CB-9180](https://issues.apache.org/jira/browse/CB-9180) Add correct supported check for **Windows 8.1** desktop +* [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar +* fix npm md issue + +### 1.0.0 (Apr 15, 2015) +* [CB-8746](https://issues.apache.org/jira/browse/CB-8746) gave plugin major version bump +* [CB-8683](https://issues.apache.org/jira/browse/CB-8683) changed plugin-id to pacakge-name +* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) properly updated translated docs to use new id +* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) updated translated docs to use new id +* Use TRAVIS_BUILD_DIR, install paramedic by npm +* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) Updated Readme +* - Use StatusBarBackgroundColor instead of AndroidStatusBarBackgroundColor, and added a quirk to the readme. +* - Add support for StatusBar.backgroundColorByHexString (and StatusBar.backgroundColorByName) on Android 5 and up +* Allow setting the statusbar backgroundcolor on Android +* [CB-8575](https://issues.apache.org/jira/browse/CB-8575) Integrate TravisCI +* [CB-8438](https://issues.apache.org/jira/browse/CB-8438) cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar +* [CB-8538](https://issues.apache.org/jira/browse/CB-8538) Added package.json file + +### 0.1.10 (Feb 04, 2015) +* [CB-8351](https://issues.apache.org/jira/browse/CB-8351) ios: Use argumentForIndex rather than NSArray extension + +### 0.1.9 (Dec 02, 2014) +* Fix onload attribute within to be a +* [CB-8010](https://issues.apache.org/jira/browse/CB-8010) - Statusbar colour does not change to orange +* added checks for running on windows when StatusBar is NOT available +* [CB-7986](https://issues.apache.org/jira/browse/CB-7986) Add cordova-plugin-statusbar support for **Windows Phone 8.1** +* [CB-7977](https://issues.apache.org/jira/browse/CB-7977) Mention `deviceready` in plugin docs +* [CB-7979](https://issues.apache.org/jira/browse/CB-7979) Each plugin doc should have a ## Installation section +* Inserting leading space after # for consistency +* [CB-7549](https://issues.apache.org/jira/browse/CB-7549) - (Re-fix) `StatusBar` **iOS 8** Landscape issue (closes #15) +* [CB-7700](https://issues.apache.org/jira/browse/CB-7700) cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar +* [CB-7571](https://issues.apache.org/jira/browse/CB-7571) Bump version of nested plugin to match parent plugin + +### 0.1.8 (Sep 17, 2014) +* [CB-7549](https://issues.apache.org/jira/browse/CB-7549) [StatusBar][iOS 8] Landscape issue +* [CB-7486](https://issues.apache.org/jira/browse/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](https://issues.apache.org/jira/browse/CB-7195) ported statusbar tests to framework + +### 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](https://issues.apache.org/jira/browse/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](https://issues.apache.org/jira/browse/CB-6127) Updated translations for docs +* android: Fix StatusBar.initialize() not running on UI thread + +### 0.1.6 (Jun 05, 2014) +* [CB-6783](https://issues.apache.org/jira/browse/CB-6783) - added StatusBarStyle config preference, updated docs (closes #9) +* [CB-6812](https://issues.apache.org/jira/browse/CB-6812) Add license +* [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md +* [CB-6264](https://issues.apache.org/jira/browse/CB-6264) minor formatting issue +* Update docs with recent WP changes, remove 'clear' from the loist of named colors in documentation +* [CB-6513](https://issues.apache.org/jira/browse/CB-6513) - Statusbar plugin for Android is not compiling + +### 0.1.5 (Apr 17, 2014) (First release as a core Cordova Plugin) +* [CB-6316](https://issues.apache.org/jira/browse/CB-6316): Added README.md which point to the new location for docs +* [CB-6316](https://issues.apache.org/jira/browse/CB-6316): Added license header to the documentation. Added README.md which point to the new location for docs +* [CB-6316](https://issues.apache.org/jira/browse/CB-6316): Moved StatusBar plugin documentation to docs folder +* [CB-6314](https://issues.apache.org/jira/browse/CB-6314): [android] Add StatusBar.isVisible support to Android +* [CB-6460](https://issues.apache.org/jira/browse/CB-6460): Update license headers diff --git a/app/plugins/cordova-plugin-statusbar/doc/de/README.md b/app/plugins/cordova-plugin-statusbar/doc/de/README.md new file mode 100644 index 0000000..9247598 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/de/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> Das `StatusBar` Objekt stellt einige Funktionen zum Anpassen des iOS und Android StatusBar. + +## Installation + + cordova plugin add cordova-plugin-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, Standardwert ist #000000). Auf iOS legen 7 und Android 5, Sie 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. + + + + +### Android Eigenarten + +Die Android 5 + Leitlinien angeben, verwenden eine andere Farbe für die Statusbar als Ihre Hauptanwendung Farbe (anders als die einheitliche Statusbar Farbe viele iOS 7 + apps), so Sie die Statusbar Farbe zur Laufzeit statt über `StatusBar.backgroundColorByHexString` oder `StatusBar.backgroundColorByName`festzulegen möchten vielleicht. Eine Möglichkeit dazu wäre: + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 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 + +Dieses Plugin wird globales `StatusBar`-Objekt definiert. + +Obwohl im globalen Gültigkeitsbereich, steht es nicht bis nach dem `deviceready`-Ereignis. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + +## Kurzes 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 + * Windows Phone-8.1 + +# 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 + * Windows Phone-8.1 + +# 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 + * Windows Phone-8.1 + +# 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 + * Windows Phone-8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone-8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone-8.1 + +# StatusBar.hide + +Ausblenden der Statusleiste. + + StatusBar.hide(); + + +## Unterstützte Plattformen + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone-8.1 + +# StatusBar.show + +Zeigt die Statusleiste. + + StatusBar.show(); + + +## Unterstützte Plattformen + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone-8.1 + +# 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 + * Windows Phone-8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/de/index.md b/app/plugins/cordova-plugin-statusbar/doc/de/index.md new file mode 100644 index 0000000..9f913c5 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/de/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> Das `StatusBar` Objekt stellt einige Funktionen zum Anpassen des iOS und Android StatusBar. + +## Installation + + cordova plugin add cordova-plugin-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 + +Dieses Plugin wird globales `StatusBar`-Objekt definiert. + +Obwohl im globalen Gültigkeitsbereich, steht es nicht bis nach dem `deviceready`-Ereignis. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + +* 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 + +## Kurzes 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 +* Windows Phone-8.1 + +# 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 +* Windows Phone-8.1 + +# 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 +* Windows Phone-8.1 + +# 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 +* Windows Phone-8.1 + +# 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 +* Windows Phone-8.1 + +# 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 +* Windows Phone-8.1 + +# StatusBar.hide + +Ausblenden der Statusleiste. + + StatusBar.hide(); + + +## Unterstützte Plattformen + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone-8.1 + +# StatusBar.show + +Zeigt die Statusleiste. + + StatusBar.show(); + + +## Unterstützte Plattformen + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone-8.1 + +# 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 +* Windows Phone-8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/es/README.md b/app/plugins/cordova-plugin-statusbar/doc/es/README.md new file mode 100644 index 0000000..8be769d --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/es/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> El `StatusBar` objeto proporciona algunas funciones para personalizar el iOS y Android StatusBar. + +## Instalación + + cordova plugin add cordova-plugin-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** (color hex string por defecto #000000). IOS 7 y 5 Android, configurar 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. + + + + +### Rarezas Android + +Android 5 + pautas especifican utilizando un color diferente para la barra de estado que la aplicación principal de color (a diferencia del color de barra de estado uniforme de muchas apps de iOS 7 +), por lo que puede establecer el color de la barra de estado en tiempo de ejecución en su lugar a través de `StatusBar.backgroundColorByHexString` o `StatusBar.backgroundColorByName`. Una forma de hacerlo sería: + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 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 + +Este plugin define global `StatusBar` objeto. + +Aunque en el ámbito global, no estará disponible hasta después de la `deviceready` evento. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + * Windows Phone 8.1 + +# StatusBar.styleLightContent + +Utilice la barra de estado lightContent (texto ligero, para fondos oscuros). + + StatusBar.styleLightContent(); + + +## Plataformas soportadas + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +Utilice la barra de estado blackTranslucent (texto ligero, para fondos oscuros). + + StatusBar.styleBlackTranslucent(); + + +## Plataformas soportadas + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +Utilice la barra de estado blackOpaque (texto ligero, para fondos oscuros). + + StatusBar.styleBlackOpaque(); + + +## Plataformas soportadas + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +Ocultar la barra de estado. + + StatusBar.hide(); + + +## Plataformas soportadas + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +Muestra la barra de estado. + + StatusBar.show(); + + +## Plataformas soportadas + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/es/index.md b/app/plugins/cordova-plugin-statusbar/doc/es/index.md new file mode 100644 index 0000000..fa4ba67 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/es/index.md @@ -0,0 +1,252 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> El `StatusBar` objeto proporciona algunas funciones para personalizar el iOS y Android StatusBar. + +## Instalación + + Cordova plugin agregar cordova-plugin-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: + + < llave > UIStatusBarHidden < / key >< verdadero / >< llave > UIViewControllerBasedStatusBarAppearance < / key >< falso / > + + +## Métodos + +Este plugin define global `StatusBar` objeto. + +Aunque en el ámbito global, no estará disponible hasta después de la `deviceready` evento. + + document.addEventListener ("deviceready", onDeviceReady, false); + function onDeviceReady() {console.log(StatusBar)}; + + +* StatusBar.overlaysWebView +* StatusBar.styleDefault +* StatusBar.styleLightContent +* StatusBar.styleBlackTranslucent +* StatusBar.styleBlackOpaque +* StatusBar.backgroundColorByName +* StatusBar.backgroundColorByHexString +* StatusBar.hide +* StatusBar.show + +## Propiedades + +* StatusBar.isVisible + +## Permisos + +#### config.xml + + < nombre de la función = "StatusBar" >< nombre param = "ios-paquete" value = "CDVStatusBar" onload = "true" / >< / característica > + + +# 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 +* Windows Phone 8.1 + +# StatusBar.styleLightContent + +Utilice la barra de estado lightContent (texto ligero, para fondos oscuros). + + StatusBar.styleLightContent(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +Utilice la barra de estado blackTranslucent (texto ligero, para fondos oscuros). + + StatusBar.styleBlackTranslucent(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +Utilice la barra de estado blackOpaque (texto ligero, para fondos oscuros). + + StatusBar.styleBlackOpaque(); + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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: + + negro, gris oscuro, lightGray, blanco, gris, rojo, verde, azul, cian, amarillo, magenta, naranja, púrpura, marrón + + +## Plataformas soportadas + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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"); = > StatusBar.backgroundColorByHexString("#FAB") #333333; = > #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 +* Windows Phone 8.1 + +# StatusBar.hide + +Ocultar la barra de estado. + + StatusBar.hide(); + + +## Plataformas soportadas + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +Muestra la barra de estado. + + StatusBar.show(); + + +## Plataformas soportadas + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.isVisible + +Lea esta propiedad para ver si la barra de estado es visible o no. + + Si (StatusBar.isVisible) {/ / hacer algo} + + +## Plataformas soportadas + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/fr/README.md b/app/plugins/cordova-plugin-statusbar/doc/fr/README.md new file mode 100644 index 0000000..6f7f9bf --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/fr/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> Le `StatusBar` objet fournit quelques fonctions pour personnaliser les iOS et Android StatusBar. + +## Installation + + cordova plugin add cordova-plugin-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 et 5 Android, 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. + + + + +### Quirks Android + +Les lignes directrices 5 + Android spécifient à l'aide d'une couleur différente pour la barre d'État à votre application principale couleur (contrairement à la couleur uniforme statusbar de nombreuses applications iOS 7 +), donc vous pouvez définir la couleur de la barre d'état lors de l'exécution au lieu de cela via `StatusBar.backgroundColorByHexString` ou `StatusBar.backgroundColorByName`. Une façon de le faire serait : + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 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 + +Ce plugin définit objet `StatusBar` global. + +Bien que 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(StatusBar); + } + + + * 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 supportées + + * iOS + +## Exemple court + + 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 supportées + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleLightContent + +Utilisez la barre d'État lightContent (texte clair, des arrière-plans sombres). + + StatusBar.styleLightContent(); + + +## Plates-formes supportées + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +Utilisez la barre d'État blackTranslucent (texte clair, des arrière-plans sombres). + + StatusBar.styleBlackTranslucent(); + + +## Plates-formes supportées + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +Utilisez la barre d'État blackOpaque (texte clair, des arrière-plans sombres). + + StatusBar.styleBlackOpaque(); + + +## Plates-formes supportées + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 supportées + + * iOS + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 supportées + + * iOS + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +Masquer la barre d'État. + + StatusBar.hide(); + + +## Plates-formes supportées + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +Affiche la barre d'État. + + StatusBar.show(); + + +## Plates-formes supportées + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 supportées + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/fr/index.md b/app/plugins/cordova-plugin-statusbar/doc/fr/index.md new file mode 100644 index 0000000..816f3df --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/fr/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> Le `StatusBar` objet fournit quelques fonctions pour personnaliser les iOS et Android StatusBar. + +## Installation + + cordova plugin add cordova-plugin-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 + +Ce plugin définit objet `StatusBar` global. + +Bien que 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(StatusBar); + } + + +* 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 supportées + +* iOS + +## Exemple court + + 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# StatusBar.hide + +Masquer la barre d'État. + + StatusBar.hide(); + + +## Plates-formes prises en charge + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +Affiche la barre d'État. + + StatusBar.show(); + + +## Plates-formes prises en charge + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 supportées + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/it/README.md b/app/plugins/cordova-plugin-statusbar/doc/it/README.md new file mode 100644 index 0000000..cf3f844 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/it/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> Il `StatusBar` oggetto fornisce alcune funzioni per personalizzare l'iOS e Android StatusBar. + +## Installazione + + cordova plugin add cordova-plugin-statusbar + + +## Preferenze + +#### config. XML + + * **StatusBarOverlaysWebView** (boolean, default è true). IOS 7, rendono la statusbar sovrapposizione o la non sovrapposizione WebView all'avvio. + + + + + * **StatusBarBackgroundColor** (stringa esadecimale di colore, il valore predefinito è #000000). Su iOS 7 e 5 Android, è possibile 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. + + + + +### Stranezze Android + +Le linee 5 + Android Guida specificano utilizzando un colore diverso per la barra di stato che l'app principale di colore (a differenza di colore uniforme statusbar di molte applicazioni di iOS 7 +), quindi si consiglia di impostare il colore della barra di stato in fase di esecuzione invece tramite `StatusBar.backgroundColorByHexString` o `StatusBar.backgroundColorByName`. Un modo per farlo sarebbe: + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 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 + +Questo plugin definisce globale oggetto `StatusBar`. + +Anche se in ambito globale, non è disponibile fino a dopo l'evento `deviceready`. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + * Windows Phone 8.1 + +# 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 + * Windows Phone 8.1 + +# 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 + * Windows Phone 8.1 + +# 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 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +Nascondere la barra di stato. + + StatusBar.hide(); + + +## Piattaforme supportate + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +Mostra la barra di stato. + + StatusBar.show(); + + +## Piattaforme supportate + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/it/index.md b/app/plugins/cordova-plugin-statusbar/doc/it/index.md new file mode 100644 index 0000000..73ddcd4 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/it/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> Il `StatusBar` oggetto fornisce alcune funzioni per personalizzare l'iOS e Android StatusBar. + +## Installazione + + cordova plugin add cordova-plugin-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 + +Questo plugin definisce globale oggetto `StatusBar`. + +Anche se in ambito globale, non è disponibile fino a dopo l'evento `deviceready`. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + +* 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# StatusBar.hide + +Nascondere la barra di stato. + + StatusBar.hide(); + + +## Piattaforme supportate + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +Mostra la barra di stato. + + StatusBar.show(); + + +## Piattaforme supportate + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/ja/README.md b/app/plugins/cordova-plugin-statusbar/doc/ja/README.md new file mode 100644 index 0000000..fc8b59a --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/ja/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> `StatusBar`オブジェクトは、iOS と Android ステータス バーをカスタマイズするいくつかの機能を提供します。 + +## インストール + + cordova plugin add cordova-plugin-statusbar + + +## 基本設定 + +#### config.xml + + * **StatusBarOverlaysWebView**(ブール値、デフォルトは true)。IOS 7、起動時にステータスバー オーバーレイまたはないオーバーレイ、WebView を作る。 + + + + + * **StatusBarBackgroundColor**(カラー 16 進文字列、既定値は #000000)。IOS 7 とアンドロイド 5、16 進文字列 (#RRGGBB) 起動時にステータスバーの背景色を設定します。 + + + + + * **StatusBarStyle**(ステータス バーのスタイル、既定値は lightcontent)。Ios 7、ステータス バーのスタイルを設定します。使用可能なオプションのデフォルト、lightcontent、blacktranslucent、blackopaque。 + + + + +### Android の癖 + +Android のガイドライン 5 + 指定メイン アプリよりもステータスバーの異なる色を使用して`StatusBar.backgroundColorByHexString`または`StatusBar.backgroundColorByName`経由で代わりに実行時にステータス バーの色を設定する場合がありますので (とは違って制服ステータスバー色多くの iOS 7 + アプリの) 色します。 それを行う方法の 1 つになります。 + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 起動時に非表示 + +実行時に下に、StatusBar.hide 関数を使用できますが、StatusBar アプリ起動時に非表示にする場合は、アプリの Info.plist ファイルを変更する必要があります。 + +これら 2 つの属性の追加/編集存在しない場合。 **「ステータス バーが非表示最初」** **"YES"**を設定し、 **「ビュー コント ローラー ベースのステータス バーの外観」** **"NO"**にします。 Xcode せず手動で編集する、キーと値は。 + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## メソッド + +このプラグインでは、グローバル `StatusBar` オブジェクトを定義します。 + +グローバル スコープではあるがそれがないまで `deviceready` イベントの後です。 + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + * Windows Phone 8.1 + +# StatusBar.styleLightContent + +LightContent ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleLightContent(); + + +## サポートされているプラットフォーム + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +BlackTranslucent ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleBlackTranslucent(); + + +## サポートされているプラットフォーム + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +BlackOpaque ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleBlackOpaque(); + + +## サポートされているプラットフォーム + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +ステータスバーを隠します。 + + StatusBar.hide(); + + +## サポートされているプラットフォーム + + * iOS + * アンドロイド + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +ステータス バーが表示されます。 + + StatusBar.show(); + + +## サポートされているプラットフォーム + + * iOS + * アンドロイド + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.isVisible + +このプロパティ、ステータスバーが表示されるかどうかをお読みください。 + + if (StatusBar.isVisible) { + // do something + } + + +## サポートされているプラットフォーム + + * iOS + * アンドロイド + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/ja/index.md b/app/plugins/cordova-plugin-statusbar/doc/ja/index.md new file mode 100644 index 0000000..79705f2 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/ja/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> `StatusBar`オブジェクトは、iOS と Android ステータス バーをカスタマイズするいくつかの機能を提供します。 + +## インストール + + cordova plugin add cordova-plugin-statusbar + + +## 基本設定 + +#### 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` オブジェクトを定義します。 + +グローバル スコープではあるがそれがないまで `deviceready` イベントの後です。 + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + +* 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 +* Windows Phone 8.1 + +# StatusBar.styleLightContent + +LightContent ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleLightContent(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +BlackTranslucent ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleBlackTranslucent(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +BlackOpaque ステータスバー (暗い背景の明るいテキスト) を使用します。 + + StatusBar.styleBlackOpaque(); + + +## サポートされているプラットフォーム + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# StatusBar.hide + +ステータスバーを隠します。 + + StatusBar.hide(); + + +## サポートされているプラットフォーム + +* iOS +* アンドロイド +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +ステータス バーが表示されます。 + + StatusBar.show(); + + +## サポートされているプラットフォーム + +* iOS +* アンドロイド +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.isVisible + +このプロパティ、ステータスバーが表示されるかどうかをお読みください。 + + if (StatusBar.isVisible) { + // do something + } + + +## サポートされているプラットフォーム + +* iOS +* アンドロイド +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/ko/README.md b/app/plugins/cordova-plugin-statusbar/doc/ko/README.md new file mode 100644 index 0000000..f76ac3e --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/ko/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> `StatusBar`개체 iOS와 안 드 로이드 상태 표시줄을 사용자 지정 하려면 몇 가지 기능을 제공 합니다. + +## 설치 + + cordova plugin add cordova-plugin-statusbar + + +## 환경 설정 + +#### config.xml + + * **StatusBarOverlaysWebView** (boolean, 기본값: true)입니다. IOS 7, 시작 시 상태 표시줄 오버레이 또는 WebView 중첩 되지 확인 합니다. + + + + + * **StatusBarBackgroundColor** (색상 16 진수 문자열 기본값: #000000). IOS에서 7과 안 드 로이드 5 시작 시 16 진수 문자열 (#RRGGBB) 상태 표시줄의 배경색을 설정 합니다. + + + + + * **StatusBarStyle** (상태 표시줄 스타일, 기본값: lightcontent). Ios 7, 상태 표시줄 스타일을 설정 합니다. 사용 가능한 옵션 기본, lightcontent, blacktranslucent, blackopaque. + + + + +### 안 드 로이드 단점 + +안 드 로이드 5 + 지침 보다 귀하의 주요 응용 프로그램 상태 표시줄에 대 한 다른 색을 사용 하 여 지정한 색상 (와 달리 균일 한 상태 표시줄의 색상 많은 iOS 7 + 애플 리 케이 션), `StatusBar.backgroundColorByHexString` 또는 `StatusBar.backgroundColorByName`를 통해 대신 런타임에 상태 표시줄 색을 설정 하고자 할 수 있습니다. 한 가지 방법은 일 것입니다. + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 시작 시 숨기기 + +런타임 동안 아래의 StatusBar.hide 함수를 사용할 수 있습니다 하지만 당신이 원하는 응용 프로그램 시작 시 숨겨진 상태 표시줄, 응용 프로그램의 Info.plist 파일 수정 해야 합니다. + +추가 편집이 두 특성이 없는 경우. **"상태 표시줄 처음 숨겨진"** **"YES"** 로 설정 하 고 **"뷰 컨트롤러 기반 상태 표시줄 모양"** **"NO"**로 설정 합니다. Xcode, 열쇠 없이 수동으로 편집 하는 경우 값은: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## 메서드 + +이 플러그인 글로벌 `StatusBar` 개체를 정의합니다. + +전역 범위에 있지만 그것은 불가능까지 `deviceready` 이벤트 후. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + * Windows Phone 8.1 + +# StatusBar.styleLightContent + +LightContent 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleLightContent(); + + +## 지원 되는 플랫폼 + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +BlackTranslucent 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleBlackTranslucent(); + + +## 지원 되는 플랫폼 + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +BlackOpaque 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleBlackOpaque(); + + +## 지원 되는 플랫폼 + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +숨기기 상태 표시줄. + + StatusBar.hide(); + + +## 지원 되는 플랫폼 + + * iOS + * 안 드 로이드 + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +상태 표시줄을 표시합니다. + + StatusBar.show(); + + +## 지원 되는 플랫폼 + + * iOS + * 안 드 로이드 + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.isVisible + +이 속성을 상태 표시줄 표시 되는 경우 읽기. + + if (StatusBar.isVisible) { + // do something + } + + +## 지원 되는 플랫폼 + + * iOS + * 안 드 로이드 + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/ko/index.md b/app/plugins/cordova-plugin-statusbar/doc/ko/index.md new file mode 100644 index 0000000..44de75b --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/ko/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> `StatusBar`개체 iOS와 안 드 로이드 상태 표시줄을 사용자 지정 하려면 몇 가지 기능을 제공 합니다. + +## 설치 + + cordova plugin add cordova-plugin-statusbar + + +## 환경 설정 + +#### 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` 개체를 정의합니다. + +전역 범위에 있지만 그것은 불가능까지 `deviceready` 이벤트 후. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + +* 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 +* Windows Phone 8.1 + +# StatusBar.styleLightContent + +LightContent 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleLightContent(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +BlackTranslucent 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleBlackTranslucent(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +BlackOpaque 상태 표시줄 (어두운 배경에 대 한 가벼운 텍스트)을 사용 합니다. + + StatusBar.styleBlackOpaque(); + + +## 지원 되는 플랫폼 + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# StatusBar.hide + +숨기기 상태 표시줄. + + StatusBar.hide(); + + +## 지원 되는 플랫폼 + +* iOS +* 안 드 로이드 +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +상태 표시줄을 표시합니다. + + StatusBar.show(); + + +## 지원 되는 플랫폼 + +* iOS +* 안 드 로이드 +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.isVisible + +이 속성을 상태 표시줄 표시 되는 경우 읽기. + + if (StatusBar.isVisible) { + // do something + } + + +## 지원 되는 플랫폼 + +* iOS +* 안 드 로이드 +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/pl/README.md b/app/plugins/cordova-plugin-statusbar/doc/pl/README.md new file mode 100644 index 0000000..1b116cc --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/pl/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> `StatusBar`Obiekt zawiera kilka funkcji, aby dostosować iOS i Android StatusBar. + +## Instalacja + + cordova plugin add cordova-plugin-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 ciąg szesnastkowy, domyślnie #000000). Na iOS 7 i Android 5 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. + + + + +### Dziwactwa Androida + +Android 5 + wytyczne określają przy użyciu różnych kolorów statusbar niż główne aplikacji kolor (w przeciwieństwie do stanu jednolitych kolorów wiele aplikacje iOS 7 +), więc może chcesz ustawić kolor pasek stanu w czasie wykonywania zamiast za pośrednictwem `StatusBar.backgroundColorByHexString` lub `StatusBar.backgroundColorByName`. Jednym sposobem na to byłoby: + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 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 + +Ten plugin definiuje obiekt globalny `StatusBar`. + +Chociaż w globalnym zasięgu, to nie dostępne dopiero po `deviceready` imprezie. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + * Windows Phone 8.1 + +# StatusBar.styleLightContent + +Użyj lightContent stanu (światło tekst, ciemne tło). + + StatusBar.styleLightContent(); + + +## Obsługiwane platformy + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +Użyj blackTranslucent stanu (światło tekst, ciemne tło). + + StatusBar.styleBlackTranslucent(); + + +## Obsługiwane platformy + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +Użyj blackOpaque stanu (światło tekst, ciemne tło). + + StatusBar.styleBlackOpaque(); + + +## Obsługiwane platformy + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +Ukryj pasek stanu. + + StatusBar.hide(); + + +## Obsługiwane platformy + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +Pokazuje pasek stanu. + + StatusBar.show(); + + +## Obsługiwane platformy + + * iOS + * Android + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/pl/index.md b/app/plugins/cordova-plugin-statusbar/doc/pl/index.md new file mode 100644 index 0000000..4f13a37 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/pl/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> `StatusBar`Obiekt zawiera kilka funkcji, aby dostosować iOS i Android StatusBar. + +## Instalacja + + cordova plugin add cordova-plugin-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 + +Ten plugin definiuje obiekt globalny `StatusBar`. + +Chociaż w globalnym zasięgu, to nie dostępne dopiero po `deviceready` imprezie. + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + +* 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 +* Windows Phone 8.1 + +# StatusBar.styleLightContent + +Użyj lightContent stanu (światło tekst, ciemne tło). + + StatusBar.styleLightContent(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +Użyj blackTranslucent stanu (światło tekst, ciemne tło). + + StatusBar.styleBlackTranslucent(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +Użyj blackOpaque stanu (światło tekst, ciemne tło). + + StatusBar.styleBlackOpaque(); + + +## Obsługiwane platformy + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# StatusBar.hide + +Ukryj pasek stanu. + + StatusBar.hide(); + + +## Obsługiwane platformy + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +Pokazuje pasek stanu. + + StatusBar.show(); + + +## Obsługiwane platformy + +* iOS +* Android +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/doc/ru/index.md b/app/plugins/cordova-plugin-statusbar/doc/ru/index.md new file mode 100644 index 0000000..fdb95ee --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/ru/index.md @@ -0,0 +1,238 @@ + + +# cordova-plugin-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 diff --git a/app/plugins/cordova-plugin-statusbar/doc/zh/README.md b/app/plugins/cordova-plugin-statusbar/doc/zh/README.md new file mode 100644 index 0000000..8a63699 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/zh/README.md @@ -0,0 +1,276 @@ + + +# cordova-plugin-statusbar + +[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg)](https://travis-ci.org/apache/cordova-plugin-statusbar) + +# StatusBar + +> `StatusBar`物件提供了一些功能,自訂的 iOS 和 Android 狀態列。 + +## 安裝 + + cordova plugin add cordova-plugin-statusbar + + +## 首選項 + +#### config.xml + + * **StatusBarOverlaysWebView**(布林值,預設值為 true)。在 iOS 7,使狀態列覆蓋或不覆蓋 web 視圖在啟動時。 + + + + + * **StatusBarBackgroundColor**(顏色十六進位字串,預設值為 #000000)。IOS 7 和 Android 5,由十六進位字串 (#RRGGBB) 在啟動時設置狀態列的背景色。 + + + + + * **狀態列**(狀態列樣式,預設值為 lightcontent)。在 iOS 7,設置的狀態橫條圖樣式。可用的選項預設,lightcontent,blacktranslucent,blackopaque。 + + + + +### Android 的怪癖 + +Android 的 5 + 準則指定使用不同的顏色比您主要的應用程式狀態欄顏色 (不像很多 iOS 7 + 應用程式的統一狀態列顏色),所以你可能想要設置在運行時顯示狀態列顏色而不是通過`StatusBar.backgroundColorByHexString`或`StatusBar.backgroundColorByName`。 一個的方式做到這一點將是: + +```js +if (cordova.platformId == 'android') { + StatusBar.backgroundColorByHexString("#333"); +} +``` + +## 在啟動時隱藏 + +在運行時期間,你可以使用 StatusBar.hide 函數下面,但如果你想要顯示狀態列隱藏在應用程式啟動時,你必須修改你的應用程式的 Info.plist 檔。 + +添加編輯這兩個屬性,如果不存在。 將**"狀態列最初隱藏"**設置為**"YES"**和**"視圖基於控制器的狀態列外觀"**設置為**"否"**。 如果您手動編輯它沒有 Xcode,鍵和值是: + + UIStatusBarHidden + + UIViewControllerBasedStatusBarAppearance + + + +## 方法 + +這個外掛程式定義全域 `StatusBar` 物件。 + +雖然在全球範圍內,它不可用直到 `deviceready` 事件之後。 + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + + * 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 + * Windows Phone 8.1 + +# StatusBar.styleLightContent + +使用 lightContent 狀態列 (深色背景光文本)。 + + StatusBar.styleLightContent(); + + +## 支援的平臺 + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +使用 blackTranslucent 狀態列 (深色背景光文本)。 + + StatusBar.styleBlackTranslucent(); + + +## 支援的平臺 + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +使用 blackOpaque 狀態列 (深色背景光文本)。 + + StatusBar.styleBlackOpaque(); + + +## 支援的平臺 + + * iOS + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# 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 + * Android 5+ + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.hide + +隱藏狀態列。 + + StatusBar.hide(); + + +## 支援的平臺 + + * iOS + * Android 系統 + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.show + +顯示狀態列。 + + StatusBar.show(); + + +## 支援的平臺 + + * iOS + * Android 系統 + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 + +# StatusBar.isVisible + +讀取此屬性,以查看狀態列是否可見。 + + if (StatusBar.isVisible) { + // do something + } + + +## 支援的平臺 + + * iOS + * Android 系統 + * Windows Phone 7 + * Windows Phone 8 + * Windows Phone 8.1 \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/doc/zh/index.md b/app/plugins/cordova-plugin-statusbar/doc/zh/index.md new file mode 100644 index 0000000..a8805da --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/doc/zh/index.md @@ -0,0 +1,262 @@ + + +# cordova-plugin-statusbar + +# StatusBar + +> `StatusBar`物件提供了一些功能,自訂的 iOS 和 Android 狀態列。 + +## 安裝 + + cordova plugin add cordova-plugin-statusbar + + +## 首選項 + +#### 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` 物件。 + +雖然在全球範圍內,它不可用直到 `deviceready` 事件之後。 + + document.addEventListener("deviceready", onDeviceReady, false); + function onDeviceReady() { + console.log(StatusBar); + } + + +* 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 +* Windows Phone 8.1 + +# StatusBar.styleLightContent + +使用 lightContent 狀態列 (深色背景光文本)。 + + StatusBar.styleLightContent(); + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackTranslucent + +使用 blackTranslucent 狀態列 (深色背景光文本)。 + + StatusBar.styleBlackTranslucent(); + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.styleBlackOpaque + +使用 blackOpaque 狀態列 (深色背景光文本)。 + + StatusBar.styleBlackOpaque(); + + +## 支援的平臺 + +* iOS +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# 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 +* Windows Phone 8.1 + +# StatusBar.hide + +隱藏狀態列。 + + StatusBar.hide(); + + +## 支援的平臺 + +* iOS +* 安卓系統 +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.show + +顯示狀態列。 + + StatusBar.show(); + + +## 支援的平臺 + +* iOS +* 安卓系統 +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 + +# StatusBar.isVisible + +讀取此屬性,以查看狀態列是否可見。 + + if (StatusBar.isVisible) { + // do something + } + + +## 支援的平臺 + +* iOS +* 安卓系統 +* Windows Phone 7 +* Windows Phone 8 +* Windows Phone 8.1 diff --git a/app/plugins/cordova-plugin-statusbar/package.json b/app/plugins/cordova-plugin-statusbar/package.json new file mode 100644 index 0000000..aea03fc --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/package.json @@ -0,0 +1,52 @@ +{ + "name": "cordova-plugin-statusbar", + "version": "2.3.0", + "description": "Cordova StatusBar Plugin", + "types": "./types/index.d.ts", + "cordova": { + "id": "cordova-plugin-statusbar", + "platforms": [ + "android", + "ios", + "wp7", + "wp8", + "windows" + ] + }, + "repository": { + "type": "git", + "url": "https://github.com/apache/cordova-plugin-statusbar" + }, + "bugs": { + "url": "https://issues.apache.org/jira/browse/CB" + }, + "keywords": [ + "cordova", + "statusbar", + "ecosystem:cordova", + "cordova-android", + "cordova-ios", + "cordova-wp7", + "cordova-wp8", + "cordova-windows" + ], + "scripts": { + "test": "npm run jshint", + "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests" + }, + "engines": { + "cordovaDependencies": { + "0.1.0": { + "cordova": ">=3.0.0" + }, + "3.0.0": { + "cordova": ">100" + } + } + }, + "author": "Apache Software Foundation", + "license": "Apache-2.0", + "devDependencies": { + "jshint": "^2.6.0" + } +} diff --git a/app/plugins/cordova-plugin-statusbar/plugin.xml b/app/plugins/cordova-plugin-statusbar/plugin.xml new file mode 100644 index 0000000..915a451 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/plugin.xml @@ -0,0 +1,99 @@ + + + + + StatusBar + Cordova StatusBar Plugin + Apache 2.0 + cordova,statusbar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/plugins/cordova-plugin-statusbar/src/android/StatusBar.java b/app/plugins/cordova-plugin-statusbar/src/android/StatusBar.java new file mode 100644 index 0000000..714c30e --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/src/android/StatusBar.java @@ -0,0 +1,276 @@ +/* + * 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.graphics.Color; +import android.os.Build; +import android.view.View; +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.LOG; +import org.apache.cordova.PluginResult; +import org.json.JSONException; +import java.util.Arrays; + +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); + + // Read 'StatusBarBackgroundColor' from config.xml, default is #000000. + setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000")); + + // Read 'StatusBarStyle' from config.xml, default is 'lightcontent'. + setStatusBarStyle(preferences.getString("StatusBarStyle", "lightcontent")); + } + }); + } + + /** + * 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(final String action, final 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)); + return true; + } + + if ("show".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + // SYSTEM_UI_FLAG_FULLSCREEN is available since JellyBean, but we + // use KitKat here to be aligned with "Fullscreen" preference + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + int uiOptions = window.getDecorView().getSystemUiVisibility(); + uiOptions &= ~View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + uiOptions &= ~View.SYSTEM_UI_FLAG_FULLSCREEN; + + window.getDecorView().setSystemUiVisibility(uiOptions); + } + + // CB-11197 We still need to update LayoutParams to force status bar + // to be hidden when entering e.g. text fields + window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + }); + return true; + } + + if ("hide".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + // SYSTEM_UI_FLAG_FULLSCREEN is available since JellyBean, but we + // use KitKat here to be aligned with "Fullscreen" preference + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + int uiOptions = window.getDecorView().getSystemUiVisibility() + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_FULLSCREEN; + + window.getDecorView().setSystemUiVisibility(uiOptions); + } + + // CB-11197 We still need to update LayoutParams to force status bar + // to be hidden when entering e.g. text fields + window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + }); + return true; + } + + if ("backgroundColorByHexString".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + try { + setStatusBarBackgroundColor(args.getString(0)); + } catch (JSONException ignore) { + LOG.e(TAG, "Invalid hexString argument, use f.i. '#777777'"); + } + } + }); + return true; + } + + if ("overlaysWebView".equals(action)) { + if (Build.VERSION.SDK_INT >= 21) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + try { + setStatusBarTransparent(args.getBoolean(0)); + } catch (JSONException ignore) { + LOG.e(TAG, "Invalid boolean argument"); + } + } + }); + return true; + } + else return args.getBoolean(0) == false; + } + + if ("styleDefault".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + setStatusBarStyle("default"); + } + }); + return true; + } + + if ("styleLightContent".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + setStatusBarStyle("lightcontent"); + } + }); + return true; + } + + if ("styleBlackTranslucent".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + setStatusBarStyle("blacktranslucent"); + } + }); + return true; + } + + if ("styleBlackOpaque".equals(action)) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + setStatusBarStyle("blackopaque"); + } + }); + return true; + } + + return false; + } + + private void setStatusBarBackgroundColor(final String colorPref) { + if (Build.VERSION.SDK_INT >= 21) { + if (colorPref != null && !colorPref.isEmpty()) { + final Window window = cordova.getActivity().getWindow(); + // Method and constants not available on all SDKs but we want to be able to compile this code with any SDK + window.clearFlags(0x04000000); // SDK 19: WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + window.addFlags(0x80000000); // SDK 21: WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); + try { + // Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21 + window.getClass().getMethod("setStatusBarColor", int.class).invoke(window, Color.parseColor(colorPref)); + } catch (IllegalArgumentException ignore) { + LOG.e(TAG, "Invalid hexString argument, use f.i. '#999999'"); + } catch (Exception ignore) { + // this should not happen, only in case Android removes this method in a version > 21 + LOG.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT); + } + } + } + } + + private void setStatusBarTransparent(final boolean transparent) { + if (Build.VERSION.SDK_INT >= 21) { + final Window window = cordova.getActivity().getWindow(); + if (transparent) { + window.getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); + window.setStatusBarColor(Color.TRANSPARENT); + } + else { + window.getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_VISIBLE); + } + } + } + + private void setStatusBarStyle(final String style) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + if (style != null && !style.isEmpty()) { + View decorView = cordova.getActivity().getWindow().getDecorView(); + int uiOptions = decorView.getSystemUiVisibility(); + + String[] darkContentStyles = { + "default", + }; + + String[] lightContentStyles = { + "lightcontent", + "blacktranslucent", + "blackopaque", + }; + + if (Arrays.asList(darkContentStyles).contains(style.toLowerCase())) { + decorView.setSystemUiVisibility(uiOptions | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + return; + } + + if (Arrays.asList(lightContentStyles).contains(style.toLowerCase())) { + decorView.setSystemUiVisibility(uiOptions & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + return; + } + + LOG.e(TAG, "Invalid style, must be either 'default', 'lightcontent' or the deprecated 'blacktranslucent' and 'blackopaque'"); + } + } + } +} diff --git a/app/plugins/cordova-plugin-statusbar/src/browser/StatusBarProxy.js b/app/plugins/cordova-plugin-statusbar/src/browser/StatusBarProxy.js new file mode 100644 index 0000000..3290d58 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/src/browser/StatusBarProxy.js @@ -0,0 +1,50 @@ +/* + * 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 notSupported(win,fail) { + // + console.log('StatusBar is not supported'); + setTimeout(function(){ + if (win) { + win(); + } + // note that while it is not explicitly supported, it does not fail + // this is really just here to allow developers to test their code in the browser + // and if we fail, then their app might as well. -jm + },0); +} + +module.exports = { + isVisible: false, + styleBlackTranslucent:notSupported, + styleDefault:notSupported, + styleLightContent:notSupported, + styleBlackOpaque:notSupported, + overlaysWebView:notSupported, + styleLightContect: notSupported, + backgroundColorByName: notSupported, + backgroundColorByHexString: notSupported, + hide: notSupported, + show: notSupported, + _ready:notSupported +}; + +require("cordova/exec/proxy").add("StatusBar", module.exports); + diff --git a/app/plugins/cordova-plugin-statusbar/src/ios/CDVStatusBar.h b/app/plugins/cordova-plugin-statusbar/src/ios/CDVStatusBar.h new file mode 100644 index 0000000..0be08cc --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/src/ios/CDVStatusBar.h @@ -0,0 +1,50 @@ +/* + 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; +@property (atomic, assign) BOOL statusBarVisible; + +- (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/app/plugins/cordova-plugin-statusbar/src/ios/CDVStatusBar.m b/app/plugins/cordova-plugin-statusbar/src/ios/CDVStatusBar.m new file mode 100644 index 0000000..b425665 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/src/ios/CDVStatusBar.m @@ -0,0 +1,522 @@ +/* + 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)cordovaViewWillAppear:(NSNotification*)notification +{ + [self resizeWebView]; +} + +-(void)statusBarDidChangeFrame:(NSNotification*)notification +{ + //add a small delay for iOS 7 ( 0.1 seconds ) + __weak CDVStatusBar* weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + [self resizeStatusBarBackgroundView]; + [weakSelf resizeWebView]; + }); +} + +- (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]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarDidChangeFrame:) name: UIApplicationDidChangeStatusBarFrameNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cordovaViewWillAppear:) name: @"CDVViewWillAppearNotification" object:nil]; + + _statusBarOverlaysWebView = YES; // default + + [self initializeStatusBarBackgroundView]; + + self.viewController.view.autoresizesSubviews = YES; + + NSString* setting; + + setting = @"StatusBarBackgroundColor"; + if ([self settingForKey:setting]) { + [self _backgroundColorByHexString:[self settingForKey:setting]]; + } + + setting = @"StatusBarStyle"; + if ([self settingForKey:setting]) { + [self setStatusBarStyle:[self settingForKey:setting]]; + } + + setting = @"StatusBarDefaultScrollToTop"; + if ([self settingForKey:setting]) { + self.webView.scrollView.scrollsToTop = [(NSNumber*)[self settingForKey:setting] boolValue]; + } else { + self.webView.scrollView.scrollsToTop = NO; + } + + // blank scroll view to intercept status bar taps + 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 + + _statusBarVisible = ![UIApplication sharedApplication].isStatusBarHidden; +} + +- (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]; + NSString* setting = @"StatusBarOverlaysWebView"; + if ([self settingForKey:setting]) { + self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue]; + if (self.statusBarOverlaysWebView) { + [self resizeWebView]; + } + } +} + +- (void) initializeStatusBarBackgroundView +{ + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + + if ([[UIApplication sharedApplication]statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown && + statusBarFrame.size.height + statusBarFrame.origin.y == [self.viewController.view.window bounds].size.height) { + + // When started in upside-down orientation on iOS 7, status bar will be bound to lower edge of the + // screen (statusBarFrame.origin.y will be somewhere around screen height). In this case we need to + // correct frame's coordinates + statusBarFrame.origin.y = 0; + } + + statusBarFrame = [self invertFrameIfNeeded:statusBarFrame]; + + _statusBarBackgroundView = [[UIView alloc] initWithFrame:statusBarFrame]; + _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor; + _statusBarBackgroundView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin); + _statusBarBackgroundView.autoresizesSubviews = YES; +} + +- (CGRect) invertFrameIfNeeded:(CGRect)rect { + // landscape is where (width > height). On iOS < 8, we need to invert since frames are + // always in Portrait context. Do not run this on ios 8 or above to avoid breaking ipad pro multitask layout + if (!IsAtLeastiOSVersion(@"8.0") && UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { + CGFloat temp = rect.size.width; + rect.size.width = rect.size.height; + rect.size.height = temp; + rect.origin = CGPointZero; + } + + return rect; +} + +- (void) setStatusBarOverlaysWebView:(BOOL)statusBarOverlaysWebView +{ + // we only care about the latest iOS version or a change in setting + if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) { + return; + } + + _statusBarOverlaysWebView = statusBarOverlaysWebView; + + [self resizeWebView]; + + if (statusBarOverlaysWebView) { + + [_statusBarBackgroundView removeFromSuperview]; + + } else { + + [self initializeStatusBarBackgroundView]; + [self.webView.superview addSubview:_statusBarBackgroundView]; + + } + +} + +- (BOOL) statusBarOverlaysWebView +{ + return _statusBarOverlaysWebView; +} + +- (void) overlaysWebView:(CDVInvokedUrlCommand*)command +{ + id value = [command argumentAtIndex: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 +{ + #if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 + # define TRANSLUCENT_STYLE UIStatusBarStyleBlackTranslucent + #else + # define TRANSLUCENT_STYLE UIStatusBarStyleLightContent + #endif + [self setStyleForStatusBar:TRANSLUCENT_STYLE]; +} + +- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command +{ + #if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 + # define OPAQUE_STYLE UIStatusBarStyleBlackOpaque + #else + # define OPAQUE_STYLE UIStatusBarStyleLightContent + #endif + [self setStyleForStatusBar:OPAQUE_STYLE]; +} + +- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command +{ + id value = [command argumentAtIndex: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 argumentAtIndex: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 +{ + _statusBarVisible = NO; + UIApplication* app = [UIApplication sharedApplication]; + + if (!app.isStatusBarHidden) + { + + [self hideStatusBar]; + + if (IsAtLeastiOSVersion(@"7.0")) { + [_statusBarBackgroundView removeFromSuperview]; + } + + [self resizeWebView]; + + _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 +{ + _statusBarVisible = YES; + UIApplication* app = [UIApplication sharedApplication]; + + if (app.isStatusBarHidden) + { + BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0")); + + [self showStatusBar]; + [self resizeWebView]; + + if (isIOS7) { + + 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 + [self resizeStatusBarBackgroundView]; + [self.webView.superview addSubview:_statusBarBackgroundView]; + + } + + } + + _statusBarBackgroundView.hidden = NO; + } +} + +-(void)resizeStatusBarBackgroundView { + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + statusBarFrame = [self invertFrameIfNeeded:statusBarFrame]; + CGRect sbBgFrame = _statusBarBackgroundView.frame; + sbBgFrame.size = statusBarFrame.size; + _statusBarBackgroundView.frame = sbBgFrame; +} + +-(void)resizeWebView +{ + BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0")); + BOOL isIOS11 = (IsAtLeastiOSVersion(@"11.0")); + + if (isIOS7) { + CGRect bounds = [self.viewController.view.window bounds]; + if (CGRectEqualToRect(bounds, CGRectZero)) { + bounds = [[UIScreen mainScreen] bounds]; + } + bounds = [self invertFrameIfNeeded:bounds]; + + self.viewController.view.frame = bounds; + + self.webView.frame = bounds; + + CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame; + statusBarFrame = [self invertFrameIfNeeded:statusBarFrame]; + CGRect frame = self.webView.frame; + CGFloat height = statusBarFrame.size.height; + + if (!self.statusBarOverlaysWebView) { + frame.origin.y = height; + } else { + frame.origin.y = height >= 20 ? height - 20 : 0; + if (isIOS11) { +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 + if (@available(iOS 11.0, *)) { + float safeAreaTop = self.webView.safeAreaInsets.top; + if (height >= safeAreaTop && safeAreaTop >0) { + // Sometimes when in-call/recording/hotspot larger status bar is present, the safeAreaTop is 40 but we want frame.origin.y to be 20 + frame.origin.y = safeAreaTop == 40 ? 20 : height - safeAreaTop; + } else { + frame.origin.y = 0; + } + } +#endif + } + } + frame.size.height -= frame.origin.y; + self.webView.frame = frame; + } else { + CGRect bounds = [[UIScreen mainScreen] applicationFrame]; + self.viewController.view.frame = bounds; + } +} + +- (void) dealloc +{ + [[UIApplication sharedApplication] removeObserver:self forKeyPath:@"statusBarHidden"]; + [[NSNotificationCenter defaultCenter]removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; +} + + +#pragma mark - UIScrollViewDelegate + +- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView +{ + [self fireTappedEvent]; + return NO; +} + +@end diff --git a/app/plugins/cordova-plugin-statusbar/src/windows/StatusBarProxy.js b/app/plugins/cordova-plugin-statusbar/src/windows/StatusBarProxy.js new file mode 100644 index 0000000..3929ff0 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/src/windows/StatusBarProxy.js @@ -0,0 +1,114 @@ +/* + * 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 */ + +var _supported = null; // set to null so we can check first time + +function isSupported() { + // if not checked before, run check + if (_supported === null) { + var viewMan = Windows.UI.ViewManagement; + _supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView); + } + return _supported; +} + +function getViewStatusBar() { + if (!isSupported()) { + throw new Error("Status bar is not supported"); + } + return Windows.UI.ViewManagement.StatusBar.getForCurrentView(); +} + +function hexToRgb(hex) { + // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") + var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; + hex = hex.replace(shorthandRegex, function (m, r, g, b) { + return r + r + g + g + b + b; + }); + + var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + return result ? { + r: parseInt(result[1], 16), + g: parseInt(result[2], 16), + b: parseInt(result[3], 16) + } : null; +} + +module.exports = { + _ready: function(win, fail) { + if(isSupported()) { + var statusBar = getViewStatusBar(); + win(statusBar.occludedRect.height !== 0); + } + }, + overlaysWebView: function () { + // not supported + }, + + styleDefault: function () { + // dark text ( to be used on a light background ) + if (isSupported()) { + getViewStatusBar().foregroundColor = { a: 0, r: 0, g: 0, b: 0 }; + } + }, + + styleLightContent: function () { + // light text ( to be used on a dark background ) + if (isSupported()) { + getViewStatusBar().foregroundColor = { a: 0, r: 255, g: 255, b: 255 }; + } + }, + + styleBlackTranslucent: function () { + // #88000000 ? Apple says to use lightContent instead + return module.exports.styleLightContent(); + }, + + styleBlackOpaque: function () { + // #FF000000 ? Apple says to use lightContent instead + return module.exports.styleLightContent(); + }, + + backgroundColorByHexString: function (win, fail, args) { + var rgb = hexToRgb(args[0]); + if(isSupported()) { + var statusBar = getViewStatusBar(); + statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b }; + statusBar.backgroundOpacity = 1; + } + }, + + show: function (win, fail) { + // added support check so no error thrown, when calling this method + if (isSupported()) { + getViewStatusBar().showAsync().done(win, fail); + } + }, + + hide: function (win, fail) { + // added support check so no error thrown, when calling this method + if (isSupported()) { + getViewStatusBar().hideAsync().done(win, fail); + } + } +}; +require("cordova/exec/proxy").add("StatusBar", module.exports); \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/src/wp/StatusBar.cs b/app/plugins/cordova-plugin-statusbar/src/wp/StatusBar.cs new file mode 100644 index 0000000..ec83ca8 --- /dev/null +++ b/app/plugins/cordova-plugin-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/app/plugins/cordova-plugin-statusbar/tests/package.json b/app/plugins/cordova-plugin-statusbar/tests/package.json new file mode 100644 index 0000000..5e2ba47 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/tests/package.json @@ -0,0 +1,14 @@ +{ + "name": "cordova-plugin-statusbar-tests", + "version": "2.2.3-dev", + "description": "", + "cordova": { + "id": "cordova-plugin-statusbar-tests", + "platforms": [] + }, + "keywords": [ + "ecosystem:cordova" + ], + "author": "", + "license": "Apache 2.0" +} diff --git a/app/plugins/cordova-plugin-statusbar/tests/plugin.xml b/app/plugins/cordova-plugin-statusbar/tests/plugin.xml new file mode 100644 index 0000000..47c7c5b --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/tests/plugin.xml @@ -0,0 +1,31 @@ + + + + + Cordova StatusBar Plugin Tests + Apache 2.0 + + + + diff --git a/app/plugins/cordova-plugin-statusbar/tests/tests.js b/app/plugins/cordova-plugin-statusbar/tests/tests.js new file mode 100644 index 0000000..5a8fe39 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/tests/tests.js @@ -0,0 +1,151 @@ +/* + * + * 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. + * +*/ + +/* jshint jasmine: true */ +/* global StatusBar */ + +exports.defineAutoTests = function () { + describe("StatusBar", function () { + it("statusbar.spec.1 should exist", function() { + expect(window.StatusBar).toBeDefined(); + }); + + it("statusbar.spec.2 should have show|hide methods", function() { + expect(window.StatusBar.show).toBeDefined(); + expect(typeof window.StatusBar.show).toBe("function"); + + expect(window.StatusBar.hide).toBeDefined(); + expect(typeof window.StatusBar.hide).toBe("function"); + }); + + it("statusbar.spec.3 should have set backgroundColor methods", function() { + expect(window.StatusBar.backgroundColorByName).toBeDefined(); + expect(typeof window.StatusBar.backgroundColorByName).toBe("function"); + + expect(window.StatusBar.backgroundColorByHexString).toBeDefined(); + expect(typeof window.StatusBar.backgroundColorByHexString).toBe("function"); + }); + + it("statusbar.spec.4 should have set style methods", function() { + expect(window.StatusBar.styleBlackTranslucent).toBeDefined(); + expect(typeof window.StatusBar.styleBlackTranslucent).toBe("function"); + + expect(window.StatusBar.styleDefault).toBeDefined(); + expect(typeof window.StatusBar.styleDefault).toBe("function"); + + expect(window.StatusBar.styleLightContent).toBeDefined(); + expect(typeof window.StatusBar.styleLightContent).toBe("function"); + + expect(window.StatusBar.styleBlackOpaque).toBeDefined(); + expect(typeof window.StatusBar.styleBlackOpaque).toBe("function"); + + expect(window.StatusBar.overlaysWebView).toBeDefined(); + expect(typeof window.StatusBar.overlaysWebView).toBe("function"); + }); + }); +}; + +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/app/plugins/cordova-plugin-statusbar/types/index.d.ts b/app/plugins/cordova-plugin-statusbar/types/index.d.ts new file mode 100644 index 0000000..87df2e7 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/types/index.d.ts @@ -0,0 +1,77 @@ +// Type definitions for Apache Cordova StatusBar plugin +// Project: https://github.com/apache/cordova-plugin-statusbar +// Definitions by: Xinkai Chen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** +* Global object StatusBar. +*/ +interface Window { + StatusBar: StatusBar; +} + + +/** +* The StatusBar object provides some functions to customize the iOS and Android StatusBar. +*/ +interface StatusBar { + /** + * On iOS 7, make the statusbar overlay or not overlay the WebView. + * @param isOverlay 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. + */ + overlaysWebView: (isOverlay: boolean) => void; + + /** + * Use the default statusbar (dark text, for light backgrounds). + */ + styleDefault: () => void; + + /** + * Use the lightContent statusbar (light text, for dark backgrounds). + */ + styleLightContent: () => void; + + /** + * Use the blackTranslucent statusbar (light text, for dark backgrounds). + */ + styleBlackTranslucent: () => void; + + /** + * Use the blackOpaque statusbar (light text, for dark backgrounds). + */ + styleBlackOpaque: () => void; + + /** + * On iOS 7, when you set StatusBar.statusBarOverlaysWebView to false, + * you can set the background color of the statusbar by color name. + * @param color Supported color names are: + * black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown + */ + backgroundColorByName: (color: string) => void; + + /** + * Sets the background color of the statusbar by a hex string. + * @param color CSS shorthand properties are also supported. + * 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 + */ + backgroundColorByHexString: (color: string) => void; + + /** + * Hide the statusbar. + */ + hide: () => void; + + /** + * Show the statusbar. + */ + show: () => void; + + /** + * Read this property to see if the statusbar is visible or not. + */ + isVisible: boolean; +} + +declare var StatusBar: StatusBar; \ No newline at end of file diff --git a/app/plugins/cordova-plugin-statusbar/www/statusbar.js b/app/plugins/cordova-plugin-statusbar/www/statusbar.js new file mode 100644 index 0000000..d9d0ea5 --- /dev/null +++ b/app/plugins/cordova-plugin-statusbar/www/statusbar.js @@ -0,0 +1,113 @@ +/* + * + * 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 cordova */ + +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. setTimeout so that proxy gets time to init +window.setTimeout(function () { + exec(function (res) { + if (typeof res == 'object') { + if (res.type == 'tap') { + cordova.fireWindowEvent('statusTap'); + } + } else { + StatusBar.isVisible = res; + } + }, null, "StatusBar", "_ready", []); +}, 0); + +module.exports = StatusBar; diff --git a/app/plugins/cordova-plugin-whitelist/CONTRIBUTING.md b/app/plugins/cordova-plugin-whitelist/CONTRIBUTING.md new file mode 100644 index 0000000..7de4c64 --- /dev/null +++ b/app/plugins/cordova-plugin-whitelist/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/app/plugins/cordova-plugin-whitelist/LICENSE b/app/plugins/cordova-plugin-whitelist/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/app/plugins/cordova-plugin-whitelist/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/app/plugins/cordova-plugin-whitelist/NOTICE b/app/plugins/cordova-plugin-whitelist/NOTICE new file mode 100644 index 0000000..8ec56a5 --- /dev/null +++ b/app/plugins/cordova-plugin-whitelist/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/app/plugins/cordova-plugin-whitelist/README.md b/app/plugins/cordova-plugin-whitelist/README.md new file mode 100644 index 0000000..e19d230 --- /dev/null +++ b/app/plugins/cordova-plugin-whitelist/README.md @@ -0,0 +1,163 @@ +--- +title: Whitelist +description: Whitelist external content accessible by your app. +--- + + +# cordova-plugin-whitelist + +This plugin implements a whitelist policy for navigating the application webview on Cordova 4.0 + +:warning: Report issues on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Whitelist%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC) + +## Installation + +You can install whitelist plugin with Cordova CLI, from npm: + +``` +$ cordova plugin add cordova-plugin-whitelist +$ cordova prepare +``` + +## Supported Cordova Platforms + +* Android 4.0.0 or above + +## Navigation Whitelist +Controls which URLs the WebView itself can be navigated to. Applies to +top-level navigations only. + +Quirks: on Android it also applies to iframes for non-http(s) schemes. + +By default, navigations only to `file://` URLs, are allowed. To allow others URLs, you must add `` tags to your `config.xml`: + + + + + + + + + + + + + + + +## Intent Whitelist +Controls which URLs the app is allowed to ask the system to open. +By default, no external URLs are allowed. + +On Android, this equates to sending an intent of type BROWSEABLE. + +This whitelist does not apply to plugins, only hyperlinks and calls to `window.open()`. + +In `config.xml`, add `` tags, like this: + + + + + + + + + + + + + + + + + + + + + + + +## Network Request Whitelist +Controls which network requests (images, XHRs, etc) are allowed to be made (via cordova native hooks). + +Note: We suggest you use a Content Security Policy (see below), which is more secure. This whitelist is mostly historical for webviews which do not support CSP. + +In `config.xml`, add `` tags, like this: + + + + + + + + + + + + + + + + + +Without any `` tags, only requests to `file://` URLs are allowed. However, the default Cordova application includes `` by default. + + +Note: Whitelist cannot block network redirects from a whitelisted remote website (i.e. http or https) to a non-whitelisted website. Use CSP rules to mitigate redirects to non-whitelisted websites for webviews that support CSP. + +Quirk: Android also allows requests to https://ssl.gstatic.com/accessibility/javascript/android/ by default, since this is required for TalkBack to function properly. + +### Content Security Policy +Controls which network requests (images, XHRs, etc) are allowed to be made (via webview directly). + +On Android and iOS, the network request whitelist (see above) is not able to filter all types of requests (e.g. `