├── .gitignore ├── README.md ├── android ├── README.md ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── kotlin │ └── com │ └── contacttracing │ ├── ContactTracingModule.kt │ └── ContactTracingPackage.kt ├── example ├── .gitignore ├── App.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── contacttracingexample │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── contacttracingexample │ │ │ │ ├── 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 ├── index.js ├── ios │ ├── ContactTracingExample-Bridging-Header.h │ ├── ContactTracingExample.xcodeproj │ │ └── project.pbxproj │ ├── ContactTracingExample │ │ ├── AppDelegate+RNCAsyncStorageDelegate.h │ │ ├── AppDelegate+RNCAsyncStorageDelegate.m │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── RNCTestAsyncStorageDelegate.h │ │ ├── RNCTestAsyncStorageDelegate.m │ │ └── main.m │ ├── Podfile │ ├── Podfile.lock │ └── stub.swift └── metro.config.js ├── index.d.ts ├── index.js ├── ios ├── CTStub.h ├── CTStub.m ├── ContactTracing-Bridging-Header.h ├── ContactTracing.m ├── ContactTracing.swift ├── ContactTracing.xcodeproj │ └── project.pbxproj └── ContactTracing.xcworkspace │ └── contents.xcworkspacedata ├── package.json ├── react-native-contact-tracing.podspec ├── react-native.config.js └── yarn.lock /.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 | xcshareddata/ 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | !debug.keystore 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://docs.fastlane.tools/best-practices/source-control/ 51 | 52 | */fastlane/report.xml 53 | */fastlane/Preview.html 54 | */fastlane/screenshots 55 | 56 | # Bundle artifact 57 | *.jsbundle 58 | 59 | # CocoaPods 60 | /ios/Pods/ 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-contact-tracing 2 | 3 | :warning: I do not own the `react-native-contact-tracing` package on npm. My package will remain unpublished until the official frameworks are released. The current owner of `react-native-contact-tracing` has a boilerplate project published to it and is in no way related to this repository. Until I can contact the owner of the package or find a better name: **do not install this package from the directions below, they are placeholders only.** 4 | 5 | A native module for Apple & Google's 6 | [Contact Tracing Framework][privacy-preserving contact tracing]. 7 |

