├── .gitattributes ├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── android ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── faizal │ └── OtpVerify │ ├── AppSignatureHelper.java │ ├── OtpBroadcastReceiver.java │ ├── OtpVerifyModule.java │ └── OtpVerifyPackage.java ├── babel.config.js ├── dist ├── index.d.ts └── index.js ├── example ├── android │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── reactnativeotpverify │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── reactnativeotpverify │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.tsx ├── ios │ ├── File.swift │ ├── OtpVerifyExample-Bridging-Header.h │ ├── OtpVerifyExample.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── OtpVerifyExample.xcscheme │ ├── OtpVerifyExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── OtpVerifyExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ └── Podfile ├── metro.config.js ├── package-lock.json ├── package.json └── src │ └── App.tsx ├── lib ├── commonjs │ ├── index.js │ └── index.js.map ├── module │ ├── index.js │ └── index.js.map └── typescript │ ├── __tests__ │ └── index.test.d.ts │ └── index.d.ts ├── package.json ├── react-native-otp-verify.podspec ├── scripts └── bootstrap.js ├── src ├── __tests__ │ └── index.test.tsx └── index.tsx ├── tsconfig.build.json └── tsconfig.json /.gitattributes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/.gitattributes -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Android/IntelliJ 14 | # 15 | build/ 16 | .idea 17 | .gradle 18 | local.properties 19 | *.iml 20 | 21 | # BUCK 22 | buck-out/ 23 | \.buckd/ 24 | *.keystore 25 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | android/build 2 | build/ 3 | .idea 4 | .gradle 5 | *.iml 6 | local.properties 7 | 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. 4 | 5 | ## Development workflow 6 | 7 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 8 | 9 | ```sh 10 | yarn 11 | ``` 12 | 13 | > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development. 14 | 15 | While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. 16 | 17 | To start the packager: 18 | 19 | ```sh 20 | yarn example start 21 | ``` 22 | 23 | To run the example app on Android: 24 | 25 | ```sh 26 | yarn example android 27 | ``` 28 | 29 | To run the example app on iOS: 30 | 31 | ```sh 32 | yarn example ios 33 | ``` 34 | 35 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 36 | 37 | ```sh 38 | yarn typescript 39 | yarn lint 40 | ``` 41 | 42 | To fix formatting errors, run the following: 43 | 44 | ```sh 45 | yarn lint --fix 46 | ``` 47 | 48 | Remember to add tests for your change if possible. Run the unit tests by: 49 | 50 | ```sh 51 | yarn test 52 | ``` 53 | 54 | To edit the Objective-C files, open `example/ios/OtpVerifyExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-otp-verify`. 55 | 56 | To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativeotpverify` under `Android`. 57 | 58 | ### Commit message convention 59 | 60 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 61 | 62 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 63 | - `feat`: new features, e.g. add new method to the module. 64 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 65 | - `docs`: changes into documentation, e.g. add usage example for the module.. 66 | - `test`: adding or updating tests, e.g. add integration tests using detox. 67 | - `chore`: tooling changes, e.g. change CI config. 68 | 69 | Our pre-commit hooks verify that your commit message matches this format when committing. 70 | 71 | ### Linting and tests 72 | 73 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 74 | 75 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 76 | 77 | Our pre-commit hooks verify that the linter and tests pass when committing. 78 | 79 | ### Publishing to npm 80 | 81 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. 82 | 83 | To publish new versions, run the following: 84 | 85 | ```sh 86 | yarn release 87 | ``` 88 | 89 | ### Scripts 90 | 91 | The `package.json` file contains various scripts for common tasks: 92 | 93 | - `yarn bootstrap`: setup project by installing all dependencies and pods. 94 | - `yarn typescript`: type-check files with TypeScript. 95 | - `yarn lint`: lint files with ESLint. 96 | - `yarn test`: run unit tests with Jest. 97 | - `yarn example start`: start the Metro server for the example app. 98 | - `yarn example android`: run the example app on Android. 99 | - `yarn example ios`: run the example app on iOS. 100 | 101 | ### Sending a pull request 102 | 103 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). 104 | 105 | When you're sending a pull request: 106 | 107 | - Prefer small pull requests focused on one change. 108 | - Verify that linters and tests are passing. 109 | - Review the documentation to make sure it looks good. 110 | - Follow the pull request template when opening a pull request. 111 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 112 | 113 | ## Code of Conduct 114 | 115 | ### Our Pledge 116 | 117 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 118 | 119 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 120 | 121 | ### Our Standards 122 | 123 | Examples of behavior that contributes to a positive environment for our community include: 124 | 125 | - Demonstrating empathy and kindness toward other people 126 | - Being respectful of differing opinions, viewpoints, and experiences 127 | - Giving and gracefully accepting constructive feedback 128 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 129 | - Focusing on what is best not just for us as individuals, but for the overall community 130 | 131 | Examples of unacceptable behavior include: 132 | 133 | - The use of sexualized language or imagery, and sexual attention or 134 | advances of any kind 135 | - Trolling, insulting or derogatory comments, and personal or political attacks 136 | - Public or private harassment 137 | - Publishing others' private information, such as a physical or email 138 | address, without their explicit permission 139 | - Other conduct which could reasonably be considered inappropriate in a 140 | professional setting 141 | 142 | ### Enforcement Responsibilities 143 | 144 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 145 | 146 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 147 | 148 | ### Scope 149 | 150 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 151 | 152 | ### Enforcement 153 | 154 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. 155 | 156 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 157 | 158 | ### Enforcement Guidelines 159 | 160 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 161 | 162 | #### 1. Correction 163 | 164 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 165 | 166 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 167 | 168 | #### 2. Warning 169 | 170 | **Community Impact**: A violation through a single incident or series of actions. 171 | 172 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 173 | 174 | #### 3. Temporary Ban 175 | 176 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 177 | 178 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 179 | 180 | #### 4. Permanent Ban 181 | 182 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 183 | 184 | **Consequence**: A permanent ban from any sort of public interaction within the community. 185 | 186 | ### Attribution 187 | 188 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, 189 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 190 | 191 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 192 | 193 | [homepage]: https://www.contributor-covenant.org 194 | 195 | For answers to common questions about this code of conduct, see the FAQ at 196 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 197 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 faizalshap 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Native Otp Verify ✉️ 2 | 3 | ___ 4 | [![npm version](https://badge.fury.io/js/react-native-otp-verify.svg)](https://badge.fury.io/js/react-native-otp-verify) 5 | 6 | - Automatic SMS Verification with the SMS Retriever API (Android Only) 7 | - Phone Number Retrieving using the Phone Number Hint API (Android Only) 8 | 9 | Automatic SMS Verification with the SMS Retriever API, you can perform SMS-based user verification in your Android app automatically, without requiring the user to manually type verification codes, and without requiring any extra app permissions. 10 | 11 | ## Message Format/Structure 12 | In order to detect the message, **_SMS message must include a hash_** that identifies your app. This hash can be obtained by using the getHash() method below. 13 | 14 | Please read the official documentation for the message structure at this 15 | [Google developer guide](https://developers.google.com/identity/sms-retriever/verify) 16 | 17 | ## Quick start 🔥 18 | #### Installation 19 | `$ npm install react-native-otp-verify --save` 20 | 21 | or 22 | 23 | `$ yarn add react-native-otp-verify` 24 | 25 | 26 | ## Usage 27 | 28 | #### Import the Library 29 | ```javascript 30 | import { 31 | getHash, 32 | startOtpListener, 33 | useOtpVerify, 34 | } from 'react-native-otp-verify'; 35 | ``` 36 | 37 | #### Using Hook 38 | ```javascript 39 | 40 | // You can use the startListener and stopListener to manually trigger listeners again. 41 | // optionally pass numberOfDigits if you want to extract otp 42 | const { hash, otp, message, timeoutError, stopListener, startListener } = useOtpVerify({numberOfDigits: 4}); 43 | ``` 44 | #### Properties 45 | | Property | Type | Description | 46 | | ------------- |:-------------:|:-------------:| 47 | | hash | string[] | The hash code for the application which should be added at the end of message.| 48 | | otp | string | OTP retreived from SMS when received. (Must pass `numberOfDigits`) | 49 | | message | string | SMS message when received. | 50 | | timeoutError | boolean | Flag is set to true when after timeout (5 minutes) [Check here](https://developers.google.com/identity/sms-retriever/request#2_start_the_sms_retriever) | 51 | | startListener | function | Manually starts listener again in case of timeout or any other error | 52 | | stopListener | function | Stops listener for the sms | 53 | 54 | #### Using Methods 55 | ```javascript 56 | // using methods 57 | useEffect(() => { 58 | getHash().then(hash => { 59 | // use this hash in the message. 60 | }).catch(console.log); 61 | 62 | startOtpListener(message => { 63 | // extract the otp using regex e.g. the below regex extracts 4 digit otp from message 64 | const otp = /(\d{4})/g.exec(message)[1]; 65 | setOtp(otp); 66 | }); 67 | return () => removeListener(); 68 | }, []); 69 | ``` 70 | ## Example 71 | See the example app in `example` folder. 72 | ### Auto Linking for React Native >= 0.60 73 | 74 | Linking the package manually is not required anymore with [**Autolinking**](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md). 75 | 76 | ### Manual Linking 77 | 78 | 1. Open up `android/app/src/main/java/[...]/MainActivity.java` 79 | - Add `import com.faizal.OtpVerify.OtpVerifyPackage;` to the imports at the top of the file 80 | - Add `new OtpVerifyPackage()` to the list returned by the `getPackages()` method 81 | 2. Append the following lines to `android/settings.gradle`: 82 | ```gradle 83 | include ':react-native-otp-verify' 84 | project(':react-native-otp-verify').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-otp-verify/android') 85 | ``` 86 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: 87 | ```gradle 88 | implementation project(':react-native-otp-verify') 89 | ``` 90 | 91 | #### Methods 92 | --- 93 | #### `requestHint: () => Promise` 94 | 95 | Gets phone number in a frictionless way to show a user’s (SIM-based) phone numbers as a hint. [Check here](https://developers.google.com/identity/phone-number-hint/android#request-phone-number-hint) 96 | 97 | --- 98 | #### `startOtpListener(handler:(message:string)=>any):Promise` 99 | 100 | Start listening for OTP/SMS and adds listener for the handler passed which is called when message is received.. 101 | 102 | --- 103 | #### `getOtp():Promise` 104 | 105 | Start listening for OTP/SMS. Return true if listener starts else throws error. 106 | 107 | --- 108 | #### `getHash():Promise` 109 | 110 | Gets the hash code for the application which should be added at the end of message. 111 | This is just a one time process. 112 | 113 | --- 114 | #### `addListener(handler:(message:string)=>any):Subscription` 115 | 116 | Adds a javascript listener to the handler passed which is called when message is received. 117 | 118 | --- 119 | #### `removeListener():void` 120 | 121 | Removes all listeners. 122 | 123 | --- 124 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | if (project == rootProject) { 3 | repositories { 4 | google() 5 | mavenCentral() 6 | jcenter() 7 | } 8 | 9 | dependencies { 10 | classpath("com.android.tools.build:gradle:3.6.1") 11 | } 12 | } 13 | } 14 | 15 | apply plugin: 'com.android.library' 16 | 17 | def safeExtGet(prop, fallback) { 18 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 19 | } 20 | 21 | android { 22 | compileSdkVersion safeExtGet('OtpVerify_compileSdkVersion', 34) 23 | namespace 'com.faizal.OtpVerify' 24 | defaultConfig { 25 | minSdkVersion safeExtGet('OtpVerify_minSdkVersion', 21) 26 | targetSdkVersion safeExtGet('OtpVerify_targetSdkVersion', 34) 27 | versionCode 2 28 | versionName "1.0" 29 | 30 | } 31 | 32 | buildTypes { 33 | release { 34 | minifyEnabled false 35 | } 36 | } 37 | lintOptions { 38 | disable 'GradleCompatible' 39 | } 40 | compileOptions { 41 | sourceCompatibility JavaVersion.VERSION_1_8 42 | targetCompatibility JavaVersion.VERSION_1_8 43 | } 44 | } 45 | 46 | repositories { 47 | mavenLocal() 48 | maven { 49 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 50 | url("$rootDir/../node_modules/react-native/android") 51 | } 52 | google() 53 | mavenCentral() 54 | jcenter() 55 | } 56 | 57 | dependencies { 58 | //noinspection GradleDynamicVersion 59 | implementation "com.facebook.react:react-native:+" // From node_modules 60 | implementation "com.google.android.gms:play-services-auth:21.2.0" 61 | } 62 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # 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 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /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 Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/java/com/faizal/OtpVerify/AppSignatureHelper.java: -------------------------------------------------------------------------------- 1 | package com.faizal.OtpVerify; 2 | 3 | import android.content.Context; 4 | import android.content.ContextWrapper; 5 | import android.content.pm.PackageManager; 6 | import android.content.pm.Signature; 7 | import android.os.Build; 8 | import android.util.Base64; 9 | import android.util.Log; 10 | 11 | import java.nio.charset.StandardCharsets; 12 | import java.security.MessageDigest; 13 | import java.security.NoSuchAlgorithmException; 14 | import java.util.ArrayList; 15 | import java.util.Arrays; 16 | 17 | public class AppSignatureHelper extends ContextWrapper { 18 | public static final String TAG = AppSignatureHelper.class.getSimpleName(); 19 | 20 | private static final String HASH_TYPE = "SHA-256"; 21 | public static final int NUM_HASHED_BYTES = 9; 22 | public static final int NUM_BASE64_CHAR = 11; 23 | 24 | public AppSignatureHelper(Context context) { 25 | super(context); 26 | } 27 | 28 | /** 29 | * Get all the app signatures for the current package 30 | * 31 | * @return 32 | */ 33 | public ArrayList getAppSignatures() { 34 | ArrayList appCodes = new ArrayList<>(); 35 | 36 | try { 37 | // Get all package signatures for the current package 38 | String packageName = getPackageName(); 39 | PackageManager packageManager = getPackageManager(); 40 | Signature[] signatures = packageManager.getPackageInfo(packageName, 41 | PackageManager.GET_SIGNATURES).signatures; 42 | 43 | // For each signature create a compatible hash 44 | for (Signature signature : signatures) { 45 | String hash = hash(packageName, signature.toCharsString()); 46 | if (hash != null) { 47 | appCodes.add(String.format("%s", hash)); 48 | } 49 | } 50 | } catch (PackageManager.NameNotFoundException e) { 51 | Log.e(TAG, "Unable to find package to obtain hash.", e); 52 | } 53 | return appCodes; 54 | } 55 | 56 | private static String hash(String packageName, String signature) { 57 | String appInfo = packageName + " " + signature; 58 | try { 59 | MessageDigest messageDigest = MessageDigest.getInstance(HASH_TYPE); 60 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 61 | messageDigest.update(appInfo.getBytes(StandardCharsets.UTF_8)); 62 | } 63 | byte[] hashSignature = messageDigest.digest(); 64 | 65 | // truncated into NUM_HASHED_BYTES 66 | hashSignature = Arrays.copyOfRange(hashSignature, 0, NUM_HASHED_BYTES); 67 | // encode into Base64 68 | String base64Hash = Base64.encodeToString(hashSignature, Base64.NO_PADDING | Base64.NO_WRAP); 69 | base64Hash = base64Hash.substring(0, NUM_BASE64_CHAR); 70 | 71 | Log.d(TAG, String.format("pkg: %s -- hash: %s", packageName, base64Hash)); 72 | return base64Hash; 73 | } catch (NoSuchAlgorithmException e) { 74 | Log.e(TAG, "hash:NoSuchAlgorithm", e); 75 | } 76 | return null; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /android/src/main/java/com/faizal/OtpVerify/OtpBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package com.faizal.OtpVerify; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.util.Log; 8 | 9 | import com.facebook.react.bridge.ReactApplicationContext; 10 | import com.facebook.react.bridge.WritableNativeMap; 11 | import com.facebook.react.modules.core.DeviceEventManagerModule; 12 | import com.google.android.gms.auth.api.phone.SmsRetriever; 13 | import com.google.android.gms.common.api.CommonStatusCodes; 14 | import com.google.android.gms.common.api.Status; 15 | 16 | public class OtpBroadcastReceiver extends BroadcastReceiver { 17 | 18 | private ReactApplicationContext mContext; 19 | 20 | private static final String EVENT = "com.faizalshap.otpVerify:otpReceived"; 21 | 22 | public OtpBroadcastReceiver(ReactApplicationContext context) { 23 | mContext = context; 24 | } 25 | 26 | private void receiveMessage(String message) { 27 | if (mContext == null) { 28 | return; 29 | } 30 | 31 | if (!mContext.hasActiveCatalystInstance()) { 32 | return; 33 | } 34 | 35 | WritableNativeMap receivedMessage = new WritableNativeMap(); 36 | 37 | receivedMessage.putString("message", message); 38 | 39 | mContext 40 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) 41 | .emit(EVENT, message); 42 | } 43 | 44 | @Override 45 | public void onReceive(Context context, Intent intent) { 46 | String o = intent.getAction(); 47 | if (SmsRetriever.SMS_RETRIEVED_ACTION.equals(o)) { 48 | Bundle extras = intent.getExtras(); 49 | if (extras == null) { 50 | return; 51 | } 52 | Status status = (Status) extras.get(SmsRetriever.EXTRA_STATUS); 53 | 54 | if (status == null) { 55 | return; 56 | } 57 | 58 | switch (status.getStatusCode()) { 59 | case CommonStatusCodes.SUCCESS: 60 | // Get SMS message contents 61 | String message = (String) extras.get(SmsRetriever.EXTRA_SMS_MESSAGE); 62 | receiveMessage(message); 63 | if (message != null) { 64 | Log.d("SMS", "" + message); 65 | } 66 | break; 67 | case CommonStatusCodes.TIMEOUT: 68 | Log.d("SMS", "Timeout error"); 69 | mContext 70 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) 71 | .emit(EVENT, "Timeout Error."); 72 | break; 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /android/src/main/java/com/faizal/OtpVerify/OtpVerifyModule.java: -------------------------------------------------------------------------------- 1 | package com.faizal.OtpVerify; 2 | 3 | import androidx.annotation.NonNull; 4 | import android.annotation.SuppressLint; 5 | import android.app.Activity; 6 | import android.content.BroadcastReceiver; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.content.IntentFilter; 10 | import android.os.Build; 11 | import android.util.Log; 12 | import com.facebook.react.bridge.Arguments; 13 | import com.facebook.react.bridge.LifecycleEventListener; 14 | 15 | import com.facebook.react.bridge.ActivityEventListener; 16 | import com.facebook.react.bridge.WritableArray; 17 | import com.google.android.gms.auth.api.Auth; 18 | import com.google.android.gms.auth.api.identity.GetPhoneNumberHintIntentRequest; 19 | import com.google.android.gms.auth.api.identity.Identity; 20 | import com.google.android.gms.auth.api.phone.SmsRetriever; 21 | import com.google.android.gms.auth.api.phone.SmsRetrieverClient; 22 | import com.google.android.gms.common.api.ApiException; 23 | import com.google.android.gms.common.api.GoogleApiClient; 24 | import com.google.android.gms.tasks.OnCanceledListener; 25 | import com.google.android.gms.tasks.OnCompleteListener; 26 | import com.google.android.gms.tasks.OnFailureListener; 27 | import com.google.android.gms.tasks.OnSuccessListener; 28 | import com.google.android.gms.tasks.Task; 29 | 30 | import java.util.ArrayList; 31 | 32 | import com.facebook.react.bridge.Promise; 33 | import com.facebook.react.bridge.ReactApplicationContext; 34 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 35 | import com.facebook.react.bridge.ReactMethod; 36 | import com.facebook.react.module.annotations.ReactModule; 37 | 38 | @ReactModule(name = OtpVerifyModule.NAME) 39 | public class OtpVerifyModule extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener { 40 | public static final String NAME = "OtpVerify"; 41 | private static final String TAG = OtpVerifyModule.class.getSimpleName(); 42 | private static final int RESOLVE_HINT = 10001; 43 | private GoogleApiClient apiClient; 44 | private Promise requestHintCallback; 45 | private final ReactApplicationContext reactContext; 46 | private BroadcastReceiver mReceiver; 47 | private boolean isReceiverRegistered = false; 48 | 49 | public OtpVerifyModule(ReactApplicationContext reactContext) { 50 | super(reactContext); 51 | this.reactContext = reactContext; 52 | mReceiver = new OtpBroadcastReceiver(reactContext); 53 | getReactApplicationContext().addLifecycleEventListener(this); 54 | registerReceiverIfNecessary(mReceiver); 55 | reactContext.addActivityEventListener(this); 56 | apiClient = new GoogleApiClient.Builder(reactContext) 57 | .addApi(Auth.GOOGLE_SIGN_IN_API) 58 | .build(); 59 | } 60 | 61 | @Override 62 | @NonNull 63 | public String getName() { 64 | return NAME; 65 | } 66 | 67 | @ReactMethod 68 | public void requestHint(Promise promise) { 69 | Activity currentActivity = getCurrentActivity(); 70 | requestHintCallback = promise; 71 | 72 | 73 | if (currentActivity == null) { 74 | requestHintCallback.reject("No Activity Found", "Current Activity Null."); 75 | return; 76 | } 77 | try { 78 | GetPhoneNumberHintIntentRequest request = GetPhoneNumberHintIntentRequest.builder().build(); 79 | Identity.getSignInClient(currentActivity) 80 | .getPhoneNumberHintIntent(request) 81 | .addOnSuccessListener( result -> { 82 | try { 83 | // phoneNumberHintIntentResultLauncher.launch(result.getIntentSender()); 84 | currentActivity.startIntentSenderForResult(result.getIntentSender(), RESOLVE_HINT, null, 0, 0, 0); 85 | } catch(Exception e) { 86 | Log.e(TAG, "Launching the PendingIntent failed", e); 87 | } 88 | }) 89 | .addOnFailureListener(e -> { 90 | Log.e(TAG, "Phone Number Hint failed", e); 91 | }); 92 | 93 | } catch (Exception e) { 94 | requestHintCallback.reject(e); 95 | } 96 | } 97 | 98 | @ReactMethod 99 | public void getOtp(Promise promise) { 100 | requestOtp(promise); 101 | } 102 | 103 | @ReactMethod 104 | public void getHash(Promise promise) { 105 | try { 106 | AppSignatureHelper helper = new AppSignatureHelper(reactContext); 107 | ArrayList signatures = helper.getAppSignatures(); 108 | WritableArray arr = Arguments.createArray(); 109 | for (String s : signatures) { 110 | arr.pushString(s); 111 | } 112 | promise.resolve(arr); 113 | } catch (Exception e) { 114 | promise.reject(e); 115 | } 116 | } 117 | 118 | 119 | @SuppressLint("UnspecifiedRegisterReceiverFlag") 120 | private void registerReceiverIfNecessary(BroadcastReceiver receiver) { 121 | if (getCurrentActivity() == null) return; 122 | try { 123 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { 124 | getCurrentActivity().registerReceiver( 125 | receiver, 126 | new IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION), 127 | SmsRetriever.SEND_PERMISSION, 128 | null, 129 | Context.RECEIVER_EXPORTED 130 | ); 131 | } 132 | else { 133 | getCurrentActivity().registerReceiver( 134 | receiver, 135 | new IntentFilter(SmsRetriever.SMS_RETRIEVED_ACTION) 136 | ); 137 | } 138 | Log.d(TAG, "Receiver Registered"); 139 | isReceiverRegistered = true; 140 | } catch (Exception e) { 141 | e.printStackTrace(); 142 | } 143 | } 144 | 145 | private void requestOtp(final Promise promise) { 146 | SmsRetrieverClient client = SmsRetriever.getClient(reactContext); 147 | Task task = client.startSmsRetriever(); 148 | task.addOnCanceledListener(new OnCanceledListener() { 149 | @Override 150 | public void onCanceled() { 151 | Log.e(TAG, "sms listener cancelled"); 152 | } 153 | }); 154 | task.addOnCompleteListener(new OnCompleteListener() { 155 | @Override 156 | public void onComplete(@NonNull Task task) { 157 | Log.e(TAG, "sms listener complete"); 158 | } 159 | }); 160 | task.addOnSuccessListener(new OnSuccessListener() { 161 | @Override 162 | public void onSuccess(Void aVoid) { 163 | Log.e(TAG, "started sms listener"); 164 | promise.resolve(true); 165 | } 166 | }); 167 | 168 | task.addOnFailureListener(new OnFailureListener() { 169 | @Override 170 | public void onFailure(@NonNull Exception e) { 171 | Log.e(TAG, "Could not start sms listener", e); 172 | promise.reject(e); 173 | } 174 | }); 175 | } 176 | 177 | private void unregisterReceiver(BroadcastReceiver receiver) { 178 | if (isReceiverRegistered && getCurrentActivity() != null && receiver != null) { 179 | try { 180 | getCurrentActivity().unregisterReceiver(receiver); 181 | Log.d(TAG, "Receiver UnRegistered"); 182 | isReceiverRegistered = false; 183 | } catch (Exception e) { 184 | e.printStackTrace(); 185 | } 186 | } 187 | } 188 | @Override 189 | public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { 190 | if (requestCode == RESOLVE_HINT) { 191 | if (resultCode == Activity.RESULT_OK) { 192 | String phoneNumber = null; 193 | try { 194 | phoneNumber = Identity.getSignInClient(activity).getPhoneNumberFromIntent(data); 195 | requestHintCallback.resolve(phoneNumber); 196 | } catch (ApiException e) { 197 | requestHintCallback.reject(e.getMessage()); 198 | } catch (NullPointerException e) { 199 | requestHintCallback.reject(e.getMessage()); 200 | } 201 | } 202 | } 203 | } 204 | 205 | @Override 206 | public void onNewIntent(Intent intent) { 207 | 208 | } 209 | 210 | @Override 211 | public void onHostResume() { 212 | registerReceiverIfNecessary(mReceiver); 213 | } 214 | 215 | @Override 216 | public void onHostPause() { 217 | unregisterReceiver(mReceiver); 218 | } 219 | 220 | @Override 221 | public void onHostDestroy() { 222 | unregisterReceiver(mReceiver); 223 | } 224 | 225 | @ReactMethod 226 | public void addListener(String eventName) { 227 | // Keep: Required for RN built in Event Emitter Calls. 228 | } 229 | 230 | @ReactMethod 231 | public void removeListeners(Integer count) { 232 | // Keep: Required for RN built in Event Emitter Calls. 233 | } 234 | } 235 | -------------------------------------------------------------------------------- /android/src/main/java/com/faizal/OtpVerify/OtpVerifyPackage.java: -------------------------------------------------------------------------------- 1 | package com.faizal.OtpVerify; 2 | 3 | import androidx.annotation.NonNull; 4 | 5 | import com.facebook.react.ReactPackage; 6 | import com.facebook.react.bridge.NativeModule; 7 | import com.facebook.react.bridge.ReactApplicationContext; 8 | import com.facebook.react.uimanager.ViewManager; 9 | 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | public class OtpVerifyPackage implements ReactPackage { 15 | @NonNull 16 | @Override 17 | public List createNativeModules(@NonNull ReactApplicationContext reactContext) { 18 | List modules = new ArrayList<>(); 19 | modules.add(new OtpVerifyModule(reactContext)); 20 | return modules; 21 | } 22 | 23 | @NonNull 24 | @Override 25 | public List createViewManagers(@NonNull ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | interface OtpVerify { 2 | getOtp: () => Promise; 3 | getHash: () => Promise; 4 | addListener: (handler: (value: string) => any) => import("react-native").EmitterSubscription; 5 | removeListener: () => void; 6 | } 7 | declare const OtpVerify: OtpVerify; 8 | export default OtpVerify; 9 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var react_native_1 = require("react-native"); 4 | var RNOtpVerify = react_native_1.NativeModules.RNOtpVerify; 5 | var OtpVerify = { 6 | getOtp: RNOtpVerify === null || RNOtpVerify === void 0 ? void 0 : RNOtpVerify.getOtp, 7 | getHash: RNOtpVerify === null || RNOtpVerify === void 0 ? void 0 : RNOtpVerify.getHash, 8 | addListener: function (handler) { 9 | return react_native_1.DeviceEventEmitter 10 | .addListener('com.faizalshap.otpVerify:otpReceived', handler); 11 | }, 12 | removeListener: function () { return react_native_1.DeviceEventEmitter.removeAllListeners('com.faizalshap.otpVerify:otpReceived'); }, 13 | }; 14 | exports.default = OtpVerify; 15 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 22 | * bundleCommand: "ram-bundle", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for OtpVerifyExample: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for OtpVerifyExample, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | enableHermes: false, // clean and rebuild if changing 80 | entryFile: "index.tsx", 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | /** 86 | * Set this to true to create two separate APKs instead of one: 87 | * - An APK that only works on ARM devices 88 | * - An APK that only works on x86 devices 89 | * The advantage is the size of the APK is reduced by about 4MB. 90 | * Upload all the APKs to the Play Store and people will download 91 | * the correct one based on the CPU architecture of their device. 92 | */ 93 | def enableSeparateBuildPerCPUArchitecture = false 94 | 95 | /** 96 | * Run Proguard to shrink the Java bytecode in release builds. 97 | */ 98 | def enableProguardInReleaseBuilds = false 99 | 100 | /** 101 | * The preferred build flavor of JavaScriptCore. 102 | * 103 | * For OtpVerifyExample, to use the international variant, you can use: 104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 105 | * 106 | * The international variant includes ICU i18n library and necessary data 107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 108 | * give correct results when using with locales other than en-US. Note that 109 | * this variant is about 6MiB larger per architecture than default. 110 | */ 111 | def jscFlavor = 'org.webkit:android-jsc:+' 112 | 113 | /** 114 | * Whether to enable the Hermes VM. 115 | * 116 | * This should be set on project.ext.react and mirrored here. If it is not set 117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 118 | * and the benefits of using Hermes will therefore be sharply reduced. 119 | */ 120 | def enableHermes = project.ext.react.get("enableHermes", false); 121 | 122 | android { 123 | compileSdkVersion rootProject.ext.compileSdkVersion 124 | 125 | compileOptions { 126 | sourceCompatibility JavaVersion.VERSION_1_8 127 | targetCompatibility JavaVersion.VERSION_1_8 128 | } 129 | 130 | defaultConfig { 131 | applicationId "com.example.reactnativeotpverify" 132 | minSdkVersion rootProject.ext.minSdkVersion 133 | targetSdkVersion rootProject.ext.targetSdkVersion 134 | versionCode 1 135 | versionName "1.0" 136 | } 137 | splits { 138 | abi { 139 | reset() 140 | enable enableSeparateBuildPerCPUArchitecture 141 | universalApk false // If true, also generate a universal APK 142 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 143 | } 144 | } 145 | signingConfigs { 146 | debug { 147 | storeFile file('debug.keystore') 148 | storePassword 'android' 149 | keyAlias 'androiddebugkey' 150 | keyPassword 'android' 151 | } 152 | } 153 | buildTypes { 154 | debug { 155 | signingConfig signingConfigs.debug 156 | } 157 | release { 158 | // Caution! In production, you need to generate your own keystore file. 159 | // see https://reactnative.dev/docs/signed-apk-android. 160 | signingConfig signingConfigs.debug 161 | minifyEnabled enableProguardInReleaseBuilds 162 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 163 | } 164 | } 165 | // applicationVariants are e.g. debug, release 166 | applicationVariants.all { variant -> 167 | variant.outputs.each { output -> 168 | // For each separate APK per architecture, set a unique version code as described here: 169 | // https://developer.android.com/studio/build/configure-apk-splits.html 170 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 171 | def abi = output.getFilter(OutputFile.ABI) 172 | if (abi != null) { // null for the universal-debug, universal-release variants 173 | output.versionCodeOverride = 174 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 175 | } 176 | 177 | } 178 | } 179 | } 180 | 181 | dependencies { 182 | implementation fileTree(dir: "libs", include: ["*.jar"]) 183 | //noinspection GradleDynamicVersion 184 | implementation "com.facebook.react:react-native:+" // From node_modules 185 | 186 | 187 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 188 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 189 | exclude group:'com.facebook.fbjni' 190 | } 191 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 192 | exclude group:'com.facebook.flipper' 193 | exclude group:'com.squareup.okhttp3', module:'okhttp' 194 | } 195 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 196 | exclude group:'com.facebook.flipper' 197 | } 198 | 199 | if (enableHermes) { 200 | def hermesPath = "../../node_modules/hermes-engine/android/"; 201 | debugImplementation files(hermesPath + "hermes-debug.aar") 202 | releaseImplementation files(hermesPath + "hermes-release.aar") 203 | } else { 204 | implementation jscFlavor 205 | } 206 | 207 | implementation project(':reactnativeotpverify') 208 | } 209 | 210 | // Run this once to be able to run the application with BUCK 211 | // puts all compile dependencies into folder libs for BUCK to use 212 | task copyDownloadableDepsToLibs(type: Copy) { 213 | from configurations.compile 214 | into 'libs' 215 | } 216 | 217 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 218 | -------------------------------------------------------------------------------- /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/example/reactnativeotpverify/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.example.reactnativeotpverify; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 32 | client.addPlugin(new ReactFlipperPlugin()); 33 | client.addPlugin(new DatabasesFlipperPlugin(context)); 34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 35 | client.addPlugin(CrashReporterPlugin.getInstance()); 36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 37 | NetworkingModule.setCustomClientBuilder( 38 | new NetworkingModule.CustomClientBuilder() { 39 | @Override 40 | public void apply(OkHttpClient.Builder builder) { 41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 42 | } 43 | }); 44 | client.addPlugin(networkFlipperPlugin); 45 | client.start(); 46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 47 | // Hence we run if after all native modules have been initialized 48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 49 | if (reactContext == null) { 50 | reactInstanceManager.addReactInstanceEventListener( 51 | new ReactInstanceManager.ReactInstanceEventListener() { 52 | @Override 53 | public void onReactContextInitialized(ReactContext reactContext) { 54 | reactInstanceManager.removeReactInstanceEventListener(this); 55 | reactContext.runOnNativeModulesQueueThread( 56 | new Runnable() { 57 | @Override 58 | public void run() { 59 | client.addPlugin(new FrescoFlipperPlugin()); 60 | } 61 | }); 62 | } 63 | }); 64 | } else { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /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/example/reactnativeotpverify/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.reactnativeotpverify; 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 "OtpVerifyExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/reactnativeotpverify/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.reactnativeotpverify; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.ReactInstanceManager; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | import com.faizal.OtpVerify.OtpVerifyPackage; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = 18 | new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | @SuppressWarnings("UnnecessaryLocalVariable") 27 | List packages = new PackageList(this).getPackages(); 28 | // Packages that cannot be autolinked yet can be added manually here, for OtpVerifyExample: 29 | // packages.add(new MyReactNativePackage()); 30 | packages.add(new OtpVerifyPackage()); 31 | return packages; 32 | } 33 | 34 | @Override 35 | protected String getJSMainModuleName() { 36 | return "index"; 37 | } 38 | }; 39 | 40 | @Override 41 | public ReactNativeHost getReactNativeHost() { 42 | return mReactNativeHost; 43 | } 44 | 45 | @Override 46 | public void onCreate() { 47 | super.onCreate(); 48 | SoLoader.init(this, /* native exopackage */ false); 49 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); // Remove this line if you don't want Flipper enabled 50 | } 51 | 52 | /** 53 | * Loads Flipper in React Native templates. 54 | * 55 | * @param context 56 | */ 57 | private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 58 | if (BuildConfig.DEBUG) { 59 | try { 60 | /* 61 | We use reflection here to pick up the class that initializes Flipper, 62 | since Flipper library is not available in release mode 63 | */ 64 | Class aClass = Class.forName("com.example.reactnativeotpverify.ReactNativeFlipper"); 65 | aClass 66 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 67 | .invoke(null, context, reactInstanceManager); 68 | } catch (ClassNotFoundException e) { 69 | e.printStackTrace(); 70 | } catch (NoSuchMethodException e) { 71 | e.printStackTrace(); 72 | } catch (IllegalAccessException e) { 73 | e.printStackTrace(); 74 | } catch (InvocationTargetException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | OtpVerify Example 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 | minSdkVersion = 16 6 | compileSdkVersion = 29 7 | targetSdkVersion = 29 8 | } 9 | repositories { 10 | google() 11 | mavenCentral() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.5.3") 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 | mavenCentral() 36 | jcenter() 37 | maven { url 'https://www.jitpack.io' } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=true 22 | FLIPPER_VERSION=0.54.0 23 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/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.2-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=`expr $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 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /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 http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'OtpVerifyExample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | 5 | include ':reactnativeotpverify' 6 | project(':reactnativeotpverify').projectDir = new File(rootProject.projectDir, '../../android') 7 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "OtpVerifyExample", 3 | "displayName": "OtpVerify Example" 4 | } 5 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | presets: ['module:metro-react-native-babel-preset'], 6 | plugins: [ 7 | [ 8 | 'module-resolver', 9 | { 10 | extensions: ['.tsx', '.ts', '.js', '.json'], 11 | alias: { 12 | [pak.name]: path.join(__dirname, '..', pak.source), 13 | }, 14 | }, 15 | ], 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /example/index.tsx: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './src/App'; 3 | import { name as appName } from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /example/ios/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // OtpVerifyExample 4 | // 5 | 6 | import Foundation 7 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample-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 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* OtpVerifyExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* OtpVerifyExampleTests.m */; }; 11 | 09EB680D46FE12310629C227 /* libPods-OtpVerifyExample-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B56BA239C969F702C63633C7 /* libPods-OtpVerifyExample-tvOS.a */; }; 12 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 13 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 14 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 15 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 16 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 17 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 18 | 2DCD954D1E0B4F2C00145EB5 /* OtpVerifyExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* OtpVerifyExampleTests.m */; }; 19 | 3DDF5FAE064BC4BFAB015043 /* libPods-OtpVerifyExample-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F6A20A3A2D31400635C17C3 /* libPods-OtpVerifyExample-tvOSTests.a */; }; 20 | 4C39C56BAD484C67AA576FFA /* libPods-OtpVerifyExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3E69C5B9553B26FBA2DF04 /* libPods-OtpVerifyExample.a */; }; 21 | 69AF7E46C79455F135C08478 /* libPods-OtpVerifyExample-OtpVerifyExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7533C965B72700ED5E109803 /* libPods-OtpVerifyExample-OtpVerifyExampleTests.a */; }; 22 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 31 | remoteInfo = OtpVerifyExample; 32 | }; 33 | 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; 38 | remoteInfo = "OtpVerifyExample-tvOS"; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 44 | 00E356EE1AD99517003FC87E /* OtpVerifyExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OtpVerifyExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 00E356F21AD99517003FC87E /* OtpVerifyExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OtpVerifyExampleTests.m; sourceTree = ""; }; 47 | 1172626FD82B50406EC37522 /* Pods-OtpVerifyExample-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample-tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample-tvOSTests/Pods-OtpVerifyExample-tvOSTests.release.xcconfig"; sourceTree = ""; }; 48 | 13B07F961A680F5B00A75B9A /* OtpVerifyExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OtpVerifyExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = OtpVerifyExample/AppDelegate.h; sourceTree = ""; }; 50 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = OtpVerifyExample/AppDelegate.m; sourceTree = ""; }; 51 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = OtpVerifyExample/Images.xcassets; sourceTree = ""; }; 52 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = OtpVerifyExample/Info.plist; sourceTree = ""; }; 53 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = OtpVerifyExample/main.m; sourceTree = ""; }; 54 | 20AB94514737C20DFC4350AE /* Pods-OtpVerifyExample-OtpVerifyExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample-OtpVerifyExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample-OtpVerifyExampleTests/Pods-OtpVerifyExample-OtpVerifyExampleTests.debug.xcconfig"; sourceTree = ""; }; 55 | 2D02E47B1E0B4A5D006451C7 /* OtpVerifyExample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "OtpVerifyExample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 2D02E4901E0B4A5D006451C7 /* OtpVerifyExample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "OtpVerifyExample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 47F7ED3B7971BE374F7B8635 /* Pods-OtpVerifyExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample.debug.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample/Pods-OtpVerifyExample.debug.xcconfig"; sourceTree = ""; }; 58 | 6F6A20A3A2D31400635C17C3 /* libPods-OtpVerifyExample-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OtpVerifyExample-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 7533C965B72700ED5E109803 /* libPods-OtpVerifyExample-OtpVerifyExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OtpVerifyExample-OtpVerifyExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = OtpVerifyExample/LaunchScreen.storyboard; sourceTree = ""; }; 61 | AE69546072F7DC475F196F4C /* Pods-OtpVerifyExample-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample-tvOS/Pods-OtpVerifyExample-tvOS.debug.xcconfig"; sourceTree = ""; }; 62 | B56BA239C969F702C63633C7 /* libPods-OtpVerifyExample-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OtpVerifyExample-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 63 | CA3E69C5B9553B26FBA2DF04 /* libPods-OtpVerifyExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OtpVerifyExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | E00ACF0FDA8BF921659E2F9A /* Pods-OtpVerifyExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample.release.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample/Pods-OtpVerifyExample.release.xcconfig"; sourceTree = ""; }; 65 | E88D904CC5F3CC947B01AB46 /* Pods-OtpVerifyExample-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample-tvOS.release.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample-tvOS/Pods-OtpVerifyExample-tvOS.release.xcconfig"; sourceTree = ""; }; 66 | EC1294380F6AD2F72CA45BA5 /* Pods-OtpVerifyExample-OtpVerifyExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample-OtpVerifyExampleTests.release.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample-OtpVerifyExampleTests/Pods-OtpVerifyExample-OtpVerifyExampleTests.release.xcconfig"; sourceTree = ""; }; 67 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 68 | 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; }; 69 | FFD6887008BEF5F1A6973F45 /* Pods-OtpVerifyExample-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OtpVerifyExample-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-OtpVerifyExample-tvOSTests/Pods-OtpVerifyExample-tvOSTests.debug.xcconfig"; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | 69AF7E46C79455F135C08478 /* libPods-OtpVerifyExample-OtpVerifyExampleTests.a in Frameworks */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | 4C39C56BAD484C67AA576FFA /* libPods-OtpVerifyExample.a in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | 09EB680D46FE12310629C227 /* libPods-OtpVerifyExample-tvOS.a in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { 98 | isa = PBXFrameworksBuildPhase; 99 | buildActionMask = 2147483647; 100 | files = ( 101 | 3DDF5FAE064BC4BFAB015043 /* libPods-OtpVerifyExample-tvOSTests.a in Frameworks */, 102 | ); 103 | runOnlyForDeploymentPostprocessing = 0; 104 | }; 105 | /* End PBXFrameworksBuildPhase section */ 106 | 107 | /* Begin PBXGroup section */ 108 | 00E356EF1AD99517003FC87E /* OtpVerifyExampleTests */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 00E356F21AD99517003FC87E /* OtpVerifyExampleTests.m */, 112 | 00E356F01AD99517003FC87E /* Supporting Files */, 113 | ); 114 | path = OtpVerifyExampleTests; 115 | sourceTree = ""; 116 | }; 117 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 00E356F11AD99517003FC87E /* Info.plist */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | 13B07FAE1A68108700A75B9A /* OtpVerifyExample */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 129 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 130 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 131 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 132 | 13B07FB61A68108700A75B9A /* Info.plist */, 133 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 134 | 13B07FB71A68108700A75B9A /* main.m */, 135 | ); 136 | name = OtpVerifyExample; 137 | sourceTree = ""; 138 | }; 139 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 143 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 144 | CA3E69C5B9553B26FBA2DF04 /* libPods-OtpVerifyExample.a */, 145 | 7533C965B72700ED5E109803 /* libPods-OtpVerifyExample-OtpVerifyExampleTests.a */, 146 | B56BA239C969F702C63633C7 /* libPods-OtpVerifyExample-tvOS.a */, 147 | 6F6A20A3A2D31400635C17C3 /* libPods-OtpVerifyExample-tvOSTests.a */, 148 | ); 149 | name = Frameworks; 150 | sourceTree = ""; 151 | }; 152 | 6B9684456A2045ADE5A6E47E /* Pods */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 47F7ED3B7971BE374F7B8635 /* Pods-OtpVerifyExample.debug.xcconfig */, 156 | E00ACF0FDA8BF921659E2F9A /* Pods-OtpVerifyExample.release.xcconfig */, 157 | 20AB94514737C20DFC4350AE /* Pods-OtpVerifyExample-OtpVerifyExampleTests.debug.xcconfig */, 158 | EC1294380F6AD2F72CA45BA5 /* Pods-OtpVerifyExample-OtpVerifyExampleTests.release.xcconfig */, 159 | AE69546072F7DC475F196F4C /* Pods-OtpVerifyExample-tvOS.debug.xcconfig */, 160 | E88D904CC5F3CC947B01AB46 /* Pods-OtpVerifyExample-tvOS.release.xcconfig */, 161 | FFD6887008BEF5F1A6973F45 /* Pods-OtpVerifyExample-tvOSTests.debug.xcconfig */, 162 | 1172626FD82B50406EC37522 /* Pods-OtpVerifyExample-tvOSTests.release.xcconfig */, 163 | ); 164 | name = Pods; 165 | path = Pods; 166 | sourceTree = ""; 167 | }; 168 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | ); 172 | name = Libraries; 173 | sourceTree = ""; 174 | }; 175 | 83CBB9F61A601CBA00E9B192 = { 176 | isa = PBXGroup; 177 | children = ( 178 | 13B07FAE1A68108700A75B9A /* OtpVerifyExample */, 179 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 180 | 00E356EF1AD99517003FC87E /* OtpVerifyExampleTests */, 181 | 83CBBA001A601CBA00E9B192 /* Products */, 182 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 183 | 6B9684456A2045ADE5A6E47E /* Pods */, 184 | ); 185 | indentWidth = 2; 186 | sourceTree = ""; 187 | tabWidth = 2; 188 | usesTabs = 0; 189 | }; 190 | 83CBBA001A601CBA00E9B192 /* Products */ = { 191 | isa = PBXGroup; 192 | children = ( 193 | 13B07F961A680F5B00A75B9A /* OtpVerifyExample.app */, 194 | 00E356EE1AD99517003FC87E /* OtpVerifyExampleTests.xctest */, 195 | 2D02E47B1E0B4A5D006451C7 /* OtpVerifyExample-tvOS.app */, 196 | 2D02E4901E0B4A5D006451C7 /* OtpVerifyExample-tvOSTests.xctest */, 197 | ); 198 | name = Products; 199 | sourceTree = ""; 200 | }; 201 | /* End PBXGroup section */ 202 | 203 | /* Begin PBXNativeTarget section */ 204 | 00E356ED1AD99517003FC87E /* OtpVerifyExampleTests */ = { 205 | isa = PBXNativeTarget; 206 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "OtpVerifyExampleTests" */; 207 | buildPhases = ( 208 | 3BD00D8DB48E257517D6B951 /* [CP] Check Pods Manifest.lock */, 209 | 00E356EA1AD99517003FC87E /* Sources */, 210 | 00E356EB1AD99517003FC87E /* Frameworks */, 211 | 00E356EC1AD99517003FC87E /* Resources */, 212 | 441170A4DAEF877A820C1CEA /* [CP] Copy Pods Resources */, 213 | ); 214 | buildRules = ( 215 | ); 216 | dependencies = ( 217 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 218 | ); 219 | name = OtpVerifyExampleTests; 220 | productName = OtpVerifyExampleTests; 221 | productReference = 00E356EE1AD99517003FC87E /* OtpVerifyExampleTests.xctest */; 222 | productType = "com.apple.product-type.bundle.unit-test"; 223 | }; 224 | 13B07F861A680F5B00A75B9A /* OtpVerifyExample */ = { 225 | isa = PBXNativeTarget; 226 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "OtpVerifyExample" */; 227 | buildPhases = ( 228 | 4F0A6FC082772762E3E4C96C /* [CP] Check Pods Manifest.lock */, 229 | FD10A7F022414F080027D42C /* Start Packager */, 230 | 13B07F871A680F5B00A75B9A /* Sources */, 231 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 232 | 13B07F8E1A680F5B00A75B9A /* Resources */, 233 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 234 | C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */, 235 | ); 236 | buildRules = ( 237 | ); 238 | dependencies = ( 239 | ); 240 | name = OtpVerifyExample; 241 | productName = OtpVerifyExample; 242 | productReference = 13B07F961A680F5B00A75B9A /* OtpVerifyExample.app */; 243 | productType = "com.apple.product-type.application"; 244 | }; 245 | 2D02E47A1E0B4A5D006451C7 /* OtpVerifyExample-tvOS */ = { 246 | isa = PBXNativeTarget; 247 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "OtpVerifyExample-tvOS" */; 248 | buildPhases = ( 249 | 87811D0F8FEC6FC2E70EDF88 /* [CP] Check Pods Manifest.lock */, 250 | FD10A7F122414F3F0027D42C /* Start Packager */, 251 | 2D02E4771E0B4A5D006451C7 /* Sources */, 252 | 2D02E4781E0B4A5D006451C7 /* Frameworks */, 253 | 2D02E4791E0B4A5D006451C7 /* Resources */, 254 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, 255 | ); 256 | buildRules = ( 257 | ); 258 | dependencies = ( 259 | ); 260 | name = "OtpVerifyExample-tvOS"; 261 | productName = "OtpVerifyExample-tvOS"; 262 | productReference = 2D02E47B1E0B4A5D006451C7 /* OtpVerifyExample-tvOS.app */; 263 | productType = "com.apple.product-type.application"; 264 | }; 265 | 2D02E48F1E0B4A5D006451C7 /* OtpVerifyExample-tvOSTests */ = { 266 | isa = PBXNativeTarget; 267 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "OtpVerifyExample-tvOSTests" */; 268 | buildPhases = ( 269 | A1191D9E34FEA625352E7BA9 /* [CP] Check Pods Manifest.lock */, 270 | 2D02E48C1E0B4A5D006451C7 /* Sources */, 271 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */, 272 | 2D02E48E1E0B4A5D006451C7 /* Resources */, 273 | ); 274 | buildRules = ( 275 | ); 276 | dependencies = ( 277 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, 278 | ); 279 | name = "OtpVerifyExample-tvOSTests"; 280 | productName = "OtpVerifyExample-tvOSTests"; 281 | productReference = 2D02E4901E0B4A5D006451C7 /* OtpVerifyExample-tvOSTests.xctest */; 282 | productType = "com.apple.product-type.bundle.unit-test"; 283 | }; 284 | /* End PBXNativeTarget section */ 285 | 286 | /* Begin PBXProject section */ 287 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 288 | isa = PBXProject; 289 | attributes = { 290 | LastUpgradeCheck = 1130; 291 | TargetAttributes = { 292 | 00E356ED1AD99517003FC87E = { 293 | CreatedOnToolsVersion = 6.2; 294 | TestTargetID = 13B07F861A680F5B00A75B9A; 295 | }; 296 | 13B07F861A680F5B00A75B9A = { 297 | LastSwiftMigration = 1120; 298 | }; 299 | 2D02E47A1E0B4A5D006451C7 = { 300 | CreatedOnToolsVersion = 8.2.1; 301 | ProvisioningStyle = Automatic; 302 | }; 303 | 2D02E48F1E0B4A5D006451C7 = { 304 | CreatedOnToolsVersion = 8.2.1; 305 | ProvisioningStyle = Automatic; 306 | TestTargetID = 2D02E47A1E0B4A5D006451C7; 307 | }; 308 | }; 309 | }; 310 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "OtpVerifyExample" */; 311 | compatibilityVersion = "Xcode 3.2"; 312 | developmentRegion = en; 313 | hasScannedForEncodings = 0; 314 | knownRegions = ( 315 | en, 316 | Base, 317 | ); 318 | mainGroup = 83CBB9F61A601CBA00E9B192; 319 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 320 | projectDirPath = ""; 321 | projectRoot = ""; 322 | targets = ( 323 | 13B07F861A680F5B00A75B9A /* OtpVerifyExample */, 324 | 00E356ED1AD99517003FC87E /* OtpVerifyExampleTests */, 325 | 2D02E47A1E0B4A5D006451C7 /* OtpVerifyExample-tvOS */, 326 | 2D02E48F1E0B4A5D006451C7 /* OtpVerifyExample-tvOSTests */, 327 | ); 328 | }; 329 | /* End PBXProject section */ 330 | 331 | /* Begin PBXResourcesBuildPhase section */ 332 | 00E356EC1AD99517003FC87E /* Resources */ = { 333 | isa = PBXResourcesBuildPhase; 334 | buildActionMask = 2147483647; 335 | files = ( 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | }; 339 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 340 | isa = PBXResourcesBuildPhase; 341 | buildActionMask = 2147483647; 342 | files = ( 343 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 344 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 345 | ); 346 | runOnlyForDeploymentPostprocessing = 0; 347 | }; 348 | 2D02E4791E0B4A5D006451C7 /* Resources */ = { 349 | isa = PBXResourcesBuildPhase; 350 | buildActionMask = 2147483647; 351 | files = ( 352 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, 353 | ); 354 | runOnlyForDeploymentPostprocessing = 0; 355 | }; 356 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = { 357 | isa = PBXResourcesBuildPhase; 358 | buildActionMask = 2147483647; 359 | files = ( 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | /* End PBXResourcesBuildPhase section */ 364 | 365 | /* Begin PBXShellScriptBuildPhase section */ 366 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 367 | isa = PBXShellScriptBuildPhase; 368 | buildActionMask = 2147483647; 369 | files = ( 370 | ); 371 | inputPaths = ( 372 | ); 373 | name = "Bundle React Native code and images"; 374 | outputPaths = ( 375 | ); 376 | runOnlyForDeploymentPostprocessing = 0; 377 | shellPath = /bin/sh; 378 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 379 | }; 380 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { 381 | isa = PBXShellScriptBuildPhase; 382 | buildActionMask = 2147483647; 383 | files = ( 384 | ); 385 | inputPaths = ( 386 | ); 387 | name = "Bundle React Native Code And Images"; 388 | outputPaths = ( 389 | ); 390 | runOnlyForDeploymentPostprocessing = 0; 391 | shellPath = /bin/sh; 392 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 393 | }; 394 | 3BD00D8DB48E257517D6B951 /* [CP] Check Pods Manifest.lock */ = { 395 | isa = PBXShellScriptBuildPhase; 396 | buildActionMask = 2147483647; 397 | files = ( 398 | ); 399 | inputFileListPaths = ( 400 | ); 401 | inputPaths = ( 402 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 403 | "${PODS_ROOT}/Manifest.lock", 404 | ); 405 | name = "[CP] Check Pods Manifest.lock"; 406 | outputFileListPaths = ( 407 | ); 408 | outputPaths = ( 409 | "$(DERIVED_FILE_DIR)/Pods-OtpVerifyExample-OtpVerifyExampleTests-checkManifestLockResult.txt", 410 | ); 411 | runOnlyForDeploymentPostprocessing = 0; 412 | shellPath = /bin/sh; 413 | 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"; 414 | showEnvVarsInLog = 0; 415 | }; 416 | 441170A4DAEF877A820C1CEA /* [CP] Copy Pods Resources */ = { 417 | isa = PBXShellScriptBuildPhase; 418 | buildActionMask = 2147483647; 419 | files = ( 420 | ); 421 | inputPaths = ( 422 | "${PODS_ROOT}/Target Support Files/Pods-OtpVerifyExample-OtpVerifyExampleTests/Pods-OtpVerifyExample-OtpVerifyExampleTests-resources.sh", 423 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 424 | ); 425 | name = "[CP] Copy Pods Resources"; 426 | outputPaths = ( 427 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 428 | ); 429 | runOnlyForDeploymentPostprocessing = 0; 430 | shellPath = /bin/sh; 431 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OtpVerifyExample-OtpVerifyExampleTests/Pods-OtpVerifyExample-OtpVerifyExampleTests-resources.sh\"\n"; 432 | showEnvVarsInLog = 0; 433 | }; 434 | 4F0A6FC082772762E3E4C96C /* [CP] Check Pods Manifest.lock */ = { 435 | isa = PBXShellScriptBuildPhase; 436 | buildActionMask = 2147483647; 437 | files = ( 438 | ); 439 | inputFileListPaths = ( 440 | ); 441 | inputPaths = ( 442 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 443 | "${PODS_ROOT}/Manifest.lock", 444 | ); 445 | name = "[CP] Check Pods Manifest.lock"; 446 | outputFileListPaths = ( 447 | ); 448 | outputPaths = ( 449 | "$(DERIVED_FILE_DIR)/Pods-OtpVerifyExample-checkManifestLockResult.txt", 450 | ); 451 | runOnlyForDeploymentPostprocessing = 0; 452 | shellPath = /bin/sh; 453 | 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"; 454 | showEnvVarsInLog = 0; 455 | }; 456 | 87811D0F8FEC6FC2E70EDF88 /* [CP] Check Pods Manifest.lock */ = { 457 | isa = PBXShellScriptBuildPhase; 458 | buildActionMask = 2147483647; 459 | files = ( 460 | ); 461 | inputFileListPaths = ( 462 | ); 463 | inputPaths = ( 464 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 465 | "${PODS_ROOT}/Manifest.lock", 466 | ); 467 | name = "[CP] Check Pods Manifest.lock"; 468 | outputFileListPaths = ( 469 | ); 470 | outputPaths = ( 471 | "$(DERIVED_FILE_DIR)/Pods-OtpVerifyExample-tvOS-checkManifestLockResult.txt", 472 | ); 473 | runOnlyForDeploymentPostprocessing = 0; 474 | shellPath = /bin/sh; 475 | 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"; 476 | showEnvVarsInLog = 0; 477 | }; 478 | A1191D9E34FEA625352E7BA9 /* [CP] Check Pods Manifest.lock */ = { 479 | isa = PBXShellScriptBuildPhase; 480 | buildActionMask = 2147483647; 481 | files = ( 482 | ); 483 | inputFileListPaths = ( 484 | ); 485 | inputPaths = ( 486 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 487 | "${PODS_ROOT}/Manifest.lock", 488 | ); 489 | name = "[CP] Check Pods Manifest.lock"; 490 | outputFileListPaths = ( 491 | ); 492 | outputPaths = ( 493 | "$(DERIVED_FILE_DIR)/Pods-OtpVerifyExample-tvOSTests-checkManifestLockResult.txt", 494 | ); 495 | runOnlyForDeploymentPostprocessing = 0; 496 | shellPath = /bin/sh; 497 | 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"; 498 | showEnvVarsInLog = 0; 499 | }; 500 | C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */ = { 501 | isa = PBXShellScriptBuildPhase; 502 | buildActionMask = 2147483647; 503 | files = ( 504 | ); 505 | inputPaths = ( 506 | "${PODS_ROOT}/Target Support Files/Pods-OtpVerifyExample/Pods-OtpVerifyExample-resources.sh", 507 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 508 | ); 509 | name = "[CP] Copy Pods Resources"; 510 | outputPaths = ( 511 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 512 | ); 513 | runOnlyForDeploymentPostprocessing = 0; 514 | shellPath = /bin/sh; 515 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-OtpVerifyExample/Pods-OtpVerifyExample-resources.sh\"\n"; 516 | showEnvVarsInLog = 0; 517 | }; 518 | FD10A7F022414F080027D42C /* Start Packager */ = { 519 | isa = PBXShellScriptBuildPhase; 520 | buildActionMask = 2147483647; 521 | files = ( 522 | ); 523 | inputFileListPaths = ( 524 | ); 525 | inputPaths = ( 526 | ); 527 | name = "Start Packager"; 528 | outputFileListPaths = ( 529 | ); 530 | outputPaths = ( 531 | ); 532 | runOnlyForDeploymentPostprocessing = 0; 533 | shellPath = /bin/sh; 534 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 535 | showEnvVarsInLog = 0; 536 | }; 537 | FD10A7F122414F3F0027D42C /* Start Packager */ = { 538 | isa = PBXShellScriptBuildPhase; 539 | buildActionMask = 2147483647; 540 | files = ( 541 | ); 542 | inputFileListPaths = ( 543 | ); 544 | inputPaths = ( 545 | ); 546 | name = "Start Packager"; 547 | outputFileListPaths = ( 548 | ); 549 | outputPaths = ( 550 | ); 551 | runOnlyForDeploymentPostprocessing = 0; 552 | shellPath = /bin/sh; 553 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 554 | showEnvVarsInLog = 0; 555 | }; 556 | /* End PBXShellScriptBuildPhase section */ 557 | 558 | /* Begin PBXSourcesBuildPhase section */ 559 | 00E356EA1AD99517003FC87E /* Sources */ = { 560 | isa = PBXSourcesBuildPhase; 561 | buildActionMask = 2147483647; 562 | files = ( 563 | 00E356F31AD99517003FC87E /* OtpVerifyExampleTests.m in Sources */, 564 | ); 565 | runOnlyForDeploymentPostprocessing = 0; 566 | }; 567 | 13B07F871A680F5B00A75B9A /* Sources */ = { 568 | isa = PBXSourcesBuildPhase; 569 | buildActionMask = 2147483647; 570 | files = ( 571 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 572 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 573 | ); 574 | runOnlyForDeploymentPostprocessing = 0; 575 | }; 576 | 2D02E4771E0B4A5D006451C7 /* Sources */ = { 577 | isa = PBXSourcesBuildPhase; 578 | buildActionMask = 2147483647; 579 | files = ( 580 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 581 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, 582 | ); 583 | runOnlyForDeploymentPostprocessing = 0; 584 | }; 585 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = { 586 | isa = PBXSourcesBuildPhase; 587 | buildActionMask = 2147483647; 588 | files = ( 589 | 2DCD954D1E0B4F2C00145EB5 /* OtpVerifyExampleTests.m in Sources */, 590 | ); 591 | runOnlyForDeploymentPostprocessing = 0; 592 | }; 593 | /* End PBXSourcesBuildPhase section */ 594 | 595 | /* Begin PBXTargetDependency section */ 596 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 597 | isa = PBXTargetDependency; 598 | target = 13B07F861A680F5B00A75B9A /* OtpVerifyExample */; 599 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 600 | }; 601 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { 602 | isa = PBXTargetDependency; 603 | target = 2D02E47A1E0B4A5D006451C7 /* OtpVerifyExample-tvOS */; 604 | targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; 605 | }; 606 | /* End PBXTargetDependency section */ 607 | 608 | /* Begin XCBuildConfiguration section */ 609 | 00E356F61AD99517003FC87E /* Debug */ = { 610 | isa = XCBuildConfiguration; 611 | baseConfigurationReference = 20AB94514737C20DFC4350AE /* Pods-OtpVerifyExample-OtpVerifyExampleTests.debug.xcconfig */; 612 | buildSettings = { 613 | BUNDLE_LOADER = "$(TEST_HOST)"; 614 | GCC_PREPROCESSOR_DEFINITIONS = ( 615 | "DEBUG=1", 616 | "$(inherited)", 617 | ); 618 | INFOPLIST_FILE = OtpVerifyExampleTests/Info.plist; 619 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 620 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 621 | OTHER_LDFLAGS = ( 622 | "-ObjC", 623 | "-lc++", 624 | "$(inherited)", 625 | ); 626 | PRODUCT_BUNDLE_IDENTIFIER = "com.example.reactnativeotpverify"; 627 | PRODUCT_NAME = "$(TARGET_NAME)"; 628 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OtpVerifyExample.app/OtpVerifyExample"; 629 | }; 630 | name = Debug; 631 | }; 632 | 00E356F71AD99517003FC87E /* Release */ = { 633 | isa = XCBuildConfiguration; 634 | baseConfigurationReference = EC1294380F6AD2F72CA45BA5 /* Pods-OtpVerifyExample-OtpVerifyExampleTests.release.xcconfig */; 635 | buildSettings = { 636 | BUNDLE_LOADER = "$(TEST_HOST)"; 637 | COPY_PHASE_STRIP = NO; 638 | INFOPLIST_FILE = OtpVerifyExampleTests/Info.plist; 639 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 640 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 641 | OTHER_LDFLAGS = ( 642 | "-ObjC", 643 | "-lc++", 644 | "$(inherited)", 645 | ); 646 | PRODUCT_BUNDLE_IDENTIFIER = "com.example.reactnativeotpverify"; 647 | PRODUCT_NAME = "$(TARGET_NAME)"; 648 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OtpVerifyExample.app/OtpVerifyExample"; 649 | }; 650 | name = Release; 651 | }; 652 | 13B07F941A680F5B00A75B9A /* Debug */ = { 653 | isa = XCBuildConfiguration; 654 | baseConfigurationReference = 47F7ED3B7971BE374F7B8635 /* Pods-OtpVerifyExample.debug.xcconfig */; 655 | buildSettings = { 656 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 657 | CLANG_ENABLE_MODULES = YES; 658 | CURRENT_PROJECT_VERSION = 1; 659 | ENABLE_BITCODE = NO; 660 | INFOPLIST_FILE = OtpVerifyExample/Info.plist; 661 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 662 | OTHER_LDFLAGS = ( 663 | "$(inherited)", 664 | "-ObjC", 665 | "-lc++", 666 | ); 667 | PRODUCT_BUNDLE_IDENTIFIER = "com.example.reactnativeotpverify"; 668 | PRODUCT_NAME = OtpVerifyExample; 669 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 670 | SWIFT_VERSION = 5.0; 671 | VERSIONING_SYSTEM = "apple-generic"; 672 | }; 673 | name = Debug; 674 | }; 675 | 13B07F951A680F5B00A75B9A /* Release */ = { 676 | isa = XCBuildConfiguration; 677 | baseConfigurationReference = E00ACF0FDA8BF921659E2F9A /* Pods-OtpVerifyExample.release.xcconfig */; 678 | buildSettings = { 679 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 680 | CLANG_ENABLE_MODULES = YES; 681 | CURRENT_PROJECT_VERSION = 1; 682 | INFOPLIST_FILE = OtpVerifyExample/Info.plist; 683 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 684 | OTHER_LDFLAGS = ( 685 | "$(inherited)", 686 | "-ObjC", 687 | "-lc++", 688 | ); 689 | PRODUCT_BUNDLE_IDENTIFIER = "com.example.reactnativeotpverify"; 690 | PRODUCT_NAME = OtpVerifyExample; 691 | SWIFT_VERSION = 5.0; 692 | VERSIONING_SYSTEM = "apple-generic"; 693 | }; 694 | name = Release; 695 | }; 696 | 2D02E4971E0B4A5E006451C7 /* Debug */ = { 697 | isa = XCBuildConfiguration; 698 | baseConfigurationReference = AE69546072F7DC475F196F4C /* Pods-OtpVerifyExample-tvOS.debug.xcconfig */; 699 | buildSettings = { 700 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 701 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 702 | CLANG_ANALYZER_NONNULL = YES; 703 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 704 | CLANG_WARN_INFINITE_RECURSION = YES; 705 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 706 | DEBUG_INFORMATION_FORMAT = dwarf; 707 | ENABLE_TESTABILITY = YES; 708 | GCC_NO_COMMON_BLOCKS = YES; 709 | INFOPLIST_FILE = "OtpVerifyExample-tvOS/Info.plist"; 710 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 711 | OTHER_LDFLAGS = ( 712 | "$(inherited)", 713 | "-ObjC", 714 | "-lc++", 715 | ); 716 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.OtpVerifyExample-tvOS"; 717 | PRODUCT_NAME = "$(TARGET_NAME)"; 718 | SDKROOT = appletvos; 719 | TARGETED_DEVICE_FAMILY = 3; 720 | TVOS_DEPLOYMENT_TARGET = 10.0; 721 | }; 722 | name = Debug; 723 | }; 724 | 2D02E4981E0B4A5E006451C7 /* Release */ = { 725 | isa = XCBuildConfiguration; 726 | baseConfigurationReference = E88D904CC5F3CC947B01AB46 /* Pods-OtpVerifyExample-tvOS.release.xcconfig */; 727 | buildSettings = { 728 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 729 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 730 | CLANG_ANALYZER_NONNULL = YES; 731 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 732 | CLANG_WARN_INFINITE_RECURSION = YES; 733 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 734 | COPY_PHASE_STRIP = NO; 735 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 736 | GCC_NO_COMMON_BLOCKS = YES; 737 | INFOPLIST_FILE = "OtpVerifyExample-tvOS/Info.plist"; 738 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 739 | OTHER_LDFLAGS = ( 740 | "$(inherited)", 741 | "-ObjC", 742 | "-lc++", 743 | ); 744 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.OtpVerifyExample-tvOS"; 745 | PRODUCT_NAME = "$(TARGET_NAME)"; 746 | SDKROOT = appletvos; 747 | TARGETED_DEVICE_FAMILY = 3; 748 | TVOS_DEPLOYMENT_TARGET = 10.0; 749 | }; 750 | name = Release; 751 | }; 752 | 2D02E4991E0B4A5E006451C7 /* Debug */ = { 753 | isa = XCBuildConfiguration; 754 | baseConfigurationReference = FFD6887008BEF5F1A6973F45 /* Pods-OtpVerifyExample-tvOSTests.debug.xcconfig */; 755 | buildSettings = { 756 | BUNDLE_LOADER = "$(TEST_HOST)"; 757 | CLANG_ANALYZER_NONNULL = YES; 758 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 759 | CLANG_WARN_INFINITE_RECURSION = YES; 760 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 761 | DEBUG_INFORMATION_FORMAT = dwarf; 762 | ENABLE_TESTABILITY = YES; 763 | GCC_NO_COMMON_BLOCKS = YES; 764 | INFOPLIST_FILE = "OtpVerifyExample-tvOSTests/Info.plist"; 765 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 766 | OTHER_LDFLAGS = ( 767 | "$(inherited)", 768 | "-ObjC", 769 | "-lc++", 770 | ); 771 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.OtpVerifyExample-tvOSTests"; 772 | PRODUCT_NAME = "$(TARGET_NAME)"; 773 | SDKROOT = appletvos; 774 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OtpVerifyExample-tvOS.app/OtpVerifyExample-tvOS"; 775 | TVOS_DEPLOYMENT_TARGET = 10.1; 776 | }; 777 | name = Debug; 778 | }; 779 | 2D02E49A1E0B4A5E006451C7 /* Release */ = { 780 | isa = XCBuildConfiguration; 781 | baseConfigurationReference = 1172626FD82B50406EC37522 /* Pods-OtpVerifyExample-tvOSTests.release.xcconfig */; 782 | buildSettings = { 783 | BUNDLE_LOADER = "$(TEST_HOST)"; 784 | CLANG_ANALYZER_NONNULL = YES; 785 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 786 | CLANG_WARN_INFINITE_RECURSION = YES; 787 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 788 | COPY_PHASE_STRIP = NO; 789 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 790 | GCC_NO_COMMON_BLOCKS = YES; 791 | INFOPLIST_FILE = "OtpVerifyExample-tvOSTests/Info.plist"; 792 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 793 | OTHER_LDFLAGS = ( 794 | "$(inherited)", 795 | "-ObjC", 796 | "-lc++", 797 | ); 798 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.OtpVerifyExample-tvOSTests"; 799 | PRODUCT_NAME = "$(TARGET_NAME)"; 800 | SDKROOT = appletvos; 801 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OtpVerifyExample-tvOS.app/OtpVerifyExample-tvOS"; 802 | TVOS_DEPLOYMENT_TARGET = 10.1; 803 | }; 804 | name = Release; 805 | }; 806 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 807 | isa = XCBuildConfiguration; 808 | buildSettings = { 809 | ALWAYS_SEARCH_USER_PATHS = NO; 810 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 811 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 812 | CLANG_CXX_LIBRARY = "libc++"; 813 | CLANG_ENABLE_MODULES = YES; 814 | CLANG_ENABLE_OBJC_ARC = YES; 815 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 816 | CLANG_WARN_BOOL_CONVERSION = YES; 817 | CLANG_WARN_COMMA = YES; 818 | CLANG_WARN_CONSTANT_CONVERSION = YES; 819 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 820 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 821 | CLANG_WARN_EMPTY_BODY = YES; 822 | CLANG_WARN_ENUM_CONVERSION = YES; 823 | CLANG_WARN_INFINITE_RECURSION = YES; 824 | CLANG_WARN_INT_CONVERSION = YES; 825 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 826 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 827 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 828 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 829 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 830 | CLANG_WARN_STRICT_PROTOTYPES = YES; 831 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 832 | CLANG_WARN_UNREACHABLE_CODE = YES; 833 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 834 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 835 | COPY_PHASE_STRIP = NO; 836 | ENABLE_STRICT_OBJC_MSGSEND = YES; 837 | ENABLE_TESTABILITY = YES; 838 | GCC_C_LANGUAGE_STANDARD = gnu99; 839 | GCC_DYNAMIC_NO_PIC = NO; 840 | GCC_NO_COMMON_BLOCKS = YES; 841 | GCC_OPTIMIZATION_LEVEL = 0; 842 | GCC_PREPROCESSOR_DEFINITIONS = ( 843 | "DEBUG=1", 844 | "$(inherited)", 845 | ); 846 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 847 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 848 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 849 | GCC_WARN_UNDECLARED_SELECTOR = YES; 850 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 851 | GCC_WARN_UNUSED_FUNCTION = YES; 852 | GCC_WARN_UNUSED_VARIABLE = YES; 853 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 854 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 855 | LIBRARY_SEARCH_PATHS = ( 856 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 857 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 858 | "\"$(inherited)\"", 859 | ); 860 | MTL_ENABLE_DEBUG_INFO = YES; 861 | ONLY_ACTIVE_ARCH = YES; 862 | SDKROOT = iphoneos; 863 | }; 864 | name = Debug; 865 | }; 866 | 83CBBA211A601CBA00E9B192 /* Release */ = { 867 | isa = XCBuildConfiguration; 868 | buildSettings = { 869 | ALWAYS_SEARCH_USER_PATHS = NO; 870 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 871 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 872 | CLANG_CXX_LIBRARY = "libc++"; 873 | CLANG_ENABLE_MODULES = YES; 874 | CLANG_ENABLE_OBJC_ARC = YES; 875 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 876 | CLANG_WARN_BOOL_CONVERSION = YES; 877 | CLANG_WARN_COMMA = YES; 878 | CLANG_WARN_CONSTANT_CONVERSION = YES; 879 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 880 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 881 | CLANG_WARN_EMPTY_BODY = YES; 882 | CLANG_WARN_ENUM_CONVERSION = YES; 883 | CLANG_WARN_INFINITE_RECURSION = YES; 884 | CLANG_WARN_INT_CONVERSION = YES; 885 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 886 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 887 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 888 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 889 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 890 | CLANG_WARN_STRICT_PROTOTYPES = YES; 891 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 892 | CLANG_WARN_UNREACHABLE_CODE = YES; 893 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 894 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 895 | COPY_PHASE_STRIP = YES; 896 | ENABLE_NS_ASSERTIONS = NO; 897 | ENABLE_STRICT_OBJC_MSGSEND = YES; 898 | GCC_C_LANGUAGE_STANDARD = gnu99; 899 | GCC_NO_COMMON_BLOCKS = YES; 900 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 901 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 902 | GCC_WARN_UNDECLARED_SELECTOR = YES; 903 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 904 | GCC_WARN_UNUSED_FUNCTION = YES; 905 | GCC_WARN_UNUSED_VARIABLE = YES; 906 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 907 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 908 | LIBRARY_SEARCH_PATHS = ( 909 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 910 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 911 | "\"$(inherited)\"", 912 | ); 913 | MTL_ENABLE_DEBUG_INFO = NO; 914 | SDKROOT = iphoneos; 915 | VALIDATE_PRODUCT = YES; 916 | }; 917 | name = Release; 918 | }; 919 | /* End XCBuildConfiguration section */ 920 | 921 | /* Begin XCConfigurationList section */ 922 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "OtpVerifyExampleTests" */ = { 923 | isa = XCConfigurationList; 924 | buildConfigurations = ( 925 | 00E356F61AD99517003FC87E /* Debug */, 926 | 00E356F71AD99517003FC87E /* Release */, 927 | ); 928 | defaultConfigurationIsVisible = 0; 929 | defaultConfigurationName = Release; 930 | }; 931 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "OtpVerifyExample" */ = { 932 | isa = XCConfigurationList; 933 | buildConfigurations = ( 934 | 13B07F941A680F5B00A75B9A /* Debug */, 935 | 13B07F951A680F5B00A75B9A /* Release */, 936 | ); 937 | defaultConfigurationIsVisible = 0; 938 | defaultConfigurationName = Release; 939 | }; 940 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "OtpVerifyExample-tvOS" */ = { 941 | isa = XCConfigurationList; 942 | buildConfigurations = ( 943 | 2D02E4971E0B4A5E006451C7 /* Debug */, 944 | 2D02E4981E0B4A5E006451C7 /* Release */, 945 | ); 946 | defaultConfigurationIsVisible = 0; 947 | defaultConfigurationName = Release; 948 | }; 949 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "OtpVerifyExample-tvOSTests" */ = { 950 | isa = XCConfigurationList; 951 | buildConfigurations = ( 952 | 2D02E4991E0B4A5E006451C7 /* Debug */, 953 | 2D02E49A1E0B4A5E006451C7 /* Release */, 954 | ); 955 | defaultConfigurationIsVisible = 0; 956 | defaultConfigurationName = Release; 957 | }; 958 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "OtpVerifyExample" */ = { 959 | isa = XCConfigurationList; 960 | buildConfigurations = ( 961 | 83CBBA201A601CBA00E9B192 /* Debug */, 962 | 83CBBA211A601CBA00E9B192 /* Release */, 963 | ); 964 | defaultConfigurationIsVisible = 0; 965 | defaultConfigurationName = Release; 966 | }; 967 | /* End XCConfigurationList section */ 968 | }; 969 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 970 | } 971 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample.xcodeproj/xcshareddata/xcschemes/OtpVerifyExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample/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 | 15 | @end 16 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample/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 | #import 12 | #import 13 | 14 | #ifdef FB_SONARKIT_ENABLED 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | static void InitializeFlipper(UIApplication *application) { 22 | FlipperClient *client = [FlipperClient sharedClient]; 23 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 24 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 25 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 26 | [client addPlugin:[FlipperKitReactPlugin new]]; 27 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 28 | [client start]; 29 | } 30 | #endif 31 | 32 | @implementation AppDelegate 33 | 34 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 35 | { 36 | #ifdef FB_SONARKIT_ENABLED 37 | InitializeFlipper(application); 38 | #endif 39 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 40 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 41 | moduleName:@"OtpVerifyExample" 42 | initialProperties:nil]; 43 | 44 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 45 | 46 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 47 | UIViewController *rootViewController = [UIViewController new]; 48 | rootViewController.view = rootView; 49 | self.window.rootViewController = rootViewController; 50 | [self.window makeKeyAndVisible]; 51 | return YES; 52 | } 53 | 54 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 55 | { 56 | #if DEBUG 57 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 58 | #else 59 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 60 | #endif 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | OtpVerify Example 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/OtpVerifyExample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /example/ios/OtpVerifyExample/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 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '10.0' 5 | 6 | target 'OtpVerifyExample' do 7 | config = use_native_modules! 8 | 9 | use_react_native!(:path => config["reactNativePath"]) 10 | 11 | pod 'react-native-otp-verify', :path => '../..' 12 | 13 | # Enables Flipper. 14 | # 15 | # Note that if you have use_frameworks! enabled, Flipper will not work and 16 | # you should disable these next few lines. 17 | use_flipper!({ 'Flipper' => '0.80.0' }) 18 | post_install do |installer| 19 | flipper_post_install(installer) 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const blacklist = require('metro-config/src/defaults/blacklist'); 3 | const escape = require('escape-string-regexp'); 4 | const pak = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | const modules = Object.keys({ 9 | ...pak.peerDependencies, 10 | }); 11 | 12 | module.exports = { 13 | projectRoot: __dirname, 14 | watchFolders: [root], 15 | 16 | // We need to make sure that only one version is loaded for peerDependencies 17 | // So we blacklist them at the root, and alias them to the versions in example's node_modules 18 | resolver: { 19 | blacklistRE: blacklist( 20 | modules.map( 21 | (m) => 22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) 23 | ) 24 | ), 25 | 26 | extraNodeModules: modules.reduce((acc, name) => { 27 | acc[name] = path.join(__dirname, 'node_modules', name); 28 | return acc; 29 | }, {}), 30 | }, 31 | 32 | transformer: { 33 | getTransformOptions: async () => ({ 34 | transform: { 35 | experimentalImportSupport: false, 36 | inlineRequires: true, 37 | }, 38 | }), 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-otp-verify-example", 3 | "description": "Example app for react-native-otp-verify", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "android": "react-native run-android", 8 | "ios": "react-native run-ios", 9 | "start": "react-native start" 10 | }, 11 | "dependencies": { 12 | "react": "16.13.1", 13 | "react-native": "0.63.4" 14 | }, 15 | "devDependencies": { 16 | "@babel/core": "^7.12.10", 17 | "@babel/runtime": "^7.12.5", 18 | "babel-plugin-module-resolver": "^4.0.0", 19 | "metro-react-native-babel-preset": "^0.64.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { StyleSheet, Text, View } from 'react-native'; 4 | import { 5 | getHash, requestHint, 6 | startOtpListener, 7 | useOtpVerify, 8 | } from 'react-native-otp-verify'; 9 | 10 | export default function App() { 11 | const [hashFromMethod, setHashFromMethod] = React.useState(); 12 | const [otpFromMethod, setOtpFromMethod] = React.useState(); 13 | const [hint, setHint] = React.useState(); 14 | 15 | // using hook - you can use the startListener and stopListener to manually trigger listeners again. 16 | const { hash, otp, timeoutError, stopListener, startListener } = useOtpVerify(); 17 | 18 | // using methods 19 | React.useEffect(() => { 20 | getHash().then(setHashFromMethod).catch(console.log); 21 | requestHint().then(setHint).catch(console.log); 22 | startOtpListener(setOtpFromMethod); 23 | }, []); 24 | 25 | return ( 26 | 27 | 28 | Using Methods 29 | Your Hash is: {hashFromMethod} 30 | Your message is: {otpFromMethod} 31 | Selected Mobile Number is: {hint} 32 | 33 | 34 | Using Hook 35 | Your Hash is: {hash} 36 | Your otp is: {otp} 37 | Timeout Error: {String(timeoutError)} 38 | 39 | 40 | ); 41 | } 42 | 43 | const styles = StyleSheet.create({ 44 | container: { 45 | flex: 1, 46 | alignItems: 'center', 47 | justifyContent: 'center', 48 | }, 49 | resultView: { 50 | margin: 10, 51 | }, 52 | resultHeader: { 53 | fontSize: 18, 54 | marginBottom: 5, 55 | }, 56 | box: { 57 | width: 60, 58 | height: 60, 59 | marginVertical: 20, 60 | }, 61 | }); 62 | -------------------------------------------------------------------------------- /lib/commonjs/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.addListener = addListener; 7 | exports.default = void 0; 8 | exports.getHash = getHash; 9 | exports.getOtp = getOtp; 10 | exports.removeListener = removeListener; 11 | exports.requestHint = requestHint; 12 | exports.startOtpListener = startOtpListener; 13 | exports.useOtpVerify = void 0; 14 | 15 | var _reactNative = require("react-native"); 16 | 17 | var _react = require("react"); 18 | 19 | const LINKING_ERROR = `The package 'react-native-otp-verify' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({ 20 | ios: "- You have run 'pod install'\n", 21 | default: '' 22 | }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n'; 23 | const RNOtpVerify = _reactNative.NativeModules.OtpVerify ? _reactNative.NativeModules.OtpVerify : new Proxy({}, { 24 | get() { 25 | throw new Error(LINKING_ERROR); 26 | } 27 | 28 | }); 29 | const eventEmitter = new _reactNative.NativeEventEmitter(RNOtpVerify); 30 | 31 | async function getOtp() { 32 | if (_reactNative.Platform.OS === 'ios') { 33 | console.warn('Not Supported on iOS'); 34 | return false; 35 | } 36 | 37 | return RNOtpVerify.getOtp(); 38 | } 39 | 40 | function startOtpListener(handler) { 41 | return getOtp().then(() => addListener(handler)); 42 | } 43 | 44 | const useOtpVerify = function () { 45 | let { 46 | numberOfDigits 47 | } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 48 | numberOfDigits: 0 49 | }; 50 | const [message, setMessage] = (0, _react.useState)(null); 51 | const [otp, setOtp] = (0, _react.useState)(null); 52 | const [timeoutError, setTimeoutError] = (0, _react.useState)(false); 53 | const [hash, setHash] = (0, _react.useState)([]); 54 | 55 | const handleMessage = response => { 56 | if (response === 'Timeout Error.') { 57 | setTimeoutError(true); 58 | } else { 59 | setMessage(response); 60 | 61 | if (numberOfDigits && response) { 62 | const otpDigits = new RegExp(`(\\d{${numberOfDigits}})`, 'g').exec(response); 63 | if (otpDigits && otpDigits[1]) setOtp(otpDigits[1]); 64 | } 65 | } 66 | }; 67 | 68 | (0, _react.useEffect)(() => { 69 | if (_reactNative.Platform.OS === 'ios') { 70 | console.warn('Not Supported on iOS'); 71 | return; 72 | } 73 | 74 | getHash().then(setHash); 75 | startOtpListener(handleMessage); 76 | return () => { 77 | removeListener(); 78 | }; 79 | }, []); 80 | 81 | const startListener = () => { 82 | if (_reactNative.Platform.OS === 'ios') { 83 | console.warn('Not Supported on iOS'); 84 | return; 85 | } 86 | 87 | setOtp(''); 88 | setMessage(''); 89 | startOtpListener(handleMessage); 90 | }; 91 | 92 | const stopListener = () => { 93 | if (_reactNative.Platform.OS === 'ios') { 94 | console.warn('Not Supported on iOS'); 95 | return; 96 | } 97 | 98 | removeListener(); 99 | }; 100 | 101 | return { 102 | otp, 103 | message, 104 | hash, 105 | timeoutError, 106 | stopListener, 107 | startListener 108 | }; 109 | }; 110 | 111 | exports.useOtpVerify = useOtpVerify; 112 | 113 | async function getHash() { 114 | if (_reactNative.Platform.OS === 'ios') { 115 | console.warn('Not Supported on iOS'); 116 | return []; 117 | } 118 | 119 | return RNOtpVerify.getHash(); 120 | } 121 | 122 | async function requestHint() { 123 | if (_reactNative.Platform.OS === 'ios') { 124 | console.warn('Not Supported on iOS'); 125 | return ''; 126 | } 127 | 128 | return RNOtpVerify.requestHint(); 129 | } 130 | 131 | function addListener(handler) { 132 | return eventEmitter.addListener('com.faizalshap.otpVerify:otpReceived', handler); 133 | } 134 | 135 | function removeListener() { 136 | return eventEmitter.removeAllListeners('com.faizalshap.otpVerify:otpReceived'); 137 | } 138 | 139 | const OtpVerify = { 140 | getOtp, 141 | getHash, 142 | addListener, 143 | removeListener, 144 | startOtpListener, 145 | requestHint 146 | }; 147 | var _default = OtpVerify; 148 | exports.default = _default; 149 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib/commonjs/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","RNOtpVerify","NativeModules","OtpVerify","Proxy","get","Error","eventEmitter","NativeEventEmitter","getOtp","OS","console","warn","startOtpListener","handler","then","addListener","useOtpVerify","numberOfDigits","message","setMessage","otp","setOtp","timeoutError","setTimeoutError","hash","setHash","handleMessage","response","otpDigits","RegExp","exec","getHash","removeListener","startListener","stopListener","requestHint","removeAllListeners"],"mappings":";;;;;;;;;;;;;;AAAA;;AACA;;AAEA,MAAMA,aAAa,GAChB,kFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,WAAW,GAAGC,2BAAcC,SAAd,GAChBD,2BAAcC,SADE,GAEhB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAWA,MAAMW,YAAY,GAAG,IAAIC,+BAAJ,CAAuBP,WAAvB,CAArB;;AAeO,eAAeQ,MAAf,GAA0C;AAC/C,MAAIZ,sBAASa,EAAT,KAAgB,KAApB,EAA2B;AACzBC,IAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA,WAAO,KAAP;AACD;;AACD,SAAOX,WAAW,CAACQ,MAAZ,EAAP;AACD;;AAEM,SAASI,gBAAT,CACLC,OADK,EAEgD;AACrD,SAAOL,MAAM,GAAGM,IAAT,CAAc,MAAMC,WAAW,CAACF,OAAD,CAA/B,CAAP;AACD;;AAEM,MAAMG,YAAY,GAAG,YAAgD;AAAA,MAA/C;AAAEC,IAAAA;AAAF,GAA+C,uEAA1B;AAAEA,IAAAA,cAAc,EAAE;AAAlB,GAA0B;AAC1E,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,qBAAwB,IAAxB,CAA9B;AACA,QAAM,CAACC,GAAD,EAAMC,MAAN,IAAgB,qBAAwB,IAAxB,CAAtB;AACA,QAAM,CAACC,YAAD,EAAeC,eAAf,IAAkC,qBAAkB,KAAlB,CAAxC;AACA,QAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,qBAA0B,EAA1B,CAAxB;;AAEA,QAAMC,aAAa,GAAIC,QAAD,IAAsB;AAC1C,QAAIA,QAAQ,KAAK,gBAAjB,EAAmC;AACjCJ,MAAAA,eAAe,CAAC,IAAD,CAAf;AACD,KAFD,MAEO;AACLJ,MAAAA,UAAU,CAACQ,QAAD,CAAV;;AACA,UAAIV,cAAc,IAAIU,QAAtB,EAAgC;AAC9B,cAAMC,SAAS,GAAG,IAAIC,MAAJ,CAAY,QAAOZ,cAAe,IAAlC,EAAuC,GAAvC,EAA4Ca,IAA5C,CAAiDH,QAAjD,CAAlB;AACA,YAAIC,SAAS,IAAIA,SAAS,CAAC,CAAD,CAA1B,EAA+BP,MAAM,CAACO,SAAS,CAAC,CAAD,CAAV,CAAN;AAChC;AACF;AACF,GAVD;;AAWA,wBAAU,MAAM;AACd,QAAIhC,sBAASa,EAAT,KAAgB,KAApB,EAA2B;AACzBC,MAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA;AACD;;AACDoB,IAAAA,OAAO,GAAGjB,IAAV,CAAeW,OAAf;AACAb,IAAAA,gBAAgB,CAACc,aAAD,CAAhB;AACA,WAAO,MAAM;AACXM,MAAAA,cAAc;AACf,KAFD;AAGD,GAVD,EAUG,EAVH;;AAWA,QAAMC,aAAa,GAAG,MAAM;AAC1B,QAAIrC,sBAASa,EAAT,KAAgB,KAApB,EAA2B;AACzBC,MAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA;AACD;;AACDU,IAAAA,MAAM,CAAC,EAAD,CAAN;AACAF,IAAAA,UAAU,CAAC,EAAD,CAAV;AACAP,IAAAA,gBAAgB,CAACc,aAAD,CAAhB;AACD,GARD;;AASA,QAAMQ,YAAY,GAAG,MAAM;AACzB,QAAItC,sBAASa,EAAT,KAAgB,KAApB,EAA2B;AACzBC,MAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA;AACD;;AACDqB,IAAAA,cAAc;AACf,GAND;;AAOA,SAAO;AAAEZ,IAAAA,GAAF;AAAOF,IAAAA,OAAP;AAAgBM,IAAAA,IAAhB;AAAsBF,IAAAA,YAAtB;AAAoCY,IAAAA,YAApC;AAAkDD,IAAAA;AAAlD,GAAP;AACD,CA7CM;;;;AA+CA,eAAeF,OAAf,GAA4C;AACjD,MAAInC,sBAASa,EAAT,KAAgB,KAApB,EAA2B;AACzBC,IAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA,WAAO,EAAP;AACD;;AACD,SAAOX,WAAW,CAAC+B,OAAZ,EAAP;AACD;;AACM,eAAeI,WAAf,GAA8C;AACnD,MAAIvC,sBAASa,EAAT,KAAgB,KAApB,EAA2B;AACzBC,IAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA,WAAO,EAAP;AACD;;AACD,SAAOX,WAAW,CAACmC,WAAZ,EAAP;AACD;;AAEM,SAASpB,WAAT,CACLF,OADK,EAEuC;AAC5C,SAAOP,YAAY,CAACS,WAAb,CACL,sCADK,EAELF,OAFK,CAAP;AAID;;AAEM,SAASmB,cAAT,GAAgC;AACrC,SAAO1B,YAAY,CAAC8B,kBAAb,CACL,sCADK,CAAP;AAGD;;AAED,MAAMlC,SAAoB,GAAG;AAC3BM,EAAAA,MAD2B;AAE3BuB,EAAAA,OAF2B;AAG3BhB,EAAAA,WAH2B;AAI3BiB,EAAAA,cAJ2B;AAK3BpB,EAAAA,gBAL2B;AAM3BuB,EAAAA;AAN2B,CAA7B;eASejC,S","sourcesContent":["import { NativeEventEmitter, NativeModules, Platform } from 'react-native';\nimport { useEffect, useState } from 'react';\n\nconst LINKING_ERROR =\n `The package 'react-native-otp-verify' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst RNOtpVerify = NativeModules.OtpVerify\n ? NativeModules.OtpVerify\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst eventEmitter = new NativeEventEmitter(RNOtpVerify);\n\ninterface OtpVerify {\n getOtp: () => Promise;\n getHash: () => Promise;\n requestHint: () => Promise;\n startOtpListener: (\n handler: (value: string) => any\n ) => Promise;\n addListener: (\n handler: (value: string) => any\n ) => import('react-native').EmitterSubscription;\n removeListener: () => void;\n}\n\nexport async function getOtp(): Promise {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return false;\n }\n return RNOtpVerify.getOtp();\n}\n\nexport function startOtpListener(\n handler: (value: string) => any\n): Promise {\n return getOtp().then(() => addListener(handler));\n}\n\nexport const useOtpVerify = ({ numberOfDigits } = { numberOfDigits: 0 }) => {\n const [message, setMessage] = useState(null);\n const [otp, setOtp] = useState(null);\n const [timeoutError, setTimeoutError] = useState(false);\n const [hash, setHash] = useState([]);\n\n const handleMessage = (response: string) => {\n if (response === 'Timeout Error.') {\n setTimeoutError(true);\n } else {\n setMessage(response);\n if (numberOfDigits && response) {\n const otpDigits = new RegExp(`(\\\\d{${numberOfDigits}})`, 'g').exec(response);\n if (otpDigits && otpDigits[1]) setOtp(otpDigits[1]);\n }\n }\n };\n useEffect(() => {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return;\n }\n getHash().then(setHash);\n startOtpListener(handleMessage);\n return () => {\n removeListener();\n };\n }, []);\n const startListener = () => {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return;\n }\n setOtp('');\n setMessage('');\n startOtpListener(handleMessage);\n };\n const stopListener = () => {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return;\n }\n removeListener();\n };\n return { otp, message, hash, timeoutError, stopListener, startListener };\n};\n\nexport async function getHash(): Promise {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return [];\n }\n return RNOtpVerify.getHash();\n}\nexport async function requestHint(): Promise {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return '';\n }\n return RNOtpVerify.requestHint();\n}\n\nexport function addListener(\n handler: (value: string) => any\n): import('react-native').EmitterSubscription {\n return eventEmitter.addListener(\n 'com.faizalshap.otpVerify:otpReceived',\n handler\n );\n}\n\nexport function removeListener(): void {\n return eventEmitter.removeAllListeners(\n 'com.faizalshap.otpVerify:otpReceived'\n );\n}\n\nconst OtpVerify: OtpVerify = {\n getOtp,\n getHash,\n addListener,\n removeListener,\n startOtpListener,\n requestHint,\n};\n\nexport default OtpVerify;\n"]} -------------------------------------------------------------------------------- /lib/module/index.js: -------------------------------------------------------------------------------- 1 | import { NativeEventEmitter, NativeModules, Platform } from 'react-native'; 2 | import { useEffect, useState } from 'react'; 3 | const LINKING_ERROR = `The package 'react-native-otp-verify' doesn't seem to be linked. Make sure: \n\n` + Platform.select({ 4 | ios: "- You have run 'pod install'\n", 5 | default: '' 6 | }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n'; 7 | const RNOtpVerify = NativeModules.OtpVerify ? NativeModules.OtpVerify : new Proxy({}, { 8 | get() { 9 | throw new Error(LINKING_ERROR); 10 | } 11 | 12 | }); 13 | const eventEmitter = new NativeEventEmitter(RNOtpVerify); 14 | export async function getOtp() { 15 | if (Platform.OS === 'ios') { 16 | console.warn('Not Supported on iOS'); 17 | return false; 18 | } 19 | 20 | return RNOtpVerify.getOtp(); 21 | } 22 | export function startOtpListener(handler) { 23 | return getOtp().then(() => addListener(handler)); 24 | } 25 | export const useOtpVerify = function () { 26 | let { 27 | numberOfDigits 28 | } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 29 | numberOfDigits: 0 30 | }; 31 | const [message, setMessage] = useState(null); 32 | const [otp, setOtp] = useState(null); 33 | const [timeoutError, setTimeoutError] = useState(false); 34 | const [hash, setHash] = useState([]); 35 | 36 | const handleMessage = response => { 37 | if (response === 'Timeout Error.') { 38 | setTimeoutError(true); 39 | } else { 40 | setMessage(response); 41 | 42 | if (numberOfDigits && response) { 43 | const otpDigits = new RegExp(`(\\d{${numberOfDigits}})`, 'g').exec(response); 44 | if (otpDigits && otpDigits[1]) setOtp(otpDigits[1]); 45 | } 46 | } 47 | }; 48 | 49 | useEffect(() => { 50 | if (Platform.OS === 'ios') { 51 | console.warn('Not Supported on iOS'); 52 | return; 53 | } 54 | 55 | getHash().then(setHash); 56 | startOtpListener(handleMessage); 57 | return () => { 58 | removeListener(); 59 | }; 60 | }, []); 61 | 62 | const startListener = () => { 63 | if (Platform.OS === 'ios') { 64 | console.warn('Not Supported on iOS'); 65 | return; 66 | } 67 | 68 | setOtp(''); 69 | setMessage(''); 70 | startOtpListener(handleMessage); 71 | }; 72 | 73 | const stopListener = () => { 74 | if (Platform.OS === 'ios') { 75 | console.warn('Not Supported on iOS'); 76 | return; 77 | } 78 | 79 | removeListener(); 80 | }; 81 | 82 | return { 83 | otp, 84 | message, 85 | hash, 86 | timeoutError, 87 | stopListener, 88 | startListener 89 | }; 90 | }; 91 | export async function getHash() { 92 | if (Platform.OS === 'ios') { 93 | console.warn('Not Supported on iOS'); 94 | return []; 95 | } 96 | 97 | return RNOtpVerify.getHash(); 98 | } 99 | export async function requestHint() { 100 | if (Platform.OS === 'ios') { 101 | console.warn('Not Supported on iOS'); 102 | return ''; 103 | } 104 | 105 | return RNOtpVerify.requestHint(); 106 | } 107 | export function addListener(handler) { 108 | return eventEmitter.addListener('com.faizalshap.otpVerify:otpReceived', handler); 109 | } 110 | export function removeListener() { 111 | return eventEmitter.removeAllListeners('com.faizalshap.otpVerify:otpReceived'); 112 | } 113 | const OtpVerify = { 114 | getOtp, 115 | getHash, 116 | addListener, 117 | removeListener, 118 | startOtpListener, 119 | requestHint 120 | }; 121 | export default OtpVerify; 122 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /lib/module/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["index.tsx"],"names":["NativeEventEmitter","NativeModules","Platform","useEffect","useState","LINKING_ERROR","select","ios","default","RNOtpVerify","OtpVerify","Proxy","get","Error","eventEmitter","getOtp","OS","console","warn","startOtpListener","handler","then","addListener","useOtpVerify","numberOfDigits","message","setMessage","otp","setOtp","timeoutError","setTimeoutError","hash","setHash","handleMessage","response","otpDigits","RegExp","exec","getHash","removeListener","startListener","stopListener","requestHint","removeAllListeners"],"mappings":"AAAA,SAASA,kBAAT,EAA6BC,aAA7B,EAA4CC,QAA5C,QAA4D,cAA5D;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,OAApC;AAEA,MAAMC,aAAa,GAChB,kFAAD,GACAH,QAAQ,CAACI,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,WAAW,GAAGR,aAAa,CAACS,SAAd,GAChBT,aAAa,CAACS,SADE,GAEhB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAWA,MAAMS,YAAY,GAAG,IAAId,kBAAJ,CAAuBS,WAAvB,CAArB;AAeA,OAAO,eAAeM,MAAf,GAA0C;AAC/C,MAAIb,QAAQ,CAACc,EAAT,KAAgB,KAApB,EAA2B;AACzBC,IAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA,WAAO,KAAP;AACD;;AACD,SAAOT,WAAW,CAACM,MAAZ,EAAP;AACD;AAED,OAAO,SAASI,gBAAT,CACLC,OADK,EAEgD;AACrD,SAAOL,MAAM,GAAGM,IAAT,CAAc,MAAMC,WAAW,CAACF,OAAD,CAA/B,CAAP;AACD;AAED,OAAO,MAAMG,YAAY,GAAG,YAAgD;AAAA,MAA/C;AAAEC,IAAAA;AAAF,GAA+C,uEAA1B;AAAEA,IAAAA,cAAc,EAAE;AAAlB,GAA0B;AAC1E,QAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBtB,QAAQ,CAAgB,IAAhB,CAAtC;AACA,QAAM,CAACuB,GAAD,EAAMC,MAAN,IAAgBxB,QAAQ,CAAgB,IAAhB,CAA9B;AACA,QAAM,CAACyB,YAAD,EAAeC,eAAf,IAAkC1B,QAAQ,CAAU,KAAV,CAAhD;AACA,QAAM,CAAC2B,IAAD,EAAOC,OAAP,IAAkB5B,QAAQ,CAAkB,EAAlB,CAAhC;;AAEA,QAAM6B,aAAa,GAAIC,QAAD,IAAsB;AAC1C,QAAIA,QAAQ,KAAK,gBAAjB,EAAmC;AACjCJ,MAAAA,eAAe,CAAC,IAAD,CAAf;AACD,KAFD,MAEO;AACLJ,MAAAA,UAAU,CAACQ,QAAD,CAAV;;AACA,UAAIV,cAAc,IAAIU,QAAtB,EAAgC;AAC9B,cAAMC,SAAS,GAAG,IAAIC,MAAJ,CAAY,QAAOZ,cAAe,IAAlC,EAAuC,GAAvC,EAA4Ca,IAA5C,CAAiDH,QAAjD,CAAlB;AACA,YAAIC,SAAS,IAAIA,SAAS,CAAC,CAAD,CAA1B,EAA+BP,MAAM,CAACO,SAAS,CAAC,CAAD,CAAV,CAAN;AAChC;AACF;AACF,GAVD;;AAWAhC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAID,QAAQ,CAACc,EAAT,KAAgB,KAApB,EAA2B;AACzBC,MAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA;AACD;;AACDoB,IAAAA,OAAO,GAAGjB,IAAV,CAAeW,OAAf;AACAb,IAAAA,gBAAgB,CAACc,aAAD,CAAhB;AACA,WAAO,MAAM;AACXM,MAAAA,cAAc;AACf,KAFD;AAGD,GAVQ,EAUN,EAVM,CAAT;;AAWA,QAAMC,aAAa,GAAG,MAAM;AAC1B,QAAItC,QAAQ,CAACc,EAAT,KAAgB,KAApB,EAA2B;AACzBC,MAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA;AACD;;AACDU,IAAAA,MAAM,CAAC,EAAD,CAAN;AACAF,IAAAA,UAAU,CAAC,EAAD,CAAV;AACAP,IAAAA,gBAAgB,CAACc,aAAD,CAAhB;AACD,GARD;;AASA,QAAMQ,YAAY,GAAG,MAAM;AACzB,QAAIvC,QAAQ,CAACc,EAAT,KAAgB,KAApB,EAA2B;AACzBC,MAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA;AACD;;AACDqB,IAAAA,cAAc;AACf,GAND;;AAOA,SAAO;AAAEZ,IAAAA,GAAF;AAAOF,IAAAA,OAAP;AAAgBM,IAAAA,IAAhB;AAAsBF,IAAAA,YAAtB;AAAoCY,IAAAA,YAApC;AAAkDD,IAAAA;AAAlD,GAAP;AACD,CA7CM;AA+CP,OAAO,eAAeF,OAAf,GAA4C;AACjD,MAAIpC,QAAQ,CAACc,EAAT,KAAgB,KAApB,EAA2B;AACzBC,IAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA,WAAO,EAAP;AACD;;AACD,SAAOT,WAAW,CAAC6B,OAAZ,EAAP;AACD;AACD,OAAO,eAAeI,WAAf,GAA8C;AACnD,MAAIxC,QAAQ,CAACc,EAAT,KAAgB,KAApB,EAA2B;AACzBC,IAAAA,OAAO,CAACC,IAAR,CAAa,sBAAb;AACA,WAAO,EAAP;AACD;;AACD,SAAOT,WAAW,CAACiC,WAAZ,EAAP;AACD;AAED,OAAO,SAASpB,WAAT,CACLF,OADK,EAEuC;AAC5C,SAAON,YAAY,CAACQ,WAAb,CACL,sCADK,EAELF,OAFK,CAAP;AAID;AAED,OAAO,SAASmB,cAAT,GAAgC;AACrC,SAAOzB,YAAY,CAAC6B,kBAAb,CACL,sCADK,CAAP;AAGD;AAED,MAAMjC,SAAoB,GAAG;AAC3BK,EAAAA,MAD2B;AAE3BuB,EAAAA,OAF2B;AAG3BhB,EAAAA,WAH2B;AAI3BiB,EAAAA,cAJ2B;AAK3BpB,EAAAA,gBAL2B;AAM3BuB,EAAAA;AAN2B,CAA7B;AASA,eAAehC,SAAf","sourcesContent":["import { NativeEventEmitter, NativeModules, Platform } from 'react-native';\nimport { useEffect, useState } from 'react';\n\nconst LINKING_ERROR =\n `The package 'react-native-otp-verify' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst RNOtpVerify = NativeModules.OtpVerify\n ? NativeModules.OtpVerify\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst eventEmitter = new NativeEventEmitter(RNOtpVerify);\n\ninterface OtpVerify {\n getOtp: () => Promise;\n getHash: () => Promise;\n requestHint: () => Promise;\n startOtpListener: (\n handler: (value: string) => any\n ) => Promise;\n addListener: (\n handler: (value: string) => any\n ) => import('react-native').EmitterSubscription;\n removeListener: () => void;\n}\n\nexport async function getOtp(): Promise {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return false;\n }\n return RNOtpVerify.getOtp();\n}\n\nexport function startOtpListener(\n handler: (value: string) => any\n): Promise {\n return getOtp().then(() => addListener(handler));\n}\n\nexport const useOtpVerify = ({ numberOfDigits } = { numberOfDigits: 0 }) => {\n const [message, setMessage] = useState(null);\n const [otp, setOtp] = useState(null);\n const [timeoutError, setTimeoutError] = useState(false);\n const [hash, setHash] = useState([]);\n\n const handleMessage = (response: string) => {\n if (response === 'Timeout Error.') {\n setTimeoutError(true);\n } else {\n setMessage(response);\n if (numberOfDigits && response) {\n const otpDigits = new RegExp(`(\\\\d{${numberOfDigits}})`, 'g').exec(response);\n if (otpDigits && otpDigits[1]) setOtp(otpDigits[1]);\n }\n }\n };\n useEffect(() => {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return;\n }\n getHash().then(setHash);\n startOtpListener(handleMessage);\n return () => {\n removeListener();\n };\n }, []);\n const startListener = () => {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return;\n }\n setOtp('');\n setMessage('');\n startOtpListener(handleMessage);\n };\n const stopListener = () => {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return;\n }\n removeListener();\n };\n return { otp, message, hash, timeoutError, stopListener, startListener };\n};\n\nexport async function getHash(): Promise {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return [];\n }\n return RNOtpVerify.getHash();\n}\nexport async function requestHint(): Promise {\n if (Platform.OS === 'ios') {\n console.warn('Not Supported on iOS');\n return '';\n }\n return RNOtpVerify.requestHint();\n}\n\nexport function addListener(\n handler: (value: string) => any\n): import('react-native').EmitterSubscription {\n return eventEmitter.addListener(\n 'com.faizalshap.otpVerify:otpReceived',\n handler\n );\n}\n\nexport function removeListener(): void {\n return eventEmitter.removeAllListeners(\n 'com.faizalshap.otpVerify:otpReceived'\n );\n}\n\nconst OtpVerify: OtpVerify = {\n getOtp,\n getHash,\n addListener,\n removeListener,\n startOtpListener,\n requestHint,\n};\n\nexport default OtpVerify;\n"]} -------------------------------------------------------------------------------- /lib/typescript/__tests__/index.test.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faizalshap/react-native-otp-verify/6c00666416a3927d4c30811ae008432a31c26189/lib/typescript/__tests__/index.test.d.ts -------------------------------------------------------------------------------- /lib/typescript/index.d.ts: -------------------------------------------------------------------------------- 1 | interface OtpVerify { 2 | getOtp: () => Promise; 3 | getHash: () => Promise; 4 | requestHint: () => Promise; 5 | startOtpListener: (handler: (value: string) => any) => Promise; 6 | addListener: (handler: (value: string) => any) => import('react-native').EmitterSubscription; 7 | removeListener: () => void; 8 | } 9 | export declare function getOtp(): Promise; 10 | export declare function startOtpListener(handler: (value: string) => any): Promise; 11 | export declare const useOtpVerify: ({ numberOfDigits }?: { 12 | numberOfDigits: number; 13 | }) => { 14 | otp: string | null; 15 | message: string | null; 16 | hash: string[] | null; 17 | timeoutError: boolean; 18 | stopListener: () => void; 19 | startListener: () => void; 20 | }; 21 | export declare function getHash(): Promise; 22 | export declare function requestHint(): Promise; 23 | export declare function addListener(handler: (value: string) => any): import('react-native').EmitterSubscription; 24 | export declare function removeListener(): void; 25 | declare const OtpVerify: OtpVerify; 26 | export default OtpVerify; 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-otp-verify", 3 | "version": "1.1.8", 4 | "description": "Otp verify", 5 | "main": "lib/commonjs/index", 6 | "module": "lib/module/index", 7 | "types": "lib/typescript/index.d.ts", 8 | "react-native": "src/index", 9 | "source": "src/index", 10 | "files": [ 11 | "src", 12 | "lib", 13 | "android", 14 | "ios", 15 | "cpp", 16 | "react-native-otp-verify.podspec", 17 | "!lib/typescript/example", 18 | "!android/build", 19 | "!ios/build", 20 | "!**/__tests__", 21 | "!**/__fixtures__", 22 | "!**/__mocks__" 23 | ], 24 | "scripts": { 25 | "test": "jest", 26 | "typescript": "tsc --noEmit", 27 | "lint": "eslint \"**/*.{js,ts,tsx}\"", 28 | "prepare": "bob build", 29 | "release": "release-it", 30 | "example": "yarn --cwd example", 31 | "pods": "cd example && pod-install --quiet", 32 | "bootstrap": "yarn example && yarn && yarn pods" 33 | }, 34 | "keywords": [ 35 | "react-native", 36 | "ios", 37 | "android" 38 | ], 39 | "repository": "https://github.com/faizalshap/react-native-otp-verify", 40 | "author": "faizalshap (https://github.com/faizalshap)", 41 | "license": "MIT", 42 | "bugs": { 43 | "url": "https://github.com/faizalshap/react-native-otp-verify/issues" 44 | }, 45 | "homepage": "https://github.com/faizalshap/react-native-otp-verify#readme", 46 | "publishConfig": { 47 | "registry": "https://registry.npmjs.org/" 48 | }, 49 | "devDependencies": { 50 | "@commitlint/config-conventional": "^11.0.0", 51 | "@react-native-community/eslint-config": "^2.0.0", 52 | "@release-it/conventional-changelog": "^2.0.0", 53 | "@types/jest": "^26.0.0", 54 | "@types/react": "^16.9.19", 55 | "@types/react-native": "0.62.13", 56 | "commitlint": "^11.0.0", 57 | "eslint": "^7.2.0", 58 | "eslint-config-prettier": "^7.0.0", 59 | "eslint-plugin-prettier": "^3.1.3", 60 | "husky": "^6.0.0", 61 | "jest": "^26.0.1", 62 | "pod-install": "^0.1.0", 63 | "prettier": "^2.0.5", 64 | "react": "16.13.1", 65 | "react-native": "0.63.4", 66 | "react-native-builder-bob": "^0.18.0", 67 | "release-it": "^14.2.2", 68 | "typescript": "^4.1.3" 69 | }, 70 | "peerDependencies": { 71 | "react": "*", 72 | "react-native": "*" 73 | }, 74 | "jest": { 75 | "preset": "react-native", 76 | "modulePathIgnorePatterns": [ 77 | "/example/node_modules", 78 | "/lib/" 79 | ] 80 | }, 81 | "commitlint": { 82 | "extends": [ 83 | "@commitlint/config-conventional" 84 | ] 85 | }, 86 | "release-it": { 87 | "git": { 88 | "commitMessage": "chore: release ${version}", 89 | "tagName": "v${version}" 90 | }, 91 | "npm": { 92 | "publish": true 93 | }, 94 | "github": { 95 | "release": true 96 | }, 97 | "plugins": { 98 | "@release-it/conventional-changelog": { 99 | "preset": "angular" 100 | } 101 | } 102 | }, 103 | "eslintConfig": { 104 | "root": true, 105 | "extends": [ 106 | "@react-native-community", 107 | "prettier" 108 | ], 109 | "rules": { 110 | "prettier/prettier": [ 111 | "error", 112 | { 113 | "quoteProps": "consistent", 114 | "singleQuote": true, 115 | "tabWidth": 2, 116 | "trailingComma": "es5", 117 | "useTabs": false 118 | } 119 | ] 120 | } 121 | }, 122 | "eslintIgnore": [ 123 | "node_modules/", 124 | "lib/" 125 | ], 126 | "prettier": { 127 | "quoteProps": "consistent", 128 | "singleQuote": true, 129 | "tabWidth": 2, 130 | "trailingComma": "es5", 131 | "useTabs": false 132 | }, 133 | "react-native-builder-bob": { 134 | "source": "src", 135 | "output": "lib", 136 | "targets": [ 137 | "commonjs", 138 | "module", 139 | [ 140 | "typescript", 141 | { 142 | "project": "tsconfig.build.json" 143 | } 144 | ] 145 | ] 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /react-native-otp-verify.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 = "react-native-otp-verify" 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.homepage = package["homepage"] 10 | s.license = package["license"] 11 | s.authors = package["author"] 12 | 13 | s.platforms = { :ios => "10.0" } 14 | s.source = { :git => "https://github.com/faizalshap/react-native-otp-verify.git", :tag => "#{s.version}" } 15 | 16 | s.source_files = "ios/**/*.{h,m,mm}" 17 | 18 | s.dependency "React-Core" 19 | end 20 | -------------------------------------------------------------------------------- /scripts/bootstrap.js: -------------------------------------------------------------------------------- 1 | const os = require('os'); 2 | const path = require('path'); 3 | const child_process = require('child_process'); 4 | 5 | const root = path.resolve(__dirname, '..'); 6 | const args = process.argv.slice(2); 7 | const options = { 8 | cwd: process.cwd(), 9 | env: process.env, 10 | stdio: 'inherit', 11 | encoding: 'utf-8', 12 | }; 13 | 14 | if (os.type() === 'Windows_NT') { 15 | options.shell = true 16 | } 17 | 18 | let result; 19 | 20 | if (process.cwd() !== root || args.length) { 21 | // We're not in the root of the project, or additional arguments were passed 22 | // In this case, forward the command to `yarn` 23 | result = child_process.spawnSync('yarn', args, options); 24 | } else { 25 | // If `yarn` is run without arguments, perform bootstrap 26 | result = child_process.spawnSync('yarn', ['bootstrap'], options); 27 | } 28 | 29 | process.exitCode = result.status; 30 | -------------------------------------------------------------------------------- /src/__tests__/index.test.tsx: -------------------------------------------------------------------------------- 1 | it.todo('write a test'); 2 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import { NativeEventEmitter, NativeModules, Platform } from 'react-native'; 2 | import { useEffect, useState } from 'react'; 3 | 4 | const LINKING_ERROR = 5 | `The package 'react-native-otp-verify' doesn't seem to be linked. Make sure: \n\n` + 6 | Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + 7 | '- You rebuilt the app after installing the package\n' + 8 | '- You are not using Expo managed workflow\n'; 9 | 10 | const RNOtpVerify = NativeModules.OtpVerify 11 | ? NativeModules.OtpVerify 12 | : new Proxy( 13 | {}, 14 | { 15 | get() { 16 | throw new Error(LINKING_ERROR); 17 | }, 18 | } 19 | ); 20 | 21 | const eventEmitter = new NativeEventEmitter(RNOtpVerify); 22 | 23 | interface OtpVerify { 24 | getOtp: () => Promise; 25 | getHash: () => Promise; 26 | requestHint: () => Promise; 27 | startOtpListener: ( 28 | handler: (value: string) => any 29 | ) => Promise; 30 | addListener: ( 31 | handler: (value: string) => any 32 | ) => import('react-native').EmitterSubscription; 33 | removeListener: () => void; 34 | } 35 | 36 | export async function getOtp(): Promise { 37 | if (Platform.OS === 'ios') { 38 | console.warn('Not Supported on iOS'); 39 | return false; 40 | } 41 | return RNOtpVerify.getOtp(); 42 | } 43 | 44 | export function startOtpListener( 45 | handler: (value: string) => any 46 | ): Promise { 47 | return getOtp().then(() => addListener(handler)); 48 | } 49 | 50 | export const useOtpVerify = ({ numberOfDigits } = { numberOfDigits: 0 }) => { 51 | const [message, setMessage] = useState(null); 52 | const [otp, setOtp] = useState(null); 53 | const [timeoutError, setTimeoutError] = useState(false); 54 | const [hash, setHash] = useState([]); 55 | 56 | const handleMessage = (response: string) => { 57 | if (response === 'Timeout Error.') { 58 | setTimeoutError(true); 59 | } else { 60 | setMessage(response); 61 | if (numberOfDigits && response) { 62 | const otpDigits = new RegExp(`(\\d{${numberOfDigits}})`, 'g').exec(response); 63 | if (otpDigits && otpDigits[1]) setOtp(otpDigits[1]); 64 | } 65 | } 66 | }; 67 | useEffect(() => { 68 | if (Platform.OS === 'ios') { 69 | console.warn('Not Supported on iOS'); 70 | return; 71 | } 72 | getHash().then(setHash); 73 | startOtpListener(handleMessage); 74 | return () => { 75 | removeListener(); 76 | }; 77 | }, []); 78 | const startListener = () => { 79 | if (Platform.OS === 'ios') { 80 | console.warn('Not Supported on iOS'); 81 | return; 82 | } 83 | setOtp(''); 84 | setMessage(''); 85 | startOtpListener(handleMessage); 86 | }; 87 | const stopListener = () => { 88 | if (Platform.OS === 'ios') { 89 | console.warn('Not Supported on iOS'); 90 | return; 91 | } 92 | removeListener(); 93 | }; 94 | return { otp, message, hash, timeoutError, stopListener, startListener }; 95 | }; 96 | 97 | export async function getHash(): Promise { 98 | if (Platform.OS === 'ios') { 99 | console.warn('Not Supported on iOS'); 100 | return []; 101 | } 102 | return RNOtpVerify.getHash(); 103 | } 104 | export async function requestHint(): Promise { 105 | if (Platform.OS === 'ios') { 106 | console.warn('Not Supported on iOS'); 107 | return ''; 108 | } 109 | return RNOtpVerify.requestHint(); 110 | } 111 | 112 | export function addListener( 113 | handler: (value: string) => any 114 | ): import('react-native').EmitterSubscription { 115 | return eventEmitter.addListener( 116 | 'com.faizalshap.otpVerify:otpReceived', 117 | handler 118 | ); 119 | } 120 | 121 | export function removeListener(): void { 122 | return eventEmitter.removeAllListeners( 123 | 'com.faizalshap.otpVerify:otpReceived' 124 | ); 125 | } 126 | 127 | const OtpVerify: OtpVerify = { 128 | getOtp, 129 | getHash, 130 | addListener, 131 | removeListener, 132 | startOtpListener, 133 | requestHint, 134 | }; 135 | 136 | export default OtpVerify; 137 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "extends": "./tsconfig", 4 | "exclude": ["example"] 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "react-native-otp-verify": ["./src/index"] 6 | }, 7 | "allowUnreachableCode": false, 8 | "allowUnusedLabels": false, 9 | "esModuleInterop": true, 10 | "importsNotUsedAsValues": "error", 11 | "forceConsistentCasingInFileNames": true, 12 | "jsx": "react", 13 | "lib": ["esnext"], 14 | "module": "esnext", 15 | "moduleResolution": "node", 16 | "noFallthroughCasesInSwitch": true, 17 | "noImplicitReturns": true, 18 | "noImplicitUseStrict": false, 19 | "noStrictGenericChecks": false, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "resolveJsonModule": true, 23 | "skipLibCheck": true, 24 | "strict": true, 25 | "target": "esnext" 26 | } 27 | } 28 | --------------------------------------------------------------------------------