├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile ├── android ├── app │ ├── build.gradle │ ├── components │ │ ├── Catalog.js │ │ ├── CatalogCell.js │ │ ├── Details.js │ │ ├── Login.js │ │ ├── MyBooks.js │ │ ├── Navigation.js │ │ ├── Reader.js │ │ ├── SearchBar.js │ │ ├── UserCell.js │ │ └── WebView.js │ ├── my-release-key.keystore │ ├── proguard-rules.pro │ ├── react.gradle │ ├── src │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── fonts │ │ │ │ └── MaterialIcons.ttf │ │ │ ├── java │ │ │ └── com │ │ │ │ └── reactnativecouchbaseliteexample │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ ├── android_back_white.png │ │ │ ├── android_search_white.png │ │ │ ├── pic100.jpg │ │ │ ├── three_bar.png │ │ │ └── title_logo.png │ │ │ ├── drawable-mdpi │ │ │ ├── android_back_white.png │ │ │ ├── android_search_white.png │ │ │ ├── pic100.jpg │ │ │ ├── three_bar.png │ │ │ └── title_logo.png │ │ │ ├── drawable-xhdpi │ │ │ ├── android_back_white.png │ │ │ ├── android_search_white.png │ │ │ ├── pic100.jpg │ │ │ ├── three_bar.png │ │ │ └── title_logo.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── android_back_white.png │ │ │ ├── android_search_white.png │ │ │ ├── pic100.jpg │ │ │ ├── three_bar.png │ │ │ └── title_logo.png │ │ │ ├── drawable │ │ │ └── pic100.jpg │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── pic100.jpg │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── pic100.jpg │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── pic100.jpg │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── pic100.jpg │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── vendor │ │ └── react-native-couchbase-lite │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── ReactNativeCouchbaseLite.podspec │ │ ├── android │ │ ├── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── me │ │ │ │ └── fraserxu │ │ │ │ └── rncouchbaselite │ │ │ │ ├── ReactCBLite.java │ │ │ │ └── ReactCBLiteManager.java │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ └── main.xml │ │ │ └── values │ │ │ └── strings.xml │ │ ├── index.js │ │ ├── npm-install-3306.sh │ │ └── package.json ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── index.android.js ├── index.ios.js ├── ios ├── CBLRegisterJSViewCompiler.h ├── Frameworks │ └── .gitignore ├── ReactNativeCouchbaseLiteExample.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── ReactNativeCouchbaseLiteExample.xcscheme ├── ReactNativeCouchbaseLiteExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── main.m ├── ReactNativeCouchbaseLiteExampleTests │ ├── Info.plist │ └── ReactNativeCouchbaseLiteExampleTests.m └── libCBLJSViewCompiler.a ├── package.json └── utils └── generate_gutenberg_json.py /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IJ 26 | # 27 | .idea 28 | .gradle 29 | local.properties 30 | 31 | # node.js 32 | # 33 | node_modules/ 34 | npm-debug.log 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 InfiniteLibrary 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Infinite Library](https://raw.githubusercontent.com/InfiniteLibrary/app/master/source/images/Title-Logo.png) 2 | 3 | ## Infinite Reader 4 | 5 | A hybrid mobile application offline eBook reader. 6 | 7 | ### Why? 8 | 9 | We at Infinite Library share the desire to create an open and excellent reading experience on as many devices as possible and to collaborate on an open-source project using modern technology. Hopefully our project increases access to eBooks around the world. 10 | 11 | ### Android Quick Start With Vagrant 12 | 1. Connect an Android device with developer mode enabled OR install [Genymotion](https://www.genymotion.com/#!/download) and install a Nexus 5 or 7 (Android version 5.1). If using Genymotion, disable its ADB by selecting Settings -> ABD -> Use custom Android SDK tools -> . 13 | 2. Install [Vagrant]{https://www.vagrantup.com/docs/getting-started/) 14 | 3. Install openssh and rsync using your operating system's package manager or installation tools - these are generally already installed on most Linux configurations. 15 | 16 | If on Windows: 17 | 1. Install [Cygwin](https://cygwin.com/install.html). Within the installer, choose the rsync and openssh packages as per https://github.com/mitchellh/vagrant/issues/3913#issuecomment-45761049. Install "git", under the "Devel" category, to allow cloning this repository. Install xorg-server and xinit to allow launching Chrome for debugging. 18 | 2. If Vagrant issue https://github.com/mitchellh/vagrant/issues/6702 is not yet resolved, you will need to follow the instructions under https://github.com/mitchellh/vagrant/issues/6702#issuecomment-166503021 19 | 3. Launch a terminal using the "Cygwin terminal" shortcut on your desktop or Start Menu. 20 | 4. Run "startxwin" to launch a local X server for Chrome. 21 | 22 | If on OS X: 23 | 1. Install [XQuartz](http://www.xquartz.org/) to enable viewing the developer console in Chrome within the VM. 24 | 4. Clone this repository and change to the new folder. 25 | 5. If using a physical device run: 26 | ``` 27 | vagrant up 28 | ``` 29 | If using an emulator (replace IP address with your emulator's IP): 30 | ``` 31 | ADB_EMULATOR_IP_ADDRESS=192.168.56.101 vagrant up 32 | ``` 33 | This will start the virtual machine which is running the infinite-reader code copied from your host machine. 34 | 6. Start the Vagrant rsync daemon: 35 | ``` 36 | vagrant rsync-auto & 37 | ``` 38 | This will automatically sync changes from the host to the VM. 39 | 7. Optionally, connect to the virtual machine and monitor the output of the react server: 40 | ``` 41 | vagrant ssh -- -Y 42 | tail -f /vagrant/react-native.log 43 | ``` 44 | The infinite-reader should now be deployed to the phone or emulator. 45 | Enable live reload using the "shake" gesture (Ctrl-m in Genymotion) and select "Enable Live Reload". 46 | Changes made to the code should automatically update on the device. 47 | To use the Chrome developer tools for debugging, start Chrome with: 48 | ``` 49 | google-chrome 50 | ``` 51 | Then connect to http://localhost:8081/debugger-ui with this Chrome instance and follow the instructions to install developer tools. 52 | 53 | ## --- The next three sections are for if you are NOT using Vagrant! --- 54 | ### Android Environment 55 | 56 | Setting up an Android development environment takes a few steps. Once you get set up, you will see how easy it is to develop Android apps with Javascript. The app looks and feels, and is, in more ways that not, a true native app. 57 | 58 | Get set up [here](https://facebook.github.io/react-native/docs/android-setup.html). 59 | 60 | ### Node Dependencies 61 | 62 | 1. `npm install -g react-native-cli` // may need to run as root 63 | 2. `npm install` 64 | 65 | **Note**: all warnings are fine, errors are not. If you get an error, you may need to adjust one or two things. npm will usually suggest a good fix. Once you get past this you are about ready to code. 66 | 67 | ### Development Environment 68 | 69 | If you have an Android device skip to 3. 70 | 71 | 1. Install an emulator. We suggest [Genymotion](https://www.genymotion.com/#!/download) 72 | 2. Run Genymotion and choose to install a Nexus 5 or 7 (Android version 5.1) 73 | 3. With the emulator running or device attached run 74 | `react-native start` 75 | This will run the development enviroment. This is required so that if you make changes to you javascript and save, you can "reload js" on your device or emulator. On the device you can shake it to open the menu and on Genymotion you can click the menu on the lower right or use CMD-M 76 | 4. In a separate terminal run 77 | `react-native run-android` 78 | This will install the device to the device (or emulator). If you experience problems make sure that you have set up development mode on the device and that you have granted all development permissions in the settings. 79 | 5. `adb reverse tcp:8081 tcp:8081` this connects the device debug port to your computers debug port 80 | 6. hit "Refresh JS" 81 | 82 | **On Android**: You will probably get a "POST error" on a red screen. This is a known bug on the npm react-native-couchbase-lite module. The module should probably be part of the repo. For now, you must add the following to "/node_modules/react-native-couchbase-lite/index.js:148" 83 | 84 | ``` 85 | if (data) { 86 | settings.body = JSON.stringify(data); 87 | } 88 | else { // add this! 89 | //unresoved hack for error PUT must have a body and GET cant have body 90 | if (settings.method == "PUT") { 91 | settings.body = "."; 92 | } 93 | } 94 | ``` 95 | 96 | **On Linux**: To enable chrome debug you must change the mention of `google-chrome` to `chromium-browser` at "/node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js:19 and 23 97 | 98 | 99 | ### On iOS (the index.ios.js is not setup for gitburg and no components exist in the iOS directory) 100 | 101 | 1. Open `ios/ReactNativeCouchbaseLiteExample.xcodeproj` in Xcode. 102 | 2. Run `npm install` and `react-native start`. 103 | 3. Run the app on a simulator or device. 104 | 105 | ### Database 106 | 107 | Here's the great part. The app is running a device database. When online, the database will sync with the server to get the latest in the catalog. The database is called couchbaseLite and there is an api to access the device db assets in the react-native-couchbase-lite npm module. Check it out. 108 | 109 | ### Navigation 110 | 111 | Becuase we don't need a lot of routes here, the current app uses the Navigation component. Perhaps the best way to see how this works is to follow what happens when you click a book to open it. In CatalogCell.js there is a ``. Awesome. When you select a book to read you touch this and `onPress={this.props.onSelect}` is triggered. 112 | 113 | What are "props"? I like to think of them as "pops" because, when you say `this.props`, you are referencing the CatalogCell instance in whichever parent component it is used. So `this.props.onSelect` fires the onSelect method of the `` in Catalog.js. That in turn fires `this.selectBook(book)` which in turn fires 114 | ``` 115 | this.props.navigator.push({ 116 | title: book.title, 117 | name: 'reader', 118 | book: book, 119 | }); 120 | ``` 121 | Here's props again, so we are sending information up to the navigator and the key is we are passing the next route with `name:'reader'`. Name sets the route to go to next. Because all of the app essentially is wrapped in a Navigator component, the message arrives at the top-level component, which is the navigator, to set the route to "reader". The title and book are context variables for the next view. Understanding and tracing this path is the key to understanding not only how Navigator works but also how components work in React and React Native. 122 | 123 | 124 | ### Components 125 | 126 | There are RN components and there are ones you create. The ones created are in "/app/android/components". Perhaps this diagram helps to explain the component structure as it (nearly) exists currently. RN components are in blue. 127 | 128 | ![diagram](https://cloud.githubusercontent.com/assets/3521359/12398008/e45cbe86-bdde-11e5-9c13-ad1560f8e701.jpg) 129 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure(2) do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | # Every Vagrant development environment requires a box. You can search for 14 | # boxes at https://atlas.hashicorp.com/search. 15 | config.vm.box = "ubuntu/trusty64" 16 | 17 | # For remote debugging 18 | config.vm.network "forwarded_port", guest: 8081, host: 8081 19 | # For adb 20 | config.vm.network "forwarded_port", guest: 5037, host: 5037 21 | # For couchbase-sync-gateway 22 | config.vm.network "forwarded_port", guest: 4984, host: 4984 23 | 24 | # Use rsync to keep files on the host continually updated in the VM 25 | # This is required for live reload to work correctly 26 | config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/", rsync__args: ["--verbose", "--archive", "-z", "--copy-links"] 27 | 28 | # Enable X11 forwarding for Chrome 29 | config.ssh.forward_agent = true 30 | config.ssh.forward_x11 = true 31 | 32 | config.vm.provider "virtualbox" do |vb| 33 | # Display the VirtualBox GUI when booting the machine 34 | # vb.gui = true 35 | # Customize the amount of memory on the VM: 36 | vb.memory = "2048" 37 | # Enable USB 38 | vb.customize ["modifyvm", :id, "--usb", "on"] 39 | vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', '1197123b', '--vendorid', '0x04e8'] 40 | vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'android', '--vendorid', '0x18d1'] 41 | end 42 | 43 | config.vm.provision "shell", inline: <<-SHELL 44 | #### Install Android SDK - this section heavily borrowed from 45 | #### https://github.com/driftyco/ionic-box/blob/master/bootstrap.sh 46 | ANDROID_SDK_FILENAME=android-sdk_r24.2-linux.tgz 47 | ANDROID_SDK=http://dl.google.com/android/$ANDROID_SDK_FILENAME 48 | 49 | # Enable Google repository for downloading chrome needed for developer console 50 | wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 51 | sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' 52 | 53 | apt-get update 54 | apt-get install -y npm git openjdk-7-jdk ant expect lib32stdc++6 lib32z1 xterm automake autoconf python-dev google-chrome-stable 55 | npm install -g n 56 | n stable 57 | 58 | wget --progress=bar:force $ANDROID_SDK 59 | tar -xzvf $ANDROID_SDK_FILENAME 60 | sudo chown -R vagrant android-sdk-linux/ 61 | 62 | echo "export ANDROID_HOME=~/android-sdk-linux" >> /home/vagrant/.bashrc 63 | echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/" >> /home/vagrant/.bashrc 64 | echo "export PATH=\$PATH:~/android-sdk-linux/tools:~/android-sdk-linux/platform-tools" >> /home/vagrant/.bashrc 65 | 66 | expect -c ' 67 | set timeout -1 ; 68 | spawn /home/vagrant/android-sdk-linux/tools/android update sdk -u --all --filter platform-tools,tools,build-tools-23,build-tools-23.0.1,build-tools-23.0.2,build-tools-23.1,build-tools-23.1.1,build-tools-23.1.2,build-tools-23,build-tools-23.0.1,android-22,android-23,addon-google_apis_x86-google-23,extra-android-support,extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services,sys-img-armeabi-v7a-android-23 69 | expect { 70 | "Do you accept the license" { exp_send "y\r" ; exp_continue } 71 | eof 72 | } 73 | ' 74 | 75 | # Install Facebook's watchman 76 | git clone https://github.com/facebook/watchman.git 77 | cd watchman 78 | ./autogen.sh 79 | ./configure 80 | make 81 | sudo make install 82 | 83 | ### Install React Native w/ dependencies 84 | sudo npm install -g react-native-cli 85 | sudo npm install -g flow 86 | sudo npm install -g babel 87 | 88 | ### Below this point, run in the shared vagrant folder 89 | cd /vagrant 90 | 91 | ### Install packages 92 | sudo npm install 93 | 94 | ### Fix for https://github.com/xinthink/react-native-material-kit/issues/77 95 | cp node_modules/react-native-material-kit/android/build.gradle node_modules/react-native-material-kit/android/build.gradle.old 96 | sed "s/buildToolsVersion '23.0.2'/buildToolsVersion '23.0.1'/" node_modules/react-native-material-kit/android/build.gradle.old > node_modules/react-native-material-kit/android/build.gradle 97 | 98 | ## Prevent http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc 99 | sudo npm dedupe 100 | sudo echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 101 | 102 | # Enable the gradle daemon for root 103 | sudo mkdir ~/.gradle 104 | sudo touch ~/.gradle/gradle.properties && sudo echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties 105 | 106 | # Ensure that user vagrant owns everything in /vagrant 107 | chown -R vagrant * 108 | SHELL 109 | 110 | # Note: below always runs when the "vagrant up" or "vagrant reload" is run 111 | config.vm.provision "shell", run: "always", privileged: false, inline: <<-SHELL 112 | export ANDROID_HOME=/home/vagrant/android-sdk-linux 113 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/ 114 | export PATH=\$PATH:/home/vagrant/android-sdk-linux/tools:/home/vagrant/android-sdk-linux/platform-tools 115 | 116 | # Enable the gradle daemon for user vagrant 117 | [ -e ~/.gradle ] || mkdir ~/.gradle 118 | [ -e ~/.gradle/gradle.properties ] || echo "org.gradle.daemon=true" > ~/.gradle/gradle.properties 119 | 120 | cd /vagrant 121 | 122 | # Connect to IP if specified 123 | if [ -n $_ADB_EMULATOR_IP_ADDRESS ]; 124 | then 125 | # Local version of ADB_EMULATOR_IP_ADDRESS with no whitespace 126 | export _ADB_EMULATOR_IP_ADDRESS=#{ENV['ADB_EMULATOR_IP_ADDRESS']} 127 | export _ADB_EMULATOR_IP_ADDRESS="$(echo -e $_ADB_EMULATOR_IP_ADDRESS | tr -d '[[:space:]]')" 128 | adb connect $_ADB_EMULATOR_IP_ADDRESS 129 | # Appears to need some time before the adb reverse command to correctly identify the device 130 | echo "Waiting for adb connection to stabilize" 131 | sleep 5 132 | fi 133 | 134 | # Open live-reload port 135 | adb reverse tcp:8081 tcp:8081 136 | 137 | # Start the react-native server and deploy to connected android device 138 | react-native run-android 139 | nohup sudo react-native start >/vagrant/react-native.log 2>&1 {}); 23 | 24 | 25 | var Catalog = React.createClass({ 26 | getInitialState() { 27 | return { 28 | dataSource: new ListView.DataSource({ 29 | rowHasChanged: (row1, row2) => row1 !== row2, 30 | }), 31 | }; 32 | }, 33 | componentDidMount() { 34 | var remoteURL = 'https://infinitelibrary:mitmedialab@infinitelibrary.cloudant.com/gitburg' 35 | var database = new manager('http://admin:password@localhost:5984/', 'demoapp'); 36 | database.createDatabase() 37 | .then((res) => { 38 | database.replicate(remoteURL, 'demoapp') 39 | }) 40 | .then((res) => { 41 | return database.getDesignDocument('_all_docs?include_docs=true&attachments=true') 42 | }) 43 | .then((res) => { 44 | this.setState({ 45 | dataSource: this.state.dataSource.cloneWithRows(res.rows) 46 | }); 47 | console.log(res.rows) 48 | }) 49 | .catch((ex) => {file:///android_asset/ 50 | console.log(ex) 51 | }) 52 | }, 53 | selectBook(book) { 54 | // fix for iOS/Android dismiss keyboard needs to be added 55 | this.props.navigator.push({ 56 | title: book.title, 57 | name: 'details', 58 | book: book, 59 | }); 60 | }, 61 | goTo(route) { 62 | // fix for iOS/Android dismiss keyboard needs to be added 63 | this.props.navigator.push({ 64 | name: route, 65 | }); 66 | }, 67 | renderRow(data) { 68 | var book = data.doc 69 | return ( 70 | this.selectBook(book)} 73 | book={book} 74 | style={styles.catalogCell} /> 75 | ); 76 | }, 77 | renderSeparator(sectionID, rowID) { 78 | return ( 79 | 80 | ); 81 | }, 82 | render() { 83 | var navigationView = ( 84 | this.goTo(route)}/> 86 | ); 87 | return ( 88 | { return this.drawer = drawer }} 92 | renderNavigationView={() => navigationView}> 93 | 94 | this.drawer.openDrawer()} 98 | style={styles.toolBar} 99 | titleColor="white" 100 | title="Catalog" /> 101 | 102 | 103 | 104 | 109 | 110 | 111 | ); 112 | }, 113 | }); 114 | 115 | 116 | var styles = StyleSheet.create({ 117 | catalogCell: { 118 | flex: 1, 119 | }, 120 | listView: { 121 | flex: 1, 122 | backgroundColor: '#F5FCFF', 123 | }, 124 | toolBar: { 125 | backgroundColor: '#F44336', 126 | height: 56, 127 | }, 128 | separator: { 129 | height: 2, 130 | backgroundColor: '#FFFFFF' 131 | }, 132 | }); 133 | 134 | module.exports = Catalog; -------------------------------------------------------------------------------- /android/app/components/CatalogCell.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var faker = require('faker'); 5 | 6 | var React = require('react-native'); 7 | var { 8 | Image, 9 | PixelRatio, 10 | Platform, 11 | StyleSheet, 12 | Text, 13 | TouchableHighlight, 14 | TouchableNativeFeedback, 15 | View 16 | } = React; 17 | 18 | var CatalogCell = React.createClass({ 19 | render () { 20 | var TouchableElement = TouchableHighlight; 21 | if (Platform.OS === 'android') { 22 | TouchableElement = TouchableNativeFeedback; 23 | } 24 | var imageURI = 'data:image/jpeg;base64,' + this.props.book._attachments["cover.jpg"].data; 25 | // console.log(imageURI) 26 | return ( 27 | 28 | 31 | 32 | 35 | 36 | {this.props.book.title} 37 | {faker.name.findName() /* TODO: Replace with real author once available in the db */ } 38 | 39 | 40 | 41 | 42 | ); 43 | } 44 | }); 45 | 46 | var styles = StyleSheet.create({ 47 | container: { 48 | flex: 1, 49 | flexDirection: 'row', 50 | justifyContent: 'center', 51 | alignItems: 'center', 52 | backgroundColor: '#F5FCFF', 53 | }, 54 | rightContainer: { 55 | flex: 1, 56 | }, 57 | title: { 58 | fontSize: 20, 59 | marginBottom: 4, 60 | textAlign: 'center', 61 | }, 62 | author: { 63 | fontSize: 14, 64 | marginBottom: 8, 65 | textAlign: 'center', 66 | color: "#C0C0C0" 67 | }, 68 | year: { 69 | textAlign: 'center', 70 | }, 71 | thumbnail: { 72 | width: 53, 73 | height: 81, 74 | } 75 | }); 76 | 77 | module.exports = CatalogCell; -------------------------------------------------------------------------------- /android/app/components/Details.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Image, 6 | PixelRatio, 7 | ScrollView, 8 | StyleSheet, 9 | Text, 10 | Platform, 11 | View, 12 | TouchableNativeFeedback, 13 | TouchableHighlight, 14 | } = React; 15 | 16 | var MK = require('react-native-material-kit'); 17 | var { 18 | MKButton, 19 | MKColor, 20 | } = MK; 21 | 22 | var Details = React.createClass({ 23 | readBook(book) { 24 | // fix for iOS/Android dismiss keyboard needs to be added 25 | this.props.navigator.push({ 26 | title: book.title, 27 | name: 'reader', 28 | book: book, 29 | }); 30 | }, 31 | render() { 32 | var TouchableElement = TouchableHighlight; 33 | if (Platform.OS === 'android') { 34 | TouchableElement = TouchableNativeFeedback; 35 | } 36 | var imageURI = 'data:image/jpeg;base64,' + this.props.book._attachments["cover.jpg"].data; 37 | var book = this.props.book; 38 | return ( 39 | 40 | 41 | {/* $FlowIssue #7363964 - There's a bug in Flow where you cannot 42 | * omit a property or set it to undefined if it's inside a shape, 43 | * even if it isn't required */} 44 | 45 | {this.props.book.title} 46 | 49 | 50 | {this.readBook(book);}} > 54 | 56 | READ 57 | 58 | 59 | 60 | 61 | ); 62 | }, 63 | }); 64 | 65 | 66 | 67 | var styles = StyleSheet.create({ 68 | contentContainer: { 69 | padding: 10, 70 | }, 71 | rightPane: { 72 | justifyContent: 'center', 73 | alignItems: 'center', 74 | flex: 1, 75 | }, 76 | movieTitle: { 77 | flex: 1, 78 | fontSize: 16, 79 | fontWeight: '500', 80 | }, 81 | rating: { 82 | marginTop: 10, 83 | }, 84 | mainSection: { 85 | flexDirection: 'column', 86 | alignItems: 'center', 87 | }, 88 | thumbnail: { 89 | height: 200, 90 | width: 128, 91 | resizeMode: 'cover', 92 | backgroundColor: '#eaeaea', 93 | }, 94 | button: { 95 | margin: 7, 96 | borderRadius: 4, 97 | width: 80, 98 | height: 40, 99 | justifyContent: 'center', 100 | alignItems: 'center', 101 | }, 102 | }); 103 | 104 | module.exports = Details; -------------------------------------------------------------------------------- /android/app/components/Login.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var UserCell = require('./UserCell'); 4 | 5 | var React = require('react-native'); 6 | var { 7 | Image, 8 | TextInput, 9 | StyleSheet, 10 | View, 11 | ListView, 12 | Text, 13 | TouchableHighlight, 14 | TouchableNativeFeedback, 15 | Platform, 16 | } = React; 17 | var MK = require('react-native-material-kit'); 18 | var { 19 | MKButton, 20 | MKColor, 21 | } = MK; 22 | 23 | import {manager, ReactCBLite} from 'react-native-couchbase-lite' 24 | ReactCBLite.init(5984, 'admin', 'password', (e) => {}); 25 | 26 | var Login = React.createClass({ 27 | getInitialState() { 28 | return { 29 | users: new ListView.DataSource({ 30 | rowHasChanged: (row1, row2) => row1 !== row2, 31 | }), 32 | text: "", 33 | session: { 34 | user: { 35 | name: "", 36 | } 37 | }, 38 | }; 39 | }, 40 | componentWillMount() { 41 | this.remoteURL = 'https://infinitelibrary:mitmedialab@infinitelibrary.cloudant.com/gitburg' 42 | this.userDB = new manager('http://admin:password@localhost:5984/', 'users'); 43 | this.sessionDB = new manager('http://admin:password@localhost:5984/', 'session'); 44 | 45 | // get the full list of users 46 | 47 | this.userDB.createDatabase() 48 | /* 49 | .then((res) => { 50 | this.userDB.replicate('users', this.remoteURL) 51 | }) */ 52 | .then((res) => { 53 | return this.userDB.getDesignDocument('_all_docs?include_docs=true') 54 | }) 55 | .then((res) => { 56 | this.setState({ 57 | users: this.state.users.cloneWithRows(res.rows) 58 | }); 59 | console.log(res.rows) 60 | }) 61 | .catch((ex) => { 62 | console.log(ex) 63 | }); 64 | 65 | this.sessionDB.createDatabase() 66 | }, 67 | 68 | // if the input button is pressed 69 | 70 | addUser() { 71 | // update session 72 | this.setState({session: {"user": { "name": this.state.text } }}); 73 | // create user 74 | var date = new Date 75 | var dateString = date.toISOString() 76 | var userID = this.state.text + '-' + dateString 77 | this.userDB.createDocument(this.state.session.user, userID); 78 | // update session 79 | this.sessionDB.createDocument(this.state.session, "currentSession"); 80 | // move on 81 | this.props.navigator.push({ 82 | name: 'catalog', 83 | }); 84 | }, 85 | 86 | // if a user is pressed 87 | 88 | selectUser(user) { 89 | // object state user object 90 | this.setState({session: {"user": user}}); 91 | // update session 92 | this.sessionDB.createDocument(this.state.session, "currentSession") 93 | // move on 94 | this.props.navigator.push({ 95 | name: 'catalog', 96 | }); 97 | 98 | }, 99 | 100 | // render all the current users 101 | 102 | renderRow(data) { 103 | var TouchableElement = TouchableHighlight; 104 | if (Platform.OS === 'android') { 105 | TouchableElement = TouchableNativeFeedback; 106 | } 107 | var user = data.doc 108 | return ( 109 | this.selectUser(user)} 112 | user={user} 113 | style={{flex: 1}} /> 114 | ); 115 | }, 116 | 117 | render () { 118 | return ( 119 | 120 | Register 121 | this.setState({text})} 130 | value={this.state.text} /> 131 | {this.addUser(this.state.text);}} > 135 | 137 | SUBMIT 138 | 139 | 140 | Or select your username 141 | 144 | 145 | ); 146 | }, 147 | }); 148 | 149 | var styles = StyleSheet.create({ 150 | nameInput: { 151 | flex: 1, 152 | fontSize: 15, 153 | color: '#333', 154 | height: 50, 155 | margin: 15, 156 | backgroundColor: '#aaa' 157 | }, 158 | button: { 159 | margin: 15, 160 | borderRadius: 4, 161 | width: 80, 162 | height: 40, 163 | justifyContent: 'center', 164 | alignItems: 'center', 165 | }, 166 | prompt: { 167 | fontSize: 15, 168 | margin: 15, 169 | } 170 | }); 171 | 172 | module.exports = Login -------------------------------------------------------------------------------- /android/app/components/MyBooks.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var React = require('react-native'); 5 | var Navigation = require('./Navigation'); 6 | var CatalogCell = require('./CatalogCell'); 7 | 8 | var { 9 | StyleSheet, 10 | Text, 11 | View, 12 | ListView, 13 | Image, 14 | DrawerLayoutAndroid, 15 | TouchableHighlight, 16 | TouchableNativeFeedback, 17 | ToolbarAndroid, 18 | } = React; 19 | 20 | import {manager, ReactCBLite} from 'react-native-couchbase-lite' 21 | ReactCBLite.init(5984, 'admin', 'password', (e) => {}); 22 | 23 | 24 | var MyBooks = React.createClass({ 25 | getInitialState() { 26 | return { 27 | dataSource: new ListView.DataSource({ 28 | rowHasChanged: (row1, row2) => row1 !== row2, 29 | }), 30 | }; 31 | }, 32 | componentDidMount() { 33 | var remoteURL = 'https://infinitelibrary.cloudant.com/gitburg' 34 | var database = new manager('http://admin:password@localhost:5984/', 'demoapp'); 35 | database.createDatabase() 36 | .then((res) => { 37 | database.replicate(remoteURL, 'demoapp') 38 | }) 39 | .then((res) => { 40 | return database.getDesignDocument('_all_docs?include_docs=true&attachments=true') 41 | }) 42 | .then((res) => { 43 | this.setState({ 44 | dataSource: this.state.dataSource.cloneWithRows(res.rows) 45 | }); 46 | console.log(res.rows) 47 | }) 48 | .catch((ex) => {file:///android_asset/ 49 | console.log(ex) 50 | }) 51 | }, 52 | selectBook(book) { 53 | // fix for iOS/Android dismiss keyboard needs to be added 54 | this.props.navigator.push({ 55 | title: book.title, 56 | name: 'reader', 57 | book: book, 58 | }); 59 | }, 60 | goTo(route) { 61 | // fix for iOS/Android dismiss keyboard needs to be added 62 | this.props.navigator.push({ 63 | name: route, 64 | }); 65 | }, 66 | renderRow(data) { 67 | var book = data.doc 68 | return ( 69 | this.selectBook(book)} 72 | book={book} 73 | style={styles.catalogCell} /> 74 | ); 75 | }, 76 | render() { 77 | var navigationView = ( 78 | this.goTo(route)}/> 80 | ); 81 | return ( 82 | { return this.drawer = drawer }} 86 | renderNavigationView={() => navigationView}> 87 | 88 | this.drawer.openDrawer()} 92 | style={styles.toolBar} 93 | titleColor="white" 94 | title="My Books" /> 95 | 96 | 100 | 101 | ); 102 | }, 103 | }); 104 | 105 | 106 | var styles = StyleSheet.create({ 107 | catalogCell: { 108 | flex: 1 109 | }, 110 | listView: { 111 | flex: 1, 112 | backgroundColor: '#F5FCFF', 113 | }, 114 | toolBar: { 115 | backgroundColor: '#FF5252', 116 | height: 56, 117 | }, 118 | }); 119 | 120 | module.exports = MyBooks; -------------------------------------------------------------------------------- /android/app/components/Navigation.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var React = require('react-native'); 5 | var { 6 | Image, 7 | StyleSheet, 8 | Text, 9 | TouchableHighlight, 10 | TouchableNativeFeedback, 11 | View, 12 | Platform, 13 | } = React; 14 | 15 | 16 | 17 | var NavItem = React.createClass({ 18 | render () { 19 | var TouchableElement = TouchableHighlight; 20 | if (Platform.OS === 'android') { 21 | TouchableElement = TouchableNativeFeedback; 22 | } 23 | return ( 24 | 25 | 28 | 29 | 30 | {this.props.name} 31 | 32 | 33 | 34 | 35 | ) 36 | } 37 | }); 38 | 39 | 40 | 41 | var Navigation = React.createClass({ 42 | render () { 43 | return ( 44 | 45 | 46 | 49 | 50 | this.props.goToRoute('mybooks')} /> 54 | this.props.goToRoute('catalog')} /> 58 | this.props.goToRoute('login')} /> 62 | 63 | ); 64 | } 65 | }); 66 | 67 | var styles = StyleSheet.create({ 68 | navItem: { 69 | flex: 1, 70 | flexDirection: 'row', 71 | justifyContent: 'center', 72 | alignItems: 'center', 73 | }, 74 | rightContainer: { 75 | flex: 1, 76 | }, 77 | navigation: { 78 | flex: 1, 79 | backgroundColor: '#E53935' 80 | }, 81 | title: { 82 | fontSize: 28, 83 | textAlign: 'center', 84 | color: '#ffffff', 85 | }, 86 | logoArea: { 87 | flex: 5, 88 | backgroundColor: '#E53935', 89 | } 90 | }); 91 | 92 | module.exports = Navigation; -------------------------------------------------------------------------------- /android/app/components/Reader.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Image, 6 | PixelRatio, 7 | ScrollView, 8 | StyleSheet, 9 | Text, 10 | View, 11 | } = React; 12 | 13 | var WebView = require('./WebView'); 14 | 15 | var Reader = React.createClass({ 16 | render() { 17 | var bookURL = "https://rawgit.com/InfiniteLibraryLibrary/" + this.props.book.title + "/master/book.xhtml"; 18 | return ( 19 | 20 | ); 21 | }, 22 | }); 23 | 24 | 25 | 26 | var styles = StyleSheet.create({ 27 | contentContainer: { 28 | padding: 10, 29 | }, 30 | rightPane: { 31 | justifyContent: 'center', 32 | alignItems: 'center', 33 | flex: 1, 34 | }, 35 | movieTitle: { 36 | flex: 1, 37 | fontSize: 16, 38 | fontWeight: '500', 39 | }, 40 | rating: { 41 | marginTop: 10, 42 | }, 43 | mainSection: { 44 | flexDirection: 'row', 45 | }, 46 | thumbnail: { 47 | width: 134, 48 | height: 200, 49 | backgroundColor: '#eaeaea', 50 | marginRight: 10, 51 | } 52 | }); 53 | 54 | module.exports = Reader; -------------------------------------------------------------------------------- /android/app/components/SearchBar.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var React = require('react-native'); 5 | var { 6 | Image, 7 | Platform, 8 | ProgressBarAndroid, 9 | TextInput, 10 | StyleSheet, 11 | TouchableNativeFeedback, 12 | View, 13 | } = React; 14 | 15 | var IS_RIPPLE_EFFECT_SUPPORTED = Platform.Version >= 21; 16 | 17 | var SearchBar = React.createClass({ 18 | render: function() { 19 | var loadingView; 20 | if (this.props.isLoading) { 21 | loadingView = ( 22 | 26 | ); 27 | } else { 28 | loadingView = ; 29 | } 30 | var background = IS_RIPPLE_EFFECT_SUPPORTED ? 31 | TouchableNativeFeedback.SelectableBackgroundBorderless() : 32 | TouchableNativeFeedback.SelectableBackground(); 33 | return ( 34 | 35 | this.refs.input && this.refs.input.focus()}> 38 | 39 | 43 | 44 | 45 | 56 | {loadingView} 57 | 58 | ); 59 | } 60 | }); 61 | 62 | var styles = StyleSheet.create({ 63 | searchBar: { 64 | flexDirection: 'row', 65 | alignItems: 'center', 66 | backgroundColor: '#EF5350', 67 | height: 56, 68 | }, 69 | searchBarInput: { 70 | flex: 1, 71 | fontSize: 20, 72 | color: 'white', 73 | height: 50, 74 | padding: 0, 75 | backgroundColor: 'transparent' 76 | }, 77 | spinner: { 78 | width: 30, 79 | height: 30, 80 | }, 81 | icon: { 82 | width: 24, 83 | height: 24, 84 | marginHorizontal: 19, 85 | }, 86 | }); 87 | 88 | module.exports = SearchBar; -------------------------------------------------------------------------------- /android/app/components/UserCell.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var React = require('react-native'); 5 | var { 6 | Image, 7 | PixelRatio, 8 | Platform, 9 | StyleSheet, 10 | Text, 11 | TouchableHighlight, 12 | TouchableNativeFeedback, 13 | View 14 | } = React; 15 | 16 | var UserCell = React.createClass({ 17 | render () { 18 | var TouchableElement = TouchableHighlight; 19 | if (Platform.OS === 'android') { 20 | TouchableElement = TouchableNativeFeedback; 21 | } 22 | return ( 23 | 24 | 27 | 28 | 29 | {this.props.user.name} 30 | 31 | 32 | 33 | 34 | ); 35 | } 36 | }); 37 | 38 | var styles = StyleSheet.create({ 39 | container: { 40 | flex: 1, 41 | flexDirection: 'row', 42 | justifyContent: 'center', 43 | alignItems: 'center', 44 | backgroundColor: '#F5FCFF', 45 | padding: 3, 46 | }, 47 | rightContainer: { 48 | flex: 1, 49 | }, 50 | title: { 51 | fontSize: 20, 52 | marginBottom: 8, 53 | textAlign: 'center', 54 | }, 55 | year: { 56 | textAlign: 'center', 57 | }, 58 | thumbnail: { 59 | width: 53, 60 | height: 81, 61 | } 62 | }); 63 | 64 | module.exports = UserCell; -------------------------------------------------------------------------------- /android/app/components/WebView.js: -------------------------------------------------------------------------------- 1 | 2 | 'use strict'; 3 | 4 | var React = require('react-native'); 5 | var { 6 | StyleSheet, 7 | Text, 8 | TextInput, 9 | TouchableOpacity, 10 | View, 11 | WebView 12 | } = React; 13 | 14 | var HEADER = '#3b5998'; 15 | var BGWASH = 'rgba(255,255,255,0.8)'; 16 | var DISABLED_WASH = 'rgba(255,255,255,0.25)'; 17 | 18 | var TEXT_INPUT_REF = 'urlInput'; 19 | var WEBVIEW_REF = 'webview'; 20 | 21 | var WebViewExample = React.createClass({ 22 | 23 | getInitialState: function() { 24 | 25 | return { 26 | status: 'No Page Loaded', 27 | backButtonEnabled: false, 28 | forwardButtonEnabled: false, 29 | loading: true, 30 | scalesPageToFit: true, 31 | }; 32 | }, 33 | 34 | inputText: '', 35 | 36 | handleTextInputChange: function(event) { 37 | this.inputText = event.nativeEvent.text; 38 | }, 39 | 40 | render: function() { 41 | this.inputText = this.state.url; 42 | 43 | return ( 44 | 45 | 58 | 59 | {this.state.status} 60 | 61 | 62 | ); 63 | }, 64 | 65 | goBack: function() { 66 | this.refs[WEBVIEW_REF].goBack(); 67 | }, 68 | 69 | goForward: function() { 70 | this.refs[WEBVIEW_REF].goForward(); 71 | }, 72 | 73 | reload: function() { 74 | this.refs[WEBVIEW_REF].reload(); 75 | }, 76 | 77 | onShouldStartLoadWithRequest: function(event) { 78 | // Implement any custom loading logic here, don't forget to return! 79 | return true; 80 | }, 81 | 82 | onNavigationStateChange: function(navState) { 83 | this.setState({ 84 | backButtonEnabled: navState.canGoBack, 85 | forwardButtonEnabled: navState.canGoForward, 86 | url: navState.url, 87 | status: navState.title, 88 | loading: navState.loading, 89 | scalesPageToFit: true 90 | }); 91 | }, 92 | 93 | onSubmitEditing: function(event) { 94 | this.pressGoButton(); 95 | }, 96 | 97 | pressGoButton: function() { 98 | var url = this.inputText.toLowerCase(); 99 | if (url === this.state.url) { 100 | this.reload(); 101 | } else { 102 | this.setState({ 103 | url: url, 104 | }); 105 | } 106 | // dismiss keyboard 107 | this.refs[TEXT_INPUT_REF].blur(); 108 | }, 109 | 110 | }); 111 | 112 | var styles = StyleSheet.create({ 113 | container: { 114 | flex: 1, 115 | backgroundColor: HEADER, 116 | }, 117 | addressBarRow: { 118 | flexDirection: 'row', 119 | padding: 8, 120 | }, 121 | webView: { 122 | backgroundColor: BGWASH, 123 | height: 350, 124 | }, 125 | addressBarTextInput: { 126 | backgroundColor: BGWASH, 127 | borderColor: 'transparent', 128 | borderRadius: 3, 129 | borderWidth: 1, 130 | height: 24, 131 | paddingLeft: 10, 132 | paddingTop: 3, 133 | paddingBottom: 3, 134 | flex: 1, 135 | fontSize: 14, 136 | }, 137 | navButton: { 138 | width: 20, 139 | padding: 3, 140 | marginRight: 3, 141 | alignItems: 'center', 142 | justifyContent: 'center', 143 | backgroundColor: BGWASH, 144 | borderColor: 'transparent', 145 | borderRadius: 3, 146 | }, 147 | disabledButton: { 148 | width: 20, 149 | padding: 3, 150 | marginRight: 3, 151 | alignItems: 'center', 152 | justifyContent: 'center', 153 | backgroundColor: DISABLED_WASH, 154 | borderColor: 'transparent', 155 | borderRadius: 3, 156 | }, 157 | goButton: { 158 | height: 24, 159 | padding: 3, 160 | marginLeft: 8, 161 | alignItems: 'center', 162 | backgroundColor: BGWASH, 163 | borderColor: 'transparent', 164 | borderRadius: 3, 165 | alignSelf: 'stretch', 166 | }, 167 | statusBar: { 168 | flexDirection: 'row', 169 | alignItems: 'center', 170 | paddingLeft: 5, 171 | height: 22, 172 | }, 173 | statusBarText: { 174 | color: 'white', 175 | fontSize: 13, 176 | }, 177 | spinner: { 178 | width: 20, 179 | marginRight: 6, 180 | }, 181 | }); 182 | 183 | exports.displayName = (undefined: ?string); 184 | exports.title = ''; 185 | exports.description = 'Base component to display web content'; 186 | module.exports = WebViewExample; -------------------------------------------------------------------------------- /android/app/my-release-key.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/my-release-key.keystore -------------------------------------------------------------------------------- /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 | 30 | # Do not strip any method/class that is annotated with @DoNotStrip 31 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 32 | -keepclassmembers class * { 33 | @com.facebook.proguard.annotations.DoNotStrip *; 34 | } 35 | 36 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 37 | void set*(***); 38 | *** get*(); 39 | } 40 | 41 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 42 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 43 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 44 | -keepclassmembers class * { @com.facebook.react.uimanager.ReactProp ; } 45 | -keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup ; } 46 | 47 | # okhttp 48 | 49 | -keepattributes Signature 50 | -keepattributes *Annotation* 51 | -keep class com.squareup.okhttp.** { *; } 52 | -keep interface com.squareup.okhttp.** { *; } 53 | -dontwarn com.squareup.okhttp.** 54 | 55 | # okio 56 | 57 | -keep class sun.misc.Unsafe { *; } 58 | -dontwarn java.nio.file.* 59 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 60 | -dontwarn okio.** 61 | -------------------------------------------------------------------------------- /android/app/react.gradle: -------------------------------------------------------------------------------- 1 | import org.apache.tools.ant.taskdefs.condition.Os 2 | 3 | def config = project.hasProperty("react") ? project.react : []; 4 | 5 | def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" 6 | def entryFile = config.entryFile ?: "index.android.js" 7 | 8 | // because elvis operator 9 | def elvisFile(thing) { 10 | return thing ? file(thing) : null; 11 | } 12 | 13 | def reactRoot = elvisFile(config.root) ?: file("../../") 14 | def jsBundleDirDebug = elvisFile(config.jsBundleDirDebug) ?: 15 | file("$buildDir/intermediates/assets/debug") 16 | def jsBundleDirRelease = elvisFile(config.jsBundleDirRelease) ?: 17 | file("$buildDir/intermediates/assets/release") 18 | def resourcesDirDebug = elvisFile(config.resourcesDirDebug) ?: 19 | file("$buildDir/intermediates/res/merged/debug") 20 | def resourcesDirRelease = elvisFile(config.resourcesDirRelease) ?: 21 | file("$buildDir/intermediates/res/merged/release") 22 | def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"] 23 | 24 | def jsBundleFileDebug = file("$jsBundleDirDebug/$bundleAssetName") 25 | def jsBundleFileRelease = file("$jsBundleDirRelease/$bundleAssetName") 26 | 27 | task bundleDebugJsAndAssets(type: Exec) { 28 | // create dirs if they are not there (e.g. the "clean" task just ran) 29 | doFirst { 30 | jsBundleDirDebug.mkdirs() 31 | resourcesDirDebug.mkdirs() 32 | } 33 | 34 | // set up inputs and outputs so gradle can cache the result 35 | inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) 36 | outputs.dir jsBundleDirDebug 37 | outputs.dir resourcesDirDebug 38 | 39 | // set up the call to the react-native cli 40 | workingDir reactRoot 41 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 42 | commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", 43 | entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug 44 | } else { 45 | commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", 46 | entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug 47 | } 48 | 49 | enabled config.bundleInDebug ?: false 50 | } 51 | 52 | task bundleReleaseJsAndAssets(type: Exec) { 53 | // create dirs if they are not there (e.g. the "clean" task just ran) 54 | doFirst { 55 | jsBundleDirRelease.mkdirs() 56 | resourcesDirRelease.mkdirs() 57 | } 58 | 59 | // set up inputs and outputs so gradle can cache the result 60 | inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) 61 | outputs.dir jsBundleDirRelease 62 | outputs.dir resourcesDirRelease 63 | 64 | // set up the call to the react-native cli 65 | workingDir reactRoot 66 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 67 | commandLine "cmd","/c", "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", 68 | entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease 69 | } else { 70 | commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", 71 | entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease 72 | } 73 | 74 | enabled config.bundleInRelease ?: true 75 | } 76 | 77 | gradle.projectsEvaluated { 78 | // hook bundleDebugJsAndAssets into the android build process 79 | bundleDebugJsAndAssets.dependsOn mergeDebugResources 80 | bundleDebugJsAndAssets.dependsOn mergeDebugAssets 81 | processDebugResources.dependsOn bundleDebugJsAndAssets 82 | 83 | // hook bundleReleaseJsAndAssets into the android build process 84 | bundleReleaseJsAndAssets.dependsOn mergeReleaseResources 85 | bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets 86 | processReleaseResources.dependsOn bundleReleaseJsAndAssets 87 | } 88 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/MaterialIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/assets/fonts/MaterialIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/java/com/reactnativecouchbaseliteexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactnativecouchbaseliteexample; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.KeyEvent; 6 | 7 | import com.facebook.react.LifecycleState; 8 | import com.facebook.react.ReactInstanceManager; 9 | import com.facebook.react.ReactRootView; 10 | import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; 11 | import com.facebook.react.shell.MainReactPackage; 12 | import com.facebook.soloader.SoLoader; 13 | import me.fraserxu.rncouchbaselite.*; 14 | import com.rnfs.RNFSPackage; 15 | import com.github.xinthink.rnmk.ReactMaterialKitPackage; 16 | import me.neo.react.StatusBarPackage; 17 | 18 | public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { 19 | 20 | private ReactInstanceManager mReactInstanceManager; 21 | private ReactRootView mReactRootView; 22 | 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | mReactRootView = new ReactRootView(this); 27 | 28 | mReactInstanceManager = ReactInstanceManager.builder() 29 | .setApplication(getApplication()) 30 | .setBundleAssetName("index.android.bundle") 31 | .setJSMainModuleName("index.android") 32 | .addPackage(new ReactCBLiteManager()) 33 | .addPackage(new MainReactPackage()) 34 | .addPackage(new RNFSPackage()) 35 | .addPackage(new ReactMaterialKitPackage()) 36 | .addPackage(new StatusBarPackage(this)) 37 | .setUseDeveloperSupport(BuildConfig.DEBUG) 38 | .setInitialLifecycleState(LifecycleState.RESUMED) 39 | .build(); 40 | 41 | mReactRootView.startReactApplication(mReactInstanceManager, "ReactNativeCouchbaseLiteExample", null); 42 | 43 | setContentView(mReactRootView); 44 | } 45 | 46 | @Override 47 | public boolean onKeyUp(int keyCode, KeyEvent event) { 48 | if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { 49 | mReactInstanceManager.showDevOptionsDialog(); 50 | return true; 51 | } 52 | return super.onKeyUp(keyCode, event); 53 | } 54 | 55 | @Override 56 | public void onBackPressed() { 57 | if (mReactInstanceManager != null) { 58 | mReactInstanceManager.onBackPressed(); 59 | } else { 60 | super.onBackPressed(); 61 | } 62 | } 63 | 64 | @Override 65 | public void invokeDefaultOnBackPressed() { 66 | super.onBackPressed(); 67 | } 68 | 69 | @Override 70 | protected void onPause() { 71 | super.onPause(); 72 | 73 | if (mReactInstanceManager != null) { 74 | mReactInstanceManager.onPause(); 75 | } 76 | } 77 | 78 | @Override 79 | protected void onResume() { 80 | super.onResume(); 81 | 82 | if (mReactInstanceManager != null) { 83 | mReactInstanceManager.onResume(this, this); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-hdpi/android_back_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-hdpi/android_search_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-hdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/three_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-hdpi/three_bar.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/title_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-hdpi/title_logo.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-mdpi/android_back_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-mdpi/android_search_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-mdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/three_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-mdpi/three_bar.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/title_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-mdpi/title_logo.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xhdpi/android_back_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xhdpi/android_search_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xhdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/three_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xhdpi/three_bar.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/title_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xhdpi/title_logo.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xxhdpi/android_back_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xxhdpi/android_search_white.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xxhdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/three_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xxhdpi/three_bar.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/title_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable-xxhdpi/title_logo.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/drawable/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-hdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-mdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-xhdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/pic100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/src/main/res/mipmap-xxhdpi/pic100.jpg -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ReactNativeCouchbaseLiteExample 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/.npmignore: -------------------------------------------------------------------------------- 1 | # Android 2 | local.properties 3 | .idea 4 | .gradle 5 | build 6 | *.iml 7 | 8 | # Don't publish the example project to npm 9 | ReactNativeCouchbaseLiteExample 10 | 11 | # Readme assets 12 | assets/ -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Fraser Xu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/README.md: -------------------------------------------------------------------------------- 1 | # react-native-couchbase-lite 2 | 3 | Couchbase Lite binding for react-native on both iOS and Android. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ npm install react-native-couchbase-lite --save 9 | ``` 10 | 11 | ## iOS 12 | 13 | 14 | * XCode CouchbaseLite project dependency set up: Drag the ReactCBLite Xcode project as a dependency project into your React Native Xcode project. 15 | 16 | ![](http://cl.ly/image/0S133n1O3g3W/static-library.png) 17 | 18 | * XCode ReactCBLite library dependency set up: Add ReactCBLite.a (from Workspace location) to the required Libraries and Frameworks. 19 | 20 | ![](http://cl.ly/image/2c0Z2u0S0r1G/link.png) 21 | 22 | * From the `Link Binary With Libraries` section in the `Build Phases` of the top-level project, add the following frameworks in your Xcode project (they are dependencies for Couchbase Lite) 23 | 24 | - libsqlite3.0.tbd 25 | - libz.tbd 26 | - Security.framework 27 | - CFNetwork.framework 28 | - SystemConfiguration.framework 29 | 30 | * Download the Couchbase Lite iOS SDK from [here](http://www.couchbase.com/nosql-databases/downloads#) and drag CouchbaseLite.framework, CouchbaseLiteListener.framework, CBLRegisterJSViewCompiler.h and libCBLJSViewCompiler.a in the Xcode project. 31 | 32 | ![](http://cl.ly/image/3Z1b0n0W0i3w/sdk.png) 33 | 34 | ## iOS (Cocoapods) 35 | 36 | * Create a new XCode project and run the following commands: 37 | 38 | ``` 39 | $ pod init 40 | ``` 41 | 42 | * Install both npm modules: 43 | 44 | ``` 45 | $ npm install react-native 46 | $ npm install react-native-couchbase-lite 47 | ``` 48 | 49 | * In `Podfile`, add dependencies: 50 | 51 | ``` 52 | pod 'React', :path => './node_modules/react-native' 53 | pod 'ReactNativeCouchbaseLite', :path => './node_modules/react-native-couchbase-lite' 54 | ``` 55 | 56 | * So far so good! Lastly, you must install CBLRegisterJSViewCompiler.h and libCBLJSViewCompiler.a that can be downloaded [here](http://www.couchbase.com/nosql-databases/downloads#) and located in the `Extras` folder. Open `{project-name}.xcworkspace` and drag both the header file and static lib in the project: 57 | 58 | ![](http://cl.ly/1L2s28462D2W/Image%202016-01-26%20at%2012.47.12%20pm.png) 59 | 60 | ## Android 61 | 62 | * Add dependency to `android/settings.gradle` 63 | 64 | ``` 65 | ... 66 | include ':react-native-couchbase-lite' 67 | project(':react-native-couchbase-lite').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-couchbase-lite/android') 68 | ``` 69 | 70 | * Add `android/build.gradle` 71 | 72 | ``` 73 | allprojects { 74 | repositories { 75 | mavenLocal() 76 | jcenter() 77 | 78 | // add couchbase url 79 | maven { 80 | url "http://files.couchbase.com/maven2/" 81 | } 82 | } 83 | } 84 | ``` 85 | 86 | * Add `android/app/build.gradle` 87 | 88 | ``` 89 | apply plugin: 'com.android.application' 90 | 91 | android { 92 | ... 93 | 94 | packagingOptions { 95 | exclude 'META-INF/ASL2.0' 96 | exclude 'META-INF/LICENSE' 97 | exclude 'META-INF/NOTICE' 98 | } 99 | } 100 | 101 | dependencies { 102 | compile fileTree(dir: 'libs', include: ['*.jar']) 103 | compile 'com.android.support:appcompat-v7:23.0.0' 104 | compile 'com.facebook.react:react-native:0.12.+' 105 | 106 | // Add this line: 107 | compile project(':react-native-couchbase-lite') 108 | } 109 | ``` 110 | 111 | * Register module in `MainActivity.java` 112 | 113 | ``` 114 | import me.fraserxu.rncouchbaselite.*; // <--- import 115 | 116 | @Override 117 | protected void onCreate(Bundle savedInstanceState) { 118 | super.onCreate(savedInstanceState); 119 | mReactRootView = new ReactRootView(this); 120 | 121 | mReactInstanceManager = ReactInstanceManager.builder() 122 | .setApplication(getApplication()) 123 | .setBundleAssetName("index.android.bundle") 124 | .setJSMainModuleName("index.android") 125 | .addPackage(new ReactCBLiteManager()) // <------- here 126 | .addPackage(new MainReactPackage()) 127 | .setUseDeveloperSupport(BuildConfig.DEBUG) 128 | .setInitialLifecycleState(LifecycleState.RESUMED) 129 | .build(); 130 | 131 | mReactRootView.startReactApplication(mReactInstanceManager, "MyApp", null); 132 | 133 | setContentView(mReactRootView); 134 | } 135 | ``` 136 | 137 | #### Usage 138 | 139 | In your app entry, init and start the Couchbase Lite Listener 140 | 141 | ```JavaScript 142 | import {manager, ReactCBLite} from 'react-native-couchbase-lite' 143 | // init the Listener with a port and login credentials 144 | ReactCBLite.init(5984, 'admin', 'password') 145 | 146 | // instantiate a new database 147 | var database = new manager('http://admin:password@localhost:5984/', 'myapp'); 148 | database.createDatabase() 149 | .then((res) => { 150 | database.getAllDocuments() 151 | .then((res) => { 152 | this.setState({ 153 | dataSource: this.state.dataSource.cloneWithRows(res.rows) 154 | }); 155 | }); 156 | ``` 157 | 158 | See the [example project](https://github.com/fraserxu/react-native-couchbase-lite/tree/master/ReactNativeCouchbaseLiteExample) for a more in-depth use case. 159 | 160 | 161 | 162 | ## Available commands 163 | 164 | ``` 165 | promise database.createDatabase(); 166 | promise database.createDesignDocument(string designDocumentName, object designDocumentViews); 167 | promise database.createDocument(object json); 168 | promise database.getDesignDocument(string designDocumentName); 169 | promise database.queryView(string designDocumentName, string viewName); 170 | promise database.deleteDocument(string documentId, string documentRevision); 171 | promise database.getAllDocuments(); 172 | promise database.getDocument(); 173 | promise database.replicate(string source, string target, boolean continuous); 174 | void database.listen(); 175 | ``` 176 | 177 | #### LICENSE 178 | MIT 179 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/ReactNativeCouchbaseLite.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint ReactNativeCouchbaseLite' to ensure this is a 3 | # valid spec and remove all comments before submitting the spec. 4 | # 5 | # Any lines starting with a # are optional, but encouraged 6 | # 7 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 8 | # 9 | 10 | Pod::Spec.new do |s| 11 | s.name = "ReactNativeCouchbaseLite" 12 | s.version = "0.2.2" 13 | s.summary = "couchbase lite binding for react-native" 14 | s.license = 'MIT' 15 | s.platform = :ios, '7.0' 16 | s.requires_arc = true 17 | s.authors = "Fraser Xu " 18 | s.homepage = "https://github.com/fraserxu/react-native-couchbase-lite.git" 19 | s.source = { :git => 'https://github.com/fraserxu/react-native-couchbase-lite.git' } 20 | s.source_files = 'ios/**/*.{h,m}' 21 | s.dependency 'couchbase-lite-ios' 22 | s.dependency 'couchbase-lite-ios/Listener' 23 | end 24 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:1.3+' 7 | } 8 | } 9 | apply plugin: 'android-library' 10 | 11 | android { 12 | compileSdkVersion 'android-23' 13 | buildToolsVersion '23.0.1' 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFile getDefaultProguardFile('proguard-android.txt') 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile 'com.couchbase.lite:couchbase-lite-android:1.1.0' 25 | compile 'com.couchbase.lite:couchbase-lite-java-listener:1.1.0' 26 | compile 'com.couchbase.lite:couchbase-lite-java-javascript:1.1.0' 27 | compile 'com.facebook.react:react-native:0.14.+' 28 | } 29 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/vendor/react-native-couchbase-lite/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/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/app/vendor/react-native-couchbase-lite/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/java/me/fraserxu/rncouchbaselite/ReactCBLite.java: -------------------------------------------------------------------------------- 1 | package me.fraserxu.rncouchbaselite; 2 | 3 | import android.content.Context; 4 | 5 | import com.couchbase.lite.Manager; 6 | import com.couchbase.lite.View; 7 | import com.couchbase.lite.android.AndroidContext; 8 | import com.couchbase.lite.javascript.JavaScriptViewCompiler; 9 | import com.couchbase.lite.listener.Credentials; 10 | import com.couchbase.lite.listener.LiteListener; 11 | import com.couchbase.lite.util.Log; 12 | import com.couchbase.lite.android.*; 13 | 14 | import com.facebook.react.bridge.ReactApplicationContext; 15 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 16 | import com.facebook.react.bridge.ReactMethod; 17 | import com.facebook.react.bridge.Callback; 18 | 19 | public class ReactCBLite extends ReactContextBaseJavaModule { 20 | 21 | public static final String REACT_CLASS = "ReactCBLite"; 22 | private static final int DEFAULT_LISTEN_PORT = 5984; 23 | private final String TAG = "ReactCBLite"; 24 | private ReactApplicationContext context; 25 | private int listenPort; 26 | private Credentials allowedCredentials; 27 | 28 | public ReactCBLite(ReactApplicationContext reactContext) { 29 | super(reactContext); 30 | this.context = reactContext; 31 | } 32 | 33 | @Override 34 | public String getName() { 35 | return REACT_CLASS; 36 | } 37 | 38 | @ReactMethod 39 | public void init(int listenPort, String login, String password, Callback errorCallback) { 40 | initCBLite(listenPort, login, password, errorCallback); 41 | } 42 | 43 | private void initCBLite(int listenPort, String login, String password, Callback errorCallback) { 44 | try { 45 | allowedCredentials = new Credentials(login, password); 46 | 47 | View.setCompiler(new JavaScriptViewCompiler()); 48 | 49 | AndroidContext context = new AndroidContext(this.context); 50 | Manager.enableLogging(Log.TAG, Log.VERBOSE); 51 | Manager.enableLogging(Log.TAG_SYNC, Log.VERBOSE); 52 | Manager.enableLogging(Log.TAG_QUERY, Log.VERBOSE); 53 | Manager.enableLogging(Log.TAG_VIEW, Log.VERBOSE); 54 | Manager.enableLogging(Log.TAG_CHANGE_TRACKER, Log.VERBOSE); 55 | Manager.enableLogging(Log.TAG_BLOB_STORE, Log.VERBOSE); 56 | Manager.enableLogging(Log.TAG_DATABASE, Log.VERBOSE); 57 | Manager.enableLogging(Log.TAG_LISTENER, Log.VERBOSE); 58 | Manager.enableLogging(Log.TAG_MULTI_STREAM_WRITER, Log.VERBOSE); 59 | Manager.enableLogging(Log.TAG_REMOTE_REQUEST, Log.VERBOSE); 60 | Manager.enableLogging(Log.TAG_ROUTER, Log.VERBOSE); 61 | Manager manager = new Manager(context, Manager.DEFAULT_OPTIONS); 62 | 63 | listenPort = startCBLListener(listenPort, manager, allowedCredentials); 64 | 65 | Log.i(TAG, "initCBLite() completed successfully with: " + String.format( 66 | "http://%s:%s@localhost:%d/", 67 | allowedCredentials.getLogin(), 68 | allowedCredentials.getPassword(), 69 | listenPort)); 70 | errorCallback.invoke(); 71 | 72 | } catch (final Exception e) { 73 | e.printStackTrace(); 74 | errorCallback.invoke(e.getMessage()); 75 | } 76 | } 77 | 78 | private int startCBLListener(int listenPort, Manager manager, Credentials allowedCredentials) { 79 | LiteListener listener = new LiteListener(manager, listenPort, allowedCredentials); 80 | int boundPort = listener.getListenPort(); 81 | Thread thread = new Thread(listener); 82 | thread.start(); 83 | return boundPort; 84 | } 85 | } -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/java/me/fraserxu/rncouchbaselite/ReactCBLiteManager.java: -------------------------------------------------------------------------------- 1 | package me.fraserxu.rncouchbaselite; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.JavaScriptModule; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public class ReactCBLiteManager implements ReactPackage { 14 | 15 | @Override 16 | public List> createJSModules() { 17 | return Collections.emptyList(); 18 | } 19 | 20 | @Override 21 | public List createViewManagers(ReactApplicationContext reactContext) { 22 | return Collections.emptyList(); 23 | } 24 | 25 | @Override 26 | public List createNativeModules( 27 | ReactApplicationContext reactContext) { 28 | List modules = new ArrayList<>(); 29 | modules.add(new ReactCBLite(reactContext)); 30 | 31 | return modules; 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/app/vendor/react-native-couchbase-lite/android/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ACTIVITY_ENTRY_NAME 4 | 5 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/index.js: -------------------------------------------------------------------------------- 1 | var { NativeModules } = require('react-native'); 2 | var ReactCBLite = NativeModules.ReactCBLite; 3 | 4 | var base64 = require('base-64'); 5 | 6 | var manager = function (databaseUrl, databaseName) { 7 | this.authHeader = "Basic " + base64.encode(databaseUrl.split("//")[1].split('@')[0]); 8 | this.databaseUrl = databaseUrl; 9 | this.databaseName = databaseName; 10 | }; 11 | 12 | manager.prototype = { 13 | 14 | /** 15 | * Construct a new Couchbase object given a database URL and database name 16 | * 17 | * @returns {*|promise} 18 | */ 19 | createDatabase: function() { 20 | return this.makeRequest("PUT", this.databaseUrl + this.databaseName, {}, null); 21 | }, 22 | 23 | /** 24 | * Delete the database 25 | * 26 | * @returns {*|promise} 27 | */ 28 | deleteDatabase: function() { 29 | return this.makeRequest("DELETE", this.databaseUrl + this.databaseName, null, null); 30 | }, 31 | 32 | /* 33 | * Create a new design document with views 34 | * 35 | * @param string designDocumentName 36 | * @param object designDocumentViews 37 | * @return promise 38 | */ 39 | createDesignDocument: function(designDocumentName, designDocumentViews) { 40 | var data = { 41 | views: designDocumentViews 42 | }; 43 | return this.makeRequest("PUT", this.databaseUrl + this.databaseName + "/" + designDocumentName, {}, data); 44 | }, 45 | 46 | /* 47 | * Get a design document and all views associated to insert 48 | * 49 | * @param string designDocumentName 50 | * @return promise 51 | */ 52 | getDesignDocument: function(designDocumentName) { 53 | return this.makeRequest("GET", this.databaseUrl + this.databaseName + "/" + designDocumentName); 54 | }, 55 | 56 | /* 57 | * Query a particular database view 58 | * 59 | * @param string designDocumentName 60 | * @param string viewName 61 | * @param object options 62 | * @return promise 63 | */ 64 | queryView: function(designDocumentName, viewName, options) { 65 | return this.makeRequest("GET", this.databaseUrl + this.databaseName + "/_design/" + designDocumentName + "/_view/" + viewName, options); 66 | }, 67 | 68 | /** 69 | * Create a new database document 70 | * 71 | * @param object jsonDocument 72 | * @returns {*|promise} 73 | */ 74 | createDocument: function (jsonDocument, docName) { 75 | return this.makeRequest("PUT", this.databaseUrl + this.databaseName + "/" + docName , {}, jsonDocument); 76 | }, 77 | 78 | /** 79 | * Add, update, or delete multiple documents to a database in a single request 80 | * 81 | * @param object jsonDocument 82 | * @returns {*|promise} 83 | */ 84 | modifyDocuments: function (jsonDocument) { 85 | return this.makeRequest("POST", this.databaseUrl + this.databaseName + '/_bulk_docs', {}, {docs: jsonDocument}); 86 | }, 87 | 88 | 89 | /** 90 | * Creates a new document or creates a new revision of an existing document 91 | * 92 | * @param object jsonDocument 93 | * @param string documentRevision 94 | * @returns {*|promise} 95 | */ 96 | updateDocument: function (jsonDocument, documentRevision) { 97 | return this.makeRequest("PUT", this.databaseUrl + this.databaseName + "/" + jsonDocument._id + "?rev=" + documentRevision, {}, jsonDocument); 98 | }, 99 | 100 | /** 101 | * Delete a particular document based on its id and revision 102 | * 103 | * @param documentId 104 | * @param documentRevision 105 | * @return promise 106 | */ 107 | deleteDocument: function(documentId, documentRevision) { 108 | return this.makeRequest("DELETE", this.databaseUrl + this.databaseName + "/" + documentId + "?rev=" + documentRevision); 109 | }, 110 | 111 | /* 112 | * Get a document from the database 113 | * 114 | * @param string documentId 115 | * @return promise 116 | */ 117 | getDocument: function(documentId) { 118 | return this.makeRequest("GET", this.databaseUrl + this.databaseName + "/" + documentId); 119 | }, 120 | 121 | /** 122 | * Get all documents from the database 123 | * 124 | * @returns {*|promise} 125 | */ 126 | getAllDocuments: function() { 127 | return this.makeRequest("GET", this.databaseUrl + this.databaseName + "/_all_docs?include_docs=true"); 128 | }, 129 | 130 | /** 131 | * Replicate in a single direction whether that be remote from local or local to remote 132 | * 133 | * @param source 134 | * @param target 135 | * @param continuous 136 | * @returns {*|promise} 137 | */ 138 | replicate: function(source, target, continuous) { 139 | return this.makeRequest("POST", this.databaseUrl + "_replicate", {}, { 140 | source: source, 141 | target: target, 142 | continuous: continuous 143 | }); 144 | }, 145 | 146 | /** 147 | * Make a RESTful request to an endpoint while providing parameters or data or both 148 | * 149 | * @param string method 150 | * @param string url 151 | * @param object params 152 | * @param object data 153 | * @returns {*|promise} 154 | */ 155 | makeRequest: function(method, url, params, data) { 156 | var settings = { 157 | method: method, 158 | headers: { 159 | 'Accept': 'application/json', 160 | 'Content-Type': 'application/json', 161 | 'Authorization': this.authHeader 162 | } 163 | }; 164 | if (params) { 165 | settings.params = params; 166 | } 167 | if (data) { 168 | settings.body = JSON.stringify(data); 169 | } 170 | else { 171 | //unresoved hack for error PUT must have a body and GET cant have body 172 | if (settings.method == "PUT") { 173 | settings.body = "."; 174 | } 175 | } 176 | return fetch(url, settings).then((res) => { 177 | if (res.status == 401) { 178 | console.log(res); 179 | } 180 | return res.json(); 181 | }).catch((err) => { throw err; }); 182 | } 183 | }; 184 | 185 | module.exports = {manager, ReactCBLite}; -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/npm-install-3306.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # A word about this shell script: 4 | # 5 | # It must work everywhere, including on systems that lack 6 | # a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh, 7 | # and potentially have either a posix shell or bourne 8 | # shell living at /bin/sh. 9 | # 10 | # See this helpful document on writing portable shell scripts: 11 | # http://www.gnu.org/s/hello/manual/autoconf/Portable-Shell.html 12 | # 13 | # The only shell it won't ever work on is cmd.exe. 14 | 15 | if [ "x$0" = "xsh" ]; then 16 | # run as curl | sh 17 | # on some systems, you can just do cat>npm-install.sh 18 | # which is a bit cuter. But on others, &1 is already closed, 19 | # so catting to another script file won't do anything. 20 | # Follow Location: headers, and fail on errors 21 | curl -f -L -s https://www.npmjs.org/install.sh > npm-install-$$.sh 22 | ret=$? 23 | if [ $ret -eq 0 ]; then 24 | (exit 0) 25 | else 26 | rm npm-install-$$.sh 27 | echo "Failed to download script" >&2 28 | exit $ret 29 | fi 30 | sh npm-install-$$.sh 31 | ret=$? 32 | rm npm-install-$$.sh 33 | exit $ret 34 | fi 35 | 36 | # See what "npm_config_*" things there are in the env, 37 | # and make them permanent. 38 | # If this fails, it's not such a big deal. 39 | configures="`env | grep 'npm_config_' | sed -e 's|^npm_config_||g'`" 40 | 41 | npm_config_loglevel="error" 42 | if [ "x$npm_debug" = "x" ]; then 43 | (exit 0) 44 | else 45 | echo "Running in debug mode." 46 | echo "Note that this requires bash or zsh." 47 | set -o xtrace 48 | set -o pipefail 49 | npm_config_loglevel="verbose" 50 | fi 51 | export npm_config_loglevel 52 | 53 | # make sure that Node.js exists 54 | node=`which node 2>&1` 55 | ret=$? 56 | if [ $ret -eq 0 ] && [ -x "$node" ]; then 57 | (exit 0) 58 | else 59 | echo "npm cannot be installed without Node.js." >&2 60 | echo "Install Node.js first, and then try again." >&2 61 | echo "" >&2 62 | echo "Maybe Node.js is installed, but not in the PATH?" >&2 63 | echo "Note that running as sudo can change envs." >&2 64 | echo "" 65 | echo "PATH=$PATH" >&2 66 | exit $ret 67 | fi 68 | 69 | # set the temp dir 70 | TMP="${TMPDIR}" 71 | if [ "x$TMP" = "x" ]; then 72 | TMP="/tmp" 73 | fi 74 | TMP="${TMP}/npm.$$" 75 | rm -rf "$TMP" || true 76 | mkdir "$TMP" 77 | if [ $? -ne 0 ]; then 78 | echo "failed to mkdir $TMP" >&2 79 | exit 1 80 | fi 81 | 82 | BACK="$PWD" 83 | 84 | ret=0 85 | tar="${TAR}" 86 | if [ -z "$tar" ]; then 87 | tar="${npm_config_tar}" 88 | fi 89 | if [ -z "$tar" ]; then 90 | tar=`which tar 2>&1` 91 | ret=$? 92 | fi 93 | 94 | if [ $ret -eq 0 ] && [ -x "$tar" ]; then 95 | echo "tar=$tar" 96 | echo "version:" 97 | $tar --version 98 | ret=$? 99 | fi 100 | 101 | if [ $ret -eq 0 ]; then 102 | (exit 0) 103 | else 104 | echo "No suitable tar program found." 105 | exit 1 106 | fi 107 | 108 | 109 | 110 | # Try to find a suitable make 111 | # If the MAKE environment var is set, use that. 112 | # otherwise, try to find gmake, and then make. 113 | # If no make is found, then just execute the necessary commands. 114 | 115 | # XXX For some reason, make is building all the docs every time. This 116 | # is an annoying source of bugs. Figure out why this happens. 117 | MAKE=NOMAKE 118 | 119 | if [ "x$MAKE" = "x" ]; then 120 | make=`which gmake 2>&1` 121 | if [ $? -eq 0 ] && [ -x "$make" ]; then 122 | (exit 0) 123 | else 124 | make=`which make 2>&1` 125 | if [ $? -eq 0 ] && [ -x "$make" ]; then 126 | (exit 0) 127 | else 128 | make=NOMAKE 129 | fi 130 | fi 131 | else 132 | make="$MAKE" 133 | fi 134 | 135 | if [ -x "$make" ]; then 136 | (exit 0) 137 | else 138 | # echo "Installing without make. This may fail." >&2 139 | make=NOMAKE 140 | fi 141 | 142 | # If there's no bash, then don't even try to clean 143 | if [ -x "/bin/bash" ]; then 144 | (exit 0) 145 | else 146 | clean="no" 147 | fi 148 | 149 | node_version=`"$node" --version 2>&1` 150 | ret=$? 151 | if [ $ret -ne 0 ]; then 152 | echo "You need Node.js to run this program." >&2 153 | echo "node --version reports: $node_version" >&2 154 | echo "with exit code = $ret" >&2 155 | echo "Please install Node.js before continuing." >&2 156 | exit $ret 157 | fi 158 | 159 | t="${npm_install}" 160 | if [ -z "$t" ]; then 161 | # switch based on Node.js version. 162 | # note that we can only use strict sh-compatible patterns here. 163 | case $node_version in 164 | 0.[01234567].* | v0.[01234567].*) 165 | echo "You are using an outdated and unsupported version of" >&2 166 | echo "Node.js ($node_version). Please update Node.js and try again." >&2 167 | exit 99 168 | ;; 169 | *) 170 | echo "install npm@latest" 171 | t="latest" 172 | ;; 173 | esac 174 | fi 175 | 176 | # need to echo "" after, because Posix sed doesn't treat EOF 177 | # as an implied end of line. 178 | url=`(curl -SsL https://registry.npmjs.org/npm/$t; echo "") \ 179 | | sed -e 's/^.*tarball":"//' \ 180 | | sed -e 's/".*$//'` 181 | 182 | ret=$? 183 | if [ "x$url" = "x" ]; then 184 | ret=125 185 | # try without the -e arg to sed. 186 | url=`(curl -SsL https://registry.npmjs.org/npm/$t; echo "") \ 187 | | sed 's/^.*tarball":"//' \ 188 | | sed 's/".*$//'` 189 | ret=$? 190 | if [ "x$url" = "x" ]; then 191 | ret=125 192 | fi 193 | fi 194 | if [ $ret -ne 0 ]; then 195 | echo "Failed to get tarball url for npm/$t" >&2 196 | exit $ret 197 | fi 198 | 199 | 200 | echo "fetching: $url" >&2 201 | 202 | cd "$TMP" \ 203 | && curl -SsL "$url" \ 204 | | $tar -xzf - \ 205 | && cd "$TMP"/* \ 206 | && (ver=`"$node" bin/read-package-json.js package.json version` 207 | isnpm10=0 208 | if [ $ret -eq 0 ]; then 209 | if [ -d node_modules ]; then 210 | if "$node" node_modules/semver/bin/semver -v "$ver" -r "1" 211 | then 212 | isnpm10=1 213 | fi 214 | else 215 | if "$node" bin/semver -v "$ver" -r ">=1.0"; then 216 | isnpm10=1 217 | fi 218 | fi 219 | fi 220 | 221 | ret=0 222 | if [ $isnpm10 -eq 1 ] && [ -f "scripts/clean-old.sh" ]; then 223 | if [ "x$skipclean" = "x" ]; then 224 | (exit 0) 225 | else 226 | clean=no 227 | fi 228 | if [ "x$clean" = "xno" ] \ 229 | || [ "x$clean" = "xn" ]; then 230 | echo "Skipping 0.x cruft clean" >&2 231 | ret=0 232 | elif [ "x$clean" = "xy" ] || [ "x$clean" = "xyes" ]; then 233 | NODE="$node" /bin/bash "scripts/clean-old.sh" "-y" 234 | ret=$? 235 | else 236 | NODE="$node" /bin/bash "scripts/clean-old.sh" &2 243 | exit $ret 244 | fi) \ 245 | && (if [ "x$configures" = "x" ]; then 246 | (exit 0) 247 | else 248 | echo "./configure $configures" 249 | echo "$configures" > npmrc 250 | fi) \ 251 | && (if [ "$make" = "NOMAKE" ]; then 252 | (exit 0) 253 | elif "$make" uninstall install; then 254 | (exit 0) 255 | else 256 | make="NOMAKE" 257 | fi 258 | if [ "$make" = "NOMAKE" ]; then 259 | "$node" cli.js rm npm -gf 260 | "$node" cli.js install -gf 261 | fi) \ 262 | && cd "$BACK" \ 263 | && rm -rf "$TMP" \ 264 | && echo "It worked" 265 | 266 | ret=$? 267 | if [ $ret -ne 0 ]; then 268 | echo "It failed" >&2 269 | fi 270 | exit $ret 271 | -------------------------------------------------------------------------------- /android/app/vendor/react-native-couchbase-lite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-couchbase-lite", 3 | "version": "0.2.3", 4 | "description": "couchbase lite binding for react-native", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/fraserxu/react-native-couchbase-lite.git" 12 | }, 13 | "keywords": [ 14 | "react-component", 15 | "react-native", 16 | "android" 17 | ], 18 | "peerDependencies": { 19 | "react-native": ">=0.14" 20 | }, 21 | "author": { 22 | "name": "Fraser Xu" 23 | }, 24 | "license": "MIT", 25 | "bugs": { 26 | "url": "https://github.com/fraserxu/react-native-couchbase-lite/issues" 27 | }, 28 | "homepage": "https://github.com/fraserxu/react-native-couchbase-lite#readme", 29 | "dependencies": { 30 | "base-64": "^0.1.0" 31 | }, 32 | "gitHead": "4cb8ba33882b27cf84423a7b1c55909440868c71", 33 | "_id": "react-native-couchbase-lite@0.2.3", 34 | "_shasum": "aebc77e6fdca72cf173f0543a2755031b36f9a98", 35 | "_from": "react-native-couchbase-lite@0.2.3", 36 | "_npmVersion": "2.14.12", 37 | "_nodeVersion": "4.2.6", 38 | "_npmUser": { 39 | "name": "jamiltz", 40 | "email": "james.nocentini@gmail.com" 41 | }, 42 | "dist": { 43 | "shasum": "aebc77e6fdca72cf173f0543a2755031b36f9a98", 44 | "tarball": "http://registry.npmjs.org/react-native-couchbase-lite/-/react-native-couchbase-lite-0.2.3.tgz" 45 | }, 46 | "maintainers": [ 47 | { 48 | "name": "fraserxu", 49 | "email": "xvfeng123@gmail.com" 50 | }, 51 | { 52 | "name": "jamiltz", 53 | "email": "james.nocentini@gmail.com" 54 | } 55 | ], 56 | "directories": {}, 57 | "_resolved": "https://registry.npmjs.org/react-native-couchbase-lite/-/react-native-couchbase-lite-0.2.3.tgz", 58 | "readme": "ERROR: No README data found!" 59 | } 60 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | def versionOverrides = [ 4 | "com.couchbase.lite:couchbase-lite-java-listener": "1.0.0", 5 | ] 6 | 7 | subprojects { 8 | 9 | configurations.all { 10 | 11 | resolutionStrategy.eachDependency { DependencyResolveDetails details -> 12 | 13 | def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name] 14 | 15 | if (overrideVersion != null && details.requested.version != overrideVersion) { 16 | logger.info "Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion" 17 | details.useVersion overrideVersion 18 | } 19 | } 20 | } 21 | } 22 | 23 | configurations.all { 24 | resolutionStrategy { 25 | force 'com.couchbase.lite:couchbase-lite-java-listener:1.0.0' 26 | } 27 | } 28 | 29 | buildscript { 30 | repositories { 31 | jcenter() 32 | } 33 | dependencies { 34 | classpath 'com.android.tools.build:gradle:1.3.1' 35 | 36 | // NOTE: Do not place your application dependencies here; they belong 37 | // in the individual module build.gradle files 38 | } 39 | } 40 | 41 | allprojects { 42 | repositories { 43 | mavenLocal() 44 | jcenter() 45 | // add couchbase url 46 | maven { 47 | url "http://files.couchbase.com/maven2/" 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ReactNativeCouchbaseLiteExample' 2 | 3 | include ':app' 4 | include ':react-native-couchbase-lite' 5 | include ':react-native-fs' 6 | include ':RNMaterialKit' 7 | include ':react-native-android-statusbar' 8 | project(':react-native-couchbase-lite').projectDir = new File(rootProject.projectDir, 'app/vendor/react-native-couchbase-lite/android') 9 | project(':react-native-fs').projectDir = new File(settingsDir, '../node_modules/react-native-fs/android') 10 | project(':RNMaterialKit').projectDir = file('../node_modules/react-native-material-kit/android') 11 | project(':react-native-android-statusbar').projectDir = new File(settingsDir, '../node_modules/react-native-android-statusbar') -------------------------------------------------------------------------------- /index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var Catalog = require('./android/app/components/Catalog'); 9 | var Details = require('./android/app/components/Details'); 10 | var Reader = require('./android/app/components/Reader'); 11 | var MyBooks = require('./android/app/components/MyBooks'); 12 | var Login = require('./android/app/components/Login'); 13 | var StatusBarAndroid = require('react-native-android-statusbar'); 14 | var { 15 | AppRegistry, 16 | BackAndroid, 17 | Navigator, 18 | StyleSheet, 19 | ToolbarAndroid, 20 | View, 21 | } = React; 22 | 23 | var _navigator; 24 | 25 | StatusBarAndroid.setHexColor('#B71C1C'); 26 | 27 | BackAndroid.addEventListener('hardwareBackPress', () => { 28 | if (_navigator && _navigator.getCurrentRoutes().length > 1) { 29 | _navigator.pop(); 30 | return true; 31 | } 32 | return false; 33 | }); 34 | 35 | var RouteMapper = function(route, navigationOperations, onComponentRef) { 36 | _navigator = navigationOperations; 37 | if (route.name === 'catalog') { 38 | return ( 39 | 40 | ); 41 | } else if (route.name === 'mybooks') { 42 | return ( 43 | 44 | ); 45 | } else if (route.name === 'login') { 46 | return ( 47 | 48 | ); 49 | } else if (route.name === 'details') { 50 | return ( 51 | 52 | 59 |
63 | 64 | ); 65 | } else if (route.name === 'reader') { 66 | return ( 67 | 68 | 75 | 79 | 80 | ); 81 | } 82 | }; 83 | 84 | var ReactNativeCouchbaseLiteExample = React.createClass({ 85 | render: function () { 86 | var initialRoute = {name: 'login'}; 87 | return ( 88 | Navigator.SceneConfigs.FadeAndroid} 92 | renderScene={RouteMapper} /> 93 | ); 94 | } 95 | }); 96 | 97 | var styles = StyleSheet.create({ 98 | container: { 99 | flex: 1, 100 | backgroundColor: 'white', 101 | }, 102 | toolbar: { 103 | backgroundColor: '#a9a9a9', 104 | height: 56, 105 | }, 106 | }); 107 | 108 | AppRegistry.registerComponent('ReactNativeCouchbaseLiteExample', () => ReactNativeCouchbaseLiteExample); 109 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | Image, 14 | ListView, 15 | } = React; 16 | 17 | var ReactCBLite = require('react-native').NativeModules.ReactCBLite; 18 | ReactCBLite.init(5984, 'admin', 'password'); 19 | 20 | var { manager } = require('react-native-couchbase-lite'); 21 | 22 | var ReactNativeCouchbaseLiteExample = React.createClass({ 23 | render: function () { 24 | return ( 25 | 26 | ); 27 | } 28 | }); 29 | 30 | var Home = React.createClass({ 31 | getInitialState() { 32 | return { 33 | dataSource: new ListView.DataSource({ 34 | rowHasChanged: (row1, row2) => row1 !== row2, 35 | }) 36 | } 37 | }, 38 | componentDidMount() { 39 | var database = new manager('http://admin:password@localhost:5984/', 'myapp'); 40 | 41 | database.createDatabase() 42 | .then((res) => { 43 | database.replicate('http://localhost:4984/moviesapp', 'myapp') 44 | }) 45 | .then((res) => { 46 | return database.getAllDocuments() 47 | }) 48 | .then((res) => { 49 | this.setState({ 50 | dataSource: this.state.dataSource.cloneWithRows(res.rows) 51 | }); 52 | console.log(res.rows) 53 | }) 54 | .catch((ex) => { 55 | console.log(ex) 56 | }) 57 | }, 58 | render() { 59 | return ( 60 | 61 | 65 | 66 | ) 67 | }, 68 | renderMovie(movie) { 69 | var movie = movie.doc; 70 | return ( 71 | 72 | 75 | 76 | {movie.title} 77 | {movie.year} 78 | 79 | 80 | ); 81 | } 82 | }); 83 | 84 | var styles = StyleSheet.create({ 85 | container: { 86 | flex: 1, 87 | flexDirection: 'row', 88 | justifyContent: 'center', 89 | alignItems: 'center', 90 | backgroundColor: '#F5FCFF', 91 | }, 92 | rightContainer: { 93 | flex: 1, 94 | }, 95 | title: { 96 | fontSize: 20, 97 | marginBottom: 8, 98 | textAlign: 'center', 99 | }, 100 | year: { 101 | textAlign: 'center', 102 | }, 103 | thumbnail: { 104 | width: 53, 105 | height: 81, 106 | }, 107 | listView: { 108 | paddingTop: 20, 109 | backgroundColor: '#F5FCFF', 110 | }, 111 | }); 112 | 113 | AppRegistry.registerComponent('ReactNativeCouchbaseLiteExample', () => ReactNativeCouchbaseLiteExample); 114 | -------------------------------------------------------------------------------- /ios/CBLRegisterJSViewCompiler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBLRegisterJSViewCompiler.h 3 | // CouchbaseLite 4 | // 5 | // Created by Chris Anderson on 7/10/13. 6 | // Copyright (c) 2013 Couchbase, Inc. All rights reserved. 7 | // 8 | 9 | void CBLRegisterJSViewCompiler(void); 10 | -------------------------------------------------------------------------------- /ios/Frameworks/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | 3 | !.gitignore -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 15 | 00E356F31AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.m */; }; 16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 23 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 24 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 31 | proxyType = 2; 32 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 33 | remoteInfo = RCTActionSheet; 34 | }; 35 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 36 | isa = PBXContainerItemProxy; 37 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 38 | proxyType = 2; 39 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 40 | remoteInfo = RCTGeolocation; 41 | }; 42 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 43 | isa = PBXContainerItemProxy; 44 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 45 | proxyType = 2; 46 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 47 | remoteInfo = RCTImage; 48 | }; 49 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 50 | isa = PBXContainerItemProxy; 51 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 52 | proxyType = 2; 53 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 54 | remoteInfo = RCTNetwork; 55 | }; 56 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 57 | isa = PBXContainerItemProxy; 58 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 59 | proxyType = 2; 60 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 61 | remoteInfo = RCTVibration; 62 | }; 63 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 64 | isa = PBXContainerItemProxy; 65 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 66 | proxyType = 1; 67 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 68 | remoteInfo = ReactNativeCouchbaseLiteExample; 69 | }; 70 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 71 | isa = PBXContainerItemProxy; 72 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 73 | proxyType = 2; 74 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 75 | remoteInfo = RCTSettings; 76 | }; 77 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 78 | isa = PBXContainerItemProxy; 79 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 80 | proxyType = 2; 81 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 82 | remoteInfo = RCTWebSocket; 83 | }; 84 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 85 | isa = PBXContainerItemProxy; 86 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 87 | proxyType = 2; 88 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 89 | remoteInfo = React; 90 | }; 91 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 92 | isa = PBXContainerItemProxy; 93 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 94 | proxyType = 2; 95 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 96 | remoteInfo = RCTLinking; 97 | }; 98 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 99 | isa = PBXContainerItemProxy; 100 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 101 | proxyType = 2; 102 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 103 | remoteInfo = RCTText; 104 | }; 105 | /* End PBXContainerItemProxy section */ 106 | 107 | /* Begin PBXFileReference section */ 108 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = main.jsbundle; sourceTree = ""; }; 109 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = ""; }; 110 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = ""; }; 111 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = ""; }; 112 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = ""; }; 113 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = ""; }; 114 | 00E356EE1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactNativeCouchbaseLiteExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 115 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 116 | 00E356F21AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactNativeCouchbaseLiteExampleTests.m; sourceTree = ""; }; 117 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = ""; }; 118 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = ""; }; 119 | 13B07F961A680F5B00A75B9A /* ReactNativeCouchbaseLiteExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactNativeCouchbaseLiteExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 120 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ReactNativeCouchbaseLiteExample/AppDelegate.h; sourceTree = ""; }; 121 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ReactNativeCouchbaseLiteExample/AppDelegate.m; sourceTree = ""; }; 122 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 123 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNativeCouchbaseLiteExample/Images.xcassets; sourceTree = ""; }; 124 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeCouchbaseLiteExample/Info.plist; sourceTree = ""; }; 125 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactNativeCouchbaseLiteExample/main.m; sourceTree = ""; }; 126 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../node_modules/react-native/React/React.xcodeproj; sourceTree = ""; }; 127 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = ""; }; 128 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = ""; }; 129 | /* End PBXFileReference section */ 130 | 131 | /* Begin PBXFrameworksBuildPhase section */ 132 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 133 | isa = PBXFrameworksBuildPhase; 134 | buildActionMask = 2147483647; 135 | files = ( 136 | ); 137 | runOnlyForDeploymentPostprocessing = 0; 138 | }; 139 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 140 | isa = PBXFrameworksBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 144 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 145 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 146 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 147 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 148 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 149 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 150 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 151 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 152 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXFrameworksBuildPhase section */ 157 | 158 | /* Begin PBXGroup section */ 159 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 163 | ); 164 | name = Products; 165 | sourceTree = ""; 166 | }; 167 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 171 | ); 172 | name = Products; 173 | sourceTree = ""; 174 | }; 175 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 179 | ); 180 | name = Products; 181 | sourceTree = ""; 182 | }; 183 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 187 | ); 188 | name = Products; 189 | sourceTree = ""; 190 | }; 191 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 192 | isa = PBXGroup; 193 | children = ( 194 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 195 | ); 196 | name = Products; 197 | sourceTree = ""; 198 | }; 199 | 00E356EF1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests */ = { 200 | isa = PBXGroup; 201 | children = ( 202 | 00E356F21AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.m */, 203 | 00E356F01AD99517003FC87E /* Supporting Files */, 204 | ); 205 | path = ReactNativeCouchbaseLiteExampleTests; 206 | sourceTree = ""; 207 | }; 208 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 209 | isa = PBXGroup; 210 | children = ( 211 | 00E356F11AD99517003FC87E /* Info.plist */, 212 | ); 213 | name = "Supporting Files"; 214 | sourceTree = ""; 215 | }; 216 | 139105B71AF99BAD00B5F7CC /* Products */ = { 217 | isa = PBXGroup; 218 | children = ( 219 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 220 | ); 221 | name = Products; 222 | sourceTree = ""; 223 | }; 224 | 139FDEE71B06529A00C62182 /* Products */ = { 225 | isa = PBXGroup; 226 | children = ( 227 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 228 | ); 229 | name = Products; 230 | sourceTree = ""; 231 | }; 232 | 13B07FAE1A68108700A75B9A /* ReactNativeCouchbaseLiteExample */ = { 233 | isa = PBXGroup; 234 | children = ( 235 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 236 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 237 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 238 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 239 | 13B07FB61A68108700A75B9A /* Info.plist */, 240 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 241 | 13B07FB71A68108700A75B9A /* main.m */, 242 | ); 243 | name = ReactNativeCouchbaseLiteExample; 244 | sourceTree = ""; 245 | }; 246 | 146834001AC3E56700842450 /* Products */ = { 247 | isa = PBXGroup; 248 | children = ( 249 | 146834041AC3E56700842450 /* libReact.a */, 250 | ); 251 | name = Products; 252 | sourceTree = ""; 253 | }; 254 | 78C398B11ACF4ADC00677621 /* Products */ = { 255 | isa = PBXGroup; 256 | children = ( 257 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 258 | ); 259 | name = Products; 260 | sourceTree = ""; 261 | }; 262 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 263 | isa = PBXGroup; 264 | children = ( 265 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 266 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 267 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 268 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 269 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 270 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 271 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 272 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 273 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 274 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 275 | ); 276 | name = Libraries; 277 | sourceTree = ""; 278 | }; 279 | 832341B11AAA6A8300B99B32 /* Products */ = { 280 | isa = PBXGroup; 281 | children = ( 282 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 283 | ); 284 | name = Products; 285 | sourceTree = ""; 286 | }; 287 | 83CBB9F61A601CBA00E9B192 = { 288 | isa = PBXGroup; 289 | children = ( 290 | 13B07FAE1A68108700A75B9A /* ReactNativeCouchbaseLiteExample */, 291 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 292 | 00E356EF1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests */, 293 | 83CBBA001A601CBA00E9B192 /* Products */, 294 | ); 295 | indentWidth = 2; 296 | sourceTree = ""; 297 | tabWidth = 2; 298 | }; 299 | 83CBBA001A601CBA00E9B192 /* Products */ = { 300 | isa = PBXGroup; 301 | children = ( 302 | 13B07F961A680F5B00A75B9A /* ReactNativeCouchbaseLiteExample.app */, 303 | 00E356EE1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.xctest */, 304 | ); 305 | name = Products; 306 | sourceTree = ""; 307 | }; 308 | /* End PBXGroup section */ 309 | 310 | /* Begin PBXNativeTarget section */ 311 | 00E356ED1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests */ = { 312 | isa = PBXNativeTarget; 313 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeCouchbaseLiteExampleTests" */; 314 | buildPhases = ( 315 | 00E356EA1AD99517003FC87E /* Sources */, 316 | 00E356EB1AD99517003FC87E /* Frameworks */, 317 | 00E356EC1AD99517003FC87E /* Resources */, 318 | ); 319 | buildRules = ( 320 | ); 321 | dependencies = ( 322 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 323 | ); 324 | name = ReactNativeCouchbaseLiteExampleTests; 325 | productName = ReactNativeCouchbaseLiteExampleTests; 326 | productReference = 00E356EE1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.xctest */; 327 | productType = "com.apple.product-type.bundle.unit-test"; 328 | }; 329 | 13B07F861A680F5B00A75B9A /* ReactNativeCouchbaseLiteExample */ = { 330 | isa = PBXNativeTarget; 331 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeCouchbaseLiteExample" */; 332 | buildPhases = ( 333 | 13B07F871A680F5B00A75B9A /* Sources */, 334 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 335 | 13B07F8E1A680F5B00A75B9A /* Resources */, 336 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 337 | ); 338 | buildRules = ( 339 | ); 340 | dependencies = ( 341 | ); 342 | name = ReactNativeCouchbaseLiteExample; 343 | productName = "Hello World"; 344 | productReference = 13B07F961A680F5B00A75B9A /* ReactNativeCouchbaseLiteExample.app */; 345 | productType = "com.apple.product-type.application"; 346 | }; 347 | /* End PBXNativeTarget section */ 348 | 349 | /* Begin PBXProject section */ 350 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 351 | isa = PBXProject; 352 | attributes = { 353 | LastUpgradeCheck = 0610; 354 | ORGANIZATIONNAME = Facebook; 355 | TargetAttributes = { 356 | 00E356ED1AD99517003FC87E = { 357 | CreatedOnToolsVersion = 6.2; 358 | TestTargetID = 13B07F861A680F5B00A75B9A; 359 | }; 360 | }; 361 | }; 362 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNativeCouchbaseLiteExample" */; 363 | compatibilityVersion = "Xcode 3.2"; 364 | developmentRegion = English; 365 | hasScannedForEncodings = 0; 366 | knownRegions = ( 367 | en, 368 | Base, 369 | ); 370 | mainGroup = 83CBB9F61A601CBA00E9B192; 371 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 372 | projectDirPath = ""; 373 | projectReferences = ( 374 | { 375 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 376 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 377 | }, 378 | { 379 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 380 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 381 | }, 382 | { 383 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 384 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 385 | }, 386 | { 387 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 388 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 389 | }, 390 | { 391 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 392 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 393 | }, 394 | { 395 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 396 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 397 | }, 398 | { 399 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 400 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 401 | }, 402 | { 403 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 404 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 405 | }, 406 | { 407 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 408 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 409 | }, 410 | { 411 | ProductGroup = 146834001AC3E56700842450 /* Products */; 412 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 413 | }, 414 | ); 415 | projectRoot = ""; 416 | targets = ( 417 | 13B07F861A680F5B00A75B9A /* ReactNativeCouchbaseLiteExample */, 418 | 00E356ED1AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests */, 419 | ); 420 | }; 421 | /* End PBXProject section */ 422 | 423 | /* Begin PBXReferenceProxy section */ 424 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 425 | isa = PBXReferenceProxy; 426 | fileType = archive.ar; 427 | path = libRCTActionSheet.a; 428 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 429 | sourceTree = BUILT_PRODUCTS_DIR; 430 | }; 431 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 432 | isa = PBXReferenceProxy; 433 | fileType = archive.ar; 434 | path = libRCTGeolocation.a; 435 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 436 | sourceTree = BUILT_PRODUCTS_DIR; 437 | }; 438 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 439 | isa = PBXReferenceProxy; 440 | fileType = archive.ar; 441 | path = libRCTImage.a; 442 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 443 | sourceTree = BUILT_PRODUCTS_DIR; 444 | }; 445 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 446 | isa = PBXReferenceProxy; 447 | fileType = archive.ar; 448 | path = libRCTNetwork.a; 449 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 450 | sourceTree = BUILT_PRODUCTS_DIR; 451 | }; 452 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 453 | isa = PBXReferenceProxy; 454 | fileType = archive.ar; 455 | path = libRCTVibration.a; 456 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 457 | sourceTree = BUILT_PRODUCTS_DIR; 458 | }; 459 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 460 | isa = PBXReferenceProxy; 461 | fileType = archive.ar; 462 | path = libRCTSettings.a; 463 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 464 | sourceTree = BUILT_PRODUCTS_DIR; 465 | }; 466 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 467 | isa = PBXReferenceProxy; 468 | fileType = archive.ar; 469 | path = libRCTWebSocket.a; 470 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 471 | sourceTree = BUILT_PRODUCTS_DIR; 472 | }; 473 | 146834041AC3E56700842450 /* libReact.a */ = { 474 | isa = PBXReferenceProxy; 475 | fileType = archive.ar; 476 | path = libReact.a; 477 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 478 | sourceTree = BUILT_PRODUCTS_DIR; 479 | }; 480 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 481 | isa = PBXReferenceProxy; 482 | fileType = archive.ar; 483 | path = libRCTLinking.a; 484 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 485 | sourceTree = BUILT_PRODUCTS_DIR; 486 | }; 487 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 488 | isa = PBXReferenceProxy; 489 | fileType = archive.ar; 490 | path = libRCTText.a; 491 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 492 | sourceTree = BUILT_PRODUCTS_DIR; 493 | }; 494 | /* End PBXReferenceProxy section */ 495 | 496 | /* Begin PBXResourcesBuildPhase section */ 497 | 00E356EC1AD99517003FC87E /* Resources */ = { 498 | isa = PBXResourcesBuildPhase; 499 | buildActionMask = 2147483647; 500 | files = ( 501 | ); 502 | runOnlyForDeploymentPostprocessing = 0; 503 | }; 504 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 505 | isa = PBXResourcesBuildPhase; 506 | buildActionMask = 2147483647; 507 | files = ( 508 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 509 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 510 | ); 511 | runOnlyForDeploymentPostprocessing = 0; 512 | }; 513 | /* End PBXResourcesBuildPhase section */ 514 | 515 | /* Begin PBXShellScriptBuildPhase section */ 516 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 517 | isa = PBXShellScriptBuildPhase; 518 | buildActionMask = 2147483647; 519 | files = ( 520 | ); 521 | inputPaths = ( 522 | ); 523 | name = "Bundle React Native code and images"; 524 | outputPaths = ( 525 | ); 526 | runOnlyForDeploymentPostprocessing = 0; 527 | shellPath = /bin/sh; 528 | shellScript = "../node_modules/react-native/packager/react-native-xcode.sh"; 529 | showEnvVarsInLog = 1; 530 | }; 531 | /* End PBXShellScriptBuildPhase section */ 532 | 533 | /* Begin PBXSourcesBuildPhase section */ 534 | 00E356EA1AD99517003FC87E /* Sources */ = { 535 | isa = PBXSourcesBuildPhase; 536 | buildActionMask = 2147483647; 537 | files = ( 538 | 00E356F31AD99517003FC87E /* ReactNativeCouchbaseLiteExampleTests.m in Sources */, 539 | ); 540 | runOnlyForDeploymentPostprocessing = 0; 541 | }; 542 | 13B07F871A680F5B00A75B9A /* Sources */ = { 543 | isa = PBXSourcesBuildPhase; 544 | buildActionMask = 2147483647; 545 | files = ( 546 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 547 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 548 | ); 549 | runOnlyForDeploymentPostprocessing = 0; 550 | }; 551 | /* End PBXSourcesBuildPhase section */ 552 | 553 | /* Begin PBXTargetDependency section */ 554 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 555 | isa = PBXTargetDependency; 556 | target = 13B07F861A680F5B00A75B9A /* ReactNativeCouchbaseLiteExample */; 557 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 558 | }; 559 | /* End PBXTargetDependency section */ 560 | 561 | /* Begin PBXVariantGroup section */ 562 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 563 | isa = PBXVariantGroup; 564 | children = ( 565 | 13B07FB21A68108700A75B9A /* Base */, 566 | ); 567 | name = LaunchScreen.xib; 568 | path = ReactNativeCouchbaseLiteExample; 569 | sourceTree = ""; 570 | }; 571 | /* End PBXVariantGroup section */ 572 | 573 | /* Begin XCBuildConfiguration section */ 574 | 00E356F61AD99517003FC87E /* Debug */ = { 575 | isa = XCBuildConfiguration; 576 | buildSettings = { 577 | BUNDLE_LOADER = "$(TEST_HOST)"; 578 | FRAMEWORK_SEARCH_PATHS = ( 579 | "$(SDKROOT)/Developer/Library/Frameworks", 580 | "$(inherited)", 581 | ); 582 | GCC_PREPROCESSOR_DEFINITIONS = ( 583 | "DEBUG=1", 584 | "$(inherited)", 585 | ); 586 | INFOPLIST_FILE = ReactNativeCouchbaseLiteExampleTests/Info.plist; 587 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 588 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 589 | PRODUCT_NAME = "$(TARGET_NAME)"; 590 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeCouchbaseLiteExample.app/ReactNativeCouchbaseLiteExample"; 591 | }; 592 | name = Debug; 593 | }; 594 | 00E356F71AD99517003FC87E /* Release */ = { 595 | isa = XCBuildConfiguration; 596 | buildSettings = { 597 | BUNDLE_LOADER = "$(TEST_HOST)"; 598 | COPY_PHASE_STRIP = NO; 599 | FRAMEWORK_SEARCH_PATHS = ( 600 | "$(SDKROOT)/Developer/Library/Frameworks", 601 | "$(inherited)", 602 | ); 603 | INFOPLIST_FILE = ReactNativeCouchbaseLiteExampleTests/Info.plist; 604 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 605 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 606 | PRODUCT_NAME = "$(TARGET_NAME)"; 607 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeCouchbaseLiteExample.app/ReactNativeCouchbaseLiteExample"; 608 | }; 609 | name = Release; 610 | }; 611 | 13B07F941A680F5B00A75B9A /* Debug */ = { 612 | isa = XCBuildConfiguration; 613 | buildSettings = { 614 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 615 | DEAD_CODE_STRIPPING = NO; 616 | HEADER_SEARCH_PATHS = ( 617 | "$(inherited)", 618 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 619 | "$(SRCROOT)/../node_modules/react-native/React/**", 620 | ); 621 | INFOPLIST_FILE = "ReactNativeCouchbaseLiteExample/Info.plist"; 622 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 623 | OTHER_LDFLAGS = "-ObjC"; 624 | PRODUCT_NAME = ReactNativeCouchbaseLiteExample; 625 | }; 626 | name = Debug; 627 | }; 628 | 13B07F951A680F5B00A75B9A /* Release */ = { 629 | isa = XCBuildConfiguration; 630 | buildSettings = { 631 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 632 | HEADER_SEARCH_PATHS = ( 633 | "$(inherited)", 634 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 635 | "$(SRCROOT)/../node_modules/react-native/React/**", 636 | ); 637 | INFOPLIST_FILE = "ReactNativeCouchbaseLiteExample/Info.plist"; 638 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 639 | OTHER_LDFLAGS = "-ObjC"; 640 | PRODUCT_NAME = ReactNativeCouchbaseLiteExample; 641 | }; 642 | name = Release; 643 | }; 644 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 645 | isa = XCBuildConfiguration; 646 | buildSettings = { 647 | ALWAYS_SEARCH_USER_PATHS = NO; 648 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 649 | CLANG_CXX_LIBRARY = "libc++"; 650 | CLANG_ENABLE_MODULES = YES; 651 | CLANG_ENABLE_OBJC_ARC = YES; 652 | CLANG_WARN_BOOL_CONVERSION = YES; 653 | CLANG_WARN_CONSTANT_CONVERSION = YES; 654 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 655 | CLANG_WARN_EMPTY_BODY = YES; 656 | CLANG_WARN_ENUM_CONVERSION = YES; 657 | CLANG_WARN_INT_CONVERSION = YES; 658 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 659 | CLANG_WARN_UNREACHABLE_CODE = YES; 660 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 661 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 662 | COPY_PHASE_STRIP = NO; 663 | ENABLE_STRICT_OBJC_MSGSEND = YES; 664 | GCC_C_LANGUAGE_STANDARD = gnu99; 665 | GCC_DYNAMIC_NO_PIC = NO; 666 | GCC_OPTIMIZATION_LEVEL = 0; 667 | GCC_PREPROCESSOR_DEFINITIONS = ( 668 | "DEBUG=1", 669 | "$(inherited)", 670 | ); 671 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 672 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 673 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 674 | GCC_WARN_UNDECLARED_SELECTOR = YES; 675 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 676 | GCC_WARN_UNUSED_FUNCTION = YES; 677 | GCC_WARN_UNUSED_VARIABLE = YES; 678 | HEADER_SEARCH_PATHS = ( 679 | "$(inherited)", 680 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 681 | "$(SRCROOT)/../node_modules/react-native/React/**", 682 | ); 683 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 684 | MTL_ENABLE_DEBUG_INFO = YES; 685 | ONLY_ACTIVE_ARCH = YES; 686 | SDKROOT = iphoneos; 687 | }; 688 | name = Debug; 689 | }; 690 | 83CBBA211A601CBA00E9B192 /* Release */ = { 691 | isa = XCBuildConfiguration; 692 | buildSettings = { 693 | ALWAYS_SEARCH_USER_PATHS = NO; 694 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 695 | CLANG_CXX_LIBRARY = "libc++"; 696 | CLANG_ENABLE_MODULES = YES; 697 | CLANG_ENABLE_OBJC_ARC = YES; 698 | CLANG_WARN_BOOL_CONVERSION = YES; 699 | CLANG_WARN_CONSTANT_CONVERSION = YES; 700 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 701 | CLANG_WARN_EMPTY_BODY = YES; 702 | CLANG_WARN_ENUM_CONVERSION = YES; 703 | CLANG_WARN_INT_CONVERSION = YES; 704 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 705 | CLANG_WARN_UNREACHABLE_CODE = YES; 706 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 707 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 708 | COPY_PHASE_STRIP = YES; 709 | ENABLE_NS_ASSERTIONS = NO; 710 | ENABLE_STRICT_OBJC_MSGSEND = YES; 711 | GCC_C_LANGUAGE_STANDARD = gnu99; 712 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 713 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 714 | GCC_WARN_UNDECLARED_SELECTOR = YES; 715 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 716 | GCC_WARN_UNUSED_FUNCTION = YES; 717 | GCC_WARN_UNUSED_VARIABLE = YES; 718 | HEADER_SEARCH_PATHS = ( 719 | "$(inherited)", 720 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 721 | "$(SRCROOT)/../node_modules/react-native/React/**", 722 | ); 723 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 724 | MTL_ENABLE_DEBUG_INFO = NO; 725 | SDKROOT = iphoneos; 726 | VALIDATE_PRODUCT = YES; 727 | }; 728 | name = Release; 729 | }; 730 | /* End XCBuildConfiguration section */ 731 | 732 | /* Begin XCConfigurationList section */ 733 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeCouchbaseLiteExampleTests" */ = { 734 | isa = XCConfigurationList; 735 | buildConfigurations = ( 736 | 00E356F61AD99517003FC87E /* Debug */, 737 | 00E356F71AD99517003FC87E /* Release */, 738 | ); 739 | defaultConfigurationIsVisible = 0; 740 | defaultConfigurationName = Release; 741 | }; 742 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeCouchbaseLiteExample" */ = { 743 | isa = XCConfigurationList; 744 | buildConfigurations = ( 745 | 13B07F941A680F5B00A75B9A /* Debug */, 746 | 13B07F951A680F5B00A75B9A /* Release */, 747 | ); 748 | defaultConfigurationIsVisible = 0; 749 | defaultConfigurationName = Release; 750 | }; 751 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNativeCouchbaseLiteExample" */ = { 752 | isa = XCConfigurationList; 753 | buildConfigurations = ( 754 | 83CBBA201A601CBA00E9B192 /* Debug */, 755 | 83CBBA211A601CBA00E9B192 /* Release */, 756 | ); 757 | defaultConfigurationIsVisible = 0; 758 | defaultConfigurationName = Release; 759 | }; 760 | /* End XCConfigurationList section */ 761 | }; 762 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 763 | } 764 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample.xcodeproj/xcshareddata/xcschemes/ReactNativeCouchbaseLiteExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample/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 "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. The static bundle is automatically 39 | * generated by "Bundle React Native code and images" build step. 40 | */ 41 | 42 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 43 | 44 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 45 | moduleName:@"ReactNativeCouchbaseLiteExample" 46 | initialProperties:nil 47 | launchOptions:launchOptions]; 48 | 49 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 50 | UIViewController *rootViewController = [UIViewController new]; 51 | rootViewController.view = rootView; 52 | self.window.rootViewController = rootViewController; 53 | [self.window makeKeyAndVisible]; 54 | return YES; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/ReactNativeCouchbaseLiteExampleTests/ReactNativeCouchbaseLiteExampleTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface ReactNativeCouchbaseLiteExampleTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation ReactNativeCouchbaseLiteExampleTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /ios/libCBLJSViewCompiler.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfiniteLibrary/infinite-reader/f4c4b1841db3b758584b8461c1b9722c5e0c884f/ios/libCBLJSViewCompiler.a -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeCouchbaseLiteExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "react-native start" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.19.0", 10 | "react-native-android-statusbar": "^0.1.2", 11 | "react-native-fs": "^1.1.0", 12 | "react-native-material-design": "^0.3.1", 13 | "react-native-material-kit": "^0.2.5", 14 | "faker" : "^3.0.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /utils/generate_gutenberg_json.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python2.7 2 | # Note that this script currently requires running with the HEAD version 3 | # of https://github.com/c-w/Gutenberg 4 | # Example run: 5 | # cd utils/ 6 | # git clone https://github.com/c-w/Gutenberg.git 7 | # mv Gutenberg/gutenberg ./ 8 | # ./generate_gutenberg_json.py > generate_gutenberg_json.py 9 | 10 | from gutenberg.acquire import load_metadata, get_metadata_cache 11 | from gutenberg._domain_model.exceptions import CacheAlreadyExistsException 12 | from rdflib import URIRef, Namespace 13 | from rdflib.namespace import RDF, DCTERMS 14 | from json import dumps 15 | 16 | def generate_gutenberg_json(): 17 | """ 18 | Uses the Gutenberg module to fetch and write out a subset of the 19 | Project Gutenberg metadata properties in JSON to standard out. 20 | Returns: nothing, output is to standard out 21 | """ 22 | print "Populating Project Gutenberg RDF cache" 23 | print "If not already populated, this may take several hours..." 24 | try: 25 | cache = get_metadata_cache() 26 | cache.populate() 27 | except CacheAlreadyExistsException: 28 | pass # Don't reload the cache if it already exists 29 | print "Cache populated, iterating over ebooks" 30 | g = load_metadata() 31 | PGTERMS = Namespace('http://www.gutenberg.org/2009/pgterms/') 32 | DCAM = Namespace('http://purl.org/dc/dcam/') 33 | # Needed since PGTERMS.format is taken 34 | PURLFORMAT = URIRef('http://purl.org/dc/terms/format') 35 | returns = [] 36 | for ebook, unused, unused2 in g.triples((None, RDF.type, PGTERMS.ebook)): 37 | ret = {"_id": str(ebook).split("/")[-1]} 38 | try: 39 | ret["title"] = list(g.triples((ebook, DCTERMS.title, None)))[0][2].value 40 | except IndexError: 41 | # If there's no title, don't index this ebook 42 | continue 43 | try: 44 | ret["num_downloads"] = list(g.triples((ebook, PGTERMS.downloads, None)))[0][2].value 45 | except IndexError: 46 | # If there's no title, don't index this ebook 47 | continue 48 | ret["publisher"] = list(g.triples((ebook, DCTERMS.publisher, None)))[0][2].value 49 | try: 50 | creator = list(g.triples((ebook, DCTERMS.creator, None)))[0][2] 51 | ret["creator"] = list(g.triples((creator, PGTERMS.name, None)))[0][2].value 52 | except IndexError: 53 | pass 54 | subjects = list(g.triples((ebook, DCTERMS.subject, None))) 55 | subject_values = [] 56 | for unused5, unused6, subject in subjects: 57 | # Use http://id.loc.gov/authorities/subjects.html 58 | # Library of Congress Subject Headings 59 | if list(g.triples((subject, DCAM.memberOf, None)))[0][2] == DCTERMS.LCSH: 60 | subject_values.append( 61 | list(g.triples((subject, RDF.value, None)))[0][2].value 62 | ) 63 | ret["subjects"] = subject_values 64 | try: 65 | bookshelf = list(g.triples((ebook, PGTERMS.bookshelf, None)))[0][2] 66 | bookshelf_value = unicode(list(g.triples((bookshelf, RDF.value, None)))[0][2]) 67 | ret["bookshelf"] = bookshelf_value 68 | except IndexError: 69 | pass 70 | 71 | formats = list() 72 | for unused3, unused4, has_format in list(g.triples((ebook, DCTERMS.hasFormat, None))): 73 | extent = list(g.triples((has_format, DCTERMS.extent, None)))[0][2].value 74 | purl_format = list(g.triples((has_format, PURLFORMAT, None)))[0][2] 75 | purl_format_value = unicode(list(g.triples((purl_format, RDF.value, None)))[0][2]) 76 | if "html" in purl_format_value or "epub" in purl_format_value: 77 | format = dict({"uri": has_format, "extent": extent, "media_type": purl_format_value}) 78 | formats.append(format) 79 | ret["formats"] = formats 80 | returns.append(ret) 81 | print dumps(returns, indent=4) 82 | 83 | 84 | if __name__ == '__main__': 85 | generate_gutenberg_json() 86 | --------------------------------------------------------------------------------