├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── LICENSE ├── README.md ├── android ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ ├── react.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── utf8map │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable-hdpi │ │ └── node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png │ │ ├── drawable-mdpi │ │ └── node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png │ │ ├── drawable-xhdpi │ │ └── node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png │ │ ├── drawable-xxhdpi │ │ └── node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png │ │ ├── drawable-xxxhdpi │ │ └── node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── app └── views │ └── index.js ├── cordova ├── config.xml ├── hooks │ └── README.md ├── platforms │ ├── android │ │ ├── .gitignore │ │ ├── AndroidManifest.xml │ │ ├── CordovaLib │ │ │ ├── AndroidManifest.xml │ │ │ ├── build.gradle │ │ │ ├── cordova.gradle │ │ │ ├── project.properties │ │ │ └── src │ │ │ │ └── org │ │ │ │ └── apache │ │ │ │ └── cordova │ │ │ │ ├── AuthenticationToken.java │ │ │ │ ├── CallbackContext.java │ │ │ │ ├── Config.java │ │ │ │ ├── ConfigXmlParser.java │ │ │ │ ├── CordovaActivity.java │ │ │ │ ├── CordovaArgs.java │ │ │ │ ├── CordovaBridge.java │ │ │ │ ├── CordovaClientCertRequest.java │ │ │ │ ├── CordovaDialogsHelper.java │ │ │ │ ├── CordovaHttpAuthHandler.java │ │ │ │ ├── CordovaInterface.java │ │ │ │ ├── CordovaInterfaceImpl.java │ │ │ │ ├── CordovaPlugin.java │ │ │ │ ├── CordovaPreferences.java │ │ │ │ ├── CordovaResourceApi.java │ │ │ │ ├── CordovaWebView.java │ │ │ │ ├── CordovaWebViewEngine.java │ │ │ │ ├── CordovaWebViewImpl.java │ │ │ │ ├── CoreAndroid.java │ │ │ │ ├── ExposedJsApi.java │ │ │ │ ├── ICordovaClientCertRequest.java │ │ │ │ ├── ICordovaCookieManager.java │ │ │ │ ├── ICordovaHttpAuthHandler.java │ │ │ │ ├── LOG.java │ │ │ │ ├── NativeToJsMessageQueue.java │ │ │ │ ├── PluginEntry.java │ │ │ │ ├── PluginManager.java │ │ │ │ ├── PluginResult.java │ │ │ │ ├── ResumeCallback.java │ │ │ │ ├── Whitelist.java │ │ │ │ └── engine │ │ │ │ ├── SystemCookieManager.java │ │ │ │ ├── SystemExposedJsApi.java │ │ │ │ ├── SystemWebChromeClient.java │ │ │ │ ├── SystemWebView.java │ │ │ │ ├── SystemWebViewClient.java │ │ │ │ └── SystemWebViewEngine.java │ │ ├── android.json │ │ ├── assets │ │ │ └── www │ │ │ │ ├── cordova-js-src │ │ │ │ ├── android │ │ │ │ │ ├── nativeapiprovider.js │ │ │ │ │ └── promptbasednativeapi.js │ │ │ │ ├── exec.js │ │ │ │ ├── platform.js │ │ │ │ └── plugin │ │ │ │ │ └── android │ │ │ │ │ └── app.js │ │ │ │ ├── cordova.js │ │ │ │ ├── cordova_plugins.js │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── img │ │ │ │ └── logo.png │ │ │ │ ├── index.html │ │ │ │ ├── js │ │ │ │ └── index.js │ │ │ │ └── plugins │ │ │ │ └── cordova-plugin-whitelist │ │ │ │ └── whitelist.js │ │ ├── build.gradle │ │ ├── cordova │ │ │ ├── .jshintrc │ │ │ ├── Api.js │ │ │ ├── android_sdk_version │ │ │ ├── build │ │ │ ├── build.bat │ │ │ ├── check_reqs │ │ │ ├── check_reqs.bat │ │ │ ├── clean │ │ │ ├── clean.bat │ │ │ ├── defaults.xml │ │ │ ├── lib │ │ │ │ ├── Adb.js │ │ │ │ ├── AndroidManifest.js │ │ │ │ ├── AndroidProject.js │ │ │ │ ├── ConsoleLogger.js │ │ │ │ ├── android_sdk_version.js │ │ │ │ ├── build.js │ │ │ │ ├── builders │ │ │ │ │ ├── AntBuilder.js │ │ │ │ │ ├── GenericBuilder.js │ │ │ │ │ ├── GradleBuilder.js │ │ │ │ │ └── builders.js │ │ │ │ ├── check_reqs.js │ │ │ │ ├── device.js │ │ │ │ ├── emulator.js │ │ │ │ ├── install-device │ │ │ │ ├── install-device.bat │ │ │ │ ├── install-emulator │ │ │ │ ├── install-emulator.bat │ │ │ │ ├── list-devices │ │ │ │ ├── list-devices.bat │ │ │ │ ├── list-emulator-images │ │ │ │ ├── list-emulator-images.bat │ │ │ │ ├── list-started-emulators │ │ │ │ ├── list-started-emulators.bat │ │ │ │ ├── log.js │ │ │ │ ├── plugin-build.gradle │ │ │ │ ├── pluginHandlers.js │ │ │ │ ├── prepare.js │ │ │ │ ├── retry.js │ │ │ │ ├── run.js │ │ │ │ ├── start-emulator │ │ │ │ └── start-emulator.bat │ │ │ ├── log │ │ │ ├── log.bat │ │ │ ├── run │ │ │ ├── run.bat │ │ │ ├── version │ │ │ └── version.bat │ │ ├── platform_www │ │ │ ├── cordova-js-src │ │ │ │ ├── android │ │ │ │ │ ├── nativeapiprovider.js │ │ │ │ │ └── promptbasednativeapi.js │ │ │ │ ├── exec.js │ │ │ │ ├── platform.js │ │ │ │ └── plugin │ │ │ │ │ └── android │ │ │ │ │ └── app.js │ │ │ ├── cordova.js │ │ │ ├── cordova_plugins.js │ │ │ └── plugins │ │ │ │ └── cordova-plugin-whitelist │ │ │ │ └── whitelist.js │ │ ├── project.properties │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── icon.png │ │ │ ├── drawable-land-hdpi │ │ │ │ └── screen.png │ │ │ ├── drawable-land-ldpi │ │ │ │ └── screen.png │ │ │ ├── drawable-land-mdpi │ │ │ │ └── screen.png │ │ │ ├── drawable-land-xhdpi │ │ │ │ └── screen.png │ │ │ ├── drawable-ldpi │ │ │ │ └── icon.png │ │ │ ├── drawable-mdpi │ │ │ │ └── icon.png │ │ │ ├── drawable-port-hdpi │ │ │ │ └── screen.png │ │ │ ├── drawable-port-ldpi │ │ │ │ └── screen.png │ │ │ ├── drawable-port-mdpi │ │ │ │ └── screen.png │ │ │ ├── drawable-port-xhdpi │ │ │ │ └── screen.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── icon.png │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ └── xml │ │ │ │ └── config.xml │ │ ├── settings.gradle │ │ └── src │ │ │ ├── it │ │ │ └── UTF8Map │ │ │ │ └── MainActivity.java │ │ │ └── org │ │ │ └── apache │ │ │ └── cordova │ │ │ └── whitelist │ │ │ └── WhitelistPlugin.java │ └── platforms.json ├── plugins │ ├── android.json │ ├── cordova-plugin-whitelist │ │ ├── CONTRIBUTING.md │ │ ├── LICENSE │ │ ├── NOTICE │ │ ├── README.md │ │ ├── RELEASENOTES.md │ │ ├── doc │ │ │ ├── de │ │ │ │ └── README.md │ │ │ ├── es │ │ │ │ └── README.md │ │ │ ├── fr │ │ │ │ └── README.md │ │ │ ├── it │ │ │ │ └── README.md │ │ │ ├── ja │ │ │ │ └── README.md │ │ │ ├── ko │ │ │ │ └── README.md │ │ │ ├── pl │ │ │ │ └── README.md │ │ │ └── zh │ │ │ │ └── README.md │ │ ├── package.json │ │ ├── plugin.xml │ │ ├── src │ │ │ └── android │ │ │ │ └── WhitelistPlugin.java │ │ └── whitelist.js │ └── fetch.json └── www │ ├── css │ └── index.css │ ├── img │ └── logo.png │ ├── index.html │ └── js │ └── index.js ├── index.android.js ├── index.ios.js ├── index.web.js ├── ios ├── UTF8Map.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── UTF8Map.xcscheme ├── UTF8Map │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── main.m └── UTF8MapTests │ ├── Info.plist │ └── UTF8MapTests.m ├── package.json └── web └── webpack.config.js /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ugh 11 | .*/node_modules/babel.* 12 | .*/node_modules/babylon.* 13 | .*/node_modules/invariant.* 14 | 15 | # Ignore react and fbjs where there are overlaps, but don't ignore 16 | # anything that react-native relies on 17 | .*/node_modules/fbjs/lib/Map.js 18 | .*/node_modules/fbjs/lib/fetch.js 19 | .*/node_modules/fbjs/lib/ExecutionEnvironment.js 20 | .*/node_modules/fbjs/lib/ErrorUtils.js 21 | 22 | # Flow has a built-in definition for the 'react' module which we prefer to use 23 | # over the currently-untyped source 24 | .*/node_modules/react/react.js 25 | .*/node_modules/react/lib/React.js 26 | .*/node_modules/react/lib/ReactDOM.js 27 | 28 | .*/__mocks__/.* 29 | .*/__tests__/.* 30 | 31 | .*/commoner/test/source/widget/share.js 32 | 33 | # Ignore commoner tests 34 | .*/node_modules/commoner/test/.* 35 | 36 | # See https://github.com/facebook/flow/issues/442 37 | .*/react-tools/node_modules/commoner/lib/reader.js 38 | 39 | # Ignore jest 40 | .*/node_modules/jest-cli/.* 41 | 42 | # Ignore Website 43 | .*/website/.* 44 | 45 | .*/node_modules/is-my-json-valid/test/.*\.json 46 | .*/node_modules/iconv-lite/encodings/tables/.*\.json 47 | .*/node_modules/y18n/test/.*\.json 48 | .*/node_modules/spdx-license-ids/spdx-license-ids.json 49 | .*/node_modules/spdx-exceptions/index.json 50 | .*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json 51 | .*/node_modules/resolve/lib/core.json 52 | .*/node_modules/jsonparse/samplejson/.*\.json 53 | .*/node_modules/json5/test/.*\.json 54 | .*/node_modules/ua-parser-js/test/.*\.json 55 | .*/node_modules/builtin-modules/builtin-modules.json 56 | .*/node_modules/binary-extensions/binary-extensions.json 57 | .*/node_modules/url-regex/tlds.json 58 | .*/node_modules/joi/.*\.json 59 | .*/node_modules/isemail/.*\.json 60 | .*/node_modules/tr46/.*\.json 61 | 62 | [include] 63 | 64 | [libs] 65 | node_modules/react-native/Libraries/react-native/react-native-interface.js 66 | node_modules/react-native/flow 67 | flow/ 68 | 69 | [options] 70 | module.system=haste 71 | 72 | esproposal.class_static_fields=enable 73 | esproposal.class_instance_fields=enable 74 | 75 | munge_underscores=true 76 | 77 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 78 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub' 79 | 80 | suppress_type=$FlowIssue 81 | suppress_type=$FlowFixMe 82 | suppress_type=$FixMe 83 | 84 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 85 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 86 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 87 | 88 | [version] 89 | 0.22.1 90 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | TODO.md 2 | 3 | # OSX 4 | # 5 | .DS_Store 6 | 7 | # Xcode 8 | # 9 | build/ 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | *.xccheckout 20 | *.moved-aside 21 | DerivedData 22 | *.hmap 23 | *.ipa 24 | *.xcuserstate 25 | project.xcworkspace 26 | 27 | # Android/IJ 28 | # 29 | .idea 30 | .gradle 31 | local.properties 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | android/app/my-release-key.keystore -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 MIT License Luigi Maselli https://corso-javascript.it / https://grigio.org 4 | 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Native Web UTF8Map 2 | An infinite scrolling example app with React Native + React Native Web 3 | 4 | ![UTF8Map ReactJS, ReactNative, React Native Web](https://cloud.githubusercontent.com/assets/8074/14461026/0d960ecc-00c1-11e6-8c05-a0a486170081.gif) 5 | 6 | [![UTF8Map on Google Play](https://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Google_Play_logo_2015.PNG/220px-Google_Play_logo_2015.PNG)](https://play.google.com/store/apps/details?id=com.utf8map) 7 | 8 | Are you undecided between the Web and Native or both? With UTF8Map you get an idea of the performance you could get and the code base is the same, you just have to choose to render the code in a WebView or in Native. 9 | 10 | ## Usage 11 | 12 | Setup the environment, Android SDK, Xcode, and.. 13 | ``` 14 | npm install -g react-native 15 | npm install 16 | ``` 17 | 18 | ### Run on the Web 19 | ``` 20 | npm run start 21 | ``` 22 | 23 | ### Run inside Cordova Android (WebView) 24 | 25 | You need to `npm run start` in another console and put you development computer ip in `cordova/www/js/index.js` 26 | 27 | ``` 28 | cordova:android:start 29 | ``` 30 | 31 | ### Run on Android (native or simulator) 32 | ``` 33 | react-native run-android 34 | ``` 35 | 36 | ### Run on iOS (simulator) 37 | ``` 38 | react-native run-ios 39 | ``` 40 | 41 | ### License 42 | 43 | MIT License (c) 2016 Luigi Maselli https://corso-javascript.it / https://grigio.org 44 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | 30 | # Do not strip any method/class that is annotated with @DoNotStrip 31 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 32 | -keepclassmembers class * { 33 | @com.facebook.proguard.annotations.DoNotStrip *; 34 | } 35 | 36 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 37 | void set*(***); 38 | *** get*(); 39 | } 40 | 41 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 42 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 43 | -keepclassmembers,includedescriptorclasses class * { native ; } 44 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 45 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 46 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 47 | 48 | -dontwarn com.facebook.react.** 49 | 50 | # okhttp 51 | 52 | -keepattributes Signature 53 | -keepattributes *Annotation* 54 | -keep class com.squareup.okhttp.** { *; } 55 | -keep interface com.squareup.okhttp.** { *; } 56 | -dontwarn com.squareup.okhttp.** 57 | 58 | # okio 59 | 60 | -keep class sun.misc.Unsafe { *; } 61 | -dontwarn java.nio.file.* 62 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 63 | -dontwarn okio.** 64 | 65 | # stetho 66 | 67 | -dontwarn com.facebook.stetho.** 68 | -------------------------------------------------------------------------------- /android/app/react.gradle: -------------------------------------------------------------------------------- 1 | import org.apache.tools.ant.taskdefs.condition.Os 2 | 3 | def config = project.hasProperty("react") ? project.react : []; 4 | 5 | def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" 6 | def entryFile = config.entryFile ?: "index.android.js" 7 | 8 | // because elvis operator 9 | def elvisFile(thing) { 10 | return thing ? file(thing) : null; 11 | } 12 | 13 | def reactRoot = elvisFile(config.root) ?: file("../../") 14 | def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"] 15 | 16 | void runBefore(String dependentTaskName, Task task) { 17 | Task dependentTask = tasks.findByPath(dependentTaskName); 18 | if (dependentTask != null) { 19 | dependentTask.dependsOn task 20 | } 21 | } 22 | 23 | gradle.projectsEvaluated { 24 | // Grab all build types and product flavors 25 | def buildTypes = android.buildTypes.collect { type -> type.name } 26 | def productFlavors = android.productFlavors.collect { flavor -> flavor.name } 27 | 28 | // When no product flavors defined, use empty 29 | if (!productFlavors) productFlavors.add('') 30 | 31 | productFlavors.each { productFlavorName -> 32 | buildTypes.each { buildTypeName -> 33 | // Create variant and target names 34 | def targetName = "${productFlavorName.capitalize()}${buildTypeName.capitalize()}" 35 | def targetPath = productFlavorName ? 36 | "${productFlavorName}/${buildTypeName}" : 37 | "${buildTypeName}" 38 | 39 | // React js bundle directories 40 | def jsBundleDirConfigName = "jsBundleDir${targetName}" 41 | def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?: 42 | file("$buildDir/intermediates/assets/${targetPath}") 43 | 44 | def resourcesDirConfigName = "resourcesDir${targetName}" 45 | def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: 46 | file("$buildDir/intermediates/res/merged/${targetPath}") 47 | def jsBundleFile = file("$jsBundleDir/$bundleAssetName") 48 | 49 | // Bundle task name for variant 50 | def bundleJsAndAssetsTaskName = "bundle${targetName}JsAndAssets" 51 | 52 | def currentBundleTask = tasks.create( 53 | name: bundleJsAndAssetsTaskName, 54 | type: Exec) { 55 | group = "react" 56 | description = "bundle JS and assets for ${targetName}." 57 | 58 | // Create dirs if they are not there (e.g. the "clean" task just ran) 59 | doFirst { 60 | jsBundleDir.mkdirs() 61 | resourcesDir.mkdirs() 62 | } 63 | 64 | // Set up inputs and outputs so gradle can cache the result 65 | inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) 66 | outputs.dir jsBundleDir 67 | outputs.dir resourcesDir 68 | 69 | // Set up the call to the react-native cli 70 | workingDir reactRoot 71 | 72 | // Set up dev mode 73 | def devEnabled = !targetName.toLowerCase().contains("release") 74 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 75 | commandLine "cmd", "/c", "node", "node_modules/react-native/local-cli/cli.js", "bundle", "--platform", "android", "--dev", "${devEnabled}", 76 | "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir 77 | } else { 78 | commandLine "node", "node_modules/react-native/local-cli/cli.js", "bundle", "--platform", "android", "--dev", "${devEnabled}", 79 | "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir 80 | } 81 | 82 | enabled config."bundleIn${targetName}" || 83 | config."bundleIn${buildTypeName.capitalize()}" ?: 84 | targetName.toLowerCase().contains("release") 85 | } 86 | 87 | // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process 88 | currentBundleTask.dependsOn("merge${targetName}Resources") 89 | currentBundleTask.dependsOn("merge${targetName}Assets") 90 | 91 | runBefore("processArmeabi-v7a${targetName}Resources", currentBundleTask) 92 | runBefore("processX86${targetName}Resources", currentBundleTask) 93 | runBefore("processUniversal${targetName}Resources", currentBundleTask) 94 | runBefore("process${targetName}Resources", currentBundleTask) 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/utf8map/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.utf8map; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.facebook.react.ReactPackage; 5 | import com.facebook.react.shell.MainReactPackage; 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | public class MainActivity extends ReactActivity { 11 | 12 | /** 13 | * Returns the name of the main component registered from JavaScript. 14 | * This is used to schedule rendering of the component. 15 | */ 16 | @Override 17 | protected String getMainComponentName() { 18 | return "UTF8Map"; 19 | } 20 | 21 | /** 22 | * Returns whether dev mode should be enabled. 23 | * This enables e.g. the dev menu. 24 | */ 25 | @Override 26 | protected boolean getUseDeveloperSupport() { 27 | return BuildConfig.DEBUG; 28 | } 29 | 30 | /** 31 | * A list of packages used by the app. If the app uses additional views 32 | * or modules besides the default ones, add more packages here. 33 | */ 34 | @Override 35 | protected List getPackages() { 36 | return Arrays.asList( 37 | new MainReactPackage() 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/drawable-hdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/drawable-mdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/drawable-xhdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/drawable-xxxhdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | UTF8Map 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$projectDir/../../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'UTF8Map' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /cordova/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | UTF8Map 4 | 5 | A sample Apache Cordova application that responds to the deviceready event. 6 | 7 | 8 | Apache Cordova Team 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /cordova/hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | 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. 24 | -------------------------------------------------------------------------------- /cordova/platforms/android/.gitignore: -------------------------------------------------------------------------------- 1 | # Non-project-specific build files: 2 | build.xml 3 | local.properties 4 | /gradlew 5 | /gradlew.bat 6 | /gradle 7 | # Ant builds 8 | ant-build 9 | ant-gen 10 | # Eclipse builds 11 | gen 12 | out 13 | # Gradle builds 14 | /build 15 | -------------------------------------------------------------------------------- /cordova/platforms/android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/build.gradle: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one 2 | or more contributor license agreements. See the NOTICE file 3 | distributed with this work for additional information 4 | regarding copyright ownership. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, 12 | software distributed under the License is distributed on an 13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | KIND, either express or implied. See the License for the 15 | specific language governing permissions and limitations 16 | under the License. 17 | */ 18 | 19 | 20 | 21 | buildscript { 22 | repositories { 23 | mavenCentral() 24 | } 25 | 26 | dependencies { 27 | classpath 'com.android.tools.build:gradle:1.5.0' 28 | } 29 | 30 | } 31 | 32 | apply plugin: 'android-library' 33 | 34 | ext { 35 | apply from: 'cordova.gradle' 36 | cdvCompileSdkVersion = privateHelpers.getProjectTarget() 37 | cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools() 38 | } 39 | 40 | android { 41 | compileSdkVersion cdvCompileSdkVersion 42 | buildToolsVersion cdvBuildToolsVersion 43 | publishNonDefault true 44 | 45 | compileOptions { 46 | sourceCompatibility JavaVersion.VERSION_1_6 47 | targetCompatibility JavaVersion.VERSION_1_6 48 | } 49 | 50 | sourceSets { 51 | main { 52 | manifest.srcFile 'AndroidManifest.xml' 53 | java.srcDirs = ['src'] 54 | resources.srcDirs = ['src'] 55 | aidl.srcDirs = ['src'] 56 | renderscript.srcDirs = ['src'] 57 | res.srcDirs = ['res'] 58 | assets.srcDirs = ['assets'] 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Indicates whether an apk should be generated for each density. 11 | split.density=false 12 | # Project target. 13 | target=android-23 14 | apk-configurations= 15 | renderscript.opt.level=O0 16 | android.library=true 17 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/AuthenticationToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | /** 22 | * The Class AuthenticationToken defines the userName and password to be used for authenticating a web resource 23 | */ 24 | public class AuthenticationToken { 25 | private String userName; 26 | private String password; 27 | 28 | /** 29 | * Gets the user name. 30 | * 31 | * @return the user name 32 | */ 33 | public String getUserName() { 34 | return userName; 35 | } 36 | 37 | /** 38 | * Sets the user name. 39 | * 40 | * @param userName 41 | * the new user name 42 | */ 43 | public void setUserName(String userName) { 44 | this.userName = userName; 45 | } 46 | 47 | /** 48 | * Gets the password. 49 | * 50 | * @return the password 51 | */ 52 | public String getPassword() { 53 | return password; 54 | } 55 | 56 | /** 57 | * Sets the password. 58 | * 59 | * @param password 60 | * the new password 61 | */ 62 | public void setPassword(String password) { 63 | this.password = password; 64 | } 65 | 66 | 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/Config.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova; 21 | 22 | import java.util.List; 23 | 24 | import android.app.Activity; 25 | import android.util.Log; 26 | 27 | @Deprecated // Use Whitelist, CordovaPrefences, etc. directly. 28 | public class Config { 29 | private static final String TAG = "Config"; 30 | 31 | static ConfigXmlParser parser; 32 | 33 | private Config() { 34 | } 35 | 36 | public static void init(Activity action) { 37 | parser = new ConfigXmlParser(); 38 | parser.parse(action); 39 | //TODO: Add feature to bring this back. Some preferences should be overridden by intents, but not all 40 | parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras()); 41 | } 42 | 43 | // Intended to be used for testing only; creates an empty configuration. 44 | public static void init() { 45 | if (parser == null) { 46 | parser = new ConfigXmlParser(); 47 | } 48 | } 49 | 50 | public static String getStartUrl() { 51 | if (parser == null) { 52 | return "file:///android_asset/www/index.html"; 53 | } 54 | return parser.getLaunchUrl(); 55 | } 56 | 57 | public static String getErrorUrl() { 58 | return parser.getPreferences().getString("errorurl", null); 59 | } 60 | 61 | public static List getPluginEntries() { 62 | return parser.getPluginEntries(); 63 | } 64 | 65 | public static CordovaPreferences getPreferences() { 66 | return parser.getPreferences(); 67 | } 68 | 69 | public static boolean isInitialized() { 70 | return parser != null; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaArgs.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import org.json.JSONArray; 22 | import org.json.JSONException; 23 | import org.json.JSONObject; 24 | 25 | import android.util.Base64; 26 | 27 | public class CordovaArgs { 28 | private JSONArray baseArgs; 29 | 30 | public CordovaArgs(JSONArray args) { 31 | this.baseArgs = args; 32 | } 33 | 34 | 35 | // Pass through the basics to the base args. 36 | public Object get(int index) throws JSONException { 37 | return baseArgs.get(index); 38 | } 39 | 40 | public boolean getBoolean(int index) throws JSONException { 41 | return baseArgs.getBoolean(index); 42 | } 43 | 44 | public double getDouble(int index) throws JSONException { 45 | return baseArgs.getDouble(index); 46 | } 47 | 48 | public int getInt(int index) throws JSONException { 49 | return baseArgs.getInt(index); 50 | } 51 | 52 | public JSONArray getJSONArray(int index) throws JSONException { 53 | return baseArgs.getJSONArray(index); 54 | } 55 | 56 | public JSONObject getJSONObject(int index) throws JSONException { 57 | return baseArgs.getJSONObject(index); 58 | } 59 | 60 | public long getLong(int index) throws JSONException { 61 | return baseArgs.getLong(index); 62 | } 63 | 64 | public String getString(int index) throws JSONException { 65 | return baseArgs.getString(index); 66 | } 67 | 68 | 69 | public Object opt(int index) { 70 | return baseArgs.opt(index); 71 | } 72 | 73 | public boolean optBoolean(int index) { 74 | return baseArgs.optBoolean(index); 75 | } 76 | 77 | public double optDouble(int index) { 78 | return baseArgs.optDouble(index); 79 | } 80 | 81 | public int optInt(int index) { 82 | return baseArgs.optInt(index); 83 | } 84 | 85 | public JSONArray optJSONArray(int index) { 86 | return baseArgs.optJSONArray(index); 87 | } 88 | 89 | public JSONObject optJSONObject(int index) { 90 | return baseArgs.optJSONObject(index); 91 | } 92 | 93 | public long optLong(int index) { 94 | return baseArgs.optLong(index); 95 | } 96 | 97 | public String optString(int index) { 98 | return baseArgs.optString(index); 99 | } 100 | 101 | public boolean isNull(int index) { 102 | return baseArgs.isNull(index); 103 | } 104 | 105 | 106 | // The interesting custom helpers. 107 | public byte[] getArrayBuffer(int index) throws JSONException { 108 | String encoded = baseArgs.getString(index); 109 | return Base64.decode(encoded, Base64.DEFAULT); 110 | } 111 | } 112 | 113 | 114 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import java.security.Principal; 22 | import java.security.PrivateKey; 23 | import java.security.cert.X509Certificate; 24 | 25 | import android.webkit.ClientCertRequest; 26 | 27 | /** 28 | * Implementation of the ICordovaClientCertRequest for Android WebView. 29 | */ 30 | public class CordovaClientCertRequest implements ICordovaClientCertRequest { 31 | 32 | private final ClientCertRequest request; 33 | 34 | public CordovaClientCertRequest(ClientCertRequest request) { 35 | this.request = request; 36 | } 37 | 38 | /** 39 | * Cancel this request 40 | */ 41 | public void cancel() 42 | { 43 | request.cancel(); 44 | } 45 | 46 | /* 47 | * Returns the host name of the server requesting the certificate. 48 | */ 49 | public String getHost() 50 | { 51 | return request.getHost(); 52 | } 53 | 54 | /* 55 | * Returns the acceptable types of asymmetric keys (can be null). 56 | */ 57 | public String[] getKeyTypes() 58 | { 59 | return request.getKeyTypes(); 60 | } 61 | 62 | /* 63 | * Returns the port number of the server requesting the certificate. 64 | */ 65 | public int getPort() 66 | { 67 | return request.getPort(); 68 | } 69 | 70 | /* 71 | * Returns the acceptable certificate issuers for the certificate matching the private key (can be null). 72 | */ 73 | public Principal[] getPrincipals() 74 | { 75 | return request.getPrincipals(); 76 | } 77 | 78 | /* 79 | * Ignore the request for now. Do not remember user's choice. 80 | */ 81 | public void ignore() 82 | { 83 | request.ignore(); 84 | } 85 | 86 | /* 87 | * Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests. 88 | * 89 | * @param privateKey The privateKey 90 | * @param chain The certificate chain 91 | */ 92 | public void proceed(PrivateKey privateKey, X509Certificate[] chain) 93 | { 94 | request.proceed(privateKey, chain); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaHttpAuthHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import android.webkit.HttpAuthHandler; 22 | 23 | /** 24 | * Specifies interface for HTTP auth handler object which is used to handle auth requests and 25 | * specifying user credentials. 26 | */ 27 | public class CordovaHttpAuthHandler implements ICordovaHttpAuthHandler { 28 | 29 | private final HttpAuthHandler handler; 30 | 31 | public CordovaHttpAuthHandler(HttpAuthHandler handler) { 32 | this.handler = handler; 33 | } 34 | 35 | /** 36 | * Instructs the WebView to cancel the authentication request. 37 | */ 38 | public void cancel () { 39 | this.handler.cancel(); 40 | } 41 | 42 | /** 43 | * Instructs the WebView to proceed with the authentication with the given credentials. 44 | * 45 | * @param username 46 | * @param password 47 | */ 48 | public void proceed (String username, String password) { 49 | this.handler.proceed(username, password); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import android.app.Activity; 22 | import android.content.Intent; 23 | 24 | import org.apache.cordova.CordovaPlugin; 25 | 26 | import java.util.concurrent.ExecutorService; 27 | 28 | /** 29 | * The Activity interface that is implemented by CordovaActivity. 30 | * It is used to isolate plugin development, and remove dependency on entire Cordova library. 31 | */ 32 | public interface CordovaInterface { 33 | 34 | /** 35 | * Launch an activity for which you would like a result when it finished. When this activity exits, 36 | * your onActivityResult() method will be called. 37 | * 38 | * @param command The command object 39 | * @param intent The intent to start 40 | * @param requestCode The request code that is passed to callback to identify the activity 41 | */ 42 | abstract public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode); 43 | 44 | /** 45 | * Set the plugin to be called when a sub-activity exits. 46 | * 47 | * @param plugin The plugin on which onActivityResult is to be called 48 | */ 49 | abstract public void setActivityResultCallback(CordovaPlugin plugin); 50 | 51 | /** 52 | * Get the Android activity. 53 | * 54 | * @return the Activity 55 | */ 56 | public abstract Activity getActivity(); 57 | 58 | 59 | /** 60 | * Called when a message is sent to plugin. 61 | * 62 | * @param id The message id 63 | * @param data The message data 64 | * @return Object or null 65 | */ 66 | public Object onMessage(String id, Object data); 67 | 68 | /** 69 | * Returns a shared thread pool that can be used for background tasks. 70 | */ 71 | public ExecutorService getThreadPool(); 72 | 73 | /** 74 | * Sends a permission request to the activity for one permission. 75 | */ 76 | public void requestPermission(CordovaPlugin plugin, int requestCode, String permission); 77 | 78 | /** 79 | * Sends a permission request to the activity for a group of permissions 80 | */ 81 | public void requestPermissions(CordovaPlugin plugin, int requestCode, String [] permissions); 82 | 83 | /** 84 | * Check for a permission. Returns true if the permission is granted, false otherwise. 85 | */ 86 | public boolean hasPermission(String permission); 87 | 88 | } 89 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaPreferences.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova; 21 | 22 | import java.util.HashMap; 23 | import java.util.Locale; 24 | import java.util.Map; 25 | 26 | import org.apache.cordova.LOG; 27 | 28 | import android.app.Activity; 29 | import android.os.Bundle; 30 | 31 | public class CordovaPreferences { 32 | private HashMap prefs = new HashMap(20); 33 | private Bundle preferencesBundleExtras; 34 | 35 | public void setPreferencesBundle(Bundle extras) { 36 | preferencesBundleExtras = extras; 37 | } 38 | 39 | public void set(String name, String value) { 40 | prefs.put(name.toLowerCase(Locale.ENGLISH), value); 41 | } 42 | 43 | public void set(String name, boolean value) { 44 | set(name, "" + value); 45 | } 46 | 47 | public void set(String name, int value) { 48 | set(name, "" + value); 49 | } 50 | 51 | public void set(String name, double value) { 52 | set(name, "" + value); 53 | } 54 | 55 | public Map getAll() { 56 | return prefs; 57 | } 58 | 59 | public boolean getBoolean(String name, boolean defaultValue) { 60 | name = name.toLowerCase(Locale.ENGLISH); 61 | String value = prefs.get(name); 62 | if (value != null) { 63 | return Boolean.parseBoolean(value); 64 | } 65 | return defaultValue; 66 | } 67 | 68 | // Added in 4.0.0 69 | public boolean contains(String name) { 70 | return getString(name, null) != null; 71 | } 72 | 73 | public int getInteger(String name, int defaultValue) { 74 | name = name.toLowerCase(Locale.ENGLISH); 75 | String value = prefs.get(name); 76 | if (value != null) { 77 | // Use Integer.decode() can't handle it if the highest bit is set. 78 | return (int)(long)Long.decode(value); 79 | } 80 | return defaultValue; 81 | } 82 | 83 | public double getDouble(String name, double defaultValue) { 84 | name = name.toLowerCase(Locale.ENGLISH); 85 | String value = prefs.get(name); 86 | if (value != null) { 87 | return Double.valueOf(value); 88 | } 89 | return defaultValue; 90 | } 91 | 92 | public String getString(String name, String defaultValue) { 93 | name = name.toLowerCase(Locale.ENGLISH); 94 | String value = prefs.get(name); 95 | if (value != null) { 96 | return value; 97 | } 98 | return defaultValue; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewEngine.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import android.view.KeyEvent; 22 | import android.view.View; 23 | 24 | /** 25 | * Interface for all Cordova engines. 26 | * No methods will be added to this class (in order to be compatible with existing engines). 27 | * Instead, we will create a new interface: e.g. CordovaWebViewEngineV2 28 | */ 29 | public interface CordovaWebViewEngine { 30 | void init(CordovaWebView parentWebView, CordovaInterface cordova, Client client, 31 | CordovaResourceApi resourceApi, PluginManager pluginManager, 32 | NativeToJsMessageQueue nativeToJsMessageQueue); 33 | 34 | CordovaWebView getCordovaWebView(); 35 | ICordovaCookieManager getCookieManager(); 36 | View getView(); 37 | 38 | void loadUrl(String url, boolean clearNavigationStack); 39 | 40 | void stopLoading(); 41 | 42 | /** Return the currently loaded URL */ 43 | String getUrl(); 44 | 45 | void clearCache(); 46 | 47 | /** After calling clearHistory(), canGoBack() should be false. */ 48 | void clearHistory(); 49 | 50 | boolean canGoBack(); 51 | 52 | /** Returns whether a navigation occurred */ 53 | boolean goBack(); 54 | 55 | /** Pauses / resumes the WebView's event loop. */ 56 | void setPaused(boolean value); 57 | 58 | /** Clean up all resources associated with the WebView. */ 59 | void destroy(); 60 | 61 | /** 62 | * Used to retrieve the associated CordovaWebView given a View without knowing the type of Engine. 63 | * E.g. ((CordovaWebView.EngineView)activity.findViewById(android.R.id.webView)).getCordovaWebView(); 64 | */ 65 | public interface EngineView { 66 | CordovaWebView getCordovaWebView(); 67 | } 68 | 69 | /** 70 | * Contains methods that an engine uses to communicate with the parent CordovaWebView. 71 | * Methods may be added in future cordova versions, but never removed. 72 | */ 73 | public interface Client { 74 | Boolean onDispatchKeyEvent(KeyEvent event); 75 | void clearLoadTimeoutTimer(); 76 | void onPageStarted(String newUrl); 77 | void onReceivedError(int errorCode, String description, String failingUrl); 78 | void onPageFinishedLoading(String url); 79 | boolean onNavigationAttempt(String url); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/ExposedJsApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova; 21 | 22 | import org.json.JSONException; 23 | 24 | /* 25 | * Any exposed Javascript API MUST implement these three things! 26 | */ 27 | public interface ExposedJsApi { 28 | public String exec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException; 29 | public void setNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException; 30 | public String retrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException; 31 | } 32 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/ICordovaClientCertRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import java.security.Principal; 22 | import java.security.PrivateKey; 23 | import java.security.cert.X509Certificate; 24 | 25 | /** 26 | * Specifies interface for handling certificate requests. 27 | */ 28 | public interface ICordovaClientCertRequest { 29 | /** 30 | * Cancel this request 31 | */ 32 | public void cancel(); 33 | 34 | /* 35 | * Returns the host name of the server requesting the certificate. 36 | */ 37 | public String getHost(); 38 | 39 | /* 40 | * Returns the acceptable types of asymmetric keys (can be null). 41 | */ 42 | public String[] getKeyTypes(); 43 | 44 | /* 45 | * Returns the port number of the server requesting the certificate. 46 | */ 47 | public int getPort(); 48 | 49 | /* 50 | * Returns the acceptable certificate issuers for the certificate matching the private key (can be null). 51 | */ 52 | public Principal[] getPrincipals(); 53 | 54 | /* 55 | * Ignore the request for now. Do not remember user's choice. 56 | */ 57 | public void ignore(); 58 | 59 | /* 60 | * Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests. 61 | * 62 | * @param privateKey The privateKey 63 | * @param chain The certificate chain 64 | */ 65 | public void proceed(PrivateKey privateKey, X509Certificate[] chain); 66 | } -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/ICordovaCookieManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova; 21 | 22 | public interface ICordovaCookieManager { 23 | 24 | public void setCookiesEnabled(boolean accept); 25 | 26 | public void setCookie(final String url, final String value); 27 | 28 | public String getCookie(final String url); 29 | 30 | public void clearCookies(); 31 | 32 | public void flush(); 33 | }; 34 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/ICordovaHttpAuthHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | /** 22 | * Specifies interface for HTTP auth handler object which is used to handle auth requests and 23 | * specifying user credentials. 24 | */ 25 | public interface ICordovaHttpAuthHandler { 26 | /** 27 | * Instructs the WebView to cancel the authentication request. 28 | */ 29 | public void cancel (); 30 | 31 | /** 32 | * Instructs the WebView to proceed with the authentication with the given credentials. 33 | * 34 | * @param username The user name 35 | * @param password The password 36 | */ 37 | public void proceed (String username, String password); 38 | } -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/PluginEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | import org.apache.cordova.CordovaPlugin; 22 | 23 | /** 24 | * This class represents a service entry object. 25 | */ 26 | public final class PluginEntry { 27 | 28 | /** 29 | * The name of the service that this plugin implements 30 | */ 31 | public final String service; 32 | 33 | /** 34 | * The plugin class name that implements the service. 35 | */ 36 | public final String pluginClass; 37 | 38 | /** 39 | * The pre-instantiated plugin to use for this entry. 40 | */ 41 | public final CordovaPlugin plugin; 42 | 43 | /** 44 | * Flag that indicates the plugin object should be created when PluginManager is initialized. 45 | */ 46 | public final boolean onload; 47 | 48 | /** 49 | * Constructs with a CordovaPlugin already instantiated. 50 | */ 51 | public PluginEntry(String service, CordovaPlugin plugin) { 52 | this(service, plugin.getClass().getName(), true, plugin); 53 | } 54 | 55 | /** 56 | * @param service The name of the service 57 | * @param pluginClass The plugin class name 58 | * @param onload Create plugin object when HTML page is loaded 59 | */ 60 | public PluginEntry(String service, String pluginClass, boolean onload) { 61 | this(service, pluginClass, onload, null); 62 | } 63 | 64 | private PluginEntry(String service, String pluginClass, boolean onload, CordovaPlugin plugin) { 65 | this.service = service; 66 | this.pluginClass = pluginClass; 67 | this.onload = onload; 68 | this.plugin = plugin; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova; 20 | 21 | 22 | import org.json.JSONException; 23 | import org.json.JSONObject; 24 | 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | public class ResumeCallback extends CallbackContext { 29 | private final String TAG = "CordovaResumeCallback"; 30 | private String serviceName; 31 | private PluginManager pluginManager; 32 | 33 | public ResumeCallback(String serviceName, PluginManager pluginManager) { 34 | super("resumecallback", null); 35 | this.serviceName = serviceName; 36 | this.pluginManager = pluginManager; 37 | } 38 | 39 | @Override 40 | public void sendPluginResult(PluginResult pluginResult) { 41 | synchronized (this) { 42 | if (finished) { 43 | LOG.w(TAG, serviceName + " attempted to send a second callback to ResumeCallback\nResult was: " + pluginResult.getMessage()); 44 | return; 45 | } else { 46 | finished = true; 47 | } 48 | } 49 | 50 | JSONObject event = new JSONObject(); 51 | JSONObject pluginResultObject = new JSONObject(); 52 | 53 | try { 54 | pluginResultObject.put("pluginServiceName", this.serviceName); 55 | pluginResultObject.put("pluginStatus", PluginResult.StatusMessages[pluginResult.getStatus()]); 56 | 57 | event.put("action", "resume"); 58 | event.put("pendingResult", pluginResultObject); 59 | } catch (JSONException e) { 60 | LOG.e(TAG, "Unable to create resume object for Activity Result"); 61 | } 62 | 63 | PluginResult eventResult = new PluginResult(PluginResult.Status.OK, event); 64 | 65 | // We send a list of results to the js so that we don't have to decode 66 | // the PluginResult passed to this CallbackContext into JSON twice. 67 | // The results are combined into an event payload before the event is 68 | // fired on the js side of things (see platform.js) 69 | List result = new ArrayList(); 70 | result.add(eventResult); 71 | result.add(pluginResult); 72 | 73 | CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); 74 | appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result)); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova.engine; 21 | 22 | import android.annotation.TargetApi; 23 | import android.os.Build; 24 | import android.webkit.CookieManager; 25 | import android.webkit.WebView; 26 | 27 | import org.apache.cordova.ICordovaCookieManager; 28 | 29 | class SystemCookieManager implements ICordovaCookieManager { 30 | 31 | protected final WebView webView; 32 | private final CookieManager cookieManager; 33 | 34 | //Added because lint can't see the conditional RIGHT ABOVE this 35 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 36 | public SystemCookieManager(WebView webview) { 37 | webView = webview; 38 | cookieManager = CookieManager.getInstance(); 39 | 40 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 41 | cookieManager.setAcceptThirdPartyCookies(webView, true); 42 | } 43 | } 44 | 45 | public void setCookiesEnabled(boolean accept) { 46 | cookieManager.setAcceptCookie(accept); 47 | } 48 | 49 | public void setCookie(final String url, final String value) { 50 | cookieManager.setCookie(url, value); 51 | } 52 | 53 | public String getCookie(final String url) { 54 | return cookieManager.getCookie(url); 55 | } 56 | 57 | public void clearCookies() { 58 | cookieManager.removeAllCookie(); 59 | } 60 | 61 | public void flush() { 62 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 63 | cookieManager.flush(); 64 | } 65 | } 66 | }; 67 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemExposedJsApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | package org.apache.cordova.engine; 20 | 21 | import android.webkit.JavascriptInterface; 22 | 23 | import org.apache.cordova.CordovaBridge; 24 | import org.apache.cordova.ExposedJsApi; 25 | import org.json.JSONException; 26 | 27 | /** 28 | * Contains APIs that the JS can call. All functions in here should also have 29 | * an equivalent entry in CordovaChromeClient.java, and be added to 30 | * cordova-js/lib/android/plugin/android/promptbasednativeapi.js 31 | */ 32 | class SystemExposedJsApi implements ExposedJsApi { 33 | private final CordovaBridge bridge; 34 | 35 | SystemExposedJsApi(CordovaBridge bridge) { 36 | this.bridge = bridge; 37 | } 38 | 39 | @JavascriptInterface 40 | public String exec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException { 41 | return bridge.jsExec(bridgeSecret, service, action, callbackId, arguments); 42 | } 43 | 44 | @JavascriptInterface 45 | public void setNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException { 46 | bridge.jsSetNativeToJsBridgeMode(bridgeSecret, value); 47 | } 48 | 49 | @JavascriptInterface 50 | public String retrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException { 51 | return bridge.jsRetrieveJsMessages(bridgeSecret, fromOnlineEvent); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package org.apache.cordova.engine; 21 | 22 | import android.content.Context; 23 | import android.util.AttributeSet; 24 | import android.view.KeyEvent; 25 | import android.webkit.WebChromeClient; 26 | import android.webkit.WebView; 27 | import android.webkit.WebViewClient; 28 | 29 | import org.apache.cordova.CordovaInterface; 30 | import org.apache.cordova.CordovaWebView; 31 | import org.apache.cordova.CordovaWebViewEngine; 32 | 33 | /** 34 | * Custom WebView subclass that enables us to capture events needed for Cordova. 35 | */ 36 | public class SystemWebView extends WebView implements CordovaWebViewEngine.EngineView { 37 | private SystemWebViewClient viewClient; 38 | SystemWebChromeClient chromeClient; 39 | private SystemWebViewEngine parentEngine; 40 | private CordovaInterface cordova; 41 | 42 | public SystemWebView(Context context) { 43 | this(context, null); 44 | } 45 | 46 | public SystemWebView(Context context, AttributeSet attrs) { 47 | super(context, attrs); 48 | } 49 | 50 | // Package visibility to enforce that only SystemWebViewEngine should call this method. 51 | void init(SystemWebViewEngine parentEngine, CordovaInterface cordova) { 52 | this.cordova = cordova; 53 | this.parentEngine = parentEngine; 54 | if (this.viewClient == null) { 55 | setWebViewClient(new SystemWebViewClient(parentEngine)); 56 | } 57 | 58 | if (this.chromeClient == null) { 59 | setWebChromeClient(new SystemWebChromeClient(parentEngine)); 60 | } 61 | } 62 | 63 | @Override 64 | public CordovaWebView getCordovaWebView() { 65 | return parentEngine != null ? parentEngine.getCordovaWebView() : null; 66 | } 67 | 68 | @Override 69 | public void setWebViewClient(WebViewClient client) { 70 | viewClient = (SystemWebViewClient)client; 71 | super.setWebViewClient(client); 72 | } 73 | 74 | @Override 75 | public void setWebChromeClient(WebChromeClient client) { 76 | chromeClient = (SystemWebChromeClient)client; 77 | super.setWebChromeClient(client); 78 | } 79 | 80 | @Override 81 | public boolean dispatchKeyEvent(KeyEvent event) { 82 | Boolean ret = parentEngine.client.onDispatchKeyEvent(event); 83 | if (ret != null) { 84 | return ret.booleanValue(); 85 | } 86 | return super.dispatchKeyEvent(event); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /cordova/platforms/android/android.json: -------------------------------------------------------------------------------- 1 | { 2 | "prepare_queue": { 3 | "installed": [], 4 | "uninstalled": [] 5 | }, 6 | "config_munge": { 7 | "files": { 8 | "res/xml/config.xml": { 9 | "parents": { 10 | "/*": [ 11 | { 12 | "xml": "", 13 | "count": 1 14 | } 15 | ] 16 | } 17 | } 18 | } 19 | }, 20 | "installed_plugins": { 21 | "cordova-plugin-whitelist": { 22 | "PACKAGE_NAME": "it.UTF8Map" 23 | } 24 | }, 25 | "dependent_plugins": {}, 26 | "modules": [ 27 | { 28 | "file": "plugins/cordova-plugin-whitelist/whitelist.js", 29 | "id": "cordova-plugin-whitelist.whitelist", 30 | "runs": true 31 | } 32 | ], 33 | "plugin_metadata": { 34 | "cordova-plugin-whitelist": "1.2.1" 35 | } 36 | } -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/cordova-js-src/android/nativeapiprovider.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi. 22 | */ 23 | 24 | var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi'); 25 | var currentApi = nativeApi; 26 | 27 | module.exports = { 28 | get: function() { return currentApi; }, 29 | setPreferPrompt: function(value) { 30 | currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi; 31 | }, 32 | // Used only by tests. 33 | set: function(value) { 34 | currentApi = value; 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/cordova-js-src/android/promptbasednativeapi.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * Implements the API of ExposedJsApi.java, but uses prompt() to communicate. 22 | * This is used pre-JellyBean, where addJavascriptInterface() is disabled. 23 | */ 24 | 25 | module.exports = { 26 | exec: function(bridgeSecret, service, action, callbackId, argsJson) { 27 | return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId])); 28 | }, 29 | setNativeToJsBridgeMode: function(bridgeSecret, value) { 30 | prompt(value, 'gap_bridge_mode:' + bridgeSecret); 31 | }, 32 | retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) { 33 | return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/cordova-js-src/plugin/android/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | var exec = require('cordova/exec'); 23 | var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; 24 | 25 | module.exports = { 26 | /** 27 | * Clear the resource cache. 28 | */ 29 | clearCache:function() { 30 | exec(null, null, APP_PLUGIN_NAME, "clearCache", []); 31 | }, 32 | 33 | /** 34 | * Load the url into the webview or into new browser instance. 35 | * 36 | * @param url The URL to load 37 | * @param props Properties that can be passed in to the activity: 38 | * wait: int => wait msec before loading URL 39 | * loadingDialog: "Title,Message" => display a native loading dialog 40 | * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error 41 | * clearHistory: boolean => clear webview history (default=false) 42 | * openExternal: boolean => open in a new browser (default=false) 43 | * 44 | * Example: 45 | * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); 46 | */ 47 | loadUrl:function(url, props) { 48 | exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]); 49 | }, 50 | 51 | /** 52 | * Cancel loadUrl that is waiting to be loaded. 53 | */ 54 | cancelLoadUrl:function() { 55 | exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []); 56 | }, 57 | 58 | /** 59 | * Clear web history in this web view. 60 | * Instead of BACK button loading the previous web page, it will exit the app. 61 | */ 62 | clearHistory:function() { 63 | exec(null, null, APP_PLUGIN_NAME, "clearHistory", []); 64 | }, 65 | 66 | /** 67 | * Go to previous page displayed. 68 | * This is the same as pressing the backbutton on Android device. 69 | */ 70 | backHistory:function() { 71 | exec(null, null, APP_PLUGIN_NAME, "backHistory", []); 72 | }, 73 | 74 | /** 75 | * Override the default behavior of the Android back button. 76 | * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. 77 | * 78 | * Note: The user should not have to call this method. Instead, when the user 79 | * registers for the "backbutton" event, this is automatically done. 80 | * 81 | * @param override T=override, F=cancel override 82 | */ 83 | overrideBackbutton:function(override) { 84 | exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]); 85 | }, 86 | 87 | /** 88 | * Override the default behavior of the Android volume button. 89 | * If overridden, when the volume button is pressed, the "volume[up|down]button" 90 | * JavaScript event will be fired. 91 | * 92 | * Note: The user should not have to call this method. Instead, when the user 93 | * registers for the "volume[up|down]button" event, this is automatically done. 94 | * 95 | * @param button volumeup, volumedown 96 | * @param override T=override, F=cancel override 97 | */ 98 | overrideButton:function(button, override) { 99 | exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]); 100 | }, 101 | 102 | /** 103 | * Exit and terminate the application. 104 | */ 105 | exitApp:function() { 106 | return exec(null, null, APP_PLUGIN_NAME, "exitApp", []); 107 | } 108 | }; 109 | -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/cordova_plugins.js: -------------------------------------------------------------------------------- 1 | cordova.define('cordova/plugin_list', function(require, exports, module) { 2 | module.exports = [ 3 | { 4 | "file": "plugins/cordova-plugin-whitelist/whitelist.js", 5 | "id": "cordova-plugin-whitelist.whitelist", 6 | "runs": true 7 | } 8 | ]; 9 | module.exports.metadata = 10 | // TOP OF METADATA 11 | { 12 | "cordova-plugin-whitelist": "1.2.1" 13 | }; 14 | // BOTTOM OF METADATA 15 | }); -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | * { 20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 21 | } 22 | 23 | body { 24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 27 | background-color:#E4E4E4; 28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 31 | background-image:-webkit-gradient( 32 | linear, 33 | left top, 34 | left bottom, 35 | color-stop(0, #A7A7A7), 36 | color-stop(0.51, #E4E4E4) 37 | ); 38 | background-attachment:fixed; 39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 40 | font-size:12px; 41 | height:100%; 42 | margin:0px; 43 | padding:0px; 44 | text-transform:uppercase; 45 | width:100%; 46 | } 47 | 48 | /* Portrait layout (default) */ 49 | .app { 50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ 51 | position:absolute; /* position in the center of the screen */ 52 | left:50%; 53 | top:50%; 54 | height:50px; /* text area height */ 55 | width:225px; /* text area width */ 56 | text-align:center; 57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ 58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ 59 | /* offset horizontal: half of text area width */ 60 | } 61 | 62 | /* Landscape layout (with min-width) */ 63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { 64 | .app { 65 | background-position:left center; 66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ 67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ 68 | /* offset horizontal: half of image width and text area width */ 69 | } 70 | } 71 | 72 | h1 { 73 | font-size:24px; 74 | font-weight:normal; 75 | margin:0px; 76 | overflow:visible; 77 | padding:0px; 78 | text-align:center; 79 | } 80 | 81 | .event { 82 | border-radius:4px; 83 | -webkit-border-radius:4px; 84 | color:#FFFFFF; 85 | font-size:12px; 86 | margin:0px 30px; 87 | padding:2px 0px; 88 | } 89 | 90 | .event.listening { 91 | background-color:#333333; 92 | display:block; 93 | } 94 | 95 | .event.received { 96 | background-color:#4B946A; 97 | display:none; 98 | } 99 | 100 | @keyframes fade { 101 | from { opacity: 1.0; } 102 | 50% { opacity: 0.4; } 103 | to { opacity: 1.0; } 104 | } 105 | 106 | @-webkit-keyframes fade { 107 | from { opacity: 1.0; } 108 | 50% { opacity: 0.4; } 109 | to { opacity: 1.0; } 110 | } 111 | 112 | .blink { 113 | animation:fade 3000ms infinite; 114 | -webkit-animation:fade 3000ms infinite; 115 | } 116 | -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/assets/www/img/logo.png -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Hello World 38 | 39 | 40 |
41 |

