├── .gitignore ├── .npmignore ├── RNTwilioExample ├── .buckconfig ├── .env ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── README.md ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── rntwilioexample │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── index.android.js ├── index.ios.js ├── ios │ ├── RNTwilioExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── RNTwilioExample.xcscheme │ ├── RNTwilioExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── RNTwilioExampleTests │ │ ├── Info.plist │ │ └── RNTwilioExampleTests.m ├── package.json └── src │ ├── actions.js │ ├── app.js │ ├── components │ └── InputPrompt.js │ ├── containers │ └── AppContainer.js │ ├── reducers.js │ ├── services │ ├── endpoints.js │ └── telephony.js │ └── store.js ├── android ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── rogchap │ └── react │ └── modules │ └── twilio │ ├── TwilioModule.java │ └── TwilioPackage.java ├── index.js ├── ios ├── RCTTwilio.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── RCTTwilio │ ├── RCTTwilio.h │ └── RCTTwilio.m └── libs │ └── TwilioSDK │ ├── Headers │ ├── TCConnection.h │ ├── TCConnectionDelegate.h │ ├── TCDevice.h │ ├── TCDeviceDelegate.h │ ├── TCPresenceEvent.h │ └── TwilioClient.h │ ├── Libraries │ ├── libTwilioClient.a │ ├── libcrypto.a │ └── libssl.a │ ├── Resources │ ├── disconnect.wav │ ├── dtmf_0.wav │ ├── dtmf_1.wav │ ├── dtmf_2.wav │ ├── dtmf_3.wav │ ├── dtmf_4.wav │ ├── dtmf_5.wav │ ├── dtmf_6.wav │ ├── dtmf_7.wav │ ├── dtmf_8.wav │ ├── dtmf_9.wav │ ├── dtmf_hash.wav │ ├── dtmf_star.wav │ ├── incoming.wav │ └── outgoing.wav │ └── readme.html ├── package.json └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | xcuserdata 3 | Pods 4 | *.lock 5 | build/ 6 | 7 | # Android/IJ 8 | # 9 | *.iml 10 | .gradle 11 | .idea 12 | local.properties 13 | 14 | # node.js 15 | # 16 | node_modules/ 17 | npm-debug.log 18 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | RNTwilioExample 2 | -------------------------------------------------------------------------------- /RNTwilioExample/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /RNTwilioExample/.env: -------------------------------------------------------------------------------- 1 | ENV=dev 2 | API_URL=http://192.168.1.65:8000/ 3 | -------------------------------------------------------------------------------- /RNTwilioExample/.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\\.\\(2[0-9]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 52 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-9]\\|1[0-9]\\|[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.29.0 59 | -------------------------------------------------------------------------------- /RNTwilioExample/.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 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | android/app/build 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | android/app/libs 42 | android/keystores/debug.keystore 43 | -------------------------------------------------------------------------------- /RNTwilioExample/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /RNTwilioExample/README.md: -------------------------------------------------------------------------------- 1 | # react-native-twilio example project 2 | 3 | The Example show you how to: 4 | 5 | - initialize the device 6 | - make calls 7 | - receive calls 8 | 9 | # ios 10 | Currently the ios example app is not done. 11 | 12 | # android 13 | 14 | ## setup 15 | 16 | ### server 17 | 18 | The server must implement: 19 | - GET /token/ 20 | - POST /calls/ 21 | 22 | If you don't have your server code yet you can simply use a server example provided by Twilio. The simplier way is to download and run a the Python example 23 | [mobile-quickstart](https://github.com/twilio/mobile-quickstart). 24 | 25 | You will need to amend `server.py` to use your Twilio credentials. 26 | 27 | 28 | The app only needs two endpoints running: 29 | 30 | # TwiML response for incoming/outgoing calls 31 | GET or POST http://localhost:5000/calls/ 32 | 33 | # generate a JWT token for the app to initialise the device 34 | GET http://localhost:5000/token/ 35 | 36 | 37 | Setup an TwiML app through the Twilio Console and use the `APP_ID` for the server configuration. 38 | 39 | Then you need to expose the server to the outside world so that Twilio can contact it when it looks for the TwiML to answer calls. You can use [ngrok](https://ngrok.com/) to do that 40 | 41 | ./ngrok http 5000 42 | # 5000 is the port you specified in server.py 43 | 44 | 45 | ### react-native 46 | You will need to have `react-native` installed and available in your `PATH`. 47 | 48 | Add your server IP address to `.env` 49 | 50 | ENV=dev 51 | API_URL=http://SERVER_IP_ADDRESS:YOUR_SERVER_PORT/ 52 | 53 | ```bash 54 | # install JS dependencies 55 | cd RNTwilioExample 56 | npm install 57 | 58 | # ensure the connection to the JS packager 59 | ./adb reverse tcp:8081 tcp:8081 60 | 61 | # run the JS packager 62 | npm start 63 | 64 | # compile and install a debug build 65 | ENVFILE=.env react-native run-android 66 | # or simply 67 | react-native run-android 68 | # because .env is the default config file 69 | 70 | # that is it! 71 | ``` 72 | 73 | ### adb wireless 74 | 75 | Please follow the instructions on how to connect adb wireless. You can simply search on the Internet for that. 76 | 77 | Then setup your app to communicate with the host machine. 78 | From The app development screen go to `Dev Settings` > `Debug server host & port for device` and type your development machine IP:PORT for example 79 | ``` 80 | 192.168.0.1:8081 81 | ``` 82 | 83 | Now `reload JS` and you should be connected. 84 | 85 | # help 86 | 87 | If you spot some problems with this instructions or want to help clarifying them feel free to open a PR. 88 | -------------------------------------------------------------------------------- /RNTwilioExample/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.rntwilioexample', 50 | ) 51 | 52 | android_resource( 53 | name = 'res', 54 | res = 'src/main/res', 55 | package = 'com.rntwilioexample', 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 | -------------------------------------------------------------------------------- /RNTwilioExample/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" 3 | 4 | import com.android.build.OutputFile 5 | 6 | /** 7 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 8 | * and bundleReleaseJsAndAssets). 9 | * These basically call `react-native bundle` with the correct arguments during the Android build 10 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 11 | * bundle directly from the development server. Below you can see all the possible configurations 12 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 13 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 14 | * 15 | * project.ext.react = [ 16 | * // the name of the generated asset file containing your JS bundle 17 | * bundleAssetName: "index.android.bundle", 18 | * 19 | * // the entry file for bundle generation 20 | * entryFile: "index.android.js", 21 | * 22 | * // whether to bundle JS and assets in debug mode 23 | * bundleInDebug: false, 24 | * 25 | * // whether to bundle JS and assets in release mode 26 | * bundleInRelease: true, 27 | * 28 | * // whether to bundle JS and assets in another build variant (if configured). 29 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 30 | * // The configuration property can be in the following formats 31 | * // 'bundleIn${productFlavor}${buildType}' 32 | * // 'bundleIn${buildType}' 33 | * // bundleInFreeDebug: true, 34 | * // bundleInPaidRelease: true, 35 | * // bundleInBeta: true, 36 | * 37 | * // the root of your project, i.e. where "package.json" lives 38 | * root: "../../", 39 | * 40 | * // where to put the JS bundle asset in debug mode 41 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 42 | * 43 | * // where to put the JS bundle asset in release mode 44 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 45 | * 46 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 47 | * // require('./image.png')), in debug mode 48 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 49 | * 50 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 51 | * // require('./image.png')), in release mode 52 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 53 | * 54 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 55 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 56 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 57 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 58 | * // for example, you might want to remove it from here. 59 | * inputExcludes: ["android/**", "ios/**"], 60 | * 61 | * // override which node gets called and with what additional arguments 62 | * nodeExecutableAndArgs: ["node"] 63 | * 64 | * // supply additional arguments to the packager 65 | * extraPackagerArgs: [] 66 | * ] 67 | */ 68 | 69 | apply from: "../../node_modules/react-native/react.gradle" 70 | 71 | /** 72 | * Set this to true to create two separate APKs instead of one: 73 | * - An APK that only works on ARM devices 74 | * - An APK that only works on x86 devices 75 | * The advantage is the size of the APK is reduced by about 4MB. 76 | * Upload all the APKs to the Play Store and people will download 77 | * the correct one based on the CPU architecture of their device. 78 | */ 79 | def enableSeparateBuildPerCPUArchitecture = false 80 | 81 | /** 82 | * Run Proguard to shrink the Java bytecode in release builds. 83 | */ 84 | def enableProguardInReleaseBuilds = false 85 | 86 | android { 87 | compileSdkVersion 23 88 | buildToolsVersion "23.0.1" 89 | 90 | defaultConfig { 91 | applicationId "com.rntwilioexample" 92 | minSdkVersion 16 93 | targetSdkVersion 22 94 | versionCode 1 95 | versionName "1.0" 96 | ndk { 97 | abiFilters "armeabi-v7a", "x86" 98 | } 99 | } 100 | splits { 101 | abi { 102 | reset() 103 | enable enableSeparateBuildPerCPUArchitecture 104 | universalApk false // If true, also generate a universal APK 105 | include "armeabi-v7a", "x86" 106 | } 107 | } 108 | buildTypes { 109 | release { 110 | minifyEnabled enableProguardInReleaseBuilds 111 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 112 | } 113 | } 114 | // applicationVariants are e.g. debug, release 115 | applicationVariants.all { variant -> 116 | variant.outputs.each { output -> 117 | // For each separate APK per architecture, set a unique version code as described here: 118 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 119 | def versionCodes = ["armeabi-v7a":1, "x86":2] 120 | def abi = output.getFilter(OutputFile.ABI) 121 | if (abi != null) { // null for the universal-debug, universal-release variants 122 | output.versionCodeOverride = 123 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 124 | } 125 | } 126 | } 127 | } 128 | 129 | dependencies { 130 | compile fileTree(dir: "libs", include: ["*.jar"]) 131 | compile "com.android.support:appcompat-v7:23.0.1" 132 | compile "com.facebook.react:react-native:+" // From node_modules 133 | compile project(':react-native-config') 134 | compile project(':react-native-twilio') 135 | } 136 | 137 | // Run this once to be able to run the application with BUCK 138 | // puts all compile dependencies into folder libs for BUCK to use 139 | task copyDownloadableDepsToLibs(type: Copy) { 140 | from configurations.compile 141 | into 'libs' 142 | } 143 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/java/com/rntwilioexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.rntwilioexample; 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 "RNTwilioExample"; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/java/com/rntwilioexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.rntwilioexample; 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.lugg.ReactNativeConfig.ReactNativeConfigPackage; 13 | import com.rogchap.react.modules.twilio.TwilioPackage; 14 | 15 | import java.util.Arrays; 16 | import java.util.List; 17 | 18 | public class MainApplication extends Application implements ReactApplication { 19 | 20 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 21 | 22 | /** 23 | * Returns whether dev mode should be enabled. 24 | * This enables e.g. the dev menu. 25 | */ 26 | @Override 27 | protected boolean getUseDeveloperSupport() { 28 | return BuildConfig.DEBUG; 29 | } 30 | 31 | /** 32 | * A list of packages used by the app. If the app uses additional views 33 | * or modules besides the default ones, add more packages here. 34 | */ 35 | @Override 36 | protected List getPackages() { 37 | return Arrays.asList( 38 | new MainReactPackage(), 39 | new ReactNativeConfigPackage(), 40 | new TwilioPackage() 41 | ); 42 | } 43 | }; 44 | 45 | @Override 46 | public ReactNativeHost getReactNativeHost() { 47 | return mReactNativeHost; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/RNTwilioExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/RNTwilioExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/RNTwilioExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/RNTwilioExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RNTwilioExample 3 | 4 | -------------------------------------------------------------------------------- /RNTwilioExample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/RNTwilioExample/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = 'debug', 3 | store = 'debug.keystore', 4 | properties = 'debug.keystore.properties', 5 | visibility = [ 6 | 'PUBLIC', 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RNTwilioExample' 2 | 3 | include ':app' 4 | 5 | include ':react-native-config' 6 | project(':react-native-config').projectDir = new File(rootProject.projectDir, 7 | '../node_modules/react-native-config/android') 8 | 9 | include ':react-native-twilio' 10 | project(':react-native-twilio').projectDir = new File(settingsDir, 11 | '../node_modules/react-native-twilio/android') -------------------------------------------------------------------------------- /RNTwilioExample/index.android.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {AppRegistry} from 'react-native' 3 | import App from './src/app' 4 | 5 | AppRegistry.registerComponent('RNTwilioExample', () => App) 6 | -------------------------------------------------------------------------------- /RNTwilioExample/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 | class RNTwilioExample 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('RNTwilioExample', () => RNTwilioExample); 54 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 15 | 00E356F31AD99517003FC87E /* RNTwilioExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* RNTwilioExampleTests.m */; }; 16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 23 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 24 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 25 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 32 | proxyType = 2; 33 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 34 | remoteInfo = RCTActionSheet; 35 | }; 36 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 39 | proxyType = 2; 40 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 41 | remoteInfo = RCTGeolocation; 42 | }; 43 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 46 | proxyType = 2; 47 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 48 | remoteInfo = RCTImage; 49 | }; 50 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 51 | isa = PBXContainerItemProxy; 52 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 53 | proxyType = 2; 54 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 55 | remoteInfo = RCTNetwork; 56 | }; 57 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 58 | isa = PBXContainerItemProxy; 59 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 60 | proxyType = 2; 61 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 62 | remoteInfo = RCTVibration; 63 | }; 64 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 65 | isa = PBXContainerItemProxy; 66 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 67 | proxyType = 1; 68 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 69 | remoteInfo = RNTwilioExample; 70 | }; 71 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 72 | isa = PBXContainerItemProxy; 73 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 74 | proxyType = 2; 75 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 76 | remoteInfo = RCTSettings; 77 | }; 78 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 79 | isa = PBXContainerItemProxy; 80 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 81 | proxyType = 2; 82 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 83 | remoteInfo = RCTWebSocket; 84 | }; 85 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 86 | isa = PBXContainerItemProxy; 87 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 88 | proxyType = 2; 89 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 90 | remoteInfo = React; 91 | }; 92 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 93 | isa = PBXContainerItemProxy; 94 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 95 | proxyType = 2; 96 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 97 | remoteInfo = RCTLinking; 98 | }; 99 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 100 | isa = PBXContainerItemProxy; 101 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 102 | proxyType = 2; 103 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 104 | remoteInfo = RCTText; 105 | }; 106 | /* End PBXContainerItemProxy section */ 107 | 108 | /* Begin PBXFileReference section */ 109 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = main.jsbundle; sourceTree = ""; }; 110 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; 111 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; 112 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; 113 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; 114 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; 115 | 00E356EE1AD99517003FC87E /* RNTwilioExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTwilioExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 116 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 117 | 00E356F21AD99517003FC87E /* RNTwilioExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTwilioExampleTests.m; sourceTree = ""; }; 118 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; 119 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; 120 | 13B07F961A680F5B00A75B9A /* RNTwilioExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNTwilioExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 121 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = RNTwilioExample/AppDelegate.h; sourceTree = ""; }; 122 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = RNTwilioExample/AppDelegate.m; sourceTree = ""; }; 123 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 124 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RNTwilioExample/Images.xcassets; sourceTree = ""; }; 125 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTwilioExample/Info.plist; sourceTree = ""; }; 126 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNTwilioExample/main.m; sourceTree = ""; }; 127 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../node_modules/react-native/React/React.xcodeproj; sourceTree = ""; }; 128 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = ""; }; 129 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = ""; }; 130 | /* End PBXFileReference section */ 131 | 132 | /* Begin PBXFrameworksBuildPhase section */ 133 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 134 | isa = PBXFrameworksBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, 138 | ); 139 | runOnlyForDeploymentPostprocessing = 0; 140 | }; 141 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 142 | isa = PBXFrameworksBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 146 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 147 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 148 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 149 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 150 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 151 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 152 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 153 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 154 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXFrameworksBuildPhase section */ 159 | 160 | /* Begin PBXGroup section */ 161 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 165 | ); 166 | name = Products; 167 | sourceTree = ""; 168 | }; 169 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 173 | ); 174 | name = Products; 175 | sourceTree = ""; 176 | }; 177 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 181 | ); 182 | name = Products; 183 | sourceTree = ""; 184 | }; 185 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 189 | ); 190 | name = Products; 191 | sourceTree = ""; 192 | }; 193 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 197 | ); 198 | name = Products; 199 | sourceTree = ""; 200 | }; 201 | 00E356EF1AD99517003FC87E /* RNTwilioExampleTests */ = { 202 | isa = PBXGroup; 203 | children = ( 204 | 00E356F21AD99517003FC87E /* RNTwilioExampleTests.m */, 205 | 00E356F01AD99517003FC87E /* Supporting Files */, 206 | ); 207 | path = RNTwilioExampleTests; 208 | sourceTree = ""; 209 | }; 210 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | 00E356F11AD99517003FC87E /* Info.plist */, 214 | ); 215 | name = "Supporting Files"; 216 | sourceTree = ""; 217 | }; 218 | 139105B71AF99BAD00B5F7CC /* Products */ = { 219 | isa = PBXGroup; 220 | children = ( 221 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 222 | ); 223 | name = Products; 224 | sourceTree = ""; 225 | }; 226 | 139FDEE71B06529A00C62182 /* Products */ = { 227 | isa = PBXGroup; 228 | children = ( 229 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 230 | ); 231 | name = Products; 232 | sourceTree = ""; 233 | }; 234 | 13B07FAE1A68108700A75B9A /* RNTwilioExample */ = { 235 | isa = PBXGroup; 236 | children = ( 237 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 238 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 239 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 240 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 241 | 13B07FB61A68108700A75B9A /* Info.plist */, 242 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 243 | 13B07FB71A68108700A75B9A /* main.m */, 244 | ); 245 | name = RNTwilioExample; 246 | sourceTree = ""; 247 | }; 248 | 146834001AC3E56700842450 /* Products */ = { 249 | isa = PBXGroup; 250 | children = ( 251 | 146834041AC3E56700842450 /* libReact.a */, 252 | ); 253 | name = Products; 254 | sourceTree = ""; 255 | }; 256 | 78C398B11ACF4ADC00677621 /* Products */ = { 257 | isa = PBXGroup; 258 | children = ( 259 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 260 | ); 261 | name = Products; 262 | sourceTree = ""; 263 | }; 264 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 265 | isa = PBXGroup; 266 | children = ( 267 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 268 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 269 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 270 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 271 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 272 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 273 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 274 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 275 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 276 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 277 | ); 278 | name = Libraries; 279 | sourceTree = ""; 280 | }; 281 | 832341B11AAA6A8300B99B32 /* Products */ = { 282 | isa = PBXGroup; 283 | children = ( 284 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 285 | ); 286 | name = Products; 287 | sourceTree = ""; 288 | }; 289 | 83CBB9F61A601CBA00E9B192 = { 290 | isa = PBXGroup; 291 | children = ( 292 | 13B07FAE1A68108700A75B9A /* RNTwilioExample */, 293 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 294 | 00E356EF1AD99517003FC87E /* RNTwilioExampleTests */, 295 | 83CBBA001A601CBA00E9B192 /* Products */, 296 | ); 297 | indentWidth = 2; 298 | sourceTree = ""; 299 | tabWidth = 2; 300 | }; 301 | 83CBBA001A601CBA00E9B192 /* Products */ = { 302 | isa = PBXGroup; 303 | children = ( 304 | 13B07F961A680F5B00A75B9A /* RNTwilioExample.app */, 305 | 00E356EE1AD99517003FC87E /* RNTwilioExampleTests.xctest */, 306 | ); 307 | name = Products; 308 | sourceTree = ""; 309 | }; 310 | /* End PBXGroup section */ 311 | 312 | /* Begin PBXNativeTarget section */ 313 | 00E356ED1AD99517003FC87E /* RNTwilioExampleTests */ = { 314 | isa = PBXNativeTarget; 315 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "RNTwilioExampleTests" */; 316 | buildPhases = ( 317 | 00E356EA1AD99517003FC87E /* Sources */, 318 | 00E356EB1AD99517003FC87E /* Frameworks */, 319 | 00E356EC1AD99517003FC87E /* Resources */, 320 | ); 321 | buildRules = ( 322 | ); 323 | dependencies = ( 324 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 325 | ); 326 | name = RNTwilioExampleTests; 327 | productName = RNTwilioExampleTests; 328 | productReference = 00E356EE1AD99517003FC87E /* RNTwilioExampleTests.xctest */; 329 | productType = "com.apple.product-type.bundle.unit-test"; 330 | }; 331 | 13B07F861A680F5B00A75B9A /* RNTwilioExample */ = { 332 | isa = PBXNativeTarget; 333 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RNTwilioExample" */; 334 | buildPhases = ( 335 | 13B07F871A680F5B00A75B9A /* Sources */, 336 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 337 | 13B07F8E1A680F5B00A75B9A /* Resources */, 338 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 339 | ); 340 | buildRules = ( 341 | ); 342 | dependencies = ( 343 | ); 344 | name = RNTwilioExample; 345 | productName = "Hello World"; 346 | productReference = 13B07F961A680F5B00A75B9A /* RNTwilioExample.app */; 347 | productType = "com.apple.product-type.application"; 348 | }; 349 | /* End PBXNativeTarget section */ 350 | 351 | /* Begin PBXProject section */ 352 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 353 | isa = PBXProject; 354 | attributes = { 355 | LastUpgradeCheck = 0610; 356 | ORGANIZATIONNAME = Facebook; 357 | TargetAttributes = { 358 | 00E356ED1AD99517003FC87E = { 359 | CreatedOnToolsVersion = 6.2; 360 | TestTargetID = 13B07F861A680F5B00A75B9A; 361 | }; 362 | }; 363 | }; 364 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTwilioExample" */; 365 | compatibilityVersion = "Xcode 3.2"; 366 | developmentRegion = English; 367 | hasScannedForEncodings = 0; 368 | knownRegions = ( 369 | en, 370 | Base, 371 | ); 372 | mainGroup = 83CBB9F61A601CBA00E9B192; 373 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 374 | projectDirPath = ""; 375 | projectReferences = ( 376 | { 377 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 378 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 379 | }, 380 | { 381 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 382 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 383 | }, 384 | { 385 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 386 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 387 | }, 388 | { 389 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 390 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 391 | }, 392 | { 393 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 394 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 395 | }, 396 | { 397 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 398 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 399 | }, 400 | { 401 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 402 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 403 | }, 404 | { 405 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 406 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 407 | }, 408 | { 409 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 410 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 411 | }, 412 | { 413 | ProductGroup = 146834001AC3E56700842450 /* Products */; 414 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 415 | }, 416 | ); 417 | projectRoot = ""; 418 | targets = ( 419 | 13B07F861A680F5B00A75B9A /* RNTwilioExample */, 420 | 00E356ED1AD99517003FC87E /* RNTwilioExampleTests */, 421 | ); 422 | }; 423 | /* End PBXProject section */ 424 | 425 | /* Begin PBXReferenceProxy section */ 426 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 427 | isa = PBXReferenceProxy; 428 | fileType = archive.ar; 429 | path = libRCTActionSheet.a; 430 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 431 | sourceTree = BUILT_PRODUCTS_DIR; 432 | }; 433 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 434 | isa = PBXReferenceProxy; 435 | fileType = archive.ar; 436 | path = libRCTGeolocation.a; 437 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 438 | sourceTree = BUILT_PRODUCTS_DIR; 439 | }; 440 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 441 | isa = PBXReferenceProxy; 442 | fileType = archive.ar; 443 | path = libRCTImage.a; 444 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 445 | sourceTree = BUILT_PRODUCTS_DIR; 446 | }; 447 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 448 | isa = PBXReferenceProxy; 449 | fileType = archive.ar; 450 | path = libRCTNetwork.a; 451 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 452 | sourceTree = BUILT_PRODUCTS_DIR; 453 | }; 454 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 455 | isa = PBXReferenceProxy; 456 | fileType = archive.ar; 457 | path = libRCTVibration.a; 458 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 459 | sourceTree = BUILT_PRODUCTS_DIR; 460 | }; 461 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 462 | isa = PBXReferenceProxy; 463 | fileType = archive.ar; 464 | path = libRCTSettings.a; 465 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 466 | sourceTree = BUILT_PRODUCTS_DIR; 467 | }; 468 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 469 | isa = PBXReferenceProxy; 470 | fileType = archive.ar; 471 | path = libRCTWebSocket.a; 472 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 473 | sourceTree = BUILT_PRODUCTS_DIR; 474 | }; 475 | 146834041AC3E56700842450 /* libReact.a */ = { 476 | isa = PBXReferenceProxy; 477 | fileType = archive.ar; 478 | path = libReact.a; 479 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 480 | sourceTree = BUILT_PRODUCTS_DIR; 481 | }; 482 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 483 | isa = PBXReferenceProxy; 484 | fileType = archive.ar; 485 | path = libRCTLinking.a; 486 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 487 | sourceTree = BUILT_PRODUCTS_DIR; 488 | }; 489 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 490 | isa = PBXReferenceProxy; 491 | fileType = archive.ar; 492 | path = libRCTText.a; 493 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 494 | sourceTree = BUILT_PRODUCTS_DIR; 495 | }; 496 | /* End PBXReferenceProxy section */ 497 | 498 | /* Begin PBXResourcesBuildPhase section */ 499 | 00E356EC1AD99517003FC87E /* Resources */ = { 500 | isa = PBXResourcesBuildPhase; 501 | buildActionMask = 2147483647; 502 | files = ( 503 | ); 504 | runOnlyForDeploymentPostprocessing = 0; 505 | }; 506 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 507 | isa = PBXResourcesBuildPhase; 508 | buildActionMask = 2147483647; 509 | files = ( 510 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 511 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 512 | ); 513 | runOnlyForDeploymentPostprocessing = 0; 514 | }; 515 | /* End PBXResourcesBuildPhase section */ 516 | 517 | /* Begin PBXShellScriptBuildPhase section */ 518 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 519 | isa = PBXShellScriptBuildPhase; 520 | buildActionMask = 2147483647; 521 | files = ( 522 | ); 523 | inputPaths = ( 524 | ); 525 | name = "Bundle React Native code and images"; 526 | outputPaths = ( 527 | ); 528 | runOnlyForDeploymentPostprocessing = 0; 529 | shellPath = /bin/sh; 530 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; 531 | showEnvVarsInLog = 1; 532 | }; 533 | /* End PBXShellScriptBuildPhase section */ 534 | 535 | /* Begin PBXSourcesBuildPhase section */ 536 | 00E356EA1AD99517003FC87E /* Sources */ = { 537 | isa = PBXSourcesBuildPhase; 538 | buildActionMask = 2147483647; 539 | files = ( 540 | 00E356F31AD99517003FC87E /* RNTwilioExampleTests.m in Sources */, 541 | ); 542 | runOnlyForDeploymentPostprocessing = 0; 543 | }; 544 | 13B07F871A680F5B00A75B9A /* Sources */ = { 545 | isa = PBXSourcesBuildPhase; 546 | buildActionMask = 2147483647; 547 | files = ( 548 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 549 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 550 | ); 551 | runOnlyForDeploymentPostprocessing = 0; 552 | }; 553 | /* End PBXSourcesBuildPhase section */ 554 | 555 | /* Begin PBXTargetDependency section */ 556 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 557 | isa = PBXTargetDependency; 558 | target = 13B07F861A680F5B00A75B9A /* RNTwilioExample */; 559 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 560 | }; 561 | /* End PBXTargetDependency section */ 562 | 563 | /* Begin PBXVariantGroup section */ 564 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 565 | isa = PBXVariantGroup; 566 | children = ( 567 | 13B07FB21A68108700A75B9A /* Base */, 568 | ); 569 | name = LaunchScreen.xib; 570 | path = RNTwilioExample; 571 | sourceTree = ""; 572 | }; 573 | /* End PBXVariantGroup section */ 574 | 575 | /* Begin XCBuildConfiguration section */ 576 | 00E356F61AD99517003FC87E /* Debug */ = { 577 | isa = XCBuildConfiguration; 578 | buildSettings = { 579 | BUNDLE_LOADER = "$(TEST_HOST)"; 580 | GCC_PREPROCESSOR_DEFINITIONS = ( 581 | "DEBUG=1", 582 | "$(inherited)", 583 | ); 584 | INFOPLIST_FILE = RNTwilioExampleTests/Info.plist; 585 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 586 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 587 | PRODUCT_NAME = "$(TARGET_NAME)"; 588 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTwilioExample.app/RNTwilioExample"; 589 | }; 590 | name = Debug; 591 | }; 592 | 00E356F71AD99517003FC87E /* Release */ = { 593 | isa = XCBuildConfiguration; 594 | buildSettings = { 595 | BUNDLE_LOADER = "$(TEST_HOST)"; 596 | COPY_PHASE_STRIP = NO; 597 | INFOPLIST_FILE = RNTwilioExampleTests/Info.plist; 598 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 599 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 600 | PRODUCT_NAME = "$(TARGET_NAME)"; 601 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTwilioExample.app/RNTwilioExample"; 602 | }; 603 | name = Release; 604 | }; 605 | 13B07F941A680F5B00A75B9A /* Debug */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 609 | DEAD_CODE_STRIPPING = NO; 610 | HEADER_SEARCH_PATHS = ( 611 | "$(inherited)", 612 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 613 | "$(SRCROOT)/../node_modules/react-native/React/**", 614 | ); 615 | INFOPLIST_FILE = "RNTwilioExample/Info.plist"; 616 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 617 | OTHER_LDFLAGS = ( 618 | "$(inherited)", 619 | "-ObjC", 620 | "-lc++", 621 | ); 622 | PRODUCT_NAME = RNTwilioExample; 623 | }; 624 | name = Debug; 625 | }; 626 | 13B07F951A680F5B00A75B9A /* Release */ = { 627 | isa = XCBuildConfiguration; 628 | buildSettings = { 629 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 630 | HEADER_SEARCH_PATHS = ( 631 | "$(inherited)", 632 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 633 | "$(SRCROOT)/../node_modules/react-native/React/**", 634 | ); 635 | INFOPLIST_FILE = "RNTwilioExample/Info.plist"; 636 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 637 | OTHER_LDFLAGS = ( 638 | "$(inherited)", 639 | "-ObjC", 640 | "-lc++", 641 | ); 642 | PRODUCT_NAME = RNTwilioExample; 643 | }; 644 | name = Release; 645 | }; 646 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 647 | isa = XCBuildConfiguration; 648 | buildSettings = { 649 | ALWAYS_SEARCH_USER_PATHS = NO; 650 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 651 | CLANG_CXX_LIBRARY = "libc++"; 652 | CLANG_ENABLE_MODULES = YES; 653 | CLANG_ENABLE_OBJC_ARC = YES; 654 | CLANG_WARN_BOOL_CONVERSION = YES; 655 | CLANG_WARN_CONSTANT_CONVERSION = YES; 656 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 657 | CLANG_WARN_EMPTY_BODY = YES; 658 | CLANG_WARN_ENUM_CONVERSION = YES; 659 | CLANG_WARN_INT_CONVERSION = YES; 660 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 661 | CLANG_WARN_UNREACHABLE_CODE = YES; 662 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 663 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 664 | COPY_PHASE_STRIP = NO; 665 | ENABLE_STRICT_OBJC_MSGSEND = YES; 666 | GCC_C_LANGUAGE_STANDARD = gnu99; 667 | GCC_DYNAMIC_NO_PIC = NO; 668 | GCC_OPTIMIZATION_LEVEL = 0; 669 | GCC_PREPROCESSOR_DEFINITIONS = ( 670 | "DEBUG=1", 671 | "$(inherited)", 672 | ); 673 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 674 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 675 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 676 | GCC_WARN_UNDECLARED_SELECTOR = YES; 677 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 678 | GCC_WARN_UNUSED_FUNCTION = YES; 679 | GCC_WARN_UNUSED_VARIABLE = YES; 680 | HEADER_SEARCH_PATHS = ( 681 | "$(inherited)", 682 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 683 | "$(SRCROOT)/../node_modules/react-native/React/**", 684 | ); 685 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 686 | MTL_ENABLE_DEBUG_INFO = YES; 687 | ONLY_ACTIVE_ARCH = YES; 688 | SDKROOT = iphoneos; 689 | }; 690 | name = Debug; 691 | }; 692 | 83CBBA211A601CBA00E9B192 /* Release */ = { 693 | isa = XCBuildConfiguration; 694 | buildSettings = { 695 | ALWAYS_SEARCH_USER_PATHS = NO; 696 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 697 | CLANG_CXX_LIBRARY = "libc++"; 698 | CLANG_ENABLE_MODULES = YES; 699 | CLANG_ENABLE_OBJC_ARC = YES; 700 | CLANG_WARN_BOOL_CONVERSION = YES; 701 | CLANG_WARN_CONSTANT_CONVERSION = YES; 702 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 703 | CLANG_WARN_EMPTY_BODY = YES; 704 | CLANG_WARN_ENUM_CONVERSION = YES; 705 | CLANG_WARN_INT_CONVERSION = YES; 706 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 707 | CLANG_WARN_UNREACHABLE_CODE = YES; 708 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 709 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 710 | COPY_PHASE_STRIP = YES; 711 | ENABLE_NS_ASSERTIONS = NO; 712 | ENABLE_STRICT_OBJC_MSGSEND = YES; 713 | GCC_C_LANGUAGE_STANDARD = gnu99; 714 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 715 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 716 | GCC_WARN_UNDECLARED_SELECTOR = YES; 717 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 718 | GCC_WARN_UNUSED_FUNCTION = YES; 719 | GCC_WARN_UNUSED_VARIABLE = YES; 720 | HEADER_SEARCH_PATHS = ( 721 | "$(inherited)", 722 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 723 | "$(SRCROOT)/../node_modules/react-native/React/**", 724 | ); 725 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 726 | MTL_ENABLE_DEBUG_INFO = NO; 727 | SDKROOT = iphoneos; 728 | VALIDATE_PRODUCT = YES; 729 | }; 730 | name = Release; 731 | }; 732 | /* End XCBuildConfiguration section */ 733 | 734 | /* Begin XCConfigurationList section */ 735 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "RNTwilioExampleTests" */ = { 736 | isa = XCConfigurationList; 737 | buildConfigurations = ( 738 | 00E356F61AD99517003FC87E /* Debug */, 739 | 00E356F71AD99517003FC87E /* Release */, 740 | ); 741 | defaultConfigurationIsVisible = 0; 742 | defaultConfigurationName = Release; 743 | }; 744 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RNTwilioExample" */ = { 745 | isa = XCConfigurationList; 746 | buildConfigurations = ( 747 | 13B07F941A680F5B00A75B9A /* Debug */, 748 | 13B07F951A680F5B00A75B9A /* Release */, 749 | ); 750 | defaultConfigurationIsVisible = 0; 751 | defaultConfigurationName = Release; 752 | }; 753 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTwilioExample" */ = { 754 | isa = XCConfigurationList; 755 | buildConfigurations = ( 756 | 83CBBA201A601CBA00E9B192 /* Debug */, 757 | 83CBBA211A601CBA00E9B192 /* Release */, 758 | ); 759 | defaultConfigurationIsVisible = 0; 760 | defaultConfigurationName = Release; 761 | }; 762 | /* End XCConfigurationList section */ 763 | }; 764 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 765 | } 766 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample.xcodeproj/xcshareddata/xcschemes/RNTwilioExample.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 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample/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:@"RNTwilioExample" 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 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample/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 | } -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSTemporaryExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExample/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 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExampleTests/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 | -------------------------------------------------------------------------------- /RNTwilioExample/ios/RNTwilioExampleTests/RNTwilioExampleTests.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 RNTwilioExampleTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation RNTwilioExampleTests 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 | -------------------------------------------------------------------------------- /RNTwilioExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNTwilioExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start" 7 | }, 8 | "dependencies": { 9 | "qs": "^6.2.0", 10 | "react": "~15.2.1", 11 | "react-native": "~0.31.0", 12 | "react-native-config": "fabriziomoscon/react-native-config", 13 | "react-native-twilio": "fabriziomoscon/react-native-twilio#develop", 14 | "react-redux": "~4.4.5", 15 | "redux": "~3.5.2", 16 | "redux-logger": "~2.6.1", 17 | "redux-thunk": "~2.1.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /RNTwilioExample/src/actions.js: -------------------------------------------------------------------------------- 1 | export const INIT_TELEPHONY_START = 'INIT_TELEPHONY_START' 2 | export const DEVICE_READY = 'DEVICE_READY' 3 | export const DEVICE_CREATION_FAILURE = 'DEVICE_CREATION_FAILURE' 4 | export const CALL_START = 'CALL_START' 5 | export const ACCEPT_CALL = 'ACCEPT_CALL' 6 | export const IGNORE_CALL = 'IGNORE_CALL' 7 | export const REJECT_CALL = 'REJECT_CALL' 8 | export const END_CALL = 'END_CALL' 9 | export const CONNECTION_START = 'CONNECTION_START' 10 | export const CONNECTION_SUCCESS = 'CONNECTION_SUCCESS' 11 | export const CONNECTION_FAILURE = 'CONNECTION_FAILURE' 12 | export const CONNECTION_STOP = 'CONNECTION_STOP' 13 | export const DEVICE_LISTENING_START = 'DEVICE_LISTENING_START' 14 | export const DEVICE_LISTENING_STOP = 'DEVICE_LISTENING_STOP' 15 | export const DEVICE_RECEIVED_INCOMING = 'DEVICE_RECEIVED_INCOMING' 16 | 17 | export function connectionDidStartConnecting(params) { 18 | let To = '' 19 | if (params && params.To) { 20 | To = params.To 21 | } 22 | return { 23 | type: CONNECTION_START, 24 | To: To, 25 | } 26 | } 27 | 28 | export function connectionDidConnect(params) { 29 | return { 30 | type: CONNECTION_SUCCESS, 31 | params: params, 32 | } 33 | } 34 | 35 | export function connectionDidFail(params) { 36 | return { 37 | type: CONNECTION_FAILURE, 38 | err: params.err, 39 | } 40 | } 41 | 42 | export function connectionDidDisconnect(params) { 43 | return { 44 | type: CONNECTION_STOP, 45 | params: params, 46 | } 47 | } 48 | 49 | export function deviceDidStartListening(params) { 50 | return { 51 | type: DEVICE_LISTENING_START, 52 | params: params, 53 | } 54 | } 55 | 56 | export function deviceDidStopListening(params) { 57 | return { 58 | type: DEVICE_LISTENING_STOP, 59 | params: params, 60 | } 61 | } 62 | 63 | export function deviceDidReceiveIncoming(params) { 64 | return { 65 | type: DEVICE_RECEIVED_INCOMING, 66 | From: params.From, 67 | } 68 | } 69 | 70 | export function makeCallStart(number) { 71 | return { 72 | type: CALL_START, 73 | number: number, 74 | } 75 | } 76 | 77 | export function acceptCall() { 78 | return { 79 | type: ACCEPT_CALL, 80 | } 81 | } 82 | 83 | export function rejectCall() { 84 | return { 85 | type: REJECT_CALL, 86 | } 87 | } 88 | 89 | export function ignoreCall() { 90 | return { 91 | type: IGNORE_CALL, 92 | } 93 | } 94 | 95 | export function endCall() { 96 | return { 97 | type: END_CALL, 98 | } 99 | } 100 | 101 | export function initTelephonyStart(client) { 102 | return { 103 | type: INIT_TELEPHONY_START, 104 | client: client, 105 | } 106 | } 107 | 108 | export function deviceReady() { 109 | return { 110 | type: DEVICE_READY, 111 | } 112 | } 113 | 114 | export function telephonyInitFailure(err) { 115 | return { 116 | type: DEVICE_CREATION_FAILURE, 117 | err: err, 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /RNTwilioExample/src/app.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react' 2 | import { Provider } from 'react-redux' 3 | 4 | import AppContainer from './containers/AppContainer' 5 | 6 | import store from './store' 7 | 8 | export default class App extends Component { 9 | render() { 10 | return ( 11 | 12 | 13 | 14 | ) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /RNTwilioExample/src/components/InputPrompt.js: -------------------------------------------------------------------------------- 1 | import React, {PropTypes} from 'react' 2 | import { 3 | View, 4 | StyleSheet, 5 | Text, 6 | TextInput, 7 | } from 'react-native' 8 | 9 | class InputPrompt extends React.Component{ 10 | propTypes: { 11 | value: PropTypes.string, 12 | label: PropTypes.string.isRequired, 13 | placeholder: PropTypes.string.isRequired, 14 | autoCorrect: PropTypes.bool.isRequired, 15 | autoFocus: PropTypes.bool.isRequired, 16 | keyboardType: PropTypes.string.isRequired, 17 | onSubmit: PropTypes.func.isRequired, 18 | onChangeText: PropTypes.func, 19 | } 20 | constructor(props){ 21 | super(props) 22 | } 23 | render(){ 24 | return ( 25 | 26 | {this.props.label} 27 | 37 | 38 | ) 39 | } 40 | } 41 | 42 | const styles = StyleSheet.create({ 43 | input: { 44 | height: 40, 45 | borderColor: 'gray', 46 | borderWidth: 1, 47 | }, 48 | }) 49 | 50 | module.exports = InputPrompt 51 | -------------------------------------------------------------------------------- /RNTwilioExample/src/containers/AppContainer.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | import React, {PropTypes} from 'react' 4 | import { 5 | StyleSheet, 6 | Text, 7 | TouchableOpacity, 8 | View, 9 | } from 'react-native' 10 | import { connect } from 'react-redux' 11 | import {bindActionCreators} from 'redux' 12 | 13 | import { 14 | initTelephonyStart, 15 | makeCallStart, 16 | endCall, 17 | acceptCall, 18 | } from '../actions' 19 | 20 | import InputPrompt from '../components/InputPrompt' 21 | 22 | const AppContainer = React.createClass({ 23 | 24 | renderTelephonyStatus() { 25 | if (this.props.deviceError) { 26 | return Telephone error {this.props.deviceError} 27 | } 28 | if (this.props.deviceReady) { 29 | return 30 | Telephone READY 31 | Listening {this.props.listening} 32 | 33 | } 34 | if (this.props.clientName) { 35 | return 36 | Telephone NOT READY 37 | {this.props.telephonyActions.initTelephonyStart(this.props.clientName)}}> 40 | init device with token 41 | 42 | 43 | } 44 | }, 45 | 46 | // componentDidMount() { 47 | // this.props.telephonyActions.initTelephonyStart(this.props.clientName) 48 | // }, 49 | 50 | getInitialState() { 51 | return { 52 | callToNumber: this.props.callToNumber 53 | } 54 | }, 55 | 56 | renderInputNumber() { 57 | if (this.props.deviceReady === false || this.props.listening === false) { 58 | return null 59 | } 60 | 61 | // this.state.callToNumber = this.props.callToNumber 62 | this.state.callToNumber = '' 63 | 64 | let callNumber = () => { 65 | this.props.telephonyActions.makeCallStart(this.state.callToNumber) 66 | } 67 | let onSubmit = (event) => { 68 | this.state.callToNumber = event.nativeEvent.text 69 | callNumber() 70 | } 71 | return 72 | 81 | {callNumber()}}> 84 | DIAL 85 | 86 | 87 | }, 88 | 89 | hangup() { 90 | this.props.telephonyActions.endCall() 91 | }, 92 | 93 | answer() { 94 | this.props.telephonyActions.acceptCall() 95 | }, 96 | 97 | renderCallProgress() { 98 | if (this.props.deviceReady === false) { 99 | return null 100 | } 101 | 102 | if (this.props.callDirection === 'out') { 103 | return 104 | You are dialing {this.props.callToNumber} 105 | {this.hangup()}}> 108 | Hang Up 109 | 110 | 111 | } 112 | if (this.props.callDirection === 'in') { 113 | return 114 | {this.props.callFromNumber} is calling 115 | {this.answer()}}> 118 | Answer 119 | 120 | 121 | } 122 | }, 123 | 124 | renderCallingError() { 125 | if (this.props.callingError) { 126 | return calling errors: {this.props.callingError} 127 | } 128 | }, 129 | 130 | render() { 131 | 132 | return ( 133 | 134 | React Native Twilio Example 135 | {this.renderTelephonyStatus()} 136 | Your client name is: {this.props.clientName} 137 | {this.renderInputNumber()} 138 | {this.renderCallProgress()} 139 | {this.renderCallingError()} 140 | 141 | ) 142 | } 143 | 144 | }) 145 | 146 | 147 | AppContainer.propTypes = { 148 | telephonyActions: PropTypes.object.isRequired, 149 | clientName: PropTypes.string.isRequired, 150 | callToNumber: PropTypes.string, 151 | callFromNumber: PropTypes.string, 152 | callingError: PropTypes.string, 153 | callDirection: PropTypes.string, 154 | listening: PropTypes.bool.isRequired, 155 | } 156 | 157 | const styles = StyleSheet.create({ 158 | outerContainer: { 159 | flex: 1, 160 | padding: 10, 161 | }, 162 | container: { 163 | flex: 1, 164 | }, 165 | button: { 166 | height: 45, 167 | flexDirection: 'row', 168 | backgroundColor: 'white', 169 | borderColor: '#111', 170 | borderWidth: 1, 171 | borderRadius: 5, 172 | marginBottom: 5, 173 | marginTop: 5, 174 | alignSelf: 'stretch', 175 | justifyContent: 'center' 176 | }, 177 | buttonText: { 178 | fontSize: 18, 179 | color: '#111', 180 | alignSelf: 'center', 181 | }, 182 | }) 183 | 184 | function mapStateToProps(state) { 185 | const { 186 | telephonyState, 187 | callState, 188 | } = state 189 | const { 190 | deviceReady, 191 | clientName, 192 | } = telephonyState 193 | 194 | const { 195 | callToNumber, 196 | callFromNumber, 197 | callingError, 198 | callDirection, 199 | listening, 200 | } = callState 201 | return { 202 | deviceReady, 203 | clientName, 204 | callToNumber, 205 | callFromNumber, 206 | callingError, 207 | callDirection, 208 | listening, 209 | } 210 | } 211 | 212 | export default connect( 213 | mapStateToProps, 214 | dispatch => ({ 215 | telephonyActions: bindActionCreators({initTelephonyStart, makeCallStart, endCall, acceptCall}, dispatch), 216 | }) 217 | )(AppContainer) 218 | -------------------------------------------------------------------------------- /RNTwilioExample/src/reducers.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux' 2 | 3 | import telephonyService from './services/telephony' 4 | 5 | import { 6 | INIT_TELEPHONY_START, 7 | DEVICE_READY, 8 | DEVICE_CREATION_FAILURE, 9 | CALL_START, 10 | ACCEPT_CALL, 11 | IGNORE_CALL, 12 | REJECT_CALL, 13 | END_CALL, 14 | CONNECTION_START, 15 | CONNECTION_SUCCESS, 16 | CONNECTION_FAILURE, 17 | CONNECTION_STOP, 18 | DEVICE_LISTENING_START, 19 | DEVICE_LISTENING_STOP, 20 | DEVICE_RECEIVED_INCOMING, 21 | } from './actions' 22 | 23 | 24 | const telephonyInitialState = { 25 | deviceReady: false, 26 | deviceError: null, 27 | clientName: 'jenny', 28 | } 29 | 30 | const callInitialState = { 31 | callDirection: null, 32 | callingError: null, 33 | callFromNumber: null, 34 | callToNumber: null, 35 | listening: false, 36 | } 37 | 38 | function telephonyState(state = telephonyInitialState, action = {}) { 39 | switch (action.type) { 40 | case INIT_TELEPHONY_START: 41 | telephonyService.init(action.client) 42 | return Object.assign({}, state, { 43 | deviceError: null, 44 | }) 45 | 46 | case DEVICE_READY: 47 | telephonyService.initListeners() 48 | return Object.assign({}, state, { 49 | deviceReady: true, 50 | deviceError: null, 51 | }) 52 | 53 | case DEVICE_CREATION_FAILURE: 54 | return Object.assign({}, state, { 55 | deviceReady: false, 56 | deviceError: action.err, 57 | }) 58 | 59 | default: 60 | return state 61 | } 62 | } 63 | 64 | function callState(state = callInitialState, action = {}) { 65 | switch (action.type) { 66 | case CONNECTION_START: 67 | console.log('### CONNECTION_START', action) 68 | return Object.assign({}, state, { 69 | callFromNumber: action.From, 70 | callToNumber: action.To, 71 | }) 72 | 73 | case CONNECTION_SUCCESS: 74 | console.log('### CONNECTION_SUCCESS', action.params) 75 | return state 76 | 77 | case CONNECTION_FAILURE: 78 | return Object.assign({}, state, { 79 | callDirection: null, 80 | callFromNumber: null, 81 | callToNumber: null, 82 | callingError: action.err, 83 | }) 84 | 85 | case CONNECTION_STOP: 86 | console.log('### CONNECTION_STOP', action.params) 87 | return Object.assign({}, state, { 88 | callFromNumber: null, 89 | callToNumber: null, 90 | callingError: action.err, 91 | }) 92 | 93 | case CALL_START: 94 | telephonyService.makeCall(action.number) 95 | return Object.assign({}, state, { 96 | callDirection: 'out', 97 | callFromNumber: null, 98 | callToNumber: action.number, 99 | callingError: null, 100 | }) 101 | 102 | case DEVICE_LISTENING_START: 103 | return Object.assign({}, state, { 104 | listening: true, 105 | }) 106 | 107 | case DEVICE_RECEIVED_INCOMING: 108 | return Object.assign({}, state, { 109 | callDirection: 'in', 110 | callFromNumber: action.From, 111 | callToNumber: null, 112 | callingError: null, 113 | }) 114 | 115 | case DEVICE_LISTENING_STOP: 116 | return Object.assign({}, state, { 117 | listening: false, 118 | }) 119 | 120 | case ACCEPT_CALL: 121 | telephonyService.acceptCall() 122 | return Object.assign({}, state, { 123 | callingError: null, 124 | }) 125 | 126 | case REJECT_CALL: 127 | telephonyService.rejectCall() 128 | return Object.assign({}, state, { 129 | callDirection: null, 130 | callFromNumber: null, 131 | callToNumber: null, 132 | callingError: null, 133 | }) 134 | 135 | case IGNORE_CALL: 136 | telephonyService.ignoreCall() 137 | return Object.assign({}, state, { 138 | callDirection: null, 139 | callFromNumber: null, 140 | callToNumber: null, 141 | callingError: null, 142 | }) 143 | 144 | case END_CALL: 145 | telephonyService.endCall() 146 | return Object.assign({}, state, { 147 | callDirection: null, 148 | callFromNumber: null, 149 | callToNumber: null, 150 | callingError: null, 151 | }) 152 | 153 | default: 154 | return state 155 | } 156 | } 157 | 158 | const appReducers = combineReducers({ 159 | callState, 160 | telephonyState, 161 | }) 162 | 163 | export default appReducers 164 | -------------------------------------------------------------------------------- /RNTwilioExample/src/services/endpoints.js: -------------------------------------------------------------------------------- 1 | import Config from 'react-native-config' 2 | 3 | // const Config = { 4 | // API_URL: 'http://localhost:8000/', 5 | // } 6 | 7 | export default { 8 | calls: { 9 | make: Config.API_URL + 'calls/', 10 | token: Config.API_URL + 'token/', 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /RNTwilioExample/src/services/telephony.js: -------------------------------------------------------------------------------- 1 | import qs from 'qs' 2 | 3 | import Twilio from 'react-native-twilio' 4 | 5 | import endpoints from './endpoints' 6 | 7 | import store from '../store' 8 | 9 | import { 10 | deviceDidStartListening, 11 | deviceDidStopListening, 12 | deviceDidReceiveIncoming, 13 | connectionDidStartConnecting, 14 | connectionDidConnect, 15 | connectionDidDisconnect, 16 | connectionDidFail, 17 | } from '../actions' 18 | 19 | import { 20 | deviceReady, 21 | deviceCreationFail, 22 | } from '../actions' 23 | 24 | function _deviceDidStartListening(params) { 25 | store.dispatch(deviceDidStartListening(params)) 26 | } 27 | 28 | function _deviceDidStopListening(params) { 29 | store.dispatch(deviceDidStopListening(params)) 30 | } 31 | 32 | function _deviceDidReceiveIncoming(params) { 33 | store.dispatch(deviceDidReceiveIncoming(params)) 34 | } 35 | 36 | function _connectionDidStartConnecting(params) { 37 | store.dispatch(connectionDidStartConnecting(params)) 38 | } 39 | 40 | function _connectionDidConnect(params) { 41 | store.dispatch(connectionDidConnect(params)) 42 | } 43 | 44 | function _connectionDidDisconnect(params) { 45 | store.dispatch(connectionDidDisconnect(params)) 46 | } 47 | 48 | function _connectionDidFail(params) { 49 | store.dispatch(connectionDidFail(params)) 50 | } 51 | 52 | function _deviceReady(params) { 53 | store.dispatch(deviceReady(params)) 54 | } 55 | 56 | function _deviceUpdated(params) { 57 | console.log('deviceUpdated params', params) 58 | } 59 | 60 | function _deviceCreationFail(params) { 61 | store.dispatch(deviceCreationFail(params)) 62 | } 63 | 64 | let telephonyService = { 65 | init(client) { 66 | this.initDeviceListeners() 67 | 68 | let urlEncodedQuery = qs.stringify({client: client}) 69 | let url = `${endpoints.calls.token}?${urlEncodedQuery}` 70 | console.log('token url', url) 71 | // Could use the Native fetcher as well 72 | // Twilio.initWithTokenUrl(url) 73 | 74 | return fetch(url) 75 | .then(res => res.text()) 76 | .then(token => { 77 | console.log('token =>', token) 78 | Twilio.initWithToken(token) 79 | return true 80 | }) 81 | }, 82 | makeCall(number) { 83 | console.log('telephonyService::makeCall()', number) 84 | Twilio.connect({ 85 | To: number 86 | }) 87 | return 88 | }, 89 | acceptCall() { 90 | console.log('telephonyService::acceptCall()') 91 | Twilio.accept() 92 | return 93 | }, 94 | rejectCall() { 95 | console.log('telephonyService::rejectCall()') 96 | Twilio.reject() 97 | return 98 | }, 99 | ignoreCall() { 100 | console.log('telephonyService::ignoreCall()') 101 | Twilio.ignore() 102 | return 103 | }, 104 | endCall() { 105 | console.log('telephonyService::endCall()') 106 | Twilio.disconnect() 107 | return 108 | }, 109 | initDeviceListeners() { 110 | Twilio.addEventListener('deviceReady', _deviceReady) 111 | Twilio.addEventListener('deviceCreationFail', _deviceCreationFail) 112 | Twilio.addEventListener('deviceUpdated', _deviceUpdated) 113 | }, 114 | initListeners() { 115 | Twilio.addEventListener('deviceDidStartListening', _deviceDidStartListening) 116 | Twilio.addEventListener('deviceDidStopListening', _deviceDidStopListening) 117 | Twilio.addEventListener('deviceDidReceiveIncoming', _deviceDidReceiveIncoming) 118 | 119 | Twilio.addEventListener('connectionDidStartConnecting', _connectionDidStartConnecting) 120 | Twilio.addEventListener('connectionDidConnect', _connectionDidConnect) 121 | Twilio.addEventListener('connectionDidDisconnect', _connectionDidDisconnect) 122 | Twilio.addEventListener('connectionDidFail', _connectionDidFail) 123 | 124 | } 125 | } 126 | 127 | export default telephonyService 128 | -------------------------------------------------------------------------------- /RNTwilioExample/src/store.js: -------------------------------------------------------------------------------- 1 | import reducers from './reducers' 2 | import { createStore, applyMiddleware } from 'redux' 3 | import thunk from 'redux-thunk' 4 | import createLogger from 'redux-logger' 5 | 6 | const store = createStore( 7 | reducers, 8 | applyMiddleware(thunk, createLogger()) 9 | ) 10 | 11 | 12 | export default store 13 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:2.1.0' 7 | } 8 | } 9 | apply plugin: 'com.android.library' 10 | 11 | repositories { 12 | maven { url "$rootDir/../node_modules/react-native/android" } 13 | jcenter() 14 | } 15 | 16 | android { 17 | compileSdkVersion 23 18 | buildToolsVersion "23.0.2" 19 | 20 | defaultConfig { 21 | minSdkVersion 16 22 | targetSdkVersion 22 23 | versionCode 1 24 | versionName "1.0" 25 | } 26 | 27 | buildTypes { 28 | release { 29 | minifyEnabled false 30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 31 | } 32 | } 33 | } 34 | 35 | dependencies { 36 | compile 'com.facebook.react:react-native:+' // from node_modules 37 | compile 'com.twilio:client-android:1.2.16' 38 | } 39 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /android/src/main/java/com/rogchap/react/modules/twilio/TwilioModule.java: -------------------------------------------------------------------------------- 1 | package com.rogchap.react.modules.twilio; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | import android.util.Log; 6 | import android.app.PendingIntent; 7 | import android.content.Intent; 8 | 9 | import android.content.Context; 10 | import android.content.IntentFilter; 11 | import android.content.BroadcastReceiver; 12 | 13 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 14 | import com.facebook.react.bridge.ReactApplicationContext; 15 | import com.facebook.react.bridge.ReadableMap; 16 | import com.facebook.react.bridge.ReadableType; 17 | import com.facebook.react.bridge.ReadableMapKeySetIterator; 18 | import com.facebook.react.bridge.ReactMethod; 19 | import com.facebook.react.bridge.Arguments; 20 | import com.facebook.react.bridge.WritableMap; 21 | import com.facebook.react.modules.core.DeviceEventManagerModule; 22 | 23 | import com.twilio.client.Connection; 24 | import com.twilio.client.ConnectionListener; 25 | import com.twilio.client.Device; 26 | import com.twilio.client.DeviceListener; 27 | import com.twilio.client.PresenceEvent; 28 | import com.twilio.client.Twilio; 29 | 30 | import java.net.URL; 31 | import java.net.URLConnection; 32 | import java.io.InputStream; 33 | import java.io.InputStreamReader; 34 | import java.io.BufferedReader; 35 | import java.util.HashMap; 36 | import java.util.Map; 37 | 38 | 39 | public class TwilioModule extends ReactContextBaseJavaModule implements ConnectionListener, DeviceListener { 40 | 41 | private static final String TAG = TwilioModule.class.getName(); 42 | 43 | private Device _phone; 44 | private Connection _connection; 45 | private Connection _pendingConnection; 46 | private IntentReceiver _receiver; 47 | 48 | public class IntentReceiver extends BroadcastReceiver { 49 | private ConnectionListener _cl; 50 | 51 | public IntentReceiver(ConnectionListener connectionListener) { 52 | this._cl = connectionListener; 53 | } 54 | 55 | public void onReceive(Context context, Intent intent) { 56 | Log.d(TAG, "onReceive"); 57 | Device device = intent.getParcelableExtra(Device.EXTRA_DEVICE); 58 | Connection incomingConnection = intent.getParcelableExtra(Device.EXTRA_CONNECTION); 59 | 60 | if (incomingConnection == null && device == null) { 61 | return; 62 | } 63 | intent.removeExtra(Device.EXTRA_DEVICE); 64 | intent.removeExtra(Device.EXTRA_CONNECTION); 65 | 66 | _pendingConnection = incomingConnection; 67 | 68 | Map connParams = _pendingConnection.getParameters(); 69 | WritableMap params = Arguments.createMap(); 70 | if (connParams != null) { 71 | for (Map.Entry entry : connParams.entrySet()) { 72 | params.putString(entry.getKey(), entry.getValue()); 73 | } 74 | } 75 | sendEvent("deviceDidReceiveIncoming", params); 76 | } 77 | } 78 | 79 | public TwilioModule(ReactApplicationContext reactContext) { 80 | super(reactContext); 81 | 82 | this._receiver = new IntentReceiver(this); 83 | IntentFilter intentFilter = new IntentFilter(); 84 | intentFilter.addAction("com.rogchap.react.modules.twilio.incoming"); 85 | getReactApplicationContext().registerReceiver(this._receiver, intentFilter); 86 | } 87 | 88 | private void sendEvent(String eventName, @Nullable WritableMap params) { 89 | Log.d(TAG, ">>> sendEvent: start sending event (" + eventName + ")"); 90 | if (params != null) { 91 | Log.d(TAG, ">>> sendEvent: params: " + params.toString() + ")"); 92 | } 93 | DeviceEventManagerModule.RCTDeviceEventEmitter deviceEE = getReactApplicationContext() 94 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class); 95 | Log.d(TAG, ">>> sendEvent: after creating device event emitter (" + eventName + ")"); 96 | deviceEE.emit(eventName, params); 97 | Log.d(TAG, ">>> sendEvent: after emitting event (" + eventName + ")"); 98 | } 99 | 100 | @Override 101 | public String getName() { 102 | return "Twilio"; 103 | } 104 | 105 | @ReactMethod 106 | public void initWithToken(final String token) { 107 | final DeviceListener dl = this; 108 | Twilio.setLogLevel(Log.DEBUG); 109 | if (!Twilio.isInitialized()) { 110 | Twilio.initialize(getReactApplicationContext(), new Twilio.InitListener() { 111 | @Override 112 | public void onInitialized() { 113 | try { 114 | if (_phone == null) { 115 | createDeviceWithToken(token, dl); 116 | } else { 117 | _phone.updateCapabilityToken(token); 118 | sendEvent("deviceUpdated", null); 119 | } 120 | } catch (Exception e) { 121 | Log.e(TAG, e.getMessage()); 122 | } 123 | } 124 | 125 | @Override 126 | public void onError(Exception e) { 127 | Log.e(TAG, e.getMessage()); 128 | } 129 | }); 130 | } else { 131 | Log.d(TAG, "device was already initialized"); 132 | try { 133 | if (_phone != null) { 134 | _phone.release(); 135 | } 136 | createDeviceWithToken(token, dl); 137 | } catch (Exception e) { 138 | Log.e(TAG, e.getMessage()); 139 | } 140 | } 141 | } 142 | 143 | private void createDeviceWithToken(String token, DeviceListener dl) { 144 | _phone = Twilio.createDevice(token, dl); 145 | /* 146 | * Providing a PendingIntent to the newly create Device, allowing you to receive incoming calls 147 | * 148 | * What you do when you receive the intent depends on the component you set in the Intent. 149 | * 150 | * If you're using an Activity, you'll want to override Activity.onNewIntent() 151 | * If you're using a Service, you'll want to override Service.onStartCommand(). 152 | * If you're using a BroadcastReceiver, override BroadcastReceiver.onReceive(). 153 | */ 154 | Intent intent = new Intent(); 155 | intent.setAction("com.rogchap.react.modules.twilio.incoming"); 156 | PendingIntent pi = PendingIntent.getBroadcast(getReactApplicationContext(), 0, intent, 0); 157 | _phone.setIncomingIntent(pi); 158 | sendEvent("deviceReady", null); 159 | } 160 | 161 | @ReactMethod 162 | public void initWithTokenUrl(String tokenUrl) { 163 | StringBuilder sb = new StringBuilder(); 164 | try { 165 | URLConnection conn = new URL(tokenUrl).openConnection(); 166 | InputStream in = conn.getInputStream(); 167 | BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); 168 | String line = reader.readLine(); 169 | while (line != null) { 170 | sb.append(line); 171 | } 172 | // String line = ""; 173 | // while ((line = reader.readLine()) != null) { 174 | // sb.append(line); 175 | // } 176 | } catch (Exception e) { 177 | Log.e(TAG, e.getMessage()); 178 | } 179 | initWithToken(sb.toString()); 180 | } 181 | 182 | @ReactMethod 183 | public void connect(ReadableMap readableMap) { 184 | if (_phone != null) { 185 | _connection = _phone.connect(convertToNativeMap(readableMap), this); 186 | } else { 187 | Log.e(TAG, "Device is null"); 188 | WritableMap errors = Arguments.createMap(); 189 | errors.putString("err", "Device is null"); 190 | sendEvent("connectionDidFail", errors); 191 | } 192 | } 193 | 194 | private Map convertToNativeMap(ReadableMap readableMap) { 195 | Map hashMap = new HashMap(); 196 | ReadableMapKeySetIterator iterator = readableMap.keySetIterator(); 197 | while (iterator.hasNextKey()) { 198 | String key = iterator.nextKey(); 199 | ReadableType readableType = readableMap.getType(key); 200 | switch (readableType) { 201 | case String: 202 | hashMap.put(key, readableMap.getString(key)); 203 | break; 204 | default: 205 | throw new IllegalArgumentException("Could not convert object with key: " + key + "."); 206 | } 207 | } 208 | return hashMap; 209 | } 210 | 211 | @ReactMethod 212 | public void disconnect() { 213 | if (_connection != null) { 214 | _connection.disconnect(); 215 | _connection = null; 216 | } 217 | } 218 | 219 | @ReactMethod 220 | public void accept() { 221 | _pendingConnection.accept(); 222 | _pendingConnection.setConnectionListener(_receiver._cl); 223 | _connection = _pendingConnection; 224 | _pendingConnection = null; 225 | } 226 | 227 | @ReactMethod 228 | public void ignore() { 229 | _pendingConnection.ignore(); 230 | } 231 | 232 | @ReactMethod 233 | public void reject() { 234 | _pendingConnection.reject(); 235 | } 236 | 237 | @ReactMethod 238 | public void setMuted(Boolean isMuted) { 239 | if (_connection != null && _connection.getState() == Connection.State.CONNECTED) { 240 | _connection.setMuted(isMuted); 241 | } 242 | } 243 | 244 | @ReactMethod 245 | public void sendDigits(String digits) { 246 | if (_connection != null && _connection.getState() == Connection.State.CONNECTED) { 247 | _connection.sendDigits(digits); 248 | } 249 | } 250 | 251 | /* Device Listener */ 252 | @Override 253 | public void onStartListening(Device device) { 254 | // this happens every 80 seconds 255 | Log.d(TAG, "Device has started listening for incoming connections"); 256 | // this event crashes the app when sent after the first time. 257 | // commenting out it for now. 258 | // sendEvent("deviceDidStartListening", null); 259 | } 260 | 261 | /* Device Listener */ 262 | @Override 263 | public void onStopListening(Device device) { 264 | Log.d(TAG, "Device has stopped listening for incoming connections"); 265 | sendEvent("deviceDidStopListening", null); 266 | } 267 | 268 | /* Device Listener */ 269 | @Override 270 | public void onStopListening(Device device, int errorCode, String error) { 271 | Log.e(TAG, String.format("Device has encountered an error and has stopped" + 272 | " listening for incoming connections: %s", error)); 273 | WritableMap errors = Arguments.createMap(); 274 | if (error != null) { 275 | errors.putString("err", error); 276 | } 277 | sendEvent("deviceDidStopListening", errors); 278 | } 279 | 280 | /* Device Listener */ 281 | @Override 282 | public boolean receivePresenceEvents(Device device) { 283 | return false; 284 | } 285 | 286 | /* Device Listener */ 287 | @Override 288 | public void onPresenceChanged(Device device, PresenceEvent presenceEvent) { 289 | 290 | } 291 | 292 | /* ConnectionListener */ 293 | 294 | @Override 295 | public void onConnecting(Connection connection) { 296 | Log.d(TAG, "onConnecting"); 297 | WritableMap params = Arguments.createMap(); 298 | if (connection.getParameters().containsKey("To")) { 299 | params.putString("To", connection.getParameters().get("To")); 300 | } 301 | sendEvent("connectionDidStartConnecting", params); 302 | } 303 | 304 | @Override 305 | public void onConnected(Connection connection) { 306 | Log.d(TAG, "onConnected: connection"); 307 | WritableMap params = Arguments.createMap(); 308 | if (connection.getParameters().containsKey("To")) { 309 | params.putString("To", connection.getParameters().get("To")); 310 | } 311 | sendEvent("connectionDidConnect", params); 312 | } 313 | 314 | @Override 315 | public void onDisconnected(Connection connection) { 316 | Log.d(TAG, "onDisconnected: connection " + connection.toString()); 317 | if (connection == _connection) { 318 | _connection = null; 319 | } 320 | Log.d(TAG, "onDisconnected: after _connection = null " + connection.toString()); 321 | if (connection == _pendingConnection) { 322 | _pendingConnection = null; 323 | } 324 | Log.d(TAG, "onDisconnected: after _pendingConnection = null " + connection.toString()); 325 | WritableMap params = Arguments.createMap(); 326 | if (connection.getParameters().containsKey("To")) { 327 | Log.d(TAG, "onDisconnected: containsKey To " + connection.toString()); 328 | params.putString("To", connection.getParameters().get("To")); 329 | } 330 | sendEvent("connectionDidDisconnect", params); 331 | } 332 | 333 | @Override 334 | public void onDisconnected(Connection connection, int errorCode, String errorMessage) { 335 | Log.d(TAG, "onDisconnected with error" + errorMessage ); 336 | WritableMap errors = Arguments.createMap(); 337 | Log.d(TAG, "onDisconnected with error: after error definition" + errorMessage ); 338 | errors.putString("err", errorMessage); 339 | sendEvent("connectionDidDisconnect", errors); 340 | } 341 | 342 | } 343 | -------------------------------------------------------------------------------- /android/src/main/java/com/rogchap/react/modules/twilio/TwilioPackage.java: -------------------------------------------------------------------------------- 1 | package com.rogchap.react.modules.twilio; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.ReactApplicationContext; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.JavaScriptModule; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.Arrays; 10 | import java.util.List; 11 | import java.util.Collections; 12 | 13 | public class TwilioPackage implements ReactPackage { 14 | 15 | @Override 16 | public List createNativeModules(ReactApplicationContext reactContext) { 17 | return Arrays.asList( 18 | new TwilioModule(reactContext) 19 | ); 20 | } 21 | 22 | @Override 23 | public List> createJSModules() { 24 | return Collections.emptyList(); 25 | } 26 | 27 | @Override 28 | public List createViewManagers(ReactApplicationContext reactContext) { 29 | return Arrays.asList(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { 2 | NativeModules, 3 | NativeAppEventEmitter, 4 | } from 'react-native'; 5 | 6 | const TwilioRCT = NativeModules.Twilio; 7 | 8 | let _eventHandlers = { 9 | deviceDidStartListening: new Map(), 10 | deviceDidStopListening: new Map(), 11 | deviceDidReceiveIncoming: new Map(), 12 | connectionDidFail: new Map(), 13 | connectionDidStartConnecting: new Map(), 14 | connectionDidConnect: new Map(), 15 | connectionDidDisconnect: new Map(), 16 | deviceReady: new Map(), 17 | deviceCreationFail: new Map(), 18 | deviceUpdated: new Map(), 19 | }; 20 | 21 | let Twilio = { 22 | initWithTokenUrl(tokenUrl) { 23 | TwilioRCT.initWithTokenUrl(tokenUrl); 24 | }, 25 | initWithToken(token) { 26 | TwilioRCT.initWithToken(token); 27 | }, 28 | connect(params = {}) { 29 | TwilioRCT.connect(params); 30 | }, 31 | disconnect() { 32 | TwilioRCT.disconnect(); 33 | }, 34 | accept() { 35 | TwilioRCT.accept(); 36 | }, 37 | reject() { 38 | TwilioRCT.reject(); 39 | }, 40 | ignore() { 41 | TwilioRCT.ignore(); 42 | }, 43 | setMuted(isMuted) { 44 | TwilioRCT.setMuted(isMuted); 45 | }, 46 | sendDigits(digits) { 47 | TwilioRCT.sendDigits(digits); 48 | }, 49 | addEventListener(type, handler) { 50 | _eventHandlers[type].set(handler, NativeAppEventEmitter.addListener( 51 | type, rtn => { 52 | handler(rtn); 53 | } 54 | )); 55 | }, 56 | removeEventListener(type, handler) { 57 | if (!_eventHandlers[type].has(handler)) { 58 | return; 59 | } 60 | _eventHandlers[type].get(handler).remove(); 61 | _eventHandlers[type].delete(handler); 62 | }, 63 | }; 64 | 65 | module.exports = Twilio; 66 | -------------------------------------------------------------------------------- /ios/RCTTwilio.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DB0862171BF2D3AF00A97135 /* RCTTwilio.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862161BF2D3AF00A97135 /* RCTTwilio.h */; }; 11 | DB0862191BF2D3AF00A97135 /* RCTTwilio.m in Sources */ = {isa = PBXBuildFile; fileRef = DB0862181BF2D3AF00A97135 /* RCTTwilio.m */; }; 12 | DB0862AD1BF4220600A97135 /* libTwilioClient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB0862981BF4216D00A97135 /* libTwilioClient.a */; }; 13 | DB0862AE1BF4220A00A97135 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB0862971BF4216D00A97135 /* libssl.a */; }; 14 | DB0862AF1BF4220D00A97135 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB0862961BF4216D00A97135 /* libcrypto.a */; }; 15 | DB0862D71BF42D8A00A97135 /* disconnect.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB08629B1BF4216D00A97135 /* disconnect.wav */; }; 16 | DB0862D81BF42D8A00A97135 /* dtmf_0.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB08629C1BF4216D00A97135 /* dtmf_0.wav */; }; 17 | DB0862D91BF42D8A00A97135 /* dtmf_1.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB08629D1BF4216D00A97135 /* dtmf_1.wav */; }; 18 | DB0862DA1BF42D8B00A97135 /* dtmf_2.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB08629E1BF4216D00A97135 /* dtmf_2.wav */; }; 19 | DB0862DB1BF42D8B00A97135 /* dtmf_3.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB08629F1BF4216D00A97135 /* dtmf_3.wav */; }; 20 | DB0862DC1BF42D8B00A97135 /* dtmf_4.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A01BF4216D00A97135 /* dtmf_4.wav */; }; 21 | DB0862DD1BF42D8B00A97135 /* dtmf_5.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A11BF4216D00A97135 /* dtmf_5.wav */; }; 22 | DB0862DE1BF42D8B00A97135 /* dtmf_6.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A21BF4216D00A97135 /* dtmf_6.wav */; }; 23 | DB0862DF1BF42D8B00A97135 /* dtmf_7.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A31BF4216D00A97135 /* dtmf_7.wav */; }; 24 | DB0862E01BF42D8B00A97135 /* dtmf_8.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A41BF4216D00A97135 /* dtmf_8.wav */; }; 25 | DB0862E11BF42D8B00A97135 /* dtmf_9.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A51BF4216D00A97135 /* dtmf_9.wav */; }; 26 | DB0862E21BF42D8B00A97135 /* dtmf_hash.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A61BF4216D00A97135 /* dtmf_hash.wav */; }; 27 | DB0862E31BF42D8B00A97135 /* dtmf_star.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A71BF4216D00A97135 /* dtmf_star.wav */; }; 28 | DB0862E41BF42D8B00A97135 /* incoming.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A81BF4216D00A97135 /* incoming.wav */; }; 29 | DB0862E51BF42D8B00A97135 /* outgoing.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0862A91BF4216D00A97135 /* outgoing.wav */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXCopyFilesBuildPhase section */ 33 | DB0862111BF2D3AF00A97135 /* CopyFiles */ = { 34 | isa = PBXCopyFilesBuildPhase; 35 | buildActionMask = 2147483647; 36 | dstPath = "include/$(PRODUCT_NAME)"; 37 | dstSubfolderSpec = 16; 38 | files = ( 39 | DB0862171BF2D3AF00A97135 /* RCTTwilio.h in CopyFiles */, 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | DB0862D61BF42D7D00A97135 /* CopyFiles */ = { 44 | isa = PBXCopyFilesBuildPhase; 45 | buildActionMask = 2147483647; 46 | dstPath = ""; 47 | dstSubfolderSpec = 7; 48 | files = ( 49 | DB0862D71BF42D8A00A97135 /* disconnect.wav in CopyFiles */, 50 | DB0862D81BF42D8A00A97135 /* dtmf_0.wav in CopyFiles */, 51 | DB0862D91BF42D8A00A97135 /* dtmf_1.wav in CopyFiles */, 52 | DB0862DA1BF42D8B00A97135 /* dtmf_2.wav in CopyFiles */, 53 | DB0862DB1BF42D8B00A97135 /* dtmf_3.wav in CopyFiles */, 54 | DB0862DC1BF42D8B00A97135 /* dtmf_4.wav in CopyFiles */, 55 | DB0862DD1BF42D8B00A97135 /* dtmf_5.wav in CopyFiles */, 56 | DB0862DE1BF42D8B00A97135 /* dtmf_6.wav in CopyFiles */, 57 | DB0862DF1BF42D8B00A97135 /* dtmf_7.wav in CopyFiles */, 58 | DB0862E01BF42D8B00A97135 /* dtmf_8.wav in CopyFiles */, 59 | DB0862E11BF42D8B00A97135 /* dtmf_9.wav in CopyFiles */, 60 | DB0862E21BF42D8B00A97135 /* dtmf_hash.wav in CopyFiles */, 61 | DB0862E31BF42D8B00A97135 /* dtmf_star.wav in CopyFiles */, 62 | DB0862E41BF42D8B00A97135 /* incoming.wav in CopyFiles */, 63 | DB0862E51BF42D8B00A97135 /* outgoing.wav in CopyFiles */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXCopyFilesBuildPhase section */ 68 | 69 | /* Begin PBXFileReference section */ 70 | DB0862131BF2D3AF00A97135 /* libRCTTwilio.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTTwilio.a; sourceTree = BUILT_PRODUCTS_DIR; }; 71 | DB0862161BF2D3AF00A97135 /* RCTTwilio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTTwilio.h; sourceTree = ""; }; 72 | DB0862181BF2D3AF00A97135 /* RCTTwilio.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTTwilio.m; sourceTree = ""; }; 73 | DB08628F1BF4216D00A97135 /* TCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCConnection.h; sourceTree = ""; }; 74 | DB0862901BF4216D00A97135 /* TCConnectionDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCConnectionDelegate.h; sourceTree = ""; }; 75 | DB0862911BF4216D00A97135 /* TCDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCDevice.h; sourceTree = ""; }; 76 | DB0862921BF4216D00A97135 /* TCDeviceDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCDeviceDelegate.h; sourceTree = ""; }; 77 | DB0862931BF4216D00A97135 /* TCPresenceEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPresenceEvent.h; sourceTree = ""; }; 78 | DB0862941BF4216D00A97135 /* TwilioClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwilioClient.h; sourceTree = ""; }; 79 | DB0862961BF4216D00A97135 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcrypto.a; sourceTree = ""; }; 80 | DB0862971BF4216D00A97135 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libssl.a; sourceTree = ""; }; 81 | DB0862981BF4216D00A97135 /* libTwilioClient.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libTwilioClient.a; sourceTree = ""; }; 82 | DB0862991BF4216D00A97135 /* readme.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = readme.html; sourceTree = ""; }; 83 | DB08629B1BF4216D00A97135 /* disconnect.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = disconnect.wav; sourceTree = ""; }; 84 | DB08629C1BF4216D00A97135 /* dtmf_0.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_0.wav; sourceTree = ""; }; 85 | DB08629D1BF4216D00A97135 /* dtmf_1.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_1.wav; sourceTree = ""; }; 86 | DB08629E1BF4216D00A97135 /* dtmf_2.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_2.wav; sourceTree = ""; }; 87 | DB08629F1BF4216D00A97135 /* dtmf_3.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_3.wav; sourceTree = ""; }; 88 | DB0862A01BF4216D00A97135 /* dtmf_4.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_4.wav; sourceTree = ""; }; 89 | DB0862A11BF4216D00A97135 /* dtmf_5.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_5.wav; sourceTree = ""; }; 90 | DB0862A21BF4216D00A97135 /* dtmf_6.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_6.wav; sourceTree = ""; }; 91 | DB0862A31BF4216D00A97135 /* dtmf_7.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_7.wav; sourceTree = ""; }; 92 | DB0862A41BF4216D00A97135 /* dtmf_8.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_8.wav; sourceTree = ""; }; 93 | DB0862A51BF4216D00A97135 /* dtmf_9.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_9.wav; sourceTree = ""; }; 94 | DB0862A61BF4216D00A97135 /* dtmf_hash.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_hash.wav; sourceTree = ""; }; 95 | DB0862A71BF4216D00A97135 /* dtmf_star.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dtmf_star.wav; sourceTree = ""; }; 96 | DB0862A81BF4216D00A97135 /* incoming.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = incoming.wav; sourceTree = ""; }; 97 | DB0862A91BF4216D00A97135 /* outgoing.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = outgoing.wav; sourceTree = ""; }; 98 | /* End PBXFileReference section */ 99 | 100 | /* Begin PBXFrameworksBuildPhase section */ 101 | DB0862AC1BF421FF00A97135 /* Frameworks */ = { 102 | isa = PBXFrameworksBuildPhase; 103 | buildActionMask = 2147483647; 104 | files = ( 105 | DB0862AD1BF4220600A97135 /* libTwilioClient.a in Frameworks */, 106 | DB0862AE1BF4220A00A97135 /* libssl.a in Frameworks */, 107 | DB0862AF1BF4220D00A97135 /* libcrypto.a in Frameworks */, 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | /* End PBXFrameworksBuildPhase section */ 112 | 113 | /* Begin PBXGroup section */ 114 | DB08620A1BF2D3AF00A97135 = { 115 | isa = PBXGroup; 116 | children = ( 117 | DB08628D1BF4216D00A97135 /* TwilioSDK */, 118 | DB0862151BF2D3AF00A97135 /* RCTTwilio */, 119 | DB0862141BF2D3AF00A97135 /* Products */, 120 | ); 121 | sourceTree = ""; 122 | }; 123 | DB0862141BF2D3AF00A97135 /* Products */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | DB0862131BF2D3AF00A97135 /* libRCTTwilio.a */, 127 | ); 128 | name = Products; 129 | sourceTree = ""; 130 | }; 131 | DB0862151BF2D3AF00A97135 /* RCTTwilio */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | DB0862161BF2D3AF00A97135 /* RCTTwilio.h */, 135 | DB0862181BF2D3AF00A97135 /* RCTTwilio.m */, 136 | ); 137 | path = RCTTwilio; 138 | sourceTree = ""; 139 | }; 140 | DB08628D1BF4216D00A97135 /* TwilioSDK */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | DB08628E1BF4216D00A97135 /* Headers */, 144 | DB0862951BF4216D00A97135 /* Libraries */, 145 | DB0862991BF4216D00A97135 /* readme.html */, 146 | DB08629A1BF4216D00A97135 /* Resources */, 147 | ); 148 | name = TwilioSDK; 149 | path = libs/TwilioSDK; 150 | sourceTree = ""; 151 | }; 152 | DB08628E1BF4216D00A97135 /* Headers */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | DB08628F1BF4216D00A97135 /* TCConnection.h */, 156 | DB0862901BF4216D00A97135 /* TCConnectionDelegate.h */, 157 | DB0862911BF4216D00A97135 /* TCDevice.h */, 158 | DB0862921BF4216D00A97135 /* TCDeviceDelegate.h */, 159 | DB0862931BF4216D00A97135 /* TCPresenceEvent.h */, 160 | DB0862941BF4216D00A97135 /* TwilioClient.h */, 161 | ); 162 | path = Headers; 163 | sourceTree = ""; 164 | }; 165 | DB0862951BF4216D00A97135 /* Libraries */ = { 166 | isa = PBXGroup; 167 | children = ( 168 | DB0862961BF4216D00A97135 /* libcrypto.a */, 169 | DB0862971BF4216D00A97135 /* libssl.a */, 170 | DB0862981BF4216D00A97135 /* libTwilioClient.a */, 171 | ); 172 | path = Libraries; 173 | sourceTree = ""; 174 | }; 175 | DB08629A1BF4216D00A97135 /* Resources */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | DB08629B1BF4216D00A97135 /* disconnect.wav */, 179 | DB08629C1BF4216D00A97135 /* dtmf_0.wav */, 180 | DB08629D1BF4216D00A97135 /* dtmf_1.wav */, 181 | DB08629E1BF4216D00A97135 /* dtmf_2.wav */, 182 | DB08629F1BF4216D00A97135 /* dtmf_3.wav */, 183 | DB0862A01BF4216D00A97135 /* dtmf_4.wav */, 184 | DB0862A11BF4216D00A97135 /* dtmf_5.wav */, 185 | DB0862A21BF4216D00A97135 /* dtmf_6.wav */, 186 | DB0862A31BF4216D00A97135 /* dtmf_7.wav */, 187 | DB0862A41BF4216D00A97135 /* dtmf_8.wav */, 188 | DB0862A51BF4216D00A97135 /* dtmf_9.wav */, 189 | DB0862A61BF4216D00A97135 /* dtmf_hash.wav */, 190 | DB0862A71BF4216D00A97135 /* dtmf_star.wav */, 191 | DB0862A81BF4216D00A97135 /* incoming.wav */, 192 | DB0862A91BF4216D00A97135 /* outgoing.wav */, 193 | ); 194 | path = Resources; 195 | sourceTree = ""; 196 | }; 197 | /* End PBXGroup section */ 198 | 199 | /* Begin PBXNativeTarget section */ 200 | DB0862121BF2D3AF00A97135 /* RCTTwilio */ = { 201 | isa = PBXNativeTarget; 202 | buildConfigurationList = DB08621C1BF2D3AF00A97135 /* Build configuration list for PBXNativeTarget "RCTTwilio" */; 203 | buildPhases = ( 204 | DB08620F1BF2D3AF00A97135 /* Sources */, 205 | DB0862111BF2D3AF00A97135 /* CopyFiles */, 206 | DB0862AC1BF421FF00A97135 /* Frameworks */, 207 | DB0862D61BF42D7D00A97135 /* CopyFiles */, 208 | ); 209 | buildRules = ( 210 | ); 211 | dependencies = ( 212 | ); 213 | name = RCTTwilio; 214 | productName = RCTTwilio; 215 | productReference = DB0862131BF2D3AF00A97135 /* libRCTTwilio.a */; 216 | productType = "com.apple.product-type.library.static"; 217 | }; 218 | /* End PBXNativeTarget section */ 219 | 220 | /* Begin PBXProject section */ 221 | DB08620B1BF2D3AF00A97135 /* Project object */ = { 222 | isa = PBXProject; 223 | attributes = { 224 | LastUpgradeCheck = 0700; 225 | ORGANIZATIONNAME = "Rogchap Software"; 226 | TargetAttributes = { 227 | DB0862121BF2D3AF00A97135 = { 228 | CreatedOnToolsVersion = 7.0; 229 | }; 230 | }; 231 | }; 232 | buildConfigurationList = DB08620E1BF2D3AF00A97135 /* Build configuration list for PBXProject "RCTTwilio" */; 233 | compatibilityVersion = "Xcode 3.2"; 234 | developmentRegion = English; 235 | hasScannedForEncodings = 0; 236 | knownRegions = ( 237 | en, 238 | ); 239 | mainGroup = DB08620A1BF2D3AF00A97135; 240 | productRefGroup = DB0862141BF2D3AF00A97135 /* Products */; 241 | projectDirPath = ""; 242 | projectRoot = ""; 243 | targets = ( 244 | DB0862121BF2D3AF00A97135 /* RCTTwilio */, 245 | ); 246 | }; 247 | /* End PBXProject section */ 248 | 249 | /* Begin PBXSourcesBuildPhase section */ 250 | DB08620F1BF2D3AF00A97135 /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | DB0862191BF2D3AF00A97135 /* RCTTwilio.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin XCBuildConfiguration section */ 261 | DB08621A1BF2D3AF00A97135 /* Debug */ = { 262 | isa = XCBuildConfiguration; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 266 | CLANG_CXX_LIBRARY = "libc++"; 267 | CLANG_ENABLE_MODULES = YES; 268 | CLANG_ENABLE_OBJC_ARC = YES; 269 | CLANG_WARN_BOOL_CONVERSION = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INT_CONVERSION = YES; 275 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 276 | CLANG_WARN_UNREACHABLE_CODE = YES; 277 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 278 | COPY_PHASE_STRIP = NO; 279 | DEBUG_INFORMATION_FORMAT = dwarf; 280 | ENABLE_STRICT_OBJC_MSGSEND = YES; 281 | ENABLE_TESTABILITY = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu99; 283 | GCC_DYNAMIC_NO_PIC = NO; 284 | GCC_NO_COMMON_BLOCKS = YES; 285 | GCC_OPTIMIZATION_LEVEL = 0; 286 | GCC_PREPROCESSOR_DEFINITIONS = ( 287 | "DEBUG=1", 288 | "$(inherited)", 289 | ); 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 297 | MTL_ENABLE_DEBUG_INFO = YES; 298 | ONLY_ACTIVE_ARCH = YES; 299 | OTHER_CFLAGS = "-fembed-bitcode"; 300 | SDKROOT = iphoneos; 301 | }; 302 | name = Debug; 303 | }; 304 | DB08621B1BF2D3AF00A97135 /* Release */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 309 | CLANG_CXX_LIBRARY = "libc++"; 310 | CLANG_ENABLE_MODULES = YES; 311 | CLANG_ENABLE_OBJC_ARC = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_CONSTANT_CONVERSION = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_EMPTY_BODY = YES; 316 | CLANG_WARN_ENUM_CONVERSION = YES; 317 | CLANG_WARN_INT_CONVERSION = YES; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CLANG_WARN_UNREACHABLE_CODE = YES; 320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 321 | COPY_PHASE_STRIP = NO; 322 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 323 | ENABLE_NS_ASSERTIONS = NO; 324 | ENABLE_STRICT_OBJC_MSGSEND = YES; 325 | GCC_C_LANGUAGE_STANDARD = gnu99; 326 | GCC_NO_COMMON_BLOCKS = YES; 327 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 328 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 329 | GCC_WARN_UNDECLARED_SELECTOR = YES; 330 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 331 | GCC_WARN_UNUSED_FUNCTION = YES; 332 | GCC_WARN_UNUSED_VARIABLE = YES; 333 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 334 | MTL_ENABLE_DEBUG_INFO = NO; 335 | OTHER_CFLAGS = "-fembed-bitcode"; 336 | SDKROOT = iphoneos; 337 | VALIDATE_PRODUCT = YES; 338 | }; 339 | name = Release; 340 | }; 341 | DB0862AA1BF4216D00A97135 /* Debug */ = { 342 | isa = XCBuildConfiguration; 343 | buildSettings = { 344 | COPY_PHASE_STRIP = NO; 345 | GCC_DYNAMIC_NO_PIC = NO; 346 | GCC_OPTIMIZATION_LEVEL = 0; 347 | HEADER_SEARCH_PATHS = ( 348 | "$(inherited)", 349 | "$(SRCROOT)/../../react-native/React/**", 350 | "$(SRCROOT)/node_modules/react-native/React", 351 | ); 352 | LIBRARY_SEARCH_PATHS = ( 353 | "$(inherited)", 354 | "$(PROJECT_DIR)/libs/TwilioSDK/**", 355 | "$(PROJECT_DIR)/libs/TwilioSDK/Libraries", 356 | ); 357 | PRODUCT_NAME = RCTTwilio; 358 | }; 359 | name = Debug; 360 | }; 361 | DB0862AB1BF4216D00A97135 /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | COPY_PHASE_STRIP = YES; 365 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 366 | HEADER_SEARCH_PATHS = ( 367 | "$(inherited)", 368 | "$(SRCROOT)/../../react-native/React/**", 369 | "$(SRCROOT)/node_modules/react-native/React", 370 | ); 371 | LIBRARY_SEARCH_PATHS = ( 372 | "$(inherited)", 373 | "$(PROJECT_DIR)/libs/TwilioSDK/**", 374 | "$(PROJECT_DIR)/libs/TwilioSDK/Libraries", 375 | ); 376 | PRODUCT_NAME = RCTTwilio; 377 | }; 378 | name = Release; 379 | }; 380 | /* End XCBuildConfiguration section */ 381 | 382 | /* Begin XCConfigurationList section */ 383 | DB08620E1BF2D3AF00A97135 /* Build configuration list for PBXProject "RCTTwilio" */ = { 384 | isa = XCConfigurationList; 385 | buildConfigurations = ( 386 | DB08621A1BF2D3AF00A97135 /* Debug */, 387 | DB08621B1BF2D3AF00A97135 /* Release */, 388 | ); 389 | defaultConfigurationIsVisible = 0; 390 | defaultConfigurationName = Release; 391 | }; 392 | DB08621C1BF2D3AF00A97135 /* Build configuration list for PBXNativeTarget "RCTTwilio" */ = { 393 | isa = XCConfigurationList; 394 | buildConfigurations = ( 395 | DB0862AA1BF4216D00A97135 /* Debug */, 396 | DB0862AB1BF4216D00A97135 /* Release */, 397 | ); 398 | defaultConfigurationIsVisible = 0; 399 | defaultConfigurationName = Release; 400 | }; 401 | /* End XCConfigurationList section */ 402 | }; 403 | rootObject = DB08620B1BF2D3AF00A97135 /* Project object */; 404 | } 405 | -------------------------------------------------------------------------------- /ios/RCTTwilio.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/RCTTwilio/RCTTwilio.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTTwilio.h 3 | // RCTTwilio 4 | // 5 | // Created by Roger Chapman on 11/11/2015. 6 | // Copyright © 2015 Rogchap Software. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "TwilioClient.h" 11 | 12 | @interface RCTTwilio : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ios/RCTTwilio/RCTTwilio.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTTwilio.m 3 | // RCTTwilio 4 | // 5 | // Created by Roger Chapman on 11/11/2015. 6 | // Copyright © 2015 Rogchap Software. All rights reserved. 7 | // 8 | 9 | #import "RCTTwilio.h" 10 | #import "RCTEventDispatcher.h" 11 | 12 | @implementation RCTTwilio { 13 | TCDevice* _phone; 14 | TCConnection* _connection; 15 | TCConnection* _pendingConnection; 16 | } 17 | 18 | RCT_EXPORT_MODULE(); 19 | 20 | @synthesize bridge = _bridge; 21 | 22 | RCT_EXPORT_METHOD(initWithTokenUrl:(NSString *) tokenUrl) { 23 | NSURL *url = [NSURL URLWithString: tokenUrl]; 24 | NSError *error = nil; 25 | NSString *token = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error]; 26 | if (token == nil) { 27 | NSLog(@"Error retrieving token: %@", [error localizedDescription]); 28 | } else { 29 | _phone = [[TCDevice alloc] initWithCapabilityToken:token delegate:self]; 30 | } 31 | } 32 | 33 | RCT_EXPORT_METHOD(initWithToken:(NSString *) token) { 34 | _phone = [[TCDevice alloc] initWithCapabilityToken:token delegate:self]; 35 | } 36 | 37 | RCT_EXPORT_METHOD(connect:(NSDictionary *) params) { 38 | _connection = [_phone connect:params delegate:self]; 39 | } 40 | 41 | RCT_EXPORT_METHOD(disconnect) { 42 | [_connection disconnect]; 43 | } 44 | 45 | RCT_EXPORT_METHOD(accept) { 46 | [_pendingConnection accept]; 47 | _connection = _pendingConnection; 48 | _pendingConnection = nil; 49 | } 50 | 51 | RCT_EXPORT_METHOD(reject) { 52 | [_pendingConnection reject]; 53 | } 54 | 55 | RCT_EXPORT_METHOD(ignore) { 56 | [_pendingConnection ignore]; 57 | } 58 | 59 | RCT_EXPORT_METHOD(setMuted:(BOOL)isMuted) { 60 | if (_connection && _connection.state == TCConnectionStateConnected) { 61 | [_connection setMuted:isMuted]; 62 | } 63 | } 64 | 65 | RCT_EXPORT_METHOD(sendDigits:(NSString *) digits) { 66 | if (_connection && _connection.state == TCConnectionStateConnected) { 67 | [_connection sendDigits:digits]; 68 | } 69 | } 70 | 71 | #pragma mark - TCDeviceDelegate 72 | 73 | -(void)device:(TCDevice *)device didReceiveIncomingConnection:(TCConnection *)connection { 74 | _pendingConnection = connection; 75 | [_pendingConnection setDelegate:self]; 76 | [self.bridge.eventDispatcher sendAppEventWithName:@"deviceDidReceiveIncoming" body:connection.parameters]; 77 | } 78 | 79 | -(void)deviceDidStartListeningForIncomingConnections:(TCDevice*)device { 80 | [self.bridge.eventDispatcher sendAppEventWithName:@"deviceDidStartListening" body:nil]; 81 | } 82 | 83 | -(void)device:(TCDevice *)device didStopListeningForIncomingConnections:(NSError *)error { 84 | id body = nil; 85 | if (error != nil) { 86 | body = @{@"err": [error localizedDescription]}; 87 | } 88 | [self.bridge.eventDispatcher 89 | sendAppEventWithName:@"deviceDidStopListening" body:body]; 90 | } 91 | 92 | #pragma mark - TCConnectionDelegate 93 | 94 | -(void)connection:(TCConnection *)connection didFailWithError:(NSError *)error { 95 | [self.bridge.eventDispatcher 96 | sendAppEventWithName:@"connectionDidFail" body:@{@"err": [error localizedDescription]}]; 97 | } 98 | 99 | -(void)connectionDidStartConnecting:(TCConnection *)connection { 100 | [self.bridge.eventDispatcher 101 | sendAppEventWithName:@"connectionDidStartConnecting" body:connection.parameters]; 102 | } 103 | 104 | -(void)connectionDidConnect:(TCConnection *)connection { 105 | [self.bridge.eventDispatcher 106 | sendAppEventWithName:@"connectionDidConnect" body:nil]; 107 | } 108 | 109 | -(void)connectionDidDisconnect:(TCConnection *)connection { 110 | if (connection == _connection) { 111 | _connection = nil; 112 | } 113 | 114 | if (connection == _pendingConnection) { 115 | _pendingConnection = nil; 116 | } 117 | [self.bridge.eventDispatcher 118 | sendAppEventWithName:@"connectionDidDisconnect" body:nil]; 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Headers/TCConnection.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2011-2015 Twilio. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms and conditions of the 5 | // Twilio Terms of Service located at http://www.twilio.com/legal/tos 6 | // 7 | 8 | #import 9 | 10 | #import "TCConnectionDelegate.h" 11 | 12 | /** TCConnectionState is an enum representing the current status of TCConnection. 13 | */ 14 | typedef NS_ENUM(NSInteger, TCConnectionState) 15 | { 16 | TCConnectionStatePending = 0, /**< An incoming TCConnection has not yet been accepted. */ 17 | TCConnectionStateConnecting, /**< An incoming TCConnection has been accepted, or an outgoing TCConnection is being established. */ 18 | TCConnectionStateConnected, /**< A connection has been established. */ 19 | TCConnectionStateDisconnected /**< An open connection has been disconnected. */ 20 | }; 21 | 22 | 23 | /** @name Incoming connection parameter capability keys */ 24 | 25 | /* 26 | * These keys can retrieve values from the TCConnection.parameters dictionary for incoming connections. 27 | * These are a subset of the values provided as a part of a Twilio Request to your Twilio application. 28 | * Please visit http://www.twilio.com/docs/api/twiml/twilio_request for details on the specifics of the parameters. 29 | */ 30 | extern NSString* const TCConnectionIncomingParameterFromKey; /**< NSString representing the calling party. If the caller is a telephone, it will be in the E.164 format. If the caller is another Twilio Client, it will be in a URI format "client:name" */ 31 | extern NSString* const TCConnectionIncomingParameterToKey; /**< NSString representing the client name of the called party. This is in a URI format "client:name" */ 32 | extern NSString* const TCConnectionIncomingParameterAccountSIDKey; /**< NSString representing the account id making the incoming call */ 33 | extern NSString* const TCConnectionIncomingParameterAPIVersionKey; /**< NSString representing the version of the Twilio API used in the server application */ 34 | extern NSString* const TCConnectionIncomingParameterCallSIDKey DEPRECATED_ATTRIBUTE; /**< NSString representing a unique identifier for the incoming call */ 35 | 36 | // Included in both Incoming and Outgoing parameters dictionaries 37 | extern NSString* const TCConnectionParameterCallSIDKey; /**< NSString representing a unique identifier for the incoming call */ 38 | 39 | // Outgoing parameters besides CallSid are completely up to application developers and thus there are no constants for them here. 40 | 41 | 42 | /** A TCConnection object represents the connection between a TCDevice and Twilio's services. 43 | 44 | A TCConnection is either incoming or outgoing. You do not create a TCConnection directly; an outgoing connection is created by calling the -[TCDevice connect:delegate:] method. Incoming connections are created internally by TCDevice and handed to the registered TCDeviceDelegate via -[TCDeviceDelegate device:didReceiveIncomingConnection:]. 45 | */ 46 | @interface TCConnection : NSObject 47 | 48 | /** Current status of the TCConnection. 49 | */ 50 | @property (nonatomic, readonly) TCConnectionState state; 51 | 52 | /** BOOL representing if the TCConnection is an incoming or outgoing connection. 53 | 54 | If the connection is incoming, the value is YES. 55 | */ 56 | @property (nonatomic, readonly, getter=isIncoming) BOOL incoming; 57 | 58 | /** A dictionary of parameters that define the connection. 59 | 60 | Incoming connection parameters are defined by the "Incoming connection parameter capability keys". 61 | Outgoing connection parameters are defined by the union of optional application parameters specified in the Capability Token and any additional parameters specified when the -[TCDevice connect:delegate:] method is called. 62 | */ 63 | @property (weak, nonatomic, readonly) NSDictionary* parameters; 64 | 65 | /** The delegate object which will receive TCConnection events. 66 | */ 67 | @property (nonatomic, weak) id delegate; 68 | 69 | /** Property that defines if the connection's microphone is muted. 70 | 71 | Setting the property will only take effect if the connection's state is TCConnectionStateConnected. 72 | */ 73 | @property (nonatomic, getter=isMuted) BOOL muted; 74 | 75 | /** Accepts an incoming connection request. 76 | 77 | When the TCDeviceDelegate receives a -[TCDeviceDelegate device:didReceiveIncomingConnection:] message, calling this method will accept the incoming connection. Calling this method on a TCConnection that is not in the TCConnectionStatePending state will have no effect. 78 | 79 | @returns None 80 | */ 81 | -(void)accept; 82 | 83 | /** Ignores an incoming connection request. 84 | 85 | When the TCDeviceDelegate receives a -[TCDeviceDelegate device:didReceiveIncomingConnection:] message, calling ignore will close the incoming connection request and the connection may not be accepted. Calling this method on a TCConnection that is not in the TCConnectionStatePending state will have no effect. 86 | The TCConnectionDelegate will eventually receive a -[TCConnectionDelegate connectionDidDisconnect:] message once the connection is terminated. 87 | 88 | @returns None 89 | */ 90 | -(void)ignore; 91 | 92 | /** Rejects an incoming connection request. 93 | 94 | When the TCDeviceDelegate receives a -[TCDeviceDelegate device:didReceiveIncomingConnection:] message, calling reject will terminate the request, notifying the caller that the call was rejected. Calling this method on a TCConnection that is not in the TCConnectionStatePending state will have no effect. 95 | The TCConnectionDelegate will not receive a -[TCConnectionDelegate connectionDidDisconnect:] message since there was no actual connection created. 96 | 97 | @returns None 98 | */ 99 | -(void)reject; 100 | 101 | /** Disconnect the connection. 102 | 103 | Calling this method on a TCConnection that is in the TCConnectionStateDisconnected state will have no effect. 104 | The TCConnectionDelegate will eventually receive a -[TCConnectionDelegate connectionDidDisconnect:] message once the connection is terminated. 105 | 106 | @returns None 107 | */ 108 | -(void)disconnect; 109 | 110 | /** Send a string of digits over the connection. Calling this method on a TCConnection that is not in the TCConnectionStateConnected state will have no effect. 111 | 112 | @param digits A string of characters to be played. Valid values are '0' - '9', '*', '#', and 'w'. Each 'w' will cause a 500 ms pause between digits sent. If any invalid character is present, no digits will be sent. 113 | 114 | @returns None 115 | */ 116 | -(void)sendDigits:(NSString*)digits; 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Headers/TCConnectionDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2011-2015 Twilio. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms and conditions of the 5 | // Twilio Terms of Service located at http://www.twilio.com/legal/tos 6 | // 7 | 8 | #import 9 | 10 | @class TCConnection; 11 | 12 | /** TCConnectionDelegate is the delegate protocol for receiving TCConnection state-change notifications. 13 | */ 14 | @protocol TCConnectionDelegate 15 | 16 | @required 17 | 18 | /** The TCConnection has failed with an error. 19 | 20 | After this selector has been called, it is safe to assume that the connection is no longer connected. When this occurs the TCConnection will be in the TCConnectionStateDisconnected state. 21 | 22 | For a list of error codes and their meanings, see http://www.twilio.com/docs/client/errors. 23 | 24 | @param connection The TCConnection that encountered an error 25 | 26 | @param error The NSError for the error encountered by TCConnection 27 | 28 | @returns None 29 | */ 30 | -(void)connection:(TCConnection*)connection didFailWithError:(NSError*)error; 31 | 32 | 33 | @optional 34 | 35 | 36 | /** The TCConnection is in the process of trying to connect. 37 | 38 | When this occurs, TCConnection is in the TCConnectionStateConnecting state. 39 | 40 | @param connection The TCConnection that is in the process of trying to connect. 41 | 42 | @returns None 43 | */ 44 | -(void)connectionDidStartConnecting:(TCConnection*)connection; 45 | 46 | /** The TCConnection has successfully connected. 47 | 48 | When this occurs, TCConnection is in the TCConnectionStateConnected state. 49 | 50 | @param connection The TCConnection that has just connected. 51 | 52 | @returns None 53 | */ 54 | -(void)connectionDidConnect:(TCConnection*)connection; 55 | 56 | /** The TCConnection has just disconnected. 57 | 58 | This will occur when the connection has been disconnected or ignored by any party. When this occurs the TCConnection will be in the TCConnectionStateDisconnected state. 59 | 60 | @param connection The TCConnection has just disconnected. 61 | 62 | @returns None 63 | */ 64 | -(void)connectionDidDisconnect:(TCConnection*)connection; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Headers/TCDevice.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2011-2015 Twilio. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms and conditions of the 5 | // Twilio Terms of Service located at http://www.twilio.com/legal/tos 6 | // 7 | 8 | #import 9 | 10 | #import "TCDeviceDelegate.h" 11 | #import "TCConnectionDelegate.h" 12 | 13 | /** TCDeviceState represents the various states of the device's ability to listen for incoming connections and make outgoing connections. 14 | 15 | The TCDeviceDelegate gets notified of the state changes. 16 | */ 17 | typedef NS_ENUM(NSInteger, TCDeviceState) 18 | { 19 | TCDeviceStateOffline = 0, /**< TCDevice The device is not connected and cannot receive incoming connections or make outgoing connections. */ 20 | TCDeviceStateReady, /**< TCDevice can receive incoming connections and attempt outgoing connections if capabilities allow. */ 21 | TCDeviceStateBusy /**< TCDevice is connected to the network and has an active connection. No additional connections can be created or accepted. */ 22 | }; 23 | 24 | /** @name Device capability keys */ 25 | 26 | /* 27 | * These keys can retrieve values from the TCDevice.capabilities dictionary. 28 | * The values are extracted from the Capability Token that is used to initialize a TCDevice. 29 | */ 30 | extern NSString* const TCDeviceCapabilityIncomingKey; /**< NSNumber of BOOL that indicates whether the device can receive incoming calls. */ 31 | extern NSString* const TCDeviceCapabilityOutgoingKey; /**< NSNumber of BOOL that indicates whether the device can make outgoing calls. */ 32 | extern NSString* const TCDeviceCapabilityExpirationKey; /**< NSNumber of long long that represents the time the device's capability token expires (number of seconds relative to the UNIX epoch). */ 33 | extern NSString* const TCDeviceCapabilityAccountSIDKey; /**< NSString representing the account SID. */ 34 | extern NSString* const TCDeviceCapabilityApplicationSIDKey; /**< The application SID used when making an outgoing call. Only present if TCDeviceCapabilityOutgoingKey is also present with a YES value. */ 35 | extern NSString* const TCDeviceCapabilityApplicationParametersKey; /**< A non-modifiable NSDictionary of key/value pairs that will be passed to the Twilio Application when making an outgoing call. Only present if TCDeviceCapabilityOutgoingKey is also present with a YES value and the Capability Token contains application parameters. Additional parameters may be specified in the connect:delegate: method if needed. */ 36 | extern NSString* const TCDeviceCapabilityClientNameKey; /**< NSString representing the client name. */ 37 | 38 | 39 | @class TCConnection; 40 | 41 | /** An instance of TCDevice is an object that knows how to interface with Twilio Services. 42 | 43 | A TCDevice is the primary entry point for Twilio Client. An iOS application should initialize a TCDevice with the initWithCapabilityToken:delegate: method with a Capability Token to talk to Twilio services. 44 | 45 | A Capability Token is a JSON Web Token (JWT) that specifies what the TCDevice may do with respect to the Twilio Application, such as whether it can make outgoing calls, how long the token and the TCDevice are valid before needing to be refreshed, and so on. Please visit http://www.twilio.com/docs/client/capability-tokens for more information. 46 | 47 | @see TCDeviceDelegate 48 | */ 49 | @interface TCDevice : NSObject 50 | 51 | /** Current status of the TCDevice. 52 | 53 | State changes will cause relevant methods to be called in TCDeviceDelegate and will include any NSErrors that occur. 54 | */ 55 | @property (nonatomic, readonly) TCDeviceState state; 56 | 57 | 58 | /** Current capabilities of the TCDevice. The keys are defined by the "Device capability keys" constants. 59 | */ 60 | @property (weak, nonatomic, readonly) NSDictionary* capabilities; 61 | 62 | 63 | /** The delegate object which will receive events from a TCDevice object. 64 | */ 65 | @property (nonatomic, weak) id delegate; 66 | 67 | /** A BOOL indicating if a sound should be played for an incoming connection. 68 | 69 | The default value is YES. See the Twilio Client iOS Usage Guide for more information on sounds. 70 | */ 71 | @property (nonatomic) BOOL incomingSoundEnabled; 72 | 73 | /** A BOOL indicating if a sound should be played for an outgoing connection. 74 | 75 | The default value is YES. See the Twilio Client iOS Usage Guide for more information on sounds. 76 | */ 77 | @property (nonatomic) BOOL outgoingSoundEnabled; 78 | 79 | /** A BOOL indicating if a sound should be played when a connection is disconnected for any reason. 80 | 81 | The default value is YES. See the Twilio Client iOS Usage Guide for more information on sounds. 82 | */ 83 | @property (nonatomic) BOOL disconnectSoundEnabled; 84 | 85 | 86 | /** Initialize a new TCDevice object. If the incoming capabilities are defined, then the device will automatically begin listening for incoming connections. 87 | 88 | @param capabilityToken A signed JSON Web Token that defines the features available to the TCDevice. These may be created using the Twilio Helper Libraries included with the SDK or available at http://www.twilio.com . The capabilities are used to begin listening for incoming connections and provide the default parameters used for establishing outgoing connections. Please visit http://www.twilio.com/docs/client/capability-tokens for more information. 89 | 90 | @param delegate The delegate object which will receive events from a TCDevice object. 91 | 92 | @returns The initialized receiver 93 | 94 | @see updateCapabilityToken: 95 | */ 96 | -(id)initWithCapabilityToken:(NSString*)capabilityToken delegate:(id)delegate; 97 | 98 | 99 | /** Start TCDevice to listen for incoming connections. 100 | 101 | The TCDevice will automatically listen for incoming connections on method calls to initWithCapabilityToken:delegate: or updateCapabilityToken: if the token allows. 102 | 103 | This method only needs to be called if unlisten was previously called. 104 | 105 | @returns None 106 | */ 107 | -(void)listen; 108 | 109 | 110 | /** Stop the device from listening for incoming connections. This could be used for a "silence" mode on the your iOS application, for instance. 111 | 112 | This method will do nothing if the TCDevice is currently not listening, either because of a previous call to unlisten or because the TCDevice has not been granted the incoming capability. 113 | 114 | @returns None 115 | */ 116 | -(void)unlisten; 117 | 118 | 119 | /** Update the capabilities of the TCDevice. 120 | 121 | There may be circumstances when the defined capabilities have expired. For example, the TCDevice may enter the TCDeviceStateOffline state because the capabilities have expired. In these cases, the capabilities will need to be updated. If the device is currently listening for incoming connections, it will restart the listening process (if permitted) using these updated capabilities. 122 | 123 | Existing connections are not affected by updating the capability token. 124 | 125 | @param capabilityToken A signed JWT that defines the capability token available to the TCDevice. Please visit http://www.twilio.com/docs/client/capability-tokens for more information on capability tokens. 126 | 127 | @return None 128 | */ 129 | -(void)updateCapabilityToken:(NSString*)capabilityToken; 130 | 131 | 132 | /** Create an outgoing connection. 133 | 134 | @param parameters An optional dictionary containing parameters for the outgoing connection that get passed to your Twilio Application. These parameters are merged with any parameters supplied in the Capability Token (e.g. the dictionary retrived with the TCDeviceCapabilityApplicationParametersKey against the capabilities property). If there are any key collisions with the two dictionaries, the value(s) from TCDeviceCapabilityApplicationParametersKey dictionary will take precedence. Parameters other than NSString are ignored. 135 | 136 | @param delegate An optional delegate object to receive callbacks when state changes occur to the TCConnection object. 137 | 138 | @returns A TCConnection object representing the new outgoing connection. If TCConnection is nil, the connection could not be initialized. 139 | */ 140 | -(TCConnection*)connect:(NSDictionary*)parameters delegate:(id)delegate; 141 | 142 | 143 | /** Disconnect all current connections associated with the receiver. 144 | 145 | This a convenience routine that disconnects all current incoming and outgoing connections, including pending incoming connections. 146 | 147 | @returns None 148 | */ 149 | -(void)disconnectAll; 150 | 151 | @end 152 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Headers/TCDeviceDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2011-2015 Twilio. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms and conditions of the 5 | // Twilio Terms of Service located at http://www.twilio.com/legal/tos 6 | // 7 | 8 | @class TCDevice; 9 | @class TCConnection; 10 | @class TCPresenceEvent; 11 | 12 | /** TCDeviceDelegate is the delegate protocol for a TCDevice. 13 | */ 14 | @protocol TCDeviceDelegate 15 | 16 | @required 17 | 18 | /** TCDevice is no longer listening for incoming connections. 19 | 20 | @param device The TCDevice object that stopped listening. 21 | 22 | @param error An NSError indicating the reason the TCDevice went offline. If the error is nil, this means that the incoming listener was successfully disconnected (for example, -[TCDevice unlisten] was called). For a list of error codes associated with a non-nil error and their meanings, see http://www.twilio.com/docs/client/errors. 23 | 24 | @returns None 25 | */ 26 | -(void)device:(TCDevice*)device didStopListeningForIncomingConnections:(NSError*)error; 27 | 28 | 29 | @optional 30 | 31 | /** TCDevice is now listening for incoming connections. 32 | 33 | @param device The TCDevice object that is now listening for connections. 34 | 35 | @returns None 36 | */ 37 | -(void)deviceDidStartListeningForIncomingConnections:(TCDevice*)device; 38 | 39 | 40 | /** Called when an incoming connection request has been received. At this point you choose to accept, ignore, or reject the new connection. 41 | 42 | When this occurs, you should assign an appropriate TCConnectionDelegate on the TCConnection to properly respond to events. 43 | 44 | Pending incoming connections may be received at any time, including while another connection is active. This method will be invoked once for each connection, and your code should handle this situation appropriately. A single pending connection can be accepted as long as no other connections are active; all other currently pending incoming connections will be automatically rejected by the library until the active connection is terminated. 45 | 46 | @param device The TCDevice that is receiving the incoming connection request. 47 | 48 | @param connection The TCConnection associated with the incoming connection. The incoming connection will be in the TCConnectionStatusPending state until it is either accepted or disconnected. 49 | 50 | @returns None 51 | */ 52 | -(void)device:(TCDevice*)device didReceiveIncomingConnection:(TCConnection*)connection; 53 | 54 | 55 | /** Called when a presence update notification has been received. 56 | 57 | When the device is ready, this selector (if implemented) is invoked once for each available client. Thereafter it is invoked as clients become available or unavailable. 58 | 59 | A client is considered available even if another call is in progress. 60 | 61 | Remember, when your client disconnects the [TCDeviceDelegate device:didStopListeningForIncomingConnections:] selector will be invoked, and when the device reconnects this presence selector will be called again for every available online client. 62 | 63 | @param device The TCDevice that is receiving the presence update. 64 | 65 | @param presenceEvent A TCPresenceEvent object describing the notification. 66 | 67 | @returns None 68 | */ 69 | -(void)device:(TCDevice *)device didReceivePresenceUpdate:(TCPresenceEvent *)presenceEvent; 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Headers/TCPresenceEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2012-2015 Twilio. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms and conditions of the 5 | // Twilio Terms of Service located at http://www.twilio.com/legal/tos 6 | // 7 | 8 | #import 9 | 10 | /** An object encapsulating client presence state for other clients connected to the Twilio Application. 11 | 12 | See [TCDeviceDelegate device:didReceivePresenceUpdate:] for more information. 13 | */ 14 | @interface TCPresenceEvent : NSObject 15 | 16 | /** The client name for which the event applies. 17 | */ 18 | @property (nonatomic, readonly) NSString *name; 19 | 20 | /** Whether or not the client specified by name is currently connected to Twilio services for the account. 21 | */ 22 | @property (nonatomic, readonly, getter=isAvailable) BOOL available; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Headers/TwilioClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2011-2015 Twilio. All rights reserved. 3 | // 4 | // Use of this software is subject to the terms and conditions of the 5 | // Twilio Terms of Service located at http://www.twilio.com/legal/tos 6 | // 7 | 8 | #import "TCConnection.h" 9 | #import "TCConnectionDelegate.h" 10 | #import "TCDevice.h" 11 | #import "TCDeviceDelegate.h" 12 | #import "TCPresenceEvent.h" 13 | 14 | @interface TwilioClient : NSObject 15 | 16 | typedef NS_ENUM(NSInteger, TCLogLevel) { 17 | TC_LOG_OFF = 0, 18 | TC_LOG_ERROR, 19 | TC_LOG_WARN, 20 | TC_LOG_INFO, 21 | TC_LOG_DEBUG, 22 | TC_LOG_VERBOSE 23 | }; 24 | 25 | @property (nonatomic, readonly) NSString* version; 26 | 27 | +(id)sharedInstance; 28 | -(void)setLogLevel:(TCLogLevel)level; 29 | 30 | /*! 31 | * 32 | * Enable or disable call quality metrics reporting. 33 | * Reporting is enabled by default. 34 | * 35 | * @param enabled 'YES' to enable; 'NO' to disable. 36 | * 37 | */ 38 | -(void)setMetricsEnabled:(BOOL)enabled; 39 | 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Libraries/libTwilioClient.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Libraries/libTwilioClient.a -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Libraries/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Libraries/libcrypto.a -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Libraries/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Libraries/libssl.a -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/disconnect.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/disconnect.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_0.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_0.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_1.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_2.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_3.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_3.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_4.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_4.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_5.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_5.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_6.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_6.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_7.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_7.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_8.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_8.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_9.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_9.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_hash.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_hash.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/dtmf_star.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/dtmf_star.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/incoming.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/incoming.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/Resources/outgoing.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabriziomoscon/react-native-twilio/b723e0718d99e95a070ae2ea1216b5f2e0c38e3b/ios/libs/TwilioSDK/Resources/outgoing.wav -------------------------------------------------------------------------------- /ios/libs/TwilioSDK/readme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Twilio Client iOS README 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 |
25 | 26 |

