├── .babelrc ├── .buckconfig ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── README.md ├── __tests__ ├── index.android.js └── index.ios.js ├── android ├── app │ ├── BUCK │ ├── build.gradle │ ├── libs │ │ ├── jsch-0.1.54.jar │ │ └── jzlib-1.1.3.jar │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── fonts │ │ │ ├── Entypo.ttf │ │ │ ├── EvilIcons.ttf │ │ │ ├── FontAwesome.ttf │ │ │ ├── Foundation.ttf │ │ │ ├── Ionicons.ttf │ │ │ ├── MaterialIcons.ttf │ │ │ ├── Octicons.ttf │ │ │ └── Zocial.ttf │ │ ├── java │ │ └── com │ │ │ └── hooks │ │ │ ├── MainActivity.java │ │ │ ├── MainApplication.java │ │ │ ├── SSHModule.java │ │ │ └── SSHPackage.java │ │ └── res │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-ldpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── keystores │ ├── BUCK │ └── debug.keystore.properties └── settings.gradle ├── credits ├── JSch.LICENSE.txt ├── JZlib.LICENSE.txt └── README.md ├── index.android.js ├── index.ios.js ├── ios ├── hooks.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── hooks.xcscheme ├── hooks │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── main.m └── hooksTests │ ├── Info.plist │ └── hooksTests.m ├── js ├── actions │ └── server.js ├── app.js ├── components │ ├── app-password │ │ ├── index.js │ │ └── styles.js │ ├── base-text │ │ └── index.js │ ├── cancelable-callbacks │ │ └── index.js │ ├── content-text │ │ └── index.js │ ├── form-field │ │ ├── index.js │ │ └── styles.js │ ├── form │ │ ├── index.js │ │ └── styles.js │ ├── frame │ │ └── index.js │ ├── hook │ │ ├── index.js │ │ └── styles.js │ ├── server-creator │ │ └── index.js │ ├── server-editor │ │ └── index.js │ ├── server-list │ │ ├── index.js │ │ └── styles.js │ └── server │ │ ├── index.js │ │ └── styles.js ├── models │ ├── index.js │ └── server.js ├── reducers │ ├── index.js │ └── server.js ├── store.js └── utils.js ├── media └── demo.gif └── package.json /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } -------------------------------------------------------------------------------- /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*[.]android.js 5 | 6 | # Ignore templates with `@flow` in header 7 | .*/local-cli/generator.* 8 | 9 | # Ignore malformed json 10 | .*/node_modules/y18n/test/.*\.json 11 | 12 | # Ignore the website subdir 13 | /website/.* 14 | 15 | # Ignore BUCK generated dirs 16 | /\.buckd/ 17 | 18 | # Ignore unexpected extra @providesModule 19 | .*/node_modules/commoner/test/source/widget/share.js 20 | 21 | # Ignore duplicate module providers 22 | # For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root 23 | .*/Libraries/react-native/React.js 24 | .*/Libraries/react-native/ReactNative.js 25 | .*/node_modules/jest-runtime/build/__tests__/.* 26 | 27 | [include] 28 | 29 | [libs] 30 | node_modules/react-native/Libraries/react-native/react-native-interface.js 31 | node_modules/react-native/flow 32 | flow/ 33 | 34 | [options] 35 | module.system=haste 36 | 37 | esproposal.class_static_fields=enable 38 | esproposal.class_instance_fields=enable 39 | 40 | experimental.strict_type_args=true 41 | 42 | munge_underscores=true 43 | 44 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 45 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 46 | 47 | suppress_type=$FlowIssue 48 | suppress_type=$FlowFixMe 49 | suppress_type=$FixMe 50 | 51 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 52 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 53 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 54 | 55 | unsafe.enable_getters_and_setters=true 56 | 57 | [version] 58 | ^0.32.0 59 | -------------------------------------------------------------------------------- /.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/IJ 26 | # 27 | *.iml 28 | .idea 29 | .gradle 30 | local.properties 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | 37 | # BUCK 38 | buck-out/ 39 | \.buckd/ 40 | android/keystores/debug.keystore 41 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hooks 2 | 3 | List, run, and see the output from scripts in your ```.hooks-app/hooks/``` directory. All over SSH, so there's nothing to install on your server. 4 | 5 | [Here's a gif of how it works.](media/demo.gif) 6 | 7 | ## Example uses 8 | 9 | - See which containers are running on the server 10 | - Run a backup script 11 | - Build and publish the a static site 12 | - Start a program on your laptop 13 | 14 | ## Assumptions 15 | 16 | The app expects ```find``` and ```sed``` to exist on the server. 17 | 18 | ## Develop 19 | 20 | - [Install the React Native CLI and the Android SDK](https://facebook.github.io/react-native/docs/getting-started.html) 21 | - Start your Android emulator (or plug in your Android phone with debugging enabled) 22 | - At the root of this project: 23 | - ```npm install``` 24 | - ```react-native link``` 25 | - ```react-native run-android``` 26 | 27 | Get it on Google Play 28 | -------------------------------------------------------------------------------- /__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | # To learn about Buck see [Docs](https://buckbuild.com/). 4 | # To run your application with Buck: 5 | # - install Buck 6 | # - `npm start` - to start the packager 7 | # - `cd android` 8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 10 | # - `buck install -r android/app` - compile, install and run application 11 | # 12 | 13 | lib_deps = [] 14 | for jarfile in glob(['libs/*.jar']): 15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) 16 | lib_deps.append(':' + name) 17 | prebuilt_jar( 18 | name = name, 19 | binary_jar = jarfile, 20 | ) 21 | 22 | for aarfile in glob(['libs/*.aar']): 23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) 24 | lib_deps.append(':' + name) 25 | android_prebuilt_aar( 26 | name = name, 27 | aar = aarfile, 28 | ) 29 | 30 | android_library( 31 | name = 'all-libs', 32 | exported_deps = lib_deps 33 | ) 34 | 35 | android_library( 36 | name = 'app-code', 37 | srcs = glob([ 38 | 'src/main/java/**/*.java', 39 | ]), 40 | deps = [ 41 | ':all-libs', 42 | ':build_config', 43 | ':res', 44 | ], 45 | ) 46 | 47 | android_build_config( 48 | name = 'build_config', 49 | package = 'com.hooks', 50 | ) 51 | 52 | android_resource( 53 | name = 'res', 54 | res = 'src/main/res', 55 | package = 'com.hooks', 56 | ) 57 | 58 | android_binary( 59 | name = 'app', 60 | package_type = 'debug', 61 | manifest = 'src/main/AndroidManifest.xml', 62 | keystore = '//android/keystores:debug', 63 | deps = [ 64 | ':app-code', 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // the root of your project, i.e. where "package.json" lives 37 | * root: "../../", 38 | * 39 | * // where to put the JS bundle asset in debug mode 40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 41 | * 42 | * // where to put the JS bundle asset in release mode 43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 44 | * 45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 46 | * // require('./image.png')), in debug mode 47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 48 | * 49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 50 | * // require('./image.png')), in release mode 51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 52 | * 53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 57 | * // for example, you might want to remove it from here. 58 | * inputExcludes: ["android/**", "ios/**"], 59 | * 60 | * // override which node gets called and with what additional arguments 61 | * nodeExecutableAndArgs: ["node"] 62 | * 63 | * // supply additional arguments to the packager 64 | * extraPackagerArgs: [] 65 | * ] 66 | */ 67 | 68 | apply from: "../../node_modules/react-native/react.gradle" 69 | 70 | /** 71 | * Set this to true to create two separate APKs instead of one: 72 | * - An APK that only works on ARM devices 73 | * - An APK that only works on x86 devices 74 | * The advantage is the size of the APK is reduced by about 4MB. 75 | * Upload all the APKs to the Play Store and people will download 76 | * the correct one based on the CPU architecture of their device. 77 | */ 78 | def enableSeparateBuildPerCPUArchitecture = false 79 | 80 | /** 81 | * Run Proguard to shrink the Java bytecode in release builds. 82 | */ 83 | def enableProguardInReleaseBuilds = false 84 | 85 | android { 86 | compileSdkVersion 23 87 | buildToolsVersion "23.0.1" 88 | 89 | defaultConfig { 90 | applicationId "com.hooks" 91 | minSdkVersion 16 92 | targetSdkVersion 22 93 | versionCode 1 94 | versionName "1.0" 95 | ndk { 96 | abiFilters "armeabi-v7a", "x86" 97 | } 98 | } 99 | signingConfigs { 100 | release { 101 | storeFile file(System.env.APP_RELEASE_STORE_FILE) 102 | storePassword System.env.APP_RELEASE_STORE_PASSWORD 103 | keyAlias System.env.APP_RELEASE_KEY_ALIAS 104 | keyPassword System.env.APP_RELEASE_KEY_PASSWORD 105 | } 106 | } 107 | splits { 108 | abi { 109 | reset() 110 | enable enableSeparateBuildPerCPUArchitecture 111 | universalApk false // If true, also generate a universal APK 112 | include "armeabi-v7a", "x86" 113 | } 114 | } 115 | buildTypes { 116 | release { 117 | minifyEnabled enableProguardInReleaseBuilds 118 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 119 | signingConfig signingConfigs.release 120 | } 121 | } 122 | // applicationVariants are e.g. debug, release 123 | applicationVariants.all { variant -> 124 | variant.outputs.each { output -> 125 | // For each separate APK per architecture, set a unique version code as described here: 126 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 127 | def versionCodes = ["armeabi-v7a":1, "x86":2] 128 | def abi = output.getFilter(OutputFile.ABI) 129 | if (abi != null) { // null for the universal-debug, universal-release variants 130 | output.versionCodeOverride = 131 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 132 | } 133 | } 134 | } 135 | } 136 | 137 | dependencies { 138 | compile project(':react-native-vector-icons') 139 | compile fileTree(dir: "libs", include: ["*.jar"]) 140 | compile "com.android.support:appcompat-v7:23.0.1" 141 | compile "com.facebook.react:react-native:+" // From node_modules 142 | } 143 | 144 | // Run this once to be able to run the application with BUCK 145 | // puts all compile dependencies into folder libs for BUCK to use 146 | task copyDownloadableDepsToLibs(type: Copy) { 147 | from configurations.compile 148 | into 'libs' 149 | } 150 | -------------------------------------------------------------------------------- /android/app/libs/jsch-0.1.54.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/libs/jsch-0.1.54.jar -------------------------------------------------------------------------------- /android/app/libs/jzlib-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/libs/jzlib-1.1.3.jar -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # okhttp 54 | 55 | -keepattributes Signature 56 | -keepattributes *Annotation* 57 | -keep class okhttp3.** { *; } 58 | -keep interface okhttp3.** { *; } 59 | -dontwarn okhttp3.** 60 | 61 | # okio 62 | 63 | -keep class sun.misc.Unsafe { *; } 64 | -dontwarn java.nio.file.* 65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 66 | -dontwarn okio.** 67 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/Entypo.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/EvilIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/EvilIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/FontAwesome.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Foundation.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/Foundation.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/Ionicons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/MaterialIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/MaterialIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Octicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/Octicons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Zocial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/assets/fonts/Zocial.ttf -------------------------------------------------------------------------------- /android/app/src/main/java/com/hooks/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.hooks; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "hooks"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/hooks/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.hooks; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.shell.MainReactPackage; 11 | 12 | import com.oblador.vectoricons.VectorIconsPackage; 13 | 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | public class MainApplication extends Application implements ReactApplication { 18 | 19 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 20 | @Override 21 | protected boolean getUseDeveloperSupport() { 22 | return BuildConfig.DEBUG; 23 | } 24 | 25 | @Override 26 | protected List getPackages() { 27 | return Arrays.asList( 28 | new MainReactPackage(), 29 | new VectorIconsPackage(), 30 | new SSHPackage() 31 | ); 32 | } 33 | }; 34 | 35 | @Override 36 | public ReactNativeHost getReactNativeHost() { 37 | return mReactNativeHost; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/hooks/SSHModule.java: -------------------------------------------------------------------------------- 1 | package com.hooks; 2 | 3 | import java.io.InputStream; 4 | import java.io.BufferedReader; 5 | import java.io.InputStreamReader; 6 | import java.util.Properties; 7 | import java.util.Vector; 8 | 9 | import com.facebook.react.bridge.Promise; 10 | import com.facebook.react.bridge.ReactApplicationContext; 11 | import com.facebook.react.bridge.ReactContext; 12 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 13 | import com.facebook.react.bridge.ReactMethod; 14 | import com.facebook.react.bridge.ReadableMap; 15 | import com.facebook.react.bridge.WritableNativeArray; 16 | import com.jcraft.jsch.ChannelExec; 17 | import com.jcraft.jsch.JSch; 18 | import com.jcraft.jsch.JSchException; 19 | import com.jcraft.jsch.Session; 20 | 21 | 22 | public class SSHModule extends ReactContextBaseJavaModule { 23 | 24 | public SSHModule(ReactApplicationContext reactContext) { 25 | super(reactContext); 26 | } 27 | 28 | @Override 29 | public String getName() { 30 | return "SSH"; 31 | } 32 | 33 | @ReactMethod 34 | public void execute(final ReadableMap config, final String command, final Promise promise) { 35 | 36 | new Thread(new Runnable() { 37 | public void run() { 38 | try { 39 | // Get an SSH session ready 40 | Session session = SSHModule.connect(config); 41 | 42 | // Execute the command and prepare to read the output 43 | ChannelExec channelExec = (ChannelExec)session.openChannel("exec"); 44 | InputStream in = channelExec.getInputStream(); 45 | channelExec.setCommand(command); 46 | channelExec.connect(); 47 | 48 | // Put the result into an JS-readable array 49 | String line; 50 | BufferedReader reader = new BufferedReader(new InputStreamReader(in)); 51 | WritableNativeArray filenames = new WritableNativeArray(); 52 | while ((line = reader.readLine()) != null) { 53 | filenames.pushString(line); 54 | } 55 | 56 | // Pass the array of filenames back to JS 57 | promise.resolve(filenames); 58 | } catch (Exception e) { 59 | promise.reject("ERROR", e.getMessage()); 60 | } 61 | } 62 | }).start(); 63 | } 64 | 65 | public static Session connect(ReadableMap config) throws JSchException { 66 | // Prepare the SSH session with the provided credentials 67 | JSch jsch = new JSch(); 68 | Session session = jsch.getSession(config.getString("user"), config.getString("host"), 22); 69 | session.setPassword(config.getString("password")); 70 | 71 | // Ignore the checking of the key 72 | Properties prop = new Properties(); 73 | prop.put("StrictHostKeyChecking", "no"); 74 | session.setConfig(prop); 75 | 76 | // Connect to the server 77 | session.connect(); 78 | 79 | return session; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/hooks/SSHPackage.java: -------------------------------------------------------------------------------- 1 | package com.hooks; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.bridge.JavaScriptModule; 9 | import com.facebook.react.bridge.NativeModule; 10 | import com.facebook.react.bridge.ReactApplicationContext; 11 | import com.facebook.react.uimanager.ViewManager; 12 | 13 | 14 | class SSHPackage implements ReactPackage { 15 | 16 | @Override 17 | public List> createJSModules() { 18 | return Collections.emptyList(); 19 | } 20 | 21 | @Override 22 | public List createViewManagers(ReactApplicationContext reactContext) { 23 | return Collections.emptyList(); 24 | } 25 | 26 | @Override 27 | public List createNativeModules( 28 | ReactApplicationContext reactContext) { 29 | List modules = new ArrayList<>(); 30 | 31 | modules.add(new SSHModule(reactContext)); 32 | 33 | return modules; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/res/mipmap-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hooks 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = 'debug', 3 | store = 'debug.keystore', 4 | properties = 'debug.keystore.properties', 5 | visibility = [ 6 | 'PUBLIC', 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'hooks' 2 | 3 | include ':app' 4 | include ':react-native-vector-icons' 5 | project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') 6 | -------------------------------------------------------------------------------- /credits/JSch.LICENSE.txt: -------------------------------------------------------------------------------- 1 | JSch 0.0.* was released under the GNU LGPL license. Later, we have switched 2 | over to a BSD-style license. 3 | 4 | ------------------------------------------------------------------------------ 5 | Copyright (c) 2002-2015 Atsuhiko Yamanaka, JCraft,Inc. 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | 1. Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in 16 | the documentation and/or other materials provided with the distribution. 17 | 18 | 3. The names of the authors may not be used to endorse or promote products 19 | derived from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 22 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 23 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 24 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 27 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /credits/JZlib.LICENSE.txt: -------------------------------------------------------------------------------- 1 | JZlib 0.0.* were released under the GNU LGPL license. Later, we have switched 2 | over to a BSD-style license. 3 | 4 | ------------------------------------------------------------------------------ 5 | Copyright (c) 2000-2011 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /credits/README.md: -------------------------------------------------------------------------------- 1 | I'd like to say thanks to the following projects because their licenses say I should: 2 | 3 | - [JSch by JCraft Inc.](http://www.jcraft.com/jsch/) ([license](JSch.LICENSE.txt)) 4 | - [JZlib by JCraft Inc.](http://www.jcraft.com/jzlib/) ([license](JZlib.LICENSE.txt)) 5 | -------------------------------------------------------------------------------- /index.android.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './js/app'; 3 | 4 | AppRegistry.registerComponent('hooks', () => App); 5 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View 13 | } from 'react-native'; 14 | 15 | export default class hooks extends Component { 16 | render() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.ios.js 24 | 25 | 26 | Press Cmd+R to reload,{'\n'} 27 | Cmd+D or shake for dev menu 28 | 29 | 30 | ); 31 | } 32 | } 33 | 34 | const styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('hooks', () => hooks); 54 | -------------------------------------------------------------------------------- /ios/hooks.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | /* Begin PBXBuildFile section */ 9 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 10 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 11 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 12 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 13 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 14 | 00E356F31AD99517003FC87E /* hooksTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* hooksTests.m */; }; 15 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 16 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 17 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 18 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 19 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 20 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 21 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 22 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 23 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 24 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 25 | 5E3500F4CB864FD499B98008 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B6B3721EA2B34650BA066ED7 /* libRNVectorIcons.a */; }; 26 | 2BC629133D6F4785B7504BFA /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 28ADFC9FEB4648389CA7F68B /* Entypo.ttf */; }; 27 | 9B014EEE39B94427A2F8EB3B /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 351FCD3C1BF640FABCCE4162 /* EvilIcons.ttf */; }; 28 | 7FEB3D333D154458B24FFAD9 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A8C2A30396DC42299C47D6CF /* FontAwesome.ttf */; }; 29 | AF7BA339B39C425E85A05D71 /* Foundation.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 622CDE11F369469FBEE2EAB0 /* Foundation.ttf */; }; 30 | FCCE0C3E701C4B8F92462AE1 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8B4451968B4C42538FD13245 /* Ionicons.ttf */; }; 31 | 7DBB79DAA8394F10A4DC2848 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 675D1EBD4517480CAECB3F18 /* MaterialIcons.ttf */; }; 32 | 671B4DBBDB6B460ABC608C57 /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 744C8440D71E47FA9118A12B /* Octicons.ttf */; }; 33 | 46A8B7ECD255451FBA9C5BF1 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 328326F6B27F4F39AE2A1010 /* Zocial.ttf */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXContainerItemProxy section */ 37 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 40 | proxyType = 2; 41 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 42 | remoteInfo = RCTActionSheet; 43 | }; 44 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 45 | isa = PBXContainerItemProxy; 46 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 47 | proxyType = 2; 48 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 49 | remoteInfo = RCTGeolocation; 50 | }; 51 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 52 | isa = PBXContainerItemProxy; 53 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 54 | proxyType = 2; 55 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 56 | remoteInfo = RCTImage; 57 | }; 58 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 59 | isa = PBXContainerItemProxy; 60 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 61 | proxyType = 2; 62 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 63 | remoteInfo = RCTNetwork; 64 | }; 65 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 66 | isa = PBXContainerItemProxy; 67 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 68 | proxyType = 2; 69 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 70 | remoteInfo = RCTVibration; 71 | }; 72 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 73 | isa = PBXContainerItemProxy; 74 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 75 | proxyType = 1; 76 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 77 | remoteInfo = hooks; 78 | }; 79 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 80 | isa = PBXContainerItemProxy; 81 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 82 | proxyType = 2; 83 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 84 | remoteInfo = RCTSettings; 85 | }; 86 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 87 | isa = PBXContainerItemProxy; 88 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 89 | proxyType = 2; 90 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 91 | remoteInfo = RCTWebSocket; 92 | }; 93 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 94 | isa = PBXContainerItemProxy; 95 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 96 | proxyType = 2; 97 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 98 | remoteInfo = React; 99 | }; 100 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 101 | isa = PBXContainerItemProxy; 102 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 103 | proxyType = 2; 104 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 105 | remoteInfo = RCTLinking; 106 | }; 107 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 108 | isa = PBXContainerItemProxy; 109 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 110 | proxyType = 2; 111 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 112 | remoteInfo = RCTText; 113 | }; 114 | /* End PBXContainerItemProxy section */ 115 | 116 | /* Begin PBXFileReference section */ 117 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = main.jsbundle; sourceTree = ""; }; 118 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; 119 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; 120 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; 121 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; 122 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; 123 | 00E356EE1AD99517003FC87E /* hooksTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = hooksTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 124 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 125 | 00E356F21AD99517003FC87E /* hooksTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = hooksTests.m; sourceTree = ""; }; 126 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; 127 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; 128 | 13B07F961A680F5B00A75B9A /* hooks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = hooks.app; sourceTree = BUILT_PRODUCTS_DIR; }; 129 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = hooks/AppDelegate.h; sourceTree = ""; }; 130 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = hooks/AppDelegate.m; sourceTree = ""; }; 131 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 132 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = hooks/Images.xcassets; sourceTree = ""; }; 133 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = hooks/Info.plist; sourceTree = ""; }; 134 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = hooks/main.m; sourceTree = ""; }; 135 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../node_modules/react-native/React/React.xcodeproj; sourceTree = ""; }; 136 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = ""; }; 137 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = ""; }; 138 | C41106DB32C34118A0764CCE /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; name = "RNVectorIcons.xcodeproj"; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; 139 | B6B3721EA2B34650BA066ED7 /* libRNVectorIcons.a */ = {isa = PBXFileReference; name = "libRNVectorIcons.a"; path = "libRNVectorIcons.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; 140 | 28ADFC9FEB4648389CA7F68B /* Entypo.ttf */ = {isa = PBXFileReference; name = "Entypo.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 141 | 351FCD3C1BF640FABCCE4162 /* EvilIcons.ttf */ = {isa = PBXFileReference; name = "EvilIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 142 | A8C2A30396DC42299C47D6CF /* FontAwesome.ttf */ = {isa = PBXFileReference; name = "FontAwesome.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 143 | 622CDE11F369469FBEE2EAB0 /* Foundation.ttf */ = {isa = PBXFileReference; name = "Foundation.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Foundation.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 144 | 8B4451968B4C42538FD13245 /* Ionicons.ttf */ = {isa = PBXFileReference; name = "Ionicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 145 | 675D1EBD4517480CAECB3F18 /* MaterialIcons.ttf */ = {isa = PBXFileReference; name = "MaterialIcons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 146 | 744C8440D71E47FA9118A12B /* Octicons.ttf */ = {isa = PBXFileReference; name = "Octicons.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 147 | 328326F6B27F4F39AE2A1010 /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; }; 148 | /* End PBXFileReference section */ 149 | 150 | /* Begin PBXFrameworksBuildPhase section */ 151 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 152 | isa = PBXFrameworksBuildPhase; 153 | buildActionMask = 2147483647; 154 | files = ( 155 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 160 | isa = PBXFrameworksBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 164 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 165 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 166 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 167 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 168 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 169 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 170 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 171 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 172 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 173 | 5E3500F4CB864FD499B98008 /* libRNVectorIcons.a in Frameworks */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXFrameworksBuildPhase section */ 178 | 179 | /* Begin PBXGroup section */ 180 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 181 | isa = PBXGroup; 182 | children = ( 183 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 184 | ); 185 | name = Products; 186 | sourceTree = ""; 187 | }; 188 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 189 | isa = PBXGroup; 190 | children = ( 191 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 192 | ); 193 | name = Products; 194 | sourceTree = ""; 195 | }; 196 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 197 | isa = PBXGroup; 198 | children = ( 199 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 200 | ); 201 | name = Products; 202 | sourceTree = ""; 203 | }; 204 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 205 | isa = PBXGroup; 206 | children = ( 207 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 208 | ); 209 | name = Products; 210 | sourceTree = ""; 211 | }; 212 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 213 | isa = PBXGroup; 214 | children = ( 215 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 216 | ); 217 | name = Products; 218 | sourceTree = ""; 219 | }; 220 | 00E356EF1AD99517003FC87E /* hooksTests */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | 00E356F21AD99517003FC87E /* hooksTests.m */, 224 | 00E356F01AD99517003FC87E /* Supporting Files */, 225 | ); 226 | path = hooksTests; 227 | sourceTree = ""; 228 | }; 229 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 230 | isa = PBXGroup; 231 | children = ( 232 | 00E356F11AD99517003FC87E /* Info.plist */, 233 | ); 234 | name = "Supporting Files"; 235 | sourceTree = ""; 236 | }; 237 | 139105B71AF99BAD00B5F7CC /* Products */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 241 | ); 242 | name = Products; 243 | sourceTree = ""; 244 | }; 245 | 139FDEE71B06529A00C62182 /* Products */ = { 246 | isa = PBXGroup; 247 | children = ( 248 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 249 | ); 250 | name = Products; 251 | sourceTree = ""; 252 | }; 253 | 13B07FAE1A68108700A75B9A /* hooks */ = { 254 | isa = PBXGroup; 255 | children = ( 256 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 257 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 258 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 259 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 260 | 13B07FB61A68108700A75B9A /* Info.plist */, 261 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 262 | 13B07FB71A68108700A75B9A /* main.m */, 263 | ); 264 | name = hooks; 265 | sourceTree = ""; 266 | }; 267 | 146834001AC3E56700842450 /* Products */ = { 268 | isa = PBXGroup; 269 | children = ( 270 | 146834041AC3E56700842450 /* libReact.a */, 271 | ); 272 | name = Products; 273 | sourceTree = ""; 274 | }; 275 | 78C398B11ACF4ADC00677621 /* Products */ = { 276 | isa = PBXGroup; 277 | children = ( 278 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 279 | ); 280 | name = Products; 281 | sourceTree = ""; 282 | }; 283 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 284 | isa = PBXGroup; 285 | children = ( 286 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 287 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 288 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 289 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 290 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 291 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 292 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 293 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 294 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 295 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 296 | C41106DB32C34118A0764CCE /* RNVectorIcons.xcodeproj */, 297 | ); 298 | name = Libraries; 299 | sourceTree = ""; 300 | }; 301 | 832341B11AAA6A8300B99B32 /* Products */ = { 302 | isa = PBXGroup; 303 | children = ( 304 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 305 | ); 306 | name = Products; 307 | sourceTree = ""; 308 | }; 309 | 83CBB9F61A601CBA00E9B192 = { 310 | isa = PBXGroup; 311 | children = ( 312 | 13B07FAE1A68108700A75B9A /* hooks */, 313 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 314 | 00E356EF1AD99517003FC87E /* hooksTests */, 315 | 83CBBA001A601CBA00E9B192 /* Products */, 316 | 4C337AB690F24F5A9ACFABD3 /* Resources */, 317 | ); 318 | indentWidth = 2; 319 | sourceTree = ""; 320 | tabWidth = 2; 321 | }; 322 | 83CBBA001A601CBA00E9B192 /* Products */ = { 323 | isa = PBXGroup; 324 | children = ( 325 | 13B07F961A680F5B00A75B9A /* hooks.app */, 326 | 00E356EE1AD99517003FC87E /* hooksTests.xctest */, 327 | ); 328 | name = Products; 329 | sourceTree = ""; 330 | }; 331 | 4C337AB690F24F5A9ACFABD3 /* Resources */ = { 332 | isa = PBXGroup; 333 | children = ( 334 | 28ADFC9FEB4648389CA7F68B /* Entypo.ttf */, 335 | 351FCD3C1BF640FABCCE4162 /* EvilIcons.ttf */, 336 | A8C2A30396DC42299C47D6CF /* FontAwesome.ttf */, 337 | 622CDE11F369469FBEE2EAB0 /* Foundation.ttf */, 338 | 8B4451968B4C42538FD13245 /* Ionicons.ttf */, 339 | 675D1EBD4517480CAECB3F18 /* MaterialIcons.ttf */, 340 | 744C8440D71E47FA9118A12B /* Octicons.ttf */, 341 | 328326F6B27F4F39AE2A1010 /* Zocial.ttf */, 342 | ); 343 | name = Resources; 344 | path = ""; 345 | sourceTree = ""; 346 | }; 347 | /* End PBXGroup section */ 348 | 349 | /* Begin PBXNativeTarget section */ 350 | 00E356ED1AD99517003FC87E /* hooksTests */ = { 351 | isa = PBXNativeTarget; 352 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "hooksTests" */; 353 | buildPhases = ( 354 | 00E356EA1AD99517003FC87E /* Sources */, 355 | 00E356EB1AD99517003FC87E /* Frameworks */, 356 | 00E356EC1AD99517003FC87E /* Resources */, 357 | ); 358 | buildRules = ( 359 | ); 360 | dependencies = ( 361 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 362 | ); 363 | name = hooksTests; 364 | productName = hooksTests; 365 | productReference = 00E356EE1AD99517003FC87E /* hooksTests.xctest */; 366 | productType = "com.apple.product-type.bundle.unit-test"; 367 | }; 368 | 13B07F861A680F5B00A75B9A /* hooks */ = { 369 | isa = PBXNativeTarget; 370 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "hooks" */; 371 | buildPhases = ( 372 | 13B07F871A680F5B00A75B9A /* Sources */, 373 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 374 | 13B07F8E1A680F5B00A75B9A /* Resources */, 375 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 376 | ); 377 | buildRules = ( 378 | ); 379 | dependencies = ( 380 | ); 381 | name = hooks; 382 | productName = "Hello World"; 383 | productReference = 13B07F961A680F5B00A75B9A /* hooks.app */; 384 | productType = "com.apple.product-type.application"; 385 | }; 386 | /* End PBXNativeTarget section */ 387 | 388 | /* Begin PBXProject section */ 389 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 390 | isa = PBXProject; 391 | attributes = { 392 | LastUpgradeCheck = 610; 393 | ORGANIZATIONNAME = Facebook; 394 | TargetAttributes = { 395 | 00E356ED1AD99517003FC87E = { 396 | CreatedOnToolsVersion = 6.2; 397 | TestTargetID = 13B07F861A680F5B00A75B9A; 398 | }; 399 | }; 400 | }; 401 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "hooks" */; 402 | compatibilityVersion = "Xcode 3.2"; 403 | developmentRegion = English; 404 | hasScannedForEncodings = 0; 405 | knownRegions = ( 406 | en, 407 | Base, 408 | ); 409 | mainGroup = 83CBB9F61A601CBA00E9B192; 410 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 411 | projectDirPath = ""; 412 | projectReferences = ( 413 | { 414 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 415 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 416 | }, 417 | { 418 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 419 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 420 | }, 421 | { 422 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 423 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 424 | }, 425 | { 426 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 427 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 428 | }, 429 | { 430 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 431 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 432 | }, 433 | { 434 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 435 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 436 | }, 437 | { 438 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 439 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 440 | }, 441 | { 442 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 443 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 444 | }, 445 | { 446 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 447 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 448 | }, 449 | { 450 | ProductGroup = 146834001AC3E56700842450 /* Products */; 451 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 452 | }, 453 | ); 454 | projectRoot = ""; 455 | targets = ( 456 | 13B07F861A680F5B00A75B9A /* hooks */, 457 | 00E356ED1AD99517003FC87E /* hooksTests */, 458 | ); 459 | }; 460 | /* End PBXProject section */ 461 | 462 | /* Begin PBXReferenceProxy section */ 463 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 464 | isa = PBXReferenceProxy; 465 | fileType = archive.ar; 466 | path = libRCTActionSheet.a; 467 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 468 | sourceTree = BUILT_PRODUCTS_DIR; 469 | }; 470 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 471 | isa = PBXReferenceProxy; 472 | fileType = archive.ar; 473 | path = libRCTGeolocation.a; 474 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 475 | sourceTree = BUILT_PRODUCTS_DIR; 476 | }; 477 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 478 | isa = PBXReferenceProxy; 479 | fileType = archive.ar; 480 | path = libRCTImage.a; 481 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 482 | sourceTree = BUILT_PRODUCTS_DIR; 483 | }; 484 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 485 | isa = PBXReferenceProxy; 486 | fileType = archive.ar; 487 | path = libRCTNetwork.a; 488 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 489 | sourceTree = BUILT_PRODUCTS_DIR; 490 | }; 491 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 492 | isa = PBXReferenceProxy; 493 | fileType = archive.ar; 494 | path = libRCTVibration.a; 495 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 496 | sourceTree = BUILT_PRODUCTS_DIR; 497 | }; 498 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 499 | isa = PBXReferenceProxy; 500 | fileType = archive.ar; 501 | path = libRCTSettings.a; 502 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 503 | sourceTree = BUILT_PRODUCTS_DIR; 504 | }; 505 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 506 | isa = PBXReferenceProxy; 507 | fileType = archive.ar; 508 | path = libRCTWebSocket.a; 509 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 510 | sourceTree = BUILT_PRODUCTS_DIR; 511 | }; 512 | 146834041AC3E56700842450 /* libReact.a */ = { 513 | isa = PBXReferenceProxy; 514 | fileType = archive.ar; 515 | path = libReact.a; 516 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 517 | sourceTree = BUILT_PRODUCTS_DIR; 518 | }; 519 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 520 | isa = PBXReferenceProxy; 521 | fileType = archive.ar; 522 | path = libRCTLinking.a; 523 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 524 | sourceTree = BUILT_PRODUCTS_DIR; 525 | }; 526 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 527 | isa = PBXReferenceProxy; 528 | fileType = archive.ar; 529 | path = libRCTText.a; 530 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 531 | sourceTree = BUILT_PRODUCTS_DIR; 532 | }; 533 | /* End PBXReferenceProxy section */ 534 | 535 | /* Begin PBXResourcesBuildPhase section */ 536 | 00E356EC1AD99517003FC87E /* Resources */ = { 537 | isa = PBXResourcesBuildPhase; 538 | buildActionMask = 2147483647; 539 | files = ( 540 | ); 541 | runOnlyForDeploymentPostprocessing = 0; 542 | }; 543 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 544 | isa = PBXResourcesBuildPhase; 545 | buildActionMask = 2147483647; 546 | files = ( 547 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 548 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 549 | 2BC629133D6F4785B7504BFA /* Entypo.ttf in Resources */, 550 | 9B014EEE39B94427A2F8EB3B /* EvilIcons.ttf in Resources */, 551 | 7FEB3D333D154458B24FFAD9 /* FontAwesome.ttf in Resources */, 552 | AF7BA339B39C425E85A05D71 /* Foundation.ttf in Resources */, 553 | FCCE0C3E701C4B8F92462AE1 /* Ionicons.ttf in Resources */, 554 | 7DBB79DAA8394F10A4DC2848 /* MaterialIcons.ttf in Resources */, 555 | 671B4DBBDB6B460ABC608C57 /* Octicons.ttf in Resources */, 556 | 46A8B7ECD255451FBA9C5BF1 /* Zocial.ttf in Resources */, 557 | ); 558 | runOnlyForDeploymentPostprocessing = 0; 559 | }; 560 | /* End PBXResourcesBuildPhase section */ 561 | 562 | /* Begin PBXShellScriptBuildPhase section */ 563 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 564 | isa = PBXShellScriptBuildPhase; 565 | buildActionMask = 2147483647; 566 | files = ( 567 | ); 568 | inputPaths = ( 569 | ); 570 | name = "Bundle React Native code and images"; 571 | outputPaths = ( 572 | ); 573 | runOnlyForDeploymentPostprocessing = 0; 574 | shellPath = /bin/sh; 575 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; 576 | showEnvVarsInLog = 1; 577 | }; 578 | /* End PBXShellScriptBuildPhase section */ 579 | 580 | /* Begin PBXSourcesBuildPhase section */ 581 | 00E356EA1AD99517003FC87E /* Sources */ = { 582 | isa = PBXSourcesBuildPhase; 583 | buildActionMask = 2147483647; 584 | files = ( 585 | 00E356F31AD99517003FC87E /* hooksTests.m in Sources */, 586 | ); 587 | runOnlyForDeploymentPostprocessing = 0; 588 | }; 589 | 13B07F871A680F5B00A75B9A /* Sources */ = { 590 | isa = PBXSourcesBuildPhase; 591 | buildActionMask = 2147483647; 592 | files = ( 593 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 594 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 595 | ); 596 | runOnlyForDeploymentPostprocessing = 0; 597 | }; 598 | /* End PBXSourcesBuildPhase section */ 599 | 600 | /* Begin PBXTargetDependency section */ 601 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 602 | isa = PBXTargetDependency; 603 | target = 13B07F861A680F5B00A75B9A /* hooks */; 604 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 605 | }; 606 | /* End PBXTargetDependency section */ 607 | 608 | /* Begin PBXVariantGroup section */ 609 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 610 | isa = PBXVariantGroup; 611 | children = ( 612 | 13B07FB21A68108700A75B9A /* Base */, 613 | ); 614 | name = LaunchScreen.xib; 615 | path = hooks; 616 | sourceTree = ""; 617 | }; 618 | /* End PBXVariantGroup section */ 619 | 620 | /* Begin XCBuildConfiguration section */ 621 | 00E356F61AD99517003FC87E /* Debug */ = { 622 | isa = XCBuildConfiguration; 623 | buildSettings = { 624 | BUNDLE_LOADER = "$(TEST_HOST)"; 625 | GCC_PREPROCESSOR_DEFINITIONS = ( 626 | "DEBUG=1", 627 | "$(inherited)", 628 | ); 629 | INFOPLIST_FILE = hooksTests/Info.plist; 630 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 631 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 632 | PRODUCT_NAME = "$(TARGET_NAME)"; 633 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/hooks.app/hooks"; 634 | LIBRARY_SEARCH_PATHS = ( 635 | "$(inherited)", 636 | "\"$(SRCROOT)/$(TARGET_NAME)\"", 637 | ); 638 | }; 639 | name = Debug; 640 | }; 641 | 00E356F71AD99517003FC87E /* Release */ = { 642 | isa = XCBuildConfiguration; 643 | buildSettings = { 644 | BUNDLE_LOADER = "$(TEST_HOST)"; 645 | COPY_PHASE_STRIP = NO; 646 | INFOPLIST_FILE = hooksTests/Info.plist; 647 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 648 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 649 | PRODUCT_NAME = "$(TARGET_NAME)"; 650 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/hooks.app/hooks"; 651 | LIBRARY_SEARCH_PATHS = ( 652 | "$(inherited)", 653 | "\"$(SRCROOT)/$(TARGET_NAME)\"", 654 | ); 655 | }; 656 | name = Release; 657 | }; 658 | 13B07F941A680F5B00A75B9A /* Debug */ = { 659 | isa = XCBuildConfiguration; 660 | buildSettings = { 661 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 662 | CURRENT_PROJECT_VERSION = 1; 663 | DEAD_CODE_STRIPPING = NO; 664 | HEADER_SEARCH_PATHS = ( 665 | "$(inherited)", 666 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 667 | "$(SRCROOT)/../node_modules/react-native/React/**", 668 | "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", 669 | ); 670 | INFOPLIST_FILE = "hooks/Info.plist"; 671 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 672 | OTHER_LDFLAGS = ( 673 | "$(inherited)", 674 | "-ObjC", 675 | "-lc++", 676 | ); 677 | PRODUCT_NAME = hooks; 678 | VERSIONING_SYSTEM = "apple-generic"; 679 | }; 680 | name = Debug; 681 | }; 682 | 13B07F951A680F5B00A75B9A /* Release */ = { 683 | isa = XCBuildConfiguration; 684 | buildSettings = { 685 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 686 | CURRENT_PROJECT_VERSION = 1; 687 | HEADER_SEARCH_PATHS = ( 688 | "$(inherited)", 689 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 690 | "$(SRCROOT)/../node_modules/react-native/React/**", 691 | "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", 692 | ); 693 | INFOPLIST_FILE = "hooks/Info.plist"; 694 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 695 | OTHER_LDFLAGS = ( 696 | "$(inherited)", 697 | "-ObjC", 698 | "-lc++", 699 | ); 700 | PRODUCT_NAME = hooks; 701 | VERSIONING_SYSTEM = "apple-generic"; 702 | }; 703 | name = Release; 704 | }; 705 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 706 | isa = XCBuildConfiguration; 707 | buildSettings = { 708 | ALWAYS_SEARCH_USER_PATHS = NO; 709 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 710 | CLANG_CXX_LIBRARY = "libc++"; 711 | CLANG_ENABLE_MODULES = YES; 712 | CLANG_ENABLE_OBJC_ARC = YES; 713 | CLANG_WARN_BOOL_CONVERSION = YES; 714 | CLANG_WARN_CONSTANT_CONVERSION = YES; 715 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 716 | CLANG_WARN_EMPTY_BODY = YES; 717 | CLANG_WARN_ENUM_CONVERSION = YES; 718 | CLANG_WARN_INT_CONVERSION = YES; 719 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 720 | CLANG_WARN_UNREACHABLE_CODE = YES; 721 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 722 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 723 | COPY_PHASE_STRIP = NO; 724 | ENABLE_STRICT_OBJC_MSGSEND = YES; 725 | GCC_C_LANGUAGE_STANDARD = gnu99; 726 | GCC_DYNAMIC_NO_PIC = NO; 727 | GCC_OPTIMIZATION_LEVEL = 0; 728 | GCC_PREPROCESSOR_DEFINITIONS = ( 729 | "DEBUG=1", 730 | "$(inherited)", 731 | ); 732 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 733 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 734 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 735 | GCC_WARN_UNDECLARED_SELECTOR = YES; 736 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 737 | GCC_WARN_UNUSED_FUNCTION = YES; 738 | GCC_WARN_UNUSED_VARIABLE = YES; 739 | HEADER_SEARCH_PATHS = ( 740 | "$(inherited)", 741 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 742 | "$(SRCROOT)/../node_modules/react-native/React/**", 743 | "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", 744 | ); 745 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 746 | MTL_ENABLE_DEBUG_INFO = YES; 747 | ONLY_ACTIVE_ARCH = YES; 748 | SDKROOT = iphoneos; 749 | }; 750 | name = Debug; 751 | }; 752 | 83CBBA211A601CBA00E9B192 /* Release */ = { 753 | isa = XCBuildConfiguration; 754 | buildSettings = { 755 | ALWAYS_SEARCH_USER_PATHS = NO; 756 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 757 | CLANG_CXX_LIBRARY = "libc++"; 758 | CLANG_ENABLE_MODULES = YES; 759 | CLANG_ENABLE_OBJC_ARC = YES; 760 | CLANG_WARN_BOOL_CONVERSION = YES; 761 | CLANG_WARN_CONSTANT_CONVERSION = YES; 762 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 763 | CLANG_WARN_EMPTY_BODY = YES; 764 | CLANG_WARN_ENUM_CONVERSION = YES; 765 | CLANG_WARN_INT_CONVERSION = YES; 766 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 767 | CLANG_WARN_UNREACHABLE_CODE = YES; 768 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 769 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 770 | COPY_PHASE_STRIP = YES; 771 | ENABLE_NS_ASSERTIONS = NO; 772 | ENABLE_STRICT_OBJC_MSGSEND = YES; 773 | GCC_C_LANGUAGE_STANDARD = gnu99; 774 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 775 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 776 | GCC_WARN_UNDECLARED_SELECTOR = YES; 777 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 778 | GCC_WARN_UNUSED_FUNCTION = YES; 779 | GCC_WARN_UNUSED_VARIABLE = YES; 780 | HEADER_SEARCH_PATHS = ( 781 | "$(inherited)", 782 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 783 | "$(SRCROOT)/../node_modules/react-native/React/**", 784 | "$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager", 785 | ); 786 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 787 | MTL_ENABLE_DEBUG_INFO = NO; 788 | SDKROOT = iphoneos; 789 | VALIDATE_PRODUCT = YES; 790 | }; 791 | name = Release; 792 | }; 793 | /* End XCBuildConfiguration section */ 794 | 795 | /* Begin XCConfigurationList section */ 796 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "hooksTests" */ = { 797 | isa = XCConfigurationList; 798 | buildConfigurations = ( 799 | 00E356F61AD99517003FC87E /* Debug */, 800 | 00E356F71AD99517003FC87E /* Release */, 801 | ); 802 | defaultConfigurationIsVisible = 0; 803 | defaultConfigurationName = Release; 804 | }; 805 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "hooks" */ = { 806 | isa = XCConfigurationList; 807 | buildConfigurations = ( 808 | 13B07F941A680F5B00A75B9A /* Debug */, 809 | 13B07F951A680F5B00A75B9A /* Release */, 810 | ); 811 | defaultConfigurationIsVisible = 0; 812 | defaultConfigurationName = Release; 813 | }; 814 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "hooks" */ = { 815 | isa = XCConfigurationList; 816 | buildConfigurations = ( 817 | 83CBBA201A601CBA00E9B192 /* Debug */, 818 | 83CBBA211A601CBA00E9B192 /* Release */, 819 | ); 820 | defaultConfigurationIsVisible = 0; 821 | defaultConfigurationName = Release; 822 | }; 823 | /* End XCConfigurationList section */ 824 | }; 825 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 826 | } 827 | -------------------------------------------------------------------------------- /ios/hooks.xcodeproj/xcshareddata/xcschemes/hooks.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ios/hooks/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/hooks/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTBundleURLProvider.h" 13 | #import "RCTRootView.h" 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"hooks" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ios/hooks/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/hooks/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/hooks/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | NSExceptionDomains 44 | 45 | localhost 46 | 47 | NSTemporaryExceptionAllowsInsecureHTTPLoads 48 | 49 | 50 | 51 | 52 | UIAppFonts 53 | 54 | Entypo.ttf 55 | EvilIcons.ttf 56 | FontAwesome.ttf 57 | Foundation.ttf 58 | Ionicons.ttf 59 | MaterialIcons.ttf 60 | Octicons.ttf 61 | Zocial.ttf 62 | 63 | 64 | -------------------------------------------------------------------------------- /ios/hooks/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ios/hooksTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/hooksTests/hooksTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface hooksTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation hooksTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /js/actions/server.js: -------------------------------------------------------------------------------- 1 | export const ADD_SERVER = 'ADD_SERVER'; 2 | export const REMOVE_SERVER = 'REMOVE_SERVER'; 3 | export const UPDATE_SERVER = 'UPDATE_SERVER'; 4 | 5 | export function addServer(server) { 6 | return { 7 | type: ADD_SERVER, 8 | server: server 9 | }; 10 | } 11 | 12 | export function removeServer(server) { 13 | return { 14 | type: REMOVE_SERVER, 15 | server: server, 16 | }; 17 | } 18 | 19 | export function updateServer(server) { 20 | return { 21 | type: UPDATE_SERVER, 22 | server: server, 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /js/app.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Provider } from 'react-redux'; 3 | import { Router, Scene } from 'react-native-router-flux'; 4 | 5 | import store from './store'; 6 | import AppPassword from './components/app-password'; 7 | import ServerCreator from './components/server-creator'; 8 | import ServerEditor from './components/server-editor'; 9 | import ServerList from './components/server-list'; 10 | import Server from './components/server'; 11 | import Hook from './components/hook'; 12 | 13 | 14 | class App extends Component { 15 | render() { 16 | return ( 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ); 32 | } 33 | } 34 | 35 | export default App; 36 | -------------------------------------------------------------------------------- /js/components/app-password/index.js: -------------------------------------------------------------------------------- 1 | import React, { Alert, Component } from 'react'; 2 | import { AsyncStorage, Text } from 'react-native'; 3 | import { Actions, ActionConst } from 'react-native-router-flux'; 4 | import Frame from '../frame'; 5 | import Form from '../form'; 6 | import { unlockStore, verifyStorePassword } from '../../store'; 7 | import styles from './styles.js'; 8 | 9 | 10 | class AppPassword extends Component { 11 | 12 | constructor(props) { 13 | super(props); 14 | this.state = {}; 15 | this.startApp = this.startApp.bind(this); 16 | } 17 | 18 | componentWillMount() { 19 | this.checkIfFirstTime(); 20 | } 21 | 22 | async checkIfFirstTime() { 23 | keys = await AsyncStorage.getAllKeys(); 24 | firstTime = keys.length == 0; 25 | this.setState({firstTime}); 26 | } 27 | 28 | startApp(form) { 29 | unlockStore(form.password); 30 | Actions.listServers({type: ActionConst.RESET}); 31 | } 32 | 33 | passwordValidator() { 34 | return { 35 | func: async (password) => { 36 | let message = "Incorrect password." 37 | 38 | if (!Boolean(password)) 39 | return message; 40 | 41 | let passwordCorrect = await verifyStorePassword(password); 42 | if (!passwordCorrect) 43 | return message; 44 | }, 45 | animation: "shake" 46 | } 47 | } 48 | 49 | passwordField() { 50 | return { 51 | 'password': { 52 | secure: true, 53 | validators: [this.passwordValidator()], 54 | } 55 | }; 56 | } 57 | 58 | renderDescription() { 59 | passwordDescription = [ 60 | "Enter a password of your choosing. Hooks will use it to encrypt it's data.", 61 | "Don't worry, Hooks only speaks with servers you tell it to.", 62 | ].join('\n\n'); 63 | 64 | if (this.state.firstTime) { 65 | return ( 66 | {passwordDescription} 67 | ); 68 | } 69 | } 70 | 71 | render() { 72 | 73 | return ( 74 | 75 |
79 | { this.renderDescription() } 80 |
81 | 82 | ); 83 | } 84 | } 85 | 86 | function mapStateToProps(state) { 87 | return {}; 88 | } 89 | 90 | export default AppPassword; 91 | -------------------------------------------------------------------------------- /js/components/app-password/styles.js: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | 4 | const styles = StyleSheet.create({ 5 | passwordDescription: { 6 | fontSize: 22, 7 | textAlign: 'center' 8 | } 9 | }); 10 | 11 | export default styles; 12 | 13 | -------------------------------------------------------------------------------- /js/components/base-text/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { Text } from 'react-native'; 3 | import merge from 'lodash/merge'; 4 | 5 | 6 | class BaseText extends Component { 7 | 8 | static propTypes = { 9 | centered: PropTypes.bool, 10 | } 11 | 12 | defaultStyle() { 13 | return {}; 14 | } 15 | 16 | propStyles() { 17 | propToStyle = { 18 | centered: {textAlign: 'center'}, 19 | }; 20 | 21 | return Object.keys(propToStyle).reduce((memo, key) => { 22 | if (this.props[key]) { 23 | memo = {...memo, ...propToStyle[key]}; 24 | } 25 | return memo; 26 | }, {}); 27 | } 28 | 29 | defaultProps() { 30 | return { 31 | style: { 32 | ...this.defaultStyle(), 33 | ...this.propStyles(), 34 | } 35 | }; 36 | } 37 | 38 | render() { 39 | return ; 40 | } 41 | } 42 | 43 | export default BaseText; 44 | -------------------------------------------------------------------------------- /js/components/cancelable-callbacks/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { BackAndroid } from 'react-native'; 3 | import { cancelable } from '../../utils'; 4 | 5 | cancelableCallbacks = (WrappedComponent) => { 6 | return class CancelableCallbackComponent extends Component { 7 | 8 | constructor(props) { 9 | super(props); 10 | this.cancelOnBack = this.cancelOnBack.bind(this); 11 | this.backHandlers = []; 12 | } 13 | 14 | componentWillUnmount() { 15 | // Cancel all the callbacks and remove Back handlers 16 | this.backHandlers.map(handler => { 17 | handler(); 18 | BackAndroid.removeEventListener('hardwareBackPress', handler); 19 | }); 20 | } 21 | 22 | cancelOnBack(promise, success, error) { 23 | // Make the cancelable callbacks and the Back button handler 24 | [{ success, error }, cancelAll ] = cancelable({ success, error }); 25 | backHandler = () => { 26 | cancelAll(); 27 | return false; 28 | }; 29 | this.backHandlers.push(backHandler); 30 | 31 | // Attach the handler to the event listener 32 | BackAndroid.addEventListener('hardwareBackPress', backHandler); 33 | 34 | // Attach the callbacks to the promise 35 | promise.then(success.func, error.func); 36 | } 37 | 38 | render() { 39 | const newProps = { cancelOnBack: this.cancelOnBack }; 40 | return ; 41 | } 42 | 43 | } 44 | }; 45 | 46 | export default cancelableCallbacks; 47 | -------------------------------------------------------------------------------- /js/components/content-text/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import BaseText from '../base-text'; 3 | import merge from 'lodash/merge'; 4 | 5 | 6 | class ContentText extends Component { 7 | 8 | defaultProps() { 9 | return { 10 | style: { 11 | fontSize: 25, 12 | color: 'black', 13 | } 14 | }; 15 | } 16 | 17 | render() { 18 | return ; 19 | } 20 | 21 | } 22 | 23 | export default ContentText; 24 | -------------------------------------------------------------------------------- /js/components/form-field/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { Text, View } from 'react-native'; 3 | import { Input, InputGroup } from 'native-base'; 4 | import * as Animatable from 'react-native-animatable'; 5 | import { capitalize } from '../../utils'; 6 | import styles from './styles.js'; 7 | 8 | 9 | Validators = { 10 | hasValue: { 11 | func: async (value) => { 12 | let filledOut = !([undefined, null, ''].includes(value)); 13 | let error = filledOut ? null : 'Fill this out.'; 14 | return error; 15 | }, 16 | } 17 | }; 18 | 19 | class FormField extends Component { 20 | 21 | static propTypes = { 22 | name: PropTypes.string, 23 | initialValue: PropTypes.string, 24 | secure: PropTypes.bool, 25 | validators: PropTypes.arrayOf(PropTypes.shape({ 26 | func: PropTypes.func, 27 | animation: PropTypes.string, 28 | })), 29 | required: PropTypes.bool, 30 | }; 31 | 32 | constructor(props) { 33 | super(props); 34 | this.state = {value: props.initialValue}; 35 | this.onChange = this.onChange.bind(this); 36 | this.config = this.generateConfiguration(); 37 | } 38 | 39 | generateConfiguration() { 40 | let defaultValues = { 41 | required: true, 42 | secure: false, 43 | validators: [], 44 | }; 45 | config = {...defaultValues, ...this.props}; 46 | 47 | // Add a validator if the field is required 48 | if (config.required) config.validators.unshift(Validators.hasValue); 49 | 50 | return config; 51 | } 52 | 53 | onChange(value) { 54 | this.setState({value}); 55 | } 56 | 57 | async validate() { 58 | // Start all the validators 59 | validatorPromises = await this.config.validators.map(async validator => { 60 | let error = await validator.func(this.state.value); 61 | return {...validator, error}; 62 | }); 63 | 64 | // Wait for all the results to come back 65 | validatorResults = await Promise.all(validatorPromises); 66 | 67 | // Show the error of the first validator with an error 68 | allPassed = validatorResults.every(validator => { 69 | // Note that the lack of an error will result in resetting the error field 70 | let errorExists = Boolean(validator.error); 71 | this.setState({error: validator.error}); 72 | 73 | if (errorExists && validator.animation) { 74 | this.refs.animator[validator.animation](700); 75 | } 76 | 77 | return !errorExists; 78 | }); 79 | 80 | return allPassed; 81 | } 82 | 83 | getValue() { 84 | return this.state.value; 85 | } 86 | 87 | render() { 88 | return ( 89 | 90 | 91 | 92 | 97 | 98 | 99 | {this.state.error || ' '} 100 | 101 | ); 102 | } 103 | } 104 | 105 | export default FormField; 106 | -------------------------------------------------------------------------------- /js/components/form-field/styles.js: -------------------------------------------------------------------------------- 1 | import { 2 | Dimensions, 3 | StyleSheet, 4 | } from 'react-native'; 5 | 6 | 7 | const { 8 | width: screenWidth, 9 | } = Dimensions.get('window'); 10 | 11 | const styles = StyleSheet.create({ 12 | fieldContainer: { 13 | marginTop: 20, 14 | }, 15 | 16 | inputGroup: { 17 | height: 70, 18 | width: screenWidth - 50, 19 | }, 20 | 21 | input: { 22 | textAlign: 'center', 23 | fontSize: 25, 24 | height: 60, 25 | }, 26 | 27 | errorText: { 28 | textAlign: 'center', 29 | fontSize: 15, 30 | color: '#d9534f', 31 | }, 32 | }); 33 | 34 | export default styles; 35 | -------------------------------------------------------------------------------- /js/components/form/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { Text, View } from 'react-native'; 3 | import { Button } from 'native-base'; 4 | import mapValues from 'lodash/mapValues'; 5 | import FormField from '../form-field'; 6 | import styles from './styles.js'; 7 | 8 | 9 | class Form extends Component { 10 | 11 | static propTypes = { 12 | children: PropTypes.node, 13 | title: PropTypes.string, 14 | initialValues: PropTypes.object, 15 | fields: PropTypes.object, 16 | submit: PropTypes.func, 17 | submitText: PropTypes.string, 18 | }; 19 | 20 | constructor(props) { 21 | super(props); 22 | this.state = this.props.initialValues || {}; 23 | this.submit = this.submit.bind(this) 24 | } 25 | 26 | async validates() { 27 | validationPromises = Object.values(this.refs).map(async field => await field.validate()); 28 | validationResults = await Promise.all(validationPromises); 29 | return validationResults.every(x => x); 30 | } 31 | 32 | values() { 33 | return mapValues(this.refs, field => field.getValue()) 34 | } 35 | 36 | async submit() { 37 | if (await this.validates()) { 38 | this.props.submit(this.values()); 39 | } 40 | } 41 | 42 | createField(name, config) { 43 | return ; 48 | } 49 | 50 | renderTitle() { 51 | if (this.props.title) { 52 | return ( 53 | {this.props.title} 54 | ); 55 | } 56 | } 57 | 58 | render() { 59 | return ( 60 | 61 | { this.renderTitle() } 62 | { this.props.children } 63 | 64 | {Object.entries(this.props.fields).map(pair => this.createField(...pair))} 65 | 66 | 69 | 70 | ); 71 | } 72 | } 73 | 74 | export default Form; 75 | -------------------------------------------------------------------------------- /js/components/form/styles.js: -------------------------------------------------------------------------------- 1 | import { 2 | Dimensions, 3 | StyleSheet, 4 | } from 'react-native'; 5 | 6 | 7 | const styles = StyleSheet.create({ 8 | content: { 9 | flex: 1, 10 | alignItems: 'center', 11 | justifyContent: 'space-around', 12 | }, 13 | 14 | title: { 15 | fontSize: 40, 16 | color: 'black', 17 | }, 18 | 19 | button: { 20 | marginLeft: 10, 21 | marginRight: 10, 22 | }, 23 | }); 24 | 25 | export default styles; 26 | -------------------------------------------------------------------------------- /js/components/frame/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { View, TouchableWithoutFeedback } from 'react-native'; 3 | import { Container } from 'native-base'; 4 | import dismissKeyboard from 'react-native-dismiss-keyboard'; 5 | 6 | class Frame extends Component { 7 | 8 | static propTypes = { 9 | children: PropTypes.node, 10 | }; 11 | 12 | constructor(props) { 13 | super(props) 14 | } 15 | 16 | containerStyle() { 17 | value = (prop, defaultValue) => this.props[prop] === undefined ? defaultValue : this.props[prop]; 18 | return { 19 | flex: value('flex', 1), 20 | margin: 15, 21 | }; 22 | } 23 | 24 | render() { 25 | return ( 26 | 27 | 28 | dismissKeyboard()}> 29 | 30 | {this.props.children} 31 | 32 | 33 | 34 | 35 | ); 36 | } 37 | } 38 | 39 | export default Frame; 40 | -------------------------------------------------------------------------------- /js/components/hook/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { InteractionManager, NativeModules, Text, View } from 'react-native'; 3 | import { Spinner } from 'native-base'; 4 | import cancelableCallbacks from '../cancelable-callbacks'; 5 | import Frame from '../frame'; 6 | import ContentText from '../content-text'; 7 | import styles from './styles.js'; 8 | 9 | 10 | function Result(props) { 11 | return ( 12 | 13 | {props.result.map((line, index) => 14 | {line} 15 | )} 16 | 17 | ); 18 | } 19 | 20 | Result.propTypes = { 21 | result: PropTypes.array, 22 | }; 23 | 24 | 25 | class Hook extends Component { 26 | 27 | static propTypes = { 28 | hook: PropTypes.string, 29 | server: PropTypes.object, 30 | cancelOnBack: PropTypes.func, 31 | }; 32 | 33 | constructor(props) { 34 | super(props); 35 | this.state = {}; 36 | } 37 | 38 | componentDidMount() { 39 | InteractionManager.runAfterInteractions(() => this.executeHook()); 40 | } 41 | 42 | executeHook() { 43 | command = '".hooks-app/hooks/' + this.props.hook + '"'; 44 | 45 | promise = NativeModules.SSH.execute(this.props.server, command) 46 | this.props.cancelOnBack(promise, (result) => { 47 | this.setState({result}) 48 | }, (error) => { 49 | let message = 'Error: ' + error.message; 50 | this.setState({error: message}) 51 | }); 52 | } 53 | 54 | renderBody() { 55 | errorExists = this.state.error !== undefined; 56 | stillRunning = this.state.result === undefined; 57 | 58 | if (errorExists) { 59 | return ( 60 | 61 | {this.state.error} 62 | 63 | ); 64 | } else if (stillRunning) { 65 | return ( 66 | 67 | Running "{this.props.hook}"... 68 | 69 | 70 | ); 71 | } else { 72 | return ( 73 | 74 | ); 75 | } 76 | } 77 | 78 | render() { 79 | return ( 80 | 81 | 82 | {this.renderBody()} 83 | 84 | 85 | ); 86 | } 87 | } 88 | 89 | export default cancelableCallbacks(Hook); 90 | -------------------------------------------------------------------------------- /js/components/hook/styles.js: -------------------------------------------------------------------------------- 1 | const styles = { 2 | body: { 3 | flex: 1, 4 | justifyContent: 'center', 5 | alignItems: 'center', 6 | }, 7 | 8 | error: { 9 | marginTop: 25, 10 | color: '#d9534f', 11 | }, 12 | }; 13 | 14 | export default styles; 15 | 16 | -------------------------------------------------------------------------------- /js/components/server-creator/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import { Actions } from 'react-native-router-flux'; 4 | 5 | import { addServer } from '../../actions/server'; 6 | import Frame from '../frame'; 7 | import Form from '../form'; 8 | import Models from '../../models'; 9 | 10 | 11 | class ServerCreator extends Component { 12 | 13 | static propTypes = { 14 | addServer: PropTypes.func, 15 | } 16 | 17 | constructor(props) { 18 | super(props); 19 | this.addServer = this.addServer.bind(this); 20 | } 21 | 22 | addServer(form) { 23 | this.props.addServer({...form, hooks: []}); 24 | Actions.pop(); 25 | } 26 | 27 | render() { 28 | return ( 29 | 30 |
33 | 34 | ); 35 | } 36 | } 37 | 38 | function mapDispatch(dispatch) { 39 | return { 40 | addServer: server => dispatch(addServer(server)) 41 | }; 42 | } 43 | 44 | export default connect(null, mapDispatch)(ServerCreator); 45 | -------------------------------------------------------------------------------- /js/components/server-editor/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { connect } from 'react-redux'; 3 | import { Actions } from 'react-native-router-flux'; 4 | import { updateServer } from '../../actions/server'; 5 | import Frame from '../frame'; 6 | import Form from '../form'; 7 | import Models from '../../models'; 8 | 9 | 10 | class ServerEditor extends Component { 11 | 12 | static propTypes = { 13 | server: PropTypes.object, 14 | updateServer: React.PropTypes.func, 15 | } 16 | 17 | constructor(props) { 18 | super(props); 19 | this.updateServer = this.updateServer.bind(this); 20 | } 21 | 22 | updateServer(form) { 23 | // Merge with props.server because we need the ID 24 | this.props.updateServer({...this.props.server, ...form}); 25 | Actions.pop(); 26 | } 27 | 28 | render() { 29 | return ( 30 | 31 | 35 | 36 | ); 37 | } 38 | } 39 | 40 | function mapDispatch(dispatch) { 41 | return { 42 | updateServer: server => dispatch(updateServer(server)) 43 | }; 44 | } 45 | 46 | export default connect(null, mapDispatch)(ServerEditor); 47 | -------------------------------------------------------------------------------- /js/components/server-list/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { 3 | Text, 4 | View, 5 | } from 'react-native'; 6 | import { Card, CardItem, Icon } from 'native-base'; 7 | import { Actions } from 'react-native-router-flux'; 8 | import { connect } from 'react-redux'; 9 | import Frame from '../frame'; 10 | import ContentText from '../content-text'; 11 | import styles from './styles.js'; 12 | 13 | 14 | class ServerList extends Component { 15 | 16 | static propTypes = { 17 | servers: PropTypes.arrayOf(PropTypes.object), 18 | }; 19 | 20 | constructor(props) { 21 | super(props); 22 | } 23 | 24 | render() { 25 | return ( 26 | 27 | Servers 28 | {this.props.servers.map((server, index) => 29 | 30 | Actions.useServer({server})}> 31 | {server.user}@{server.host} 32 | 33 | 34 | )} 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | ); 44 | } 45 | } 46 | 47 | function mapState(state) { 48 | return { 49 | servers: state.server.list, 50 | }; 51 | } 52 | 53 | export default connect(mapState)(ServerList); 54 | -------------------------------------------------------------------------------- /js/components/server-list/styles.js: -------------------------------------------------------------------------------- 1 | import { 2 | StyleSheet, 3 | } from 'react-native'; 4 | 5 | 6 | const styles = StyleSheet.create({ 7 | title: { 8 | margin: 10, 9 | marginLeft: 25, 10 | marginRight: 25, 11 | fontSize: 35, 12 | color: 'black', 13 | textAlign: 'center', 14 | }, 15 | 16 | content: { 17 | flex: 1, 18 | alignItems: 'center', 19 | justifyContent: 'space-around' 20 | }, 21 | 22 | serverCard: { 23 | margin: 15, 24 | }, 25 | 26 | serverCardItem: { 27 | flex: 1, 28 | borderColor: 'white', 29 | alignItems: 'center', 30 | justifyContent: 'center', 31 | }, 32 | 33 | serverText: { 34 | padding: 15, 35 | }, 36 | }); 37 | 38 | export default styles; 39 | -------------------------------------------------------------------------------- /js/components/server/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component, PropTypes } from 'react'; 2 | import { 3 | InteractionManager, 4 | ListView, 5 | NativeModules, 6 | RefreshControl, 7 | Text, 8 | View, 9 | } from 'react-native'; 10 | import { Button, Card, CardItem, Spinner } from 'native-base'; 11 | import { connect } from 'react-redux'; 12 | import { Actions } from 'react-native-router-flux'; 13 | import { removeServer, updateServer } from '../../actions/server'; 14 | import Frame from '../frame'; 15 | import ContentText from '../content-text'; 16 | import cancelableCallbacks from '../cancelable-callbacks'; 17 | import styles from './styles.js'; 18 | 19 | 20 | const Help = () => { 21 | let message = [ 22 | "There aren't any hooks on this server.", 23 | "Add executable files to the directory below to have them listed here:", 24 | "~/.hooks-app/hooks", 25 | ].join("\n\n"); 26 | 27 | return ( 28 | 29 | { message } 30 | 31 | ); 32 | } 33 | 34 | const Error = (props) => { 35 | return ( 36 | 37 | {props.message} 38 | 39 | ); 40 | }; 41 | 42 | Error.propTypes = { 43 | message: PropTypes.string, 44 | } 45 | 46 | 47 | class Server extends Component { 48 | 49 | static propTypes = { 50 | server: PropTypes.object, 51 | removeServer: PropTypes.func, 52 | updateServer: PropTypes.func, 53 | cancelOnBack: PropTypes.func, 54 | }; 55 | 56 | constructor(props) { 57 | super(props); 58 | this.state = {refreshing: true, error: null}; 59 | this.renderHook = this.renderHook.bind(this); 60 | this.findHooks = this.findHooks.bind(this); 61 | this.updateSelf = this.updateSelf.bind(this); 62 | this.removeSelf = this.removeSelf.bind(this); 63 | this.createRefreshControl = this.createRefreshControl.bind(this); 64 | } 65 | 66 | componentDidMount() { 67 | if (this.props.server.hooks.length === 0) { 68 | InteractionManager.runAfterInteractions(() => this.findHooks()); 69 | } else { 70 | this.setState({refreshing: false}); 71 | } 72 | } 73 | 74 | findHooks() { 75 | this.setState({refreshing: true, error: null}); 76 | 77 | // Get the hooks from the server 78 | command = "find .hooks-app/hooks -type f -perm -111 | sed \"s/^.hooks-app\\\/hooks\\\///\""; 79 | promise = NativeModules.SSH.execute(this.props.server, command); 80 | 81 | // Attach the callbacks to a promise that will cancel them on a back press 82 | this.props.cancelOnBack(promise, (result) => { 83 | // Filter out the valid hooks and save them to the server 84 | validHook = (hook) => !(['.', '..'].includes(hook)); 85 | validHooks = result.filter(validHook); 86 | this.props.updateServer({...this.props.server, hooks: validHooks}); 87 | this.setState({refreshing: false}); 88 | }, (error) => { 89 | this.setState({ 90 | error: 'Error: ' + error.message, 91 | refreshing: false, 92 | }); 93 | }) 94 | } 95 | 96 | updateSelf() { 97 | Actions.updateServer({server: this.props.server}); 98 | } 99 | 100 | removeSelf() { 101 | this.props.removeServer(this.props.server); 102 | Actions.pop(); 103 | } 104 | 105 | shouldComponentUpdate(nextProps, nextState) { 106 | // Only re-render if a server still exists. It may not if a remove just happened. 107 | return Boolean(nextProps.server); 108 | } 109 | 110 | renderBody() { 111 | errorExists = this.state.error !== null; 112 | refreshing = this.state.refreshing; 113 | hooksExist = this.props.server.hooks.length > 0; 114 | 115 | if (errorExists) { 116 | return ; 117 | } else if (refreshing || hooksExist) { 118 | const ds = new ListView.DataSource({rowHasChanged: (x, y) => x !== y}); 119 | return ( 120 | 125 | ); 126 | } else { 127 | return ; 128 | } 129 | } 130 | 131 | createRefreshControl() { 132 | return ( 133 | 136 | ); 137 | } 138 | 139 | renderHook(hook) { 140 | return ( 141 | 142 | Actions.executeHook({hook, server: this.props.server})}> 143 | {hook} 144 | 145 | 146 | ); 147 | } 148 | 149 | render() { 150 | return ( 151 | 152 | 153 | {this.props.server.user}@{this.props.server.host} 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | {this.renderBody()} 162 | 163 | 164 | ); 165 | } 166 | } 167 | 168 | function mapState(state, ownProps) { 169 | return { 170 | server: state.server.list.find(server => server.id == ownProps.server.id) 171 | }; 172 | } 173 | 174 | function mapDispatch(dispatch) { 175 | return { 176 | removeServer: server => dispatch(removeServer(server)), 177 | updateServer: server => dispatch(updateServer(server)), 178 | }; 179 | } 180 | 181 | export default connect(mapState, mapDispatch)(cancelableCallbacks(Server)); 182 | -------------------------------------------------------------------------------- /js/components/server/styles.js: -------------------------------------------------------------------------------- 1 | import { 2 | Dimensions, 3 | } from 'react-native'; 4 | 5 | 6 | const { 7 | width: screenWidth, 8 | } = Dimensions.get('window'); 9 | 10 | const styles = { 11 | header: { 12 | alignItems: 'center', 13 | marginLeft: 10, 14 | marginRight: 10, 15 | }, 16 | 17 | title: { 18 | fontSize: 35, 19 | marginBottom: 25, 20 | color: 'black', 21 | textAlign: 'center', 22 | }, 23 | 24 | buttonRow: { 25 | flexDirection: 'row', 26 | justifyContent: 'space-between', 27 | width: screenWidth - 50, 28 | marginBottom: 25, 29 | }, 30 | 31 | button: { 32 | width: (screenWidth / 3) - 35, 33 | }, 34 | 35 | body: { 36 | flex: 1, 37 | margin: 10, 38 | }, 39 | 40 | card: { 41 | marginBottom: 25, 42 | }, 43 | 44 | cardItem: { 45 | flex: 1, 46 | alignItems: 'center', 47 | justifyContent: 'center' 48 | }, 49 | 50 | wait: { 51 | flexDirection: 'row', 52 | justifyContent: 'center', 53 | alignItems: 'center', 54 | }, 55 | 56 | errorContainer: { 57 | marginTop: 10, 58 | alignItems: 'center', 59 | }, 60 | 61 | error: { 62 | color: '#d9534f', // Same as NativeBase's default error color 63 | }, 64 | 65 | spinner: { 66 | marginRight: 15, 67 | }, 68 | }; 69 | 70 | export default styles; 71 | 72 | -------------------------------------------------------------------------------- /js/models/index.js: -------------------------------------------------------------------------------- 1 | import server from './server'; 2 | 3 | export default { 4 | server 5 | }; 6 | -------------------------------------------------------------------------------- /js/models/server.js: -------------------------------------------------------------------------------- 1 | const fields = { 2 | 'user': {}, 3 | 'host': {}, 4 | 'password': {secure: true}, 5 | }; 6 | 7 | export default fields; 8 | -------------------------------------------------------------------------------- /js/reducers/index.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | import server from './server'; 3 | 4 | 5 | export default combineReducers({ 6 | server 7 | }); 8 | -------------------------------------------------------------------------------- /js/reducers/server.js: -------------------------------------------------------------------------------- 1 | import { 2 | ADD_SERVER, 3 | REMOVE_SERVER, 4 | UPDATE_SERVER, 5 | } from '../actions/server'; 6 | 7 | 8 | const initialState = { 9 | list: [], 10 | lastAssignedId: 0, 11 | }; 12 | 13 | export default (currentState = initialState, action) => { 14 | switch (action.type) { 15 | 16 | case ADD_SERVER: 17 | newId = currentState.lastAssignedId + 1; 18 | newServer = { ...action.server, id: newId }; 19 | return { 20 | ...currentState, 21 | list: [...currentState.list, newServer], 22 | lastAssignedId: newId, 23 | }; 24 | 25 | case REMOVE_SERVER: 26 | return { 27 | ...currentState, 28 | list: currentState.list.filter(server => server.id != action.server.id) 29 | }; 30 | 31 | case UPDATE_SERVER: 32 | return { 33 | ...currentState, 34 | list: currentState.list.map(server => server.id == action.server.id ? action.server : server) 35 | }; 36 | 37 | default: 38 | return currentState; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /js/store.js: -------------------------------------------------------------------------------- 1 | import { createStore } from 'redux'; 2 | import { AsyncStorage } from 'react-native'; 3 | import { getStoredState, persistStore, autoRehydrate } from 'redux-persist'; 4 | import createEncryptor from 'redux-persist-transform-encrypt'; 5 | import reducer from './reducers'; 6 | 7 | 8 | const store = createStore(reducer, undefined, autoRehydrate()); 9 | 10 | createConfiguration = (password) => { 11 | encryptor = createEncryptor({secretKey: password}); 12 | return {storage: AsyncStorage, transforms: [encryptor]} 13 | }; 14 | 15 | export async function verifyStorePassword(password) { 16 | let state = await getStoredState(createConfiguration(password)); 17 | let incorrect = Object.values(state).includes(null); 18 | return !incorrect; 19 | }; 20 | 21 | export function unlockStore(password) { 22 | persistStore(store, createConfiguration(password)); 23 | }; 24 | 25 | export default store; 26 | -------------------------------------------------------------------------------- /js/utils.js: -------------------------------------------------------------------------------- 1 | export function capitalize(s) { 2 | return s && s[0].toUpperCase() + s.slice(1); 3 | }; 4 | 5 | export function cancelable(callbacks) { 6 | cancelableCallbacks = Object.keys(callbacks).reduce((memo, name) => { 7 | let canceled = false; 8 | return { 9 | ...memo, 10 | [name]: { 11 | func: (...args) => { if (!canceled) callbacks[name](...args) }, 12 | canceled: () => canceled, 13 | cancel: () => canceled = true, 14 | } 15 | } 16 | }, {}); 17 | 18 | cancelAll = () => Object.values(cancelableCallbacks).map((f) => f.cancel()); 19 | 20 | return [cancelableCallbacks, cancelAll]; 21 | } 22 | -------------------------------------------------------------------------------- /media/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azlyth/hooks/859d2263deef7e68830dc445723b9a3ae525a7aa/media/demo.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hooks", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "react-native start", 7 | "test": "jest", 8 | "install-apk": "cd android && ./gradlew assembleRelease && adb install -r app/build/outputs/apk/app-release.apk" 9 | }, 10 | "dependencies": { 11 | "lodash": "^4.16.6", 12 | "native-base": "^0.5.11", 13 | "react": "15.3.2", 14 | "react-native": "^0.35.0", 15 | "react-native-animatable": "^0.6.1", 16 | "react-native-dismiss-keyboard": "^1.0.0", 17 | "react-native-router-flux": "^3.36.0", 18 | "react-redux": "^4.4.5", 19 | "redux": "^3.6.0", 20 | "redux-persist": "^4.0.0-alpha7", 21 | "redux-persist-transform-encrypt": "^0.1.2" 22 | }, 23 | "jest": { 24 | "preset": "jest-react-native" 25 | }, 26 | "devDependencies": { 27 | "babel-jest": "16.0.0", 28 | "babel-preset-react-native": "1.9.0", 29 | "jest": "16.0.2", 30 | "jest-react-native": "16.0.0", 31 | "react-test-renderer": "15.3.2" 32 | } 33 | } 34 | --------------------------------------------------------------------------------