├── .circleci └── config.yml ├── .gitattributes ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── RNTreasureData.podspec ├── android ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── github │ └── quipper │ └── rn │ └── td │ ├── RNTreasureDataModule.java │ ├── RNTreasureDataPackage.java │ └── Utils.java ├── example ├── .babelrc ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── .gitkeep │ │ │ ├── java │ │ │ └── com │ │ │ │ └── rntreasuredataexample │ │ │ │ ├── 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 ├── app.json ├── index.js ├── ios │ ├── Podfile │ ├── Podfile.lock │ ├── RNTreasureDataExample-tvOS │ │ └── Info.plist │ ├── RNTreasureDataExample-tvOSTests │ │ └── Info.plist │ ├── RNTreasureDataExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── RNTreasureDataExample-tvOS.xcscheme │ │ │ └── RNTreasureDataExample.xcscheme │ ├── RNTreasureDataExample.xcworkspace │ │ └── contents.xcworkspacedata │ ├── RNTreasureDataExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── RNTreasureDataExampleTests │ │ ├── Info.plist │ │ └── RNTreasureDataExampleTests.m ├── package.json ├── src │ └── App.tsx ├── tsconfig.json └── yarn.lock ├── ios ├── RNTreasureData.h ├── RNTreasureData.m └── RNTreasureData.xcodeproj │ └── project.pbxproj ├── package.json ├── src ├── declarations.d.ts └── index.ts ├── tsconfig.json ├── tslint.json └── yarn.lock /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | bundle_dependencies: 4 | working_directory: ~/react-native-td 5 | docker: 6 | - image: circleci/node:8.7.0 7 | steps: 8 | - checkout 9 | - restore_cache: 10 | keys: 11 | - react-native-td-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} 12 | - react-native-td-{{ arch }} 13 | - run: 14 | name: System information 15 | command: | 16 | echo "Node $(node -v)" 17 | echo "npm $(node -v)" 18 | - run: 19 | name: Install dependencies 20 | command: 'npm install' 21 | - save_cache: 22 | key: react-native-td-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} 23 | paths: 24 | - ~/react-native-td/node_modules 25 | - ~/.cache/yarn 26 | 27 | compile_source: 28 | working_directory: ~/react-native-td 29 | docker: 30 | - image: circleci/node:8.7.0 31 | steps: 32 | - checkout 33 | - restore_cache: 34 | keys: 35 | - react-native-td-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} 36 | - react-native-td-{{ arch }} 37 | - run: 38 | name: Install dependencies 39 | command: 'npm install' 40 | - run: 41 | name: Compile TypeScript 42 | command: 'npm run tsc' 43 | - run: 44 | name: Compile example module 45 | command: | 46 | cd ./example 47 | npm install 48 | npm run tsc 49 | npm run build:ios 50 | npm run build:android 51 | 52 | deploy_to_npm: 53 | working_directory: ~/react-native-td 54 | docker: 55 | - image: circleci/node:8.7.0 56 | steps: 57 | - checkout 58 | - restore_cache: 59 | keys: 60 | - react-native-td-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} 61 | - react-native-td-{{ arch }} 62 | - run: 63 | name: Install dependencies 64 | command: 'npm install' 65 | - run: 66 | name: Compile TypeScript 67 | command: 'npm run tsc' 68 | - run: 69 | name: Login to npm and publish 70 | command: | 71 | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc 72 | npm publish 73 | 74 | workflows: 75 | version: 2 76 | build_and_deploy: 77 | jobs: 78 | - bundle_dependencies: 79 | filters: 80 | tags: 81 | only: /.*/ 82 | branches: 83 | only: /.*/ 84 | - compile_source: 85 | requires: 86 | - bundle_dependencies 87 | filters: 88 | tags: 89 | only: /.*/ 90 | branches: 91 | only: /.*/ 92 | - deploy_to_npm: 93 | requires: 94 | - compile_source 95 | filters: 96 | tags: 97 | only: /.*/ 98 | branches: 99 | ignore: /.*/ -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # node.js 6 | # 7 | node_modules/ 8 | npm-debug.log 9 | yarn-error.log 10 | 11 | # Xcode 12 | # 13 | build/ 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata 23 | *.xccheckout 24 | *.moved-aside 25 | DerivedData 26 | *.hmap 27 | *.ipa 28 | *.xcuserstate 29 | project.xcworkspace 30 | */ios/Pods 31 | *.jsbundle 32 | *.jsbundle.meta 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | .settings 40 | local.properties 41 | *.iml 42 | *.classpath 43 | *.project 44 | *.android.bundle 45 | *.android.bundle.meta 46 | 47 | # BUCK 48 | buck-out/ 49 | \.buckd/ 50 | *.keystore 51 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | 3 | # Xcode 4 | *.pbxuser 5 | *.mode1v3 6 | *.mode2v3 7 | *.perspectivev3 8 | *.xcuserstate 9 | project.xcworkspace/ 10 | xcuserdata/ 11 | 12 | # Android 13 | android/local.properties 14 | android/.gradle/ 15 | android/.idea/ 16 | android/gradlew 17 | android/build 18 | android/gradlew.bat 19 | android/gradle/ 20 | 21 | # Config files 22 | .babelrc 23 | tsconfig.json 24 | tslint.json 25 | yarn.lock 26 | 27 | # Others 28 | example/ 29 | build 30 | node_modules 31 | src/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | - 0.9.3 2018/07/01 2 | - [Fix][Add React dependency to podspec](https://github.com/quipper/react-native-td/pull/17) 3 | - [Fix][isFirstRun was calling callback method twice](https://github.com/quipper/react-native-td/pull/18) 4 | - 0.9.2 2018/03/17 5 | - [Fix][Fix typo](https://github.com/quipper/react-native-td/pull/14) 6 | - 0.9.1 2018/01/09 7 | - 1st release -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-td [![CircleCI](https://circleci.com/gh/quipper/react-native-td.svg?style=svg)](https://circleci.com/gh/quipper/react-native-td) [![npm version](https://badge.fury.io/js/react-native-td.svg)](https://badge.fury.io/js/react-native-td) 2 | 3 | react-native-td is an unofficial React Native SDK for Treasure Data. 4 | 5 | The module is a light-weight layer sitting on-top of the TreasureData SDK for both [iOS](https://github.com/treasure-data/td-ios-sdk) and [Android](https://github.com/treasure-data/td-android-sdk). 6 | 7 | ## Installation 8 | 9 | You can install react-native-td into your project in the following way. 10 | 11 | ```sh 12 | npm install --save react-native-td 13 | react-native link react-native-td 14 | ``` 15 | 16 | ### iOS configuration 17 | 18 | If you haven't introduced cocoapods, install it and run `pod init` under `ios/`and make sure lines below are in `Podfile`. 19 | 20 | ```diff 21 | + pod 'React', :path => '../node_modules/react-native', :subspecs => [ 22 | + 'Core', 23 | + 'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43 24 | + 'RCTText', 25 | + 'RCTNetwork', 26 | + 'RCTWebSocket', # needed for debugging 27 | + ] 28 | + pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga' 29 | + pod 'RNTreasureData', :path => '../node_modules/react-native-td' 30 | ``` 31 | 32 | ## Usage 33 | 34 | Basically react-native-td imitates the interface of TreasureData iOS/Android SDK as close as possible. 35 | 36 | Hence to know more detail check official documents below. 37 | 38 | - iOS: https://docs.treasuredata.com/articles/ios-sdk 39 | - Android: https://docs.treasuredata.com/articles/android-sdk 40 | 41 | ### Instantiate with your API key 42 | 43 | ```ts 44 | import TreasureData from "react-native-td"; 45 | 46 | TreasureData.initialize("your API key"); 47 | ``` 48 | 49 | We recommend to use a write-only API key for the SDK. To obtain one, please: 50 | 51 | 1. Login to the Treasure Data Console at http://console.treasuredata.com; 52 | 2. Visit your Profile page at http://console.treasuredata.com/users/current; 53 | 3. Insert your password under the 'API Keys' panel; 54 | 4. In the bottom part of the panel, under 'Write-Only API keys', either copy the API key or click on 'Generate New' and copy the new API key. 55 | 56 | ### Add a event to local buffer 57 | 58 | To add an event to local buffer, you can call `addEvent` or `addEventWithCallback` API. 59 | 60 | ```ts 61 | TreasureData.addEventWithCallback( 62 | { event: "event_name" }, 63 | "database_name", 64 | "record_name", 65 | () => { 66 | console.log("onSuccess is called."); 67 | }, 68 | (error, message) => { 69 | console.log(`Error: ${error}`); 70 | console.log(`Message: ${message}`); 71 | } 72 | ); 73 | ``` 74 | 75 | Or simply: 76 | 77 | ```ts 78 | TreasureData.addEvent("database_name", "table_name", { event: "event_name" }); 79 | ``` 80 | 81 | ### Upload buffered events to Treasure Data 82 | 83 | To upload events buffered events to Treasure Data, you can call `uploadEvents` or `uploadEventsWithCallback` API. 84 | 85 | ```ts 86 | TreasureData.uploadEventsWithCallback( 87 | () => { 88 | console.log("onSuccess is called."); 89 | }, 90 | (error, message) => { 91 | console.log(`Error: ${error}`); 92 | console.log(`Message: ${message}`); 93 | } 94 | ); 95 | ``` 96 | 97 | Or simply: 98 | 99 | ```ts 100 | TreasureData.uploadEvents(); 101 | ``` 102 | 103 | ### Start/End session 104 | 105 | ```ts 106 | TreasureData.startSession("table_name"); 107 | 108 | TreasureData.endSession("table_name"); 109 | ``` 110 | 111 | If you want to handle the following case, use a pair of methods `startSession` and `endSession` for global session tracking. 112 | 113 | * User opens the application and starts session tracking using startSession 114 | * User moves to home screen and finishes the session using endSession 115 | * User reopens the application and restarts session tracking within default 10 seconds. But you want to deal with this new session as the same session. 116 | 117 | ```ts 118 | TreasureData.setSessionTimeoutMilli(30 * 1000); // Default is 10 seconds 119 | 120 | TreasureData.startSession(); 121 | 122 | TreasureData.endSession(); 123 | ``` 124 | 125 | In this case, you can get the current session ID using `getSessionId`. 126 | 127 | ```ts 128 | TreasureData.getSessionId().then(sessionId => { 129 | console.log(sessionId); 130 | }); 131 | ``` 132 | 133 | ### Detect if it's the first running 134 | 135 | You can detect if it's the first running or not easily using `isFirstRun` method and then clear the flag with `clearFirstRun`. 136 | 137 | ```ts 138 | TreasureData.isFirstRun() 139 | .then(() => { 140 | TreasureData.clearFirstRun(); 141 | TreasureData.uploadEvents(); 142 | }) 143 | .catch(error => { 144 | console.log(error); 145 | }); 146 | ``` 147 | 148 | ## About Error code 149 | 150 | `addEventWithCallback` and `uploadEventsWithCallback` methods call back `onError` with errorCode argument. 151 | 152 | This argument is useful to know the cause type of the error. There are the following error codes. 153 | 154 | * `init_error` : The initialization failed. 155 | * `invalid_param` : The parameter passed to the API was invalid 156 | * `invalid_event` : The event was invalid 157 | * `data_conversion` : Failed to convert the data to/from JSON 158 | * `storage_error` : Failed to read/write data in the storage 159 | * `network_error` : Failed to communicate with the server due to network problem 160 | * `server_response` : The server returned an error response 161 | 162 | ## Additional Configuration 163 | 164 | ### Endpoint 165 | 166 | ```ts 167 | TreasureData.initializeApiEndpoint("https://in.treasuredata.com"); 168 | TreasureData.initialize("your API key"); 169 | ``` 170 | 171 | ### Encryption key 172 | 173 | ```ts 174 | TreasureData.initializeEncryptionKey("hello world"); 175 | ``` 176 | 177 | ### Default database 178 | 179 | ```ts 180 | TreasureData.setDefaultDatabase("default_db"); 181 | ``` 182 | 183 | ### Adding UUID of the device to each event automatically 184 | 185 | ```ts 186 | TreasureData.enableAutoAppendUniqId(); 187 | ``` 188 | 189 | ### Adding an UUID to each event record automatically 190 | 191 | ```ts 192 | TreasureData.enableAutoAppendRecordUUID(); 193 | ``` 194 | 195 | ### Adding device model information to each event automatically 196 | 197 | ```ts 198 | TreasureData.enableAutoAppendModelInformation(); 199 | ``` 200 | 201 | ### Adding application package version information to each event automatically 202 | 203 | ```ts 204 | TreasureData.enableAutoAppendAppInformation(); 205 | ``` 206 | 207 | ### Adding locale configuration information to each event automatically 208 | 209 | ```ts 210 | TreasureData.enableAutoAppendLocaleInformation(); 211 | ``` 212 | 213 | ### Use server side upload timestamp 214 | 215 | ```ts 216 | TreasureData.enableServerSideUploadTimestamp(); 217 | // Add server side upload time as a customized column name 218 | TreasureData.enableServerSideUploadTimestamp("server_upload_time"); 219 | ``` 220 | 221 | ### Enable/Disable debug log 222 | 223 | ```ts 224 | TreasureData.enableLogging(); 225 | TreasureData.disableLogging(); 226 | ``` 227 | -------------------------------------------------------------------------------- /RNTreasureData.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | package = JSON.parse(File.read('./package.json')) 3 | 4 | Pod::Spec.new do |s| 5 | s.name = "RNTreasureData" 6 | s.version = package["version"] 7 | s.summary = package["description"] 8 | s.description = <<-DESC 9 | An unofficial React Native SDK for Treasure Data. 10 | The module is a light-weight layer sitting on-top of the TreasureData SDK for both iOS and Android. 11 | DESC 12 | s.homepage = "https://github.com/quipper/react-native-td" 13 | s.license = package['license'] 14 | s.author = package['author'] 15 | s.platform = :ios, "7.0" 16 | s.source = { :git => 'https://github.com/quipper/react-native-td.git' } 17 | s.source_files = "ios/*.{h,m}" 18 | s.requires_arc = true 19 | 20 | s.dependency "TreasureData-iOS-SDK" 21 | s.dependency "React" 22 | end 23 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | } 10 | } 11 | 12 | apply plugin: 'com.android.library' 13 | 14 | android { 15 | compileSdkVersion 26 16 | buildToolsVersion '25.0.3' 17 | 18 | defaultConfig { 19 | minSdkVersion 16 20 | targetSdkVersion 26 21 | versionCode 1 22 | versionName "1.0" 23 | } 24 | lintOptions { 25 | abortOnError false 26 | } 27 | } 28 | 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | compile 'com.facebook.react:react-native:+' 35 | compile 'com.treasuredata:td-android-sdk:0.1.16' 36 | } 37 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Jan 06 13:56:14 JST 2018 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-4.1-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 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/java/com/github/quipper/rn/td/RNTreasureDataModule.java: -------------------------------------------------------------------------------- 1 | package com.github.quipper.rn.td; 2 | 3 | import com.facebook.react.bridge.Callback; 4 | import com.facebook.react.bridge.Promise; 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 7 | import com.facebook.react.bridge.ReactMethod; 8 | import com.facebook.react.bridge.ReadableMap; 9 | import com.treasuredata.android.TDCallback; 10 | import com.treasuredata.android.TreasureData; 11 | 12 | import java.util.Map; 13 | 14 | import javax.annotation.Nonnull; 15 | import javax.annotation.Nullable; 16 | 17 | import static com.github.quipper.rn.td.Utils.toHashMap; 18 | 19 | public final class RNTreasureDataModule extends ReactContextBaseJavaModule { 20 | 21 | RNTreasureDataModule(ReactApplicationContext reactContext) { 22 | super(reactContext); 23 | } 24 | 25 | @Override 26 | public String getName() { 27 | return "RNTreasureData"; 28 | } 29 | 30 | @Nullable 31 | @Override 32 | public Map getConstants() { 33 | return null; 34 | } 35 | 36 | @ReactMethod 37 | public void initialize(@Nonnull String apiKey) { 38 | TreasureData.initializeSharedInstance(getReactApplicationContext(), apiKey); 39 | } 40 | 41 | @ReactMethod 42 | public void initializeApiEndpoint(@Nonnull String apiEndpoint) { 43 | TreasureData.initializeApiEndpoint(apiEndpoint); 44 | } 45 | 46 | @ReactMethod 47 | public void initializeEncryptionKey(@Nonnull String encryptionKey) { 48 | TreasureData.initializeEncryptionKey(encryptionKey); 49 | } 50 | 51 | @ReactMethod 52 | public void setDefaultDatabase(@Nonnull String databse) { 53 | TreasureData.sharedInstance().setDefaultDatabase(databse); 54 | } 55 | 56 | @ReactMethod 57 | public void enableAutoAppendUniqId() { 58 | TreasureData.sharedInstance().enableAutoAppendUniqId(); 59 | } 60 | 61 | @ReactMethod 62 | public void disableAutoAppendUniqId() { 63 | TreasureData.sharedInstance().disableAutoAppendUniqId(); 64 | } 65 | 66 | @ReactMethod 67 | public void enableAutoAppendRecordUUID() { 68 | TreasureData.sharedInstance().enableAutoAppendRecordUUID(); 69 | } 70 | 71 | @ReactMethod 72 | public void enableAutoAppendRecordUUID(String column) { 73 | TreasureData.sharedInstance().enableAutoAppendRecordUUID(column); 74 | } 75 | 76 | @ReactMethod 77 | public void disableAutoAppendRecordUUID() { 78 | TreasureData.sharedInstance().disableAutoAppendRecordUUID(); 79 | } 80 | 81 | @ReactMethod 82 | public void enableAutoAppendModelInformation() { 83 | TreasureData.sharedInstance().enableAutoAppendModelInformation(); 84 | } 85 | 86 | @ReactMethod 87 | public void disableAutoAppendModelInformation() { 88 | TreasureData.sharedInstance().disableAutoAppendModelInformation(); 89 | } 90 | 91 | @ReactMethod 92 | public void enableAutoAppendAppInformation() { 93 | TreasureData.sharedInstance().enableAutoAppendAppInformation(); 94 | } 95 | 96 | @ReactMethod 97 | public void disableAutoAppendAppInformation() { 98 | TreasureData.sharedInstance().disableAutoAppendAppInformation(); 99 | } 100 | 101 | @ReactMethod 102 | public void enableAutoAppendLocaleInformation() { 103 | TreasureData.sharedInstance().enableAutoAppendLocaleInformation(); 104 | } 105 | 106 | @ReactMethod 107 | public void disableAutoAppendLocaleInformation() { 108 | TreasureData.sharedInstance().disableAutoAppendLocaleInformation(); 109 | } 110 | 111 | @ReactMethod 112 | public void enableServerSideUploadTimestamp() { 113 | TreasureData.sharedInstance().enableServerSideUploadTimestamp(); 114 | } 115 | 116 | @ReactMethod 117 | public void enableServerSideUploadTimestamp(String column) { 118 | TreasureData.sharedInstance().enableServerSideUploadTimestamp(column); 119 | } 120 | 121 | @ReactMethod 122 | public void disableServerSideUploadTimestamp() { 123 | TreasureData.sharedInstance().disableServerSideUploadTimestamp(); 124 | } 125 | 126 | @ReactMethod 127 | public void enableLogging() { 128 | TreasureData.enableLogging(); 129 | } 130 | 131 | @ReactMethod 132 | public void disableLogging() { 133 | TreasureData.disableLogging(); 134 | } 135 | 136 | @ReactMethod 137 | public void addEvent(ReadableMap record, String database, String table) { 138 | TreasureData.sharedInstance().addEvent(database, table, toHashMap(record)); 139 | } 140 | 141 | @ReactMethod 142 | public void addEvent(ReadableMap record, String table) { 143 | TreasureData.sharedInstance().addEvent(table, toHashMap(record)); 144 | } 145 | 146 | @ReactMethod 147 | public void addEventWithCallback(ReadableMap record, String database, String table, final Callback onSuccess, final Callback onError) { 148 | TreasureData.sharedInstance().addEventWithCallback(database, table, toHashMap(record), new TDCallback() { 149 | @Override 150 | public void onSuccess() { 151 | onSuccess.invoke(); 152 | } 153 | 154 | @Override 155 | public void onError(String errorCode, Exception e) { 156 | onError.invoke(errorCode, e.getMessage()); 157 | } 158 | }); 159 | } 160 | 161 | @ReactMethod 162 | public void addEventWithCallback(ReadableMap record, String table, final Callback onSuccess, final Callback onError) { 163 | TreasureData.sharedInstance().addEventWithCallback(table, toHashMap(record), new TDCallback() { 164 | @Override 165 | public void onSuccess() { 166 | onSuccess.invoke(); 167 | } 168 | 169 | @Override 170 | public void onError(String errorCode, Exception e) { 171 | onError.invoke(errorCode, e.getMessage()); 172 | } 173 | }); 174 | } 175 | 176 | @ReactMethod 177 | public void uploadEvents() { 178 | TreasureData.sharedInstance().uploadEvents(); 179 | } 180 | 181 | @ReactMethod 182 | public void uploadEventsWithCallback(final Callback onSuccess, final Callback onError) { 183 | TreasureData.sharedInstance().uploadEventsWithCallback(new TDCallback() { 184 | @Override 185 | public void onSuccess() { 186 | onSuccess.invoke(); 187 | } 188 | 189 | @Override 190 | public void onError(String errorCode, Exception e) { 191 | onError.invoke(errorCode, e.getMessage()); 192 | } 193 | }); 194 | } 195 | 196 | @ReactMethod 197 | public void startSession() { 198 | TreasureData.startSession(getReactApplicationContext()); 199 | } 200 | 201 | @ReactMethod 202 | public void startSession(String table) { 203 | TreasureData.sharedInstance().startSession(table); 204 | } 205 | 206 | @ReactMethod 207 | public void startSession(String table, String database) { 208 | TreasureData.sharedInstance().startSession(table, database); 209 | } 210 | 211 | @ReactMethod 212 | public void endSession() { 213 | TreasureData.endSession(getReactApplicationContext()); 214 | } 215 | 216 | @ReactMethod 217 | public void endSession(String table) { 218 | TreasureData.sharedInstance().endSession(table); 219 | } 220 | 221 | @ReactMethod 222 | public void endSession(String table, String database) { 223 | TreasureData.sharedInstance().endSession(table, database); 224 | } 225 | 226 | @ReactMethod 227 | public void getSessionId(Promise promise) { 228 | String sessionId = TreasureData.getSessionId(getReactApplicationContext()); 229 | if (sessionId == null) { 230 | promise.reject(new Throwable("sessionId == null")); 231 | } else { 232 | promise.resolve(sessionId); 233 | } 234 | } 235 | 236 | @ReactMethod 237 | public void isFirstRun(Promise promise) { 238 | boolean isFirstRun = TreasureData.sharedInstance().isFirstRun(getReactApplicationContext()); 239 | if (isFirstRun) { 240 | promise.resolve(null); 241 | } else { 242 | promise.reject(new Throwable("not first run")); 243 | } 244 | } 245 | 246 | @ReactMethod 247 | public void clearFirstRun() { 248 | TreasureData.sharedInstance().clearFirstRun(getReactApplicationContext()); 249 | } 250 | 251 | @ReactMethod 252 | public void setSessionTimeoutMilli(long to) { 253 | TreasureData.setSessionTimeoutMilli(to); 254 | } 255 | 256 | @ReactMethod 257 | public void enableRetryUploading() { 258 | TreasureData.sharedInstance().enableAutoRetryUploading(); 259 | } 260 | 261 | @ReactMethod 262 | public void disableRetryUploading() { 263 | TreasureData.sharedInstance().disableAutoRetryUploading(); 264 | } 265 | 266 | @ReactMethod 267 | public void enableEventCompression() { 268 | TreasureData.enableEventCompression(); 269 | } 270 | 271 | @ReactMethod 272 | public void disableEventCompression() { 273 | TreasureData.disableEventCompression(); 274 | } 275 | } -------------------------------------------------------------------------------- /android/src/main/java/com/github/quipper/rn/td/RNTreasureDataPackage.java: -------------------------------------------------------------------------------- 1 | package com.github.quipper.rn.td; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import com.facebook.react.ReactPackage; 7 | import com.facebook.react.bridge.NativeModule; 8 | import com.facebook.react.bridge.ReactApplicationContext; 9 | import com.facebook.react.uimanager.ViewManager; 10 | import com.facebook.react.bridge.JavaScriptModule; 11 | 12 | public final class RNTreasureDataPackage implements ReactPackage { 13 | 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Collections.singletonList(new RNTreasureDataModule(reactContext)); 17 | } 18 | 19 | // Deprecated from RN 0.47 20 | public List> createJSModules() { 21 | return Collections.emptyList(); 22 | } 23 | 24 | @Override 25 | public List createViewManagers(ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } -------------------------------------------------------------------------------- /android/src/main/java/com/github/quipper/rn/td/Utils.java: -------------------------------------------------------------------------------- 1 | package com.github.quipper.rn.td; 2 | 3 | import com.facebook.react.bridge.ReadableArray; 4 | import com.facebook.react.bridge.ReadableMap; 5 | import com.facebook.react.bridge.ReadableMapKeySetIterator; 6 | 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | 10 | final class Utils { 11 | 12 | private Utils() { 13 | throw new AssertionError(); 14 | } 15 | 16 | // https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java#L61 17 | static HashMap toHashMap(ReadableMap map) { 18 | HashMap hashMap = new HashMap<>(); 19 | ReadableMapKeySetIterator iterator = map.keySetIterator(); 20 | while (iterator.hasNextKey()) { 21 | String key = iterator.nextKey(); 22 | switch (map.getType(key)) { 23 | case Null: 24 | hashMap.put(key, null); 25 | break; 26 | case Boolean: 27 | hashMap.put(key, map.getBoolean(key)); 28 | break; 29 | case Number: 30 | hashMap.put(key, map.getDouble(key)); 31 | break; 32 | case String: 33 | hashMap.put(key, map.getString(key)); 34 | break; 35 | case Map: 36 | hashMap.put(key,toHashMap(map.getMap(key))); 37 | break; 38 | case Array: 39 | hashMap.put(key, toArrayList(map.getArray(key))); 40 | break; 41 | default: 42 | throw new IllegalArgumentException("Could not convert object with key: " + key + "."); 43 | } 44 | } 45 | return hashMap; 46 | } 47 | 48 | // https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeArray.java#L56 49 | private static ArrayList toArrayList(ReadableArray array) { 50 | ArrayList arrayList = new ArrayList<>(array.size()); 51 | for (int i = 0, size = array.size(); i < size; i++) { 52 | switch (array.getType(i)) { 53 | case Null: 54 | arrayList.add(null); 55 | break; 56 | case Boolean: 57 | arrayList.add(array.getBoolean(i)); 58 | break; 59 | case Number: 60 | arrayList.add(array.getDouble(i)); 61 | break; 62 | case String: 63 | arrayList.add(array.getString(i)); 64 | break; 65 | case Map: 66 | arrayList.add(toHashMap(array.getMap(i))); 67 | break; 68 | case Array: 69 | arrayList.add(toArrayList(array.getArray(i))); 70 | break; 71 | default: 72 | throw new IllegalArgumentException("Could not convert object at index: " + i + "."); 73 | } 74 | } 75 | return arrayList; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["babel-preset-react-native-stage-0/decorator-support"], 3 | "env": { 4 | "development": { 5 | "plugins": ["transform-react-jsx-source"] 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.rntreasuredataexample", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.rntreasuredataexample", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | project.ext.react = [ 76 | entryFile: "index.js" 77 | ] 78 | 79 | apply from: "../../node_modules/react-native/react.gradle" 80 | 81 | /** 82 | * Set this to true to create two separate APKs instead of one: 83 | * - An APK that only works on ARM devices 84 | * - An APK that only works on x86 devices 85 | * The advantage is the size of the APK is reduced by about 4MB. 86 | * Upload all the APKs to the Play Store and people will download 87 | * the correct one based on the CPU architecture of their device. 88 | */ 89 | def enableSeparateBuildPerCPUArchitecture = false 90 | 91 | /** 92 | * Run Proguard to shrink the Java bytecode in release builds. 93 | */ 94 | def enableProguardInReleaseBuilds = false 95 | 96 | android { 97 | compileSdkVersion 23 98 | buildToolsVersion "23.0.1" 99 | 100 | defaultConfig { 101 | applicationId "com.rntreasuredataexample" 102 | minSdkVersion 16 103 | targetSdkVersion 22 104 | versionCode 1 105 | versionName "1.0" 106 | ndk { 107 | abiFilters "armeabi-v7a", "x86" 108 | } 109 | } 110 | splits { 111 | abi { 112 | reset() 113 | enable enableSeparateBuildPerCPUArchitecture 114 | universalApk false // If true, also generate a universal APK 115 | include "armeabi-v7a", "x86" 116 | } 117 | } 118 | buildTypes { 119 | release { 120 | minifyEnabled enableProguardInReleaseBuilds 121 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 122 | } 123 | } 124 | // applicationVariants are e.g. debug, release 125 | applicationVariants.all { variant -> 126 | variant.outputs.each { output -> 127 | // For each separate APK per architecture, set a unique version code as described here: 128 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 129 | def versionCodes = ["armeabi-v7a":1, "x86":2] 130 | def abi = output.getFilter(OutputFile.ABI) 131 | if (abi != null) { // null for the universal-debug, universal-release variants 132 | output.versionCodeOverride = 133 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 134 | } 135 | } 136 | } 137 | packagingOptions { 138 | exclude 'META-INF/DEPENDENCIES' 139 | exclude 'META-INF/LICENSE' 140 | exclude 'META-INF/LICENSE.txt' 141 | exclude 'META-INF/license.txt' 142 | exclude 'META-INF/NOTICE' 143 | exclude 'META-INF/NOTICE.txt' 144 | exclude 'META-INF/notice.txt' 145 | exclude 'META-INF/ASL2.0' 146 | } 147 | } 148 | 149 | dependencies { 150 | compile project(':react-native-td') 151 | compile fileTree(dir: "libs", include: ["*.jar"]) 152 | compile "com.android.support:appcompat-v7:23.0.1" 153 | compile "com.facebook.react:react-native:+" // From node_modules 154 | } 155 | 156 | // Run this once to be able to run the application with BUCK 157 | // puts all compile dependencies into folder libs for BUCK to use 158 | task copyDownloadableDepsToLibs(type: Copy) { 159 | from configurations.compile 160 | into 'libs' 161 | } 162 | -------------------------------------------------------------------------------- /example/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 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/android/app/src/main/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/example/android/app/src/main/assets/.gitkeep -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/rntreasuredataexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.rntreasuredataexample; 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 "RNTreasureDataExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/rntreasuredataexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.rntreasuredataexample; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.github.quipper.rn.td.RNTreasureDataPackage; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage(), 27 | new RNTreasureDataPackage() 28 | ); 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RNTreasureDataExample 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/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:2.2.3' 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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quipper/react-native-td/84a1e05e978cc7c481335b5d16e0a3ffae304684/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/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.14.1-all.zip 6 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RNTreasureDataExample' 2 | include ':react-native-td' 3 | project(':react-native-td').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-td/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNTreasureDataExample", 3 | "displayName": "RNTreasureDataExample" 4 | } -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import TreasureData from 'react-native-td'; 3 | import App from './build/App'; 4 | 5 | TreasureData.initialize("your API key"); 6 | TreasureData.enableLogging(); 7 | TreasureData.enableAutoAppendUniqId(); 8 | TreasureData.enableAutoAppendModelInformation(); 9 | TreasureData.startSession(); 10 | 11 | AppRegistry.registerComponent('RNTreasureDataExample', () => App); 12 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'RNTreasureDataExample' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | pod 'yoga', path: '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec' 9 | pod 'React', path: '../node_modules/react-native' 10 | pod 'RNTreasureData', :path => '../node_modules/react-native-td' 11 | 12 | target 'RNTreasureDataExampleTests' do 13 | inherit! :search_paths 14 | # Pods for testing 15 | end 16 | end 17 | 18 | target 'RNTreasureDataExample-tvOS' do 19 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 20 | # use_frameworks! 21 | 22 | # Pods for RNTreasureDataExample-tvOS 23 | 24 | target 'RNTreasureDataExample-tvOSTests' do 25 | inherit! :search_paths 26 | # Pods for testing 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - KeenClientTD (3.2.32) 3 | - React (0.51.0): 4 | - React/Core (= 0.51.0) 5 | - React/Core (0.51.0): 6 | - yoga (= 0.51.0.React) 7 | - RNTreasureData (0.9.2): 8 | - TreasureData-iOS-SDK 9 | - TreasureData-iOS-SDK (0.1.24): 10 | - KeenClientTD (= 3.2.32) 11 | - yoga (0.51.0.React) 12 | 13 | DEPENDENCIES: 14 | - React (from `../node_modules/react-native`) 15 | - RNTreasureData (from `../node_modules/react-native-td`) 16 | - yoga (from `../node_modules/react-native/ReactCommon/yoga/Yoga.podspec`) 17 | 18 | EXTERNAL SOURCES: 19 | React: 20 | :path: ../node_modules/react-native 21 | RNTreasureData: 22 | :path: ../node_modules/react-native-td 23 | yoga: 24 | :path: ../node_modules/react-native/ReactCommon/yoga/Yoga.podspec 25 | 26 | SPEC CHECKSUMS: 27 | KeenClientTD: 66da83b01742f4983925391e70b5beecb4096bd1 28 | React: 541ba768b9855e10cdc76f55427a5cd0653ca806 29 | RNTreasureData: c40d07b95e5f734c91ca1e6beb2576e5a9f2602d 30 | TreasureData-iOS-SDK: e8b6d8cde3807c4ad600eb132227fb4eb20762bd 31 | yoga: 17521bbb0dd54a47c0b3ac43253e78cdac7488e0 32 | 33 | PODFILE CHECKSUM: e5e8f54f971ee927a3ed7a5d8cafd10544618bfe 34 | 35 | COCOAPODS: 1.4.0 36 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample-tvOS/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 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample-tvOSTests/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 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample.xcodeproj/xcshareddata/xcschemes/RNTreasureDataExample-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample.xcodeproj/xcshareddata/xcschemes/RNTreasureDataExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/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 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/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 13 | #import 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"RNTreasureDataExample" 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 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/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 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/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 | } -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | RNTreasureDataExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExample/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 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExampleTests/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 | -------------------------------------------------------------------------------- /example/ios/RNTreasureDataExampleTests/RNTreasureDataExampleTests.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 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface RNTreasureDataExampleTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation RNTreasureDataExampleTests 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 = [[[RCTSharedApplication() 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 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNTreasureDataExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "tsc": "tsc", 8 | "clean": "rimraf artifacts", 9 | "build": "yarn run clean && yarn run tsc", 10 | "watch": "yarn run build -w", 11 | "build:ios": "react-native bundle --entry-file='./index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'", 12 | "build:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res", 13 | "start:ios": "yarn run build && concurrently -r 'yarn run watch' 'react-native run-ios'", 14 | "start:android": "yarn run build && concurrently -r 'yarn run watch' 'react-native run-android'", 15 | "test": "jest" 16 | }, 17 | "dependencies": { 18 | "react": "^16.0.0", 19 | "react-native": "0.51.0", 20 | "react-native-td": "0.9.3" 21 | }, 22 | "devDependencies": { 23 | "@types/jest": "^21.1.1", 24 | "@types/react": "^16.0.7", 25 | "babel-jest": "22.0.4", 26 | "babel-preset-react-native": "4.0.0", 27 | "babel-preset-react-native-stage-0": "^1.0.1", 28 | "concurrently": "^3.5.1", 29 | "jest": "22.0.4", 30 | "react-test-renderer": "16.0.0", 31 | "rimraf": "^2.6.2", 32 | "ts-jest": "^21.0.1", 33 | "typescript": "^2.6.1" 34 | }, 35 | "jest": { 36 | "preset": "react-native", 37 | "moduleFileExtensions": [ 38 | "ts", 39 | "tsx", 40 | "js" 41 | ], 42 | "transform": { 43 | "^.+\\.(js)$": "/node_modules/babel-jest", 44 | "\\.(ts|tsx)$": "/node_modules/ts-jest/preprocessor.js" 45 | }, 46 | "transformIgnorePatterns": [ 47 | "node_modules/(?!(jest-)?react-native)" 48 | ], 49 | "testRegex": "(/__tests__/.*|(Test))\\.(ts|tsx)$" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Platform, StyleSheet, Text, View } from 'react-native'; 3 | import TreasureData from 'react-native-td'; 4 | 5 | const instructions = Platform.select({ 6 | ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', 7 | android: 8 | 'Double tap R on your keyboard to reload,\n' + 9 | 'Shake or press menu button for dev menu', 10 | }); 11 | 12 | const styles = StyleSheet.create({ 13 | container: { 14 | flex: 1, 15 | justifyContent: 'center', 16 | alignItems: 'center', 17 | backgroundColor: '#F5FCFF', 18 | }, 19 | welcome: { 20 | fontSize: 20, 21 | textAlign: 'center', 22 | margin: 10, 23 | }, 24 | instructions: { 25 | textAlign: 'center', 26 | color: '#333333', 27 | marginBottom: 5, 28 | }, 29 | }); 30 | 31 | export default class App extends Component { 32 | constructor(props) { 33 | super(props); 34 | } 35 | 36 | componentDidMount() { 37 | TreasureData.addEventWithCallback( 38 | { event: 'event_name' }, 39 | 'database_name', 40 | 'record_name', 41 | () => { 42 | console.log('onSuccess is called.'); 43 | }, 44 | (error, message) => { 45 | console.log(`Error: ${error}`, `Message: ${message}`); 46 | }, 47 | ); 48 | } 49 | 50 | componentWillUnmount() { 51 | TreasureData.isFirstRun() 52 | .then(() => { 53 | TreasureData.clearFirstRun(); 54 | TreasureData.uploadEventsWithCallback( 55 | () => { 56 | console.log('onSuccess is called.'); 57 | }, 58 | (error, message) => { 59 | console.log(`Error: ${error}`, `Message: ${message}`); 60 | }, 61 | ); 62 | }) 63 | .catch((error) => { 64 | console.log(error); 65 | }); 66 | } 67 | 68 | render() { 69 | return ( 70 | 71 | react-native-td example 72 | {instructions} 73 | 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "emitDecoratorMetadata": true, 4 | "experimentalDecorators": true, 5 | "target": "es2015", 6 | "module": "es2015", 7 | "moduleResolution": "node", 8 | "jsx": "react", 9 | "outDir": "build", 10 | "rootDir": "src", 11 | "allowSyntheticDefaultImports": true, 12 | "noImplicitAny": false, 13 | "preserveConstEnums": true, 14 | "allowJs": false, 15 | "sourceMap": true, 16 | "noImplicitReturns": true, 17 | "noUnusedParameters": true, 18 | "noUnusedLocals": true, 19 | "skipLibCheck": true 20 | }, 21 | "filesGlob": [ 22 | "typings/index.d.ts", 23 | "src/**/*.ts", 24 | "src/**/*.tsx" 25 | ], 26 | "types": [ 27 | "react", 28 | "react-native", 29 | "jest" 30 | ], 31 | "exclude": [ 32 | "android", 33 | "ios", 34 | "build", 35 | "node_modules" 36 | ], 37 | "compileOnSave": false 38 | } -------------------------------------------------------------------------------- /ios/RNTreasureData.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface RNTreasureData : NSObject 5 | 6 | @end 7 | 8 | -------------------------------------------------------------------------------- /ios/RNTreasureData.m: -------------------------------------------------------------------------------- 1 | #import "RNTreasureData.h" 2 | #import 3 | #import 4 | 5 | @implementation RNTreasureData 6 | 7 | RCT_EXPORT_MODULE() 8 | 9 | - (NSDictionary *)constantsToExport 10 | { 11 | return nil; 12 | } 13 | 14 | + (BOOL)requiresMainQueueSetup 15 | { 16 | return YES; 17 | } 18 | 19 | RCT_EXPORT_METHOD(initialize: 20 | (NSString *) apiKey) 21 | { 22 | [TreasureData initializeWithApiKey:apiKey]; 23 | } 24 | 25 | RCT_EXPORT_METHOD(initializeApiEndpoint: 26 | (NSString *) apiEndpoint) 27 | { 28 | [TreasureData initializeApiEndpoint:apiEndpoint]; 29 | } 30 | 31 | RCT_EXPORT_METHOD(initializeEncryptionKey: 32 | (NSString *) encryptionKey) 33 | { 34 | [TreasureData initializeEncryptionKey:encryptionKey]; 35 | } 36 | 37 | RCT_EXPORT_METHOD(setDefaultDatabase: 38 | (NSString *) defaultDatabase) 39 | { 40 | [[TreasureData sharedInstance] setDefaultDatabase:defaultDatabase]; 41 | } 42 | 43 | RCT_EXPORT_METHOD(enableAutoAppendUniqId) 44 | { 45 | [[TreasureData sharedInstance] enableAutoAppendUniqId]; 46 | } 47 | 48 | RCT_EXPORT_METHOD(disableAutoAppendUniqId) 49 | { 50 | [[TreasureData sharedInstance] disableAutoAppendUniqId]; 51 | } 52 | 53 | RCT_EXPORT_METHOD(enableAutoAppendRecordUUID) 54 | { 55 | [[TreasureData sharedInstance] enableAutoAppendRecordUUID]; 56 | } 57 | 58 | RCT_EXPORT_METHOD(enableAutoAppendRecordUUID: 59 | (NSString *) column) 60 | { 61 | [[TreasureData sharedInstance] enableAutoAppendRecordUUID:column]; 62 | } 63 | 64 | RCT_EXPORT_METHOD(disableAutoAppendRecordUUID) 65 | { 66 | [[TreasureData sharedInstance] disableAutoAppendRecordUUID]; 67 | } 68 | 69 | RCT_EXPORT_METHOD(enableAutoAppendModelInformation) 70 | { 71 | [[TreasureData sharedInstance] enableAutoAppendModelInformation]; 72 | } 73 | 74 | RCT_EXPORT_METHOD(disableAutoAppendModelInformation) 75 | { 76 | [[TreasureData sharedInstance] disableAutoAppendModelInformation]; 77 | } 78 | 79 | RCT_EXPORT_METHOD(enableAutoAppendAppInformation) 80 | { 81 | [[TreasureData sharedInstance] enableAutoAppendModelInformation]; 82 | } 83 | 84 | RCT_EXPORT_METHOD(disableAutoAppendAppInformation) 85 | { 86 | [[TreasureData sharedInstance] disableAutoAppendModelInformation]; 87 | } 88 | 89 | RCT_EXPORT_METHOD(enableAutoAppendLocaleInformation) 90 | { 91 | [[TreasureData sharedInstance] enableAutoAppendLocaleInformation]; 92 | } 93 | 94 | RCT_EXPORT_METHOD(disableAutoAppendLocaleInformation) 95 | { 96 | [[TreasureData sharedInstance] disableAutoAppendLocaleInformation]; 97 | } 98 | 99 | RCT_EXPORT_METHOD(enableServerSideUploadTimestamp) 100 | { 101 | [[TreasureData sharedInstance] enableServerSideUploadTimestamp]; 102 | } 103 | 104 | RCT_EXPORT_METHOD(enableServerSideUploadTimestamp: 105 | (NSString *) column) 106 | { 107 | [[TreasureData sharedInstance] enableServerSideUploadTimestamp:column]; 108 | } 109 | 110 | RCT_EXPORT_METHOD(disableServerSideUploadTimestamp) 111 | { 112 | [[TreasureData sharedInstance] disableServerSideUploadTimestamp]; 113 | } 114 | 115 | RCT_EXPORT_METHOD(enableLogging) 116 | { 117 | [TreasureData enableLogging]; 118 | } 119 | 120 | RCT_EXPORT_METHOD(disableLogging) 121 | { 122 | [TreasureData disableLogging]; 123 | } 124 | 125 | RCT_EXPORT_METHOD(enableRetryUploading) 126 | { 127 | [[TreasureData sharedInstance] enableRetryUploading]; 128 | } 129 | 130 | RCT_EXPORT_METHOD(disableRetryUploading) 131 | { 132 | [[TreasureData sharedInstance] disableRetryUploading]; 133 | } 134 | 135 | RCT_EXPORT_METHOD(enableEventCompression) 136 | { 137 | [TreasureData enableEventCompression]; 138 | } 139 | 140 | RCT_EXPORT_METHOD(disableEventCompression) 141 | { 142 | [TreasureData disableEventCompression]; 143 | } 144 | 145 | RCT_EXPORT_METHOD(addEvent: 146 | (NSDictionary *)record database:(NSString *)database table:(NSString *)table) 147 | { 148 | [[TreasureData sharedInstance] addEvent:record database:database table:table]; 149 | } 150 | 151 | RCT_EXPORT_METHOD(addEvent: 152 | (NSDictionary *)record table:(NSString *)table) 153 | { 154 | [[TreasureData sharedInstance] addEvent:record table:table]; 155 | } 156 | 157 | RCT_EXPORT_METHOD(addEventWithCallback: 158 | (NSDictionary *)record 159 | database:(nullable NSString *)database 160 | table:(NSString *) table 161 | onSuccess:(RCTResponseSenderBlock) onSuccess 162 | onError:(RCTResponseSenderBlock) onError) 163 | { 164 | 165 | if (database) { 166 | [[TreasureData sharedInstance] 167 | addEventWithCallback:record 168 | database:database 169 | table:table 170 | onSuccess:^(){ 171 | onSuccess(nil); 172 | } 173 | onError:^(NSString* errorCode, NSString* message) { 174 | onError(@[errorCode, message]); 175 | } 176 | ]; 177 | } else { 178 | [[TreasureData sharedInstance] 179 | addEventWithCallback:record 180 | table:table 181 | onSuccess:^(){ 182 | onSuccess(nil); 183 | } 184 | onError:^(NSString* errorCode, NSString* message) { 185 | onError(@[errorCode, message]); 186 | } 187 | ]; 188 | } 189 | } 190 | 191 | RCT_EXPORT_METHOD(uploadEvents) 192 | { 193 | [[TreasureData sharedInstance] uploadEvents]; 194 | } 195 | 196 | RCT_EXPORT_METHOD(uploadEventsWithCallback: 197 | (RCTResponseSenderBlock) onSuccess 198 | onError:(RCTResponseSenderBlock) onError) 199 | { 200 | [[TreasureData sharedInstance] 201 | uploadEventsWithCallback: 202 | ^(){ 203 | onSuccess(nil); 204 | } 205 | onError:^(NSString* errorCode, NSString* message) { 206 | onError(@[errorCode, message]); 207 | } 208 | ]; 209 | } 210 | 211 | RCT_EXPORT_METHOD(startSession) 212 | { 213 | [TreasureData startSession]; 214 | } 215 | 216 | RCT_EXPORT_METHOD(startSession: 217 | (NSString *)table) 218 | { 219 | [[TreasureData sharedInstance] startSession:table]; 220 | } 221 | 222 | RCT_EXPORT_METHOD(startSession: 223 | (NSString *)table database:(NSString *)database) 224 | { 225 | [[TreasureData sharedInstance] startSession:table database: database]; 226 | } 227 | 228 | RCT_EXPORT_METHOD(endSession) 229 | { 230 | [TreasureData endSession]; 231 | } 232 | 233 | RCT_EXPORT_METHOD(endSession: 234 | (NSString *)table) 235 | { 236 | [[TreasureData sharedInstance] endSession:table]; 237 | } 238 | 239 | RCT_EXPORT_METHOD(endSession: 240 | (NSString *)table database:(NSString *)database) 241 | { 242 | [[TreasureData sharedInstance] endSession:table database: database]; 243 | } 244 | 245 | RCT_EXPORT_METHOD(getSessionId: 246 | (RCTPromiseResolveBlock)resolve 247 | reject:(RCTPromiseRejectBlock)reject) 248 | { 249 | NSString *sessionId = [TreasureData getSessionId]; 250 | if (sessionId) { 251 | resolve(sessionId); 252 | } else { 253 | reject(RCTErrorUnspecified, @"sessionId is nil", nil); 254 | } 255 | } 256 | 257 | RCT_EXPORT_METHOD(isFirstRun: 258 | (RCTPromiseResolveBlock)resolve 259 | reject:(RCTPromiseRejectBlock)reject) 260 | { 261 | BOOL isFirstRun = [[TreasureData sharedInstance] isFirstRun]; 262 | if (isFirstRun) { 263 | resolve(nil); 264 | } else { 265 | reject(RCTErrorUnspecified, nil, nil); 266 | } 267 | } 268 | 269 | RCT_EXPORT_METHOD(clearFirstRun) 270 | { 271 | [[TreasureData sharedInstance] clearFirstRun]; 272 | } 273 | 274 | RCT_EXPORT_METHOD(setSessionTimeoutMilli: 275 | (NSNumber *)to) 276 | { 277 | [TreasureData setSessionTimeoutMilli:(long)to]; 278 | } 279 | 280 | @end 281 | -------------------------------------------------------------------------------- /ios/RNTreasureData.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3E7B58A1CC2AC0600A0062D /* RNTreasureData.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNTreasureData.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 134814201AA4EA6300B7C361 /* libRNTreasureData.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNTreasureData.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | B3E7B5881CC2AC0600A0062D /* RNTreasureData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNTreasureData.h; sourceTree = ""; }; 28 | B3E7B5891CC2AC0600A0062D /* RNTreasureData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTreasureData.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 134814211AA4EA7D00B7C361 /* Products */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 134814201AA4EA6300B7C361 /* libRNTreasureData.a */, 46 | ); 47 | name = Products; 48 | sourceTree = ""; 49 | }; 50 | 58B511D21A9E6C8500147676 = { 51 | isa = PBXGroup; 52 | children = ( 53 | B3E7B5881CC2AC0600A0062D /* RNTreasureData.h */, 54 | B3E7B5891CC2AC0600A0062D /* RNTreasureData.m */, 55 | 134814211AA4EA7D00B7C361 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | /* End PBXGroup section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 58B511DA1A9E6C8500147676 /* RNTreasureData */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNTreasureData" */; 65 | buildPhases = ( 66 | 58B511D71A9E6C8500147676 /* Sources */, 67 | 58B511D81A9E6C8500147676 /* Frameworks */, 68 | 58B511D91A9E6C8500147676 /* CopyFiles */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = RNTreasureData; 75 | productName = RCTDataManager; 76 | productReference = 134814201AA4EA6300B7C361 /* libRNTreasureData.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 58B511D31A9E6C8500147676 /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0830; 86 | ORGANIZATIONNAME = Facebook; 87 | TargetAttributes = { 88 | 58B511DA1A9E6C8500147676 = { 89 | CreatedOnToolsVersion = 6.1.1; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNTreasureData" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = English; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | ); 100 | mainGroup = 58B511D21A9E6C8500147676; 101 | productRefGroup = 58B511D21A9E6C8500147676; 102 | projectDirPath = ""; 103 | projectRoot = ""; 104 | targets = ( 105 | 58B511DA1A9E6C8500147676 /* RNTreasureData */, 106 | ); 107 | }; 108 | /* End PBXProject section */ 109 | 110 | /* Begin PBXSourcesBuildPhase section */ 111 | 58B511D71A9E6C8500147676 /* Sources */ = { 112 | isa = PBXSourcesBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | B3E7B58A1CC2AC0600A0062D /* RNTreasureData.m in Sources */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXSourcesBuildPhase section */ 120 | 121 | /* Begin XCBuildConfiguration section */ 122 | 58B511ED1A9E6C8500147676 /* Debug */ = { 123 | isa = XCBuildConfiguration; 124 | buildSettings = { 125 | ALWAYS_SEARCH_USER_PATHS = NO; 126 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 127 | CLANG_CXX_LIBRARY = "libc++"; 128 | CLANG_ENABLE_MODULES = YES; 129 | CLANG_ENABLE_OBJC_ARC = YES; 130 | CLANG_WARN_BOOL_CONVERSION = YES; 131 | CLANG_WARN_CONSTANT_CONVERSION = YES; 132 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 133 | CLANG_WARN_EMPTY_BODY = YES; 134 | CLANG_WARN_ENUM_CONVERSION = YES; 135 | CLANG_WARN_INFINITE_RECURSION = YES; 136 | CLANG_WARN_INT_CONVERSION = YES; 137 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 138 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 139 | CLANG_WARN_UNREACHABLE_CODE = YES; 140 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 141 | COPY_PHASE_STRIP = NO; 142 | ENABLE_STRICT_OBJC_MSGSEND = YES; 143 | ENABLE_TESTABILITY = YES; 144 | GCC_C_LANGUAGE_STANDARD = gnu99; 145 | GCC_DYNAMIC_NO_PIC = NO; 146 | GCC_NO_COMMON_BLOCKS = YES; 147 | GCC_OPTIMIZATION_LEVEL = 0; 148 | GCC_PREPROCESSOR_DEFINITIONS = ( 149 | "DEBUG=1", 150 | "$(inherited)", 151 | ); 152 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 153 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 154 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 155 | GCC_WARN_UNDECLARED_SELECTOR = YES; 156 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 157 | GCC_WARN_UNUSED_FUNCTION = YES; 158 | GCC_WARN_UNUSED_VARIABLE = YES; 159 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 160 | MTL_ENABLE_DEBUG_INFO = YES; 161 | ONLY_ACTIVE_ARCH = YES; 162 | SDKROOT = iphoneos; 163 | }; 164 | name = Debug; 165 | }; 166 | 58B511EE1A9E6C8500147676 /* Release */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 171 | CLANG_CXX_LIBRARY = "libc++"; 172 | CLANG_ENABLE_MODULES = YES; 173 | CLANG_ENABLE_OBJC_ARC = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INFINITE_RECURSION = YES; 180 | CLANG_WARN_INT_CONVERSION = YES; 181 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 182 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 183 | CLANG_WARN_UNREACHABLE_CODE = YES; 184 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 185 | COPY_PHASE_STRIP = YES; 186 | ENABLE_NS_ASSERTIONS = NO; 187 | ENABLE_STRICT_OBJC_MSGSEND = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu99; 189 | GCC_NO_COMMON_BLOCKS = YES; 190 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 191 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 192 | GCC_WARN_UNDECLARED_SELECTOR = YES; 193 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 194 | GCC_WARN_UNUSED_FUNCTION = YES; 195 | GCC_WARN_UNUSED_VARIABLE = YES; 196 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 197 | MTL_ENABLE_DEBUG_INFO = NO; 198 | SDKROOT = iphoneos; 199 | VALIDATE_PRODUCT = YES; 200 | }; 201 | name = Release; 202 | }; 203 | 58B511F01A9E6C8500147676 /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | HEADER_SEARCH_PATHS = ( 207 | "$(inherited)", 208 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 209 | "$(SRCROOT)/../../../React/**", 210 | "$(SRCROOT)/../../react-native/React/**", 211 | ); 212 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 213 | OTHER_LDFLAGS = "-ObjC"; 214 | PRODUCT_NAME = RNTreasureData; 215 | SKIP_INSTALL = YES; 216 | }; 217 | name = Debug; 218 | }; 219 | 58B511F11A9E6C8500147676 /* Release */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | HEADER_SEARCH_PATHS = ( 223 | "$(inherited)", 224 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 225 | "$(SRCROOT)/../../../React/**", 226 | "$(SRCROOT)/../../react-native/React/**", 227 | ); 228 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 229 | OTHER_LDFLAGS = "-ObjC"; 230 | PRODUCT_NAME = RNTreasureData; 231 | SKIP_INSTALL = YES; 232 | }; 233 | name = Release; 234 | }; 235 | /* End XCBuildConfiguration section */ 236 | 237 | /* Begin XCConfigurationList section */ 238 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNTreasureData" */ = { 239 | isa = XCConfigurationList; 240 | buildConfigurations = ( 241 | 58B511ED1A9E6C8500147676 /* Debug */, 242 | 58B511EE1A9E6C8500147676 /* Release */, 243 | ); 244 | defaultConfigurationIsVisible = 0; 245 | defaultConfigurationName = Release; 246 | }; 247 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNTreasureData" */ = { 248 | isa = XCConfigurationList; 249 | buildConfigurations = ( 250 | 58B511F01A9E6C8500147676 /* Debug */, 251 | 58B511F11A9E6C8500147676 /* Release */, 252 | ); 253 | defaultConfigurationIsVisible = 0; 254 | defaultConfigurationName = Release; 255 | }; 256 | /* End XCConfigurationList section */ 257 | }; 258 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 259 | } 260 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-td", 3 | "version": "0.9.3", 4 | "description": "An unofficial React Native SDK for Treasure Data.", 5 | "main": "build/index.js", 6 | "types": "build/index.d.ts", 7 | "scripts": { 8 | "tsc": "tsc", 9 | "lint": "tslint --project tsconfig.json" 10 | }, 11 | "author": "Shintaro Katafuchi", 12 | "bugs": "https://github.com/quipper/react-native-td/issues", 13 | "license": "APACHE-2.0", 14 | "keywords": [ 15 | "react-native", 16 | "treasure-data" 17 | ], 18 | "peerDependencies": { 19 | "react": "^16.0.0", 20 | "react-native": "0.51.0" 21 | }, 22 | "devDependencies": { 23 | "@types/react": "^16.0.7", 24 | "@types/react-native": "^0.48.9", 25 | "tslint": "^5.8.0", 26 | "typescript": "^2.6.1" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/declarations.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-native-td'; -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { NativeModules } from 'react-native'; 2 | 3 | export type ErrorCode = 4 | | 'init_error' 5 | | 'invalid_param' 6 | | 'invalid_event' 7 | | 'data_conversion' 8 | | 'storage_error' 9 | | 'network_error' 10 | | 'server_response'; 11 | 12 | export interface TreasureData { 13 | initialize: (apiKey: string) => void; 14 | initializeApiEndpoint: (apiEndpoint: string) => void; 15 | initializeEncryptionKey: (encryptionKey: string) => void; 16 | setDefaultDatabase: (database: string) => void; 17 | enableAutoAppendUniqId: () => void; 18 | disableAutoAppendUniqId: () => void; 19 | enableAutoAppendRecordUUID: (column: string) => void; 20 | disableAutoAppendRecordUUID: () => void; 21 | enableAutoAppendModelInformation: () => void; 22 | disableAutoAppendModelInformation: () => void; 23 | enableAutoAppendAppInformation: () => void; 24 | disableAutoAppendAppInformation: () => void; 25 | enableAutoAppendLocaleInformation: () => void; 26 | disableAutoAppendLocaleInformation: () => void; 27 | enableServerSideUploadTimestamp: (column: string) => void; 28 | disableServerSideUploadTimestamp: () => void; 29 | enableLogging: () => void; 30 | disableLogging: () => void; 31 | enableRetryUploading: () => void; 32 | disableRetryUploading: () => void; 33 | enableEventCompression: () => void; 34 | disableEventCompression: () => void; 35 | addEvent: (record: object, database: string | undefined | null, table: string) => void; 36 | addEventWithCallback: ( 37 | record: object, 38 | database: string | undefined | null, 39 | table: string, 40 | onSuccess: () => void, 41 | onError: (errorCode: ErrorCode, message: string | undefined | null) => void, 42 | ) => void; 43 | uploadEvents: () => void; 44 | uploadEventsWithCallback: ( 45 | onSuccess: () => void, 46 | onError: (errorCode: ErrorCode, message: string | undefined | null) => void, 47 | ) => void; 48 | startSession: (table: string, database: string) => void; 49 | endSession: (table: string, database: string) => void; 50 | getSessionId: () => Promise; 51 | isFirstRun: () => Promise; 52 | clearFirstRun: () => void; 53 | setSessionTimeoutMilli: (to: number) => void; 54 | } 55 | 56 | // tslint:disable-next-line:no-object-literal-type-assertion 57 | const TreasureData: TreasureData = {} as TreasureData; 58 | const { RNTreasureData } = NativeModules; 59 | 60 | TreasureData.initialize = (apiKey: string) => { 61 | return RNTreasureData.initialize(apiKey); 62 | }; 63 | 64 | TreasureData.initializeApiEndpoint = (apiEndpoint: string) => { 65 | return RNTreasureData.initializeApiEndpoint(apiEndpoint); 66 | }; 67 | 68 | TreasureData.initializeEncryptionKey = (encryptionKey: string) => { 69 | return RNTreasureData.initializeEncryptionKey(encryptionKey); 70 | }; 71 | 72 | TreasureData.setDefaultDatabase = (database: string) => { 73 | return RNTreasureData.setDefaultDatabase(database); 74 | }; 75 | 76 | TreasureData.enableAutoAppendUniqId = () => { 77 | return RNTreasureData.enableAutoAppendUniqId(); 78 | }; 79 | 80 | TreasureData.disableAutoAppendUniqId = () => { 81 | return RNTreasureData.disableAutoAppendUniqId(); 82 | }; 83 | 84 | TreasureData.enableAutoAppendRecordUUID = () => { 85 | return RNTreasureData.enableAutoAppendRecordUUID(); 86 | }; 87 | 88 | TreasureData.enableAutoAppendRecordUUID = (column: string) => { 89 | return RNTreasureData.enableAutoAppendRecordUUID(column); 90 | }; 91 | 92 | TreasureData.disableAutoAppendRecordUUID = () => { 93 | return RNTreasureData.disableAutoAppendRecordUUID(); 94 | }; 95 | 96 | TreasureData.enableAutoAppendModelInformation = () => { 97 | return RNTreasureData.enableAutoAppendModelInformation(); 98 | }; 99 | 100 | TreasureData.disableAutoAppendModelInformation = () => { 101 | return RNTreasureData.disableAutoAppendModelInformation(); 102 | }; 103 | 104 | TreasureData.enableAutoAppendAppInformation = () => { 105 | return RNTreasureData.enableAutoAppendAppInformation(); 106 | }; 107 | 108 | TreasureData.disableAutoAppendAppInformation = () => { 109 | return RNTreasureData.disableAutoAppendAppInformation(); 110 | }; 111 | 112 | TreasureData.enableAutoAppendLocaleInformation = () => { 113 | return RNTreasureData.enableAutoAppendLocaleInformation(); 114 | }; 115 | 116 | TreasureData.disableAutoAppendLocaleInformation = () => { 117 | return RNTreasureData.disableAutoAppendLocaleInformation(); 118 | }; 119 | 120 | TreasureData.enableServerSideUploadTimestamp = () => { 121 | return RNTreasureData.enableServerSideUploadTimestamp(); 122 | }; 123 | 124 | TreasureData.enableServerSideUploadTimestamp = (column: string) => { 125 | return RNTreasureData.enableServerSideUploadTimestamp(column); 126 | }; 127 | 128 | TreasureData.disableServerSideUploadTimestamp = () => { 129 | return RNTreasureData.disableServerSideUploadTimestamp(); 130 | }; 131 | 132 | TreasureData.enableLogging = () => { 133 | return RNTreasureData.enableLogging(); 134 | }; 135 | 136 | TreasureData.disableLogging = () => { 137 | return RNTreasureData.disableLogging(); 138 | }; 139 | 140 | TreasureData.enableRetryUploading = () => { 141 | return RNTreasureData.enableRetryUploading(); 142 | }; 143 | 144 | TreasureData.disableRetryUploading = () => { 145 | return RNTreasureData.disableRetryUploading(); 146 | }; 147 | 148 | TreasureData.enableEventCompression = () => { 149 | return RNTreasureData.enableEventCompression(); 150 | }; 151 | 152 | TreasureData.disableEventCompression = () => { 153 | return RNTreasureData.disableEventCompression(); 154 | }; 155 | 156 | TreasureData.addEvent = (record: object, database: string | undefined | null, table: string) => { 157 | if (database) { 158 | return RNTreasureData.addEvent(record, database, table); 159 | } else { 160 | return RNTreasureData.addEvent(record, table); 161 | } 162 | }; 163 | 164 | TreasureData.addEventWithCallback = ( 165 | record: object, 166 | database: string | undefined | null, 167 | table: string, 168 | onSuccess: () => void, 169 | onError: (errorCode: ErrorCode, message: string | undefined | null) => void, 170 | ) => { 171 | if (database) { 172 | return RNTreasureData.addEventWithCallback( 173 | record, 174 | database, 175 | table, 176 | onSuccess, 177 | onError, 178 | ); 179 | } else { 180 | return RNTreasureData.addEventWithCallback( 181 | record, 182 | table, 183 | onSuccess, 184 | onError, 185 | ); 186 | } 187 | }; 188 | 189 | TreasureData.uploadEvents = () => { 190 | return RNTreasureData.uploadEvents(); 191 | }; 192 | 193 | TreasureData.uploadEventsWithCallback = ( 194 | onSuccess: () => void, 195 | onError: (errorCode: ErrorCode, message: string | undefined | null) => void, 196 | ) => { 197 | return RNTreasureData.uploadEventsWithCallback(onSuccess, onError); 198 | }; 199 | 200 | TreasureData.startSession = () => { 201 | return RNTreasureData.startSession(); 202 | }; 203 | 204 | TreasureData.startSession = (table: string) => { 205 | return RNTreasureData.startSession(table); 206 | }; 207 | 208 | TreasureData.startSession = (table: string, database: string) => { 209 | return RNTreasureData.startSession(table, database); 210 | }; 211 | 212 | TreasureData.endSession = () => { 213 | return RNTreasureData.endSession(); 214 | }; 215 | 216 | TreasureData.endSession = (table: string) => { 217 | return RNTreasureData.endSession(table); 218 | }; 219 | 220 | TreasureData.endSession = (table: string, database: string) => { 221 | return RNTreasureData.endSession(table, database); 222 | }; 223 | 224 | TreasureData.getSessionId = (): Promise => { 225 | return RNTreasureData.getSessionId(); 226 | }; 227 | 228 | TreasureData.isFirstRun = (): Promise => { 229 | return RNTreasureData.isFirstRun(); 230 | }; 231 | 232 | TreasureData.clearFirstRun = () => { 233 | return RNTreasureData.clearFirstRun(); 234 | }; 235 | 236 | TreasureData.setSessionTimeoutMilli = (to: number) => { 237 | return RNTreasureData.setSessionTimeoutMilli(to); 238 | }; 239 | 240 | export default TreasureData; 241 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "es6", 5 | "moduleResolution": "node", 6 | "jsx": "react", 7 | "outDir": "build", 8 | "rootDir": "src", 9 | "allowSyntheticDefaultImports": true, 10 | "noImplicitAny": true, 11 | "experimentalDecorators": false, 12 | "preserveConstEnums": true, 13 | "sourceMap": true, 14 | "strictNullChecks": true, 15 | "declaration": true, 16 | "skipLibCheck":true, 17 | }, 18 | "filesGlob": [ 19 | "src/**/*.ts", 20 | "src/**/*.tsx" 21 | ], 22 | "exclude": [ 23 | "build", 24 | "node_modules", 25 | "example" 26 | ], 27 | "compileOnSave": false 28 | } -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["tslint:latest"], 3 | "rules": { 4 | "member-access": false, 5 | "member-ordering": [ 6 | true, 7 | { 8 | "order": "fields-first" 9 | } 10 | ], 11 | "no-any": true, 12 | "no-inferrable-types": [false], 13 | "no-internal-module": true, 14 | "no-var-requires": true, 15 | "no-console": false, 16 | "typedef": [false], 17 | "typedef-whitespace": [ 18 | true, 19 | { 20 | "call-signature": "nospace", 21 | "index-signature": "nospace", 22 | "parameter": "nospace", 23 | "property-declaration": "nospace", 24 | "variable-declaration": "nospace" 25 | }, 26 | { 27 | "call-signature": "space", 28 | "index-signature": "space", 29 | "parameter": "space", 30 | "property-declaration": "space", 31 | "variable-declaration": "space" 32 | } 33 | ], 34 | "ban": false, 35 | "no-duplicate-variable": true, 36 | "no-empty-interface": false, 37 | "no-implicit-dependencies": [true, "peer"], 38 | "no-null-keyword": true, 39 | "no-switch-case-fall-through": true, 40 | "no-use-before-declare": true, 41 | "switch-default": true, 42 | "triple-equals": [true, "allow-undefined-check"], 43 | "eofline": true, 44 | "indent": [true, "spaces"], 45 | "max-line-length": [true, 150], 46 | "no-require-imports": false, 47 | "no-trailing-whitespace": true, 48 | "object-literal-sort-keys": false, 49 | "trailing-comma": [ 50 | true, 51 | { 52 | "multiline": "always", 53 | "singleline": "never" 54 | } 55 | ], 56 | "align": [true], 57 | "class-name": true, 58 | "comment-format": [true, "check-space"], 59 | "interface-name": [false], 60 | "jsdoc-format": true, 61 | "no-consecutive-blank-lines": [true], 62 | "no-parameter-properties": false, 63 | "one-line": [ 64 | true, 65 | "check-open-brace", 66 | "check-catch", 67 | "check-else", 68 | "check-finally", 69 | "check-whitespace" 70 | ], 71 | "quotemark": [ 72 | true, 73 | "single", 74 | "jsx-double", 75 | "avoid-escape", 76 | "avoid-template" 77 | ], 78 | "semicolon": [true, "always"], 79 | "variable-name": [ 80 | true, 81 | "check-format", 82 | "allow-leading-underscore", 83 | "allow-pascal-case", 84 | "ban-keywords" 85 | ] 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@types/react-native@^0.48.9": 6 | version "0.48.10" 7 | resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.48.10.tgz#c808a3ed381b2f5d87f07853ae29def8d4ad9f81" 8 | dependencies: 9 | "@types/react" "*" 10 | 11 | "@types/react@*", "@types/react@^16.0.7": 12 | version "16.4.6" 13 | resolved "https://registry.yarnpkg.com/@types/react/-/react-16.4.6.tgz#5024957c6bcef4f02823accf5974faba2e54fada" 14 | dependencies: 15 | csstype "^2.2.0" 16 | 17 | ansi-regex@^2.0.0: 18 | version "2.1.1" 19 | resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" 20 | 21 | ansi-styles@^2.2.1: 22 | version "2.2.1" 23 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" 24 | 25 | ansi-styles@^3.2.1: 26 | version "3.2.1" 27 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" 28 | dependencies: 29 | color-convert "^1.9.0" 30 | 31 | argparse@^1.0.7: 32 | version "1.0.10" 33 | resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" 34 | dependencies: 35 | sprintf-js "~1.0.2" 36 | 37 | babel-code-frame@^6.22.0: 38 | version "6.26.0" 39 | resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" 40 | dependencies: 41 | chalk "^1.1.3" 42 | esutils "^2.0.2" 43 | js-tokens "^3.0.2" 44 | 45 | balanced-match@^1.0.0: 46 | version "1.0.0" 47 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" 48 | 49 | brace-expansion@^1.1.7: 50 | version "1.1.11" 51 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" 52 | dependencies: 53 | balanced-match "^1.0.0" 54 | concat-map "0.0.1" 55 | 56 | builtin-modules@^1.1.1: 57 | version "1.1.1" 58 | resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" 59 | 60 | chalk@^1.1.3: 61 | version "1.1.3" 62 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" 63 | dependencies: 64 | ansi-styles "^2.2.1" 65 | escape-string-regexp "^1.0.2" 66 | has-ansi "^2.0.0" 67 | strip-ansi "^3.0.0" 68 | supports-color "^2.0.0" 69 | 70 | chalk@^2.3.0: 71 | version "2.4.1" 72 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" 73 | dependencies: 74 | ansi-styles "^3.2.1" 75 | escape-string-regexp "^1.0.5" 76 | supports-color "^5.3.0" 77 | 78 | color-convert@^1.9.0: 79 | version "1.9.2" 80 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" 81 | dependencies: 82 | color-name "1.1.1" 83 | 84 | color-name@1.1.1: 85 | version "1.1.1" 86 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" 87 | 88 | commander@^2.12.1: 89 | version "2.16.0" 90 | resolved "https://registry.yarnpkg.com/commander/-/commander-2.16.0.tgz#f16390593996ceb4f3eeb020b31d78528f7f8a50" 91 | 92 | concat-map@0.0.1: 93 | version "0.0.1" 94 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 95 | 96 | csstype@^2.2.0: 97 | version "2.5.5" 98 | resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.5.5.tgz#4125484a3d42189a863943f23b9e4b80fedfa106" 99 | 100 | diff@^3.2.0: 101 | version "3.5.0" 102 | resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" 103 | 104 | escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: 105 | version "1.0.5" 106 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 107 | 108 | esprima@^4.0.0: 109 | version "4.0.0" 110 | resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" 111 | 112 | esutils@^2.0.2: 113 | version "2.0.2" 114 | resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" 115 | 116 | fs.realpath@^1.0.0: 117 | version "1.0.0" 118 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 119 | 120 | glob@^7.1.1: 121 | version "7.1.2" 122 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" 123 | dependencies: 124 | fs.realpath "^1.0.0" 125 | inflight "^1.0.4" 126 | inherits "2" 127 | minimatch "^3.0.4" 128 | once "^1.3.0" 129 | path-is-absolute "^1.0.0" 130 | 131 | has-ansi@^2.0.0: 132 | version "2.0.0" 133 | resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" 134 | dependencies: 135 | ansi-regex "^2.0.0" 136 | 137 | has-flag@^3.0.0: 138 | version "3.0.0" 139 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" 140 | 141 | inflight@^1.0.4: 142 | version "1.0.6" 143 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 144 | dependencies: 145 | once "^1.3.0" 146 | wrappy "1" 147 | 148 | inherits@2: 149 | version "2.0.3" 150 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" 151 | 152 | js-tokens@^3.0.2: 153 | version "3.0.2" 154 | resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" 155 | 156 | js-yaml@^3.7.0: 157 | version "3.12.0" 158 | resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" 159 | dependencies: 160 | argparse "^1.0.7" 161 | esprima "^4.0.0" 162 | 163 | minimatch@^3.0.4: 164 | version "3.0.4" 165 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" 166 | dependencies: 167 | brace-expansion "^1.1.7" 168 | 169 | once@^1.3.0: 170 | version "1.4.0" 171 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 172 | dependencies: 173 | wrappy "1" 174 | 175 | path-is-absolute@^1.0.0: 176 | version "1.0.1" 177 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 178 | 179 | path-parse@^1.0.5: 180 | version "1.0.5" 181 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" 182 | 183 | resolve@^1.3.2: 184 | version "1.8.1" 185 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" 186 | dependencies: 187 | path-parse "^1.0.5" 188 | 189 | semver@^5.3.0: 190 | version "5.5.0" 191 | resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" 192 | 193 | sprintf-js@~1.0.2: 194 | version "1.0.3" 195 | resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" 196 | 197 | strip-ansi@^3.0.0: 198 | version "3.0.1" 199 | resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" 200 | dependencies: 201 | ansi-regex "^2.0.0" 202 | 203 | supports-color@^2.0.0: 204 | version "2.0.0" 205 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" 206 | 207 | supports-color@^5.3.0: 208 | version "5.4.0" 209 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54" 210 | dependencies: 211 | has-flag "^3.0.0" 212 | 213 | tslib@^1.8.0, tslib@^1.8.1: 214 | version "1.9.3" 215 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" 216 | 217 | tslint@^5.8.0: 218 | version "5.10.0" 219 | resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.10.0.tgz#11e26bccb88afa02dd0d9956cae3d4540b5f54c3" 220 | dependencies: 221 | babel-code-frame "^6.22.0" 222 | builtin-modules "^1.1.1" 223 | chalk "^2.3.0" 224 | commander "^2.12.1" 225 | diff "^3.2.0" 226 | glob "^7.1.1" 227 | js-yaml "^3.7.0" 228 | minimatch "^3.0.4" 229 | resolve "^1.3.2" 230 | semver "^5.3.0" 231 | tslib "^1.8.0" 232 | tsutils "^2.12.1" 233 | 234 | tsutils@^2.12.1: 235 | version "2.27.1" 236 | resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.1.tgz#ab0276ac23664f36ce8fd4414daec4aebf4373ee" 237 | dependencies: 238 | tslib "^1.8.1" 239 | 240 | typescript@^2.6.1: 241 | version "2.9.2" 242 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" 243 | 244 | wrappy@1: 245 | version "1.0.2" 246 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 247 | --------------------------------------------------------------------------------