Twilio Client iOS README

27 | 28 |

Ahoy hoy and welcome to Twilio Client iOS! In just a few minutes you'll 29 | be adding telephony features to your iOS app.

30 | 31 |

We recommend going through the Quickstart to get yourself familiar with 32 | the SDK along with this guide. And you'll want to get yourself a Twilio 33 | account by heading to 34 | https://www.twilio.com/try-twilio 35 | if you don't have one already.

36 | 37 |

Here's an overview of the SDK contents:

38 | 39 |
    40 |
  • ChangeLog - a list of changes since the last 41 | release
  • 42 |
  • README - this file
  • 43 |
  • Quickstart Guide - a guide and 44 | sample Xcode project that take you step-by-step through building an 45 | iOS application to connect to Twilio
  • 46 |
  • FAQ - frequently asked questions
  • 47 |
  • TwilioSDK.podspec - CocoaPods specification file to use with your project
  • 48 |
  • Headers/ - header files you'll need to import
  • 49 |
  • Libraries/ - static libraries you need to include in your project in order for Twilio Client to work
  • 50 |
  • Resources/ - sound resources used with Twilio Client iOS
  • 51 |
  • Quickstart/ - Quickstart sample app
  • 52 |
  • BasicPhone/ - sample app that shows you Twilio Client in action, for setting up server backend, please see Quickstart Guide
  • 53 |
  • Helper Libs/ - server-side helper libraries to use in conjunction with your iOS application
  • 54 |
  • Server/ - sample server backend for both Quickstart and BasicPhone - https://github.com/twilio/mobile-quickstart 55 | for authorizing client capabilities and communicating with Twilio
  • 56 |
  • Twilio Client iOS Docs - installer to set up Twilio Client Developer Docs to be referenced within Xcode Documentation and API Reference window
  • 57 |