Apache Cordova

42 | 46 |
47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | this.bindEvents(); 23 | }, 24 | // Bind Event Listeners 25 | // 26 | // Bind any events that are required on startup. Common events are: 27 | // 'load', 'deviceready', 'offline', and 'online'. 28 | bindEvents: function() { 29 | document.addEventListener('deviceready', this.onDeviceReady, false); 30 | }, 31 | // deviceready Event Handler 32 | // 33 | // The scope of 'this' is the event. In order to call the 'receivedEvent' 34 | // function, we must explicitly call 'app.receivedEvent(...);' 35 | onDeviceReady: function() { 36 | app.receivedEvent('deviceready'); 37 | // window.location="http://192.168.1.5:3000"; 38 | window.open("http://192.168.1.5:3000", "_blank", "location=no,hidden=yes"); 39 | }, 40 | // Update DOM on a Received Event 41 | receivedEvent: function(id) { 42 | var parentElement = document.getElementById(id); 43 | var listeningElement = parentElement.querySelector('.listening'); 44 | var receivedElement = parentElement.querySelector('.received'); 45 | 46 | listeningElement.setAttribute('style', 'display:none;'); 47 | receivedElement.setAttribute('style', 'display:block;'); 48 | 49 | console.log('Received Event: ' + id); 50 | } 51 | }; 52 | 53 | app.initialize(); 54 | -------------------------------------------------------------------------------- /cordova/platforms/android/assets/www/plugins/cordova-plugin-whitelist/whitelist.js: -------------------------------------------------------------------------------- 1 | cordova.define("cordova-plugin-whitelist.whitelist", function(require, exports, module) { 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | if (!document.querySelector('meta[http-equiv=Content-Security-Policy]')) { 23 | var msg = 'No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.'; 24 | console.error(msg); 25 | setInterval(function() { 26 | console.warn(msg); 27 | }, 10000); 28 | } 29 | 30 | }); 31 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true 3 | , "bitwise": true 4 | , "undef": true 5 | , "trailing": true 6 | , "quotmark": true 7 | , "indent": 4 8 | , "unused": "vars" 9 | , "latedef": "nofunc" 10 | } 11 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/android_sdk_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var android_sdk_version = require('./lib/android_sdk_version'); 23 | 24 | android_sdk_version.run().done(null, function(err) { 25 | console.log(err); 26 | process.exit(2); 27 | }); 28 | 29 | 30 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var args = process.argv; 23 | var Api = require('./Api'); 24 | var nopt = require('nopt'); 25 | var path = require('path'); 26 | 27 | // Support basic help commands 28 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) 29 | require('./lib/build').help(); 30 | 31 | // Do some basic argument parsing 32 | var buildOpts = nopt({ 33 | 'verbose' : Boolean, 34 | 'silent' : Boolean, 35 | 'debug' : Boolean, 36 | 'release' : Boolean, 37 | 'nobuild': Boolean, 38 | 'buildConfig' : path 39 | }, { 'd' : '--verbose' }); 40 | 41 | // Make buildOptions compatible with PlatformApi build method spec 42 | buildOpts.argv = buildOpts.argv.original; 43 | 44 | new Api().build(buildOpts) 45 | .catch(function(err) { 46 | console.error(err.stack); 47 | process.exit(2); 48 | }); 49 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/build.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0build" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/check_reqs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var check_reqs = require('./lib/check_reqs'); 23 | 24 | check_reqs.run().done( 25 | function success() { 26 | console.log('Looks like your environment fully supports cordova-android development!'); 27 | }, function fail(err) { 28 | console.log(err); 29 | process.exit(2); 30 | } 31 | ); 32 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/check_reqs.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0check_reqs" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var Api = require('./Api'); 23 | var path = require('path'); 24 | 25 | // Support basic help commands 26 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { 27 | console.log('Usage: ' + path.relative(process.cwd(), process.argv[1])); 28 | console.log('Cleans the project directory.'); 29 | process.exit(0); 30 | } 31 | 32 | new Api().clean({argv: process.argv.slice(2)}) 33 | .catch(function(err) { 34 | console.error(err.stack); 35 | process.exit(2); 36 | }); 37 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/clean.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0clean" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/Adb.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | var Q = require('q'); 21 | var os = require('os'); 22 | var events = require('cordova-common').events; 23 | var spawn = require('cordova-common').superspawn.spawn; 24 | var CordovaError = require('cordova-common').CordovaError; 25 | 26 | var Adb = {}; 27 | 28 | function isDevice(line) { 29 | return line.match(/\w+\tdevice/) && !line.match(/emulator/); 30 | } 31 | 32 | function isEmulator(line) { 33 | return line.match(/device/) && line.match(/emulator/); 34 | } 35 | 36 | /** 37 | * Lists available/connected devices and emulators 38 | * 39 | * @param {Object} opts Various options 40 | * @param {Boolean} opts.emulators Specifies whether this method returns 41 | * emulators only 42 | * 43 | * @return {Promise} list of available/connected 44 | * devices/emulators 45 | */ 46 | Adb.devices = function (opts) { 47 | return spawn('adb', ['devices'], {cwd: os.tmpdir()}) 48 | .then(function(output) { 49 | return output.split('\n').filter(function (line) { 50 | // Filter out either real devices or emulators, depending on options 51 | return (line && opts && opts.emulators) ? isEmulator(line) : isDevice(line); 52 | }).map(function (line) { 53 | return line.replace(/\tdevice/, '').replace('\r', ''); 54 | }); 55 | }); 56 | }; 57 | 58 | Adb.install = function (target, packagePath, opts) { 59 | events.emit('verbose', 'Installing apk ' + packagePath + ' on ' + target + '...'); 60 | var args = ['-s', target, 'install']; 61 | if (opts && opts.replace) args.push('-r'); 62 | return spawn('adb', args.concat(packagePath), {cwd: os.tmpdir()}) 63 | .then(function(output) { 64 | // 'adb install' seems to always returns no error, even if installation fails 65 | // so we catching output to detect installation failure 66 | if (output.match(/Failure/)) 67 | return Q.reject(new CordovaError('Failed to install apk to device: ' + output)); 68 | }); 69 | }; 70 | 71 | Adb.uninstall = function (target, packageId) { 72 | events.emit('verbose', 'Uninstalling ' + packageId + ' from ' + target + '...'); 73 | return spawn('adb', ['-s', target, 'uninstall', packageId], {cwd: os.tmpdir()}); 74 | }; 75 | 76 | Adb.shell = function (target, shellCommand) { 77 | events.emit('verbose', 'Running command "' + shellCommand + '" on ' + target + '...'); 78 | var args = ['-s', target, 'shell']; 79 | shellCommand = shellCommand.split(/\s+/); 80 | return spawn('adb', args.concat(shellCommand), {cwd: os.tmpdir()}) 81 | .catch(function (output) { 82 | return Q.reject(new CordovaError('Failed to execute shell command "' + 83 | shellCommand + '"" on device: ' + output)); 84 | }); 85 | }; 86 | 87 | Adb.start = function (target, activityName) { 88 | events.emit('verbose', 'Starting application "' + activityName + '" on ' + target + '...'); 89 | return Adb.shell(target, 'am start -W -a android.intent.action.MAIN -n' + activityName) 90 | .catch(function (output) { 91 | return Q.reject(new CordovaError('Failed to start application "' + 92 | activityName + '"" on device: ' + output)); 93 | }); 94 | }; 95 | 96 | module.exports = Adb; 97 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/ConsoleLogger.js: -------------------------------------------------------------------------------- 1 | /** 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | var loggerInstance; 21 | var util = require('util'); 22 | var EventEmitter = require('events').EventEmitter; 23 | var CordovaError = require('cordova-common').CordovaError; 24 | 25 | /** 26 | * @class ConsoleLogger 27 | * @extends EventEmitter 28 | * 29 | * Implementing basic logging for platform. Inherits regular NodeJS 30 | * EventEmitter. All events, emitted on this class instance are immediately 31 | * logged to console. 32 | * 33 | * Also attaches handler to process' uncaught exceptions, so these exceptions 34 | * logged to console similar to regular error events. 35 | */ 36 | function ConsoleLogger() { 37 | EventEmitter.call(this); 38 | 39 | var isVerbose = process.argv.indexOf('-d') >= 0 || process.argv.indexOf('--verbose') >= 0; 40 | // For CordovaError print only the message without stack trace unless we 41 | // are in a verbose mode. 42 | process.on('uncaughtException', function(err){ 43 | if ((err instanceof CordovaError) && isVerbose) { 44 | console.error(err.stack); 45 | } else { 46 | console.error(err.message); 47 | } 48 | process.exit(1); 49 | }); 50 | 51 | this.on('results', console.log); 52 | this.on('verbose', function () { 53 | if (isVerbose) 54 | console.log.apply(console, arguments); 55 | }); 56 | this.on('info', console.log); 57 | this.on('log', console.log); 58 | this.on('warn', console.warn); 59 | } 60 | util.inherits(ConsoleLogger, EventEmitter); 61 | 62 | /** 63 | * Returns already instantiated/newly created instance of ConsoleLogger class. 64 | * This method should be used instead of creating ConsoleLogger directly, 65 | * otherwise we'll get multiple handlers attached to process' 66 | * uncaughtException 67 | * 68 | * @return {ConsoleLogger} New or already created instance of ConsoleLogger 69 | */ 70 | ConsoleLogger.get = function () { 71 | loggerInstance = loggerInstance || new ConsoleLogger(); 72 | return loggerInstance; 73 | }; 74 | 75 | module.exports = ConsoleLogger; 76 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/android_sdk_version.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var child_process = require('child_process'), 23 | Q = require('q'); 24 | 25 | var get_highest_sdk = function(results){ 26 | var reg = /\d+/; 27 | var apiLevels = []; 28 | for(var i=0;i 2) { 26 | var install_target; 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | device.install(install_target).done(null, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | } else { 34 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 35 | process.exit(2); 36 | } 37 | } else { 38 | device.install().done(null, function(err) { 39 | console.error('ERROR: ' + err); 40 | process.exit(2); 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/install-device.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-device" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/install-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | var install_target; 26 | if(args.length > 2) { 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | } else { 30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 31 | process.exit(2); 32 | } 33 | } 34 | 35 | emulator.install(install_target).done(null, function(err) { 36 | console.error('ERROR: ' + err); 37 | process.exit(2); 38 | }); 39 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/install-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/list-devices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var devices = require('./device'); 23 | 24 | // Usage support for when args are given 25 | devices.list().done(function(device_list) { 26 | device_list && device_list.forEach(function(dev) { 27 | console.log(dev); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | 34 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/list-devices.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-devices" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | emulators.list_images().done(function(emulator_list) { 26 | emulator_list && emulator_list.forEach(function(emu) { 27 | console.log(emu.name); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/list-emulator-images.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-emulator-images" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | emulators.list_started().done(function(emulator_list) { 26 | emulator_list && emulator_list.forEach(function(emu) { 27 | console.log(emu); 28 | }); 29 | }, function(err) { 30 | console.error('ERROR: ' + err); 31 | process.exit(2); 32 | }); 33 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/list-started-emulators.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-started-emulators" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/log.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var path = require('path'), 23 | os = require('os'), 24 | Q = require('q'), 25 | child_process = require('child_process'), 26 | ROOT = path.join(__dirname, '..', '..'); 27 | 28 | /* 29 | * Starts running logcat in the shell. 30 | * Returns a promise. 31 | */ 32 | module.exports.run = function() { 33 | var d = Q.defer(); 34 | var adb = child_process.spawn('adb', ['logcat'], {cwd: os.tmpdir()}); 35 | 36 | adb.stdout.on('data', function(data) { 37 | var lines = data ? data.toString().split('\n') : []; 38 | var out = lines.filter(function(x) { return x.indexOf('nativeGetEnabledTags') < 0; }); 39 | console.log(out.join('\n')); 40 | }); 41 | 42 | adb.stderr.on('data', console.error); 43 | adb.on('close', function(code) { 44 | if (code > 0) { 45 | d.reject('Failed to run logcat command.'); 46 | } else d.resolve(); 47 | }); 48 | 49 | return d.promise; 50 | }; 51 | 52 | module.exports.help = function() { 53 | console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'cordova', 'log'))); 54 | console.log('Gives the logcat output on the command line.'); 55 | process.exit(0); 56 | }; 57 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/plugin-build.gradle: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one 2 | or more contributor license agreements. See the NOTICE file 3 | distributed with this work for additional information 4 | regarding copyright ownership. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, 12 | software distributed under the License is distributed on an 13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | KIND, either express or implied. See the License for the 15 | specific language governing permissions and limitations 16 | under the License. 17 | */ 18 | 19 | // GENERATED FILE! DO NOT EDIT! 20 | 21 | buildscript { 22 | repositories { 23 | mavenCentral() 24 | } 25 | 26 | // Switch the Android Gradle plugin version requirement depending on the 27 | // installed version of Gradle. This dependency is documented at 28 | // http://tools.android.com/tech-docs/new-build-system/version-compatibility 29 | // and https://issues.apache.org/jira/browse/CB-8143 30 | if (gradle.gradleVersion >= "2.2") { 31 | dependencies { 32 | classpath 'com.android.tools.build:gradle:1.0.0+' 33 | } 34 | } else if (gradle.gradleVersion >= "2.1") { 35 | dependencies { 36 | classpath 'com.android.tools.build:gradle:0.14.0+' 37 | } 38 | } else { 39 | dependencies { 40 | classpath 'com.android.tools.build:gradle:0.12.0+' 41 | } 42 | } 43 | } 44 | 45 | apply plugin: 'android-library' 46 | 47 | dependencies { 48 | compile fileTree(dir: 'libs', include: '*.jar') 49 | debugCompile project(path: ":CordovaLib", configuration: "debug") 50 | releaseCompile project(path: ":CordovaLib", configuration: "release") 51 | } 52 | 53 | android { 54 | compileSdkVersion cdvCompileSdkVersion 55 | buildToolsVersion cdvBuildToolsVersion 56 | publishNonDefault true 57 | 58 | compileOptions { 59 | sourceCompatibility JavaVersion.VERSION_1_6 60 | targetCompatibility JavaVersion.VERSION_1_6 61 | } 62 | 63 | sourceSets { 64 | main { 65 | manifest.srcFile 'AndroidManifest.xml' 66 | java.srcDirs = ['src'] 67 | resources.srcDirs = ['src'] 68 | aidl.srcDirs = ['src'] 69 | renderscript.srcDirs = ['src'] 70 | res.srcDirs = ['res'] 71 | assets.srcDirs = ['assets'] 72 | jniLibs.srcDirs = ['libs'] 73 | } 74 | } 75 | } 76 | 77 | if (file('build-extras.gradle').exists()) { 78 | apply from: 'build-extras.gradle' 79 | } 80 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/retry.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /* jshint node: true */ 23 | 24 | 'use strict'; 25 | 26 | var events = require('cordova-common').events; 27 | 28 | /* 29 | * Retry a promise-returning function a number of times, propagating its 30 | * results on success or throwing its error on a failed final attempt. 31 | * 32 | * @arg {Number} attemts_left - The number of times to retry the passed call. 33 | * @arg {Function} promiseFunction - A function that returns a promise. 34 | * @arg {...} - Arguments to pass to promiseFunction. 35 | * 36 | * @returns {Promise} 37 | */ 38 | module.exports.retryPromise = function (attemts_left, promiseFunction) { 39 | 40 | // NOTE: 41 | // get all trailing arguments, by skipping the first two (attemts_left and 42 | // promiseFunction) because they shouldn't get passed to promiseFunction 43 | var promiseFunctionArguments = Array.prototype.slice.call(arguments, 2); 44 | 45 | return promiseFunction.apply(undefined, promiseFunctionArguments).then( 46 | 47 | // on success pass results through 48 | function onFulfilled(value) { 49 | return value; 50 | }, 51 | 52 | // on rejection either retry, or throw the error 53 | function onRejected(error) { 54 | 55 | attemts_left -= 1; 56 | 57 | if (attemts_left < 1) { 58 | throw error; 59 | } 60 | 61 | events.emit('verbose', 'A retried call failed. Retrying ' + attemts_left + ' more time(s).'); 62 | 63 | // retry call self again with the same arguments, except attemts_left is now lower 64 | var fullArguments = [attemts_left, promiseFunction].concat(promiseFunctionArguments); 65 | return module.exports.retryPromise.apply(undefined, fullArguments); 66 | } 67 | ); 68 | }; 69 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/start-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | var install_target; 26 | if(args.length > 2) { 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | } else { 30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 31 | process.exit(2); 32 | } 33 | } 34 | 35 | emulator.start(install_target).done(null, function(err) { 36 | console.error('ERROR: ' + err); 37 | process.exit(2); 38 | }); 39 | 40 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/lib/start-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0start-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var log = require('./lib/log'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Usage support for when args are given 27 | if(args.length > 2) { 28 | log.help(); 29 | } else { 30 | reqs.run().done(function() { 31 | return log.run(); 32 | }, function(err) { 33 | console.error('ERROR: ' + err); 34 | process.exit(2); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/log.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0log" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var Api = require('./Api'); 23 | var nopt = require('nopt'); 24 | var path = require('path'); 25 | 26 | // Support basic help commands 27 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) 28 | require('./lib/run').help(); 29 | 30 | // Do some basic argument parsing 31 | var runOpts = nopt({ 32 | 'verbose' : Boolean, 33 | 'silent' : Boolean, 34 | 'debug' : Boolean, 35 | 'release' : Boolean, 36 | 'nobuild': Boolean, 37 | 'buildConfig' : path, 38 | 'archs' : String, 39 | 'device' : Boolean, 40 | 'emulator': Boolean, 41 | 'target' : String 42 | }, { 'd' : '--verbose' }); 43 | 44 | // Make runOptions compatible with PlatformApi run method spec 45 | runOpts.argv = runOpts.argv.remain; 46 | 47 | new Api().run(runOpts) 48 | .catch(function(err) { 49 | console.error(err, err.stack); 50 | process.exit(2); 51 | }); 52 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/run.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0run" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | // Coho updates this line: 23 | var VERSION = "5.1.1"; 24 | 25 | module.exports.version = VERSION; 26 | 27 | if (!module.parent) { 28 | console.log(VERSION); 29 | } 30 | -------------------------------------------------------------------------------- /cordova/platforms/android/cordova/version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0version" 20 | IF EXIST %script_path% ( 21 | node %script_path% %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /cordova/platforms/android/platform_www/cordova-js-src/android/nativeapiprovider.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi. 22 | */ 23 | 24 | var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi'); 25 | var currentApi = nativeApi; 26 | 27 | module.exports = { 28 | get: function() { return currentApi; }, 29 | setPreferPrompt: function(value) { 30 | currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi; 31 | }, 32 | // Used only by tests. 33 | set: function(value) { 34 | currentApi = value; 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /cordova/platforms/android/platform_www/cordova-js-src/android/promptbasednativeapi.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** 21 | * Implements the API of ExposedJsApi.java, but uses prompt() to communicate. 22 | * This is used pre-JellyBean, where addJavascriptInterface() is disabled. 23 | */ 24 | 25 | module.exports = { 26 | exec: function(bridgeSecret, service, action, callbackId, argsJson) { 27 | return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId])); 28 | }, 29 | setNativeToJsBridgeMode: function(bridgeSecret, value) { 30 | prompt(value, 'gap_bridge_mode:' + bridgeSecret); 31 | }, 32 | retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) { 33 | return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /cordova/platforms/android/platform_www/cordova-js-src/plugin/android/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | var exec = require('cordova/exec'); 23 | var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; 24 | 25 | module.exports = { 26 | /** 27 | * Clear the resource cache. 28 | */ 29 | clearCache:function() { 30 | exec(null, null, APP_PLUGIN_NAME, "clearCache", []); 31 | }, 32 | 33 | /** 34 | * Load the url into the webview or into new browser instance. 35 | * 36 | * @param url The URL to load 37 | * @param props Properties that can be passed in to the activity: 38 | * wait: int => wait msec before loading URL 39 | * loadingDialog: "Title,Message" => display a native loading dialog 40 | * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error 41 | * clearHistory: boolean => clear webview history (default=false) 42 | * openExternal: boolean => open in a new browser (default=false) 43 | * 44 | * Example: 45 | * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); 46 | */ 47 | loadUrl:function(url, props) { 48 | exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]); 49 | }, 50 | 51 | /** 52 | * Cancel loadUrl that is waiting to be loaded. 53 | */ 54 | cancelLoadUrl:function() { 55 | exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []); 56 | }, 57 | 58 | /** 59 | * Clear web history in this web view. 60 | * Instead of BACK button loading the previous web page, it will exit the app. 61 | */ 62 | clearHistory:function() { 63 | exec(null, null, APP_PLUGIN_NAME, "clearHistory", []); 64 | }, 65 | 66 | /** 67 | * Go to previous page displayed. 68 | * This is the same as pressing the backbutton on Android device. 69 | */ 70 | backHistory:function() { 71 | exec(null, null, APP_PLUGIN_NAME, "backHistory", []); 72 | }, 73 | 74 | /** 75 | * Override the default behavior of the Android back button. 76 | * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. 77 | * 78 | * Note: The user should not have to call this method. Instead, when the user 79 | * registers for the "backbutton" event, this is automatically done. 80 | * 81 | * @param override T=override, F=cancel override 82 | */ 83 | overrideBackbutton:function(override) { 84 | exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]); 85 | }, 86 | 87 | /** 88 | * Override the default behavior of the Android volume button. 89 | * If overridden, when the volume button is pressed, the "volume[up|down]button" 90 | * JavaScript event will be fired. 91 | * 92 | * Note: The user should not have to call this method. Instead, when the user 93 | * registers for the "volume[up|down]button" event, this is automatically done. 94 | * 95 | * @param button volumeup, volumedown 96 | * @param override T=override, F=cancel override 97 | */ 98 | overrideButton:function(button, override) { 99 | exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]); 100 | }, 101 | 102 | /** 103 | * Exit and terminate the application. 104 | */ 105 | exitApp:function() { 106 | return exec(null, null, APP_PLUGIN_NAME, "exitApp", []); 107 | } 108 | }; 109 | -------------------------------------------------------------------------------- /cordova/platforms/android/platform_www/cordova_plugins.js: -------------------------------------------------------------------------------- 1 | cordova.define('cordova/plugin_list', function(require, exports, module) { 2 | module.exports = [ 3 | { 4 | "file": "plugins/cordova-plugin-whitelist/whitelist.js", 5 | "id": "cordova-plugin-whitelist.whitelist", 6 | "runs": true 7 | } 8 | ]; 9 | module.exports.metadata = 10 | // TOP OF METADATA 11 | { 12 | "cordova-plugin-whitelist": "1.2.1" 13 | }; 14 | // BOTTOM OF METADATA 15 | }); -------------------------------------------------------------------------------- /cordova/platforms/android/platform_www/plugins/cordova-plugin-whitelist/whitelist.js: -------------------------------------------------------------------------------- 1 | cordova.define("cordova-plugin-whitelist.whitelist", function(require, exports, module) { 2 | /* 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | if (!document.querySelector('meta[http-equiv=Content-Security-Policy]')) { 23 | var msg = 'No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.'; 24 | console.error(msg); 25 | setInterval(function() { 26 | console.warn(msg); 27 | }, 10000); 28 | } 29 | 30 | }); 31 | -------------------------------------------------------------------------------- /cordova/platforms/android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | # Project target. 13 | target=android-23 14 | android.library.reference.1=CordovaLib 15 | -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-land-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-land-hdpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-land-ldpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-land-ldpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-land-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-land-mdpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-land-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-land-xhdpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-port-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-port-hdpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-port-ldpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-port-ldpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-port-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-port-mdpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-port-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-port-xhdpi/screen.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/platforms/android/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /cordova/platforms/android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | UTF8Map 4 | @string/app_name 5 | @string/launcher_name 6 | 7 | -------------------------------------------------------------------------------- /cordova/platforms/android/res/xml/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | UTF8Map 10 | 11 | A sample Apache Cordova application that responds to the deviceready event. 12 | 13 | 14 | Apache Cordova Team 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /cordova/platforms/android/settings.gradle: -------------------------------------------------------------------------------- 1 | // GENERATED FILE - DO NOT EDIT 2 | include ":" 3 | include ":CordovaLib" 4 | -------------------------------------------------------------------------------- /cordova/platforms/android/src/it/UTF8Map/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package it.UTF8Map; 21 | 22 | import android.os.Bundle; 23 | import org.apache.cordova.*; 24 | 25 | public class MainActivity extends CordovaActivity 26 | { 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) 29 | { 30 | super.onCreate(savedInstanceState); 31 | // Set by in config.xml 32 | loadUrl(launchUrl); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /cordova/platforms/platforms.json: -------------------------------------------------------------------------------- 1 | { 2 | "android": "5.1.1" 3 | } -------------------------------------------------------------------------------- /cordova/plugins/android.json: -------------------------------------------------------------------------------- 1 | { 2 | "prepare_queue": { 3 | "installed": [], 4 | "uninstalled": [] 5 | }, 6 | "config_munge": { 7 | "files": {} 8 | }, 9 | "installed_plugins": { 10 | "cordova-plugin-whitelist": { 11 | "PACKAGE_NAME": "it.UTF8Map" 12 | } 13 | }, 14 | "dependent_plugins": {} 15 | } -------------------------------------------------------------------------------- /cordova/plugins/cordova-plugin-whitelist/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Contributing to Apache Cordova 23 | 24 | Anyone can contribute to Cordova. And we need your contributions. 25 | 26 | There are multiple ways to contribute: report bugs, improve the docs, and 27 | contribute code. 28 | 29 | For instructions on this, start with the 30 | [contribution overview](http://cordova.apache.org/contribute/). 31 | 32 | The details are explained there, but the important items are: 33 | - Sign and submit an Apache ICLA (Contributor License Agreement). 34 | - Have a Jira issue open that corresponds to your contribution. 35 | - Run the tests so your patch doesn't break existing functionality. 36 | 37 | We look forward to your contributions! 38 | -------------------------------------------------------------------------------- /cordova/plugins/cordova-plugin-whitelist/NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2012 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /cordova/plugins/cordova-plugin-whitelist/RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | 21 | # Release Notes 22 | 23 | ### 1.2.1 (Jan 15, 2016) 24 | * CB-10194 info tag prints for ios when not applicable 25 | 26 | ### 1.2.0 (Nov 18, 2015) 27 | * removed **iOS** engine check from `plugin.xml` 28 | * [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest 29 | * [CB-9972](https://issues.apache.org/jira/browse/CB-9972) - Remove **iOS** whitelist 30 | * Updated the text, it should read 4.0.x and greater, since this plugin will be required for `cordova-android 5.0` 31 | * Fixing contribute link. 32 | * Updated `plugin.xml ` tag to remove warning about not needing this plugin if you are using the **iOS 9 SDK** 33 | * [CB-9738](https://issues.apache.org/jira/browse/CB-9738) - Disable whitelist use when runtime environment is **iOS 9** 34 | * [CB-9740](https://issues.apache.org/jira/browse/CB-9740) - Add `` tag describing whitelist plugin not needed on `cordova-ios` and cordova-android 3.x` 35 | * [CB-9568](https://issues.apache.org/jira/browse/CB-9568) - Update whitelist plugin to allow all network access by default 36 | * [CB-9337](https://issues.apache.org/jira/browse/CB-9337) - enable use of `` tags for native code network requests 37 | 38 | ### 1.1.0 (Jun 17, 2015) 39 | * [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-plugin-whitelist documentation translation: cordova-plugin-whitelist 40 | * fix npm md issue 41 | * Usage of CDVURLRequestFilter protocol. 42 | * [CB-9089](https://issues.apache.org/jira/browse/CB-9089) - iOS whitelist plugin does not compile 43 | * [CB-9090](https://issues.apache.org/jira/browse/CB-9090) - Enable whitelist plugin for cordova-ios 4.0.0 44 | * Fixed error in Content-Security-Policy example 45 | 46 | ### 1.0.0 (Mar 25, 2015) 47 | * [CB-8739](https://issues.apache.org/jira/browse/CB-8739) added missing license headers 48 | * Add @Override to CustomConfigXmlParser methods 49 | * Change ID to cordova-plugin-whitelist rather than reverse-DNS-style 50 | * Tweak CSP examples in README 51 | * [CB-8660](https://issues.apache.org/jira/browse/CB-8660) remove extra commas from package.json 52 | -------------------------------------------------------------------------------- /cordova/plugins/cordova-plugin-whitelist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-whitelist", 3 | "version": "1.2.1", 4 | "description": "Cordova Whitelist Plugin", 5 | "cordova": { 6 | "platforms": [ 7 | "android" 8 | ] 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/apache/cordova-plugin-whitelist" 13 | }, 14 | "keywords": [ 15 | "cordova", 16 | "whitelist", 17 | "ecosystem:cordova", 18 | "cordova-android" 19 | ], 20 | "engines": [ 21 | { 22 | "name": "cordova-android", 23 | "version": ">=4.0.0" 24 | } 25 | ], 26 | "author": "Apache Software Foundation", 27 | "license": "Apache 2.0" 28 | } 29 | -------------------------------------------------------------------------------- /cordova/plugins/cordova-plugin-whitelist/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | Whitelist 25 | Cordova Network Whitelist Plugin 26 | Apache 2.0 27 | cordova,whitelist,policy 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /cordova/plugins/cordova-plugin-whitelist/whitelist.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | * 19 | */ 20 | 21 | if (!document.querySelector('meta[http-equiv=Content-Security-Policy]')) { 22 | var msg = 'No Content-Security-Policy meta tag found. Please add one when using the cordova-plugin-whitelist plugin.'; 23 | console.error(msg); 24 | setInterval(function() { 25 | console.warn(msg); 26 | }, 10000); 27 | } 28 | -------------------------------------------------------------------------------- /cordova/plugins/fetch.json: -------------------------------------------------------------------------------- 1 | { 2 | "cordova-plugin-whitelist": { 3 | "source": { 4 | "type": "registry", 5 | "id": "cordova-plugin-whitelist@1" 6 | }, 7 | "is_top_level": true, 8 | "variables": {} 9 | } 10 | } -------------------------------------------------------------------------------- /cordova/www/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | * { 20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 21 | } 22 | 23 | body { 24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 27 | background-color:#E4E4E4; 28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 31 | background-image:-webkit-gradient( 32 | linear, 33 | left top, 34 | left bottom, 35 | color-stop(0, #A7A7A7), 36 | color-stop(0.51, #E4E4E4) 37 | ); 38 | background-attachment:fixed; 39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 40 | font-size:12px; 41 | height:100%; 42 | margin:0px; 43 | padding:0px; 44 | text-transform:uppercase; 45 | width:100%; 46 | } 47 | 48 | /* Portrait layout (default) */ 49 | .app { 50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ 51 | position:absolute; /* position in the center of the screen */ 52 | left:50%; 53 | top:50%; 54 | height:50px; /* text area height */ 55 | width:225px; /* text area width */ 56 | text-align:center; 57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ 58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ 59 | /* offset horizontal: half of text area width */ 60 | } 61 | 62 | /* Landscape layout (with min-width) */ 63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { 64 | .app { 65 | background-position:left center; 66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ 67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ 68 | /* offset horizontal: half of image width and text area width */ 69 | } 70 | } 71 | 72 | h1 { 73 | font-size:24px; 74 | font-weight:normal; 75 | margin:0px; 76 | overflow:visible; 77 | padding:0px; 78 | text-align:center; 79 | } 80 | 81 | .event { 82 | border-radius:4px; 83 | -webkit-border-radius:4px; 84 | color:#FFFFFF; 85 | font-size:12px; 86 | margin:0px 30px; 87 | padding:2px 0px; 88 | } 89 | 90 | .event.listening { 91 | background-color:#333333; 92 | display:block; 93 | } 94 | 95 | .event.received { 96 | background-color:#4B946A; 97 | display:none; 98 | } 99 | 100 | @keyframes fade { 101 | from { opacity: 1.0; } 102 | 50% { opacity: 0.4; } 103 | to { opacity: 1.0; } 104 | } 105 | 106 | @-webkit-keyframes fade { 107 | from { opacity: 1.0; } 108 | 50% { opacity: 0.4; } 109 | to { opacity: 1.0; } 110 | } 111 | 112 | .blink { 113 | animation:fade 3000ms infinite; 114 | -webkit-animation:fade 3000ms infinite; 115 | } 116 | -------------------------------------------------------------------------------- /cordova/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corso-javascript/react-native-web-utf8map/cce9584bed7b9b938d105ccc15ef7664d59581fa/cordova/www/img/logo.png -------------------------------------------------------------------------------- /cordova/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Hello World 38 | 39 | 40 |
41 |