This work is based on [mattt's](https://github.com/mattt) theoretical [ContactTracingManager][ContactTracingManager], Apple's `ContactTracing` [API Documentation][API Docs] & Google's [Android API Docs][Android API Docs]. 8 | 9 | **Help welcome for Android! see issue #1** 10 | 11 | ## Getting started 12 | 13 | `$ npm install react-native-contact-tracing --save` 14 | 15 | ### Mostly automatic installation 16 | 17 | `$ react-native link react-native-contact-tracing` 18 | 19 | ## Usage 20 | 21 | ### Example 22 | 23 | ```javascript 24 | import ContactTracing from 'react-native-contact-tracing'; 25 | 26 | contactTracing.start(); 27 | ``` 28 | 29 | ## Methods 30 | 31 | ### Summary 32 | 33 | * [`start`](#start) 34 | * [`stop`](#stop) 35 | * [`requestExposureSummary`](#requestexposuresummary) 36 | * [`currentStatus`](#currentstatus) 37 | 38 | --- 39 | 40 | ### Details 41 | 42 | #### `start()` 43 | 44 | ```javascript 45 | await contactTracing.start(); 46 | ``` 47 | 48 | Begin contact tracing, asking for permissions if need be. This returns a promise that resolves if tracing began successfully. 49 | 50 | --- 51 | 52 | #### `stop()` 53 | 54 | ```javascript 55 | await contactTracing.stop(); 56 | ``` 57 | 58 | Stops contact tracing, this also returns a promise that resolves if tracing ended successfully. 59 | 60 | --- 61 | 62 | #### `requestExposureSummary()` 63 | 64 | ```javascript 65 | const { matchedKeyCount, contactInformation } = await contactTracing.requestExposureSummary(); 66 | ``` 67 | 68 | Provides a summary on exposures. This returns a promise that resolves to an object containing the matchedKeyCount & an array of CTContactInfo objects. 69 | 70 | --- 71 | 72 | #### `currentStatus()` 73 | 74 | ```javascript 75 | const status = await contactTracing.currentStatus(); 76 | ``` 77 | 78 | This returns a promise that resolves to the current tracing status. The value is an integer. 79 | 80 | --- 81 | 82 | ## License 83 | 84 | This project has no affiliation with Apple or Google. 85 | 86 | Information subject to copyright. 87 | All rights reserved. 88 | 89 | [privacy-preserving contact tracing]: https://www.apple.com/covid19/contacttracing 90 | [ContactTracingManager]: https://gist.github.com/mattt/17c880d64c362b923e13c765f5b1c75a 91 | [API Docs]: https://covid19-static.cdn-apple.com/applications/covid19/current/static/contact-tracing/pdf/ContactTracing-FrameworkDocumentation.pdf 92 | [Android API Docs]: https://www.blog.google/documents/55/Android_Contact_Tracing_API.pdf 93 | -------------------------------------------------------------------------------- /android/README.md: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | 4 | If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm: 5 | 6 | 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed 7 | 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK 8 | ``` 9 | ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle 10 | sdk.dir=/Users/{username}/Library/Android/sdk 11 | ``` 12 | 3. Delete the `maven` folder 13 | 4. Run `./gradlew installArchives` 14 | 5. Verify that latest set of generated files is in the maven folder with the correct version number 15 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | def DEFAULT_COMPILE_SDK_VERSION = 28 2 | def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3' 3 | def DEFAULT_MIN_SDK_VERSION = 16 4 | def DEFAULT_TARGET_SDK_VERSION = 28 5 | 6 | def safeExtGet(prop, fallback) { 7 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 8 | } 9 | 10 | 11 | buildscript { 12 | ext.kotlin_version = '1.3.71' 13 | 14 | // The Android Gradle plugin is only required when opening the android folder stand-alone. 15 | // This avoids unnecessary downloads and potential conflicts when the library is included as a 16 | // module dependency in an application project. 17 | // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies 18 | 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | dependencies { 24 | if (project == rootProject) { 25 | classpath 'com.android.tools.build:gradle:3.4.1' 26 | } 27 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 28 | } 29 | } 30 | 31 | apply plugin: 'com.android.library' 32 | apply plugin: 'maven' 33 | apply plugin: 'kotlin-android' 34 | 35 | android { 36 | compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) 37 | buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) 38 | defaultConfig { 39 | minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) 40 | targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) 41 | versionCode 1 42 | versionName "1.0" 43 | } 44 | lintOptions { 45 | abortOnError false 46 | } 47 | } 48 | 49 | repositories { 50 | // ref: https://www.baeldung.com/maven-local-repository 51 | mavenLocal() 52 | maven { 53 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 54 | url "$rootDir/../node_modules/react-native/android" 55 | } 56 | maven { 57 | // Android JSC is installed from npm 58 | url "$rootDir/../node_modules/jsc-android/dist" 59 | } 60 | google() 61 | jcenter() 62 | } 63 | 64 | dependencies { 65 | //noinspection GradleDynamicVersion 66 | implementation 'com.facebook.react:react-native:+' // From node_modules 67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 68 | } 69 | 70 | def configureReactNativePom(def pom) { 71 | def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) 72 | 73 | pom.project { 74 | name packageJson.title 75 | artifactId packageJson.name 76 | version = packageJson.version 77 | group = "com.contacttracing" 78 | description packageJson.description 79 | url packageJson.repository.baseUrl 80 | 81 | licenses { 82 | license { 83 | name packageJson.license 84 | url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename 85 | distribution 'repo' 86 | } 87 | } 88 | 89 | developers { 90 | developer { 91 | id packageJson.author.username 92 | name packageJson.author.name 93 | } 94 | } 95 | } 96 | } 97 | 98 | afterEvaluate { project -> 99 | // some Gradle build hooks ref: 100 | // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html 101 | task androidJavadoc(type: Javadoc) { 102 | source = android.sourceSets.main.java.srcDirs 103 | classpath += files(android.bootClasspath) 104 | classpath += files(project.getConfigurations().getByName('compile').asList()) 105 | include '**/*.java' 106 | } 107 | 108 | task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { 109 | classifier = 'javadoc' 110 | from androidJavadoc.destinationDir 111 | } 112 | 113 | task androidSourcesJar(type: Jar) { 114 | classifier = 'sources' 115 | from android.sourceSets.main.java.srcDirs 116 | include '**/*.java' 117 | } 118 | 119 | android.libraryVariants.all { variant -> 120 | def name = variant.name.capitalize() 121 | def javaCompileTask = variant.javaCompileProvider.get() 122 | 123 | task "jar${name}"(type: Jar, dependsOn: javaCompileTask) { 124 | from javaCompileTask.destinationDir 125 | } 126 | } 127 | 128 | artifacts { 129 | archives androidSourcesJar 130 | archives androidJavadocJar 131 | } 132 | 133 | task installArchives(type: Upload) { 134 | configuration = configurations.archives 135 | repositories.mavenDeployer { 136 | // Deploy to react-native-event-bridge/maven, ready to publish to npm 137 | repository url: "file://${projectDir}/../android/maven" 138 | configureReactNativePom pom 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/contacttracing/ContactTracingModule.kt: -------------------------------------------------------------------------------- 1 | package com.contacttracing 2 | 3 | import com.facebook.react.bridge.Promise 4 | import com.facebook.react.bridge.ReactApplicationContext 5 | import com.facebook.react.bridge.ReactContextBaseJavaModule 6 | import com.facebook.react.bridge.ReactMethod 7 | 8 | class ContactTracingModule(reactContext: ReactApplicationContext) : 9 | ReactContextBaseJavaModule(reactContext) { 10 | override fun getName() = "ContactTracing" 11 | 12 | override fun getConstants(): MutableMap { 13 | val constants = mutableMapOf() 14 | 15 | constants["supported"] = false 16 | 17 | return constants 18 | } 19 | 20 | @ReactMethod 21 | fun start(promise: Promise) { 22 | promise.resolve("TODO") 23 | } 24 | 25 | @ReactMethod 26 | fun stop(promise: Promise) { 27 | promise.resolve("TODO") 28 | } 29 | 30 | @ReactMethod 31 | fun currentStatus(promise: Promise) { 32 | promise.resolve("TODO") 33 | } 34 | 35 | @ReactMethod 36 | fun requestExposureSummary(promise: Promise) { 37 | promise.resolve("TODO") 38 | } 39 | } -------------------------------------------------------------------------------- /android/src/main/kotlin/com/contacttracing/ContactTracingPackage.kt: -------------------------------------------------------------------------------- 1 | package com.contacttracing 2 | 3 | import android.view.View 4 | import com.facebook.react.ReactPackage 5 | import com.facebook.react.bridge.NativeModule 6 | import com.facebook.react.bridge.ReactApplicationContext 7 | import com.facebook.react.uimanager.ReactShadowNode 8 | import com.facebook.react.uimanager.ViewManager 9 | 10 | class ContactTracingPackage : ReactPackage { 11 | override fun createNativeModules(reactContext: ReactApplicationContext): MutableList { 12 | val moduleList = mutableListOf() 13 | moduleList.add(ContactTracingModule(reactContext)) 14 | return moduleList 15 | } 16 | 17 | override fun createViewManagers(reactContext: ReactApplicationContext): MutableList>> { 18 | return mutableListOf() // empty 19 | } 20 | } -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | *.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | Pods/ -------------------------------------------------------------------------------- /example/App.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | import React, {useEffect, useState} from 'react'; 4 | import { 5 | SafeAreaView, 6 | StyleSheet, 7 | Text, 8 | } from 'react-native'; 9 | 10 | import ContactTracing, { ContactTracingStatus } from '../' 11 | 12 | export default () => { 13 | const [state, setState] = useState(ContactTracingStatus.UNKNOWN); 14 | 15 | useEffect(() => { 16 | ContactTracing.start(); 17 | }, []); 18 | 19 | useEffect(() => { 20 | async function getState() { 21 | const status = await ContactTracing.currentStatus(); 22 | setState(status); 23 | } 24 | 25 | getState(); 26 | }, [state]); 27 | 28 | return ( 29 | 30 | Supported: {String(ContactTracing.getConstants()["supported"])} 31 | Status: {state} 32 | 33 | ) 34 | } 35 | 36 | 37 | const styles = StyleSheet.create({ 38 | container: { 39 | flex: 1, 40 | backgroundColor: '#F5FCFF', 41 | alignItems: 'center', 42 | justifyContent: 'center' 43 | }, 44 | }); 45 | -------------------------------------------------------------------------------- /example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | 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.contacttracingexample", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.contacttracingexample", 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 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation. If none specified and 19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 20 | * // default. Can be overridden with ENTRY_FILE environment variable. 21 | * entryFile: "index.android.js", 22 | * 23 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 24 | * bundleCommand: "ram-bundle", 25 | * 26 | * // whether to bundle JS and assets in debug mode 27 | * bundleInDebug: false, 28 | * 29 | * // whether to bundle JS and assets in release mode 30 | * bundleInRelease: true, 31 | * 32 | * // whether to bundle JS and assets in another build variant (if configured). 33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 34 | * // The configuration property can be in the following formats 35 | * // 'bundleIn${productFlavor}${buildType}' 36 | * // 'bundleIn${buildType}' 37 | * // bundleInFreeDebug: true, 38 | * // bundleInPaidRelease: true, 39 | * // bundleInBeta: true, 40 | * 41 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 42 | * // for example: to disable dev mode in the staging build type (if configured) 43 | * devDisabledInStaging: true, 44 | * // The configuration property can be in the following formats 45 | * // 'devDisabledIn${productFlavor}${buildType}' 46 | * // 'devDisabledIn${buildType}' 47 | * 48 | * // the root of your project, i.e. where "package.json" lives 49 | * root: "../../", 50 | * 51 | * // where to put the JS bundle asset in debug mode 52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 53 | * 54 | * // where to put the JS bundle asset in release mode 55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 56 | * 57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 58 | * // require('./image.png')), in debug mode 59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 60 | * 61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 62 | * // require('./image.png')), in release mode 63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 64 | * 65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 69 | * // for example, you might want to remove it from here. 70 | * inputExcludes: ["android/**", "ios/**"], 71 | * 72 | * // override which node gets called and with what additional arguments 73 | * nodeExecutableAndArgs: ["node"], 74 | * 75 | * // supply additional arguments to the packager 76 | * extraPackagerArgs: [] 77 | * ] 78 | */ 79 | 80 | project.ext.react = [ 81 | enableHermes: false, // clean and rebuild if changing 82 | ] 83 | 84 | apply from: "../../../node_modules/react-native/react.gradle" 85 | 86 | /** 87 | * Set this to true to create two separate APKs instead of one: 88 | * - An APK that only works on ARM devices 89 | * - An APK that only works on x86 devices 90 | * The advantage is the size of the APK is reduced by about 4MB. 91 | * Upload all the APKs to the Play Store and people will download 92 | * the correct one based on the CPU architecture of their device. 93 | */ 94 | def enableSeparateBuildPerCPUArchitecture = false 95 | 96 | /** 97 | * Run Proguard to shrink the Java bytecode in release builds. 98 | */ 99 | def enableProguardInReleaseBuilds = false 100 | 101 | /** 102 | * The preferred build flavor of JavaScriptCore. 103 | * 104 | * For example, to use the international variant, you can use: 105 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 106 | * 107 | * The international variant includes ICU i18n library and necessary data 108 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 109 | * give correct results when using with locales other than en-US. Note that 110 | * this variant is about 6MiB larger per architecture than default. 111 | */ 112 | def jscFlavor = 'org.webkit:android-jsc:+' 113 | 114 | /** 115 | * Whether to enable the Hermes VM. 116 | * 117 | * This should be set on project.ext.react and mirrored here. If it is not set 118 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 119 | * and the benefits of using Hermes will therefore be sharply reduced. 120 | */ 121 | def enableHermes = project.ext.react.get("enableHermes", false); 122 | 123 | android { 124 | compileSdkVersion rootProject.ext.compileSdkVersion 125 | 126 | compileOptions { 127 | sourceCompatibility JavaVersion.VERSION_1_8 128 | targetCompatibility JavaVersion.VERSION_1_8 129 | } 130 | 131 | defaultConfig { 132 | applicationId "com.contacttracingexample" 133 | minSdkVersion rootProject.ext.minSdkVersion 134 | targetSdkVersion rootProject.ext.targetSdkVersion 135 | versionCode 1 136 | versionName "1.0" 137 | } 138 | splits { 139 | abi { 140 | reset() 141 | enable enableSeparateBuildPerCPUArchitecture 142 | universalApk false // If true, also generate a universal APK 143 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 144 | } 145 | } 146 | signingConfigs { 147 | debug { 148 | storeFile file('debug.keystore') 149 | storePassword 'android' 150 | keyAlias 'androiddebugkey' 151 | keyPassword 'android' 152 | } 153 | } 154 | buildTypes { 155 | debug { 156 | signingConfig signingConfigs.debug 157 | } 158 | release { 159 | // Caution! In production, you need to generate your own keystore file. 160 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 161 | signingConfig signingConfigs.debug 162 | minifyEnabled enableProguardInReleaseBuilds 163 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 164 | } 165 | } 166 | 167 | packagingOptions { 168 | pickFirst "lib/armeabi-v7a/libc++_shared.so" 169 | pickFirst "lib/arm64-v8a/libc++_shared.so" 170 | pickFirst "lib/x86/libc++_shared.so" 171 | pickFirst "lib/x86_64/libc++_shared.so" 172 | } 173 | 174 | // applicationVariants are e.g. debug, release 175 | applicationVariants.all { variant -> 176 | variant.outputs.each { output -> 177 | // For each separate APK per architecture, set a unique version code as described here: 178 | // https://developer.android.com/studio/build/configure-apk-splits.html 179 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 180 | def abi = output.getFilter(OutputFile.ABI) 181 | if (abi != null) { // null for the universal-debug, universal-release variants 182 | output.versionCodeOverride = 183 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 184 | } 185 | 186 | } 187 | } 188 | } 189 | 190 | dependencies { 191 | implementation project(':rn-contact-tracing') 192 | //noinspection GradleDynamicVersion 193 | implementation "com.facebook.react:react-native:+" // From node_modules 194 | 195 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 196 | 197 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 198 | exclude group:'com.facebook.fbjni' 199 | } 200 | 201 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 202 | exclude group:'com.facebook.flipper' 203 | } 204 | 205 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 206 | exclude group:'com.facebook.flipper' 207 | } 208 | 209 | if (enableHermes) { 210 | def hermesPath = "../../../node_modules/hermes-engine/android/"; 211 | debugImplementation files(hermesPath + "hermes-debug.aar") 212 | releaseImplementation files(hermesPath + "hermes-release.aar") 213 | } else { 214 | implementation jscFlavor 215 | } 216 | } 217 | 218 | // Run this once to be able to run the application with BUCK 219 | // puts all compile dependencies into folder libs for BUCK to use 220 | task copyDownloadableDepsToLibs(type: Copy) { 221 | from configurations.compile 222 | into 'libs' 223 | } 224 | 225 | apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 226 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/debug/java/com/contacttracingexample/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.contacttracingexample; 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 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/contacttracingexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.contacttracingexample; 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 "ContactTracingExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/contacttracingexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.contacttracingexample; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import com.contacttracing.ContactTracingPackage; 7 | import com.facebook.react.PackageList; 8 | import com.facebook.react.ReactApplication; 9 | import com.facebook.react.ReactInstanceManager; 10 | import com.facebook.react.ReactNativeHost; 11 | import com.facebook.react.ReactPackage; 12 | import com.facebook.soloader.SoLoader; 13 | import java.lang.reflect.InvocationTargetException; 14 | import java.util.List; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = 19 | new ReactNativeHost(this) { 20 | @Override 21 | public boolean getUseDeveloperSupport() { 22 | return BuildConfig.DEBUG; 23 | } 24 | 25 | @Override 26 | protected List getPackages() { 27 | @SuppressWarnings("UnnecessaryLocalVariable") 28 | List packages = new PackageList(this).getPackages(); 29 | packages.add(new ContactTracingPackage()); 30 | // Packages that cannot be autolinked yet can be added manually here, for example: 31 | // packages.add(new MyReactNativePackage()); 32 | return packages; 33 | } 34 | 35 | @Override 36 | protected String getJSMainModuleName() { 37 | return "example/index"; 38 | } 39 | }; 40 | 41 | @Override 42 | public ReactNativeHost getReactNativeHost() { 43 | return mReactNativeHost; 44 | } 45 | 46 | @Override 47 | public void onCreate() { 48 | super.onCreate(); 49 | SoLoader.init(this, /* native exopackage */ false); 50 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 51 | } 52 | 53 | /** 54 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 55 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 56 | * 57 | * @param context 58 | * @param reactInstanceManager 59 | */ 60 | private static void initializeFlipper( 61 | Context context, ReactInstanceManager reactInstanceManager) { 62 | if (BuildConfig.DEBUG) { 63 | try { 64 | /* 65 | We use reflection here to pick up the class that initializes Flipper, 66 | since Flipper library is not available in release mode 67 | */ 68 | Class aClass = Class.forName("com.contacttracingexample.ReactNativeFlipper"); 69 | aClass 70 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 71 | .invoke(null, context, reactInstanceManager); 72 | } catch (ClassNotFoundException e) { 73 | e.printStackTrace(); 74 | } catch (NoSuchMethodException e) { 75 | e.printStackTrace(); 76 | } catch (IllegalAccessException e) { 77 | e.printStackTrace(); 78 | } catch (InvocationTargetException e) { 79 | e.printStackTrace(); 80 | } 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ContactTracingExample 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 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 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # 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 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericlewis/react-native-contact-tracing/eaafa332217ec20c39d81980069f5ab9caf37f33/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/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 | # https://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 | -------------------------------------------------------------------------------- /example/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 https://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 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ContactTracingExample' 2 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | 4 | include ':app', ':rn-contact-tracing' 5 | 6 | project(':rn-contact-tracing').projectDir = new File(rootProject.projectDir, '../../android') 7 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | * 7 | * @format 8 | * @flow 9 | */ 10 | 11 | import {AppRegistry} from 'react-native'; 12 | import App from './App'; 13 | 14 | AppRegistry.registerComponent("ContactTracingExample", () => App); -------------------------------------------------------------------------------- /example/ios/ContactTracingExample-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 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 11 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 14 | 68DFFF9B2445174600DEA07F /* stub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68DFFF9A2445174600DEA07F /* stub.swift */; }; 15 | A5810B99A21C3469288EB29A /* libPods-ContactTracingExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A53AA7860852BA2A55871524 /* libPods-ContactTracingExample.a */; }; 16 | ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 21 | 1275E8755BEB35D671046615 /* Pods-ContactTracingExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContactTracingExample.release.xcconfig"; path = "Target Support Files/Pods-ContactTracingExample/Pods-ContactTracingExample.release.xcconfig"; sourceTree = ""; }; 22 | 13B07F961A680F5B00A75B9A /* ContactTracingExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ContactTracingExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ContactTracingExample/AppDelegate.h; sourceTree = ""; }; 24 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ContactTracingExample/AppDelegate.m; sourceTree = ""; }; 25 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 26 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ContactTracingExample/Images.xcassets; sourceTree = ""; }; 27 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ContactTracingExample/Info.plist; sourceTree = ""; }; 28 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ContactTracingExample/main.m; sourceTree = ""; }; 29 | 241A0452ABCCE23C288D1DB5 /* Pods-ContactTracingExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ContactTracingExample.debug.xcconfig"; path = "Target Support Files/Pods-ContactTracingExample/Pods-ContactTracingExample.debug.xcconfig"; sourceTree = ""; }; 30 | 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 68DFFF94244510C100DEA07F /* ContactTracingExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ContactTracingExample-Bridging-Header.h"; sourceTree = ""; }; 32 | 68DFFF9A2445174600DEA07F /* stub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = stub.swift; sourceTree = ""; }; 33 | A53AA7860852BA2A55871524 /* libPods-ContactTracingExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ContactTracingExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 35 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */, 44 | A5810B99A21C3469288EB29A /* libPods-ContactTracingExample.a in Frameworks */, 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 13B07FAE1A68108700A75B9A /* ContactTracingExample */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 55 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 56 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 57 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 58 | 13B07FB61A68108700A75B9A /* Info.plist */, 59 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 60 | 13B07FB71A68108700A75B9A /* main.m */, 61 | 68DFFF9A2445174600DEA07F /* stub.swift */, 62 | 68DFFF94244510C100DEA07F /* ContactTracingExample-Bridging-Header.h */, 63 | ); 64 | name = ContactTracingExample; 65 | sourceTree = ""; 66 | }; 67 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 71 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 72 | 2D16E6891FA4F8E400B85C8A /* libReact.a */, 73 | A53AA7860852BA2A55871524 /* libPods-ContactTracingExample.a */, 74 | ); 75 | name = Frameworks; 76 | sourceTree = ""; 77 | }; 78 | 55D8C212885452E21A8D4635 /* Pods */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 241A0452ABCCE23C288D1DB5 /* Pods-ContactTracingExample.debug.xcconfig */, 82 | 1275E8755BEB35D671046615 /* Pods-ContactTracingExample.release.xcconfig */, 83 | ); 84 | path = Pods; 85 | sourceTree = ""; 86 | }; 87 | 83CBB9F61A601CBA00E9B192 = { 88 | isa = PBXGroup; 89 | children = ( 90 | 13B07FAE1A68108700A75B9A /* ContactTracingExample */, 91 | 83CBBA001A601CBA00E9B192 /* Products */, 92 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 93 | 55D8C212885452E21A8D4635 /* Pods */, 94 | ); 95 | indentWidth = 2; 96 | sourceTree = ""; 97 | tabWidth = 2; 98 | usesTabs = 0; 99 | }; 100 | 83CBBA001A601CBA00E9B192 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 13B07F961A680F5B00A75B9A /* ContactTracingExample.app */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | /* End PBXGroup section */ 109 | 110 | /* Begin PBXNativeTarget section */ 111 | 13B07F861A680F5B00A75B9A /* ContactTracingExample */ = { 112 | isa = PBXNativeTarget; 113 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ContactTracingExample" */; 114 | buildPhases = ( 115 | 9341C4033AC0A99BB588F90C /* [CP] Check Pods Manifest.lock */, 116 | 13B07F871A680F5B00A75B9A /* Sources */, 117 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 118 | 13B07F8E1A680F5B00A75B9A /* Resources */, 119 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 120 | ); 121 | buildRules = ( 122 | ); 123 | dependencies = ( 124 | ); 125 | name = ContactTracingExample; 126 | productName = "Hello World"; 127 | productReference = 13B07F961A680F5B00A75B9A /* ContactTracingExample.app */; 128 | productType = "com.apple.product-type.application"; 129 | }; 130 | /* End PBXNativeTarget section */ 131 | 132 | /* Begin PBXProject section */ 133 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 134 | isa = PBXProject; 135 | attributes = { 136 | LastUpgradeCheck = 0940; 137 | ORGANIZATIONNAME = Facebook; 138 | TargetAttributes = { 139 | 13B07F861A680F5B00A75B9A = { 140 | LastSwiftMigration = 1140; 141 | }; 142 | }; 143 | }; 144 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ContactTracingExample" */; 145 | compatibilityVersion = "Xcode 3.2"; 146 | developmentRegion = English; 147 | hasScannedForEncodings = 0; 148 | knownRegions = ( 149 | English, 150 | en, 151 | Base, 152 | ); 153 | mainGroup = 83CBB9F61A601CBA00E9B192; 154 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 155 | projectDirPath = ""; 156 | projectRoot = ""; 157 | targets = ( 158 | 13B07F861A680F5B00A75B9A /* ContactTracingExample */, 159 | ); 160 | }; 161 | /* End PBXProject section */ 162 | 163 | /* Begin PBXResourcesBuildPhase section */ 164 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 165 | isa = PBXResourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 169 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXResourcesBuildPhase section */ 174 | 175 | /* Begin PBXShellScriptBuildPhase section */ 176 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 177 | isa = PBXShellScriptBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | ); 181 | inputPaths = ( 182 | ); 183 | name = "Bundle React Native code and images"; 184 | outputPaths = ( 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | shellPath = /bin/sh; 188 | shellScript = "export NODE_BINARY=node\n../../node_modules/react-native/scripts/react-native-xcode.sh\n"; 189 | }; 190 | 9341C4033AC0A99BB588F90C /* [CP] Check Pods Manifest.lock */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputFileListPaths = ( 196 | ); 197 | inputPaths = ( 198 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 199 | "${PODS_ROOT}/Manifest.lock", 200 | ); 201 | name = "[CP] Check Pods Manifest.lock"; 202 | outputFileListPaths = ( 203 | ); 204 | outputPaths = ( 205 | "$(DERIVED_FILE_DIR)/Pods-ContactTracingExample-checkManifestLockResult.txt", 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 210 | showEnvVarsInLog = 0; 211 | }; 212 | /* End PBXShellScriptBuildPhase section */ 213 | 214 | /* Begin PBXSourcesBuildPhase section */ 215 | 13B07F871A680F5B00A75B9A /* Sources */ = { 216 | isa = PBXSourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 220 | 68DFFF9B2445174600DEA07F /* stub.swift in Sources */, 221 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | }; 225 | /* End PBXSourcesBuildPhase section */ 226 | 227 | /* Begin PBXVariantGroup section */ 228 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 229 | isa = PBXVariantGroup; 230 | children = ( 231 | 13B07FB21A68108700A75B9A /* Base */, 232 | ); 233 | name = LaunchScreen.xib; 234 | path = ContactTracingExample; 235 | sourceTree = ""; 236 | }; 237 | /* End PBXVariantGroup section */ 238 | 239 | /* Begin XCBuildConfiguration section */ 240 | 13B07F941A680F5B00A75B9A /* Debug */ = { 241 | isa = XCBuildConfiguration; 242 | baseConfigurationReference = 241A0452ABCCE23C288D1DB5 /* Pods-ContactTracingExample.debug.xcconfig */; 243 | buildSettings = { 244 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 245 | CLANG_ENABLE_MODULES = YES; 246 | CURRENT_PROJECT_VERSION = 1; 247 | DEAD_CODE_STRIPPING = NO; 248 | INFOPLIST_FILE = ContactTracingExample/Info.plist; 249 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 250 | OTHER_LDFLAGS = ( 251 | "$(inherited)", 252 | "-ObjC", 253 | "-lc++", 254 | ); 255 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 256 | PRODUCT_NAME = ContactTracingExample; 257 | SWIFT_OBJC_BRIDGING_HEADER = "ContactTracingExample-Bridging-Header.h"; 258 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 259 | SWIFT_VERSION = 5.0; 260 | VERSIONING_SYSTEM = "apple-generic"; 261 | }; 262 | name = Debug; 263 | }; 264 | 13B07F951A680F5B00A75B9A /* Release */ = { 265 | isa = XCBuildConfiguration; 266 | baseConfigurationReference = 1275E8755BEB35D671046615 /* Pods-ContactTracingExample.release.xcconfig */; 267 | buildSettings = { 268 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 269 | CLANG_ENABLE_MODULES = YES; 270 | CURRENT_PROJECT_VERSION = 1; 271 | INFOPLIST_FILE = ContactTracingExample/Info.plist; 272 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 273 | OTHER_LDFLAGS = ( 274 | "$(inherited)", 275 | "-ObjC", 276 | "-lc++", 277 | ); 278 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 279 | PRODUCT_NAME = ContactTracingExample; 280 | SWIFT_OBJC_BRIDGING_HEADER = "ContactTracingExample-Bridging-Header.h"; 281 | SWIFT_VERSION = 5.0; 282 | VERSIONING_SYSTEM = "apple-generic"; 283 | }; 284 | name = Release; 285 | }; 286 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 287 | isa = XCBuildConfiguration; 288 | buildSettings = { 289 | ALWAYS_SEARCH_USER_PATHS = NO; 290 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 291 | CLANG_CXX_LIBRARY = "libc++"; 292 | CLANG_ENABLE_MODULES = YES; 293 | CLANG_ENABLE_OBJC_ARC = YES; 294 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 295 | CLANG_WARN_BOOL_CONVERSION = YES; 296 | CLANG_WARN_COMMA = YES; 297 | CLANG_WARN_CONSTANT_CONVERSION = YES; 298 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 299 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 300 | CLANG_WARN_EMPTY_BODY = YES; 301 | CLANG_WARN_ENUM_CONVERSION = YES; 302 | CLANG_WARN_INFINITE_RECURSION = YES; 303 | CLANG_WARN_INT_CONVERSION = YES; 304 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 305 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 306 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 307 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 308 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 309 | CLANG_WARN_STRICT_PROTOTYPES = YES; 310 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 311 | CLANG_WARN_UNREACHABLE_CODE = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 314 | COPY_PHASE_STRIP = NO; 315 | ENABLE_STRICT_OBJC_MSGSEND = YES; 316 | ENABLE_TESTABILITY = YES; 317 | GCC_C_LANGUAGE_STANDARD = gnu99; 318 | GCC_DYNAMIC_NO_PIC = NO; 319 | GCC_NO_COMMON_BLOCKS = YES; 320 | GCC_OPTIMIZATION_LEVEL = 0; 321 | GCC_PREPROCESSOR_DEFINITIONS = ( 322 | "DEBUG=1", 323 | "$(inherited)", 324 | ); 325 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 326 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 327 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 328 | GCC_WARN_UNDECLARED_SELECTOR = YES; 329 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 330 | GCC_WARN_UNUSED_FUNCTION = YES; 331 | GCC_WARN_UNUSED_VARIABLE = YES; 332 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 333 | MTL_ENABLE_DEBUG_INFO = YES; 334 | ONLY_ACTIVE_ARCH = YES; 335 | SDKROOT = iphoneos; 336 | }; 337 | name = Debug; 338 | }; 339 | 83CBBA211A601CBA00E9B192 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_COMMA = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 352 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 353 | CLANG_WARN_EMPTY_BODY = YES; 354 | CLANG_WARN_ENUM_CONVERSION = YES; 355 | CLANG_WARN_INFINITE_RECURSION = YES; 356 | CLANG_WARN_INT_CONVERSION = YES; 357 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 358 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 359 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 360 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 361 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 362 | CLANG_WARN_STRICT_PROTOTYPES = YES; 363 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 364 | CLANG_WARN_UNREACHABLE_CODE = YES; 365 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 366 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 367 | COPY_PHASE_STRIP = YES; 368 | ENABLE_NS_ASSERTIONS = NO; 369 | ENABLE_STRICT_OBJC_MSGSEND = YES; 370 | GCC_C_LANGUAGE_STANDARD = gnu99; 371 | GCC_NO_COMMON_BLOCKS = YES; 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 379 | MTL_ENABLE_DEBUG_INFO = NO; 380 | SDKROOT = iphoneos; 381 | VALIDATE_PRODUCT = YES; 382 | }; 383 | name = Release; 384 | }; 385 | /* End XCBuildConfiguration section */ 386 | 387 | /* Begin XCConfigurationList section */ 388 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ContactTracingExample" */ = { 389 | isa = XCConfigurationList; 390 | buildConfigurations = ( 391 | 13B07F941A680F5B00A75B9A /* Debug */, 392 | 13B07F951A680F5B00A75B9A /* Release */, 393 | ); 394 | defaultConfigurationIsVisible = 0; 395 | defaultConfigurationName = Release; 396 | }; 397 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ContactTracingExample" */ = { 398 | isa = XCConfigurationList; 399 | buildConfigurations = ( 400 | 83CBBA201A601CBA00E9B192 /* Debug */, 401 | 83CBBA211A601CBA00E9B192 /* Release */, 402 | ); 403 | defaultConfigurationIsVisible = 0; 404 | defaultConfigurationName = Release; 405 | }; 406 | /* End XCConfigurationList section */ 407 | }; 408 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 409 | } 410 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/AppDelegate+RNCAsyncStorageDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | 12 | @interface AppDelegate (RNCAsyncStorageDelegate) 13 | @end 14 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/AppDelegate+RNCAsyncStorageDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate+RNCAsyncStorageDelegate.h" 9 | 10 | #import 11 | 12 | @implementation AppDelegate (RNCAsyncStorageDelegate) 13 | 14 | - (void)allKeys:(nonnull RNCAsyncStorageResultCallback)completion 15 | { 16 | completion(self.memoryStorage.allKeys); 17 | } 18 | 19 | - (void)mergeValues:(nonnull NSArray *)values 20 | forKeys:(nonnull NSArray *)keys 21 | completion:(nonnull RNCAsyncStorageResultCallback)block 22 | { 23 | [NSException raise:@"Unimplemented" 24 | format:@"%@ is unimplemented", NSStringFromSelector(_cmd)]; 25 | } 26 | 27 | - (void)removeAllValues:(nonnull RNCAsyncStorageCompletion)completion 28 | { 29 | [self.memoryStorage removeAllObjects]; 30 | completion(nil); 31 | } 32 | 33 | - (void)removeValuesForKeys:(nonnull NSArray *)keys 34 | completion:(nonnull RNCAsyncStorageResultCallback)completion 35 | { 36 | for (NSString *key in keys) { 37 | [self.memoryStorage removeObjectForKey:key]; 38 | } 39 | completion(@[]); 40 | } 41 | 42 | - (void)setValues:(nonnull NSArray *)values 43 | forKeys:(nonnull NSArray *)keys 44 | completion:(nonnull RNCAsyncStorageResultCallback)completion 45 | { 46 | for (NSUInteger i = 0; i < values.count; ++i) { 47 | NSString *value = values[i]; 48 | NSString *key = keys[i]; 49 | [self.memoryStorage setObject:value forKey:key]; 50 | } 51 | completion(@[]); 52 | } 53 | 54 | - (void)valuesForKeys:(nonnull NSArray *)keys 55 | completion:(nonnull RNCAsyncStorageResultCallback)completion 56 | { 57 | NSMutableArray *values = [NSMutableArray arrayWithCapacity:keys.count]; 58 | for (NSString *key in keys) { 59 | NSString *value = self.memoryStorage[key]; 60 | [values addObject:value == nil ? [NSNull null] : value]; 61 | } 62 | completion(values); 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | @property (nonatomic, strong) NSMutableDictionary *memoryStorage; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | 12 | #import 13 | #import 14 | #import 15 | 16 | @implementation AppDelegate { 17 | __weak RCTBridge *_bridge; 18 | } 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 21 | { 22 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 24 | moduleName:@"ContactTracingExample" 25 | initialProperties:nil]; 26 | 27 | rootView.backgroundColor = [UIColor blackColor]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | - (void)didLoadJavaScript:(NSNotification *)note 38 | { 39 | RCTBridge *bridge = note.userInfo[@"bridge"]; 40 | if (bridge == nil) { 41 | return; 42 | } 43 | 44 | _bridge = bridge; 45 | } 46 | 47 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 48 | { 49 | #if DEBUG 50 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"example/index" fallbackResource:nil]; 51 | #else 52 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 53 | #endif 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ContactTracingExample 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 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/RNCTestAsyncStorageDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | /*! 11 | * Implementation of |RNCAsyncStorageDelegate| used for E2E testing purposes only. 12 | */ 13 | @interface RNCTestAsyncStorageDelegate : NSObject 14 | @end 15 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/RNCTestAsyncStorageDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "RNCTestAsyncStorageDelegate.h" 9 | 10 | const NSInteger RNCTestAsyncStorageExtraValue = 1000000; 11 | 12 | NSString *RNCTestAddExtraValue(NSString *value) 13 | { 14 | NSInteger i = [value integerValue]; 15 | if (i == 0) { 16 | return value; 17 | } 18 | return [NSString stringWithFormat:@"%ld", (long)i + RNCTestAsyncStorageExtraValue]; 19 | } 20 | 21 | NSString *RNCTestRemoveExtraValue(NSString *value) 22 | { 23 | NSInteger i = [value integerValue]; 24 | if (i > RNCTestAsyncStorageExtraValue) { 25 | i -= RNCTestAsyncStorageExtraValue; 26 | } 27 | return [NSString stringWithFormat:@"%ld", (long)i]; 28 | } 29 | 30 | @implementation RNCTestAsyncStorageDelegate { 31 | NSMutableDictionary *_memoryStorage; 32 | } 33 | 34 | - (instancetype)init 35 | { 36 | if (self = [super init]) { 37 | _memoryStorage = [NSMutableDictionary dictionary]; 38 | } 39 | return self; 40 | } 41 | 42 | - (void)allKeys:(RNCAsyncStorageResultCallback)completion 43 | { 44 | completion(_memoryStorage.allKeys); 45 | } 46 | 47 | - (void)mergeValues:(nonnull NSArray *)values 48 | forKeys:(nonnull NSArray *)keys 49 | completion:(nonnull RNCAsyncStorageResultCallback)completion 50 | { 51 | NSError *error = nil; 52 | NSDictionary *dictionary = 53 | [NSJSONSerialization JSONObjectWithData:[values[0] dataUsingEncoding:NSUTF8StringEncoding] 54 | options:NSJSONReadingMutableContainers 55 | error:&error]; 56 | NSMutableDictionary *modified = [NSMutableDictionary dictionaryWithCapacity:dictionary.count]; 57 | for (NSString *key in dictionary) { 58 | NSObject *value = dictionary[key]; 59 | if ([value isKindOfClass:[NSString class]]) { 60 | modified[key] = [(NSString *)value stringByAppendingString:@" from delegate"]; 61 | } else { 62 | modified[key] = value; 63 | } 64 | } 65 | 66 | NSData *data = [NSJSONSerialization dataWithJSONObject:modified options:0 error:&error]; 67 | NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 68 | _memoryStorage[keys[0]] = str; 69 | completion(@[str]); 70 | } 71 | 72 | - (void)removeAllValues:(nonnull RNCAsyncStorageCompletion)completion 73 | { 74 | [_memoryStorage removeAllObjects]; 75 | completion(nil); 76 | } 77 | 78 | - (void)removeValuesForKeys:(nonnull NSArray *)keys 79 | completion:(nonnull RNCAsyncStorageResultCallback)completion 80 | { 81 | for (NSString *key in keys) { 82 | [_memoryStorage 83 | setObject:[NSString stringWithFormat:@"%ld", (long)RNCTestAsyncStorageExtraValue] 84 | forKey:key]; 85 | } 86 | completion(@[]); 87 | } 88 | 89 | - (void)setValues:(nonnull NSArray *)values 90 | forKeys:(nonnull NSArray *)keys 91 | completion:(nonnull RNCAsyncStorageResultCallback)completion 92 | { 93 | for (NSUInteger i = 0; i < values.count; ++i) { 94 | NSString *value = values[i]; 95 | NSString *key = keys[i]; 96 | [_memoryStorage setObject:RNCTestRemoveExtraValue(value) forKey:key]; 97 | } 98 | completion(@[]); 99 | } 100 | 101 | - (void)valuesForKeys:(nonnull NSArray *)keys 102 | completion:(nonnull RNCAsyncStorageResultCallback)completion 103 | { 104 | NSMutableArray *values = [NSMutableArray arrayWithCapacity:keys.count]; 105 | for (NSString *key in keys) { 106 | NSString *value = _memoryStorage[key]; 107 | [values addObject:value == nil ? [NSNull null] : RNCTestAddExtraValue(value)]; 108 | } 109 | completion(values); 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /example/ios/ContactTracingExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '13.4' 2 | require_relative '../../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | project './ContactTracingExample.xcodeproj' 5 | 6 | target 'ContactTracingExample' do 7 | # Pods for example 8 | pod 'react-native-contact-tracing', :path => "../.." 9 | pod 'FBLazyVector', :path => "../../node_modules/react-native/Libraries/FBLazyVector" 10 | pod 'FBReactNativeSpec', :path => "../../node_modules/react-native/Libraries/FBReactNativeSpec" 11 | pod 'RCTRequired', :path => "../../node_modules/react-native/Libraries/RCTRequired" 12 | pod 'RCTTypeSafety', :path => "../../node_modules/react-native/Libraries/TypeSafety" 13 | pod 'React', :path => '../../node_modules/react-native/' 14 | pod 'React-Core', :path => '../../node_modules/react-native/' 15 | pod 'React-CoreModules', :path => '../../node_modules/react-native/React/CoreModules' 16 | pod 'React-Core/DevSupport', :path => '../../node_modules/react-native/' 17 | pod 'React-RCTActionSheet', :path => '../../node_modules/react-native/Libraries/ActionSheetIOS' 18 | pod 'React-RCTAnimation', :path => '../../node_modules/react-native/Libraries/NativeAnimation' 19 | pod 'React-RCTBlob', :path => '../../node_modules/react-native/Libraries/Blob' 20 | pod 'React-RCTImage', :path => '../../node_modules/react-native/Libraries/Image' 21 | pod 'React-RCTLinking', :path => '../../node_modules/react-native/Libraries/LinkingIOS' 22 | pod 'React-RCTNetwork', :path => '../../node_modules/react-native/Libraries/Network' 23 | pod 'React-RCTSettings', :path => '../../node_modules/react-native/Libraries/Settings' 24 | pod 'React-RCTText', :path => '../../node_modules/react-native/Libraries/Text' 25 | pod 'React-RCTVibration', :path => '../../node_modules/react-native/Libraries/Vibration' 26 | pod 'React-Core/RCTWebSocket', :path => '../../node_modules/react-native/' 27 | 28 | pod 'React-cxxreact', :path => '../../node_modules/react-native/ReactCommon/cxxreact' 29 | pod 'React-jsi', :path => '../../node_modules/react-native/ReactCommon/jsi' 30 | pod 'React-jsiexecutor', :path => '../../node_modules/react-native/ReactCommon/jsiexecutor' 31 | pod 'React-jsinspector', :path => '../../node_modules/react-native/ReactCommon/jsinspector' 32 | pod 'ReactCommon/callinvoker', :path => "../../node_modules/react-native/ReactCommon" 33 | pod 'ReactCommon/turbomodule/core', :path => "../../node_modules/react-native/ReactCommon" 34 | pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga' 35 | 36 | pod 'DoubleConversion', :podspec => '../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 37 | pod 'glog', :podspec => '../../node_modules/react-native/third-party-podspecs/glog.podspec' 38 | pod 'Folly', :podspec => '../../node_modules/react-native/third-party-podspecs/Folly.podspec' 39 | 40 | use_native_modules! 41 | end -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost-for-react-native (1.63.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.62.2) 5 | - FBReactNativeSpec (0.62.2): 6 | - Folly (= 2018.10.22.00) 7 | - RCTRequired (= 0.62.2) 8 | - RCTTypeSafety (= 0.62.2) 9 | - React-Core (= 0.62.2) 10 | - React-jsi (= 0.62.2) 11 | - ReactCommon/turbomodule/core (= 0.62.2) 12 | - Folly (2018.10.22.00): 13 | - boost-for-react-native 14 | - DoubleConversion 15 | - Folly/Default (= 2018.10.22.00) 16 | - glog 17 | - Folly/Default (2018.10.22.00): 18 | - boost-for-react-native 19 | - DoubleConversion 20 | - glog 21 | - glog (0.3.5) 22 | - RCTRequired (0.62.2) 23 | - RCTTypeSafety (0.62.2): 24 | - FBLazyVector (= 0.62.2) 25 | - Folly (= 2018.10.22.00) 26 | - RCTRequired (= 0.62.2) 27 | - React-Core (= 0.62.2) 28 | - React (0.62.2): 29 | - React-Core (= 0.62.2) 30 | - React-Core/DevSupport (= 0.62.2) 31 | - React-Core/RCTWebSocket (= 0.62.2) 32 | - React-RCTActionSheet (= 0.62.2) 33 | - React-RCTAnimation (= 0.62.2) 34 | - React-RCTBlob (= 0.62.2) 35 | - React-RCTImage (= 0.62.2) 36 | - React-RCTLinking (= 0.62.2) 37 | - React-RCTNetwork (= 0.62.2) 38 | - React-RCTSettings (= 0.62.2) 39 | - React-RCTText (= 0.62.2) 40 | - React-RCTVibration (= 0.62.2) 41 | - React-Core (0.62.2): 42 | - Folly (= 2018.10.22.00) 43 | - glog 44 | - React-Core/Default (= 0.62.2) 45 | - React-cxxreact (= 0.62.2) 46 | - React-jsi (= 0.62.2) 47 | - React-jsiexecutor (= 0.62.2) 48 | - Yoga 49 | - React-Core/CoreModulesHeaders (0.62.2): 50 | - Folly (= 2018.10.22.00) 51 | - glog 52 | - React-Core/Default 53 | - React-cxxreact (= 0.62.2) 54 | - React-jsi (= 0.62.2) 55 | - React-jsiexecutor (= 0.62.2) 56 | - Yoga 57 | - React-Core/Default (0.62.2): 58 | - Folly (= 2018.10.22.00) 59 | - glog 60 | - React-cxxreact (= 0.62.2) 61 | - React-jsi (= 0.62.2) 62 | - React-jsiexecutor (= 0.62.2) 63 | - Yoga 64 | - React-Core/DevSupport (0.62.2): 65 | - Folly (= 2018.10.22.00) 66 | - glog 67 | - React-Core/Default (= 0.62.2) 68 | - React-Core/RCTWebSocket (= 0.62.2) 69 | - React-cxxreact (= 0.62.2) 70 | - React-jsi (= 0.62.2) 71 | - React-jsiexecutor (= 0.62.2) 72 | - React-jsinspector (= 0.62.2) 73 | - Yoga 74 | - React-Core/RCTActionSheetHeaders (0.62.2): 75 | - Folly (= 2018.10.22.00) 76 | - glog 77 | - React-Core/Default 78 | - React-cxxreact (= 0.62.2) 79 | - React-jsi (= 0.62.2) 80 | - React-jsiexecutor (= 0.62.2) 81 | - Yoga 82 | - React-Core/RCTAnimationHeaders (0.62.2): 83 | - Folly (= 2018.10.22.00) 84 | - glog 85 | - React-Core/Default 86 | - React-cxxreact (= 0.62.2) 87 | - React-jsi (= 0.62.2) 88 | - React-jsiexecutor (= 0.62.2) 89 | - Yoga 90 | - React-Core/RCTBlobHeaders (0.62.2): 91 | - Folly (= 2018.10.22.00) 92 | - glog 93 | - React-Core/Default 94 | - React-cxxreact (= 0.62.2) 95 | - React-jsi (= 0.62.2) 96 | - React-jsiexecutor (= 0.62.2) 97 | - Yoga 98 | - React-Core/RCTImageHeaders (0.62.2): 99 | - Folly (= 2018.10.22.00) 100 | - glog 101 | - React-Core/Default 102 | - React-cxxreact (= 0.62.2) 103 | - React-jsi (= 0.62.2) 104 | - React-jsiexecutor (= 0.62.2) 105 | - Yoga 106 | - React-Core/RCTLinkingHeaders (0.62.2): 107 | - Folly (= 2018.10.22.00) 108 | - glog 109 | - React-Core/Default 110 | - React-cxxreact (= 0.62.2) 111 | - React-jsi (= 0.62.2) 112 | - React-jsiexecutor (= 0.62.2) 113 | - Yoga 114 | - React-Core/RCTNetworkHeaders (0.62.2): 115 | - Folly (= 2018.10.22.00) 116 | - glog 117 | - React-Core/Default 118 | - React-cxxreact (= 0.62.2) 119 | - React-jsi (= 0.62.2) 120 | - React-jsiexecutor (= 0.62.2) 121 | - Yoga 122 | - React-Core/RCTSettingsHeaders (0.62.2): 123 | - Folly (= 2018.10.22.00) 124 | - glog 125 | - React-Core/Default 126 | - React-cxxreact (= 0.62.2) 127 | - React-jsi (= 0.62.2) 128 | - React-jsiexecutor (= 0.62.2) 129 | - Yoga 130 | - React-Core/RCTTextHeaders (0.62.2): 131 | - Folly (= 2018.10.22.00) 132 | - glog 133 | - React-Core/Default 134 | - React-cxxreact (= 0.62.2) 135 | - React-jsi (= 0.62.2) 136 | - React-jsiexecutor (= 0.62.2) 137 | - Yoga 138 | - React-Core/RCTVibrationHeaders (0.62.2): 139 | - Folly (= 2018.10.22.00) 140 | - glog 141 | - React-Core/Default 142 | - React-cxxreact (= 0.62.2) 143 | - React-jsi (= 0.62.2) 144 | - React-jsiexecutor (= 0.62.2) 145 | - Yoga 146 | - React-Core/RCTWebSocket (0.62.2): 147 | - Folly (= 2018.10.22.00) 148 | - glog 149 | - React-Core/Default (= 0.62.2) 150 | - React-cxxreact (= 0.62.2) 151 | - React-jsi (= 0.62.2) 152 | - React-jsiexecutor (= 0.62.2) 153 | - Yoga 154 | - React-CoreModules (0.62.2): 155 | - FBReactNativeSpec (= 0.62.2) 156 | - Folly (= 2018.10.22.00) 157 | - RCTTypeSafety (= 0.62.2) 158 | - React-Core/CoreModulesHeaders (= 0.62.2) 159 | - React-RCTImage (= 0.62.2) 160 | - ReactCommon/turbomodule/core (= 0.62.2) 161 | - React-cxxreact (0.62.2): 162 | - boost-for-react-native (= 1.63.0) 163 | - DoubleConversion 164 | - Folly (= 2018.10.22.00) 165 | - glog 166 | - React-jsinspector (= 0.62.2) 167 | - React-jsi (0.62.2): 168 | - boost-for-react-native (= 1.63.0) 169 | - DoubleConversion 170 | - Folly (= 2018.10.22.00) 171 | - glog 172 | - React-jsi/Default (= 0.62.2) 173 | - React-jsi/Default (0.62.2): 174 | - boost-for-react-native (= 1.63.0) 175 | - DoubleConversion 176 | - Folly (= 2018.10.22.00) 177 | - glog 178 | - React-jsiexecutor (0.62.2): 179 | - DoubleConversion 180 | - Folly (= 2018.10.22.00) 181 | - glog 182 | - React-cxxreact (= 0.62.2) 183 | - React-jsi (= 0.62.2) 184 | - React-jsinspector (0.62.2) 185 | - react-native-contact-tracing (1.0.0): 186 | - React 187 | - React-RCTActionSheet (0.62.2): 188 | - React-Core/RCTActionSheetHeaders (= 0.62.2) 189 | - React-RCTAnimation (0.62.2): 190 | - FBReactNativeSpec (= 0.62.2) 191 | - Folly (= 2018.10.22.00) 192 | - RCTTypeSafety (= 0.62.2) 193 | - React-Core/RCTAnimationHeaders (= 0.62.2) 194 | - ReactCommon/turbomodule/core (= 0.62.2) 195 | - React-RCTBlob (0.62.2): 196 | - FBReactNativeSpec (= 0.62.2) 197 | - Folly (= 2018.10.22.00) 198 | - React-Core/RCTBlobHeaders (= 0.62.2) 199 | - React-Core/RCTWebSocket (= 0.62.2) 200 | - React-jsi (= 0.62.2) 201 | - React-RCTNetwork (= 0.62.2) 202 | - ReactCommon/turbomodule/core (= 0.62.2) 203 | - React-RCTImage (0.62.2): 204 | - FBReactNativeSpec (= 0.62.2) 205 | - Folly (= 2018.10.22.00) 206 | - RCTTypeSafety (= 0.62.2) 207 | - React-Core/RCTImageHeaders (= 0.62.2) 208 | - React-RCTNetwork (= 0.62.2) 209 | - ReactCommon/turbomodule/core (= 0.62.2) 210 | - React-RCTLinking (0.62.2): 211 | - FBReactNativeSpec (= 0.62.2) 212 | - React-Core/RCTLinkingHeaders (= 0.62.2) 213 | - ReactCommon/turbomodule/core (= 0.62.2) 214 | - React-RCTNetwork (0.62.2): 215 | - FBReactNativeSpec (= 0.62.2) 216 | - Folly (= 2018.10.22.00) 217 | - RCTTypeSafety (= 0.62.2) 218 | - React-Core/RCTNetworkHeaders (= 0.62.2) 219 | - ReactCommon/turbomodule/core (= 0.62.2) 220 | - React-RCTSettings (0.62.2): 221 | - FBReactNativeSpec (= 0.62.2) 222 | - Folly (= 2018.10.22.00) 223 | - RCTTypeSafety (= 0.62.2) 224 | - React-Core/RCTSettingsHeaders (= 0.62.2) 225 | - ReactCommon/turbomodule/core (= 0.62.2) 226 | - React-RCTText (0.62.2): 227 | - React-Core/RCTTextHeaders (= 0.62.2) 228 | - React-RCTVibration (0.62.2): 229 | - FBReactNativeSpec (= 0.62.2) 230 | - Folly (= 2018.10.22.00) 231 | - React-Core/RCTVibrationHeaders (= 0.62.2) 232 | - ReactCommon/turbomodule/core (= 0.62.2) 233 | - ReactCommon/callinvoker (0.62.2): 234 | - DoubleConversion 235 | - Folly (= 2018.10.22.00) 236 | - glog 237 | - React-cxxreact (= 0.62.2) 238 | - ReactCommon/turbomodule/core (0.62.2): 239 | - DoubleConversion 240 | - Folly (= 2018.10.22.00) 241 | - glog 242 | - React-Core (= 0.62.2) 243 | - React-cxxreact (= 0.62.2) 244 | - React-jsi (= 0.62.2) 245 | - ReactCommon/callinvoker (= 0.62.2) 246 | - Yoga (1.14.0) 247 | 248 | DEPENDENCIES: 249 | - DoubleConversion (from `../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 250 | - FBLazyVector (from `../../node_modules/react-native/Libraries/FBLazyVector`) 251 | - FBReactNativeSpec (from `../../node_modules/react-native/Libraries/FBReactNativeSpec`) 252 | - Folly (from `../../node_modules/react-native/third-party-podspecs/Folly.podspec`) 253 | - glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`) 254 | - RCTRequired (from `../../node_modules/react-native/Libraries/RCTRequired`) 255 | - RCTTypeSafety (from `../../node_modules/react-native/Libraries/TypeSafety`) 256 | - React (from `../../node_modules/react-native/`) 257 | - React-Core (from `../../node_modules/react-native/`) 258 | - React-Core/DevSupport (from `../../node_modules/react-native/`) 259 | - React-Core/RCTWebSocket (from `../../node_modules/react-native/`) 260 | - React-CoreModules (from `../../node_modules/react-native/React/CoreModules`) 261 | - React-cxxreact (from `../../node_modules/react-native/ReactCommon/cxxreact`) 262 | - React-jsi (from `../../node_modules/react-native/ReactCommon/jsi`) 263 | - React-jsiexecutor (from `../../node_modules/react-native/ReactCommon/jsiexecutor`) 264 | - React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`) 265 | - react-native-contact-tracing (from `../..`) 266 | - React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`) 267 | - React-RCTAnimation (from `../../node_modules/react-native/Libraries/NativeAnimation`) 268 | - React-RCTBlob (from `../../node_modules/react-native/Libraries/Blob`) 269 | - React-RCTImage (from `../../node_modules/react-native/Libraries/Image`) 270 | - React-RCTLinking (from `../../node_modules/react-native/Libraries/LinkingIOS`) 271 | - React-RCTNetwork (from `../../node_modules/react-native/Libraries/Network`) 272 | - React-RCTSettings (from `../../node_modules/react-native/Libraries/Settings`) 273 | - React-RCTText (from `../../node_modules/react-native/Libraries/Text`) 274 | - React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`) 275 | - ReactCommon/callinvoker (from `../../node_modules/react-native/ReactCommon`) 276 | - ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`) 277 | - Yoga (from `../../node_modules/react-native/ReactCommon/yoga`) 278 | 279 | SPEC REPOS: 280 | https://github.com/cocoapods/specs.git: 281 | - boost-for-react-native 282 | 283 | EXTERNAL SOURCES: 284 | DoubleConversion: 285 | :podspec: "../../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 286 | FBLazyVector: 287 | :path: "../../node_modules/react-native/Libraries/FBLazyVector" 288 | FBReactNativeSpec: 289 | :path: "../../node_modules/react-native/Libraries/FBReactNativeSpec" 290 | Folly: 291 | :podspec: "../../node_modules/react-native/third-party-podspecs/Folly.podspec" 292 | glog: 293 | :podspec: "../../node_modules/react-native/third-party-podspecs/glog.podspec" 294 | RCTRequired: 295 | :path: "../../node_modules/react-native/Libraries/RCTRequired" 296 | RCTTypeSafety: 297 | :path: "../../node_modules/react-native/Libraries/TypeSafety" 298 | React: 299 | :path: "../../node_modules/react-native/" 300 | React-Core: 301 | :path: "../../node_modules/react-native/" 302 | React-CoreModules: 303 | :path: "../../node_modules/react-native/React/CoreModules" 304 | React-cxxreact: 305 | :path: "../../node_modules/react-native/ReactCommon/cxxreact" 306 | React-jsi: 307 | :path: "../../node_modules/react-native/ReactCommon/jsi" 308 | React-jsiexecutor: 309 | :path: "../../node_modules/react-native/ReactCommon/jsiexecutor" 310 | React-jsinspector: 311 | :path: "../../node_modules/react-native/ReactCommon/jsinspector" 312 | react-native-contact-tracing: 313 | :path: "../.." 314 | React-RCTActionSheet: 315 | :path: "../../node_modules/react-native/Libraries/ActionSheetIOS" 316 | React-RCTAnimation: 317 | :path: "../../node_modules/react-native/Libraries/NativeAnimation" 318 | React-RCTBlob: 319 | :path: "../../node_modules/react-native/Libraries/Blob" 320 | React-RCTImage: 321 | :path: "../../node_modules/react-native/Libraries/Image" 322 | React-RCTLinking: 323 | :path: "../../node_modules/react-native/Libraries/LinkingIOS" 324 | React-RCTNetwork: 325 | :path: "../../node_modules/react-native/Libraries/Network" 326 | React-RCTSettings: 327 | :path: "../../node_modules/react-native/Libraries/Settings" 328 | React-RCTText: 329 | :path: "../../node_modules/react-native/Libraries/Text" 330 | React-RCTVibration: 331 | :path: "../../node_modules/react-native/Libraries/Vibration" 332 | ReactCommon: 333 | :path: "../../node_modules/react-native/ReactCommon" 334 | Yoga: 335 | :path: "../../node_modules/react-native/ReactCommon/yoga" 336 | 337 | SPEC CHECKSUMS: 338 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c 339 | DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 340 | FBLazyVector: 4aab18c93cd9546e4bfed752b4084585eca8b245 341 | FBReactNativeSpec: 5465d51ccfeecb7faa12f9ae0024f2044ce4044e 342 | Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 343 | glog: 1f3da668190260b06b429bb211bfbee5cd790c28 344 | RCTRequired: cec6a34b3ac8a9915c37e7e4ad3aa74726ce4035 345 | RCTTypeSafety: 93006131180074cffa227a1075802c89a49dd4ce 346 | React: 29a8b1a02bd764fb7644ef04019270849b9a7ac3 347 | React-Core: b12bffb3f567fdf99510acb716ef1abd426e0e05 348 | React-CoreModules: 4a9b87bbe669d6c3173c0132c3328e3b000783d0 349 | React-cxxreact: e65f9c2ba0ac5be946f53548c1aaaee5873a8103 350 | React-jsi: b6dc94a6a12ff98e8877287a0b7620d365201161 351 | React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da 352 | React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493 353 | react-native-contact-tracing: b3b35718c6899aa049b4e799eeadc071e5363a13 354 | React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c 355 | React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0 356 | React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71 357 | React-RCTImage: e70be9b9c74fe4e42d0005f42cace7981c994ac3 358 | React-RCTLinking: c1b9739a88d56ecbec23b7f63650e44672ab2ad2 359 | React-RCTNetwork: 73138b6f45e5a2768ad93f3d57873c2a18d14b44 360 | React-RCTSettings: 6e3738a87e21b39a8cb08d627e68c44acf1e325a 361 | React-RCTText: fae545b10cfdb3d247c36c56f61a94cfd6dba41d 362 | React-RCTVibration: 4356114dbcba4ce66991096e51a66e61eda51256 363 | ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3 364 | Yoga: 3ebccbdd559724312790e7742142d062476b698e 365 | 366 | PODFILE CHECKSUM: 5dcb287bcd53d3e7fdf07b5281f08ee440f9dc83 367 | 368 | COCOAPODS: 1.7.5 369 | -------------------------------------------------------------------------------- /example/ios/stub.swift: -------------------------------------------------------------------------------- 1 | /// DO NOT DELETE ME, OR I WILL NOT BUILD! 2 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | export interface IContactInfo { 2 | /** 3 | * How long the contact was in proximity. Minimum duration is 5 minutes and increments by 5 minutes: 5, 10, 15, etc. 4 | * 5 | * This value is in seconds. 6 | */ 7 | duration: number; 8 | 9 | /** 10 | * This property contains the time when the contact occurred. This may have reduced precision, such as within one day of the actual time. 11 | * 12 | * This value is in seconds since 00:00:00 UTC on 1 January 2001. 13 | */ 14 | timestamp: number; 15 | } 16 | 17 | export interface IExposureSummary { 18 | matchedKeyCount: number; 19 | contactInformation: IContactInfo[]; 20 | } 21 | 22 | export enum ContactTracingStatus { 23 | UNKNOWN, 24 | ON, 25 | OFF 26 | } 27 | 28 | export interface IContactTracing { 29 | getConstants(): { supported: boolean }; 30 | start(): Promise; 31 | stop(): Promise; 32 | currentStatus(): Promise; 33 | requestExposureSummary(): Promise; 34 | } 35 | 36 | declare const ContactTracing: IContactTracing; 37 | 38 | export default ContactTracing; -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { NativeModules } from 'react-native'; 2 | 3 | const { ContactTracing } = NativeModules; 4 | 5 | export const ContactTracingStatus = { 6 | UNKNOWN: 0, 7 | ON: 1, 8 | OFF: 2, 9 | }; 10 | 11 | export default ContactTracing; 12 | -------------------------------------------------------------------------------- /ios/CTStub.h: -------------------------------------------------------------------------------- 1 | // Contact Tracing Framework 2 | // Preliminary - Subject to Modification and Extension 3 | // Interface derived from documentation (retrieved 2020-04-10) 4 | // https://www.apple.com/covid19/contacttracing 5 | // 6 | // Information subject to copyright. 7 | // All rights reserved. 8 | // 9 | // This file was originally created by Mattt and can be found here: 10 | // https://github.com/NSHipster/ContactTracing-Framework-Interface/blob/master/ContactTracing.h 11 | 12 | #import 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | #pragma mark - CTStateGetRequest 17 | 18 | /// STUBS! 19 | 20 | typedef NS_ENUM(NSInteger, CTManagerState) { 21 | CTManagerStateUnknown, 22 | CTManagerStateOn, 23 | CTManagerStateOff, 24 | }; 25 | 26 | #pragma mark - CTDailyTracingKey 27 | 28 | /// The Daily Tracing Key object. 29 | @interface CTDailyTracingKey : NSObject 30 | 31 | /// This property contains the Daily Tracing Key information. 32 | @property (readonly, copy) NSData *keyData; 33 | 34 | @end 35 | 36 | #pragma mark - CTSelfTracingInfo 37 | 38 | /// Contains the Daily Tracing Keys. 39 | @interface CTSelfTracingInfo : NSObject 40 | 41 | /// Daily tracing keys available at the time of the request. 42 | @property (readonly, copy) NSArray * dailyTracingKeys; 43 | 44 | @end 45 | 46 | #pragma mark - CTContactInfo 47 | 48 | /// Contains information about a single contact incident. 49 | @interface CTContactInfo : NSObject 50 | 51 | /// How long the contact was in proximity. Minimum duration is 5 minutes and increments by 5 minutes: 5, 10, 15, etc. 52 | @property (readonly) NSTimeInterval duration; 53 | 54 | /// This property contains the time when the contact occurred. This may have reduced precision, such as within one day of the actual time. 55 | @property (readonly) CFAbsoluteTime timestamp; 56 | 57 | @end 58 | 59 | #pragma mark - CTExposureDetectionSummary 60 | 61 | /// Provides a summary on exposures. 62 | @interface CTExposureDetectionSummary : NSObject 63 | 64 | /// This property holds the number of keys that matched for an exposure detection. 65 | @property (readonly) NSInteger matchedKeyCount; 66 | 67 | @end 68 | 69 | /// The type definition for the completion handler. 70 | typedef void (^CTErrorHandler) (NSError * _Nullable inError); 71 | 72 | /// Requests whether contact tracing is on or off on the device. 73 | @interface CTStateGetRequest : NSObject 74 | 75 | /// This property holds the completion handler that framework invokes when the request completes. The property is cleared upon completion to break any potential retain cycles. 76 | @property (nullable, copy) CTErrorHandler completionHandler; 77 | 78 | /// This property holds the the dispatch queue used to invoke handlers on. If this property isn't set, the framework uses the main queue. 79 | @property (nullable) dispatch_queue_t dispatchQueue; 80 | 81 | /// This property contains the snapshot of the state when the request was performed. It's valid only after the framework invokes the completion handler. 82 | @property (readonly) CTManagerState state; 83 | 84 | /// Asynchronously performs the request to get the state, and invokes the completion handler when it's done. 85 | - (void) perform; 86 | 87 | /// Invalidates a previously initiated request. If there is an outstanding completion handler, the framework will invoke it with an error. 88 | /// Don't reuse the request after this is called. If you require another request, create a new one. 89 | - (void) invalidate; 90 | 91 | @end 92 | 93 | #pragma mark - CTStateSetRequest 94 | 95 | /// Changes the state of contact tracing on the device. 96 | @interface CTStateSetRequest : NSObject 97 | 98 | /// This property holds the completion handler that framework invokes when the request completes. The property is cleared upon completion to break any potential retain cycles. 99 | @property (nullable, copy) CTErrorHandler completionHandler; 100 | 101 | /// This property holds the the dispatch queue used to invoke handlers on. If this property isn't set, the framework uses the main queue. 102 | @property (nullable) dispatch_queue_t dispatchQueue; 103 | 104 | /// This property contains the state to set Contact Tracing to. Call the perform method to apply the state once set. 105 | @property (readwrite) CTManagerState state; 106 | 107 | /// Asynchronously performs the request to get the state, and invokes the completion handler when it's done. 108 | - (void) perform; 109 | 110 | /// Invalidates a previously initiated request. If there is an outstanding completion handler, the framework will invoke it with an error. 111 | /// 112 | /// Don't reuse the request after this is called. If you require another request, create a new one. 113 | - (void) invalidate; 114 | 115 | @end 116 | 117 | #pragma mark - CTExposureDetectionSession 118 | 119 | /// The type definition for the completion handler. 120 | typedef void (^CTExposureDetectionFinishHandler) (CTExposureDetectionSummary * _Nullable inSummary, NSError * _Nullable inError); 121 | 122 | /// The type definition for the completion handler. 123 | typedef void ( ^CTExposureDetectionContactHandler )( NSArray * _Nullable inContacts, NSError * _Nullable inError ); 124 | 125 | /// Performs exposure detection bad on previously collected proximity data and keys. 126 | @interface CTExposureDetectionSession : NSObject 127 | 128 | /// This property holds the the dispatch queue used to invoke handlers on. If this property isn't set, the framework uses the main queue. 129 | @property dispatch_queue_t dispatchQueue; 130 | 131 | /// This property contains the maximum number of keys to provide to this API at once. This property's value updates after each operation complete and before the completion handler is invoked. Use this property to throttle key downloads to avoid excessive buffering of keys in memory. 132 | @property (readonly, nonatomic) NSInteger maxKeyCount; 133 | 134 | /// Activates the session and requests authorization for the app with the user. Properties and methods cannot be used until this completes successfully. 135 | - (void) activateWithCompletion:(nullable CTErrorHandler) inCompletion; 136 | 137 | /// Invalidates the session. Any outstanding completion handlers will be invoked with an error. The session cannot be used after this is called. A new session must be created if another detection is needed. 138 | - (void) invalidate; 139 | 140 | /// Asynchronously adds the specified keys to the session to allow them to be checked for exposure. Each call to this method must include more keys than specified by the current value of . 141 | - (void) addPositiveDiagnosisKeys:(NSArray *) inKeys completion:(nullable CTErrorHandler) inCompletion; 142 | 143 | /// Indicates all of the available keys have been provided. Any remaining detection will be performed and the completion handler will be invoked with the results. 144 | - (void) finishedPositiveDiagnosisKeysWithCompletion:(nullable CTExposureDetectionFinishHandler) inFinishHandler; 145 | 146 | /// Obtains information on each incident. This can only be called once the detector finishes. The handler may be invoked multiple times. An empty array indicates the final invocation of the hander. 147 | - (void) getContactInfoWithHandler:(nullable CTExposureDetectionContactHandler) inHandler; 148 | 149 | @end 150 | 151 | #pragma mark - CTSelfTracingInfoRequest 152 | 153 | /// The type definition for the completion handler. 154 | typedef void ( ^CTSelfTracingInfoGetCompletion ) ( CTSelfTracingInfo * _Nullable inInfo, NSError * _Nullable inError ); 155 | 156 | /// Requests the daily tracing keys used by this device to share with a server. 157 | @interface CTSelfTracingInfoRequest : NSObject 158 | 159 | /// This property invokes this completion handler when the request completes and clears the property to break any potential retain cycles. 160 | @property (nullable, copy) CTSelfTracingInfoGetCompletion completionHandler; 161 | 162 | /// This property holds the the dispatch queue used to invoke handlers on. If this property isn't set, the framework uses the main queue. 163 | @property (nullable) dispatch_queue_t dispatchQueue; 164 | 165 | /// Asynchronously performs the request to get the state, and invokes the completion handler when it's done. 166 | - (void) perform; 167 | 168 | /// Invalidates a previously initiated request. If there is an outstanding completion handler, the framework will invoke it with an error. 169 | /// 170 | /// Don't reuse the request after this is called. If you require another request, create a new one. 171 | - (void) invalidate; 172 | 173 | @end 174 | 175 | NS_ASSUME_NONNULL_END 176 | -------------------------------------------------------------------------------- /ios/CTStub.m: -------------------------------------------------------------------------------- 1 | #import "CTStub.h" 2 | 3 | @implementation CTContactInfo 4 | 5 | @end 6 | 7 | @implementation CTDailyTracingKey 8 | 9 | @end 10 | 11 | @implementation CTExposureDetectionSession 12 | 13 | - (void)activateWithCompletion:(nullable CTErrorHandler)inCompletion 14 | { 15 | inCompletion(NULL); 16 | } 17 | 18 | - (void)addPositiveDiagnosisKeys:(NSArray *)inKeys 19 | completion:(nullable CTErrorHandler)inCompletion 20 | { 21 | inCompletion(NULL); 22 | } 23 | 24 | - (void)finishedPositiveDiagnosisKeysWithCompletion:(nullable CTExposureDetectionFinishHandler)inFinishHandler 25 | { 26 | inFinishHandler(NULL, NULL); 27 | } 28 | 29 | - (void)getContactInfoWithHandler:(nullable CTExposureDetectionContactHandler)inHandler 30 | { 31 | inHandler(NULL, NULL); 32 | } 33 | 34 | - (void)invalidate 35 | { 36 | // NOOP 37 | } 38 | 39 | @end 40 | 41 | @implementation CTSelfTracingInfoRequest 42 | 43 | - (void)perform 44 | { 45 | // NOOP 46 | } 47 | 48 | - (void)invalidate 49 | { 50 | // NOOP 51 | } 52 | 53 | @end 54 | 55 | @implementation CTStateGetRequest 56 | 57 | - (void)perform 58 | { 59 | // NOOP 60 | } 61 | 62 | - (void)invalidate 63 | { 64 | // NOOP 65 | } 66 | 67 | @end 68 | 69 | @implementation CTStateSetRequest 70 | 71 | - (void)perform 72 | { 73 | // NOOP 74 | } 75 | 76 | - (void)invalidate 77 | { 78 | // NOOP 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /ios/ContactTracing-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import "CTStub.h" 5 | -------------------------------------------------------------------------------- /ios/ContactTracing.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface RCT_EXTERN_MODULE(ContactTracing, RCTEventEmitter) 5 | 6 | RCT_EXTERN_METHOD(start:(RCTPromiseResolveBlock)resolve 7 | reject:(RCTPromiseRejectBlock)reject) 8 | 9 | RCT_EXTERN_METHOD(stop:(RCTPromiseResolveBlock)resolve 10 | reject:(RCTPromiseRejectBlock)reject) 11 | 12 | RCT_EXTERN_METHOD(requestExposureSummary:(RCTPromiseResolveBlock)resolve 13 | reject:(RCTPromiseRejectBlock)reject) 14 | 15 | RCT_EXTERN_METHOD(currentStatus:(RCTPromiseResolveBlock)resolve 16 | reject:(RCTPromiseRejectBlock)reject) 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ios/ContactTracing.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc(ContactTracing) 4 | public class ContactTracing: RCTEventEmitter { 5 | 6 | /// Events 7 | static let exposureDetectionSummaryReceived = "exposureDetectionSummaryReceived" 8 | static let contactInformationReceived = "contactInformationReceived" 9 | static let stateDidChange = "stateDidChange" 10 | static let authorizationDidChange = "authorizationDidChange" 11 | static let onError = "onError" 12 | static let onExposure = "onExposure" 13 | 14 | static let errorKey = "CT_ERROR" 15 | 16 | private var dispatchQueue: DispatchQueue = DispatchQueue(label: "com.ericlewis.react-native-contact-tracing") 17 | 18 | public override func supportedEvents() -> [String]! { 19 | [ 20 | Self.exposureDetectionSummaryReceived, 21 | Self.contactInformationReceived, 22 | Self.stateDidChange, 23 | Self.authorizationDidChange, 24 | Self.onError, 25 | Self.onExposure 26 | ] 27 | } 28 | 29 | public override func constantsToExport() -> [AnyHashable : Any]! { 30 | ["supported": true] // this is basically always true, the limit is based on iOS version. 31 | } 32 | 33 | @objc 34 | public override static func requiresMainQueueSetup() -> Bool { 35 | true 36 | } 37 | 38 | private(set) var state: CTManagerState = .unknown { 39 | didSet { 40 | guard oldValue != state else { return } 41 | self.sendEvent(withName: Self.stateDidChange, 42 | body: state.rawValue) 43 | } 44 | } 45 | 46 | private(set) var authorized: Bool = false { 47 | didSet { 48 | guard oldValue != authorized else { return } 49 | self.sendEvent(withName: Self.authorizationDidChange, 50 | body: authorized) 51 | } 52 | } 53 | 54 | private var currentGetRequest: CTStateGetRequest? { 55 | willSet { currentGetRequest?.invalidate() } 56 | } 57 | 58 | private var currentSetRequest: CTStateSetRequest? { 59 | willSet { currentSetRequest?.invalidate() } 60 | } 61 | 62 | private var currentSession: CTExposureDetectionSession? { 63 | willSet { currentSession?.invalidate() } 64 | didSet { 65 | guard let session = currentSession else { return } 66 | session.activate { (error) in 67 | guard error != nil else { 68 | self.sendEvent(withName: Self.onError, body: error?.localizedDescription) 69 | return 70 | } 71 | self.authorized = true 72 | } 73 | } 74 | } 75 | 76 | @objc 77 | func start(_ resolve: @escaping RCTPromiseResolveBlock, 78 | reject: @escaping RCTPromiseRejectBlock) { 79 | guard state != .on else { return } 80 | 81 | let getRequest = CTStateGetRequest() 82 | getRequest.dispatchQueue = self.dispatchQueue 83 | defer { getRequest.perform() } 84 | 85 | getRequest.completionHandler = { error in 86 | guard error != nil else { return reject(Self.errorKey, "getRequest", error) } 87 | self.state = getRequest.state 88 | 89 | let setRequest = CTStateSetRequest() 90 | setRequest.dispatchQueue = self.dispatchQueue 91 | defer { setRequest.perform() } 92 | 93 | setRequest.state = .on 94 | setRequest.completionHandler = { error in 95 | guard error != nil else { return reject(Self.errorKey, "setRequest", error) } 96 | self.state = setRequest.state 97 | self.currentSession = CTExposureDetectionSession() 98 | resolve(nil) 99 | } 100 | } 101 | 102 | self.currentGetRequest = getRequest 103 | } 104 | 105 | @objc 106 | func stop(_ resolve: @escaping RCTPromiseResolveBlock, 107 | reject: @escaping RCTPromiseRejectBlock) { 108 | guard state != .off else { return } 109 | 110 | let setRequest = CTStateSetRequest() 111 | setRequest.dispatchQueue = self.dispatchQueue 112 | defer { setRequest.perform() } 113 | 114 | setRequest.state = .off 115 | setRequest.completionHandler = { error in 116 | guard error != nil else { return reject(Self.errorKey, "setRequest", error) } 117 | self.state = setRequest.state 118 | self.currentSession = nil 119 | resolve(nil) 120 | } 121 | 122 | self.currentSetRequest = setRequest 123 | } 124 | 125 | @objc 126 | func requestExposureSummary(_ resolve: @escaping RCTPromiseResolveBlock, 127 | reject: @escaping RCTPromiseRejectBlock) { 128 | guard authorized, let session = currentSession else { return } 129 | 130 | let selfTracingInfoRequest = CTSelfTracingInfoRequest() 131 | selfTracingInfoRequest.dispatchQueue = self.dispatchQueue 132 | 133 | selfTracingInfoRequest.completionHandler = { (tracingInfo, error) in 134 | guard error != nil else { return reject(Self.errorKey, "selfTracingInfoRequest", error) } 135 | guard let dailyTracingKeys = tracingInfo?.dailyTracingKeys else { return } 136 | 137 | session.addPositiveDiagnosisKeys(batching: dailyTracingKeys) { (error) in 138 | guard error != nil else { return reject(Self.errorKey, "addPositiveDiagnosisKeys", error) } 139 | 140 | session.finishedPositiveDiagnosisKeys { (summary, error) in 141 | guard error != nil else { return reject(Self.errorKey, "finishedPositiveDiagnosisKeys", error) } 142 | guard let summary = summary else { return } 143 | 144 | self.sendEvent(withName: Self.exposureDetectionSummaryReceived, 145 | body: summary.matchedKeyCount) 146 | 147 | if summary.matchedKeyCount > 0 { 148 | self.sendEvent(withName: Self.onExposure, 149 | body: nil) 150 | } 151 | 152 | session.getContactInfo { (contactInfo, error) in 153 | guard error != nil else { return reject(Self.errorKey, "getContactInfo", error) } 154 | guard let contactInfo = contactInfo?.map({ ["duration": $0.duration, "timestamp": $0.timestamp] }) 155 | else { return } 156 | 157 | self.sendEvent(withName: Self.contactInformationReceived, 158 | body: contactInfo) 159 | 160 | resolve(["matchedKeyCount": summary.matchedKeyCount, "contactInformation": contactInfo]) 161 | } 162 | } 163 | } 164 | } 165 | } 166 | 167 | @objc 168 | func currentStatus(_ resolve: @escaping RCTPromiseResolveBlock, 169 | reject: @escaping RCTPromiseRejectBlock) { 170 | resolve(state.rawValue) 171 | } 172 | } 173 | 174 | extension CTExposureDetectionSession { 175 | func addPositiveDiagnosisKeys(batching keys: [CTDailyTracingKey], completion: CTErrorHandler) { 176 | if keys.isEmpty { 177 | completion(nil) 178 | } else { 179 | let cursor = keys.index(keys.startIndex, offsetBy: maxKeyCount, limitedBy: keys.endIndex) ?? keys.endIndex 180 | let batch = Array(keys.prefix(upTo: cursor)) 181 | let remaining = Array(keys.suffix(from: cursor)) 182 | 183 | withoutActuallyEscaping(completion) { escapingCompletion in 184 | addPositiveDiagnosisKeys(batch) { (error) in 185 | if let error = error { 186 | escapingCompletion(error) 187 | } else { 188 | self.addPositiveDiagnosisKeys(batching: remaining, completion: escapingCompletion) 189 | } 190 | } 191 | } 192 | } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /ios/ContactTracing.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 68CD69F62443F5E500A66F66 /* ContactTracing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68CD69F32443F5E500A66F66 /* ContactTracing.swift */; }; 11 | 68DFFF9D244518F400DEA07F /* CTStub.m in Sources */ = {isa = PBXBuildFile; fileRef = 68DFFF9C244518F400DEA07F /* CTStub.m */; }; 12 | B3E7B58A1CC2AC0600A0062D /* ContactTracing.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ContactTracing.m */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXCopyFilesBuildPhase section */ 16 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 17 | isa = PBXCopyFilesBuildPhase; 18 | buildActionMask = 2147483647; 19 | dstPath = "include/$(PRODUCT_NAME)"; 20 | dstSubfolderSpec = 16; 21 | files = ( 22 | ); 23 | runOnlyForDeploymentPostprocessing = 0; 24 | }; 25 | /* End PBXCopyFilesBuildPhase section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 134814201AA4EA6300B7C361 /* libContactTracing.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libContactTracing.a; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 68CD69F02443F5E500A66F66 /* ContactTracing-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ContactTracing-Bridging-Header.h"; sourceTree = ""; }; 30 | 68CD69F32443F5E500A66F66 /* ContactTracing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactTracing.swift; sourceTree = ""; }; 31 | 68DFFF97244514B500DEA07F /* CTStub.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CTStub.h; sourceTree = ""; }; 32 | 68DFFF9C244518F400DEA07F /* CTStub.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CTStub.m; sourceTree = ""; }; 33 | B3E7B5891CC2AC0600A0062D /* ContactTracing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactTracing.m; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 134814211AA4EA7D00B7C361 /* Products */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 134814201AA4EA6300B7C361 /* libContactTracing.a */, 51 | ); 52 | name = Products; 53 | sourceTree = ""; 54 | }; 55 | 58B511D21A9E6C8500147676 = { 56 | isa = PBXGroup; 57 | children = ( 58 | 68DFFF97244514B500DEA07F /* CTStub.h */, 59 | 68DFFF9C244518F400DEA07F /* CTStub.m */, 60 | 68CD69F02443F5E500A66F66 /* ContactTracing-Bridging-Header.h */, 61 | B3E7B5891CC2AC0600A0062D /* ContactTracing.m */, 62 | 68CD69F32443F5E500A66F66 /* ContactTracing.swift */, 63 | 134814211AA4EA7D00B7C361 /* Products */, 64 | ); 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | 58B511DA1A9E6C8500147676 /* ContactTracing */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ContactTracing" */; 73 | buildPhases = ( 74 | 58B511D71A9E6C8500147676 /* Sources */, 75 | 58B511D81A9E6C8500147676 /* Frameworks */, 76 | 58B511D91A9E6C8500147676 /* CopyFiles */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = ContactTracing; 83 | productName = RCTDataManager; 84 | productReference = 134814201AA4EA6300B7C361 /* libContactTracing.a */; 85 | productType = "com.apple.product-type.library.static"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | 58B511D31A9E6C8500147676 /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastUpgradeCheck = 0920; 94 | ORGANIZATIONNAME = Facebook; 95 | TargetAttributes = { 96 | 58B511DA1A9E6C8500147676 = { 97 | CreatedOnToolsVersion = 6.1.1; 98 | LastSwiftMigration = 1140; 99 | }; 100 | }; 101 | }; 102 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ContactTracing" */; 103 | compatibilityVersion = "Xcode 3.2"; 104 | developmentRegion = English; 105 | hasScannedForEncodings = 0; 106 | knownRegions = ( 107 | English, 108 | en, 109 | ); 110 | mainGroup = 58B511D21A9E6C8500147676; 111 | productRefGroup = 58B511D21A9E6C8500147676; 112 | projectDirPath = ""; 113 | projectRoot = ""; 114 | targets = ( 115 | 58B511DA1A9E6C8500147676 /* ContactTracing */, 116 | ); 117 | }; 118 | /* End PBXProject section */ 119 | 120 | /* Begin PBXSourcesBuildPhase section */ 121 | 58B511D71A9E6C8500147676 /* Sources */ = { 122 | isa = PBXSourcesBuildPhase; 123 | buildActionMask = 2147483647; 124 | files = ( 125 | 68DFFF9D244518F400DEA07F /* CTStub.m in Sources */, 126 | 68CD69F62443F5E500A66F66 /* ContactTracing.swift in Sources */, 127 | B3E7B58A1CC2AC0600A0062D /* ContactTracing.m in Sources */, 128 | ); 129 | runOnlyForDeploymentPostprocessing = 0; 130 | }; 131 | /* End PBXSourcesBuildPhase section */ 132 | 133 | /* Begin XCBuildConfiguration section */ 134 | 58B511ED1A9E6C8500147676 /* Debug */ = { 135 | isa = XCBuildConfiguration; 136 | buildSettings = { 137 | ALWAYS_SEARCH_USER_PATHS = NO; 138 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 139 | CLANG_CXX_LIBRARY = "libc++"; 140 | CLANG_ENABLE_MODULES = YES; 141 | CLANG_ENABLE_OBJC_ARC = YES; 142 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 143 | CLANG_WARN_BOOL_CONVERSION = YES; 144 | CLANG_WARN_COMMA = YES; 145 | CLANG_WARN_CONSTANT_CONVERSION = YES; 146 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 147 | CLANG_WARN_EMPTY_BODY = YES; 148 | CLANG_WARN_ENUM_CONVERSION = YES; 149 | CLANG_WARN_INFINITE_RECURSION = YES; 150 | CLANG_WARN_INT_CONVERSION = YES; 151 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 152 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 153 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 154 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 155 | CLANG_WARN_STRICT_PROTOTYPES = YES; 156 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 157 | CLANG_WARN_UNREACHABLE_CODE = YES; 158 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 159 | COPY_PHASE_STRIP = NO; 160 | ENABLE_STRICT_OBJC_MSGSEND = YES; 161 | ENABLE_TESTABILITY = YES; 162 | GCC_C_LANGUAGE_STANDARD = gnu99; 163 | GCC_DYNAMIC_NO_PIC = NO; 164 | GCC_NO_COMMON_BLOCKS = YES; 165 | GCC_OPTIMIZATION_LEVEL = 0; 166 | GCC_PREPROCESSOR_DEFINITIONS = ( 167 | "DEBUG=1", 168 | "$(inherited)", 169 | ); 170 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 171 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 172 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 173 | GCC_WARN_UNDECLARED_SELECTOR = YES; 174 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 175 | GCC_WARN_UNUSED_FUNCTION = YES; 176 | GCC_WARN_UNUSED_VARIABLE = YES; 177 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 178 | MTL_ENABLE_DEBUG_INFO = YES; 179 | ONLY_ACTIVE_ARCH = YES; 180 | SDKROOT = iphoneos; 181 | }; 182 | name = Debug; 183 | }; 184 | 58B511EE1A9E6C8500147676 /* Release */ = { 185 | isa = XCBuildConfiguration; 186 | buildSettings = { 187 | ALWAYS_SEARCH_USER_PATHS = NO; 188 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 189 | CLANG_CXX_LIBRARY = "libc++"; 190 | CLANG_ENABLE_MODULES = YES; 191 | CLANG_ENABLE_OBJC_ARC = YES; 192 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 193 | CLANG_WARN_BOOL_CONVERSION = YES; 194 | CLANG_WARN_COMMA = YES; 195 | CLANG_WARN_CONSTANT_CONVERSION = YES; 196 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 197 | CLANG_WARN_EMPTY_BODY = YES; 198 | CLANG_WARN_ENUM_CONVERSION = YES; 199 | CLANG_WARN_INFINITE_RECURSION = YES; 200 | CLANG_WARN_INT_CONVERSION = YES; 201 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 202 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 203 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 204 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 205 | CLANG_WARN_STRICT_PROTOTYPES = YES; 206 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | COPY_PHASE_STRIP = YES; 210 | ENABLE_NS_ASSERTIONS = NO; 211 | ENABLE_STRICT_OBJC_MSGSEND = YES; 212 | GCC_C_LANGUAGE_STANDARD = gnu99; 213 | GCC_NO_COMMON_BLOCKS = YES; 214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 216 | GCC_WARN_UNDECLARED_SELECTOR = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 218 | GCC_WARN_UNUSED_FUNCTION = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 221 | MTL_ENABLE_DEBUG_INFO = NO; 222 | SDKROOT = iphoneos; 223 | VALIDATE_PRODUCT = YES; 224 | }; 225 | name = Release; 226 | }; 227 | 58B511F01A9E6C8500147676 /* Debug */ = { 228 | isa = XCBuildConfiguration; 229 | buildSettings = { 230 | CLANG_ENABLE_MODULES = YES; 231 | HEADER_SEARCH_PATHS = ( 232 | "$(inherited)", 233 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 234 | "$(SRCROOT)/../../../React/**", 235 | "$(SRCROOT)/../../react-native/React/**", 236 | ); 237 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 238 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 239 | OTHER_LDFLAGS = "-ObjC"; 240 | PRODUCT_NAME = ContactTracing; 241 | SKIP_INSTALL = YES; 242 | SWIFT_OBJC_BRIDGING_HEADER = "ContactTracing-Bridging-Header.h"; 243 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 244 | SWIFT_VERSION = 5.0; 245 | }; 246 | name = Debug; 247 | }; 248 | 58B511F11A9E6C8500147676 /* Release */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | CLANG_ENABLE_MODULES = YES; 252 | HEADER_SEARCH_PATHS = ( 253 | "$(inherited)", 254 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 255 | "$(SRCROOT)/../../../React/**", 256 | "$(SRCROOT)/../../react-native/React/**", 257 | ); 258 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 259 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 260 | OTHER_LDFLAGS = "-ObjC"; 261 | PRODUCT_NAME = ContactTracing; 262 | SKIP_INSTALL = YES; 263 | SWIFT_OBJC_BRIDGING_HEADER = "ContactTracing-Bridging-Header.h"; 264 | SWIFT_VERSION = 5.0; 265 | }; 266 | name = Release; 267 | }; 268 | /* End XCBuildConfiguration section */ 269 | 270 | /* Begin XCConfigurationList section */ 271 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ContactTracing" */ = { 272 | isa = XCConfigurationList; 273 | buildConfigurations = ( 274 | 58B511ED1A9E6C8500147676 /* Debug */, 275 | 58B511EE1A9E6C8500147676 /* Release */, 276 | ); 277 | defaultConfigurationIsVisible = 0; 278 | defaultConfigurationName = Release; 279 | }; 280 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ContactTracing" */ = { 281 | isa = XCConfigurationList; 282 | buildConfigurations = ( 283 | 58B511F01A9E6C8500147676 /* Debug */, 284 | 58B511F11A9E6C8500147676 /* Release */, 285 | ); 286 | defaultConfigurationIsVisible = 0; 287 | defaultConfigurationName = Release; 288 | }; 289 | /* End XCConfigurationList section */ 290 | }; 291 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 292 | } 293 | -------------------------------------------------------------------------------- /ios/ContactTracing.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-contact-tracing", 3 | "title": "React Native Contact Tracing", 4 | "version": "1.0.0", 5 | "description": "React-native module for Apple & Google's Contact Tracing Framework", 6 | "main": "index.js", 7 | "types": "index.d.ts", 8 | "scripts": { 9 | "start": "node node_modules/react-native/local-cli/cli.js start", 10 | "start:android": "react-native run-android --root example/", 11 | "start:ios": "react-native run-ios --project-path example/ios" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/github_account/react-native-contact-tracing.git", 16 | "baseUrl": "https://github.com/github_account/react-native-contact-tracing" 17 | }, 18 | "homepage": "https://github.com/github_account/react-native-contact-tracing", 19 | "keywords": [ 20 | "react-native" 21 | ], 22 | "author": { 23 | "name": "Eric Lewis", 24 | "email": "ericlewis777@gmail.com" 25 | }, 26 | "license": "UNLICENSED", 27 | "readmeFilename": "README.md", 28 | "peerDependencies": { 29 | "react": "^16.8.1", 30 | "react-native": ">=0.60.0-rc.0 <1.0.x" 31 | }, 32 | "devDependencies": { 33 | "react": "16.11.0", 34 | "react-native": "0.62.2" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /react-native-contact-tracing.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = package['name'] 7 | s.version = package['version'] 8 | s.summary = package['description'] 9 | s.license = package['license'] 10 | 11 | s.authors = package['author'] 12 | s.homepage = package['homepage'] 13 | s.platform = :ios, "13.4" 14 | s.source = { :git => "https://github.com/github_account/react-native-contact-tracing.git", :tag => "#{s.version}" } 15 | 16 | s.source_files = "ios/**/*.{h,m,swift}" 17 | s.requires_arc = true 18 | 19 | s.dependency "React" 20 | end 21 | 22 | -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | project: { 3 | android: { 4 | sourceDir: './example/android', 5 | }, 6 | }, 7 | }; 8 | --------------------------------------------------------------------------------