├── .buckconfig ├── .eslintrc.js ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .vscode └── settings.json ├── .watchmanconfig ├── LICENSE ├── README.md ├── __tests__ ├── CheckboxTest.tsx ├── ListItemRowTest.tsx ├── ListRowTest.tsx ├── NewItemTest.tsx └── __snapshots__ │ ├── CheckboxTest.tsx.snap │ ├── ListItemRowTest.tsx.snap │ ├── ListRowTest.tsx.snap │ └── NewItemTest.tsx.snap ├── android ├── .project ├── .settings │ └── org.eclipse.buildship.core.prefs ├── app │ ├── BUCK │ ├── build.gradle │ ├── build_defs.bzl │ ├── debug.keystore │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── rnsqlitedemo │ │ │ └── ReactNativeFlipper.java │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── rnsqlitedemo │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── app.json ├── babel.config.js ├── e2e ├── addNewList.spec.ts ├── config.json ├── init.ts ├── package-lock.json ├── package.json ├── tsconfig.json └── tslint.json ├── index.js ├── index.macos.js ├── ios ├── Podfile ├── Podfile.lock ├── Pods │ ├── Headers │ │ ├── Private │ │ │ ├── RCTRestart │ │ │ │ └── RCTRestart.h │ │ │ ├── RNFS │ │ │ │ ├── Downloader.h │ │ │ │ ├── NSArray+Map.h │ │ │ │ ├── RNFSManager.h │ │ │ │ └── Uploader.h │ │ │ ├── react-native-sqlite-storage │ │ │ │ ├── SQLite.h │ │ │ │ └── SQLiteResult.h │ │ │ └── rn-fetch-blob │ │ │ │ ├── IOS7Polyfill.h │ │ │ │ ├── RNFetchBlob.h │ │ │ │ ├── RNFetchBlobConst.h │ │ │ │ ├── RNFetchBlobFS.h │ │ │ │ ├── RNFetchBlobNetwork.h │ │ │ │ ├── RNFetchBlobProgress.h │ │ │ │ ├── RNFetchBlobReqBuilder.h │ │ │ │ └── RNFetchBlobRequest.h │ │ └── Public │ │ │ ├── RCTRestart │ │ │ └── RCTRestart.h │ │ │ ├── RNFS │ │ │ ├── Downloader.h │ │ │ ├── NSArray+Map.h │ │ │ ├── RNFSManager.h │ │ │ └── Uploader.h │ │ │ ├── react-native-sqlite-storage │ │ │ ├── SQLite.h │ │ │ └── SQLiteResult.h │ │ │ └── rn-fetch-blob │ │ │ ├── IOS7Polyfill.h │ │ │ ├── RNFetchBlob.h │ │ │ ├── RNFetchBlobConst.h │ │ │ ├── RNFetchBlobFS.h │ │ │ ├── RNFetchBlobNetwork.h │ │ │ ├── RNFetchBlobProgress.h │ │ │ ├── RNFetchBlobReqBuilder.h │ │ │ └── RNFetchBlobRequest.h │ ├── Local Podspecs │ │ ├── RCTRestart.podspec.json │ │ ├── RNFS.podspec.json │ │ ├── React.podspec.json │ │ ├── react-native-sqlite-storage.podspec.json │ │ ├── rn-fetch-blob.podspec.json │ │ └── yoga.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ └── Target Support Files │ │ ├── Pods-RNSQLiteDemo │ │ ├── Pods-RNSQLiteDemo-acknowledgements.markdown │ │ ├── Pods-RNSQLiteDemo-acknowledgements.plist │ │ ├── Pods-RNSQLiteDemo-dummy.m │ │ ├── Pods-RNSQLiteDemo-frameworks.sh │ │ ├── Pods-RNSQLiteDemo-resources.sh │ │ ├── Pods-RNSQLiteDemo.debug.xcconfig │ │ └── Pods-RNSQLiteDemo.release.xcconfig │ │ ├── RCTRestart │ │ ├── RCTRestart-dummy.m │ │ ├── RCTRestart-prefix.pch │ │ └── RCTRestart.xcconfig │ │ ├── RNFS │ │ ├── RNFS-dummy.m │ │ ├── RNFS-prefix.pch │ │ └── RNFS.xcconfig │ │ ├── react-native-sqlite-storage │ │ ├── react-native-sqlite-storage-dummy.m │ │ ├── react-native-sqlite-storage-prefix.pch │ │ └── react-native-sqlite-storage.xcconfig │ │ ├── rn-fetch-blob │ │ ├── rn-fetch-blob-dummy.m │ │ ├── rn-fetch-blob-prefix.pch │ │ └── rn-fetch-blob.xcconfig │ │ └── yoga │ │ ├── yoga-dummy.m │ │ ├── yoga-prefix.pch │ │ └── yoga.xcconfig ├── RNSQLiteDemo-Bridging-Header.h ├── RNSQLiteDemo-tvOS-Bridging-Header.h ├── RNSQLiteDemo-tvOS │ └── Info.plist ├── RNSQLiteDemo-tvOSTests │ └── Info.plist ├── RNSQLiteDemo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── RNSQLiteDemo-tvOS.xcscheme │ │ └── RNSQLiteDemo.xcscheme ├── RNSQLiteDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── RNSQLiteDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ └── main.m └── RNSQLiteDemoTests │ ├── Info.plist │ └── RNSQLiteDemoTests.m ├── macos ├── .gitignore ├── Podfile ├── Podfile.lock ├── RNSQLiteDemo-iOS │ └── Info.plist ├── RNSQLiteDemo-macOS │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Info.plist │ ├── RNSQLiteDemo.entitlements │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── RNSQLiteDemo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── RNSQLiteDemo-iOS.xcscheme │ │ └── RNSQLiteDemo-macOS.xcscheme └── RNSQLiteDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── metro.config.js ├── metro.config.macos.js ├── package-lock.json ├── package.json ├── react-native.config.js ├── src ├── App.tsx ├── components │ ├── AllLists.tsx │ ├── AppText.tsx │ ├── Checkbox.tsx │ ├── Header.tsx │ ├── HomeScreen.tsx │ ├── ListDetailsScreen.tsx │ ├── ListItemRow.tsx │ ├── ListRow.tsx │ ├── LoadingScreen.tsx │ ├── NewItem.tsx │ ├── SettingsScreen.macos.tsx │ └── SettingsScreen.tsx ├── context │ └── DatabaseContext.tsx ├── database │ ├── Constants.ts │ ├── Database.ts │ ├── DatabaseInitialization.ts │ └── InMemoryDatabase.ts ├── hooks │ ├── useDatabaseSync.ts │ ├── useListItems.ts │ └── useLists.ts ├── style │ └── Shared.ts ├── sync │ ├── Authorize.ts │ ├── DatabaseSync.ts │ └── dropbox │ │ ├── DropboxAuthorize.ts │ │ ├── DropboxConstants.ts │ │ ├── DropboxDatabaseSync.macos.ts │ │ ├── DropboxDatabaseSync.ts │ │ └── OAuthConfig.ts └── types │ ├── List.ts │ ├── ListItem.ts │ ├── react-native-restart.d.ts │ ├── rn-fetch-blob.d.ts │ └── shitty-qs.d.ts ├── tsconfig.jest.json ├── tsconfig.json └── tslint.json /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: "@react-native-community", 4 | quotes: "double", 5 | }; 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | 3 | # specific for windows script files 4 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.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 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | yarn-error.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | *.keystore 42 | !debug.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: true, 3 | arrowParens: "always", 4 | jsxBracketSameLine: true, 5 | semi: true, 6 | singleQuote: false, 7 | trailingComma: "all", 8 | printWidth: 120, 9 | }; 10 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.background": "#1F3215", 4 | "titleBar.activeBackground": "#2B471D", 5 | "titleBar.activeForeground": "#F9FCF7" 6 | }, 7 | "java.configuration.updateBuildConfiguration": "disabled" 8 | } -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2020 Bruce Lefebvre 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 | # React Native SQLite + Dropbox sync demo 2 | 3 | This project is a basic List application that demonstrates building an offline first app with SQLite and React Native (featuring TypeScript and CocoaPods under the hood). Once authorized, the database can be synced between multiple iOS devices using Dropbox. 4 | 5 | These instructions cover iOS and macOS usage at this time. 6 | 7 | 8 | ## Install JS dependencies 9 | 10 | npm install 11 | 12 | 13 | ## Install iOS dependencies (requires [Cocoapods](https://cocoapods.org/)) 14 | 15 | pushd ios/ 16 | pod install 17 | popd 18 | 19 | 20 | ## Install macOS dependencies 21 | 22 | pushd macos/ 23 | pod install 24 | popd 25 | 26 | 27 | ## Start the React Native Metro Bundler 28 | 29 | npm run start:macos 30 | 31 | 32 | ## Run (and debug) on the iOS simulator 33 | 34 | With the "React Native Tools" VSCode extension installed, open the Debug tab and press the "Play" button with "Debug iOS" selected in the dropdown. 35 | 36 | When the simulator opens, press Command-D to open the developer menu. Tap "Debug JS Remotely" to connect VSCode to the app and enable debugging. 37 | 38 | Alternatively: 39 | 40 | open ios/RNSQLiteDemo.xcworkspace 41 | 42 | Select a simulator of your choice. Press the "run" button. 43 | 44 | ## Run on the macOS simulator 45 | 46 | Open the macOS Xcode project: 47 | 48 | open macos/RNSQLiteDemo.xcworkspace/ 49 | 50 | Select `My Mac` as the "active scheme". Press the "Build and then run" (Play) button. 51 | 52 | 53 | ## Types and testing 54 | 55 | ### Compile TypeScript source in watch mode 56 | 57 | npm run tsc -- -w 58 | 59 | 60 | ### Run the Jest unit tests 61 | 62 | npm test 63 | 64 | 65 | ### E2E Testing with Detox on iOS 66 | 67 | End-to-end testing happens from within the `e2e/` directory: 68 | 69 | cd e2e/ 70 | npm install 71 | 72 | 73 | #### Build E2E tests 74 | 75 | npm run test:e2e:build 76 | 77 | 78 | #### Run E2E tests 79 | 80 | npm run test:e2e 81 | 82 | 83 | #### Run tests without reinstalling onto the Simulator 84 | 85 | Details on this workflow can be [found here](https://github.com/wix/Detox/blob/master/docs/Guide.DevelopingWhileWritingTests.md): 86 | 87 | npm run test:e2e:reuse 88 | 89 | 90 | ## Troubleshooting 91 | 92 | #### Run Metro Bundler and clear it's cache 93 | 94 | npm start -- --reset-cache 95 | -------------------------------------------------------------------------------- /__tests__/CheckboxTest.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | 4 | import { Checkbox } from "../src/components/Checkbox"; 5 | 6 | test("Renders correctly unchecked", () => { 7 | const tree = renderer.create().toJSON(); 8 | expect(tree).toMatchSnapshot(); 9 | }); 10 | 11 | test("Renders correctly checked", () => { 12 | const tree = renderer.create().toJSON(); 13 | expect(tree).toMatchSnapshot(); 14 | }); 15 | -------------------------------------------------------------------------------- /__tests__/ListItemRowTest.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import { ListItemRow } from "../src/components/ListItemRow"; 4 | import { ListItem } from "../src/types/ListItem"; 5 | 6 | test("ListItemRow renders correctly", () => { 7 | const listItem: ListItem = { 8 | text: "Test list item text", 9 | done: false, 10 | id: 1 11 | }; 12 | const tree = renderer 13 | .create( 14 | console.log("List clicked!")} 17 | /> 18 | ) 19 | .toJSON(); 20 | expect(tree).toMatchSnapshot(); 21 | }); 22 | -------------------------------------------------------------------------------- /__tests__/ListRowTest.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import { ListRow } from "../src/components/ListRow"; 4 | import { List } from "../src/types/List"; 5 | 6 | test("ListRow renders correctly", () => { 7 | const list: List = { title: "Test list title", id: 1 }; 8 | const tree = renderer 9 | .create( 10 | console.log("List clicked!")} 13 | /> 14 | ) 15 | .toJSON(); 16 | expect(tree).toMatchSnapshot(); 17 | }); 18 | -------------------------------------------------------------------------------- /__tests__/NewItemTest.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import { NewItem } from "../src/components/NewItem"; 4 | 5 | test("ListItemRow renders correctly", () => { 6 | const tree = renderer 7 | .create( 8 | Promise.resolve(console.log("create!"))} 13 | handleNameChange={name => console.log(`name: ${name}`)} 14 | /> 15 | ) 16 | .toJSON(); 17 | expect(tree).toMatchSnapshot(); 18 | }); 19 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/CheckboxTest.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Renders correctly checked 1`] = ` 4 | 13 | ☑ 14 | 15 | `; 16 | 17 | exports[`Renders correctly unchecked 1`] = ` 18 | 27 | ⬜ 28 | 29 | `; 30 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/ListItemRowTest.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ListItemRow renders correctly 1`] = ` 4 | 27 | 36 | ⬜ 37 | 38 | 53 | Test list item text 54 | 55 | 56 | `; 57 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/ListRowTest.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ListRow renders correctly 1`] = ` 4 | 33 | 40 | Test list title 41 | 42 | 43 | `; 44 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/NewItemTest.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ListItemRow renders correctly 1`] = ` 4 | 13 | 32 | 54 | 61 | create 62 | 63 | 64 | 65 | `; 66 | -------------------------------------------------------------------------------- /android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | 19 | 1608996354603 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir= 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.rnsqlitedemo", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.rnsqlitedemo", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/debug.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 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/debug/java/com/rnsqlitedemo/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.rnsqlitedemo; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 32 | client.addPlugin(new ReactFlipperPlugin()); 33 | client.addPlugin(new DatabasesFlipperPlugin(context)); 34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 35 | client.addPlugin(CrashReporterPlugin.getInstance()); 36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 37 | NetworkingModule.setCustomClientBuilder( 38 | new NetworkingModule.CustomClientBuilder() { 39 | @Override 40 | public void apply(OkHttpClient.Builder builder) { 41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 42 | } 43 | }); 44 | client.addPlugin(networkFlipperPlugin); 45 | client.start(); 46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 47 | // Hence we run if after all native modules have been initialized 48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 49 | if (reactContext == null) { 50 | reactInstanceManager.addReactInstanceEventListener( 51 | new ReactInstanceManager.ReactInstanceEventListener() { 52 | @Override 53 | public void onReactContextInitialized(ReactContext reactContext) { 54 | reactInstanceManager.removeReactInstanceEventListener(this); 55 | reactContext.runOnNativeModulesQueueThread( 56 | new Runnable() { 57 | @Override 58 | public void run() { 59 | client.addPlugin(new FrescoFlipperPlugin()); 60 | } 61 | }); 62 | } 63 | }); 64 | } else { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/rnsqlitedemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.rnsqlitedemo; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "RNSQLiteDemo"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/rnsqlitedemo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.rnsqlitedemo; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = 17 | new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | @SuppressWarnings("UnnecessaryLocalVariable") 26 | List packages = new PackageList(this).getPackages(); 27 | // Packages that cannot be autolinked yet can be added manually here, for example: 28 | // packages.add(new MyReactNativePackage()); 29 | return packages; 30 | } 31 | 32 | @Override 33 | protected String getJSMainModuleName() { 34 | return "index"; 35 | } 36 | }; 37 | 38 | @Override 39 | public ReactNativeHost getReactNativeHost() { 40 | return mReactNativeHost; 41 | } 42 | 43 | @Override 44 | public void onCreate() { 45 | super.onCreate(); 46 | SoLoader.init(this, /* native exopackage */ false); 47 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 48 | } 49 | 50 | /** 51 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 52 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 53 | * 54 | * @param context 55 | * @param reactInstanceManager 56 | */ 57 | private static void initializeFlipper( 58 | Context context, ReactInstanceManager reactInstanceManager) { 59 | if (BuildConfig.DEBUG) { 60 | try { 61 | /* 62 | We use reflection here to pick up the class that initializes Flipper, 63 | since Flipper library is not available in release mode 64 | */ 65 | Class aClass = Class.forName("com.rnsqlitedemo.ReactNativeFlipper"); 66 | aClass 67 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 68 | .invoke(null, context, reactInstanceManager); 69 | } catch (ClassNotFoundException e) { 70 | e.printStackTrace(); 71 | } catch (NoSuchMethodException e) { 72 | e.printStackTrace(); 73 | } catch (IllegalAccessException e) { 74 | e.printStackTrace(); 75 | } catch (InvocationTargetException e) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RNSQLiteDemo 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.5.2") 16 | 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | 34 | google() 35 | jcenter() 36 | maven { url 'https://www.jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.33.1 29 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blefebvre/react-native-sqlite-demo/c9dde28c2ba92ab2b64147244803308f89f2e0ed/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RNSQLiteDemo' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNSQLiteDemo", 3 | "displayName": "RNSQLiteDemo" 4 | } -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /e2e/addNewList.spec.ts: -------------------------------------------------------------------------------- 1 | import {expect, element, by} from "detox"; 2 | 3 | describe("Add new list test", () => { 4 | const newListTitle = `Test list (time ${Date.now()})`; 5 | 6 | it("should have 'all lists' view visible", async () => { 7 | await expect(element(by.id("allListsView"))).toBeVisible(); 8 | }); 9 | 10 | it("should support creating a new list", async () => { 11 | await element(by.id("newListTextInput")).typeText(newListTitle); 12 | await element(by.id("addListButton")).tap(); 13 | 14 | // Check that our new list was created 15 | await expect(element(by.text(newListTitle).withAncestor(by.id("allListsView")))).toBeVisible(); 16 | }); 17 | 18 | it("should support adding items to the new list", async () => { 19 | // Open the new list 20 | await element(by.id(`listButton:${newListTitle}`)).tap(); 21 | 22 | await expect(element(by.id("viewListModal"))).toBeVisible(); 23 | 24 | // Add a few items to the list 25 | await element(by.id("newItemTextInput")).typeText("Bacon"); 26 | await element(by.id("newItemButton")).tap(); 27 | 28 | await element(by.id("newItemTextInput")).typeText("Bread"); 29 | await element(by.id("newItemButton")).tap(); 30 | 31 | await element(by.id("newItemTextInput")).typeText("Eggs"); 32 | await element(by.id("newItemButton")).tap(); 33 | 34 | // Ensure each item has been added to the list 35 | await expect(element(by.id("listItem:Bacon"))).toBeVisible(); 36 | await expect(element(by.id("listItem:Bread"))).toBeVisible(); 37 | await expect(element(by.id("listItem:Eggs"))).toBeVisible(); 38 | await expect(element(by.id("listItem:Something else"))).toBeNotVisible(); 39 | }); 40 | 41 | it("should mark an item as done", async () => { 42 | await element(by.id("listItem:Bread")).tap(); 43 | // Check for the checkbox:checked accessibility label 44 | await expect(element(by.label("checkbox:checked").withAncestor(by.id("listItem:Bread")))).toBeVisible(); 45 | }); 46 | 47 | it("should delete the new list", async () => { 48 | await element(by.id("deleteListButton")).tap(); 49 | await element(by.text("Yes, delete it")).tap(); 50 | }); 51 | 52 | it("should go back to the main list view, and the test list should be gone", async () => { 53 | await expect(element(by.id("allListsView"))).toBeVisible(); 54 | 55 | await expect(element(by.text(newListTitle).withAncestor(by.id("allListsView")))).toNotExist(); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /e2e/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "ts-jest", 3 | "setupFilesAfterEnv": ["./init.ts"], 4 | "testEnvironment": "node", 5 | "reporters": ["detox/runners/jest/streamlineReporter"], 6 | "verbose": true 7 | } 8 | -------------------------------------------------------------------------------- /e2e/init.ts: -------------------------------------------------------------------------------- 1 | import {cleanup, init} from "detox"; 2 | import * as adapter from "detox/runners/jest/adapter"; 3 | 4 | const config = require("./package.json").detox; 5 | 6 | jest.setTimeout(120000); 7 | jasmine.getEnv().addReporter(adapter); 8 | 9 | beforeAll(async () => { 10 | await init(config, {initGlobals: false}); 11 | }); 12 | 13 | afterAll(async () => { 14 | await cleanup(); 15 | }); 16 | -------------------------------------------------------------------------------- /e2e/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "e2e", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "addNewList.spec.js", 6 | "scripts": { 7 | "test:e2e": "detox test", 8 | "test:e2e:reuse": "detox test --reuse", 9 | "test:e2e:build": "detox build" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "MIT", 14 | "dependencies": {}, 15 | "devDependencies": { 16 | "@types/detox": "^16.4.3", 17 | "@types/jasmine": "^2.8.9", 18 | "@types/jest": "^25.1.2", 19 | "detox": "^17.14.6", 20 | "jest": "^25.1.0", 21 | "ts-jest": "^25.2.0", 22 | "typescript": "^3.1.6" 23 | }, 24 | "detox": { 25 | "configurations": { 26 | "ios.sim.debug": { 27 | "binaryPath": "../ios/build/Build/Products/Debug-iphonesimulator/RNSQLiteDemo.app", 28 | "build": "xcodebuild -workspace ../ios/RNSQLiteDemo.xcworkspace -scheme RNSQLiteDemo -configuration Debug -sdk iphonesimulator -derivedDataPath ../ios/build", 29 | "type": "ios.simulator", 30 | "name": "iPhone 12" 31 | } 32 | }, 33 | "test-runner": "jest", 34 | "runner-config": "./config.json" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "isolatedModules": false, 6 | "typeRoots": ["node_modules/@types", "../node_modules/@types"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /e2e/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended", 5 | "tslint-config-standard", 6 | "tslint-react", 7 | "tslint-config-prettier" 8 | ], 9 | "jsRules": {}, 10 | "rules": { 11 | "ordered-imports": false, 12 | "trailing-comma": false, 13 | "jsx-no-multiline-js": false, 14 | "jsx-no-lambda": false, 15 | "object-literal-sort-keys": false, 16 | "no-console": false, 17 | "interface-name": false, 18 | "max-line-length": false, 19 | "no-var-requires": false 20 | }, 21 | "rulesDirectory": [] 22 | } 23 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import "react-native-gesture-handler"; 2 | import { AppRegistry } from "react-native"; 3 | import { App } from "./src/App"; 4 | import { name as appName } from "./app.json"; 5 | 6 | AppRegistry.registerComponent(appName, () => App); 7 | -------------------------------------------------------------------------------- /index.macos.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from "react-native"; 2 | import { App } from "./src/App"; 3 | import { name as appName } from "./app.json"; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '12.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | def add_flipper_pods!(versions = {}) 5 | versions['Flipper'] ||= '~> 0.33.1' 6 | versions['DoubleConversion'] ||= '1.1.7' 7 | versions['Flipper-Folly'] ||= '~> 2.1' 8 | versions['Flipper-Glog'] ||= '0.3.6' 9 | versions['Flipper-PeerTalk'] ||= '~> 0.0.4' 10 | versions['Flipper-RSocket'] ||= '~> 1.0' 11 | pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' 12 | pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' 13 | pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 14 | pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' 15 | pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' 16 | # List all transitive dependencies for FlipperKit pods 17 | # to avoid them being linked in Release builds 18 | pod 'Flipper', versions['Flipper'], :configuration => 'Debug' 19 | pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' 20 | pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' 21 | pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' 22 | pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' 23 | pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' 24 | pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' 25 | pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' 26 | pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' 27 | pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' 28 | pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' 29 | pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' 30 | pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' 31 | pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 32 | end 33 | 34 | # Post Install processing for Flipper 35 | def flipper_post_install(installer) 36 | installer.pods_project.targets.each do |target| 37 | if target.name == 'YogaKit' 38 | target.build_configurations.each do |config| 39 | config.build_settings['SWIFT_VERSION'] = '4.1' 40 | end 41 | end 42 | end 43 | end 44 | 45 | target 'RNSQLiteDemo' do 46 | # Pods for RNSQLiteDemo 47 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 48 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 49 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 50 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 51 | pod 'React', :path => '../node_modules/react-native/' 52 | pod 'React-Core', :path => '../node_modules/react-native/' 53 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 54 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 55 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 56 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 57 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 58 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 59 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 60 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 61 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 62 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 63 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 64 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 65 | 66 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 67 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 68 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 69 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 70 | pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" 71 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 72 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true 73 | 74 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 75 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 76 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 77 | 78 | pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage' 79 | 80 | target 'RNSQLiteDemoTests' do 81 | inherit! :complete 82 | # Pods for testing 83 | end 84 | 85 | use_native_modules! 86 | 87 | # Enables Flipper. 88 | # 89 | # Note that if you have use_frameworks! enabled, Flipper will not work and 90 | # you should disable these next few lines. 91 | add_flipper_pods! 92 | post_install do |installer| 93 | flipper_post_install(installer) 94 | 95 | # To avoid: "clang: error: linker command failed with exit code 1" arm64 errors 96 | # (sol'n from: https://stackoverflow.com/a/63955114/1867332) 97 | installer.pods_project.build_configurations.each do |config| 98 | config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" 99 | end 100 | end 101 | end 102 | 103 | target 'RNSQLiteDemo-tvOS' do 104 | # Pods for RNSQLiteDemo-tvOS 105 | 106 | target 'RNSQLiteDemo-tvOSTests' do 107 | inherit! :search_paths 108 | # Pods for testing 109 | end 110 | 111 | end 112 | -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/RCTRestart/RCTRestart.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-restart/ios/RCTRestart/RCTRestart.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/RNFS/Downloader.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/Downloader.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/RNFS/NSArray+Map.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/NSArray+Map.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/RNFS/RNFSManager.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/RNFSManager.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/RNFS/Uploader.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/Uploader.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/react-native-sqlite-storage/SQLite.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-sqlite-storage/platforms/ios/SQLite.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/react-native-sqlite-storage/SQLiteResult.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-sqlite-storage/platforms/ios/SQLiteResult.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/IOS7Polyfill.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/IOS7Polyfill.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlob.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlobConst.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobConst.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlobFS.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobFS.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlobNetwork.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobNetwork.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlobProgress.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobProgress.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlobReqBuilder.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobReqBuilder.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Private/rn-fetch-blob/RNFetchBlobRequest.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobRequest.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/RCTRestart/RCTRestart.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-restart/ios/RCTRestart/RCTRestart.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/RNFS/Downloader.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/Downloader.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/RNFS/NSArray+Map.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/NSArray+Map.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/RNFS/RNFSManager.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/RNFSManager.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/RNFS/Uploader.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-fs/Uploader.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/react-native-sqlite-storage/SQLite.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-sqlite-storage/platforms/ios/SQLite.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/react-native-sqlite-storage/SQLiteResult.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/react-native-sqlite-storage/platforms/ios/SQLiteResult.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/IOS7Polyfill.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/IOS7Polyfill.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlob.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlob/RNFetchBlob.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlobConst.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobConst.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlobFS.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobFS.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlobNetwork.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobNetwork.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlobProgress.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobProgress.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlobReqBuilder.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobReqBuilder.h -------------------------------------------------------------------------------- /ios/Pods/Headers/Public/rn-fetch-blob/RNFetchBlobRequest.h: -------------------------------------------------------------------------------- 1 | ../../../../../node_modules/rn-fetch-blob/ios/RNFetchBlobRequest.h -------------------------------------------------------------------------------- /ios/Pods/Local Podspecs/RCTRestart.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RCTRestart", 3 | "version": "0.0.13", 4 | "summary": "React Native Restart Component", 5 | "homepage": "https://github.com/avishayil/react-native-restart#readme", 6 | "license": { 7 | "type": "MIT", 8 | "file": "../LICENSE" 9 | }, 10 | "authors": { 11 | "name": "Avishay Bar", 12 | "email": "http://www.geektime.co.il" 13 | }, 14 | "platforms": { 15 | "ios": "8.0" 16 | }, 17 | "source": { 18 | "git": "git+https://github.com/avishayil/react-native-restart.git", 19 | "tag": "v0.0.13" 20 | }, 21 | "source_files": "RCTRestart/**/*.{h,m}", 22 | "requires_arc": true, 23 | "dependencies": { 24 | "React": [ 25 | 26 | ] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ios/Pods/Local Podspecs/RNFS.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNFS", 3 | "version": "2.16.6", 4 | "homepage": "https://github.com/itinance/react-native-fs", 5 | "summary": "Native filesystem access for react-native", 6 | "license": "MIT", 7 | "authors": { 8 | "Johannes Lumpe": "johannes@lum.pe" 9 | }, 10 | "platforms": { 11 | "ios": "8.0", 12 | "tvos": "9.2" 13 | }, 14 | "source": { 15 | "git": "https://github.com/itinance/react-native-fs", 16 | "tag": "v2.16.6" 17 | }, 18 | "source_files": "*.{h,m}", 19 | "preserve_paths": "**/*.js", 20 | "dependencies": { 21 | "React": [ 22 | 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ios/Pods/Local Podspecs/React.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "React", 3 | "version": "0.62.2", 4 | "summary": "A framework for building native apps using React", 5 | "description": "React Native apps are built using the React JS\nframework, and render directly to native UIKit\nelements using a fully asynchronous architecture.\nThere is no browser and no HTML. We have picked what\nwe think is the best set of features from these and\nother technologies to build what we hope to become\nthe best product development framework available,\nwith an emphasis on iteration speed, developer\ndelight, continuity of technology, and absolutely\nbeautiful and fast products with no compromises in\nquality or capability.", 6 | "homepage": "http://facebook.github.io/react-native/", 7 | "license": "MIT", 8 | "authors": "Facebook, Inc. and its affiliates", 9 | "platforms": { 10 | "ios": "9.0", 11 | "tvos": "9.2" 12 | }, 13 | "source": { 14 | "git": "https://github.com/facebook/react-native.git", 15 | "tag": "v0.62.2" 16 | }, 17 | "preserve_paths": [ 18 | "package.json", 19 | "LICENSE", 20 | "LICENSE-docs" 21 | ], 22 | "cocoapods_version": ">= 1.2.0", 23 | "dependencies": { 24 | "React-Core": [ 25 | "0.62.2" 26 | ], 27 | "React-Core/DevSupport": [ 28 | "0.62.2" 29 | ], 30 | "React-Core/RCTWebSocket": [ 31 | "0.62.2" 32 | ], 33 | "React-RCTActionSheet": [ 34 | "0.62.2" 35 | ], 36 | "React-RCTAnimation": [ 37 | "0.62.2" 38 | ], 39 | "React-RCTBlob": [ 40 | "0.62.2" 41 | ], 42 | "React-RCTImage": [ 43 | "0.62.2" 44 | ], 45 | "React-RCTLinking": [ 46 | "0.62.2" 47 | ], 48 | "React-RCTNetwork": [ 49 | "0.62.2" 50 | ], 51 | "React-RCTSettings": [ 52 | "0.62.2" 53 | ], 54 | "React-RCTText": [ 55 | "0.62.2" 56 | ], 57 | "React-RCTVibration": [ 58 | "0.62.2" 59 | ] 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /ios/Pods/Local Podspecs/react-native-sqlite-storage.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-sqlite-storage", 3 | "version": "5.0.0", 4 | "summary": "SQLite3 bindings for React Native (Android & iOS)", 5 | "homepage": "https://github.com/andpor/react-native-sqlite-storage", 6 | "license": "MIT", 7 | "authors": { 8 | "name": "Andrzej Porebski" 9 | }, 10 | "source": { 11 | "git": "https://github.com/andpor/react-native-sqlite-storage.git", 12 | "tag": "5.0.0" 13 | }, 14 | "platforms": { 15 | "ios": "8.0", 16 | "osx": "10.10" 17 | }, 18 | "preserve_paths": [ 19 | "README.md", 20 | "LICENSE", 21 | "package.json", 22 | "sqlite.js" 23 | ], 24 | "source_files": "platforms/ios/*.{h,m}", 25 | "dependencies": { 26 | "React": [ 27 | 28 | ] 29 | }, 30 | "libraries": "sqlite3" 31 | } 32 | -------------------------------------------------------------------------------- /ios/Pods/Local Podspecs/rn-fetch-blob.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rn-fetch-blob", 3 | "version": "0.12.0", 4 | "summary": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.", 5 | "requires_arc": true, 6 | "license": "MIT", 7 | "homepage": "n/a", 8 | "source": { 9 | "git": "https://github.com/joltup/rn-fetch-blob" 10 | }, 11 | "authors": "Joltup", 12 | "source_files": "ios/**/*.{h,m}", 13 | "platforms": { 14 | "ios": "8.0" 15 | }, 16 | "dependencies": { 17 | "React-Core": [ 18 | 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ios/Pods/Local Podspecs/yoga.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Yoga", 3 | "version": "1.14.0", 4 | "license": { 5 | "type": "MIT" 6 | }, 7 | "homepage": "https://yogalayout.com", 8 | "documentation_url": "https://yogalayout.com/docs/", 9 | "summary": "Yoga is a cross-platform layout engine which implements Flexbox.", 10 | "description": "Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.", 11 | "authors": "Facebook", 12 | "source": { 13 | "git": "https://github.com/facebook/react-native.git", 14 | "tag": "v0.62.2" 15 | }, 16 | "module_name": "yoga", 17 | "header_dir": "yoga", 18 | "requires_arc": false, 19 | "pod_target_xcconfig": { 20 | "DEFINES_MODULE": "YES" 21 | }, 22 | "compiler_flags": [ 23 | "-fno-omit-frame-pointer", 24 | "-fexceptions", 25 | "-Wall", 26 | "-Werror", 27 | "-std=c++1y", 28 | "-fPIC" 29 | ], 30 | "platforms": { 31 | "ios": "9.0", 32 | "tvos": "9.2" 33 | }, 34 | "source_files": "yoga/**/*.{cpp,h}", 35 | "public_header_files": "yoga/{Yoga,YGEnums,YGMacros,YGValue}.h" 36 | } 37 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-RNSQLiteDemo/Pods-RNSQLiteDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_RNSQLiteDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_RNSQLiteDemo 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-RNSQLiteDemo/Pods-RNSQLiteDemo-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 80 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 145 | wait 146 | fi 147 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-RNSQLiteDemo/Pods-RNSQLiteDemo-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-RNSQLiteDemo/Pods-RNSQLiteDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaLibEvent" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FBLazyVector" "${PODS_ROOT}/Headers/Public/FBReactNativeSpec" "${PODS_ROOT}/Headers/Public/Flipper" "${PODS_ROOT}/Headers/Public/Flipper-DoubleConversion" "${PODS_ROOT}/Headers/Public/Flipper-Folly" "${PODS_ROOT}/Headers/Public/Flipper-Glog" "${PODS_ROOT}/Headers/Public/Flipper-PeerTalk" "${PODS_ROOT}/Headers/Public/Flipper-RSocket" "${PODS_ROOT}/Headers/Public/FlipperKit" "${PODS_ROOT}/Headers/Public/OpenSSL-Universal" "${PODS_ROOT}/Headers/Public/RCTRequired" "${PODS_ROOT}/Headers/Public/RCTRestart" "${PODS_ROOT}/Headers/Public/RCTTypeSafety" "${PODS_ROOT}/Headers/Public/RNCAsyncStorage" "${PODS_ROOT}/Headers/Public/RNCMaskedView" "${PODS_ROOT}/Headers/Public/RNFS" "${PODS_ROOT}/Headers/Public/RNGestureHandler" "${PODS_ROOT}/Headers/Public/RNReanimated" "${PODS_ROOT}/Headers/Public/RNScreens" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-RCTText" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/ReactCommon" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/YogaKit" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-netinfo" "${PODS_ROOT}/Headers/Public/react-native-safe-area-context" "${PODS_ROOT}/Headers/Public/react-native-sqlite-storage" "${PODS_ROOT}/Headers/Public/rn-fetch-blob" "$(PODS_ROOT)/Headers/Private/React-Core" 5 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FBReactNativeSpec" "${PODS_CONFIGURATION_BUILD_DIR}/Flipper" "${PODS_CONFIGURATION_BUILD_DIR}/Flipper-DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/Flipper-Folly" "${PODS_CONFIGURATION_BUILD_DIR}/Flipper-Glog" "${PODS_CONFIGURATION_BUILD_DIR}/Flipper-PeerTalk" "${PODS_CONFIGURATION_BUILD_DIR}/Flipper-RSocket" "${PODS_CONFIGURATION_BUILD_DIR}/FlipperKit" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/RCTRestart" "${PODS_CONFIGURATION_BUILD_DIR}/RCTTypeSafety" "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage" "${PODS_CONFIGURATION_BUILD_DIR}/RNCMaskedView" "${PODS_CONFIGURATION_BUILD_DIR}/RNFS" "${PODS_CONFIGURATION_BUILD_DIR}/RNGestureHandler" "${PODS_CONFIGURATION_BUILD_DIR}/RNReanimated" "${PODS_CONFIGURATION_BUILD_DIR}/RNScreens" "${PODS_CONFIGURATION_BUILD_DIR}/React-Core" "${PODS_CONFIGURATION_BUILD_DIR}/React-CoreModules" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTBlob" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTImage" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTLinking" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTNetwork" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTSettings" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTText" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTVibration" "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsi" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsiexecutor" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector" "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon" "${PODS_CONFIGURATION_BUILD_DIR}/Yoga" "${PODS_CONFIGURATION_BUILD_DIR}/YogaKit" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-netinfo" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-safe-area-context" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-sqlite-storage" "${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob" "${PODS_ROOT}/CocoaLibEvent/lib" "${PODS_ROOT}/OpenSSL-Universal/ios/lib" 6 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/YogaKit/YogaKit.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap" 7 | OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -l"DoubleConversion" -l"FBReactNativeSpec" -l"Flipper" -l"Flipper-DoubleConversion" -l"Flipper-Folly" -l"Flipper-Glog" -l"Flipper-PeerTalk" -l"Flipper-RSocket" -l"FlipperKit" -l"Folly" -l"RCTRestart" -l"RCTTypeSafety" -l"RNCAsyncStorage" -l"RNCMaskedView" -l"RNFS" -l"RNGestureHandler" -l"RNReanimated" -l"RNScreens" -l"React-Core" -l"React-CoreModules" -l"React-RCTAnimation" -l"React-RCTBlob" -l"React-RCTImage" -l"React-RCTLinking" -l"React-RCTNetwork" -l"React-RCTSettings" -l"React-RCTText" -l"React-RCTVibration" -l"React-cxxreact" -l"React-jsi" -l"React-jsiexecutor" -l"React-jsinspector" -l"ReactCommon" -l"Yoga" -l"YogaKit" -l"crypto" -l"event" -l"event_core" -l"event_extra" -l"event_pthreads" -l"glog" -l"react-native-netinfo" -l"react-native-safe-area-context" -l"react-native-sqlite-storage" -l"rn-fetch-blob" -l"sqlite3" -l"ssl" -l"stdc++" -framework "AudioToolbox" -framework "CFNetwork" -framework "JavaScriptCore" -framework "MobileCoreServices" -framework "Security" -framework "UIKit" 8 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/YogaKit/YogaKit.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/FlipperKit/FlipperKit.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap" 9 | PODS_BUILD_DIR = ${BUILD_DIR} 10 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 12 | PODS_ROOT = ${SRCROOT}/Pods 13 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 14 | SWIFT_INCLUDE_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YogaKit" 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/Pods-RNSQLiteDemo/Pods-RNSQLiteDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public/CocoaLibEvent" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FBLazyVector" "${PODS_ROOT}/Headers/Public/FBReactNativeSpec" "${PODS_ROOT}/Headers/Public/Flipper" "${PODS_ROOT}/Headers/Public/Flipper-DoubleConversion" "${PODS_ROOT}/Headers/Public/Flipper-Folly" "${PODS_ROOT}/Headers/Public/Flipper-Glog" "${PODS_ROOT}/Headers/Public/Flipper-PeerTalk" "${PODS_ROOT}/Headers/Public/Flipper-RSocket" "${PODS_ROOT}/Headers/Public/FlipperKit" "${PODS_ROOT}/Headers/Public/OpenSSL-Universal" "${PODS_ROOT}/Headers/Public/RCTRequired" "${PODS_ROOT}/Headers/Public/RCTRestart" "${PODS_ROOT}/Headers/Public/RCTTypeSafety" "${PODS_ROOT}/Headers/Public/RNCAsyncStorage" "${PODS_ROOT}/Headers/Public/RNCMaskedView" "${PODS_ROOT}/Headers/Public/RNFS" "${PODS_ROOT}/Headers/Public/RNGestureHandler" "${PODS_ROOT}/Headers/Public/RNReanimated" "${PODS_ROOT}/Headers/Public/RNScreens" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-RCTText" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/ReactCommon" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/YogaKit" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-netinfo" "${PODS_ROOT}/Headers/Public/react-native-safe-area-context" "${PODS_ROOT}/Headers/Public/react-native-sqlite-storage" "${PODS_ROOT}/Headers/Public/rn-fetch-blob" "$(PODS_ROOT)/Headers/Private/React-Core" 5 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaAsyncSocket" "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/FBReactNativeSpec" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/RCTRestart" "${PODS_CONFIGURATION_BUILD_DIR}/RCTTypeSafety" "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage" "${PODS_CONFIGURATION_BUILD_DIR}/RNCMaskedView" "${PODS_CONFIGURATION_BUILD_DIR}/RNFS" "${PODS_CONFIGURATION_BUILD_DIR}/RNGestureHandler" "${PODS_CONFIGURATION_BUILD_DIR}/RNReanimated" "${PODS_CONFIGURATION_BUILD_DIR}/RNScreens" "${PODS_CONFIGURATION_BUILD_DIR}/React-Core" "${PODS_CONFIGURATION_BUILD_DIR}/React-CoreModules" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTBlob" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTImage" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTLinking" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTNetwork" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTSettings" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTText" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTVibration" "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsi" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsiexecutor" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector" "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon" "${PODS_CONFIGURATION_BUILD_DIR}/Yoga" "${PODS_CONFIGURATION_BUILD_DIR}/YogaKit" "${PODS_CONFIGURATION_BUILD_DIR}/glog" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-netinfo" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-safe-area-context" "${PODS_CONFIGURATION_BUILD_DIR}/react-native-sqlite-storage" "${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob" "${PODS_ROOT}/CocoaLibEvent/lib" "${PODS_ROOT}/OpenSSL-Universal/ios/lib" 6 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/YogaKit/YogaKit.modulemap" -fmodule-map-file="${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap" 7 | OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaAsyncSocket" -l"DoubleConversion" -l"FBReactNativeSpec" -l"Folly" -l"RCTRestart" -l"RCTTypeSafety" -l"RNCAsyncStorage" -l"RNCMaskedView" -l"RNFS" -l"RNGestureHandler" -l"RNReanimated" -l"RNScreens" -l"React-Core" -l"React-CoreModules" -l"React-RCTAnimation" -l"React-RCTBlob" -l"React-RCTImage" -l"React-RCTLinking" -l"React-RCTNetwork" -l"React-RCTSettings" -l"React-RCTText" -l"React-RCTVibration" -l"React-cxxreact" -l"React-jsi" -l"React-jsiexecutor" -l"React-jsinspector" -l"ReactCommon" -l"Yoga" -l"YogaKit" -l"crypto" -l"event" -l"event_core" -l"event_extra" -l"event_pthreads" -l"glog" -l"react-native-netinfo" -l"react-native-safe-area-context" -l"react-native-sqlite-storage" -l"rn-fetch-blob" -l"sqlite3" -l"ssl" -l"stdc++" -framework "AudioToolbox" -framework "CFNetwork" -framework "JavaScriptCore" -framework "MobileCoreServices" -framework "Security" -framework "UIKit" 8 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/YogaKit/YogaKit.modulemap" -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap" 9 | PODS_BUILD_DIR = ${BUILD_DIR} 10 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 11 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 12 | PODS_ROOT = ${SRCROOT}/Pods 13 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 14 | SWIFT_INCLUDE_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YogaKit" 15 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 16 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/RCTRestart/RCTRestart-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RCTRestart : NSObject 3 | @end 4 | @implementation PodsDummy_RCTRestart 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/RCTRestart/RCTRestart-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/RCTRestart/RCTRestart.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RCTRestart 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/RCTRestart" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/RCTRestart" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-RCTBlob" "${PODS_ROOT}/Headers/Public/React-RCTText" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/glog" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/React-Core" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTActionSheet" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTBlob" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTImage" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTLinking" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTNetwork" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTSettings" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTText" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTVibration" "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsi" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsiexecutor" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector" "${PODS_CONFIGURATION_BUILD_DIR}/Yoga" "${PODS_CONFIGURATION_BUILD_DIR}/glog" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../node_modules/react-native-restart/ios 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/RNFS/RNFS-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_RNFS : NSObject 3 | @end 4 | @implementation PodsDummy_RNFS 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/RNFS/RNFS-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/RNFS/RNFS.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RNFS 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/RNFS" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/RNFS" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-RCTBlob" "${PODS_ROOT}/Headers/Public/React-RCTText" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/glog" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/React-Core" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTActionSheet" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTBlob" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTImage" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTLinking" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTNetwork" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTSettings" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTText" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTVibration" "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsi" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsiexecutor" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector" "${PODS_CONFIGURATION_BUILD_DIR}/Yoga" "${PODS_CONFIGURATION_BUILD_DIR}/glog" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../node_modules/react-native-fs 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/react-native-sqlite-storage/react-native-sqlite-storage-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_react_native_sqlite_storage : NSObject 3 | @end 4 | @implementation PodsDummy_react_native_sqlite_storage 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/react-native-sqlite-storage/react-native-sqlite-storage-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/react-native-sqlite-storage/react-native-sqlite-storage.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/react-native-sqlite-storage 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/react-native-sqlite-storage" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-RCTBlob" "${PODS_ROOT}/Headers/Public/React-RCTText" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/react-native-sqlite-storage" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/React-Core" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTActionSheet" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTAnimation" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTBlob" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTImage" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTLinking" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTNetwork" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTSettings" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTText" "${PODS_CONFIGURATION_BUILD_DIR}/React-RCTVibration" "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsi" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsiexecutor" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector" "${PODS_CONFIGURATION_BUILD_DIR}/Yoga" "${PODS_CONFIGURATION_BUILD_DIR}/glog" 5 | OTHER_LDFLAGS = -l"sqlite3" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../node_modules/react-native-sqlite-storage 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/rn-fetch-blob/rn-fetch-blob-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_rn_fetch_blob : NSObject 3 | @end 4 | @implementation PodsDummy_rn_fetch_blob 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/rn-fetch-blob/rn-fetch-blob-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/rn-fetch-blob/rn-fetch-blob.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/rn-fetch-blob 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/rn-fetch-blob" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/glog" "${PODS_ROOT}/Headers/Public/rn-fetch-blob" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/DoubleConversion" "${PODS_CONFIGURATION_BUILD_DIR}/Folly" "${PODS_CONFIGURATION_BUILD_DIR}/React-Core" "${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsi" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsiexecutor" "${PODS_CONFIGURATION_BUILD_DIR}/React-jsinspector" "${PODS_CONFIGURATION_BUILD_DIR}/Yoga" "${PODS_CONFIGURATION_BUILD_DIR}/glog" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../node_modules/rn-fetch-blob 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/yoga/yoga-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Yoga : NSObject 3 | @end 4 | @implementation PodsDummy_Yoga 5 | @end 6 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/yoga/yoga-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /ios/Pods/Target Support Files/yoga/yoga.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Yoga 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Yoga" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Yoga" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../node_modules/react-native/ReactCommon/yoga 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo-tvOS-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo.xcodeproj/xcshareddata/xcschemes/RNSQLiteDemo-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 65 | 66 | 67 | 68 | 70 | 76 | 77 | 78 | 79 | 80 | 90 | 92 | 98 | 99 | 100 | 101 | 107 | 109 | 115 | 116 | 117 | 118 | 120 | 121 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo.xcodeproj/xcshareddata/xcschemes/RNSQLiteDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #import 8 | 9 | #if DEBUG 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | 17 | static void InitializeFlipper(UIApplication *application) { 18 | FlipperClient *client = [FlipperClient sharedClient]; 19 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 20 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 21 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 22 | [client addPlugin:[FlipperKitReactPlugin new]]; 23 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 24 | [client start]; 25 | } 26 | #endif 27 | 28 | @implementation AppDelegate 29 | 30 | // Handle incoming deep links into the app 31 | - (BOOL)application:(UIApplication *)application 32 | openURL:(NSURL *)url 33 | options:(NSDictionary *)options 34 | { 35 | return [RCTLinkingManager application:application openURL:url options:options]; 36 | } 37 | 38 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 39 | { 40 | #if DEBUG 41 | InitializeFlipper(application); 42 | #endif 43 | 44 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 45 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 46 | moduleName:@"RNSQLiteDemo" 47 | initialProperties:nil]; 48 | 49 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 50 | 51 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 52 | UIViewController *rootViewController = [UIViewController new]; 53 | rootViewController.view = rootView; 54 | self.window.rootViewController = rootViewController; 55 | [self.window makeKeyAndVisible]; 56 | 57 | // Keep splash around to prevent flash effect 58 | UIView* launchScreenView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] objectAtIndex:0]; 59 | launchScreenView.frame = self.window.bounds; 60 | rootView.loadingView = launchScreenView; 61 | 62 | return YES; 63 | } 64 | 65 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 66 | { 67 | #if DEBUG 68 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 69 | #else 70 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 71 | #endif 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo/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/RNSQLiteDemo/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/RNSQLiteDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | RNSQLiteDemo 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleTypeRole 27 | Editor 28 | CFBundleURLName 29 | com.brucelefebvre.reactnative.RNSQLiteDemo 30 | CFBundleURLSchemes 31 | 32 | com.brucelefebvre.rnsqlitelistapp.oauth 33 | 34 | 35 | 36 | CFBundleVersion 37 | 1 38 | LSRequiresIPhoneOS 39 | 40 | NSAppTransportSecurity 41 | 42 | NSAllowsArbitraryLoads 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | NSLocationWhenInUseUsageDescription 54 | 55 | UILaunchStoryboardName 56 | LaunchScreen 57 | UIRequiredDeviceCapabilities 58 | 59 | armv7 60 | 61 | UIStatusBarStyle 62 | UIStatusBarStyleDarkContent 63 | UISupportedInterfaceOrientations 64 | 65 | UIInterfaceOrientationPortrait 66 | UIInterfaceOrientationLandscapeLeft 67 | UIInterfaceOrientationLandscapeRight 68 | 69 | UIViewControllerBasedStatusBarAppearance 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemo/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ios/RNSQLiteDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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/RNSQLiteDemoTests/RNSQLiteDemoTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface RNSQLiteDemoTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation RNSQLiteDemoTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | Pods/ 3 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 2 | 3 | def add_flipper_pods!(versions = {}) 4 | versions['Flipper'] ||= '~> 0.33.1' 5 | versions['DoubleConversion'] ||= '1.1.7' 6 | versions['Flipper-Folly'] ||= '~> 2.1' 7 | versions['Flipper-Glog'] ||= '0.3.6' 8 | versions['Flipper-PeerTalk'] ||= '~> 0.0.4' 9 | versions['Flipper-RSocket'] ||= '~> 1.0' 10 | 11 | pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' 12 | pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' 13 | pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 14 | pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' 15 | pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' 16 | 17 | # List all transitive dependencies for FlipperKit pods 18 | # to avoid them being linked in Release builds 19 | pod 'Flipper', versions['Flipper'], :configuration => 'Debug' 20 | pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' 21 | pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' 22 | pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' 23 | pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' 24 | pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' 25 | pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' 26 | pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' 27 | pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' 28 | pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' 29 | pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' 30 | pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' 31 | pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' 32 | pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 33 | end 34 | 35 | # Post Install processing for Flipper 36 | def flipper_post_install(installer) 37 | installer.pods_project.targets.each do |target| 38 | if target.name == 'YogaKit' 39 | target.build_configurations.each do |config| 40 | config.build_settings['SWIFT_VERSION'] = '4.1' 41 | end 42 | end 43 | end 44 | end 45 | 46 | abstract_target 'Shared' do 47 | # Pods for RNSQLiteDemo 48 | pod 'FBLazyVector', :path => '../node_modules/react-native-macos/Libraries/FBLazyVector' 49 | pod 'FBReactNativeSpec', :path => '../node_modules/react-native-macos/Libraries/FBReactNativeSpec' 50 | pod 'RCTRequired', :path => '../node_modules/react-native-macos/Libraries/RCTRequired' 51 | pod 'RCTTypeSafety', :path => '../node_modules/react-native-macos/Libraries/TypeSafety' 52 | pod 'React', :path => '../node_modules/react-native-macos/' 53 | pod 'React-Core', :path => '../node_modules/react-native-macos/' 54 | pod 'React-CoreModules', :path => '../node_modules/react-native-macos/React/CoreModules' 55 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native-macos/' 56 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native-macos/Libraries/ActionSheetIOS' 57 | pod 'React-RCTAnimation', :path => '../node_modules/react-native-macos/Libraries/NativeAnimation' 58 | pod 'React-RCTBlob', :path => '../node_modules/react-native-macos/Libraries/Blob' 59 | pod 'React-RCTImage', :path => '../node_modules/react-native-macos/Libraries/Image' 60 | pod 'React-RCTLinking', :path => '../node_modules/react-native-macos/Libraries/LinkingIOS' 61 | pod 'React-RCTNetwork', :path => '../node_modules/react-native-macos/Libraries/Network' 62 | pod 'React-RCTSettings', :path => '../node_modules/react-native-macos/Libraries/Settings' 63 | pod 'React-RCTText', :path => '../node_modules/react-native-macos/Libraries/Text' 64 | pod 'React-RCTVibration', :path => '../node_modules/react-native-macos/Libraries/Vibration' 65 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native-macos/' 66 | 67 | pod 'React-cxxreact', :path => '../node_modules/react-native-macos/ReactCommon/cxxreact' 68 | pod 'React-jsi', :path => '../node_modules/react-native-macos/ReactCommon/jsi' 69 | pod 'React-jsiexecutor', :path => '../node_modules/react-native-macos/ReactCommon/jsiexecutor' 70 | pod 'React-jsinspector', :path => '../node_modules/react-native-macos/ReactCommon/jsinspector' 71 | pod 'ReactCommon/callinvoker', :path => '../node_modules/react-native-macos/ReactCommon' 72 | pod 'ReactCommon/turbomodule/core', :path => '../node_modules/react-native-macos/ReactCommon' 73 | pod 'Yoga', :path => '../node_modules/react-native-macos/ReactCommon/yoga', :modular_headers => true 74 | 75 | pod 'DoubleConversion', :podspec => '../node_modules/react-native-macos/third-party-podspecs/DoubleConversion.podspec' 76 | pod 'glog', :podspec => '../node_modules/react-native-macos/third-party-podspecs/glog.podspec' 77 | pod 'RCT-Folly', :podspec => '../node_modules/react-native-macos/third-party-podspecs/RCT-Folly.podspec' 78 | pod 'boost-for-react-native', :podspec => '../node_modules/react-native-macos/third-party-podspecs/boost-for-react-native.podspec' 79 | 80 | pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage' 81 | 82 | target 'RNSQLiteDemo-macOS' do 83 | platform :macos, '10.15' 84 | use_native_modules! 85 | 86 | # Enables Hermes 87 | # 88 | # Be sure to first install the `hermes-engine-darwin` npm package, e.g.: 89 | # 90 | # $ yarn add 'hermes-engine-darwin@^0.4.3' 91 | # 92 | # pod 'React-Core/Hermes', :path => '../node_modules/react-native-macos/' 93 | # pod 'hermes', :path => '../node_modules/hermes-engine-darwin' 94 | # pod 'libevent', :podspec => '../node_modules/react-native-macos/third-party-podspecs/libevent.podspec' 95 | 96 | # Pods specifically for macOS target 97 | end 98 | 99 | target 'RNSQLiteDemo-iOS' do 100 | platform :ios, '12' 101 | use_native_modules! 102 | 103 | # Enables Flipper. 104 | # 105 | # Note that if you have use_frameworks! enabled, Flipper will not work and 106 | # you should disable these next few lines. 107 | add_flipper_pods! 108 | post_install do |installer| 109 | flipper_post_install(installer) 110 | end 111 | 112 | # Pods specifically for iOS target 113 | end 114 | end 115 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | $(PRODUCT_NAME) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class RCTBridge; 4 | 5 | @interface AppDelegate : NSObject 6 | 7 | @property (nonatomic, readonly) RCTBridge *bridge; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | 6 | @interface AppDelegate () 7 | 8 | @end 9 | 10 | @implementation AppDelegate 11 | 12 | - (void)awakeFromNib { 13 | [super awakeFromNib]; 14 | 15 | _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil]; 16 | } 17 | 18 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 19 | // Insert code here to initialize your application 20 | } 21 | 22 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 23 | // Insert code here to tear down your application 24 | } 25 | 26 | #pragma mark - RCTBridgeDelegate Methods 27 | 28 | - (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge { 29 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:@"main"]; // .jsbundle; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "scale" : "1x", 46 | "size" : "512x512" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "scale" : "2x", 51 | "size" : "512x512" 52 | } 53 | ], 54 | "info" : { 55 | "author" : "xcode", 56 | "version" : 1 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSAppTransportSecurity 26 | 27 | NSAllowsArbitraryLoads 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSMainStoryboardFile 39 | Main 40 | NSPrincipalClass 41 | NSApplication 42 | NSSupportsAutomaticTermination 43 | 44 | NSSupportsSuddenTermination 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/RNSQLiteDemo.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/ViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface ViewController : NSViewController 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/ViewController.m: -------------------------------------------------------------------------------- 1 | #import "ViewController.h" 2 | #import "AppDelegate.h" 3 | 4 | #import 5 | 6 | @implementation ViewController 7 | 8 | - (void)viewDidLoad { 9 | [super viewDidLoad]; 10 | 11 | RCTBridge *bridge = [((AppDelegate *)[NSApp delegate])bridge]; 12 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"RNSQLiteDemo" initialProperties:nil]; 13 | 14 | NSView *view = [self view]; 15 | 16 | [view addSubview:rootView]; 17 | [rootView setBackgroundColor:[NSColor windowBackgroundColor]]; 18 | [rootView setFrame:[view bounds]]; 19 | [rootView setAutoresizingMask:(NSViewMinXMargin | NSViewMinXMargin | NSViewMinYMargin | NSViewMaxYMargin | NSViewWidthSizable | NSViewHeightSizable)]; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo-macOS/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, const char *argv[]) { 4 | return NSApplicationMain(argc, argv); 5 | } 6 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo.xcodeproj/xcshareddata/xcschemes/RNSQLiteDemo-iOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo.xcodeproj/xcshareddata/xcschemes/RNSQLiteDemo-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/RNSQLiteDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /metro.config.macos.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This cli config is needed for development purposes, e.g. for running 3 | * integration tests during local development or on CI services. 4 | */ 5 | 6 | const path = require('path'); 7 | const blacklist = require('metro-config/src/defaults/blacklist'); 8 | 9 | const rnmPath = path.resolve(__dirname, 'node_modules/react-native-macos'); 10 | 11 | module.exports = { 12 | resolver: { 13 | extraNodeModules: { 14 | 'react-native': rnmPath, 15 | }, 16 | platforms: ['macos', 'ios', 'android'], 17 | blacklistRE: blacklist([/node_modules\/react-native\/.*/]), 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RNSQLiteDemo", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "android": "react-native run-android", 6 | "ios": "react-native run-ios", 7 | "start": "react-native start", 8 | "test": "jest", 9 | "lint": "eslint .", 10 | "tsc": "tsc", 11 | "watch": "npm run tsc -- -w", 12 | "start:macos": "node node_modules/react-native-macos/local-cli/cli.js start --use-react-native-macos" 13 | }, 14 | "dependencies": { 15 | "@react-native-async-storage/async-storage": "^1.13.2", 16 | "@react-native-community/masked-view": "^0.1.10", 17 | "@react-native-community/netinfo": "^5.9.9", 18 | "@react-navigation/native": "^5.8.10", 19 | "@react-navigation/stack": "^5.12.8", 20 | "moment": "^2.24.0", 21 | "react": "16.11.0", 22 | "react-native": "0.62.2", 23 | "react-native-fs": "^2.16.4", 24 | "react-native-gesture-handler": "^1.9.0", 25 | "react-native-macos": "^0.62.21", 26 | "react-native-reanimated": "^1.13.2", 27 | "react-native-restart": "0.0.13", 28 | "react-native-safe-area-context": "^3.1.9", 29 | "react-native-screens": "^2.16.1", 30 | "react-native-sqlite-storage": "^5.0.0", 31 | "rn-fetch-blob": "^0.12.0", 32 | "shitty-qs": "^1.0.1" 33 | }, 34 | "devDependencies": { 35 | "@babel/core": "^7.9.0", 36 | "@babel/runtime": "^7.9.2", 37 | "@react-native-community/eslint-config": "^0.0.7", 38 | "@types/jest": "^25.1.2", 39 | "@types/react": "^16.9.56", 40 | "@types/react-native": "^0.62.2", 41 | "@types/react-native-fs": "^2.13.0", 42 | "@types/react-native-sqlite-storage": "^3.3.2", 43 | "@types/react-test-renderer": "^16.9.2", 44 | "babel-jest": "^25.1.0", 45 | "eslint": "^6.8.0", 46 | "jest": "^25.1.0", 47 | "metro-react-native-babel-preset": "^0.58.0", 48 | "prettier": "^1.19.1", 49 | "react-test-renderer": "16.11.0", 50 | "typescript": "^3.9.7" 51 | }, 52 | "jest": { 53 | "preset": "react-native", 54 | "testMatch": [ 55 | "**/__tests__/*.+(ts|tsx|js)" 56 | ] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | const macSwitch = '--use-react-native-macos'; 2 | 3 | if (process.argv.includes(macSwitch)) { 4 | process.argv = process.argv.filter(arg => arg !== macSwitch); 5 | process.argv.push('--config=metro.config.macos.js'); 6 | module.exports = { 7 | reactNativePath: 'node_modules/react-native-macos', 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React, { useState, useEffect } from "react"; 7 | import { AppState, StyleSheet, AppStateStatus, TouchableOpacity, Text } from "react-native"; 8 | import { NavigationContainer } from "@react-navigation/native"; 9 | import { createStackNavigator } from "@react-navigation/stack"; 10 | import { LoadingScreen } from "./components/LoadingScreen"; 11 | import { useDatabaseSync } from "./hooks/useDatabaseSync"; 12 | import { HomeScreen } from "./components/HomeScreen"; 13 | import { SettingsScreen } from "./components/SettingsScreen"; 14 | import { ListDetailsScreen } from "./components/ListDetailsScreen"; 15 | import { List } from "./types/List"; 16 | import { ListContextProvider } from "./context/DatabaseContext"; 17 | import { AppText } from "./components/AppText"; 18 | 19 | // Track the current state of the app as a regular variable (instead of in state), since 20 | // we do not want to re-render when this value changes. 21 | let appState: AppStateStatus; 22 | 23 | // React Navigation stack navigator 24 | const Stack = createStackNavigator(); 25 | 26 | export type RootStackParamList = { 27 | HomeScreen: undefined; 28 | Settings: undefined; 29 | "List Details": { list: List }; 30 | }; 31 | 32 | export const App: React.FunctionComponent = function() { 33 | // Initialize state 34 | const [isLoading, setIsLoading] = useState(false); 35 | const [loadingText, setLoadingText] = useState("Loading..."); 36 | // Read the initial value of AppState 37 | appState = AppState.currentState; 38 | 39 | // Set up a callback to fire when AppState changes (when the app goes to/from the background) 40 | useEffect(function() { 41 | // The app is currently active, so the "change" event will not fire and we need to 42 | // call appIsNowRunningInForeground ourselves. 43 | appIsNowRunningInForeground(); 44 | appState = "active"; 45 | // Listen for app state changes 46 | AppState.addEventListener("change", handleAppStateChange); 47 | 48 | return function() { 49 | // Cleanup function 50 | AppState.removeEventListener("change", handleAppStateChange); 51 | }; 52 | }, []); 53 | 54 | // Handle the app going from foreground to background, and vice versa. 55 | function handleAppStateChange(nextAppState: AppStateStatus) { 56 | if (appState.match(/inactive|background/) && nextAppState === "active") { 57 | // App has moved from the background (or inactive) into the foreground 58 | appIsNowRunningInForeground(); 59 | } 60 | appState = nextAppState; 61 | } 62 | 63 | // Function to run when the app is brought to the foreground 64 | async function appIsNowRunningInForeground() { 65 | console.log("App is now running in the foreground!"); 66 | 67 | // Sync the database with Dropbox 68 | const syncDatabase = useDatabaseSync(prepareForDatabaseUpdate); 69 | syncDatabase(); 70 | } 71 | 72 | // Function to call right before a DB update begins 73 | async function prepareForDatabaseUpdate() { 74 | setIsLoading(true); 75 | setLoadingText("Downloading database..."); 76 | } 77 | 78 | function isReady() { 79 | return isLoading === false; 80 | } 81 | 82 | if (isReady()) { 83 | // Once the database is ready, render the Lists 84 | return ( 85 | 86 | 87 | 88 | ({ 92 | headerRight: () => { 93 | return ( 94 | navigation.navigate("Settings")}> 95 | ⚙️ 96 | 97 | ); 98 | }, 99 | })} 100 | /> 101 | 108 | { 112 | let title = "List details"; 113 | const params: any = route.params; 114 | if (params != null && params.list != null) { 115 | title += `: ${params.list.title}`; 116 | } 117 | return { 118 | headerBackTitle: "Back", 119 | title, 120 | }; 121 | }} 122 | /> 123 | 124 | 125 | 126 | ); 127 | } else { 128 | // Else, show a loading screen 129 | return ; 130 | } 131 | }; 132 | 133 | const styles = StyleSheet.create({ 134 | container: { 135 | flex: 1, 136 | }, 137 | settingsButton: { 138 | paddingRight: 10, 139 | }, 140 | settingsButtonText: { 141 | fontSize: 20, 142 | }, 143 | }); 144 | -------------------------------------------------------------------------------- /src/components/AllLists.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React, { useState } from "react"; 7 | import { View, StyleSheet, FlatList } from "react-native"; 8 | 9 | import { NewItem } from "./NewItem"; 10 | import { List } from "../types/List"; 11 | import { ListRow } from "./ListRow"; 12 | 13 | interface Props { 14 | lists: List[]; 15 | openList(list: List): void; 16 | createList(newListTitle: string): Promise; 17 | } 18 | 19 | // Main page of the app. This component renders: 20 | // - a header, including a cog icon to open the Settings modal 21 | // - the form to add a new List 22 | // - and a list of all the Lists saved locally in the app's database 23 | export const AllLists: React.FunctionComponent = function({ openList, createList, lists }) { 24 | const [newListTitle, setNewListTitle] = useState(""); 25 | 26 | return ( 27 | 28 | setNewListTitle(value)} 31 | handleCreateNewItem={createList} 32 | placeholderText="Enter a name for your new list" 33 | createButtonText="Add list" 34 | buttonTestId="addListButton" 35 | textInputTestId="newListTextInput" 36 | /> 37 | 38 | ( 42 | { 45 | openList(list); 46 | }} 47 | /> 48 | )} 49 | keyExtractor={(item, index) => `${index}`} 50 | /> 51 | 52 | ); 53 | }; 54 | 55 | const styles = StyleSheet.create({ 56 | container: { 57 | paddingLeft: 10, 58 | paddingRight: 10, 59 | flex: 1, 60 | }, 61 | newItemField: {}, 62 | }); 63 | -------------------------------------------------------------------------------- /src/components/AppText.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import * as React from "react"; 7 | import { StyleSheet, Text } from "react-native"; 8 | 9 | interface Props { 10 | children: React.ReactElement | string; 11 | style?: object; 12 | accessibilityLabel?: string; 13 | } 14 | 15 | export const AppText: React.FunctionComponent = function({ children, style, ...props }) { 16 | let combinedStyle; 17 | if (Array.isArray(style)) { 18 | combinedStyle = [styles.appTextStyle, ...style]; 19 | } else { 20 | combinedStyle = { ...styles.appTextStyle, ...style }; 21 | } 22 | 23 | return ( 24 | 25 | {children} 26 | 27 | ); 28 | }; 29 | 30 | const styles = StyleSheet.create({ 31 | appTextStyle: { 32 | color: "#000", 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /src/components/Checkbox.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React from "react"; 7 | import { StyleSheet } from "react-native"; 8 | import { AppText } from "./AppText"; 9 | 10 | interface Props { 11 | checked: boolean; 12 | } 13 | 14 | export const Checkbox: React.FunctionComponent = function(props) { 15 | const { checked } = props; 16 | return ( 17 | 18 | {checked ? "☑" : "⬜"} 19 | 20 | ); 21 | }; 22 | 23 | const styles = StyleSheet.create({ 24 | check: { 25 | fontSize: 30, 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /src/components/Header.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React from "react"; 7 | import { StyleSheet } from "react-native"; 8 | import { AppText } from "./AppText"; 9 | 10 | interface Props { 11 | title: string; 12 | } 13 | 14 | export const Header: React.FunctionComponent = function(props) { 15 | const { title } = props; 16 | return {title}; 17 | }; 18 | 19 | const styles = StyleSheet.create({ 20 | header: { 21 | fontSize: 20, 22 | marginBottom: 20, 23 | marginTop: 20, 24 | }, 25 | }); 26 | -------------------------------------------------------------------------------- /src/components/HomeScreen.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React, { useEffect } from "react"; 7 | import { StackNavigationProp } from "@react-navigation/stack"; 8 | import { RootStackParamList } from "../App"; 9 | import { List } from "../types/List"; 10 | import { useLists } from "../hooks/useLists"; 11 | import { StyleSheet } from "react-native"; 12 | import { AllLists } from "./AllLists"; 13 | 14 | interface Props { 15 | navigation: StackNavigationProp; 16 | } 17 | 18 | // Main page of the app. This component renders: 19 | // - a header, including a cog icon to open the Settings modal 20 | // - the form to add a new List 21 | // - and a list of all the Lists saved locally in the app's database 22 | export const HomeScreen: React.FunctionComponent = function({ navigation }) { 23 | // Use the useLists hook to simplify list management. 24 | const { lists, createList } = useLists(); 25 | const { navigate } = navigation; 26 | 27 | return ( 28 | navigate("List Details", { list })} /> 29 | ); 30 | }; 31 | 32 | const styles = StyleSheet.create({ 33 | container: { 34 | paddingLeft: 10, 35 | paddingRight: 10, 36 | flex: 1, 37 | }, 38 | newItemField: {}, 39 | }); 40 | -------------------------------------------------------------------------------- /src/components/ListDetailsScreen.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React, { useState } from "react"; 7 | import { StyleSheet, SafeAreaView, TouchableOpacity, FlatList, Alert } from "react-native"; 8 | import { NewItem } from "./NewItem"; 9 | import { ListItem } from "../types/ListItem"; 10 | import { ListItemRow } from "./ListItemRow"; 11 | import { useListItems } from "../hooks/useListItems"; 12 | import { StackNavigationProp } from "@react-navigation/stack"; 13 | import { RouteProp } from "@react-navigation/native"; 14 | import { RootStackParamList } from "../App"; 15 | import { useLists } from "../hooks/useLists"; 16 | import { AppText } from "./AppText"; 17 | 18 | interface Props { 19 | navigation: StackNavigationProp; 20 | route: RouteProp; 21 | } 22 | 23 | // Modal dialog to view and manage the items of a single list 24 | export const ListDetailsScreen: React.FunctionComponent = function(props) { 25 | const { navigation, route } = props; 26 | const { list } = route.params; 27 | const [newItemText, setNewItemText] = useState(""); 28 | 29 | // Use the useListItems hook to manage list items, instead of using the DB object directly 30 | const { selectedListsItems, updateListItem, addListItem } = useListItems(list); 31 | // Use the useLists hook to simplify list management 32 | const { deleteList } = useLists(); 33 | 34 | async function toggleListItemDoneness(listItem: ListItem) { 35 | const newDoneState = !listItem.done; 36 | listItem.done = newDoneState; 37 | await updateListItem(listItem); 38 | } 39 | 40 | async function handleAddNewItemToList(): Promise { 41 | if (newItemText.trim() === "") { 42 | // Don't create new list items with no text 43 | return; 44 | } 45 | await addListItem(newItemText); 46 | } 47 | 48 | function promptToDeleteList() { 49 | Alert.alert("Delete list?", "Are you sure you would like to delete this list?", [ 50 | { 51 | text: "Yes, delete it", 52 | style: "destructive", 53 | onPress: async () => { 54 | // Delete the list, then head back to the main view 55 | await deleteList(list); 56 | navigation.goBack(); 57 | }, 58 | }, 59 | { 60 | text: "No", 61 | onPress: () => console.log("Cancel Pressed"), 62 | }, 63 | ]); 64 | } 65 | 66 | return ( 67 | 68 | setNewItemText(value)} 71 | handleCreateNewItem={handleAddNewItemToList} 72 | placeholderText="Enter a new list item" 73 | createButtonText="Add item" 74 | /> 75 | 76 | } 79 | keyExtractor={(_, index) => `item-${index}`} 80 | ListFooterComponent={ 81 | 82 | Delete list 83 | 84 | } 85 | /> 86 | 87 | ); 88 | }; 89 | 90 | const styles = StyleSheet.create({ 91 | container: { 92 | flex: 1, 93 | marginLeft: 10, 94 | marginRight: 10, 95 | }, 96 | deleteList: { 97 | alignItems: "center", 98 | marginTop: 10, 99 | padding: 10, 100 | }, 101 | }); 102 | -------------------------------------------------------------------------------- /src/components/ListItemRow.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React from "react"; 7 | import { StyleSheet, TouchableOpacity } from "react-native"; 8 | import { ListItem } from "../types/ListItem"; 9 | import { AppText } from "./AppText"; 10 | import { Checkbox } from "./Checkbox"; 11 | 12 | interface Props { 13 | listItem: ListItem; 14 | handleListItemClicked(listItem: ListItem): void; 15 | } 16 | 17 | export const ListItemRow: React.FunctionComponent = function(props) { 18 | const { listItem, handleListItemClicked } = props; 19 | return ( 20 | handleListItemClicked(listItem)} 22 | style={styles.row} 23 | testID={`listItem:${listItem.text}`}> 24 | 25 | {listItem.text} 26 | 27 | ); 28 | }; 29 | 30 | const styles = StyleSheet.create({ 31 | row: { 32 | borderWidth: 1, 33 | paddingLeft: 15, 34 | marginTop: 10, 35 | borderRadius: 3, 36 | flexDirection: "row", 37 | alignItems: "center", 38 | }, 39 | itemText: { 40 | marginTop: 15, 41 | marginBottom: 15, 42 | marginLeft: 11, 43 | }, 44 | done: { 45 | textDecorationLine: "line-through", 46 | color: "gray", 47 | }, 48 | }); 49 | -------------------------------------------------------------------------------- /src/components/ListRow.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React from "react"; 7 | import { TouchableOpacity, StyleSheet } from "react-native"; 8 | import { List } from "../types/List"; 9 | import { AppText } from "./AppText"; 10 | 11 | interface Props { 12 | list: List; 13 | handleListClicked(list: List): void; 14 | } 15 | 16 | export const ListRow: React.FunctionComponent = function(props) { 17 | const { list, handleListClicked } = props; 18 | return ( 19 | handleListClicked(list)} style={styles.row} testID={`listButton:${list.title}`}> 20 | {list.title} 21 | 22 | ); 23 | }; 24 | 25 | const styles = StyleSheet.create({ 26 | row: { 27 | borderWidth: 1, 28 | padding: 15, 29 | marginTop: 10, 30 | backgroundColor: "#444", 31 | borderRadius: 3, 32 | shadowColor: "#000", 33 | shadowOffset: { 34 | width: 0, 35 | height: 2, 36 | }, 37 | shadowOpacity: 0.25, 38 | shadowRadius: 3, 39 | }, 40 | text: { 41 | color: "#EEE", 42 | }, 43 | }); 44 | -------------------------------------------------------------------------------- /src/components/LoadingScreen.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React from "react"; 7 | import { ActivityIndicator, StyleSheet, View } from "react-native"; 8 | import { AppText } from "./AppText"; 9 | 10 | interface Props { 11 | text?: string; 12 | } 13 | 14 | // Component that shows a spinner, and some text below it 15 | export const LoadingScreen: React.FunctionComponent = function(props) { 16 | return ( 17 | 18 | 19 | {props.text || "Loading..."} 20 | 21 | ); 22 | }; 23 | 24 | const styles = StyleSheet.create({ 25 | container: { 26 | flex: 1, 27 | justifyContent: "center", 28 | }, 29 | text: { 30 | textAlign: "center", 31 | paddingTop: 10, 32 | }, 33 | }); 34 | -------------------------------------------------------------------------------- /src/components/NewItem.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import * as React from "react"; 7 | import { Keyboard, View, TextInput, StyleSheet, TouchableOpacity } from "react-native"; 8 | import { AppText } from "./AppText"; 9 | 10 | interface Props { 11 | newItemName: string; // Prop that the TextInput is controlled by 12 | placeholderText: string; 13 | createButtonText: string; 14 | buttonTestId?: string; 15 | textInputTestId?: string; 16 | handleNameChange(title: string): void; 17 | handleCreateNewItem(title: string): Promise; 18 | } 19 | 20 | export const NewItem: React.FunctionComponent = function(props) { 21 | const { newItemName, placeholderText, createButtonText, handleNameChange, handleCreateNewItem } = props; 22 | 23 | const createNewItem = () => { 24 | if (newItemName !== "") { 25 | handleCreateNewItem(newItemName).then(() => { 26 | // Reset the text input 27 | handleNameChange(""); 28 | // Dismiss keyboard 29 | Keyboard.dismiss(); 30 | }); 31 | } 32 | }; 33 | 34 | return ( 35 | 36 | 45 | 46 | {createButtonText} 47 | 48 | 49 | ); 50 | }; 51 | 52 | const styles = StyleSheet.create({ 53 | textInput: { 54 | color: "black", 55 | borderWidth: 1, 56 | padding: 5, 57 | flex: 4, 58 | }, 59 | wrapper: { 60 | flexDirection: "row", 61 | alignItems: "center", 62 | paddingTop: 10, 63 | }, 64 | button: { 65 | flex: 1, 66 | flexDirection: "row", 67 | justifyContent: "center", 68 | paddingTop: 5, 69 | paddingBottom: 5, 70 | }, 71 | }); 72 | -------------------------------------------------------------------------------- /src/components/SettingsScreen.macos.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import * as React from "react"; 7 | import { StyleSheet, SafeAreaView } from "react-native"; 8 | import { StackNavigationProp } from "@react-navigation/stack"; 9 | import { RootStackParamList } from "../App"; 10 | import { AppText } from "./AppText"; 11 | 12 | interface Props { 13 | navigation: StackNavigationProp; 14 | } 15 | 16 | export const SettingsScreen: React.FunctionComponent = function({ navigation }) { 17 | return ( 18 | 19 | Dropbox sync is not currently available for macOS. 20 | 21 | ); 22 | }; 23 | 24 | const styles = StyleSheet.create({ 25 | container: { 26 | flex: 1, 27 | marginTop: 10, 28 | marginLeft: 10, 29 | marginRight: 10, 30 | }, 31 | }); 32 | -------------------------------------------------------------------------------- /src/components/SettingsScreen.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React, { useEffect, useState } from "react"; 7 | import { View, StyleSheet, Text, SafeAreaView, TouchableOpacity, Alert } from "react-native"; 8 | import RNRestart from "react-native-restart"; 9 | import { DropboxAuthorize } from "../sync/dropbox/DropboxAuthorize"; 10 | import { DropboxDatabaseSync } from "../sync/dropbox/DropboxDatabaseSync"; 11 | import { LoadingScreen } from "./LoadingScreen"; 12 | import { StackNavigationProp } from "@react-navigation/stack"; 13 | import { RootStackParamList } from "../App"; 14 | 15 | interface Props { 16 | back(): void; 17 | navigation: StackNavigationProp; 18 | } 19 | 20 | const dropboxAuth: DropboxAuthorize = new DropboxAuthorize(); 21 | const dropboxSync: DropboxDatabaseSync = new DropboxDatabaseSync(); 22 | 23 | export const SettingsScreen: React.FunctionComponent = function(props) { 24 | // Initialize state 25 | const [isDropboxStatusKnown, setIsDropboxStatusKnown] = useState(false); 26 | const [hasAuthorizedWithDropbox, setHasAuthorizedWithDropbox] = useState(false); 27 | const [isDownloading, setIsDownloading] = useState(false); 28 | 29 | const { navigation } = props; 30 | 31 | useEffect(() => { 32 | async function checkIfAuthorizedWithDropbox() { 33 | // Check if this user has already authorized with Dropbox 34 | const isAuthorized = await dropboxAuth.hasUserAuthorized(); 35 | setIsDropboxStatusKnown(true); 36 | setHasAuthorizedWithDropbox(isAuthorized); 37 | } 38 | checkIfAuthorizedWithDropbox(); 39 | }, []); // [] = effect has no dependencies, so run this code only on component mount 40 | 41 | function renderDropboxComponents() { 42 | if (hasAuthorizedWithDropbox) { 43 | return ( 44 | 45 | 46 | ✅ You have authorized the app to backup and sync your database file using Dropbox! Tap below to unlink. 47 | 48 | 49 | 50 | Unlink Dropbox 51 | 52 | 53 | ); 54 | } else { 55 | return ( 56 | 57 | Tap below to authorize the app to backup and sync your database file with Dropbox. 58 | 59 | 60 | Authorize with Dropbox 61 | 62 | 63 | ); 64 | } 65 | } 66 | 67 | // Begin authorization flow 68 | async function authorizeWithDropbox(): Promise { 69 | // Begin authorization flow with Dropbox 70 | await dropboxAuth.authorize(); 71 | setHasAuthorizedWithDropbox(true); 72 | 73 | // Check if the remote DB file is newer than the copy we have on device 74 | try { 75 | const remoteDatabaseIsNewer = await dropboxSync.hasRemoteUpdate(); 76 | if (remoteDatabaseIsNewer) { 77 | // We just linked, and there is existing data on Dropbox. Prompt to overwrite it. 78 | Alert.alert( 79 | "Replace local database?", 80 | "Would you like to overwrite the app's current database with the version on Dropbox?", 81 | [ 82 | { 83 | text: "Yes, replace my local DB", 84 | onPress: async function overwriteLocalDB() { 85 | console.log("User chose to replace the local DB."); 86 | // Download the update 87 | try { 88 | setIsDownloading(true); 89 | // Download the database from Dropbox 90 | await dropboxSync.download(); 91 | console.log("DB download success! Reloading app."); 92 | RNRestart.Restart(); 93 | } catch (reason) { 94 | // Error! 95 | setIsDownloading(false); 96 | console.error("Error downloading database from Dropbox. Reason: " + reason); 97 | } 98 | }, 99 | }, 100 | { 101 | text: "No, unlink Dropbox", 102 | onPress: () => unlinkFromDropbox(), 103 | }, 104 | ], 105 | { cancelable: false }, 106 | ); 107 | } else { 108 | // Nothing exists on Dropbox yet, so kick off the 1st upload 109 | return dropboxSync.upload(); 110 | } 111 | } catch (reason) { 112 | Alert.alert("Error", `Unable to authorize with Dropbox. Reason: ${reason}`); 113 | } 114 | } 115 | 116 | function promptToUnlinkFromDropbox() { 117 | Alert.alert( 118 | "Unlink Dropbox", 119 | "Are you sure you would like to unlink Dropbox? Your data will remain on this device, but it will no longer be backed up or synced.", 120 | [ 121 | { 122 | text: "No", 123 | onPress: () => { 124 | // No-op 125 | return; 126 | }, 127 | }, 128 | { 129 | text: "Yes, unlink", 130 | onPress: () => unlinkFromDropbox(), 131 | style: "destructive", 132 | }, 133 | ], 134 | ); 135 | } 136 | 137 | async function unlinkFromDropbox() { 138 | console.log("Unlinking from Dropbox."); 139 | await dropboxAuth.revokeAuthorization(); 140 | setHasAuthorizedWithDropbox(false); 141 | } 142 | 143 | return isDownloading ? ( 144 | 145 | ) : ( 146 | 147 | {isDropboxStatusKnown && renderDropboxComponents()} 148 | 149 | ); 150 | }; 151 | 152 | const styles = StyleSheet.create({ 153 | container: { 154 | flex: 1, 155 | marginTop: 10, 156 | marginLeft: 10, 157 | marginRight: 10, 158 | }, 159 | dropboxButton: { 160 | alignItems: "center", 161 | margin: 10, 162 | marginTop: 25, 163 | paddingTop: 10, 164 | paddingBottom: 10, 165 | borderWidth: 1, 166 | borderRadius: 3, 167 | }, 168 | }); 169 | -------------------------------------------------------------------------------- /src/context/DatabaseContext.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import React, { useContext, useState } from "react"; 7 | import { Database, sqliteDatabase } from "../database/Database"; 8 | import { inMemoryDatabase } from "../database/InMemoryDatabase"; // optional: see comments below 9 | import { List } from "../types/List"; 10 | 11 | // Initialize our Database context. 12 | // Any implementation that matches the Database interface will do. We will go with our 13 | // sqliteDatabase for this app. 14 | const DatabaseContext = React.createContext(undefined); 15 | 16 | // Store the List state in context as well 17 | const ListsContext = React.createContext(undefined); 18 | type SetLists = (lists: List[]) => void; 19 | const SetListsContext = React.createContext(undefined); 20 | 21 | // The provider which enables accessing our list context from it's component tree. 22 | export const ListContextProvider: React.FunctionComponent = function({ children }) { 23 | const [lists, setLists] = useState([]); // Init with empty list of Lists 24 | 25 | return ( 26 | 27 | 28 | {children} 29 | 30 | 31 | ); 32 | 33 | // Alternatively, try the InMemoryDatabase instead by replacing `sqliteDatabase` above 34 | // with `inMemoryDatabase`. 35 | }; 36 | 37 | // Hook to pull our database object from the context and return it. 38 | // Inspired by the Kent C. Dodds approach to using context: https://kentcdodds.com/blog/how-to-use-react-context-effectively 39 | export function useDatabase(): Database { 40 | const database = useContext(DatabaseContext); 41 | if (database === undefined) { 42 | throw new Error("useDatabase must be used within a ListContextProvider"); 43 | } 44 | return database; 45 | } 46 | 47 | export function useListsContext(): List[] { 48 | const listsContext = useContext(ListsContext); 49 | if (listsContext === undefined) { 50 | throw new Error("useListsContext must be used within a ListContextProvider"); 51 | } 52 | return listsContext; 53 | } 54 | 55 | export function useSetListsContext(): SetLists { 56 | const listsUpdateContext = useContext(SetListsContext); 57 | if (listsUpdateContext === undefined) { 58 | throw new Error("useSetListsContext must be used within a ListContextProvider"); 59 | } 60 | return listsUpdateContext; 61 | } 62 | -------------------------------------------------------------------------------- /src/database/Constants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | export const DATABASE = { 7 | FILE_NAME: "AppDatabase.db", 8 | BACKUP_FILE_NAME: "AppDatabase_Backup.db", 9 | }; 10 | -------------------------------------------------------------------------------- /src/database/DatabaseInitialization.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import SQLite from "react-native-sqlite-storage"; 7 | 8 | export class DatabaseInitialization { 9 | // Perform any updates to the database schema. These can occur during initial configuration, or after an app store update. 10 | // This should be called each time the database is opened. 11 | public updateDatabaseTables(database: SQLite.SQLiteDatabase): Promise { 12 | let dbVersion: number = 0; 13 | console.log("Beginning database updates..."); 14 | 15 | // First: create tables if they do not already exist 16 | return database 17 | .transaction(this.createTables) 18 | .then(() => { 19 | // Get the current database version 20 | return this.getDatabaseVersion(database); 21 | }) 22 | .then((version) => { 23 | dbVersion = version; 24 | console.log("Current database version is: " + dbVersion); 25 | 26 | // Perform DB updates based on this version 27 | 28 | // This is included as an example of how you make database schema changes once the app has been shipped 29 | if (dbVersion < 1) { 30 | // Uncomment the next line, and the referenced function below, to enable this 31 | // return database.transaction(this.preVersion1Inserts); 32 | } 33 | // otherwise, 34 | return; 35 | }) 36 | .then(() => { 37 | if (dbVersion < 2) { 38 | // Uncomment the next line, and the referenced function below, to enable this 39 | // return database.transaction(this.preVersion2Inserts); 40 | } 41 | // otherwise, 42 | return; 43 | }); 44 | } 45 | 46 | // Perform initial setup of the database tables 47 | private createTables(transaction: SQLite.Transaction) { 48 | // DANGER! For dev only 49 | const dropAllTables = false; 50 | if (dropAllTables) { 51 | transaction.executeSql("DROP TABLE IF EXISTS List;"); 52 | transaction.executeSql("DROP TABLE IF EXISTS ListItem;"); 53 | transaction.executeSql("DROP TABLE IF EXISTS Version;"); 54 | } 55 | 56 | // List table 57 | transaction.executeSql(` 58 | CREATE TABLE IF NOT EXISTS List( 59 | list_id INTEGER PRIMARY KEY NOT NULL, 60 | title TEXT 61 | ); 62 | `); 63 | 64 | // ListItem table 65 | transaction.executeSql(` 66 | CREATE TABLE IF NOT EXISTS ListItem( 67 | item_id INTEGER PRIMARY KEY NOT NULL, 68 | list_id INTEGER, 69 | text TEXT, 70 | done INTEGER DEFAULT 0, 71 | FOREIGN KEY ( list_id ) REFERENCES List ( list_id ) 72 | ); 73 | `); 74 | 75 | // Version table 76 | transaction.executeSql(` 77 | CREATE TABLE IF NOT EXISTS Version( 78 | version_id INTEGER PRIMARY KEY NOT NULL, 79 | version INTEGER 80 | ); 81 | `); 82 | } 83 | 84 | // Get the version of the database, as specified in the Version table 85 | private getDatabaseVersion(database: SQLite.SQLiteDatabase): Promise { 86 | // Select the highest version number from the version table 87 | return database 88 | .executeSql("SELECT version FROM Version ORDER BY version DESC LIMIT 1;") 89 | .then(([results]) => { 90 | if (results.rows && results.rows.length > 0) { 91 | const version = results.rows.item(0).version; 92 | return version; 93 | } else { 94 | return 0; 95 | } 96 | }) 97 | .catch((error) => { 98 | console.log(`No version set. Returning 0. Details: ${error}`); 99 | return 0; 100 | }); 101 | } 102 | 103 | // Once the app has shipped, use the following functions as a template for updating the database: 104 | /* 105 | // This function should be called when the version of the db is < 1 106 | private preVersion1Inserts(transaction: SQLite.Transaction) { 107 | console.log("Running pre-version 1 DB inserts"); 108 | 109 | // Make schema changes 110 | transaction.executeSql("ALTER TABLE ..."); 111 | 112 | // Lastly, update the database version 113 | transaction.executeSql("INSERT INTO Version (version) VALUES (1);"); 114 | } 115 | 116 | // This function should be called when the version of the db is < 2 117 | private preVersion2Inserts(transaction: SQLite.Transaction) { 118 | console.log("Running pre-version 2 DB inserts"); 119 | 120 | // Make schema changes 121 | transaction.executeSql("ALTER TABLE ..."); 122 | 123 | // Lastly, update the database version 124 | transaction.executeSql("INSERT INTO Version (version) VALUES (2);"); 125 | } 126 | */ 127 | } 128 | -------------------------------------------------------------------------------- /src/database/InMemoryDatabase.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import { Database } from "./Database"; 7 | import { List } from "../types/List"; 8 | import { ListItem } from "../types/ListItem"; 9 | 10 | // A (naive!) in-memory implementation of the Database interface. 11 | let lists = [] as List[]; 12 | let listIdIndex = 0; 13 | 14 | // A Map where each key represents a list ID, and the value is an array of list items. 15 | type ListItemMap = { [key: number]: ListItem[] }; 16 | let listItemsMap: ListItemMap = {}; 17 | let listItemIdIndex = 0; 18 | 19 | async function createList(newListTitle: string) { 20 | const newList: List = { title: newListTitle, id: listIdIndex++ }; 21 | listItemsMap = { ...listItemsMap, [newList.id]: [] }; 22 | lists = [...lists, newList]; 23 | } 24 | 25 | async function addListItem(text: string, list: List) { 26 | const newListItem: ListItem = { text, done: false, id: listItemIdIndex++, listId: list.id }; 27 | const listItemsForList = listItemsMap[list.id]; 28 | const updatedListItemsForList = [...listItemsForList, newListItem]; 29 | listItemsMap = { ...listItemsMap, [list.id]: updatedListItemsForList }; 30 | } 31 | 32 | async function getAllLists(): Promise { 33 | return lists; 34 | } 35 | 36 | async function getListItems(list: List, doneItemsLast: boolean): Promise { 37 | console.log("List:", list, "List items:", listItemsMap[list.id]); 38 | return listItemsMap[list.id]; 39 | } 40 | 41 | async function updateListItem(listItem: ListItem): Promise { 42 | if (listItem.listId !== undefined) { 43 | const listItemsForList = listItemsMap[listItem.listId]; 44 | const updatedListItemsForList = listItemsForList.map((currentItem) => { 45 | if (currentItem.id === listItem.id) { 46 | return listItem; 47 | } else { 48 | return currentItem; 49 | } 50 | }); 51 | // Update state 52 | listItemsMap = { ...listItemsMap, [listItem.listId]: updatedListItemsForList }; 53 | } 54 | } 55 | 56 | async function deleteList(listToDelete: List): Promise { 57 | lists = lists.filter((list) => list.id !== listToDelete.id); 58 | } 59 | 60 | export const inMemoryDatabase: Database = { 61 | createList, 62 | addListItem, 63 | getAllLists, 64 | getListItems, 65 | updateListItem, 66 | deleteList, 67 | }; 68 | -------------------------------------------------------------------------------- /src/hooks/useListItems.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import { useState, useEffect } from "react"; 7 | import { useDatabase } from "../context/DatabaseContext"; 8 | import { List } from "../types/List"; 9 | import { ListItem } from "../types/ListItem"; 10 | 11 | export function useListItems(selectedList: List) { 12 | const database = useDatabase(); 13 | const [selectedListsItems, setSelectedListsItems] = useState([]); 14 | 15 | useEffect(() => { 16 | refreshListsItems(selectedList); 17 | }, [selectedList]); // Note! Run this effect whenever the selectedList changes. 18 | 19 | async function refreshListsItems(listToRefresh: List, doneItemsLast = false): Promise { 20 | console.log(`Refreshing list items for list: ${listToRefresh && listToRefresh.title}`); 21 | 22 | if (listToRefresh !== undefined) { 23 | const selectedListsItems = await database.getListItems(listToRefresh, doneItemsLast); 24 | setSelectedListsItems(selectedListsItems); 25 | } else { 26 | // otherwise, listToRefresh is undefined 27 | return Promise.reject("Could not refresh an undefined list's items"); 28 | } 29 | } 30 | 31 | async function updateListItem(listItem: ListItem): Promise { 32 | await database.updateListItem(listItem); 33 | await refreshListsItems(selectedList); 34 | } 35 | 36 | async function addListItem(newItemText: string): Promise { 37 | await database.addListItem(newItemText, selectedList); 38 | await refreshListsItems(selectedList); 39 | } 40 | 41 | return { 42 | selectedListsItems, 43 | addListItem, 44 | updateListItem, 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /src/hooks/useLists.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import { useEffect } from "react"; 7 | import { List } from "../types/List"; 8 | import { useDatabase, useListsContext, useSetListsContext } from "../context/DatabaseContext"; 9 | 10 | // Hook for managing and accessing lists (CRUD) 11 | export function useLists() { 12 | // Get the lists array and setter from context 13 | const lists: List[] = useListsContext(); 14 | const setLists: (lists: List[]) => void = useSetListsContext(); 15 | const database = useDatabase(); 16 | 17 | useEffect(() => { 18 | refreshLists(); 19 | }, []); 20 | 21 | function refreshLists() { 22 | // Query all lists from the DB, then store them as state 23 | return database.getAllLists().then(setLists); 24 | } 25 | 26 | function createList(newListTitle: string): Promise { 27 | return database.createList(newListTitle).then(refreshLists); 28 | } 29 | 30 | function deleteList(listToDelete: List): Promise { 31 | if (listToDelete !== undefined) { 32 | return database.deleteList(listToDelete).then(refreshLists); 33 | } 34 | // otherwise: 35 | return Promise.reject(Error("Could not delete an undefined list")); 36 | } 37 | 38 | return { 39 | lists, 40 | createList, 41 | deleteList, 42 | refreshLists, 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /src/style/Shared.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import { StyleSheet } from "react-native"; 7 | 8 | export const sharedStyle = StyleSheet.create({ 9 | headerWithButton: { 10 | flexDirection: "row", 11 | justifyContent: "space-between", 12 | }, 13 | headerButton: { 14 | justifyContent: "center", 15 | padding: 5, 16 | }, 17 | }); 18 | -------------------------------------------------------------------------------- /src/sync/Authorize.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | 7 | export interface Authorize { 8 | authorize(): Promise; 9 | revokeAuthorization(): Promise; 10 | hasUserAuthorized(): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /src/sync/DatabaseSync.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | 7 | export interface DatabaseSync { 8 | upload(): Promise; 9 | download(): Promise; 10 | hasSynced(): Promise; 11 | hasRemoteUpdate(): Promise; 12 | hasLastUploadCompleted(): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /src/sync/dropbox/DropboxAuthorize.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | import { Linking } from "react-native"; 7 | import AsyncStorage from "@react-native-async-storage/async-storage"; 8 | import shittyQs from "shitty-qs"; 9 | 10 | import { DROPBOX } from "./DropboxConstants"; 11 | import { OAUTH_CONFIG } from "./OAuthConfig"; 12 | import { Authorize } from "../Authorize"; 13 | 14 | // Class to support authorizing for database synchronization via Dropbox 15 | export class DropboxAuthorize implements Authorize { 16 | private urlHandlerIsListening = false; 17 | private handleOpenURL: (event: { url: string }) => void; 18 | 19 | constructor() { 20 | this._handleOpenURL = this._handleOpenURL.bind(this); 21 | } 22 | 23 | // Authorize with Dropbox. Uses the device's browser to work through the Dropbox 24 | // OAuth 2 process, eventually recording a token and account ID if successful. 25 | public authorize(): Promise { 26 | console.log("Authorization starting..."); 27 | // Generate a random string for Dropbox's state param. 28 | // This helps us be sure a deep link into the app is indeed related to the request 29 | // we made to Dropbox. 30 | const stateValue = Math.random().toString(); 31 | 32 | if (this.urlHandlerIsListening && this.handleOpenURL) { 33 | // There is already a listener! Remove it. 34 | Linking.removeEventListener("url", this.handleOpenURL); 35 | this.urlHandlerIsListening = false; 36 | } 37 | 38 | // Open the Dropbox authorization page in the device browser 39 | return Linking.openURL( 40 | [ 41 | DROPBOX.AUTHORIZE_URL, 42 | "?response_type=token", 43 | `&client_id=${OAUTH_CONFIG.OAUTH_CLIENT_ID}`, 44 | `&redirect_uri=${OAUTH_CONFIG.OAUTH_REDIRECT_URI}`, 45 | `&state=${stateValue}`, 46 | ].join(""), 47 | ) 48 | .catch((err) => console.error("An error occurred trying to open the browser to authorize with Dropbox:", err)) 49 | .then(() => { 50 | return new Promise((resolve, reject) => { 51 | // Callback for when the app is invoked via it's custom URL protocol 52 | this.handleOpenURL = (event: { url: string }) => { 53 | this._handleOpenURL(event, stateValue) 54 | .then(() => { 55 | resolve(); 56 | }) 57 | .catch((reason) => { 58 | reject(reason); 59 | }) 60 | .then(() => { 61 | // "Finally" block 62 | // Remove deep link event listener 63 | Linking.removeEventListener("url", this.handleOpenURL); 64 | this.urlHandlerIsListening = false; 65 | return; 66 | }); 67 | }; 68 | 69 | // Add deep link event listener to catch when Dropbox sends the user back to the app. 70 | Linking.addEventListener("url", this.handleOpenURL); 71 | this.urlHandlerIsListening = true; 72 | }); 73 | }); 74 | } 75 | 76 | public hasUserAuthorized(): Promise { 77 | return AsyncStorage.getItem(DROPBOX.ACCESS_TOKEN_STORAGE_KEY).then((accessToken) => { 78 | if (accessToken !== null) { 79 | // We have an access token! 80 | return true; 81 | } // otherwise 82 | return false; 83 | }); 84 | } 85 | 86 | public revokeAuthorization(): Promise { 87 | return AsyncStorage.getItem(DROPBOX.ACCESS_TOKEN_STORAGE_KEY) 88 | .then((accessToken) => { 89 | if (accessToken === null) { 90 | throw new Error("Cannot unlink without an access token"); 91 | } 92 | 93 | return fetch(DROPBOX.REVOKE_TOKEN_URL, { 94 | method: "POST", 95 | headers: { 96 | Authorization: `Bearer ${accessToken}`, 97 | }, 98 | }); 99 | }) 100 | .then((response) => { 101 | console.log("Unlink response:", response); 102 | // "Success" 103 | if (response.status === 200) { 104 | return; 105 | } 106 | // otherwise 107 | throw new Error( 108 | `Failed to revoke Dropbox token. status: ${response.status} and response: ${JSON.stringify(response)}`, 109 | ); 110 | }) 111 | .then(() => AsyncStorage.removeItem(DROPBOX.ACCESS_TOKEN_STORAGE_KEY)) 112 | .then(() => AsyncStorage.removeItem(DROPBOX.LAST_UPDATE_STATUS_KEY)) 113 | .then(() => AsyncStorage.removeItem(DROPBOX.MOST_RECENT_BACKUP_TIMESTAMP_KEY)); 114 | } 115 | 116 | // Private helpers 117 | 118 | private _handleOpenURL(event: { url: string }, stateValue: string): Promise { 119 | console.log("Deep link event!", event); 120 | 121 | const queryStringResult = event.url.match(/\#(.*)/); 122 | if (queryStringResult === null || queryStringResult.length < 2) { 123 | return Promise.reject("Did not receive a query string as part of this deep link!"); 124 | } 125 | 126 | const [, queryString] = queryStringResult; 127 | const parsedQueryString = shittyQs(queryString); 128 | if (parsedQueryString.error) { 129 | // There was an error! 130 | const errorCode = parsedQueryString.error; 131 | const errorDescription = parsedQueryString.error_description; 132 | 133 | console.error("Dropbox OAuth error! code:", errorCode); 134 | console.error("Error description:", errorDescription); 135 | 136 | return Promise.reject(`Could not authorize with Dropbox. Code: ${errorCode}`); 137 | } 138 | 139 | if (stateValue !== parsedQueryString.state) { 140 | // This value must match! This is a security feature of Dropbox's OAuth impl 141 | return Promise.reject("State parameter DID NOT MATCH!"); 142 | } 143 | 144 | // Otherwise: not an error! 145 | const accessToken = parsedQueryString.access_token; 146 | const accountId = parsedQueryString.account_id; 147 | 148 | // Persist accessToken and accountId 149 | return AsyncStorage.setItem(DROPBOX.ACCESS_TOKEN_STORAGE_KEY, accessToken) 150 | .then(() => { 151 | return AsyncStorage.setItem(DROPBOX.ACCOUNT_ID_STORAGE_KEY, accountId); 152 | }) 153 | .then(() => { 154 | console.log("Dropbox OAuth authorization success! Account ID:", accountId); 155 | return; 156 | }); 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/sync/dropbox/DropboxConstants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | export const DROPBOX = { 7 | AUTHORIZE_URL: "https://www.dropbox.com/oauth2/authorize", 8 | GET_METADATA_URL: "https://api.dropboxapi.com/2/files/get_metadata", 9 | REVOKE_TOKEN_URL: "https://api.dropboxapi.com/2/auth/token/revoke", 10 | UPLOAD_URL: "https://content.dropboxapi.com/2/files/upload", 11 | DOWNLOAD_URL: "https://content.dropboxapi.com/2/files/download", 12 | API_RESULT_HEADER_NAME: "dropbox-api-result", 13 | CLIENT_MODIFIED_TIMESTAMP_KEY: "client_modified", 14 | ACCESS_TOKEN_STORAGE_KEY: "dropbox:token", 15 | ACCOUNT_ID_STORAGE_KEY: "dropbox:accountId", 16 | MOST_RECENT_BACKUP_TIMESTAMP_KEY: "dropbox:mostRecentBackupTimestamp", 17 | LAST_UPDATE_STATUS_KEY: "dropbox:lastUpdateStatus", 18 | UPDATE_STATUS_STARTED: "updateStarted", 19 | UPDATE_STATUS_FINISHED: "updateFinished", 20 | NO_SUCH_FILE_ERROR_SUBSTRING: "couldn’t be opened because there is no such file", 21 | }; 22 | -------------------------------------------------------------------------------- /src/sync/dropbox/DropboxDatabaseSync.macos.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | 7 | import { DatabaseSync } from "../DatabaseSync"; 8 | 9 | // Class to mock out Dropbox backup and sync on macOS. 10 | // This was done because the "react-native-fs" plugin does not support the macOS platform. 11 | export class DropboxDatabaseSync implements DatabaseSync { 12 | // Has the app been configured to sync it's database? 13 | public hasSynced(): Promise { 14 | // Always return false on macOS, which will prevent the sync process from proceeding 15 | return Promise.resolve(false); 16 | } 17 | 18 | public upload(): Promise { 19 | // Resolve immediately on macOS 20 | return Promise.resolve(); 21 | } 22 | 23 | public hasRemoteUpdate(): Promise { 24 | throw new Error("Not implemented on macOS"); 25 | } 26 | 27 | public hasLastUploadCompleted(): Promise { 28 | throw new Error("Not implemented on macOS"); 29 | } 30 | 31 | public download(): Promise { 32 | throw new Error("Not implemented on macOS"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/sync/dropbox/OAuthConfig.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | export const OAUTH_CONFIG = { 7 | // Replace with YOUR unique redirect URI 8 | OAUTH_REDIRECT_URI: "com.brucelefebvre.rnsqlitelistapp.oauth://oauthredirect", 9 | // Replace with YOUR unique client ID 10 | OAUTH_CLIENT_ID: "eb4o7i48qif5djh", 11 | }; 12 | -------------------------------------------------------------------------------- /src/types/List.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2021 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | export interface List { 7 | title: string; 8 | id: number; 9 | } 10 | -------------------------------------------------------------------------------- /src/types/ListItem.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * React Native SQLite Demo 3 | * Copyright (c) 2018-2020 Bruce Lefebvre 4 | * https://github.com/blefebvre/react-native-sqlite-demo/blob/master/LICENSE 5 | */ 6 | export interface ListItem { 7 | text: string; 8 | done: boolean; 9 | id: number; 10 | listId?: number; 11 | } 12 | -------------------------------------------------------------------------------- /src/types/react-native-restart.d.ts: -------------------------------------------------------------------------------- 1 | declare module "react-native-restart"; 2 | -------------------------------------------------------------------------------- /src/types/rn-fetch-blob.d.ts: -------------------------------------------------------------------------------- 1 | declare module "rn-fetch-blob"; 2 | -------------------------------------------------------------------------------- /src/types/shitty-qs.d.ts: -------------------------------------------------------------------------------- 1 | declare module "shitty-qs"; 2 | -------------------------------------------------------------------------------- /tsconfig.jest.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "jsx": "react", 5 | "module": "commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "allowSyntheticDefaultImports": true, 5 | "esModuleInterop": true, 6 | "isolatedModules": true, 7 | "jsx": "react-native", 8 | "lib": ["es6"], 9 | "moduleResolution": "node", 10 | "noEmit": true, 11 | "strict": true, 12 | "strictPropertyInitialization": false, 13 | "target": "esnext", 14 | "typeRoots": ["node_modules/@types"] 15 | }, 16 | "exclude": ["node_modules", "e2e", "*.js"] 17 | } 18 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": [ 4 | "tslint:recommended", 5 | "tslint-config-standard", 6 | "tslint-react", 7 | "tslint-config-prettier" 8 | ], 9 | "jsRules": {}, 10 | "rules": { 11 | "ordered-imports": false, 12 | "trailing-comma": false, 13 | "jsx-no-multiline-js": false, 14 | "jsx-no-lambda": false, 15 | "object-literal-sort-keys": false, 16 | "no-console": false, 17 | "interface-name": false, 18 | "max-line-length": false 19 | }, 20 | "rulesDirectory": [] 21 | } 22 | --------------------------------------------------------------------------------