Apache Cordova

42 | 46 |
47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /cordova/www/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | this.bindEvents(); 23 | }, 24 | // Bind Event Listeners 25 | // 26 | // Bind any events that are required on startup. Common events are: 27 | // 'load', 'deviceready', 'offline', and 'online'. 28 | bindEvents: function() { 29 | document.addEventListener('deviceready', this.onDeviceReady, false); 30 | }, 31 | // deviceready Event Handler 32 | // 33 | // The scope of 'this' is the event. In order to call the 'receivedEvent' 34 | // function, we must explicitly call 'app.receivedEvent(...);' 35 | onDeviceReady: function() { 36 | app.receivedEvent('deviceready'); 37 | // window.location="http://192.168.1.5:3000"; 38 | window.open("http://192.168.1.5:3000", "_blank", "location=no,hidden=yes"); 39 | }, 40 | // Update DOM on a Received Event 41 | receivedEvent: function(id) { 42 | var parentElement = document.getElementById(id); 43 | var listeningElement = parentElement.querySelector('.listening'); 44 | var receivedElement = parentElement.querySelector('.received'); 45 | 46 | listeningElement.setAttribute('style', 'display:none;'); 47 | receivedElement.setAttribute('style', 'display:block;'); 48 | 49 | console.log('Received Event: ' + id); 50 | } 51 | }; 52 | 53 | app.initialize(); 54 | -------------------------------------------------------------------------------- /index.android.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | AppRegistry, 3 | Component, 4 | StyleSheet, 5 | Text, 6 | View 7 | } from 'react-native'; 8 | 9 | import App from './app/views/index' 10 | 11 | 12 | AppRegistry.registerComponent('UTF8Map', () => App); 13 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | AppRegistry, 3 | Component, 4 | StyleSheet, 5 | Text, 6 | View 7 | } from 'react-native'; 8 | 9 | import App from './app/views/index.web' 10 | 11 | 12 | AppRegistry.registerComponent('UTF8Map', () => App); 13 | -------------------------------------------------------------------------------- /index.web.js: -------------------------------------------------------------------------------- 1 | import App from './app/views/index' 2 | 3 | import React, { 4 | AppRegistry, 5 | } from 'react-native' 6 | 7 | AppRegistry.registerComponent('UTF8Map', () => App); 8 | 9 | var app = document.createElement('div'); 10 | 11 | /* Toolbar color */ 12 | var meta = document.createElement('meta'); 13 | meta.name = "theme-color"; 14 | meta.content = "#1E6ADC"; 15 | document.getElementsByTagName('head')[0].appendChild(meta); 16 | 17 | document.title="UTF8Map" 18 | document.body.appendChild(app); 19 | 20 | AppRegistry.runApplication('UTF8Map', { 21 | rootTag: app 22 | }) 23 | -------------------------------------------------------------------------------- /ios/UTF8Map.xcodeproj/xcshareddata/xcschemes/UTF8Map.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ios/UTF8Map/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/UTF8Map/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. The static bundle is automatically 39 | * generated by the "Bundle React Native code and images" build step when 40 | * running the project on an actual device or running the project on the 41 | * simulator in the "Release" build configuration. 42 | */ 43 | 44 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 45 | 46 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 47 | moduleName:@"UTF8Map" 48 | initialProperties:nil 49 | launchOptions:launchOptions]; 50 | 51 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 52 | UIViewController *rootViewController = [UIViewController new]; 53 | rootViewController.view = rootView; 54 | self.window.rootViewController = rootViewController; 55 | [self.window makeKeyAndVisible]; 56 | return YES; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /ios/UTF8Map/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/UTF8Map/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/UTF8Map/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ios/UTF8Map/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ios/UTF8MapTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/UTF8MapTests/UTF8MapTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface UTF8MapTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation UTF8MapTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UTF8Map", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-web/local-cli/cli.js start", 7 | "android:start": "react-native run-android", 8 | "android:pkg:build": "cd android && ./gradlew assembleRelease", 9 | "android:pkg:install": "adb install android/app/build/outputs/apk/app-release.apk", 10 | "cordova:android:start": "(cd cordova && cordova run android)" 11 | }, 12 | "dependencies": { 13 | "react": "^0.14.8", 14 | "react-dom": "^0.14.8", 15 | "react-native": "^0.23.0", 16 | "react-native-web": "0.0.21" 17 | }, 18 | "devDependencies": { 19 | "react-web": "^0.2.2", 20 | "babel-core": "^6.7.6", 21 | "babel-loader": "^6.2.4", 22 | "babel-preset-es2015": "^6.6.0", 23 | "babel-preset-react": "^6.5.0", 24 | "babel-preset-stage-2": "^6.5.0", 25 | "haste-resolver-webpack-plugin": "^0.2.1", 26 | "json-loader": "^0.5.2", 27 | "react-hot-loader": "^1.2.7", 28 | "webpack": "^1.12.15", 29 | "webpack-dev-server": "^1.14.1", 30 | "webpack-html-plugin": "^0.1.1" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /web/webpack.config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | var webpack = require('webpack'); 5 | var HtmlPlugin = require('webpack-html-plugin'); 6 | var HasteResolverPlugin = require('haste-resolver-webpack-plugin'); 7 | 8 | var IP = '0.0.0.0'; 9 | var PORT = 3000; 10 | var NODE_ENV = process.env.NODE_ENV; 11 | var ROOT_PATH = path.resolve(__dirname, '..'); 12 | var PROD = 'production'; 13 | var DEV = 'development'; 14 | let isProd = NODE_ENV === 'production'; 15 | 16 | console.log('ROOT_PATH =', ROOT_PATH) 17 | 18 | 19 | var config = { 20 | paths: { 21 | src: path.join(ROOT_PATH, '.'), 22 | index: path.join(ROOT_PATH, 'index.web'), 23 | }, 24 | }; 25 | 26 | module.exports = { 27 | ip: IP, 28 | port: PORT, 29 | devtool: 'source-map', 30 | resolve: { 31 | alias: { 32 | 'react-native': 'react-native-web' 33 | }, 34 | extensions: ['', '.web.js','.js', '.jsx'], 35 | }, 36 | entry: isProd? [ 37 | config.paths.index 38 | ]: [ 39 | 'webpack-dev-server/client?http://' + IP + ':' + PORT, 40 | 'webpack/hot/only-dev-server', 41 | config.paths.index, 42 | ], 43 | output: { 44 | path: path.join(__dirname, 'output'), 45 | filename: 'bundle.js' 46 | }, 47 | plugins: [ 48 | new HasteResolverPlugin({ 49 | platform: 'web', 50 | nodeModules: ['react-web'] 51 | }), 52 | new webpack.DefinePlugin({ 53 | 'process.env': { 54 | 'NODE_ENV': JSON.stringify(isProd? PROD: DEV), 55 | } 56 | }), 57 | isProd? new webpack.ProvidePlugin({ 58 | React: "react" 59 | }): new webpack.HotModuleReplacementPlugin(), 60 | new webpack.NoErrorsPlugin(), 61 | new HtmlPlugin(), 62 | ], 63 | module: { 64 | loaders: [{ 65 | test: /\.jsx?$/, 66 | loader: 'babel', // 'babel-loader' is also a legal name to reference 67 | query: { 68 | presets: ['es2015', 'react', 'stage-2'] 69 | }, 70 | include: [config.paths.src], 71 | exclude: [/node_modules/] 72 | }, { 73 | test: /\.json$/, 74 | loader: 'json', 75 | },] 76 | } 77 | }; 78 | --------------------------------------------------------------------------------