58 | 59 |

60 | Happy coding!
61 | -Team Twilio 62 |

63 |
64 | 65 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-twilio", 3 | "version": "0.1.3", 4 | "description": "A React Native wrapper for the Twilio mobile SDK", 5 | "repository": { 6 | "type": "git", 7 | "url": "git@github.com:fabriziomoscon/react-native-twilio.git" 8 | }, 9 | "main": "index.js", 10 | "keywords": [ 11 | "react-component", 12 | "react-native", 13 | "twilio", 14 | "voice", 15 | "phone", 16 | "voip", 17 | "ios" 18 | ], 19 | "author": "Roger Chapman", 20 | "license": "MIT" 21 | } 22 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # A React Native wrapper for the [Twilio](https://www.twilio.com) mobile SDK 2 | 3 | [![npm version](https://badge.fury.io/js/react-native-twilio.svg)](https://badge.fury.io/js/react-native-twilio) 4 | 5 | ## Installation iOS 6 | 7 | 1. Run `npm install react-native-twilio --save` in your project directory 8 | 1. Open your project in XCode, right click on `Libraries` and click `Add Files to "Your Project Name"` 9 | 1. Within `node_modules`, find `react-native-twilio/ios` and add RCTTwilio.xcodeproj to your project. 10 | 1. Add `libRCTTwilio.a` to `Build Phases -> Link Binary With Libraries` 11 | 12 | ## Installation Android 13 | 14 | Coming Soon... PR anyone? 15 | 16 | ## Usage 17 | 18 | Have a look at the [Twilio Client SDK](https://www.twilio.com/docs/api/client) for details. 19 | 20 | ``` javascript 21 | const Twilio = require('react-native-twilio'); 22 | 23 | ... 24 | 25 | componentWillMount() { 26 | Twilio.initWithTokenUrl('https://example.com/token'); 27 | // or 28 | Twilio.initWithToken('sometoken'); 29 | Twilio.addEventListener('deviceDidStartListening', this._deviceDidStartListening); 30 | Twilio.addEventListener('deviceDidStopListening', this._deviceDidStopListening); 31 | Twilio.addEventListener('deviceDidReceiveIncoming', this._deviceDidReceiveIncoming); 32 | Twilio.addEventListener('connectionDidStartConnecting', this._connectionDidStartConnecting); 33 | Twilio.addEventListener('connectionDidConnect', this._connectionDidConnect); 34 | Twilio.addEventListener('connectionDidDisconnect', this._connectionDidDisconnect); 35 | Twilio.addEventListener('connectionDidFail', this._connectionDidFail); 36 | } 37 | 38 | ... 39 | 40 | Twilio.connect({To: '+61234567890'}); 41 | 42 | Twilio.disconnect(); 43 | 44 | Twilio.accept(); 45 | 46 | Twilio.reject(); 47 | 48 | Twilio.ignore(); 49 | ``` --------------------------------------------------------------------------------