├── Gemfile ├── examples └── testapp │ ├── ios │ ├── testtools │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ ├── SplashScreen.imageset │ │ │ │ ├── splashscreen.png │ │ │ │ └── Contents.json │ │ │ ├── SplashScreenBackground.imageset │ │ │ │ ├── background.png │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── main.m │ │ ├── AppDelegate.h │ │ ├── Supporting │ │ │ └── Expo.plist │ │ ├── Info.plist │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── AppDelegate.m │ │ └── SplashScreen.storyboard │ ├── testtools.xcworkspace │ │ └── contents.xcworkspacedata │ ├── testtools.xcodeproj │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── testtools.xcscheme │ │ └── project.pbxproj │ └── Podfile │ ├── android │ ├── app │ │ ├── debug.keystore │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ ├── colors.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── drawable │ │ │ │ │ │ ├── splashscreen_image.png │ │ │ │ │ │ └── splashscreen.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── testtools │ │ │ │ │ │ ├── generated │ │ │ │ │ │ └── BasePackageList.java │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ │ └── debug │ │ │ │ ├── AndroidManifest.xml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── testtools │ │ │ │ └── ReactNativeFlipper.java │ │ ├── proguard-rules.pro │ │ ├── build_defs.bzl │ │ ├── BUCK │ │ ├── google-services.json │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew │ ├── metro.config.js │ ├── babel.config.js │ ├── app.json │ ├── __tests__ │ └── App.js │ ├── AlanText.js │ ├── AlanButton.js │ ├── index.js │ ├── package.json │ ├── .gitignore │ ├── AlanSDK.js │ └── App.js ├── fastlane └── Fastfile ├── .circleci ├── bkp.yaml └── config.yml └── README.md /Gemfile: -------------------------------------------------------------------------------- 1 | # Gemfile 2 | source "https://rubygems.org" 3 | gem 'fastlane' -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/testapp/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/debug.keystore -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Alan RN TestTools 3 | 4 | -------------------------------------------------------------------------------- /examples/testapp/metro.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transformer: { 3 | assetPlugins: ['expo-asset/tools/hashAssetFiles'], 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/testapp/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | api.cache(true); 3 | return { 4 | presets: ['babel-preset-expo'], 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /examples/testapp/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/drawable/splashscreen_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/drawable/splashscreen_image.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Images.xcassets/SplashScreen.imageset/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/ios/testtools/Images.xcassets/SplashScreen.imageset/splashscreen.png -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Images.xcassets/SplashScreenBackground.imageset/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alan-ai/alan-sdk-reactnative/HEAD/examples/testapp/ios/testtools/Images.xcassets/SplashScreenBackground.imageset/background.png -------------------------------------------------------------------------------- /examples/testapp/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testtools", 3 | "displayName": "testtools", 4 | "expo": { 5 | "name": "testtools", 6 | "slug": "testtools", 7 | "version": "1.0.0", 8 | "assetBundlePatterns": [ 9 | "**/*" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/testapp/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #FFFFFF 5 | 6 | -------------------------------------------------------------------------------- /examples/testapp/__tests__/App.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import App from '../App'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | renderer.create(); 10 | }); 11 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/testapp/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'testtools' 2 | 3 | apply from: '../node_modules/react-native-unimodules/gradle.groovy' 4 | includeUnimodulesProjects() 5 | 6 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); 7 | applyNativeModulesSettingsGradle(settings) 8 | 9 | include ':app' 10 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | #import 7 | 8 | @interface AppDelegate : UMAppDelegateWrapper 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/drawable/splashscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Supporting/Expo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | EXUpdatesSDKVersion 6 | YOUR-APP-SDK-VERSION-HERE 7 | EXUpdatesURL 8 | YOUR-APP-URL-HERE 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/testapp/AlanText.js: -------------------------------------------------------------------------------- 1 | /*jshint esversion: 6 */ 2 | 3 | import PropTypes from 'prop-types'; 4 | import React from 'react'; 5 | import {requireNativeComponent} from 'react-native'; 6 | 7 | class AlanText extends React.Component { 8 | render() { 9 | return ; 10 | } 11 | } 12 | 13 | AlanText.propTypes = { 14 | }; 15 | 16 | var RNTAlanText = requireNativeComponent('RNTAlanText', AlanText); 17 | module.exports = AlanText; 18 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Images.xcassets/SplashScreen.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "splashscreen.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "version": 1, 19 | "author": "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Images.xcassets/SplashScreenBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "background.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "scale": "2x" 11 | }, 12 | { 13 | "idiom": "universal", 14 | "scale": "3x" 15 | } 16 | ], 17 | "info": { 18 | "version": 1, 19 | "author": "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /examples/testapp/AlanButton.js: -------------------------------------------------------------------------------- 1 | /*jshint esversion: 6 */ 2 | 3 | import PropTypes from 'prop-types'; 4 | import React from 'react'; 5 | import {requireNativeComponent} from 'react-native'; 6 | 7 | class AlanButton extends React.Component { 8 | render() { 9 | return ; 10 | } 11 | } 12 | 13 | AlanButton.propTypes = { 14 | projectid: PropTypes.string, 15 | }; 16 | 17 | var RNTAlanButton = requireNativeComponent('RNTAlanButton', AlanButton); 18 | module.exports = AlanButton; -------------------------------------------------------------------------------- /examples/testapp/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | # fastlane/Fastfile 2 | default_platform :ios 3 | 4 | platform :ios do 5 | before_all do 6 | setup_circle_ci 7 | import_certificate( 8 | keychain_name: ENV["MATCH_KEYCHAIN_NAME"], 9 | keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"], 10 | certificate_path: 'Certificates.p12', 11 | certificate_password: ENV["CERTIFICATE_PASSWORD"] || "default" 12 | ) 13 | end 14 | 15 | desc "Clean" 16 | lane :clean do 17 | clear_derived_data 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /examples/testapp/index.js: -------------------------------------------------------------------------------- 1 | // import { registerRootComponent } from 'expo'; 2 | 3 | // import App from './App'; 4 | 5 | // registerRootComponent calls AppRegistry.registerComponent('main', () => App); 6 | // It also ensures that whether you load the app in the Expo client or in a native build, 7 | // the environment is set up appropriately 8 | // registerRootComponent(App); 9 | 10 | import {AppRegistry} from 'react-native'; 11 | import App from './App'; 12 | import {name as appName} from './app.json'; 13 | 14 | AppRegistry.registerComponent(appName, () => App); 15 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /examples/testapp/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/java/com/testtools/generated/BasePackageList.java: -------------------------------------------------------------------------------- 1 | package com.testtools.generated; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | import org.unimodules.core.interfaces.Package; 6 | 7 | public class BasePackageList { 8 | public List getPackageList() { 9 | return Arrays.asList( 10 | new expo.modules.constants.ConstantsPackage(), 11 | new expo.modules.errorrecovery.ErrorRecoveryPackage(), 12 | new expo.modules.filesystem.FileSystemPackage(), 13 | new expo.modules.font.FontLoaderPackage(), 14 | new expo.modules.imageloader.ImageLoaderPackage(), 15 | new expo.modules.keepawake.KeepAwakePackage(), 16 | new expo.modules.lineargradient.LinearGradientPackage(), 17 | new expo.modules.location.LocationPackage(), 18 | new expo.modules.permissions.PermissionsPackage(), 19 | new expo.modules.splashscreen.SplashScreenPackage(), 20 | new expo.modules.sqlite.SQLitePackage(), 21 | new expo.modules.updates.UpdatesPackage() 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/testapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "index.js", 3 | "scripts": { 4 | "android": "react-native run-android", 5 | "ios": "react-native run-ios", 6 | "web": "expo start --web", 7 | "start": "react-native start", 8 | "test": "jest" 9 | }, 10 | "dependencies": { 11 | "@alan-ai/alan-sdk-react-native": "~1.0.7", 12 | "expo": "~38.0.1", 13 | "expo-splash-screen": "~0.6.2", 14 | "expo-status-bar": "^1.0.0", 15 | "expo-updates": "~0.2.10", 16 | "react": "~16.11.0", 17 | "react-dom": "~16.11.0", 18 | "react-native": "~0.62.2", 19 | "react-native-cli": "^2.0.1", 20 | "react-native-gesture-handler": "~1.6.1", 21 | "react-native-reanimated": "~1.9.0", 22 | "react-native-screens": "~2.9.0", 23 | "react-native-unimodules": "~0.10.1", 24 | "react-native-web": "~0.11.7" 25 | }, 26 | "devDependencies": { 27 | "@babel/core": "~7.9.0", 28 | "babel-jest": "~25.2.6", 29 | "jest": "~25.2.6", 30 | "react-test-renderer": "~16.11.0" 31 | }, 32 | "jest": { 33 | "preset": "react-native" 34 | }, 35 | "private": true 36 | } 37 | -------------------------------------------------------------------------------- /examples/testapp/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | # node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | 43 | # fastlane 44 | # 45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 46 | # screenshots whenever they are needed. 47 | # For more information about the recommended setup visit: 48 | # https://docs.fastlane.tools/best-practices/source-control/ 49 | 50 | */fastlane/report.xml 51 | */fastlane/Preview.html 52 | */fastlane/screenshots 53 | 54 | # Bundle artifacts 55 | *.jsbundle 56 | 57 | # CocoaPods 58 | /ios/Pods/ 59 | 60 | # Expo 61 | .expo/* 62 | web-build/ 63 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /examples/testapp/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 21 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.5.3") 16 | classpath 'com.google.gms:google-services:4.3.3' 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | 34 | google() 35 | jcenter() 36 | maven { url 'https://www.jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /.circleci/bkp.yaml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | jobs: 4 | analyse_js: 5 | executor: rn/linux_js 6 | steps: 7 | - attach_workspace: 8 | at: ./testtools 9 | - run: 10 | command: yarn install 11 | working_directory: ./testtools 12 | 13 | checkout_code: 14 | executor: rn/linux_js 15 | steps: 16 | - checkout 17 | - persist_to_workspace: 18 | paths: . 19 | root: . 20 | build_app: 21 | executor: rn/linux_android 22 | steps: 23 | - checkout 24 | - run: 25 | command: pwd 26 | - run: 27 | command: ls -al 28 | - run: 29 | name: Build Android RN Sample App (from testtools) 30 | command: cd ./testtools/android && ./gradlew assembleDebug 31 | 32 | orbs: 33 | rn: react-native-community/react-native@4.4.2 34 | android: circleci/android@0.2.1 35 | 36 | workflows: 37 | test: 38 | jobs: 39 | # - checkout_code 40 | # - analyse_js: 41 | # requires: 42 | # - checkout_code 43 | - build_app 44 | # requires: 45 | # - analyse_js 46 | # - rn/android_build: 47 | # project_path: ./testtools/android 48 | # build_type: release 49 | # requires: 50 | # - analyse_js 51 | -------------------------------------------------------------------------------- /examples/testapp/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | 25 | # Automatically convert third-party libraries to use AndroidX 26 | android.enableJetifier=true 27 | 28 | # Version of flipper SDK to use with React Native 29 | FLIPPER_VERSION=0.33.1 30 | 31 | org.gradle.jvmargs=-Xmx8096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -------------------------------------------------------------------------------- /examples/testapp/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.testtools", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.testtools", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/java/com/testtools/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.testtools; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.facebook.react.ReactActivity; 6 | import com.facebook.react.ReactActivityDelegate; 7 | import com.facebook.react.ReactRootView; 8 | import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; 9 | 10 | import expo.modules.splashscreen.singletons.SplashScreen; 11 | import expo.modules.splashscreen.SplashScreenImageResizeMode; 12 | 13 | public class MainActivity extends ReactActivity { 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | // SplashScreen.show(...) has to be called after super.onCreate(...) 18 | // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually 19 | SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false); 20 | } 21 | 22 | 23 | /** 24 | * Returns the name of the main component registered from JavaScript. 25 | * This is used to schedule rendering of the component. 26 | */ 27 | @Override 28 | protected String getMainComponentName() { 29 | return "testtools"; 30 | } 31 | 32 | @Override 33 | protected ReactActivityDelegate createReactActivityDelegate() { 34 | return new ReactActivityDelegate(this, getMainComponentName()) { 35 | @Override 36 | protected ReactRootView createRootView() { 37 | return new RNGestureHandlerEnabledRootView(MainActivity.this); 38 | } 39 | }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | testtools 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | SplashScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UIStatusBarStyle 49 | UIStatusBarStyleDefault 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /examples/testapp/AlanSDK.js: -------------------------------------------------------------------------------- 1 | /*jshint esversion: 6 */ 2 | 3 | import PropTypes from 'prop-types'; 4 | import React from 'react'; 5 | import {Text, View, StyleSheet} from 'react-native'; 6 | import {requireNativeComponent} from 'react-native'; 7 | 8 | const styles = StyleSheet.create({ 9 | textView: { 10 | height: 64, 11 | right: 20, 12 | left: 20, 13 | justifyContent: 'center', 14 | alignItems: 'center', 15 | position: 'absolute', 16 | }, 17 | buttonView: { 18 | width: 64, 19 | height: 64, 20 | right: 20, 21 | justifyContent: 'center', 22 | alignItems: 'center', 23 | position: 'absolute', 24 | }, 25 | bottomView: { 26 | width: '100%', 27 | height: 64, 28 | bottom: 40, 29 | justifyContent: 'center', 30 | alignItems: 'center', 31 | position: 'absolute', 32 | }, 33 | }); 34 | 35 | class AlanButton extends React.Component { 36 | render() { 37 | return ; 38 | } 39 | } 40 | 41 | AlanButton.propTypes = { 42 | params: PropTypes.array, 43 | }; 44 | 45 | var RNTAlanButton = requireNativeComponent('RNTAlanButton', AlanButton); 46 | 47 | class AlanText extends React.Component { 48 | render() { 49 | return ; 50 | } 51 | } 52 | 53 | AlanText.propTypes = { 54 | }; 55 | 56 | var RNTAlanText = requireNativeComponent('RNTAlanText', AlanText); 57 | 58 | class AlanView extends React.Component { 59 | render() { 60 | return 61 | 62 | 71 | ; 72 | } 73 | } 74 | 75 | AlanView.propTypes = { 76 | projectid: PropTypes.string, 77 | host: PropTypes.string, 78 | authData: PropTypes.object, 79 | }; 80 | 81 | module.exports = { 82 | AlanView: AlanView, 83 | }; 84 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /examples/testapp/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Self-Coding System for Your App — Alan AI SDK for React Native 2 | 3 | [Alan AI Platform](https://alan.app/) • [Alan AI Studio](https://studio.alan.app/register) • [Docs](https://alan.app/docs) • [FAQ](https://alan.app/docs/usage/additional/faq) • 4 | [Blog](https://alan.app/blog/) • [Twitter](https://twitter.com/alanvoiceai) 5 | 6 | [![npm](https://img.shields.io/npm/v/@alan-ai/alan-sdk-react-native.svg)](https://www.npmjs.com/package/@alan-ai/alan-sdk-react-native) 7 | 8 | Quickly create AI agents with the Alan AI Platform. Enable human-like conversations and perform actions in any app through voice commands. 9 | 10 | ## The Intelligent App Platform 11 | 12 | Alan AI is transforming enterprise software with a new approach, **Application-Level AI**. Instead of relying on manual development or isolated AI tools, we embed an intelligent layer into your application that builds features on demand. 13 | 14 | Powered by our proprietary **Three-Layer AI (3LAI)** architecture, our system generates both business logic and UI in real time—no developers needed. It works across your entire app stack: the user interface, business logic, and data management. 15 | 16 | The **Intelligent App Platform** lets companies integrate AI-driven interfaces into their existing apps in days, not months. 17 | 18 | It creates a safe and validated environment from your app’s APIs, GUIs, and documentation, enabling accurate, context-aware code generation. At runtime, the AI acts like a self-coding engine—instantly creating new features based on user needs. 19 | 20 | With Alan AI, your software becomes truly adaptive—responding, evolving, and scaling automatically. 21 | 22 | This repository contains the **Alan AI SDK for React Native**, enabling you to embed Alan's intelligent layer into your Android applications. 23 | 24 | ## How to start 25 | 26 | To create an AI agent for your React Native app: 27 | 1. Sign up for Alan AI Studio to build dialog scripts in JavaScript and test them. 28 | 2. Use the Alan AI SDK for React Native to embed an AI agent to your application. For details, see Alan AI documentation. 29 | 30 | 31 | ## Example apps 32 | 33 | In the [Examples](https://github.com/alan-ai/alan-sdk-reactnative/tree/master/examples) folder, you can find example apps integrated with the Alan AI SDK for React Native. Launch the app, tap the Alan AI button and start giving voice commands. For example, you can ask: "Hello" or "What does this app do?" 34 | 35 | ## Other platforms 36 | 37 | You may also want to try Alan AI SDKs for the following platforms: 38 | 39 | * Web 40 | * iOS 41 | * Android 42 | * Flutter 43 | * Ionic 44 | * Apache Cordova 45 | * PowerApps 46 | 47 | ## Have questions? 48 | 49 | If you have any questions or something is missing in the documentation: 50 | - Join [Alan AI Slack community](https://app.slack.com/client/TL55N530A) for support 51 | - Contact us at [support@alan.app](mailto:support@alan.app) -------------------------------------------------------------------------------- /examples/testapp/android/app/src/debug/java/com/testtools/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.testtools; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 32 | client.addPlugin(new ReactFlipperPlugin()); 33 | client.addPlugin(new DatabasesFlipperPlugin(context)); 34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 35 | client.addPlugin(CrashReporterPlugin.getInstance()); 36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 37 | NetworkingModule.setCustomClientBuilder( 38 | new NetworkingModule.CustomClientBuilder() { 39 | @Override 40 | public void apply(OkHttpClient.Builder builder) { 41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 42 | } 43 | }); 44 | client.addPlugin(networkFlipperPlugin); 45 | client.start(); 46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 47 | // Hence we run if after all native modules have been initialized 48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 49 | if (reactContext == null) { 50 | reactInstanceManager.addReactInstanceEventListener( 51 | new ReactInstanceManager.ReactInstanceEventListener() { 52 | @Override 53 | public void onReactContextInitialized(ReactContext reactContext) { 54 | reactInstanceManager.removeReactInstanceEventListener(this); 55 | reactContext.runOnNativeModulesQueueThread( 56 | new Runnable() { 57 | @Override 58 | public void run() { 59 | client.addPlugin(new FrescoFlipperPlugin()); 60 | } 61 | }); 62 | } 63 | }); 64 | } else { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /examples/testapp/ios/testtools.xcodeproj/xcshareddata/xcschemes/testtools.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # For a detailed guide to building and testing on iOS, read the docs: 2 | # https://circleci.com/docs/2.0/testing-ios/ 3 | 4 | version: 2.1 5 | 6 | orbs: 7 | node: circleci/node@4.7.0 8 | 9 | jobs: 10 | build_android: 11 | docker: 12 | - image: circleci/android:api-28-node 13 | resource_class: xlarge 14 | steps: 15 | - checkout 16 | - run: sudo mkdir /opt/gradle 17 | - run: sudo wget https://services.gradle.org/distributions/gradle-6.7-bin.zip 18 | - run: sudo unzip -d /opt/gradle gradle-6.7-bin.zip 19 | - run: echo 'export export PATH=$PATH:/opt/gradle/gradle-6.7/bin:$PATH' >> $BASH_ENV 20 | - run: gradle -v 21 | - run: 22 | name: Installing JDK 1.8 required for Cordova support 23 | command: | 24 | sudo apt update 25 | sudo apt install software-properties-common 26 | sudo apt update 27 | wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add - 28 | sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ 29 | sudo apt update 30 | sudo apt install adoptopenjdk-8-hotspot 31 | echo 'export PATH=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin:$PATH' >> $BASH_ENV 32 | echo 'export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64' >> $BASH_ENV 33 | source $BASH_ENV 34 | - run: 35 | name: Setup PATH variables 36 | command: | 37 | export PATH=$ANDROID_HOME/platform-tools:$PATH 38 | export PATH=$ANDROID_HOME/tools:$PATH 39 | - restore_cache: 40 | keys: 41 | - node-modules-cache 42 | - run: 43 | name: Install React native 44 | command: sudo npm install -g react-native-cli 45 | - run: 46 | name: Install Dependencies npm 47 | command: cd examples/testapp && npm install 48 | - save_cache: 49 | key: node-modules-cache 50 | paths: 51 | - ./node_modules 52 | - run: 53 | name: Build android 54 | command: cd examples/testapp/android && ./gradlew assembleDebug 55 | 56 | 57 | build_ios: 58 | macos: 59 | xcode: 11.3.0 60 | steps: 61 | - checkout 62 | - node/install: 63 | node-version: 16.13.0 64 | - run: node --version 65 | - run: 66 | name: Install yarn 67 | command: npm install --global yarn 68 | - run: 69 | name: decode Certificates 70 | command: base64 -D -o Certificates.p12 \<<< $Certificates 71 | - run: 72 | name: make Provisioning Profiles directory 73 | command: mkdir -pv ~/Library/MobileDevice/Provisioning\ Profiles/ 74 | - run: 75 | name: decode Provisioning Profiles 76 | command: base64 -D -o ~/Library/MobileDevice/Provisioning\ Profiles/App_Store.mobileprovision \<<< $App_Store_Profile 77 | - run: bundle exec fastlane clean 78 | - run: 79 | name: Install cocoapods 80 | command: sudo gem install cocoapods 81 | - run: 82 | name: Install React native 83 | command: sudo npm install -g react-native-cli 84 | - run: 85 | name: export path 86 | command: echo 'export PATH="$PATH:/usr/local/bin"' >> $BASH_ENV 87 | - run: 88 | name: Install Dependencies npm 89 | command: cd examples/testapp && npm install 90 | - run: 91 | name: Install Dependencies cocoapods 92 | command: cd examples/testapp/ios && pod install 93 | - run: 94 | name: React native build for iOS Release 95 | command: cd examples/testapp/ios && xcodebuild -workspace "testtools.xcworkspace" -scheme "testtools" -configuration Release 96 | 97 | workflows: 98 | version: 2.1 99 | build-android-and-ios: 100 | jobs: 101 | - build_android 102 | - build_ios 103 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #import 8 | #import 9 | #import 10 | #import 11 | #import 12 | 13 | #if DEBUG 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | 21 | static void InitializeFlipper(UIApplication *application) { 22 | FlipperClient *client = [FlipperClient sharedClient]; 23 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 24 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 25 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 26 | [client addPlugin:[FlipperKitReactPlugin new]]; 27 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 28 | [client start]; 29 | } 30 | #endif 31 | 32 | @interface AppDelegate () 33 | 34 | @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter; 35 | @property (nonatomic, strong) NSDictionary *launchOptions; 36 | 37 | @end 38 | 39 | @implementation AppDelegate 40 | 41 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 42 | { 43 | #if DEBUG 44 | InitializeFlipper(application); 45 | #endif 46 | 47 | self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; 48 | self.launchOptions = launchOptions; 49 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 50 | #ifdef DEBUG 51 | [self initializeReactNativeApp]; 52 | #else 53 | EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance]; 54 | controller.delegate = self; 55 | [controller startAndShowLaunchScreen:self.window]; 56 | #endif 57 | 58 | [super application:application didFinishLaunchingWithOptions:launchOptions]; 59 | 60 | return YES; 61 | } 62 | 63 | - (RCTBridge *)initializeReactNativeApp 64 | { 65 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions]; 66 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil]; 67 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 68 | 69 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 70 | UIViewController *rootViewController = [UIViewController new]; 71 | rootViewController.view = rootView; 72 | self.window.rootViewController = rootViewController; 73 | [self.window makeKeyAndVisible]; 74 | 75 | return bridge; 76 | } 77 | 78 | - (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge 79 | { 80 | NSArray> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge]; 81 | // If you'd like to export some custom RCTBridgeModules that are not Expo modules, add them here! 82 | return extraModules; 83 | } 84 | 85 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { 86 | #ifdef DEBUG 87 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 88 | #else 89 | return [[EXUpdatesAppController sharedInstance] launchAssetUrl]; 90 | #endif 91 | } 92 | 93 | - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success { 94 | appController.bridge = [self initializeReactNativeApp]; 95 | EXSplashScreenService *splashScreenService = (EXSplashScreenService *)[UMModuleRegistryProvider getSingletonModuleForClass:[EXSplashScreenService class]]; 96 | [splashScreenService showSplashScreenFor:self.window.rootViewController]; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /examples/testapp/android/app/src/main/java/com/testtools/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.testtools; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.net.Uri; 6 | 7 | import com.facebook.react.PackageList; 8 | import com.facebook.react.ReactApplication; 9 | import com.facebook.react.ReactInstanceManager; 10 | import com.facebook.react.ReactNativeHost; 11 | import com.facebook.react.ReactPackage; 12 | import com.facebook.react.shell.MainReactPackage; 13 | import com.facebook.soloader.SoLoader; 14 | import com.testtools.generated.BasePackageList; 15 | 16 | import org.unimodules.adapters.react.ReactAdapterPackage; 17 | import org.unimodules.adapters.react.ModuleRegistryAdapter; 18 | import org.unimodules.adapters.react.ReactModuleRegistryProvider; 19 | import org.unimodules.core.interfaces.Package; 20 | import org.unimodules.core.interfaces.SingletonModule; 21 | 22 | import app.alan.reactmodule.AlanButtonPackage; 23 | import expo.modules.constants.ConstantsPackage; 24 | import expo.modules.permissions.PermissionsPackage; 25 | import expo.modules.filesystem.FileSystemPackage; 26 | import expo.modules.updates.UpdatesController; 27 | 28 | import java.lang.reflect.InvocationTargetException; 29 | import java.util.Arrays; 30 | import java.util.List; 31 | import javax.annotation.Nullable; 32 | 33 | public class MainApplication extends Application implements ReactApplication { 34 | private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider( 35 | new BasePackageList().getPackageList() 36 | ); 37 | 38 | 39 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 40 | @Override 41 | public boolean getUseDeveloperSupport() { 42 | return BuildConfig.DEBUG; 43 | } 44 | 45 | @Override 46 | protected List getPackages() { 47 | List packages = new PackageList(this).getPackages(); 48 | packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider)); 49 | // packages.add(new AlanButtonPackage()); 50 | return packages; 51 | } 52 | 53 | @Override 54 | protected String getJSMainModuleName() { 55 | return "index"; 56 | } 57 | 58 | @Override 59 | protected @Nullable String getJSBundleFile() { 60 | if (BuildConfig.DEBUG) { 61 | return super.getJSBundleFile(); 62 | } else { 63 | return UpdatesController.getInstance().getLaunchAssetFile(); 64 | } 65 | } 66 | 67 | @Override 68 | protected @Nullable String getBundleAssetName() { 69 | if (BuildConfig.DEBUG) { 70 | return super.getBundleAssetName(); 71 | } else { 72 | return UpdatesController.getInstance().getBundleAssetName(); 73 | } 74 | } 75 | }; 76 | 77 | @Override 78 | public ReactNativeHost getReactNativeHost() { 79 | return mReactNativeHost; 80 | } 81 | 82 | @Override 83 | public void onCreate() { 84 | super.onCreate(); 85 | SoLoader.init(this, /* native exopackage */ false); 86 | 87 | if (!BuildConfig.DEBUG) { 88 | UpdatesController.initialize(this); 89 | } 90 | 91 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 92 | } 93 | 94 | /** 95 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 96 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 97 | * 98 | * @param context 99 | * @param reactInstanceManager 100 | */ 101 | private static void initializeFlipper( 102 | Context context, ReactInstanceManager reactInstanceManager) { 103 | if (BuildConfig.DEBUG) { 104 | try { 105 | /* 106 | We use reflection here to pick up the class that initializes Flipper, 107 | since Flipper library is not available in release mode 108 | */ 109 | Class aClass = Class.forName("com.testtools.ReactNativeFlipper"); 110 | aClass 111 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 112 | .invoke(null, context, reactInstanceManager); 113 | } catch (ClassNotFoundException e) { 114 | e.printStackTrace(); 115 | } catch (NoSuchMethodException e) { 116 | e.printStackTrace(); 117 | } catch (IllegalAccessException e) { 118 | e.printStackTrace(); 119 | } catch (InvocationTargetException e) { 120 | e.printStackTrace(); 121 | } 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /examples/testapp/ios/testtools/SplashScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 39 | 40 | 41 | 42 | 53 | 54 | 55 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /examples/testapp/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '11.0' 2 | require_relative '../node_modules/react-native-unimodules/cocoapods.rb' 3 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 4 | 5 | def add_flipper_pods!(versions = {}) 6 | versions['Flipper'] ||= '~> 0.33.1' 7 | versions['DoubleConversion'] ||= '1.1.7' 8 | versions['Flipper-Folly'] ||= '~> 2.1' 9 | versions['Flipper-Glog'] ||= '0.3.6' 10 | versions['Flipper-PeerTalk'] ||= '~> 0.0.4' 11 | versions['Flipper-RSocket'] ||= '~> 1.0' 12 | 13 | pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' 14 | pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' 15 | pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 16 | pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' 17 | pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' 18 | 19 | # List all transitive dependencies for FlipperKit pods 20 | # to avoid them being linked in Release builds 21 | pod 'Flipper', versions['Flipper'], :configuration => 'Debug' 22 | pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' 23 | pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' 24 | pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' 25 | pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' 26 | pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' 27 | pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' 28 | pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' 29 | pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' 30 | pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' 31 | pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' 32 | pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' 33 | pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' 34 | pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 35 | end 36 | 37 | # Post Install processing for Flipper 38 | def flipper_post_install(installer) 39 | installer.pods_project.targets.each do |target| 40 | if target.name == 'YogaKit' 41 | target.build_configurations.each do |config| 42 | config.build_settings['SWIFT_VERSION'] = '4.1' 43 | end 44 | end 45 | end 46 | end 47 | 48 | target 'testtools' do 49 | # Pods for testtools 50 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 51 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 52 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 53 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 54 | pod 'React', :path => '../node_modules/react-native/' 55 | pod 'React-Core', :path => '../node_modules/react-native/' 56 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 57 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 58 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 59 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 60 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 61 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 62 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 63 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 64 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 65 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 66 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 67 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 68 | 69 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 70 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 71 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 72 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 73 | pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" 74 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 75 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true 76 | 77 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 78 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 79 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 80 | 81 | use_unimodules! 82 | use_native_modules! 83 | 84 | # Enables Flipper. 85 | # 86 | # Note that if you have use_frameworks! enabled, Flipper will not work and 87 | # you should disable these next few lines. 88 | # add_flipper_pods! 89 | # post_install do |installer| 90 | # flipper_post_install(installer) 91 | # end 92 | end -------------------------------------------------------------------------------- /examples/testapp/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /examples/testapp/android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "47629768410", 4 | "firebase_url": "https://alantesttools-311cf.firebaseio.com", 5 | "project_id": "alantesttools-311cf", 6 | "storage_bucket": "alantesttools-311cf.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:47629768410:android:e37c04d9e0cfc48aaf77e3", 12 | "android_client_info": { 13 | "package_name": "app.alan.flutter_test_tools" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 25 | } 26 | ], 27 | "services": { 28 | "appinvite_service": { 29 | "other_platform_oauth_client": [ 30 | { 31 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 32 | "client_type": 3 33 | } 34 | ] 35 | } 36 | } 37 | }, 38 | { 39 | "client_info": { 40 | "mobilesdk_app_id": "1:47629768410:android:72f10c86cdca8540af77e3", 41 | "android_client_info": { 42 | "package_name": "app.alan.playground" 43 | } 44 | }, 45 | "oauth_client": [ 46 | { 47 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 48 | "client_type": 3 49 | } 50 | ], 51 | "api_key": [ 52 | { 53 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 54 | } 55 | ], 56 | "services": { 57 | "appinvite_service": { 58 | "other_platform_oauth_client": [ 59 | { 60 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 61 | "client_type": 3 62 | } 63 | ] 64 | } 65 | } 66 | }, 67 | { 68 | "client_info": { 69 | "mobilesdk_app_id": "1:47629768410:android:a6b8c0680955f623af77e3", 70 | "android_client_info": { 71 | "package_name": "app.alan.rn.testtools" 72 | } 73 | }, 74 | "oauth_client": [ 75 | { 76 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 77 | "client_type": 3 78 | } 79 | ], 80 | "api_key": [ 81 | { 82 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 83 | } 84 | ], 85 | "services": { 86 | "appinvite_service": { 87 | "other_platform_oauth_client": [ 88 | { 89 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 90 | "client_type": 3 91 | } 92 | ] 93 | } 94 | } 95 | }, 96 | { 97 | "client_info": { 98 | "mobilesdk_app_id": "1:47629768410:android:73efa0048d1e7cd1af77e3", 99 | "android_client_info": { 100 | "package_name": "app.alan.safety" 101 | } 102 | }, 103 | "oauth_client": [ 104 | { 105 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 106 | "client_type": 3 107 | } 108 | ], 109 | "api_key": [ 110 | { 111 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 112 | } 113 | ], 114 | "services": { 115 | "appinvite_service": { 116 | "other_platform_oauth_client": [ 117 | { 118 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 119 | "client_type": 3 120 | } 121 | ] 122 | } 123 | } 124 | }, 125 | { 126 | "client_info": { 127 | "mobilesdk_app_id": "1:47629768410:android:05b2d39d0bd43b3caf77e3", 128 | "android_client_info": { 129 | "package_name": "app.alan.testtools" 130 | } 131 | }, 132 | "oauth_client": [ 133 | { 134 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 135 | "client_type": 3 136 | } 137 | ], 138 | "api_key": [ 139 | { 140 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 141 | } 142 | ], 143 | "services": { 144 | "appinvite_service": { 145 | "other_platform_oauth_client": [ 146 | { 147 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 148 | "client_type": 3 149 | } 150 | ] 151 | } 152 | } 153 | }, 154 | { 155 | "client_info": { 156 | "mobilesdk_app_id": "1:47629768410:android:61f1984da9763751af77e3", 157 | "android_client_info": { 158 | "package_name": "com.testtools" 159 | } 160 | }, 161 | "oauth_client": [ 162 | { 163 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 164 | "client_type": 3 165 | } 166 | ], 167 | "api_key": [ 168 | { 169 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 170 | } 171 | ], 172 | "services": { 173 | "appinvite_service": { 174 | "other_platform_oauth_client": [ 175 | { 176 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 177 | "client_type": 3 178 | } 179 | ] 180 | } 181 | } 182 | }, 183 | { 184 | "client_info": { 185 | "mobilesdk_app_id": "1:47629768410:android:5b98705ca95923fbaf77e3", 186 | "android_client_info": { 187 | "package_name": "io.ionic.starter" 188 | } 189 | }, 190 | "oauth_client": [ 191 | { 192 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 193 | "client_type": 3 194 | } 195 | ], 196 | "api_key": [ 197 | { 198 | "current_key": "AIzaSyDPa2DXfGpLJ7T7sbrAuS1B77xvbeFLsHs" 199 | } 200 | ], 201 | "services": { 202 | "appinvite_service": { 203 | "other_platform_oauth_client": [ 204 | { 205 | "client_id": "47629768410-gjgiu4hfsorsg0hspsg4nc1gl757chor.apps.googleusercontent.com", 206 | "client_type": 3 207 | } 208 | ] 209 | } 210 | } 211 | } 212 | ], 213 | "configuration_version": "1" 214 | } -------------------------------------------------------------------------------- /examples/testapp/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: 'com.google.gms.google-services' 3 | 4 | import com.android.build.OutputFile 5 | 6 | /** 7 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 8 | * and bundleReleaseJsAndAssets). 9 | * These basically call `react-native bundle` with the correct arguments during the Android build 10 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 11 | * bundle directly from the development server. Below you can see all the possible configurations 12 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 13 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 14 | * 15 | * project.ext.react = [ 16 | * // the name of the generated asset file containing your JS bundle 17 | * bundleAssetName: "index.android.bundle", 18 | * 19 | * // the entry file for bundle generation. If none specified and 20 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 21 | * // default. Can be overridden with ENTRY_FILE environment variable. 22 | * entryFile: "index.android.js", 23 | * 24 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 25 | * bundleCommand: "ram-bundle", 26 | * 27 | * // whether to bundle JS and assets in debug mode 28 | * bundleInDebug: false, 29 | * 30 | * // whether to bundle JS and assets in release mode 31 | * bundleInRelease: true, 32 | * 33 | * // whether to bundle JS and assets in another build variant (if configured). 34 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 35 | * // The configuration property can be in the following formats 36 | * // 'bundleIn${productFlavor}${buildType}' 37 | * // 'bundleIn${buildType}' 38 | * // bundleInFreeDebug: true, 39 | * // bundleInPaidRelease: true, 40 | * // bundleInBeta: true, 41 | * 42 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 43 | * // for example: to disable dev mode in the staging build type (if configured) 44 | * devDisabledInStaging: true, 45 | * // The configuration property can be in the following formats 46 | * // 'devDisabledIn${productFlavor}${buildType}' 47 | * // 'devDisabledIn${buildType}' 48 | * 49 | * // the root of your project, i.e. where "package.json" lives 50 | * root: "../../", 51 | * 52 | * // where to put the JS bundle asset in debug mode 53 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 54 | * 55 | * // where to put the JS bundle asset in release mode 56 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 57 | * 58 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 59 | * // require('./image.png')), in debug mode 60 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 61 | * 62 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 63 | * // require('./image.png')), in release mode 64 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 65 | * 66 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 67 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 68 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 69 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 70 | * // for example, you might want to remove it from here. 71 | * inputExcludes: ["android/**", "ios/**"], 72 | * 73 | * // override which node gets called and with what additional arguments 74 | * nodeExecutableAndArgs: ["node"], 75 | * 76 | * // supply additional arguments to the packager 77 | * extraPackagerArgs: [] 78 | * ] 79 | */ 80 | 81 | project.ext.react = [ 82 | // whether to bundle JS and assets in debug mode 83 | bundleInDebug: true, 84 | enableHermes: false 85 | ] 86 | 87 | apply from: '../../node_modules/react-native-unimodules/gradle.groovy' 88 | apply from: "../../node_modules/react-native/react.gradle" 89 | apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle" 90 | 91 | /** 92 | * Set this to true to create two separate APKs instead of one: 93 | * - An APK that only works on ARM devices 94 | * - An APK that only works on x86 devices 95 | * The advantage is the size of the APK is reduced by about 4MB. 96 | * Upload all the APKs to the Play Store and people will download 97 | * the correct one based on the CPU architecture of their device. 98 | */ 99 | def enableSeparateBuildPerCPUArchitecture = true 100 | 101 | /** 102 | * Run Proguard to shrink the Java bytecode in release builds. 103 | */ 104 | def enableProguardInReleaseBuilds = false 105 | 106 | /** 107 | * The preferred build flavor of JavaScriptCore. 108 | * 109 | * For example, to use the international variant, you can use: 110 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 111 | * 112 | * The international variant includes ICU i18n library and necessary data 113 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 114 | * give correct results when using with locales other than en-US. Note that 115 | * this variant is about 6MiB larger per architecture than default. 116 | */ 117 | def jscFlavor = 'org.webkit:android-jsc:+' 118 | 119 | /** 120 | * Whether to enable the Hermes VM. 121 | * 122 | * This should be set on project.ext.react and mirrored here. If it is not set 123 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 124 | * and the benefits of using Hermes will therefore be sharply reduced. 125 | */ 126 | def enableHermes = project.ext.react.get("enableHermes", false); 127 | 128 | android { 129 | compileSdkVersion rootProject.ext.compileSdkVersion 130 | 131 | compileOptions { 132 | sourceCompatibility JavaVersion.VERSION_1_8 133 | targetCompatibility JavaVersion.VERSION_1_8 134 | } 135 | 136 | defaultConfig { 137 | applicationId "com.testtools" 138 | minSdkVersion rootProject.ext.minSdkVersion 139 | targetSdkVersion rootProject.ext.targetSdkVersion 140 | versionCode 8 141 | versionName "1.0" 142 | } 143 | splits { 144 | abi { 145 | reset() 146 | enable enableSeparateBuildPerCPUArchitecture 147 | universalApk false // If true, also generate a universal APK 148 | include "armeabi-v7a", "x86" 149 | } 150 | } 151 | signingConfigs { 152 | debug { 153 | storeFile file('debug.keystore') 154 | storePassword 'android' 155 | keyAlias 'androiddebugkey' 156 | keyPassword 'android' 157 | } 158 | } 159 | buildTypes { 160 | debug { 161 | signingConfig signingConfigs.debug 162 | } 163 | release { 164 | // Caution! In production, you need to generate your own keystore file. 165 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 166 | signingConfig signingConfigs.debug 167 | minifyEnabled enableProguardInReleaseBuilds 168 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 169 | } 170 | } 171 | 172 | packagingOptions { 173 | pickFirst "lib/armeabi-v7a/libc++_shared.so" 174 | pickFirst "lib/arm64-v8a/libc++_shared.so" 175 | pickFirst "lib/x86/libc++_shared.so" 176 | pickFirst "lib/x86_64/libc++_shared.so" 177 | } 178 | 179 | // applicationVariants are e.g. debug, release 180 | applicationVariants.all { variant -> 181 | variant.outputs.each { output -> 182 | // For each separate APK per architecture, set a unique version code as described here: 183 | // https://developer.android.com/studio/build/configure-apk-splits.html 184 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 185 | def abi = output.getFilter(OutputFile.ABI) 186 | if (abi != null) { // null for the universal-debug, universal-release variants 187 | output.versionCodeOverride = 188 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 189 | } 190 | 191 | } 192 | } 193 | 194 | dexOptions { 195 | javaMaxHeapSize "4g" 196 | } 197 | } 198 | 199 | dependencies { 200 | implementation fileTree(dir: "libs", include: ["*.jar"]) 201 | //noinspection GradleDynamicVersion 202 | implementation "com.facebook.react:react-native:+" // From node_modules 203 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 204 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 205 | exclude group:'com.facebook.fbjni' 206 | } 207 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 208 | exclude group:'com.facebook.flipper' 209 | } 210 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 211 | exclude group:'com.facebook.flipper' 212 | } 213 | addUnimodulesDependencies() 214 | 215 | if (enableHermes) { 216 | def hermesPath = "../../node_modules/hermes-engine/android/"; 217 | debugImplementation files(hermesPath + "hermes-debug.aar") 218 | releaseImplementation files(hermesPath + "hermes-release.aar") 219 | } else { 220 | implementation jscFlavor 221 | } 222 | 223 | implementation 'com.google.firebase:firebase-analytics:17.2.2' 224 | } 225 | 226 | // Run this once to be able to run the application with BUCK 227 | // puts all compile dependencies into folder libs for BUCK to use 228 | task copyDownloadableDepsToLibs(type: Copy) { 229 | from configurations.compile 230 | into 'libs' 231 | } 232 | 233 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 234 | -------------------------------------------------------------------------------- /examples/testapp/App.js: -------------------------------------------------------------------------------- 1 | /*jshint esversion: 6 */ 2 | 3 | import React, {Component} from 'react'; 4 | import { 5 | Button, 6 | TextInput, 7 | View, 8 | Text, 9 | StyleSheet, 10 | Alert, 11 | ScrollView, 12 | KeyboardAvoidingView, 13 | Dimensions, 14 | Switch, 15 | } from 'react-native'; 16 | import {NativeEventEmitter, NativeModules} from 'react-native'; 17 | 18 | import {AlanView} from './AlanSDK.js'; 19 | 20 | const {AlanManager, AlanEventEmitter} = NativeModules; 21 | const alanEventEmitter = new NativeEventEmitter(AlanEventEmitter); 22 | 23 | const screenWidth = Dimensions.get('window').width; 24 | const textWidth = screenWidth - 40; 25 | 26 | const createAlert = (text) => 27 | Alert.alert( 28 | text, 29 | text, 30 | [{text: 'OK', onPress: () => console.log('OK Pressed')}], 31 | {cancelable: false}, 32 | ); 33 | 34 | const subscription = alanEventEmitter.addListener('command', (data) => { 35 | console.log(`got command event ${JSON.stringify(data)}`); 36 | // {"command":"showAlert","text":"text"} 37 | createAlert(data.text); 38 | }); 39 | 40 | export default class HelloWorldApp extends Component { 41 | constructor(props) { 42 | super(props); 43 | 44 | this.state = { 45 | helloValue: '(test text | hello | test tools)', 46 | commandValue: 'test command', 47 | apiValue: 'test project api', 48 | visualValue: 'test visual state', 49 | sendCommandValue: 'test send command', 50 | authDataValue: 'test auth data', 51 | authData: false, 52 | isProd: false, 53 | }; 54 | } 55 | 56 | componentWillUnmount() { 57 | subscription.remove(); 58 | } 59 | 60 | renderAlanButton() { 61 | if (this.state.isProd && this.state.authData) { 62 | this.state.authData = false; 63 | return ( 64 | 71 | ); 72 | } 73 | else if (this.state.isProd) { 74 | return ( 75 | 81 | ); 82 | } 83 | else if (this.state.authData) { 84 | this.state.authData = false; 85 | return ( 86 | 93 | ); 94 | } 95 | else { 96 | return ( 97 | 103 | ); 104 | } 105 | } 106 | 107 | render() { 108 | console.log(`isProd - ${this.state.isProd}`); 109 | console.log(`authData - ${this.state.authData}`); 110 | console.log(`authDataValue - ${this.state.authDataValue}`); 111 | const alanButton = this.renderAlanButton(); 112 | 113 | return ( 114 | 115 | 120 | 128 | 129 | 130 | 131 | Stage 132 | this.setState({isProd: val})} 136 | value={this.state.isProd} 137 | /> 138 | Prod 139 | 140 |