├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitignore ├── .postcssrc.js ├── README.md ├── android.config.json ├── configs ├── config.js ├── helper.js ├── logo.png ├── plugin.js ├── utils.js ├── vue-loader.conf.js ├── webpack.common.conf.js ├── webpack.dev.conf.js ├── webpack.prod.conf.js ├── webpack.release.conf.js └── webpack.test.conf.js ├── dist ├── components │ └── module.js ├── index.js ├── layout │ ├── nav-bar.js │ ├── status-bar.js │ └── title-bar.js └── views │ ├── camera │ ├── captureImage.js │ └── captureVideo.js │ ├── communication │ ├── call.js │ ├── mail.js │ └── sms.js │ ├── device │ ├── battery.js │ ├── info.js │ ├── network.js │ ├── screen.js │ ├── vibration.js │ └── volume.js │ ├── geolocation │ └── geolocation.js │ ├── media │ ├── audio.js │ ├── image.js │ └── video.js │ ├── modal │ ├── alert.js │ ├── confirm.js │ ├── prompt.js │ └── toast.js │ ├── network │ ├── download.js │ ├── fetch.js │ └── upload.js │ ├── recorder │ └── recorder.js │ ├── sensor │ ├── accelerometer.js │ └── compass.js │ └── third-party │ └── alipay.js ├── ios.config.json ├── package-lock.json ├── package.json ├── platforms ├── android │ ├── .weex_plugin.json │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ ├── src │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── assets │ │ │ │ ├── dist │ │ │ │ │ ├── components │ │ │ │ │ │ └── module.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── layout │ │ │ │ │ │ ├── nav-bar.js │ │ │ │ │ │ ├── status-bar.js │ │ │ │ │ │ └── title-bar.js │ │ │ │ │ └── views │ │ │ │ │ │ ├── camera │ │ │ │ │ │ ├── captureImage.js │ │ │ │ │ │ └── captureVideo.js │ │ │ │ │ │ ├── communication │ │ │ │ │ │ ├── call.js │ │ │ │ │ │ ├── mail.js │ │ │ │ │ │ └── sms.js │ │ │ │ │ │ ├── device │ │ │ │ │ │ ├── battery.js │ │ │ │ │ │ ├── info.js │ │ │ │ │ │ ├── network.js │ │ │ │ │ │ ├── screen.js │ │ │ │ │ │ ├── vibration.js │ │ │ │ │ │ └── volume.js │ │ │ │ │ │ ├── geolocation │ │ │ │ │ │ └── geolocation.js │ │ │ │ │ │ ├── media │ │ │ │ │ │ ├── audio.js │ │ │ │ │ │ ├── image.js │ │ │ │ │ │ └── video.js │ │ │ │ │ │ ├── modal │ │ │ │ │ │ ├── alert.js │ │ │ │ │ │ ├── confirm.js │ │ │ │ │ │ ├── prompt.js │ │ │ │ │ │ └── toast.js │ │ │ │ │ │ ├── network │ │ │ │ │ │ ├── download.js │ │ │ │ │ │ ├── fetch.js │ │ │ │ │ │ └── upload.js │ │ │ │ │ │ ├── recorder │ │ │ │ │ │ └── recorder.js │ │ │ │ │ │ ├── sensor │ │ │ │ │ │ ├── accelerometer.js │ │ │ │ │ │ └── compass.js │ │ │ │ │ │ └── third-party │ │ │ │ │ │ └── alipay.js │ │ │ │ └── index.js │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── instapp │ │ │ │ │ └── natex │ │ │ │ │ ├── AbsWeexActivity.java │ │ │ │ │ ├── ApiKey.java │ │ │ │ │ ├── SplashActivity.java │ │ │ │ │ ├── WXApplication.java │ │ │ │ │ ├── WXPageActivity.java │ │ │ │ │ ├── extend │ │ │ │ │ ├── BlurTool.java │ │ │ │ │ ├── BlurTransformation.java │ │ │ │ │ ├── ImageAdapter.java │ │ │ │ │ └── WXEventModule.java │ │ │ │ │ ├── hotreload │ │ │ │ │ └── HotReloadManager.java │ │ │ │ │ └── util │ │ │ │ │ ├── AppConfig.java │ │ │ │ │ ├── AppConfigXmlParser.java │ │ │ │ │ ├── AppPreferences.java │ │ │ │ │ ├── CommonUtils.java │ │ │ │ │ └── Constants.java │ │ │ │ └── res │ │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_action_refresh.png │ │ │ │ └── ic_action_scan.png │ │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_action_refresh.png │ │ │ │ └── ic_action_scan.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_action_refresh.png │ │ │ │ └── ic_action_scan.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_action_refresh.png │ │ │ │ └── ic_action_scan.png │ │ │ │ ├── layout │ │ │ │ ├── activity_splash.xml │ │ │ │ └── activity_wxpage.xml │ │ │ │ ├── menu │ │ │ │ ├── main.xml │ │ │ │ └── main_scan.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ │ ├── values-zh-rCN │ │ │ │ └── strings.xml │ │ │ │ ├── values │ │ │ │ ├── attrs.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── drawables.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ └── themes.xml │ │ │ │ └── xml │ │ │ │ └── app_config.xml │ │ └── tools │ │ │ └── debug.keystore │ ├── build.gradle │ ├── codeStyleSettings.xml │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── ios │ ├── LICENSE │ ├── Podfile │ ├── Podfile.lock │ ├── README.md │ ├── WeexDemo.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── WeexDemo.xcscheme │ │ │ └── WeexUITestDemo.xcscheme │ ├── WeexDemo.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── WeexDemo │ │ ├── ApiKey.h │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── launcher@1024.png │ │ │ │ ├── launcher@120-1.png │ │ │ │ ├── launcher@120.png │ │ │ │ ├── launcher@152.png │ │ │ │ ├── launcher@167.png │ │ │ │ ├── launcher@180.png │ │ │ │ ├── launcher@40.png │ │ │ │ ├── launcher@58-1.png │ │ │ │ ├── launcher@58.png │ │ │ │ ├── launcher@76.png │ │ │ │ ├── launcher@80-1.png │ │ │ │ ├── launcher@80.png │ │ │ │ └── launcher@87.png │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Contents.json │ │ │ │ ├── Default-4.7@2x.png │ │ │ │ ├── Default-568h@2x-1.png │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default.png │ │ │ │ ├── Default@2x-1.png │ │ │ │ ├── Default@2x.png │ │ │ │ ├── Default@3x-1.png │ │ │ │ ├── Default@3x.png │ │ │ │ ├── iPhoneX-landscape.png │ │ │ │ └── iPhoneX@3x.png │ │ │ ├── back.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── back.png │ │ │ │ ├── back@2x.png │ │ │ │ └── back@3x.png │ │ │ ├── reload.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── reload.png │ │ │ │ ├── reload@2x.png │ │ │ │ └── reload@3x.png │ │ │ └── scan.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── scan.png │ │ │ │ ├── scan@2x.png │ │ │ │ └── scan@3x.png │ │ ├── DemoDefine.h │ │ ├── Images.xcassets │ │ │ └── Brand Assets.launchimage │ │ │ │ └── Contents.json │ │ ├── WeexConfig │ │ │ ├── WXImgLoaderDefaultImpl.h │ │ │ ├── WXImgLoaderDefaultImpl.m │ │ │ ├── WeexSDKManager.h │ │ │ └── WeexSDKManager.m │ │ ├── WeexDemo-Info.plist │ │ ├── WeexScanner │ │ │ ├── UIViewController+WXDemoNaviBar.h │ │ │ ├── UIViewController+WXDemoNaviBar.m │ │ │ ├── WXDemoViewController.h │ │ │ └── WXDemoViewController.m │ │ ├── config.xml │ │ ├── main.m │ │ └── weex-icon.png │ ├── WeexDemoTests │ │ ├── Info.plist │ │ └── WeexDemoTests.m │ ├── WeexUITestDemo-Info.plist │ ├── WeexUITestDemoUITests │ │ ├── Info.plist │ │ └── WeexUITestDemoUITests.m │ ├── bundlejs │ │ ├── components │ │ │ └── module.js │ │ ├── index.js │ │ ├── layout │ │ │ ├── nav-bar.js │ │ │ ├── status-bar.js │ │ │ └── title-bar.js │ │ └── views │ │ │ ├── camera │ │ │ ├── captureImage.js │ │ │ └── captureVideo.js │ │ │ ├── communication │ │ │ ├── call.js │ │ │ ├── mail.js │ │ │ └── sms.js │ │ │ ├── device │ │ │ ├── battery.js │ │ │ ├── info.js │ │ │ ├── network.js │ │ │ ├── screen.js │ │ │ ├── vibration.js │ │ │ └── volume.js │ │ │ ├── geolocation │ │ │ └── geolocation.js │ │ │ ├── media │ │ │ ├── audio.js │ │ │ ├── image.js │ │ │ └── video.js │ │ │ ├── modal │ │ │ ├── alert.js │ │ │ ├── confirm.js │ │ │ ├── prompt.js │ │ │ └── toast.js │ │ │ ├── network │ │ │ ├── download.js │ │ │ ├── fetch.js │ │ │ └── upload.js │ │ │ ├── recorder │ │ │ └── recorder.js │ │ │ ├── sensor │ │ │ ├── accelerometer.js │ │ │ └── compass.js │ │ │ └── third-party │ │ │ └── alipay.js │ ├── weex.png │ └── weex@2x.png └── platforms.json ├── plugins └── plugins.json ├── src ├── assets │ ├── css │ │ ├── base.less │ │ └── case.less │ └── img │ │ ├── arrow.png │ │ └── logo.png ├── components │ └── module.vue ├── entry.js ├── index.vue ├── ini │ └── modules.js ├── layout │ ├── nav-bar.vue │ ├── status-bar.vue │ └── title-bar.vue ├── utils │ └── env.js └── views │ ├── camera │ ├── captureImage.vue │ └── captureVideo.vue │ ├── communication │ ├── call.vue │ ├── mail.vue │ └── sms.vue │ ├── device │ ├── battery.vue │ ├── info.vue │ ├── network.vue │ ├── screen.vue │ ├── vibration.vue │ └── volume.vue │ ├── geolocation │ └── geolocation.vue │ ├── media │ ├── audio.vue │ ├── image.vue │ └── video.vue │ ├── modal │ ├── alert.vue │ ├── confirm.vue │ ├── prompt.vue │ └── toast.vue │ ├── network │ ├── download.vue │ ├── fetch.vue │ └── upload.vue │ ├── recorder │ └── recorder.vue │ ├── sensor │ ├── accelerometer.vue │ └── compass.vue │ └── third-party │ └── alipay.vue ├── test └── unit │ ├── .eslintrc │ ├── index.js │ ├── karma.conf.js │ └── specs │ └── index.spec.js ├── web ├── assets │ ├── preview.css │ └── qrcode.js ├── index.html └── preview.html └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "stage-0" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = tab 6 | indent_size = 4 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /configs/ 2 | /dist/ 3 | /*.js 4 | /test/unit/coverage/ 5 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true, 5 | "es6": true 6 | }, 7 | "extends": ["eslint:recommended", "vue"], 8 | "plugins": ["vue", "html"], 9 | "parser": "babel-eslint", 10 | "parserOptions": { 11 | "sourceType": "module", 12 | "ecmaVersion": 8, 13 | "ecmaFeatures": { 14 | "experimentalObjectRestSpread": true, 15 | "jsx": true 16 | } 17 | }, 18 | "rules": { 19 | "prefer-const": 0, 20 | "no-console": 1, 21 | "no-cond-assign": 2, 22 | "no-irregular-whitespace": 2, 23 | "no-unexpected-multiline": 2, 24 | "no-caller": 2, 25 | "no-extend-native": 2, 26 | "no-extra-bind": 2, 27 | "no-multi-spaces": 2, 28 | "no-multi-str": 2, 29 | "no-native-reassign": 2, 30 | "no-new-wrappers": 2, 31 | "no-new-symbol": 2, 32 | "no-this-before-super": 2, 33 | "no-throw-literal": 2, 34 | "no-var": 2, 35 | "no-with": 2, 36 | "no-unused-vars": [2, {"args": "none"}], 37 | "no-array-constructor": 2, 38 | "no-mixed-spaces-and-tabs": 2, 39 | "no-multiple-empty-lines": [2, {"max": 2}], 40 | "no-trailing-spaces": 2, 41 | "no-dupe-args": 2, 42 | "no-dupe-keys": 2, 43 | "no-duplicate-case": 2, 44 | "arrow-parens": [2, "always"], 45 | "arrow-spacing": 2, 46 | "camelcase": [2, {properties: "never"}], 47 | "comma-dangle": [1,"only-multiline"], 48 | "comma-style": 2, 49 | "constructor-super": 2, 50 | "eol-last": 2, 51 | "eqeqeq": [2, "allow-null"], 52 | "generator-star-spacing": [2, "after"], 53 | "indent": [2, "tab", { 54 | "SwitchCase": 1 55 | }], 56 | "object-curly-spacing": 2, 57 | "quotes": [2, "single"], 58 | "semi": [2, "never"], 59 | "semi-spacing": 2, 60 | "space-before-blocks": 2, 61 | "space-before-function-paren": [2, "never"], 62 | "use-isnan": 2, 63 | "key-spacing": [2, { 64 | "afterColon": true, 65 | "mode": "strict" 66 | }] 67 | }, 68 | "globals": { 69 | "weex": true 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## JS 2 | node_modules/ 3 | temp/ 4 | .temp/ 5 | 6 | 7 | ## Android Studio 8 | 9 | # Built application files 10 | *.apk 11 | *.ap_ 12 | 13 | # Files for the ART/Dalvik VM 14 | *.dex 15 | 16 | # Java class files 17 | *.class 18 | 19 | # Generated files 20 | bin/ 21 | gen/ 22 | out/ 23 | 24 | # Gradle files 25 | .gradle/ 26 | build/ 27 | 28 | # Local configuration file (sdk path, etc) 29 | local.properties 30 | 31 | # Proguard folder generated by Eclipse 32 | proguard/ 33 | 34 | # Log Files 35 | *.log 36 | 37 | # Android Studio Navigation editor temp files 38 | .navigation/ 39 | 40 | # Android Studio captures folder 41 | captures/ 42 | 43 | # Intellij 44 | *.iml 45 | .idea/ 46 | 47 | # Keystore files 48 | *.jks 49 | 50 | # External native build folder generated in Android Studio 2.2 and later 51 | .externalNativeBuild 52 | 53 | # Google Services (e.g. APIs or Firebase) 54 | google-services.json 55 | 56 | # Freeline 57 | freeline.py 58 | freeline/ 59 | freeline_project_description.json 60 | 61 | 62 | ## Xcode 63 | 64 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 65 | 66 | ## Build generated 67 | build/ 68 | DerivedData/ 69 | 70 | ## Various settings 71 | *.pbxuser 72 | !default.pbxuser 73 | *.mode1v3 74 | !default.mode1v3 75 | *.mode2v3 76 | !default.mode2v3 77 | *.perspectivev3 78 | !default.perspectivev3 79 | xcuserdata/ 80 | 81 | ## Other 82 | *.moved-aside 83 | *.xccheckout 84 | *.xcscmblueprint 85 | 86 | ## Obj-C/Swift specific 87 | *.hmap 88 | *.ipa 89 | *.dSYM.zip 90 | *.dSYM 91 | 92 | # CocoaPods 93 | # 94 | # We recommend against adding the Pods directory to your .gitignore. However 95 | # you should judge for yourself, the pros and cons are mentioned at: 96 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 97 | # 98 | Pods/ 99 | 100 | # Carthage 101 | # 102 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 103 | # Carthage/Checkouts 104 | 105 | Carthage/Build 106 | 107 | # fastlane 108 | # 109 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 110 | # screenshots whenever they are needed. 111 | # For more information about the recommended setup visit: 112 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 113 | 114 | fastlane/report.xml 115 | fastlane/Preview.html 116 | fastlane/screenshots 117 | fastlane/test_output 118 | 119 | # Code Injection 120 | # 121 | # After new code Injection tools there's a generated folder /iOSInjectionProject 122 | # https://github.com/johnno1962/injectionforxcode 123 | 124 | iOSInjectionProject/ 125 | 126 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {}, 7 | "autoprefixer": {} 8 | } 9 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nat Explorer 2 | 3 | 4 | 5 | Nat Explorer is a nat example app, help you explore Nat modules instantly. 6 | 7 | ### Download 8 | 9 | [![Available on App Store](http://natjs.com/_assets/images/btn_app_store.svg)](https://itunes.apple.com/us/app/nat-explorer/id1262312650) 10 |    11 | [![Android App on Google Play](http://natjs.com/_assets/images/btn_google_play.svg)](https://play.google.com/store/apps/details?id=com.instapp.natex) 12 | 13 | Also, you can download it directly by scan the QRcode below. 14 | 15 | Download Nat Explorer 16 | 17 | ## Commands 18 | 19 | ```bash 20 | npm start 21 | ``` 22 | 23 | Starts the development server for you to preview your weex page on browser. 24 | You can also scan the QR code using weex playground to preview weex page on native. 25 | 26 | ```bash 27 | npm run dev 28 | ``` 29 | 30 | Open the code compilation task in watch mode. 31 | 32 | ```bash 33 | npm run ios 34 | ``` 35 | 36 | (Mac only, requires Xcode) 37 | Starts the development server and loads your app in an iOS simulator. 38 | 39 | ```bash 40 | npm run android 41 | ``` 42 | 43 | (Requires Android build tools) 44 | Starts the development server and loads your app on a connected Android device or emulator. 45 | 46 | ```bash 47 | npm run pack:ios 48 | ``` 49 | 50 | (Mac only, requires Xcode) 51 | Packaging ios project into ipa package. 52 | 53 | ```bash 54 | npm run pack:android 55 | ``` 56 | 57 | (Requires Android build tools) 58 | Packaging android project into apk package. 59 | 60 | ```bash 61 | npm run pack:web 62 | ``` 63 | 64 | Packaging html5 project into `web/build` folder. 65 | 66 | ```bash 67 | npm run test 68 | ``` 69 | 70 | Starts the test runner. 71 | 72 | ## License 73 | 74 | [MIT](http://opensource.org/licenses/MIT) 75 | 76 | Copyright (c) 2017-present, Acathur 77 | -------------------------------------------------------------------------------- /android.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "AppName":"Nat Example", 3 | "AppId":"com.instapp.natex", 4 | "SplashText":"Nat", 5 | "WeexBundle":"index.js" 6 | } 7 | -------------------------------------------------------------------------------- /configs/config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const ROOT = path.resolve(__dirname, '..'); 3 | const ip = require('ip').address(); 4 | const config = { 5 | root: ROOT, 6 | // webpack-dev-server 7 | pluginConfigPath: 'plugins/plugins.json', 8 | pluginFilePath: 'plugins/plugins.js', 9 | // router 10 | // common 11 | templateDir: '.temp', 12 | entryFilePath: 'entry.js', 13 | dev: { 14 | // Various Dev Server settings 15 | contentBase: ROOT, 16 | host: ip, 17 | port: 8081, 18 | historyApiFallback: true, 19 | open: true, 20 | watchContentBase: true, 21 | openPage: 'web/preview.html', 22 | watchOptions: { 23 | ignored: /node_modules/, 24 | aggregateTimeout: 300, 25 | poll: false 26 | }, 27 | // Use Eslint Loader? 28 | // If true, your code will be linted during bundling and 29 | // linting errors and warnings will be shown in the console. 30 | useEslint: true, 31 | // If true, eslint errors and warnings will also be shown in the error overlay 32 | // in the browser. 33 | showEslintErrorsInOverlay: false, 34 | /** 35 | * Source Maps 36 | */ 37 | // https://webpack.js.org/configuration/devtool/#development 38 | devtool: 'eval-source-map', 39 | env: JSON.stringify('development'), 40 | // If you have problems debugging vue-files in devtools, 41 | // set this to false - it *may* help 42 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 43 | cacheBusting: true, 44 | // CSS Sourcemaps off by default because relative paths are "buggy" 45 | // with this option, according to the CSS-Loader README 46 | // (https://github.com/webpack/css-loader#sourcemaps) 47 | // In our experience, they generally work as expected, 48 | // just be aware of this issue when enabling this option. 49 | cssSourceMap: false, 50 | proxyTable: {}, 51 | autoOpenBrowser: false, 52 | errorOverlay: true, 53 | notifyOnErrors: true, 54 | htmlOptions: { 55 | devScripts: ` 56 | 69 | ` 70 | } 71 | }, 72 | test: { 73 | env: JSON.stringify('test') 74 | }, 75 | prod: { 76 | env: JSON.stringify('production'), 77 | /** 78 | * Source Maps 79 | */ 80 | productionSourceMap: true, 81 | // https://webpack.js.org/configuration/devtool/#production 82 | devtool: '#source-map', 83 | cssSourceMap: true, 84 | productionSourceMap: true 85 | }, 86 | nodeConfiguration: { 87 | global: false, 88 | Buffer: false, 89 | __filename: false, 90 | __dirname: false, 91 | setImmediate: false, 92 | clearImmediate: false, 93 | // see: https://github.com/webpack/node-libs-browser 94 | assert: false, 95 | buffer: false, 96 | child_process: false, 97 | cluster: false, 98 | console: false, 99 | constants: false, 100 | crypto: false, 101 | dgram: false, 102 | dns: false, 103 | domain: false, 104 | events: false, 105 | fs: false, 106 | http: false, 107 | https: false, 108 | module: false, 109 | net: false, 110 | os: false, 111 | path: false, 112 | process: false, 113 | punycode: false, 114 | querystring: false, 115 | readline: false, 116 | repl: false, 117 | stream: false, 118 | string_decoder: false, 119 | sys: false, 120 | timers: false, 121 | tls: false, 122 | tty: false, 123 | url: false, 124 | util: false, 125 | vm: false, 126 | zlib: false 127 | } 128 | } 129 | module.exports = config; 130 | -------------------------------------------------------------------------------- /configs/helper.js: -------------------------------------------------------------------------------- 1 | // Helper functions 2 | const path = require('path'); 3 | const ROOT = path.resolve(__dirname, '..'); 4 | 5 | const root = (args) => { 6 | return path.join(ROOT, 'src', args); 7 | } 8 | const rootNode = (args) => { 9 | return path.join(ROOT, args); 10 | } 11 | 12 | const resolve = (dir) => { 13 | return path.join(__dirname, '..', dir) 14 | } 15 | 16 | module.exports = { 17 | root, 18 | rootNode, 19 | resolve 20 | } -------------------------------------------------------------------------------- /configs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/configs/logo.png -------------------------------------------------------------------------------- /configs/plugin.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs-extra'); 3 | const webpack = require('webpack'); 4 | const config = require('./config'); 5 | const helper = require('./helper'); 6 | const pluginConfigPath = helper.rootNode(config.pluginConfigPath); 7 | const outputPath = helper.rootNode(config.pluginFilePath); 8 | 9 | const toLowerCamelCase = key => { 10 | return key.replace(/\b\-\w+\b/g, function(word){ 11 | return word.substring(1,2).toUpperCase()+word.substring(2); 12 | }); 13 | } 14 | 15 | const buildPlugins = () => { 16 | let content = ''; 17 | let keys = []; 18 | const plugins =require(pluginConfigPath).web; 19 | if (plugins && plugins.length > 0) { 20 | for(let plugin of plugins){ 21 | let camelCaseKey = toLowerCamelCase(plugin.name); 22 | content += `import ${camelCaseKey} from '${plugin.name}';\n` 23 | keys.push(camelCaseKey) 24 | } 25 | content += `export default [${keys.join(',')}];` 26 | fs.outputFileSync(outputPath, content); 27 | return true; 28 | } 29 | else { 30 | if (fs.existsSync(outputPath)) { 31 | fs.unlink(outputPath) 32 | } 33 | return false; 34 | } 35 | } 36 | 37 | module.exports = buildPlugins; 38 | -------------------------------------------------------------------------------- /configs/utils.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const config = require('./config') 3 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | const packageConfig = require('../package.json') 5 | 6 | exports.cssLoaders = function (options) { 7 | options = options || {} 8 | const cssLoader = { 9 | loader: 'css-loader', 10 | options: { 11 | sourceMap: options.sourceMap 12 | } 13 | } 14 | 15 | const postcssLoader = { 16 | loader: 'postcss-loader', 17 | options: { 18 | sourceMap: options.sourceMap 19 | } 20 | } 21 | 22 | // generate loader string to be used with extract text plugin 23 | const generateLoaders = (loader, loaderOptions) => { 24 | let loaders = options.useVue ? [cssLoader] : [] 25 | if (options.usePostCSS) { 26 | loaders.push(postcssLoader) 27 | } 28 | if (loader) { 29 | loaders.push({ 30 | loader: loader + '-loader', 31 | options: Object.assign({}, loaderOptions, { 32 | sourceMap: options.sourceMap 33 | }) 34 | }) 35 | } 36 | if (options.useVue) { 37 | return ['vue-style-loader'].concat(loaders) 38 | } 39 | else { 40 | return loaders 41 | } 42 | } 43 | 44 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 45 | return { 46 | less: generateLoaders('less'), 47 | sass: generateLoaders('sass', { indentedSyntax: true }), 48 | scss: generateLoaders('sass'), 49 | stylus: generateLoaders('stylus'), 50 | styl: generateLoaders('stylus') 51 | } 52 | } 53 | 54 | // Generate loaders for standalone style files (outside of .vue) 55 | exports.styleLoaders = function (options) { 56 | const output = [] 57 | const loaders = exports.cssLoaders(options) 58 | 59 | for (const extension in loaders) { 60 | const loader = loaders[extension] 61 | output.push({ 62 | test: new RegExp('\\.' + extension + '$'), 63 | use: loader 64 | }) 65 | } 66 | 67 | return output 68 | } 69 | 70 | exports.createNotifierCallback = () => { 71 | const notifier = require('node-notifier') 72 | 73 | return (severity, errors) => { 74 | if (severity !== 'error') return 75 | 76 | const error = errors[0] 77 | const filename = error.file && error.file.split('!').pop() 78 | 79 | notifier.notify({ 80 | title: packageConfig.name, 81 | message: severity + ': ' + error.name, 82 | subtitle: filename || '', 83 | icon: path.join(__dirname, 'logo.png') 84 | }) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /configs/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | const utils = require('./utils') 2 | const config = require('./config') 3 | const isProduction = process.env.NODE_ENV === 'production' 4 | const sourceMapEnabled = isProduction 5 | ? config.prod.productionSourceMap 6 | : config.dev.cssSourceMap 7 | 8 | module.exports = (options) => { 9 | return { 10 | loaders: utils.cssLoaders({ 11 | // sourceMap: use sourcemao or not. 12 | sourceMap: options && sourceMapEnabled, 13 | // useVue: use vue-style-loader or not 14 | useVue: options && options.useVue, 15 | // usePostCSS: use postcss to compile styles. 16 | usePostCSS: options && options.usePostCSS 17 | }), 18 | cssSourceMap: sourceMapEnabled, 19 | cacheBusting: config.dev.cacheBusting 20 | } 21 | } -------------------------------------------------------------------------------- /configs/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | const commonConfig = require('./webpack.common.conf'); 2 | const webpackMerge = require('webpack-merge'); // used to merge webpack configs 3 | const os = require('os'); 4 | const webpack = require('webpack'); 5 | 6 | const config = require('./config'); 7 | const helper = require('./helper'); 8 | 9 | /** 10 | * Webpack Plugins 11 | */ 12 | const UglifyJsparallelPlugin = require('webpack-uglify-parallel'); 13 | 14 | /** 15 | * Webpack configuration for weex. 16 | */ 17 | const weexConfig = webpackMerge(commonConfig[1], { 18 | /* 19 | * Add additional plugins to the compiler. 20 | * 21 | * See: http://webpack.github.io/docs/configuration.html#plugins 22 | */ 23 | plugins: [ 24 | /* 25 | * Plugin: UglifyJsparallelPlugin 26 | * Description: Identical to standard uglify webpack plugin 27 | * with an option to build multiple files in parallel 28 | * 29 | * See: https://www.npmjs.com/package/webpack-uglify-parallel 30 | */ 31 | new UglifyJsparallelPlugin({ 32 | workers: os.cpus().length, 33 | mangle: true, 34 | compressor: { 35 | warnings: false, 36 | drop_console: true, 37 | drop_debugger: true 38 | } 39 | }), 40 | // Need to run uglify first, then pipe other webpack plugins 41 | ...commonConfig[1].plugins 42 | ] 43 | }) 44 | 45 | /** 46 | * Webpack configuration for web. 47 | */ 48 | const webConfig = webpackMerge(commonConfig[0], { 49 | /** 50 | * Developer tool to enhance debugging 51 | * 52 | * See: http://webpack.github.io/docs/configuration.html#devtool 53 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps 54 | */ 55 | devtool: config.prod.devtool, 56 | /** 57 | * Options affecting the output of the compilation. 58 | * 59 | * See: http://webpack.github.io/docs/configuration.html#output 60 | */ 61 | output: { 62 | /** 63 | * The output directory as absolute path (required). 64 | * 65 | * See: http://webpack.github.io/docs/configuration.html#output-path 66 | */ 67 | path: helper.rootNode('./dist'), 68 | /** 69 | * Specifies the name of each output file on disk. 70 | * IMPORTANT: You must not specify an absolute path here! 71 | * 72 | * See: http://webpack.github.io/docs/configuration.html#output-filename 73 | */ 74 | filename: '[name].web.js', 75 | /** 76 | * The filename of the SourceMaps for the JavaScript files. 77 | * They are inside the output.path directory. 78 | * 79 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename 80 | */ 81 | sourceMapFilename: '[name].web.map' 82 | }, 83 | /* 84 | * Add additional plugins to the compiler. 85 | * 86 | * See: http://webpack.github.io/docs/configuration.html#plugins 87 | */ 88 | plugins: [ 89 | /** 90 | * Plugin: webpack.DefinePlugin 91 | * Description: The DefinePlugin allows you to create global constants which can be configured at compile time. 92 | * 93 | * See: https://webpack.js.org/plugins/define-plugin/ 94 | */ 95 | new webpack.DefinePlugin({ 96 | 'process.env': { 97 | 'NODE_ENV': config.prod.env 98 | } 99 | }), 100 | /* 101 | * Plugin: UglifyJsparallelPlugin 102 | * Description: Identical to standard uglify webpack plugin 103 | * with an option to build multiple files in parallel 104 | * 105 | * See: https://www.npmjs.com/package/webpack-uglify-parallel 106 | */ 107 | new UglifyJsparallelPlugin({ 108 | workers: os.cpus().length, 109 | mangle: true, 110 | compressor: { 111 | warnings: false, 112 | drop_console: true, 113 | drop_debugger: true 114 | } 115 | }) 116 | ] 117 | }); 118 | 119 | module.exports = [weexConfig, webConfig] 120 | -------------------------------------------------------------------------------- /configs/webpack.test.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // This is the webpack config used for unit tests. 3 | 4 | const utils = require('./utils') 5 | const config = require('./config') 6 | const webpack = require('webpack') 7 | const merge = require('webpack-merge') 8 | const baseWebpackConfig = require('./webpack.common.conf') 9 | 10 | const webpackConfig = merge(baseWebpackConfig[0], { 11 | // use inline sourcemap for karma-sourcemap-loader 12 | module: { 13 | rules: utils.styleLoaders() 14 | }, 15 | devtool: '#inline-source-map', 16 | resolveLoader: { 17 | alias: { 18 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option 19 | // see discussion at https://github.com/vuejs/vue-loader/issues/724 20 | 'scss-loader': 'sass-loader' 21 | } 22 | }, 23 | plugins: [ 24 | new webpack.DefinePlugin({ 25 | 'process.env': { 26 | 'NODE_ENV': config.test.env 27 | } 28 | }) 29 | ] 30 | }) 31 | 32 | // no need for app entry during tests 33 | delete webpackConfig.entry 34 | 35 | module.exports = webpackConfig 36 | -------------------------------------------------------------------------------- /ios.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "AppName":"Nat Explorer", 3 | "Version":"1.1.0", 4 | "BuildVersion":"7", 5 | "AppId":"com.instapp.natex", 6 | "CodeSign":"", 7 | "Profile":"", 8 | "WeexBundle":"index.js" 9 | } 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nat-explorer", 3 | "version": "1.0.0", 4 | "description": "A weex project", 5 | "author": "", 6 | "private": true, 7 | "scripts": { 8 | "start": "npm run serve", 9 | "build": "webpack --env.NODE_ENV=common", 10 | "build:prod": "webpack --env.NODE_ENV=production", 11 | "build:prod:web": "webpack --env.NODE_ENV=release", 12 | "build:plugin": "webpack --env.NODE_ENV=plugin", 13 | "clean:web": "rimraf ./release/web", 14 | "clean:ios": "rimraf ./release/ios", 15 | "clean:android": "rimraf ./release/android", 16 | "dev": "webpack --env.NODE_ENV=common --progress --watch", 17 | "unit": "karma start test/unit/karma.conf.js --single-run", 18 | "test": "npm run unit", 19 | "lint": "eslint --ext .js,.vue src test/unit --fix", 20 | "serve": "webpack-dev-server --env.NODE_ENV=development --progress", 21 | "ios": "weex run ios", 22 | "web": "npm run serve", 23 | "android": "weex run android", 24 | "pack:ios": "npm run clean:ios && weex build ios", 25 | "pack:android": "npm run clean:android && weex build android", 26 | "pack:web": "npm run clean:web && npm run build:prod:web" 27 | }, 28 | "keywords": [ 29 | "weex" 30 | ], 31 | "license": "MIT", 32 | "dependencies": { 33 | "natjs": "^0.1.5", 34 | "phantom-limb": "0.0.1", 35 | "vue": "^2.5.11", 36 | "weex-vue-render": "^1.0.17" 37 | }, 38 | "devDependencies": { 39 | "autoprefixer": "^8.0.0", 40 | "babel-core": "^6.26.0", 41 | "babel-eslint": "^8.2.1", 42 | "babel-loader": "^7.1.1", 43 | "babel-preset-stage-0": "^6.24.1", 44 | "chai": "^4.1.2", 45 | "css-loader": "^0.28.8", 46 | "eslint": "^4.15.0", 47 | "eslint-config-standard": "^10.2.1", 48 | "eslint-config-vue": "^2.0.2", 49 | "eslint-friendly-formatter": "^3.0.0", 50 | "eslint-loader": "^1.7.1", 51 | "eslint-plugin-html": "^4.0.2", 52 | "eslint-plugin-import": "^2.7.0", 53 | "eslint-plugin-node": "^5.2.0", 54 | "eslint-plugin-promise": "^3.4.0", 55 | "eslint-plugin-standard": "^3.0.1", 56 | "eslint-plugin-vue": "^4.0.0", 57 | "extract-text-webpack-plugin": "^3.0.2", 58 | "friendly-errors-webpack-plugin": "^1.6.1", 59 | "fs-extra": "^5.0.0", 60 | "html-webpack-plugin": "^2.30.1", 61 | "ip": "^1.1.5", 62 | "karma": "^1.7.1", 63 | "karma-coverage": "^1.1.1", 64 | "karma-mocha": "^1.3.0", 65 | "karma-phantomjs-launcher": "^1.0.4", 66 | "karma-phantomjs-shim": "^1.5.0", 67 | "karma-sinon-chai": "^1.3.3", 68 | "karma-sourcemap-loader": "^0.3.7", 69 | "karma-spec-reporter": "0.0.31", 70 | "karma-webpack": "^2.0.6", 71 | "less": "^3.0.1", 72 | "less-loader": "^4.1.0", 73 | "node-notifier": "^5.1.2", 74 | "portfinder": "^1.0.13", 75 | "postcss-import": "^11.0.0", 76 | "postcss-loader": "^2.0.9", 77 | "postcss-plugin-weex": "^0.1.6", 78 | "pug": "^2.0.1", 79 | "raw-loader": "^0.5.1", 80 | "rimraf": "^2.6.2", 81 | "script-ext-html-webpack-plugin": "^1.8.5", 82 | "sinon": "^4.1.3", 83 | "sinon-chai": "^2.14.0", 84 | "vue-loader": "^12.2.0", 85 | "vue-style-loader": "^3.0.3", 86 | "vue-template-compiler": "^2.5.11", 87 | "webpack": "^3.10.0", 88 | "webpack-dev-server": "^2.9.7", 89 | "webpack-merge": "^4.1.0", 90 | "webpack-uglify-parallel": "^0.1.4", 91 | "weex-loader": "^0.7.2", 92 | "weex-vue-precompiler": "^0.1.17" 93 | }, 94 | "optionalDependencies": { 95 | "ios-deploy": "^1.9.0" 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /platforms/android/.weex_plugin.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "maven", 4 | "groupId": "com.instapp.nat", 5 | "name": "weex-plugin-camera", 6 | "version": "1.0.2", 7 | "dependency": "com.instapp.nat:weex-plugin-camera:1.0.2" 8 | }, 9 | { 10 | "type": "maven", 11 | "groupId": "com.instapp.nat", 12 | "name": "weex-plugin-communication", 13 | "version": "1.0.1", 14 | "dependency": "com.instapp.nat:weex-plugin-communication:1.0.1" 15 | }, 16 | { 17 | "type": "maven", 18 | "groupId": "com.instapp.nat", 19 | "name": "weex-plugin-device-battery", 20 | "version": "1.0.0-alpha", 21 | "dependency": "com.instapp.nat:weex-plugin-device-battery:1.0.0-alpha" 22 | }, 23 | { 24 | "type": "maven", 25 | "groupId": "com.instapp.nat", 26 | "name": "weex-plugin-device-info", 27 | "version": "1.0.0-alpha", 28 | "dependency": "com.instapp.nat:weex-plugin-device-info:1.0.0-alpha" 29 | }, 30 | { 31 | "type": "maven", 32 | "groupId": "com.instapp.nat", 33 | "name": "weex-plugin-device-network", 34 | "version": "1.0.0-alpha.1", 35 | "dependency": "com.instapp.nat:weex-plugin-device-network:1.0.0-alpha.1" 36 | }, 37 | { 38 | "type": "maven", 39 | "groupId": "com.instapp.nat", 40 | "name": "weex-plugin-device-screen", 41 | "version": "1.0.0-alpha.1", 42 | "dependency": "com.instapp.nat:weex-plugin-device-screen:1.0.0-alpha.1" 43 | }, 44 | { 45 | "type": "maven", 46 | "groupId": "com.instapp.nat", 47 | "name": "weex-plugin-device-vibration", 48 | "version": "1.0.0-alpha.1", 49 | "dependency": "com.instapp.nat:weex-plugin-device-vibration:1.0.0-alpha.1" 50 | }, 51 | { 52 | "type": "maven", 53 | "groupId": "com.instapp.nat", 54 | "name": "weex-plugin-device-volume", 55 | "version": "1.0.0-alpha", 56 | "dependency": "com.instapp.nat:weex-plugin-device-volume:1.0.0-alpha" 57 | }, 58 | { 59 | "type": "maven", 60 | "groupId": "com.instapp.nat", 61 | "name": "weex-plugin-geolocation", 62 | "version": "1.0.1", 63 | "dependency": "com.instapp.nat:weex-plugin-geolocation:1.0.1" 64 | }, 65 | { 66 | "type": "maven", 67 | "groupId": "com.instapp.nat", 68 | "name": "weex-plugin-media-audio", 69 | "version": "1.0.0-alpha", 70 | "dependency": "com.instapp.nat:weex-plugin-media-audio:1.0.0-alpha" 71 | }, 72 | { 73 | "type": "maven", 74 | "groupId": "com.instapp.nat", 75 | "name": "weex-plugin-media-image", 76 | "version": "1.0.1", 77 | "dependency": "com.instapp.nat:weex-plugin-media-image:1.0.1" 78 | }, 79 | { 80 | "type": "maven", 81 | "groupId": "com.instapp.nat", 82 | "name": "weex-plugin-media-video", 83 | "version": "1.0.0-alpha", 84 | "dependency": "com.instapp.nat:weex-plugin-media-video:1.0.0-alpha" 85 | }, 86 | { 87 | "type": "maven", 88 | "groupId": "com.instapp.nat", 89 | "name": "weex-plugin-modal", 90 | "version": "1.0.1-alpha", 91 | "dependency": "com.instapp.nat:weex-plugin-modal:1.0.1-alpha" 92 | }, 93 | { 94 | "type": "maven", 95 | "groupId": "com.instapp.nat", 96 | "name": "weex-plugin-recorder", 97 | "version": "1.0.1", 98 | "dependency": "com.instapp.nat:weex-plugin-recorder:1.0.1" 99 | }, 100 | { 101 | "type": "maven", 102 | "groupId": "com.instapp.nat", 103 | "name": "weex-plugin-sensor-accelerometer", 104 | "version": "1.0.0-alpha", 105 | "dependency": "com.instapp.nat:weex-plugin-sensor-accelerometer:1.0.0-alpha" 106 | }, 107 | { 108 | "type": "maven", 109 | "groupId": "com.instapp.nat", 110 | "name": "weex-plugin-sensor-compass", 111 | "version": "1.0.0-alpha", 112 | "dependency": "com.instapp.nat:weex-plugin-sensor-compass:1.0.0-alpha" 113 | }, 114 | { 115 | "type": "maven", 116 | "groupId": "com.instapp.nat", 117 | "name": "weex-plugin-stream", 118 | "version": "1.0.0-alpha", 119 | "dependency": "com.instapp.nat:weex-plugin-stream:1.0.0-alpha" 120 | }, 121 | { 122 | "type": "maven", 123 | "groupId": "com.instapp.nat", 124 | "name": "weex-plugin-transfer", 125 | "version": "1.0.0-alpha", 126 | "dependency": "com.instapp.nat:weex-plugin-transfer:1.0.0-alpha" 127 | } 128 | ] -------------------------------------------------------------------------------- /platforms/android/NOTICE: -------------------------------------------------------------------------------- 1 | Weex android playground 2 | Copyright 2016 Alibaba Group 3 | 4 | This product includes software developed at Alibaba Group. (http://www.alibabagroup.com) 5 | 6 | This product contains software zxing(https://github.com/zxing/zxing) developed 7 | by Google Inc. , licensed under the Apache License. -------------------------------------------------------------------------------- /platforms/android/README.md: -------------------------------------------------------------------------------- 1 | ### weex apps samples 2 | 3 | *Please install the weex-toolkit before use hotrefresh* 4 | 5 | [Development Tools link](https://github.com/alibaba/weex_toolchain) -------------------------------------------------------------------------------- /platforms/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.taobao.android.weex.plugin.gradle' 3 | 4 | android { 5 | compileSdkVersion project.compileSdkVersion 6 | buildToolsVersion project.buildToolsVersion 7 | 8 | defaultConfig { 9 | applicationId "com.instapp.natex" 10 | minSdkVersion project.appMinSdkVersion 11 | targetSdkVersion project.targetSdkVersion 12 | versionCode 9 13 | versionName "1.1.0" 14 | ndk { 15 | abiFilters "x86" 16 | abiFilters "armeabi" 17 | } 18 | multiDexEnabled true 19 | } 20 | applicationVariants.all { variant -> 21 | variant.outputs.each { output -> 22 | def outputFile = output.outputFile 23 | if (outputFile != null && outputFile.name.equals('app-debug.apk')) { 24 | def fileName = outputFile.name.replace("app-debug.apk", "weex-app.apk") 25 | output.outputFile = new File(outputFile.parent, fileName) 26 | } 27 | } 28 | } 29 | signingConfigs { 30 | debug { 31 | storeFile file("tools/debug.keystore") 32 | storePassword "android" 33 | keyAlias "androiddebugkey" 34 | keyPassword "android" 35 | } 36 | } 37 | buildTypes { 38 | debug { 39 | signingConfig signingConfigs.debug 40 | } 41 | } 42 | sourceSets { 43 | main { 44 | java { 45 | srcDirs = ["src/main/java", "src/main/java_zxing"]; 46 | } 47 | } 48 | } 49 | lintOptions { 50 | abortOnError false 51 | } 52 | 53 | packagingOptions { 54 | exclude 'LICENSE.txt' 55 | } 56 | 57 | compileOptions { 58 | sourceCompatibility JavaVersion.VERSION_1_7 59 | targetCompatibility JavaVersion.VERSION_1_7 60 | } 61 | 62 | dexOptions { 63 | jumboMode true 64 | } 65 | } 66 | 67 | 68 | dependencies { 69 | compile fileTree(include: ['*.jar'], dir: 'libs') 70 | compile 'com.taobao.android:weex_sdk:0.18.0' 71 | compile 'com.google.code.findbugs:jsr305:2.0.1' 72 | compile 'com.squareup.okhttp:okhttp:2.3.0' 73 | compile 'com.squareup.okhttp:okhttp-ws:2.3.0' 74 | compile 'com.squareup.okio:okio:1.0.1' 75 | compile 'com.squareup.picasso:picasso:2.5.2' 76 | compile "com.alibaba:fastjson:${project.fastjsonLibVersion}" 77 | compile "com.android.support:support-v4:${project.supportLibVersion}" 78 | compile "com.android.support:appcompat-v7:${project.supportLibVersion}" 79 | compile "com.android.support:design:${project.supportLibVersion}" 80 | compile "com.android.support:support-annotations:${project.supportLibVersion}" 81 | compile 'com.taobao.android:weex_inspector:0.13.5-multicontext' 82 | compile 'com.journeyapps:zxing-android-embedded:3.4.0' 83 | // PLUGIN GRADLE EXTENSIONS START 84 | compile 'com.taobao.android:weexplugin-loader:1.3' 85 | compile 'com.taobao.android:weexplugin-processor:1.3' 86 | compile 'com.taobao.android:weexplugin-annotation:1.3' 87 | // PLUGIN GRADLE EXTENSIONS END 88 | compile 'cn.leancloud.android:avoscloud-sdk:v4.6.4' 89 | compile 'cn.leancloud.android:avoscloud-statistics:v4.6.4' 90 | } 91 | -------------------------------------------------------------------------------- /platforms/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 /Users/lixinke/Tool/android-eclipse/adt-bundle-mac-x86_64-20140702/sdk/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 | ##weex 19 | -keep class com.taobao.weex.bridge.**{*;} 20 | -keep class com.taobao.weex.dom.**{*;} 21 | -keep class com.taobao.weex.adapter.**{*;} 22 | -keep class com.taobao.weex.common.**{*;} 23 | -keep class * implements com.taobao.weex.IWXObject{*;} 24 | -keep class com.taobao.weex.ui.**{*;} 25 | -keep class com.taobao.weex.ui.component.**{*;} 26 | -keep class com.taobao.weex.utils.**{ 27 | public ; 28 | public ; 29 | } 30 | -keep class com.taobao.weex.view.**{*;} 31 | -keep class com.taobao.weex.module.**{*;} 32 | -keep public class * extends com.taobao.weex.common.WXModule{*;} 33 | -keep public class com.taobao.weex.WXDebugTool{*;} -------------------------------------------------------------------------------- /platforms/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/assets/index.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ function(module, exports) { 46 | 47 | ;__weex_define__("@weex-component/0f3c9ae76450de3e67cfabcbf5621bf7", [], function(__weex_require__, __weex_exports__, __weex_module__){ 48 | 49 | ;__weex_module__.exports.template = __weex_module__.exports.template || {} 50 | ;Object.assign(__weex_module__.exports.template, { 51 | "type": "div", 52 | "children": [ 53 | { 54 | "type": "text", 55 | "style": { 56 | "fontSize": 100 57 | }, 58 | "attr": { 59 | "value": "Hello World." 60 | } 61 | } 62 | ] 63 | }) 64 | }) 65 | ;__weex_bootstrap__("@weex-component/0f3c9ae76450de3e67cfabcbf5621bf7", { 66 | "transformerVersion": "0.3.1" 67 | },undefined) 68 | 69 | /***/ } 70 | /******/ ]); -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/ApiKey.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex; 2 | 3 | /** 4 | * Created by Acathur on 28/07/2017. 5 | */ 6 | 7 | public class ApiKey { 8 | public static final String LC_APPID = "Your Leancloud AppId"; 9 | public static final String LC_APPKEY = "Your Leancloud AppKey"; 10 | } 11 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.os.Bundle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | import android.view.animation.Animation; 9 | import android.view.animation.AnimationSet; 10 | 11 | public class SplashActivity extends AppCompatActivity { 12 | 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_splash); 18 | 19 | View textView = findViewById(R.id.fullscreen_content); 20 | 21 | AnimationSet animationSet = new AnimationSet(false); 22 | animationSet.setDuration(10); 23 | 24 | animationSet.setAnimationListener(new Animation.AnimationListener() { 25 | @Override 26 | public void onAnimationStart(Animation animation) { 27 | } 28 | 29 | @Override 30 | public void onAnimationEnd(Animation animation) { 31 | Intent intent = new Intent(SplashActivity.this, WXPageActivity.class); 32 | Uri data = getIntent().getData(); 33 | if (data != null) { 34 | intent.setData(data); 35 | } 36 | intent.putExtra("from", "splash"); 37 | startActivity(intent); 38 | finish(); 39 | } 40 | 41 | @Override 42 | public void onAnimationRepeat(Animation animation) { 43 | } 44 | }); 45 | 46 | textView.startAnimation(animationSet); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/WXApplication.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex; 2 | 3 | import android.app.Application; 4 | import android.os.Build; 5 | import android.os.StrictMode; 6 | 7 | import com.instapp.natex.extend.ImageAdapter; 8 | import com.instapp.natex.extend.WXEventModule; 9 | import com.alibaba.weex.plugin.loader.WeexPluginContainer; 10 | import com.instapp.natex.util.AppConfig; 11 | import com.taobao.weex.InitConfig; 12 | import com.taobao.weex.WXSDKEngine; 13 | import com.taobao.weex.common.WXException; 14 | import com.avos.avoscloud.AVOSCloud; 15 | import com.avos.avoscloud.AVAnalytics; 16 | 17 | public class WXApplication extends Application { 18 | 19 | @Override 20 | public void onCreate() { 21 | if (Build.VERSION.SDK_INT>=18) { 22 | StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); 23 | StrictMode.setVmPolicy(builder.build()); 24 | builder.detectFileUriExposure(); 25 | } 26 | 27 | super.onCreate(); 28 | 29 | WXSDKEngine.addCustomOptions("appName", "NatExplorer"); 30 | WXSDKEngine.addCustomOptions("appGroup", "Instapp"); 31 | WXSDKEngine.initialize(this, 32 | new InitConfig.Builder().setImgAdapter(new ImageAdapter()).build() 33 | ); 34 | 35 | AVOSCloud.useAVCloudUS(); 36 | AVOSCloud.initialize(this, ApiKey.LC_APPID, ApiKey.LC_APPKEY); 37 | AVAnalytics.enableCrashReport(this, true); 38 | 39 | try { 40 | WXSDKEngine.registerModule("event", WXEventModule.class); 41 | } catch (WXException e) { 42 | e.printStackTrace(); 43 | } 44 | AppConfig.init(this); 45 | WeexPluginContainer.loadAll(this); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/extend/BlurTransformation.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 com.instapp.natex.extend; 20 | 21 | import android.graphics.Bitmap; 22 | 23 | import com.squareup.picasso.Transformation; 24 | 25 | public class BlurTransformation implements Transformation { 26 | 27 | private int mRadius; 28 | 29 | public BlurTransformation(int radius) { 30 | mRadius = radius; 31 | } 32 | 33 | @Override public Bitmap transform(Bitmap source) { 34 | if(mRadius <= 0) { 35 | return source; 36 | } 37 | Bitmap bitmap; 38 | try { 39 | bitmap = BlurTool.blur(source, mRadius); 40 | }catch (Exception e){ 41 | bitmap = source; 42 | } 43 | if(bitmap != source) { 44 | source.recycle(); 45 | } 46 | return bitmap; 47 | } 48 | 49 | @Override public String key() { 50 | return "BlurTransformation(radius=" + mRadius + ")"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/extend/ImageAdapter.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 com.instapp.natex.extend; 20 | 21 | import android.net.Uri; 22 | import android.text.TextUtils; 23 | import android.widget.ImageView; 24 | 25 | import com.squareup.picasso.Callback; 26 | import com.squareup.picasso.Picasso; 27 | import com.taobao.weex.WXEnvironment; 28 | import com.taobao.weex.WXSDKManager; 29 | import com.taobao.weex.adapter.IWXImgLoaderAdapter; 30 | import com.taobao.weex.common.WXImageStrategy; 31 | import com.taobao.weex.dom.WXImageQuality; 32 | 33 | public class ImageAdapter implements IWXImgLoaderAdapter { 34 | 35 | public ImageAdapter() { 36 | } 37 | 38 | @Override 39 | public void setImage(final String url, final ImageView view, 40 | WXImageQuality quality, final WXImageStrategy strategy) { 41 | 42 | WXSDKManager.getInstance().postOnUiThread(new Runnable() { 43 | 44 | @Override 45 | public void run() { 46 | if(view==null||view.getLayoutParams()==null){ 47 | return; 48 | } 49 | if (TextUtils.isEmpty(url)) { 50 | view.setImageBitmap(null); 51 | return; 52 | } 53 | String temp = url; 54 | if (url.startsWith("//")) { 55 | temp = "http:" + url; 56 | } 57 | if (view.getLayoutParams().width <= 0 || view.getLayoutParams().height <= 0) { 58 | return; 59 | } 60 | 61 | 62 | if(!TextUtils.isEmpty(strategy.placeHolder)){ 63 | Picasso.Builder builder=new Picasso.Builder(WXEnvironment.getApplication()); 64 | Picasso picasso=builder.build(); 65 | picasso.load(Uri.parse(strategy.placeHolder)).into(view); 66 | 67 | view.setTag(strategy.placeHolder.hashCode(),picasso); 68 | } 69 | 70 | Picasso.with(WXEnvironment.getApplication()) 71 | .load(temp) 72 | .transform(new BlurTransformation(strategy.blurRadius)) 73 | .into(view, new Callback() { 74 | @Override 75 | public void onSuccess() { 76 | if(strategy.getImageListener()!=null){ 77 | strategy.getImageListener().onImageFinish(url,view,true,null); 78 | } 79 | 80 | if(!TextUtils.isEmpty(strategy.placeHolder)){ 81 | ((Picasso) view.getTag(strategy.placeHolder.hashCode())).cancelRequest(view); 82 | } 83 | } 84 | 85 | @Override 86 | public void onError() { 87 | if(strategy.getImageListener()!=null){ 88 | strategy.getImageListener().onImageFinish(url,view,false,null); 89 | } 90 | } 91 | }); 92 | } 93 | },0); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/extend/WXEventModule.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex.extend; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.text.TextUtils; 6 | 7 | import com.instapp.natex.WXPageActivity; 8 | import com.taobao.weex.annotation.JSMethod; 9 | import com.taobao.weex.common.WXModule; 10 | 11 | 12 | public class WXEventModule extends WXModule { 13 | @JSMethod() 14 | public void openURL(String url) { 15 | if (TextUtils.isEmpty(url)) { 16 | return; 17 | } 18 | Uri uri = Uri.parse(url); 19 | String scheme = uri.getScheme(); 20 | 21 | if (scheme.equals("http") || scheme.equals("https") || scheme.equals("file")) { 22 | Intent renderIntent = new Intent(mWXSDKInstance.getContext(), WXPageActivity.class); 23 | renderIntent.setData(uri); 24 | mWXSDKInstance.getContext().startActivity(renderIntent); 25 | } else { 26 | Intent intent = new Intent(Intent.ACTION_VIEW); 27 | intent.setData(uri); 28 | mWXSDKInstance.getContext().startActivity(intent); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/hotreload/HotReloadManager.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex.hotreload; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.squareup.okhttp.OkHttpClient; 6 | import com.squareup.okhttp.Request; 7 | import com.squareup.okhttp.Response; 8 | import com.squareup.okhttp.ws.WebSocket; 9 | import com.squareup.okhttp.ws.WebSocketCall; 10 | import com.squareup.okhttp.ws.WebSocketListener; 11 | import com.taobao.weex.utils.WXLogUtils; 12 | 13 | import org.json.JSONException; 14 | import org.json.JSONObject; 15 | 16 | import java.io.IOException; 17 | 18 | import okio.Buffer; 19 | import okio.BufferedSource; 20 | 21 | /** 22 | * Created by moxun on 29/12/2017. 23 | */ 24 | 25 | public class HotReloadManager { 26 | private static final String TAG = "HotReloadManager"; 27 | private ActionListener listener; 28 | private WebSocket session; 29 | 30 | public HotReloadManager(String ws, final ActionListener actionListener) { 31 | if (TextUtils.isEmpty(ws) || actionListener == null) { 32 | WXLogUtils.w("HotReloadManager", "Illegal arguments"); 33 | return; 34 | } 35 | this.listener = actionListener; 36 | 37 | OkHttpClient client = new OkHttpClient(); 38 | Request.Builder builder = new Request.Builder(); 39 | builder.url(ws); 40 | Request request = builder.build(); 41 | WebSocketCall call = WebSocketCall.create(client, request); 42 | call.enqueue(new WebSocketListener() { 43 | @Override 44 | public void onOpen(WebSocket webSocket, Request request, Response response) throws IOException { 45 | WXLogUtils.w(TAG, "ws session open"); 46 | session = webSocket; 47 | } 48 | 49 | @Override 50 | public void onMessage(BufferedSource bufferedSource, WebSocket.PayloadType payloadType) throws IOException { 51 | WXLogUtils.w(TAG, "on message"); 52 | if (payloadType == WebSocket.PayloadType.TEXT) { 53 | String message = bufferedSource.readUtf8(); 54 | bufferedSource.close(); 55 | try { 56 | JSONObject rpcMessage = new JSONObject(message); 57 | String method = rpcMessage.optString("method", null); 58 | if (!TextUtils.isEmpty(method)) { 59 | if ("WXReload".equals(method)) { 60 | listener.reload(); 61 | } else if ("WXReloadBundle".equals(method)) { 62 | String bundleUrl = rpcMessage.optString("params", null); 63 | if (!TextUtils.isEmpty(bundleUrl)) { 64 | listener.render(bundleUrl); 65 | } 66 | } 67 | } 68 | } catch (JSONException e) { 69 | e.printStackTrace(); 70 | } 71 | } 72 | } 73 | 74 | @Override 75 | public void onPong(Buffer buffer) { 76 | WXLogUtils.w(TAG, "on pong"); 77 | } 78 | 79 | @Override 80 | public void onClose(int i, String s) { 81 | WXLogUtils.w("HotReloadManager", "Closed:" + i + ", " + s); 82 | } 83 | 84 | @Override 85 | public void onFailure(IOException e) { 86 | e.printStackTrace(); 87 | } 88 | }); 89 | } 90 | 91 | public void destroy() { 92 | if (session != null) { 93 | try { 94 | session.close(1001, "GOING_AWAY"); 95 | } catch (IOException e) { 96 | e.printStackTrace(); 97 | } 98 | } 99 | } 100 | 101 | public interface ActionListener { 102 | void reload(); 103 | 104 | void render(String bundleUrl); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/util/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex.util; 2 | 3 | import android.content.Context; 4 | 5 | 6 | /** 7 | * Created by budao on 2016/10/12. 8 | */ 9 | public class AppConfig { 10 | private static final String TAG = "AppConfig"; 11 | private static AppPreferences sPreferences = new AppPreferences(); 12 | 13 | public static void init(Context context) { 14 | loadAppSetting(context); 15 | } 16 | 17 | public static String getLaunchUrl() { 18 | if (isLaunchLocally()) { 19 | return sPreferences.getString("local_url", "file://assets/index.js"); 20 | } 21 | return sPreferences.getString("launch_url", "http://127.0.0.1:8080/dist/index.js"); 22 | } 23 | 24 | public static Boolean isLaunchLocally() { 25 | return sPreferences.getBoolean("launch_locally", false); 26 | } 27 | 28 | private static void loadAppSetting(Context context) { 29 | AppConfigXmlParser parser = new AppConfigXmlParser(); 30 | parser.parse(context); 31 | sPreferences = parser.getPreferences(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/util/AppConfigXmlParser.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 com.instapp.natex.util; 21 | 22 | import android.content.Context; 23 | import android.util.Log; 24 | 25 | import org.xmlpull.v1.XmlPullParser; 26 | import org.xmlpull.v1.XmlPullParserException; 27 | 28 | import java.io.IOException; 29 | import java.util.Locale; 30 | 31 | public class AppConfigXmlParser { 32 | private static String TAG = "AppConfigXmlParser"; 33 | 34 | private AppPreferences prefs = new AppPreferences(); 35 | 36 | public AppPreferences getPreferences() { 37 | return prefs; 38 | } 39 | 40 | public synchronized void parse(Context action) { 41 | // First checking the class namespace for config.xml 42 | int id = action.getResources().getIdentifier("app_config", "xml", action.getClass().getPackage() 43 | .getName()); 44 | if (id == 0) { 45 | // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml 46 | id = action.getResources().getIdentifier("app_config", "xml", action.getPackageName()); 47 | if (id == 0) { 48 | Log.e(TAG, "res/xml/app_config.xml is missing!"); 49 | return; 50 | } 51 | } 52 | parse(action.getResources().getXml(id)); 53 | } 54 | 55 | public void parse(XmlPullParser xml) { 56 | int eventType = -1; 57 | 58 | while (eventType != XmlPullParser.END_DOCUMENT) { 59 | if (eventType == XmlPullParser.START_TAG) { 60 | handleStartTag(xml); 61 | } else if (eventType == XmlPullParser.END_TAG) { 62 | handleEndTag(xml); 63 | } 64 | try { 65 | eventType = xml.next(); 66 | } catch (XmlPullParserException e) { 67 | e.printStackTrace(); 68 | } catch (IOException e) { 69 | e.printStackTrace(); 70 | } 71 | } 72 | } 73 | 74 | private void handleStartTag(XmlPullParser xml) { 75 | String strNode = xml.getName(); 76 | if (strNode.equals("preference")) { 77 | String name = xml.getAttributeValue(null, "name").toLowerCase(Locale.ENGLISH); 78 | String value = xml.getAttributeValue(null, "value"); 79 | prefs.set(name, value); 80 | } 81 | } 82 | 83 | private void handleEndTag(XmlPullParser xml) { 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/util/AppPreferences.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 com.instapp.natex.util; 21 | 22 | import android.os.Bundle; 23 | 24 | import java.util.HashMap; 25 | import java.util.Locale; 26 | import java.util.Map; 27 | 28 | public class AppPreferences { 29 | private HashMap prefs = new HashMap(20); 30 | private Bundle preferencesBundleExtras; 31 | 32 | public void setPreferencesBundle(Bundle extras) { 33 | preferencesBundleExtras = extras; 34 | } 35 | 36 | public void set(String name, String value) { 37 | prefs.put(name.toLowerCase(Locale.ENGLISH), value); 38 | } 39 | 40 | public void set(String name, boolean value) { 41 | set(name, "" + value); 42 | } 43 | 44 | public void set(String name, int value) { 45 | set(name, "" + value); 46 | } 47 | 48 | public void set(String name, double value) { 49 | set(name, "" + value); 50 | } 51 | 52 | public Map getAll() { 53 | return prefs; 54 | } 55 | 56 | public boolean getBoolean(String name, boolean defaultValue) { 57 | name = name.toLowerCase(Locale.ENGLISH); 58 | String value = prefs.get(name); 59 | if (value != null) { 60 | return Boolean.parseBoolean(value); 61 | } 62 | return defaultValue; 63 | } 64 | 65 | // Added in 4.0.0 66 | public boolean contains(String name) { 67 | return getString(name, null) != null; 68 | } 69 | 70 | public int getInteger(String name, int defaultValue) { 71 | name = name.toLowerCase(Locale.ENGLISH); 72 | String value = prefs.get(name); 73 | if (value != null) { 74 | // Use Integer.decode() can't handle it if the highest bit is set. 75 | return (int)(long) Long.decode(value); 76 | } 77 | return defaultValue; 78 | } 79 | 80 | public double getDouble(String name, double defaultValue) { 81 | name = name.toLowerCase(Locale.ENGLISH); 82 | String value = prefs.get(name); 83 | if (value != null) { 84 | return Double.valueOf(value); 85 | } 86 | return defaultValue; 87 | } 88 | 89 | public String getString(String name, String defaultValue) { 90 | name = name.toLowerCase(Locale.ENGLISH); 91 | String value = prefs.get(name); 92 | if (value != null) { 93 | return value; 94 | } 95 | return defaultValue; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/java/com/instapp/natex/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.instapp.natex.util; 2 | 3 | public class Constants { 4 | 5 | // public static final String BUNDLE_URL = "http://t.cn?_wx_tpl=http://h5.waptest.taobao.com/app/weextc031/build/TC__Home.js"; 6 | public static final String BUNDLE_URL = "http://t.cn?_wx_tpl=http://g.tbcdn.cn/weex/weex-tc/0.1.0/build/TC__Home.js"; 7 | public static final String TEST_BUNDLE_URL = BUNDLE_URL; 8 | public static final String WEEX_SAMPLES_KEY = "?weex-samples"; 9 | public static final String WEEX_TPL_KEY = "_wx_tpl"; 10 | public static final String PARAM_BUNDLE_URL = "bundleUrl"; 11 | 12 | 13 | //hot refresh 14 | public static final int HOT_REFRESH_CONNECT = 0x111; 15 | public static final int HOT_REFRESH_DISCONNECT = HOT_REFRESH_CONNECT + 1; 16 | public static final int HOT_REFRESH_REFRESH = HOT_REFRESH_DISCONNECT + 1; 17 | public static final int HOT_REFRESH_CONNECT_ERROR = HOT_REFRESH_REFRESH + 1; 18 | 19 | public static final String ACTION_OPEN_URL = "com.instapp.natex.protocol.openurl"; 20 | } 21 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-hdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-hdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-hdpi/ic_action_scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-hdpi/ic_action_scan.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-mdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-mdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-mdpi/ic_action_scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-mdpi/ic_action_scan.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-xhdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-xhdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-xhdpi/ic_action_scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-xhdpi/ic_action_scan.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-xxhdpi/ic_action_refresh.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/drawable-xxhdpi/ic_action_scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/drawable-xxhdpi/ic_action_scan.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/layout/activity_wxpage.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 15 | 20 | 21 | 22 | 23 | 29 | 30 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/menu/main_scan.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values-zh-rCN/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | Nat Explorer 19 | 20 | 请将条码置于取景框内扫描 21 | 对不起,您当前的设备是X86架构.\n我们只支持ARM架构的设备! 22 | 23 | 24 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #1F7AFB 4 | #303F9F 5 | 6 | #1F7AFB 7 | 8 | #FFFFFF 9 | #333333 10 | #66000000 11 | 12 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/drawables.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Nat Explorer 3 | ©️ Instapp 4 | Please place the QRcode in the frame 5 | Sorry, your current device is x86 architecture.\n We only 6 | support arm architecture devices! 7 | 8 | Network Error!\n1.Make sure you use the command "npm run serve" 9 | launched local service\n2.Make sure you modify "your_current_ip" to your local IP in 10 | "WXMainActivity" 11 | 12 | Scan 13 | Refresh 14 | 15 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 16 | 17 | 21 | 22 | 33 | 34 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | -------------------------------------------------------------------------------- /platforms/android/app/src/main/res/xml/app_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | Hello 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /platforms/android/app/tools/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/app/tools/debug.keystore -------------------------------------------------------------------------------- /platforms/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 | mavenLocal() 6 | jcenter() 7 | mavenCentral() 8 | maven { 9 | url 'https://maven.google.com/' 10 | name 'Google' 11 | } 12 | maven { 13 | url "http://mvn.leancloud.cn/nexus/content/repositories/public" 14 | } 15 | } 16 | dependencies { 17 | classpath 'com.android.tools.build:gradle:2.2.2' 18 | classpath 'com.taobao.android:weexplugin-gradle-plugin:1.3' 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | jcenter() 26 | mavenCentral() 27 | maven { 28 | url 'https://maven.google.com/' 29 | name 'Google' 30 | } 31 | maven { 32 | url "http://mvn.leancloud.cn/nexus/content/repositories/public" 33 | } 34 | } 35 | } 36 | 37 | task clean(type: Delete) { 38 | delete rootProject.buildDir 39 | } 40 | 41 | subprojects { 42 | ext { 43 | compileSdkVersion=26 44 | buildToolsVersion="26.0.0" 45 | minSdkVersion=14 46 | appMinSdkVersion=15 47 | targetSdkVersion=26 48 | supportLibVersion="26.1.0" 49 | fastjsonLibVersion="1.1.46.android" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /platforms/android/gradle.properties: -------------------------------------------------------------------------------- 1 | ## Project-wide Gradle settings. 2 | # 3 | # For more details on how to configure your build environment visit 4 | # http://www.gradle.org/docs/current/userguide/build_environment.html 5 | # 6 | # Specifies the JVM arguments used for the daemon process. 7 | # The setting is particularly useful for tweaking memory settings. 8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 10 | # 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | #Mon Jun 27 20:06:22 CST 2016 16 | android.useDeprecatedNdk=true 17 | -------------------------------------------------------------------------------- /platforms/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /platforms/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 15 12:24:19 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | #distributionUrl=http://gw.alicdn.com/bao/uploaded/LB1J5WLJVXXXXcMXpXXXXXXXXXX.zip 8 | #distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 9 | #distributionUrl=gradle-2.10-bin.zip -------------------------------------------------------------------------------- /platforms/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 | -------------------------------------------------------------------------------- /platforms/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /platforms/ios/Podfile: -------------------------------------------------------------------------------- 1 | source 'git@github.com/CocoaPods/Specs.git' 2 | platform :ios, '8.0' 3 | #inhibit_all_warnings! 4 | 5 | def common 6 | pod 'WeexNatMediaImage', '1.0.1' 7 | pod 'WeexNatRecorder', '1.0.0' 8 | pod 'WeexNatGeolocation', '1.0.1' 9 | pod 'WeexNatCommunication', '1.0.0' 10 | pod 'WeexNatCamera', '1.0.0' 11 | pod 'WeexNatTransfer', '1.0.1' 12 | pod 'WeexNatStream', '1.0.0' 13 | pod 'WeexNatSensorCompass', '1.0.1' 14 | pod 'WeexNatSensorAccelerometer', '1.0.0' 15 | pod 'WeexNatModal', '1.0.1' 16 | pod 'WeexNatMediaVideo', '1.0.0' 17 | pod 'WeexNatMediaAudio', '1.0.0' 18 | pod 'WeexNatDeviceVolume', '1.0.0' 19 | pod 'WeexNatDeviceVibration', '1.0.0' 20 | pod 'WeexNatDeviceScreen', '1.0.0' 21 | pod 'WeexNatDeviceNetwork', '1.0.0' 22 | pod 'WeexNatDeviceInfo', '1.0.0' 23 | pod 'WeexNatDeviceBattery', '1.0.0' 24 | pod 'WeexSDK' 25 | pod 'WeexPluginLoader' 26 | pod 'SDWebImage', '3.7.5' 27 | pod 'SocketRocket', '0.4.2' 28 | pod 'AVOSCloud' 29 | end 30 | 31 | target 'WeexDemo' do 32 | common 33 | end 34 | 35 | target 'WeexUITestDemo' do 36 | common 37 | end 38 | -------------------------------------------------------------------------------- /platforms/ios/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/README.md -------------------------------------------------------------------------------- /platforms/ios/WeexDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo.xcodeproj/xcshareddata/xcschemes/WeexUITestDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/ApiKey.h: -------------------------------------------------------------------------------- 1 | // 2 | // ApiKey.h 3 | // WeexDemo 4 | // 5 | // Created by Acathur on 28/07/2017. 6 | // Copyright © 2017 Instapp. All rights reserved. 7 | // 8 | 9 | #define LC_APPID @"Your Leancloud AppId" 10 | #define LC_APPKEY @"Your Leancloud AppKey" 11 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import "AppDelegate.h" 10 | #import "DemoDefine.h" 11 | #import "ApiKey.h" 12 | #import 13 | #import 14 | #import 15 | #import "WeexSDKManager.h" 16 | 17 | @interface AppDelegate () 18 | @end 19 | 20 | @implementation AppDelegate 21 | 22 | #pragma mark 23 | #pragma mark application 24 | 25 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 26 | { 27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 28 | self.window.backgroundColor = [UIColor whiteColor]; 29 | 30 | [WeexSDKManager setup]; 31 | 32 | // leancloud 33 | [AVOSCloud setServiceRegion:AVServiceRegionUS]; 34 | [AVOSCloud setApplicationId:LC_APPID clientKey:LC_APPKEY]; 35 | [AVAnalytics trackAppOpenedWithLaunchOptions:launchOptions]; 36 | 37 | [self.window makeKeyAndVisible]; 38 | 39 | // Override point for customization after application launch. 40 | [self startSplashScreen]; 41 | 42 | return YES; 43 | } 44 | 45 | #pragma mark 46 | #pragma mark animation when startup 47 | 48 | - (void)startSplashScreen 49 | { 50 | UIView* splashView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 51 | splashView.backgroundColor = [UIColor whiteColor]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "size" : "29x29", 15 | "idiom" : "iphone", 16 | "filename" : "launcher@58.png", 17 | "scale" : "2x" 18 | }, 19 | { 20 | "size" : "29x29", 21 | "idiom" : "iphone", 22 | "filename" : "launcher@87.png", 23 | "scale" : "3x" 24 | }, 25 | { 26 | "size" : "40x40", 27 | "idiom" : "iphone", 28 | "filename" : "launcher@80.png", 29 | "scale" : "2x" 30 | }, 31 | { 32 | "size" : "40x40", 33 | "idiom" : "iphone", 34 | "filename" : "launcher@120.png", 35 | "scale" : "3x" 36 | }, 37 | { 38 | "size" : "60x60", 39 | "idiom" : "iphone", 40 | "filename" : "launcher@120-1.png", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "size" : "60x60", 45 | "idiom" : "iphone", 46 | "filename" : "launcher@180.png", 47 | "scale" : "3x" 48 | }, 49 | { 50 | "idiom" : "ipad", 51 | "size" : "20x20", 52 | "scale" : "1x" 53 | }, 54 | { 55 | "idiom" : "ipad", 56 | "size" : "20x20", 57 | "scale" : "2x" 58 | }, 59 | { 60 | "idiom" : "ipad", 61 | "size" : "29x29", 62 | "scale" : "1x" 63 | }, 64 | { 65 | "size" : "29x29", 66 | "idiom" : "ipad", 67 | "filename" : "launcher@58-1.png", 68 | "scale" : "2x" 69 | }, 70 | { 71 | "size" : "40x40", 72 | "idiom" : "ipad", 73 | "filename" : "launcher@40.png", 74 | "scale" : "1x" 75 | }, 76 | { 77 | "size" : "40x40", 78 | "idiom" : "ipad", 79 | "filename" : "launcher@80-1.png", 80 | "scale" : "2x" 81 | }, 82 | { 83 | "size" : "76x76", 84 | "idiom" : "ipad", 85 | "filename" : "launcher@76.png", 86 | "scale" : "1x" 87 | }, 88 | { 89 | "size" : "76x76", 90 | "idiom" : "ipad", 91 | "filename" : "launcher@152.png", 92 | "scale" : "2x" 93 | }, 94 | { 95 | "size" : "83.5x83.5", 96 | "idiom" : "ipad", 97 | "filename" : "launcher@167.png", 98 | "scale" : "2x" 99 | }, 100 | { 101 | "size" : "1024x1024", 102 | "idiom" : "ios-marketing", 103 | "filename" : "launcher@1024.png", 104 | "scale" : "1x" 105 | } 106 | ], 107 | "info" : { 108 | "version" : 1, 109 | "author" : "xcode" 110 | } 111 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@1024.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@120-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@120-1.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@120.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@152.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@167.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@180.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@40.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@58-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@58-1.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@58.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@76.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@80-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@80-1.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@80.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/AppIcon.appiconset/launcher@87.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "2436h", 7 | "filename" : "iPhoneX@3x.png", 8 | "minimum-system-version" : "11.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "2436h", 16 | "filename" : "iPhoneX-landscape.png", 17 | "minimum-system-version" : "11.0", 18 | "orientation" : "landscape", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "736h", 25 | "filename" : "Default@3x.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "3x" 29 | }, 30 | { 31 | "extent" : "full-screen", 32 | "idiom" : "iphone", 33 | "subtype" : "736h", 34 | "filename" : "Default@3x-1.png", 35 | "minimum-system-version" : "8.0", 36 | "orientation" : "landscape", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "extent" : "full-screen", 41 | "idiom" : "iphone", 42 | "subtype" : "667h", 43 | "filename" : "Default-4.7@2x.png", 44 | "minimum-system-version" : "8.0", 45 | "orientation" : "portrait", 46 | "scale" : "2x" 47 | }, 48 | { 49 | "orientation" : "portrait", 50 | "idiom" : "iphone", 51 | "filename" : "Default@2x.png", 52 | "extent" : "full-screen", 53 | "minimum-system-version" : "7.0", 54 | "scale" : "2x" 55 | }, 56 | { 57 | "extent" : "full-screen", 58 | "idiom" : "iphone", 59 | "subtype" : "retina4", 60 | "filename" : "Default-568h@2x.png", 61 | "minimum-system-version" : "7.0", 62 | "orientation" : "portrait", 63 | "scale" : "2x" 64 | }, 65 | { 66 | "orientation" : "portrait", 67 | "idiom" : "ipad", 68 | "extent" : "full-screen", 69 | "minimum-system-version" : "7.0", 70 | "scale" : "1x" 71 | }, 72 | { 73 | "orientation" : "landscape", 74 | "idiom" : "ipad", 75 | "extent" : "full-screen", 76 | "minimum-system-version" : "7.0", 77 | "scale" : "1x" 78 | }, 79 | { 80 | "orientation" : "portrait", 81 | "idiom" : "ipad", 82 | "extent" : "full-screen", 83 | "minimum-system-version" : "7.0", 84 | "scale" : "2x" 85 | }, 86 | { 87 | "orientation" : "landscape", 88 | "idiom" : "ipad", 89 | "extent" : "full-screen", 90 | "minimum-system-version" : "7.0", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "orientation" : "portrait", 95 | "idiom" : "iphone", 96 | "filename" : "Default.png", 97 | "extent" : "full-screen", 98 | "scale" : "1x" 99 | }, 100 | { 101 | "orientation" : "portrait", 102 | "idiom" : "iphone", 103 | "filename" : "Default@2x-1.png", 104 | "extent" : "full-screen", 105 | "scale" : "2x" 106 | }, 107 | { 108 | "orientation" : "portrait", 109 | "idiom" : "iphone", 110 | "filename" : "Default-568h@2x-1.png", 111 | "extent" : "full-screen", 112 | "subtype" : "retina4", 113 | "scale" : "2x" 114 | }, 115 | { 116 | "orientation" : "portrait", 117 | "idiom" : "ipad", 118 | "extent" : "to-status-bar", 119 | "scale" : "1x" 120 | }, 121 | { 122 | "orientation" : "portrait", 123 | "idiom" : "ipad", 124 | "extent" : "full-screen", 125 | "scale" : "1x" 126 | }, 127 | { 128 | "orientation" : "landscape", 129 | "idiom" : "ipad", 130 | "extent" : "to-status-bar", 131 | "scale" : "1x" 132 | }, 133 | { 134 | "orientation" : "landscape", 135 | "idiom" : "ipad", 136 | "extent" : "full-screen", 137 | "scale" : "1x" 138 | }, 139 | { 140 | "orientation" : "portrait", 141 | "idiom" : "ipad", 142 | "extent" : "to-status-bar", 143 | "scale" : "2x" 144 | }, 145 | { 146 | "orientation" : "portrait", 147 | "idiom" : "ipad", 148 | "extent" : "full-screen", 149 | "scale" : "2x" 150 | }, 151 | { 152 | "orientation" : "landscape", 153 | "idiom" : "ipad", 154 | "extent" : "to-status-bar", 155 | "scale" : "2x" 156 | }, 157 | { 158 | "orientation" : "landscape", 159 | "idiom" : "ipad", 160 | "extent" : "full-screen", 161 | "scale" : "2x" 162 | } 163 | ], 164 | "info" : { 165 | "version" : 1, 166 | "author" : "xcode" 167 | } 168 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default-4.7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default-4.7@2x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x-1.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x-1.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@3x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@3x-1.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/Default@3x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/iPhoneX-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/iPhoneX-landscape.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/iPhoneX@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/LaunchImage.launchimage/iPhoneX@3x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/back.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "back.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "back@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "back@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/back.imageset/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/back.imageset/back.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/back.imageset/back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/back.imageset/back@2x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/back.imageset/back@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/back.imageset/back@3x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "reload.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "reload@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "reload@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/reload.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/reload@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/reload@2x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/reload@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/reload.imageset/reload@3x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "scan.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "scan@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "scan@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/scan.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/scan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/scan@2x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/scan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/Assets.xcassets/scan.imageset/scan@3x.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/DemoDefine.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | 11 | #define CURRENT_IP @"your computer device ip" 12 | 13 | #if TARGET_IPHONE_SIMULATOR 14 | #define DEMO_HOST @"127.0.0.1" 15 | #else 16 | #define DEMO_HOST CURRENT_IP 17 | #endif 18 | 19 | #define DEMO_URL(path) [NSString stringWithFormat:@"http://%@:12580/%s", DEMO_HOST, #path] 20 | 21 | #define HOME_URL [NSString stringWithFormat:@"http://%@:8080/dist/index.js", DEMO_HOST] 22 | 23 | #define BUNDLE_URL [NSString stringWithFormat:@"file://%@/bundlejs/index.js",[NSBundle mainBundle].bundlePath] 24 | 25 | #define UITEST_HOME_URL @"http://test?_wx_tpl=http://localhost:12580/test/build/TC__Home.js" 26 | 27 | #define WEEX_COLOR [UIColor colorWithRed:0.27 green:0.71 blue:0.94 alpha:1] 28 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/Images.xcassets/Brand Assets.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "minimum-system-version" : "7.0", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "orientation" : "portrait", 11 | "idiom" : "iphone", 12 | "minimum-system-version" : "7.0", 13 | "subtype" : "retina4", 14 | "scale" : "2x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexConfig/WXImgLoaderDefaultImpl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | #import 11 | 12 | @interface WXImgLoaderDefaultImpl : NSObject 13 | @end 14 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexConfig/WXImgLoaderDefaultImpl.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import "WXImgLoaderDefaultImpl.h" 10 | #import 11 | 12 | #define MIN_IMAGE_WIDTH 36 13 | #define MIN_IMAGE_HEIGHT 36 14 | 15 | #if OS_OBJECT_USE_OBJC 16 | #undef WXDispatchQueueRelease 17 | #undef WXDispatchQueueSetterSementics 18 | #define WXDispatchQueueRelease(q) 19 | #define WXDispatchQueueSetterSementics strong 20 | #else 21 | #undef WXDispatchQueueRelease 22 | #undef WXDispatchQueueSetterSementics 23 | #define WXDispatchQueueRelease(q) (dispatch_release(q)) 24 | #define WXDispatchQueueSetterSementics assign 25 | #endif 26 | 27 | @interface WXImgLoaderDefaultImpl() 28 | 29 | @property (WXDispatchQueueSetterSementics, nonatomic) dispatch_queue_t ioQueue; 30 | 31 | @end 32 | 33 | @implementation WXImgLoaderDefaultImpl 34 | 35 | #pragma mark - 36 | #pragma mark WXImgLoaderProtocol 37 | 38 | - (id)downloadImageWithURL:(NSString *)url imageFrame:(CGRect)imageFrame userInfo:(NSDictionary *)userInfo completed:(void(^)(UIImage *image, NSError *error, BOOL finished))completedBlock 39 | { 40 | if ([url hasPrefix:@"//"]) { 41 | url = [@"http:" stringByAppendingString:url]; 42 | } 43 | return (id)[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:url] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { 44 | 45 | } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { 46 | if (completedBlock) { 47 | completedBlock(image, error, finished); 48 | } 49 | }]; 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexConfig/WeexSDKManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // WeexSDKManager.h 3 | // WeexDemo 4 | // 5 | // Created by yangshengtao on 16/11/14. 6 | // Copyright © 2016年 taobao. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface WeexSDKManager : NSObject 12 | 13 | + (void)setup; 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexConfig/WeexSDKManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // WeexSDKManager.m 3 | // WeexDemo 4 | // 5 | // Created by yangshengtao on 16/11/14. 6 | // Copyright © 2016年 taobao. All rights reserved. 7 | // 8 | 9 | #import "WeexSDKManager.h" 10 | #import "DemoDefine.h" 11 | #import 12 | #import "WXDemoViewController.h" 13 | #import "WXImgLoaderDefaultImpl.h" 14 | 15 | @implementation WeexSDKManager 16 | 17 | + (void)setup; 18 | { 19 | NSURL *url = nil; 20 | #if DEBUG 21 | //If you are debugging in device , please change the host to current IP of your computer. 22 | url = [NSURL URLWithString:BUNDLE_URL]; 23 | #else 24 | url = [NSURL URLWithString:BUNDLE_URL]; 25 | #endif 26 | NSString * entryURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WXEntryBundleURL"]; 27 | if (entryURL) { 28 | if ([entryURL hasPrefix:@"http"]) { 29 | url = [NSURL URLWithString:entryURL]; 30 | } else { 31 | url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",[[NSBundle bundleForClass:self] resourceURL].absoluteString, entryURL]]; 32 | } 33 | } 34 | 35 | #ifdef UITEST 36 | url = [NSURL URLWithString:UITEST_HOME_URL]; 37 | #endif 38 | 39 | [self initWeexSDK]; 40 | [self loadCustomContainWithScannerWithUrl:url]; 41 | } 42 | 43 | + (void)initWeexSDK 44 | { 45 | [WXAppConfiguration setAppGroup:@"Instapp"]; 46 | [WXAppConfiguration setAppName:@"NatExample"]; 47 | [WXAppConfiguration setAppVersion:@"1.1.0"]; 48 | [WXAppConfiguration setExternalUserAgent:@"nat/0.1.5"]; 49 | 50 | [WXSDKEngine initSDKEnvironment]; 51 | 52 | [WXSDKEngine registerHandler:[WXImgLoaderDefaultImpl new] withProtocol:@protocol(WXImgLoaderProtocol)]; 53 | 54 | #ifdef DEBUG 55 | [WXLog setLogLevel:WXLogLevelLog]; 56 | #endif 57 | } 58 | 59 | + (void)loadCustomContainWithScannerWithUrl:(NSURL *)url 60 | { 61 | UIViewController *demo = [[WXDemoViewController alloc] init]; 62 | ((WXDemoViewController *)demo).url = url; 63 | [[UIApplication sharedApplication] delegate].window.rootViewController = [[WXRootViewController alloc] initWithRootViewController:demo]; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Nat Explorer 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | com.instapp.natex 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 7 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | NSCameraUsageDescription 33 | $(PRODUCT_NAME) camera use 34 | NSLocationWhenInUseUsageDescription 35 | $(PRODUCT_NAME) location use 36 | NSMicrophoneUsageDescription 37 | $(PRODUCT_NAME) microphone use 38 | NSPhotoLibraryUsageDescription 39 | $(PRODUCT_NAME) photo use 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UIStatusBarStyle 45 | UIStatusBarStyleDefault 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | 50 | UISupportedInterfaceOrientations~ipad 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationPortraitUpsideDown 54 | UIInterfaceOrientationLandscapeLeft 55 | UIInterfaceOrientationLandscapeRight 56 | 57 | UIViewControllerBasedStatusBarAppearance 58 | 59 | WXEntryBundleURL 60 | bundlejs/index.js 61 | WXSocketConnectionURL 62 | ws://200.1.1.105:8080 63 | 64 | 65 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexScanner/UIViewController+WXDemoNaviBar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | #import "DemoDefine.h" 11 | 12 | @interface UIViewController (WXDemoNaviBar) 13 | 14 | /** 15 | * back button click action 16 | * @param sender responder 17 | */ 18 | - (void)backButtonClicked:(id)sender; 19 | 20 | - (void)setupNaviBar; 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexScanner/UIViewController+WXDemoNaviBar.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import "UIViewController+WXDemoNaviBar.h" 10 | #import 11 | #import 12 | 13 | @implementation UIViewController (WXDemoNaviBar) 14 | 15 | - (void)setupNaviBar 16 | { 17 | UIScreenEdgePanGestureRecognizer *edgePanGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgePanGesture:)]; 18 | edgePanGestureRecognizer.delegate = self; 19 | edgePanGestureRecognizer.edges = UIRectEdgeLeft; 20 | [self.view addGestureRecognizer:edgePanGestureRecognizer]; 21 | 22 | NSArray *ver = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; 23 | if ([[ver objectAtIndex:0] intValue] >= 7) { 24 | // iOS 7.0 or later 25 | self.navigationController.navigationBar.barTintColor = WEEX_COLOR; 26 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 27 | self.navigationController.navigationBar.translucent = NO; 28 | }else { 29 | // iOS 6.1 or earlier 30 | self.navigationController.navigationBar.tintColor = WEEX_COLOR; 31 | } 32 | 33 | [self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: 34 | [UIColor whiteColor], NSForegroundColorAttributeName, nil]]; 35 | self.navigationItem.title = @"Weex Playground"; 36 | 37 | if (self.navigationItem.leftBarButtonItem) return; 38 | 39 | UIBarButtonItem *leftItem; 40 | if(![[self.navigationController.viewControllers objectAtIndex:0] isEqual:self]) { 41 | leftItem = [self backButtonItem]; 42 | } 43 | if (leftItem) { 44 | self.navigationItem.leftBarButtonItems = @[leftItem]; 45 | } 46 | } 47 | 48 | - (void)edgePanGesture:(UIScreenEdgePanGestureRecognizer*)edgePanGestureRecognizer 49 | { 50 | [self.navigationController popViewControllerAnimated:YES]; 51 | } 52 | 53 | #pragma mark- UIGestureRecognizerDelegate 54 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer 55 | { 56 | if (self.navigationController && [self.navigationController.viewControllers count] == 1) { 57 | return NO; 58 | } 59 | return YES; 60 | } 61 | 62 | - (UIBarButtonItem *)backButtonItem 63 | { 64 | UIBarButtonItem *backButtonItem = objc_getAssociatedObject(self, _cmd); 65 | if (!backButtonItem) { 66 | backButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] 67 | style:UIBarButtonItemStylePlain 68 | target:self 69 | action:@selector(backButtonClicked:)]; 70 | objc_setAssociatedObject(self, _cmd, backButtonItem, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 71 | } 72 | return backButtonItem; 73 | } 74 | 75 | - (void)backButtonClicked:(id)sender 76 | { 77 | [self.navigationController popViewControllerAnimated:YES]; 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/WeexScanner/WXDemoViewController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | #import 11 | 12 | @interface WXDemoViewController : UIViewController 13 | 14 | @property (nonatomic, strong) NSString *script; 15 | @property (nonatomic, strong) NSURL *url; 16 | 17 | @property (nonatomic, strong) SRWebSocket *hotReloadSocket; 18 | @property (nonatomic, strong) NSString *source; 19 | 20 | @end 21 | 22 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NatExplorer 4 | 5 | Nat Explorer is a nat example app, help you explore Nat modules instantly. 6 | 7 | 8 | Instapp 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemo/weex-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/WeexDemo/weex-icon.png -------------------------------------------------------------------------------- /platforms/ios/WeexDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /platforms/ios/WeexDemoTests/WeexDemoTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | 11 | @interface WeexDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation WeexDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /platforms/ios/WeexUITestDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(PRODUCT_BUNDLE_SHORTVERSION) 19 | CFBundleSignature 20 | $(PRODUCT_BUNDLE_SIGNATURE) 21 | CFBundleVersion 22 | $(PRODUCT_BUNDLE_VERSION) 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UIStatusBarStyle 37 | UIStatusBarStyleLightContent 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UIViewControllerBasedStatusBarAppearance 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /platforms/ios/WeexUITestDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /platforms/ios/WeexUITestDemoUITests/WeexUITestDemoUITests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Weex. 3 | * Copyright (c) 2016, Alibaba, Inc. All rights reserved. 4 | * 5 | * This source code is licensed under the Apache Licence 2.0. 6 | * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #import 10 | 11 | @interface WeexUITestDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation WeexUITestDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /platforms/ios/weex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/weex.png -------------------------------------------------------------------------------- /platforms/ios/weex@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/platforms/ios/weex@2x.png -------------------------------------------------------------------------------- /platforms/platforms.json: -------------------------------------------------------------------------------- 1 | { 2 | "ios": "4.1.6", 3 | "android": "6.3.17" 4 | } -------------------------------------------------------------------------------- /src/assets/css/base.less: -------------------------------------------------------------------------------- 1 | @primary: #3D83FB; 2 | @ink: #333; 3 | 4 | @font-size-base: 32px; 5 | @font-size-xl: @font-size-base * 2.25; 6 | @font-size-lg: @font-size-base * 1.25; 7 | @font-size-sm: @font-size-base * 0.75; 8 | 9 | .bottom-line { 10 | border-bottom-width: 1px; 11 | border-bottom-style: solid; 12 | border-bottom-color: #ddd; 13 | } 14 | 15 | .button { 16 | background-image: linear-gradient(to bottom, #3D83FB, #3370FF); 17 | height: 84px; 18 | padding-left: 64px; 19 | padding-right: 64px; 20 | border-radius: 42px; 21 | // box-shadow: 0 8px 12px rgba(59,130,251,0.3); 22 | border-width: 0; 23 | align-items: center; 24 | justify-content: center; 25 | } 26 | 27 | .button-txt { 28 | font-size: @font-size-base; 29 | font-weight: 600; 30 | color: #fff; 31 | } 32 | -------------------------------------------------------------------------------- /src/assets/css/case.less: -------------------------------------------------------------------------------- 1 | @import './base.less'; 2 | 3 | .content { 4 | padding-left: 48px; 5 | padding-right: 48px; 6 | } 7 | 8 | .case { 9 | margin-bottom: 36px; 10 | } 11 | 12 | .header { 13 | height: 94px; 14 | flex-direction: row; 15 | align-items: center; 16 | } 17 | 18 | .dot { 19 | background-color: @primary; 20 | width: 16px; 21 | height: 16px; 22 | border-radius: 8px; 23 | margin-right: 16px; 24 | } 25 | 26 | .title { 27 | font-size: @font-size-base; 28 | font-weight: 700; 29 | } 30 | 31 | .code { 32 | font-size: @font-size-sm; 33 | color: #555; 34 | background-color: #f7f7f7; 35 | border-radius: 8px; 36 | padding-left: 36px; 37 | padding-right: 36px; 38 | padding-top: 32px; 39 | padding-bottom: 32px; 40 | width: 654px; // width fix 41 | } 42 | -------------------------------------------------------------------------------- /src/assets/img/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/src/assets/img/arrow.png -------------------------------------------------------------------------------- /src/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natjs/nat-explorer/120cf3219f6bbffaa739cef94febcbefd14ab878/src/assets/img/logo.png -------------------------------------------------------------------------------- /src/components/module.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 44 | 45 | 82 | -------------------------------------------------------------------------------- /src/entry.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import weex from 'weex-vue-render' 3 | 4 | weex.init(Vue) 5 | -------------------------------------------------------------------------------- /src/index.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 36 | 37 | 71 | -------------------------------------------------------------------------------- /src/ini/modules.js: -------------------------------------------------------------------------------- 1 | const modules = [{ 2 | name: 'Communication', 3 | functions: [{ 4 | name: 'Call', 5 | path: 'views/communication/call.js' 6 | }, { 7 | name: 'Mail', 8 | path: 'views/communication/mail.js' 9 | }, { 10 | name: 'Sms', 11 | path: 'views/communication/sms.js' 12 | }] 13 | }, { 14 | name: 'Media', 15 | functions: [{ 16 | name: 'Image', 17 | path: 'views/media/image.js' 18 | }, { 19 | name: 'Audio', 20 | path: 'views/media/audio.js' 21 | }, { 22 | name: 'Video', 23 | path: 'views/media/video.js' 24 | }] 25 | }, { 26 | name: 'Camera', 27 | functions: [{ 28 | name: 'Capture Image', 29 | path: 'views/camera/captureImage.js' 30 | }, { 31 | name: 'Capture Video', 32 | path: 'views/camera/captureVideo.js' 33 | }] 34 | }, { 35 | name: 'Recorder', 36 | functions: [{ 37 | name: 'Recorder', 38 | path: 'views/recorder/recorder.js' 39 | }] 40 | }, { 41 | name: 'Modal', 42 | functions: [{ 43 | name: 'Alert', 44 | path: 'views/modal/alert.js' 45 | }, { 46 | name: 'Confirm', 47 | path: 'views/modal/confirm.js' 48 | }, { 49 | name: 'Prompt', 50 | path: 'views/modal/prompt.js' 51 | }, { 52 | name: 'Toast', 53 | path: 'views/modal/toast.js' 54 | }] 55 | }, { 56 | name: 'Network', 57 | functions: [{ 58 | name: 'Fetch', 59 | path: 'views/network/fetch.js', 60 | hints: 'stream' 61 | }, { 62 | name: 'Download', 63 | path: 'views/network/download.js', 64 | hints: 'transfer' 65 | }, { 66 | name: 'Upload', 67 | path: 'views/network/upload.js', 68 | hints: 'transfer' 69 | }] 70 | }, { 71 | name: 'Geolocation', 72 | functions: [{ 73 | name: 'Geolocation', 74 | path: 'views/geolocation/geolocation.js', 75 | hints: 'geo' 76 | }] 77 | }, { 78 | name: 'Sensor', 79 | functions: [{ 80 | name: 'Accelerometer', 81 | path: 'views/sensor/accelerometer.js' 82 | }, { 83 | name: 'Compass', 84 | path: 'views/sensor/compass.js' 85 | }] 86 | }, { 87 | name: 'Device', 88 | functions: [{ 89 | name: 'Info', 90 | path: 'views/device/info.js' 91 | }, { 92 | name: 'Network', 93 | path: 'views/device/network.js' 94 | }, { 95 | name: 'Vibration', 96 | path: 'views/device/vibration.js' 97 | }, { 98 | name: 'Screen', 99 | path: 'views/device/screen.js' 100 | }, { 101 | name: 'Volume', 102 | path: 'views/device/volume.js' 103 | }, { 104 | name: 'Battery', 105 | path: 'views/device/battery.js' 106 | }] 107 | }/* , { 108 | name: 'Third-Party', 109 | functions: [{ 110 | name: 'Alipay', 111 | path: 'views/third-party/alipay.js' 112 | }, { 113 | name: 'Wechat', 114 | path: 'views/third-party/wechat.js' 115 | }] 116 | } */] 117 | 118 | export default modules 119 | -------------------------------------------------------------------------------- /src/layout/nav-bar.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 28 | 29 | 60 | -------------------------------------------------------------------------------- /src/layout/status-bar.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 40 | 41 | 53 | -------------------------------------------------------------------------------- /src/layout/title-bar.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 17 | 18 | 35 | -------------------------------------------------------------------------------- /src/utils/env.js: -------------------------------------------------------------------------------- 1 | const env = { 2 | isNative: typeof window !== 'object', 3 | platform: weex.config.env.platform, 4 | deviceWidth: weex.config.env.deviceWidth, 5 | deviceHeight: weex.config.env.deviceHeight, 6 | cdnUri: 'http://cdn.instapp.io/nat/', 7 | 8 | get baseUrl() { 9 | let url 10 | let bundleUrl = weex.config.bundleUrl 11 | let isAndroid = bundleUrl.indexOf('file://assets/') > -1 12 | let isiOS = bundleUrl.indexOf('file:///') > -1 13 | 14 | if (isAndroid) { 15 | url = 'file://assets/dist/' 16 | } else if (isiOS) { 17 | url = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1) 18 | } else { 19 | let host = 'localhost:8080' 20 | let matches = /\/\/([^\/]+?)\//.exec(bundleUrl) 21 | host = (matches && matches.length >= 2) ? matches[1] : host 22 | url = 'http://' + host + '/dist/' 23 | } 24 | 25 | return url 26 | } 27 | } 28 | 29 | export default env 30 | -------------------------------------------------------------------------------- /src/views/camera/captureImage.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 74 | 75 | 82 | -------------------------------------------------------------------------------- /src/views/camera/captureVideo.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 74 | 75 | 82 | -------------------------------------------------------------------------------- /src/views/communication/call.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 61 | 62 | 65 | -------------------------------------------------------------------------------- /src/views/communication/mail.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 78 | 79 | 82 | -------------------------------------------------------------------------------- /src/views/communication/sms.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 72 | 73 | 76 | -------------------------------------------------------------------------------- /src/views/device/battery.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 54 | 55 | 58 | -------------------------------------------------------------------------------- /src/views/device/info.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 54 | 55 | 58 | -------------------------------------------------------------------------------- /src/views/device/network.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 54 | 55 | 58 | -------------------------------------------------------------------------------- /src/views/device/screen.vue: -------------------------------------------------------------------------------- 1 | 63 | 64 | 154 | 155 | 158 | -------------------------------------------------------------------------------- /src/views/device/vibration.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 56 | 57 | 60 | -------------------------------------------------------------------------------- /src/views/device/volume.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 74 | 75 | 78 | -------------------------------------------------------------------------------- /src/views/geolocation/geolocation.vue: -------------------------------------------------------------------------------- 1 | 56 | 57 | 118 | 119 | 122 | -------------------------------------------------------------------------------- /src/views/media/audio.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 110 | 111 | 114 | -------------------------------------------------------------------------------- /src/views/media/image.vue: -------------------------------------------------------------------------------- 1 | 71 | 72 | 146 | 147 | 150 | -------------------------------------------------------------------------------- /src/views/media/video.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 110 | 111 | 114 | -------------------------------------------------------------------------------- /src/views/modal/alert.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 80 | 81 | 84 | -------------------------------------------------------------------------------- /src/views/modal/confirm.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 82 | 83 | 86 | -------------------------------------------------------------------------------- /src/views/modal/prompt.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 84 | 85 | 88 | -------------------------------------------------------------------------------- /src/views/modal/toast.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 64 | 65 | 68 | -------------------------------------------------------------------------------- /src/views/network/download.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 97 | 98 | 101 | -------------------------------------------------------------------------------- /src/views/network/fetch.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 91 | 92 | 95 | -------------------------------------------------------------------------------- /src/views/network/upload.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 138 | 139 | 148 | -------------------------------------------------------------------------------- /src/views/recorder/recorder.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 123 | 124 | 132 | -------------------------------------------------------------------------------- /src/views/sensor/accelerometer.vue: -------------------------------------------------------------------------------- 1 | 56 | 57 | 118 | 119 | 122 | -------------------------------------------------------------------------------- /src/views/sensor/compass.vue: -------------------------------------------------------------------------------- 1 | 56 | 57 | 118 | 119 | 122 | -------------------------------------------------------------------------------- /src/views/third-party/alipay.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 65 | 66 | 69 | -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import weex from 'weex-vue-render' 3 | 4 | weex.init(Vue) 5 | 6 | Vue.config.productionTip = false 7 | 8 | // require all test files (files that ends with .spec.js) 9 | const testsContext = require.context('./specs', true, /\.spec$/) 10 | testsContext.keys().forEach(testsContext) 11 | 12 | // require all src files except entry.js for coverage. 13 | // you can also change this to match only the subset of files that 14 | // you want coverage for. 15 | const srcContext = require.context('../../src', true, /^\.\/(?!entry(\.js)?$)/) 16 | srcContext.keys().forEach(srcContext) 17 | -------------------------------------------------------------------------------- /test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../../configs/webpack.test.conf') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['PhantomJS'], 15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./index.js'], 18 | preprocessors: { 19 | './index.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | singleRun: false, 26 | browserConsoleLogOptions: {level: 'error', format: '%b %T: %m', terminal: false}, 27 | coverageReporter: { 28 | dir: './coverage', 29 | reporters: [ 30 | { type: 'lcov', subdir: '.' }, 31 | { type: 'text-summary' } 32 | ] 33 | } 34 | }) 35 | } 36 | -------------------------------------------------------------------------------- /test/unit/specs/index.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import index from '@/index' 3 | 4 | describe('index.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(index) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.greeting').textContent).to.equal('The environment is ready!') 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /web/assets/preview.css: -------------------------------------------------------------------------------- 1 | html,body {width:100%;height:100%;margin:0;padding:0;} 2 | body { display: flex; flex-direction: column; } 3 | .center { display: flex; align-items: center; justify-content: center; } 4 | 5 | #preview { width: 750px; height: 1300px; transform: scale(0.4); transform-origin: top left; } 6 | .mock-phone { position: relative; width: 320px; min-width: 320px; height: 625px; border: 2px solid #0088fb; border-radius: 30px; } 7 | .mock-phone .inner { position: absolute; top: 50px; z-index: 26; left: 10px; width: 300px; height: 500px; border: 1px solid #0088fb; overflow: hidden; } 8 | .mock-phone .inner iframe { width: 100%; height: 100%; margin: 0; } 9 | .mock-phone .camera { position: absolute; width: 10px; height: 10px; border-radius: 10px; background: #afddff; border: 1px solid #0088fb; top: 20px; left: 96px; } 10 | .mock-phone .earpiece { position: absolute; width: 70px; height: 8px; border-radius: 8px; background: #afddff; border: 1px solid #0088fb; top: 20px; left: 120px; } 11 | .mock-phone .home-btn { position: absolute; width: 50px; height: 50px; border-radius: 50px; background: #afddff; border: 1px solid #0088fb; bottom: 10px; left: 50%; margin-left: -25px; } 12 | 13 | 14 | .header { 15 | height: 100px; 16 | flex-grow: 0; 17 | } 18 | .content { 19 | display: flex; 20 | flex-grow: 1; 21 | flex-direction: row; 22 | } 23 | .main { 24 | display: flex; 25 | flex-direction: row; 26 | justify-content: space-between; 27 | width: 55%; 28 | min-width: 750px; 29 | max-width: 800px; 30 | } 31 | .main .qrcode-box { 32 | width: 400px; 33 | display: flex; 34 | flex-direction: column; 35 | justify-content: center; 36 | align-items: stretch; 37 | } 38 | .qrcode > img { 39 | display: block; 40 | width: 250px; 41 | height: 250px; 42 | margin: 0 auto; 43 | } 44 | .qrcode-tips { 45 | text-align: center; 46 | margin-top: 20px; 47 | } 48 | .qrcode-tips a, .qrcode-tips a:link { 49 | color: #00B4FF; 50 | text-decoration: none; 51 | } 52 | .qrcode-tips a:hover, .qrcode-tips a:active { 53 | color: #238FFF; 54 | } 55 | .pages-box { 56 | max-height: 330px; 57 | overflow-y: auto; 58 | } 59 | .pages-box .page-item{ 60 | display: inline-block; 61 | padding: 5px 8px; 62 | text-decoration: none; 63 | font-size: 14px; 64 | border-radius: 5px; 65 | margin: 10px 5px; 66 | color:#717171; 67 | border:1px solid #ddd; 68 | transition: all .2s ease; 69 | } 70 | .pages-box .page-item:hover{ 71 | border-color:#0088fb; 72 | background: #0088fb; 73 | color:#fff; 74 | } 75 | .pages-box .page-item.active { 76 | border-color:#0088fb; 77 | background: #0088fb; 78 | color:#fff; 79 | } -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | weex-vue-render 6 | 7 | 8 | 9 | 10 | 11 | 12 | 29 | 30 | 31 |
32 | 33 | <%= htmlWebpackPlugin.options.devScripts %> 34 | 35 | -------------------------------------------------------------------------------- /web/preview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Weex Preview 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 | 30 |

Use Weex playground app to scan it.

31 |
32 | 33 |
34 |
35 |
36 |
37 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | // You can see all the config in `./configs`. 2 | const buildPlugins = require('./configs/plugin'); 3 | let webpackConfig; 4 | module.exports = env => { 5 | switch (env.NODE_ENV) { 6 | case 'prod': 7 | case 'production': 8 | webpackConfig = require('./configs/webpack.prod.conf'); 9 | break; 10 | case 'test': 11 | case 'testing': 12 | webpackConfig = require('./configs/webpack.test.conf'); 13 | break; 14 | case 'plugin': 15 | buildPlugins(); 16 | case 'common': 17 | webpackConfig = require('./configs/webpack.common.conf'); 18 | break; 19 | case 'release': 20 | webpackConfig = require('./configs/webpack.release.conf'); 21 | break; 22 | case 'dev': 23 | case 'development': 24 | default: 25 | webpackConfig = require('./configs/webpack.dev.conf'); 26 | } 27 | return webpackConfig; 28 | } 29 | --------------------------------------------------------------------------------