Skip to content

Commit c16faec

Browse files
authored
Merge pull request #6 from complycube/updateVersion
Refactor project structure and update configurations for app
2 parents 352ad8f + 499fe4b commit c16faec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+427
-2000
lines changed

.eslintrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

App.jsx

Lines changed: 0 additions & 82 deletions
This file was deleted.

App.tsx

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import React from 'react';
2+
import { ComplyCube } from '@complycube/react-native';
3+
import { useEffect, useState } from 'react';
4+
import {
5+
SafeAreaView,
6+
StatusBar,
7+
useColorScheme,
8+
View,
9+
Text,
10+
StyleSheet,
11+
TouchableOpacity,
12+
} from 'react-native';
13+
14+
const settings = {
15+
clientID: 'CLIENT_ID',
16+
clientToken: 'SDK_TOKEN',
17+
stages: [
18+
{
19+
name: 'intro',
20+
heading: 'Custom Screen Title',
21+
message: 'Custom welcome message.',
22+
},
23+
{
24+
name: 'documentCapture',
25+
documentTypes: {
26+
passport: true,
27+
driving_license: ['GB', 'US'],
28+
},
29+
},
30+
'faceCapture',
31+
],
32+
};
33+
34+
function App() {
35+
const isDarkMode = useColorScheme() === 'dark';
36+
const [showSDK, setShowSDK] = useState(false);
37+
38+
useEffect(() => {
39+
// Initialization logic (if needed)
40+
}, []);
41+
42+
return (
43+
<SafeAreaView style={styles.safeArea}>
44+
<StatusBar />
45+
<View style={styles.container}>
46+
<Text style={styles.header}>Identity Verification</Text>
47+
<TouchableOpacity
48+
style={styles.button}
49+
onPress={() => setShowSDK(true)}
50+
>
51+
<Text style={styles.buttonText}>Start Verification</Text>
52+
</TouchableOpacity>
53+
54+
{showSDK && (
55+
<View style={styles.sdkContainer}>
56+
<ComplyCube
57+
settings={settings}
58+
onSuccess={() => setShowSDK(false)}
59+
onError={() => setShowSDK(false)}
60+
onCancel={() => setShowSDK(false)}
61+
/>
62+
</View>
63+
)}
64+
</View>
65+
</SafeAreaView>
66+
);
67+
}
68+
69+
const styles = StyleSheet.create({
70+
safeArea: {
71+
flex: 1,
72+
backgroundColor: '#fff',
73+
},
74+
container: {
75+
flex: 1,
76+
padding: 20,
77+
justifyContent: 'center',
78+
alignItems: 'center',
79+
backgroundColor: '#fff',
80+
},
81+
header: {
82+
fontSize: 24,
83+
fontWeight: 'bold',
84+
textAlign: 'center',
85+
marginBottom: 30,
86+
color: '#333',
87+
},
88+
button: {
89+
backgroundColor: '#007AFF',
90+
padding: 15,
91+
borderRadius: 8,
92+
alignItems: 'center',
93+
marginHorizontal: 20,
94+
},
95+
buttonText: {
96+
color: 'white',
97+
fontSize: 16,
98+
fontWeight: '500',
99+
},
100+
sdkContainer: {
101+
flex: 1,
102+
marginTop: 20,
103+
backgroundColor: 'white',
104+
},
105+
});
106+
107+
export default App;

Gemfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,14 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.13'
7-
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9+
gem 'xcodeproj', '< 1.26.0'
10+
gem 'concurrent-ruby', '< 1.3.4'
11+
12+
# Ruby 3.4.0 has removed some libraries from the standard library.
13+
gem 'bigdecimal'
14+
gem 'logger'
15+
gem 'benchmark'
16+
gem 'mutex_m'

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@ This repository provides a pre-built UI that uses the ComplyCube SDK. It guides
66
77
## To run the app
88

9-
### Install CocoaPods
9+
### Before you start
1010

11-
1. Before using the ComplyCube SDK, install the CocoaPods Artifactory plugin by running the following command in your terminal:
11+
1. Install [Node.js](https://nodejs.org/en/download/).
12+
2. Install [Android Studio](https://developer.android.com/studio) and [Xcode](https://developer.apple.com/xcode/).
13+
3. Clone this repository.
1214

13-
```bash
14-
gem install cocoapods-art
15-
```
16-
17-
2. To add the library, copy your repository credentials into a `.netrc` file to your home directory and setup the repository:
15+
```bash
16+
git clone https://github.com/complycube/complycube-react-native-sdk.git
17+
```
1818

19-
```bash
20-
pod repo-art add cc-cocoapods-release-local "https://complycuberepo.jfrog.io/artifactory/api/pods/cc-cocoapods-release-local"
21-
```
19+
4. Install dependencies.
2220

23-
### Add Artifactory Credentials for Gradle
21+
```bash
22+
cd complycube-react-native-sdk
23+
npm install
24+
```
2425

25-
1. In the `android/gradle.properties` file, replace `ARTIFACTORY_USER` and `ARTIFACTORY_PASSWORD` with your JFrog Username and the encrypted JFrog Password.
26+
>#### iOS only
27+
>Install CocoaPods dependencies. <br/>
28+
>- `cd ios` <br/>
29+
>- `pod install`
2630
2731
### Run the apps
2832

__tests__/App.test.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
* @format
33
*/
44

5-
import 'react-native';
65
import React from 'react';
6+
import ReactTestRenderer from 'react-test-renderer';
77
import App from '../App';
88

9-
// Note: import explicitly to use the types shipped with jest.
10-
import {it} from '@jest/globals';
11-
12-
// Note: test renderer must be required after react-native.
13-
import renderer from 'react-test-renderer';
14-
15-
it('renders correctly', () => {
16-
renderer.create(<App />);
9+
test('renders correctly', async () => {
10+
await ReactTestRenderer.act(() => {
11+
ReactTestRenderer.create(<App />);
12+
});
1713
});

android/app/build.gradle

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ apply plugin: "com.facebook.react"
88
*/
99
react {
1010
/* Folders */
11-
// The root of your project, i.e. where "package.json" lives. Default is '..'
12-
// root = file("../")
13-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
14-
// reactNativeDir = file("../node_modules/react-native")
15-
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16-
// codegenDir = file("../node_modules/@react-native/codegen")
17-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18-
// cliFile = file("../node_modules/react-native/cli.js")
11+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
12+
// root = file("../../")
13+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14+
// reactNativeDir = file("../../node_modules/react-native")
15+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16+
// codegenDir = file("../../node_modules/@react-native/codegen")
17+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18+
// cliFile = file("../../node_modules/react-native/cli.js")
1919

2020
/* Variants */
2121
// The list of variants to that are debuggable. For those we're going to
@@ -49,6 +49,9 @@ react {
4949
//
5050
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5151
// hermesFlags = ["-O", "-output-source-map"]
52+
53+
/* Autolinking */
54+
autolinkLibrariesWithApp()
5255
}
5356

5457
/**
@@ -60,23 +63,23 @@ def enableProguardInReleaseBuilds = false
6063
* The preferred build flavor of JavaScriptCore (JSC)
6164
*
6265
* For example, to use the international variant, you can use:
63-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
66+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
6467
*
6568
* The international variant includes ICU i18n library and necessary data
6669
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
6770
* give correct results when using with locales other than en-US. Note that
6871
* this variant is about 6MiB larger per architecture than default.
6972
*/
70-
def jscFlavor = 'org.webkit:android-jsc:+'
73+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7174

7275
android {
7376
ndkVersion rootProject.ext.ndkVersion
7477
buildToolsVersion rootProject.ext.buildToolsVersion
7578
compileSdk rootProject.ext.compileSdkVersion
7679

77-
namespace "com.rnofficial1"
80+
namespace "com.test2"
7881
defaultConfig {
79-
applicationId "com.rnofficial1"
82+
applicationId "com.test2"
8083
minSdkVersion rootProject.ext.minSdkVersion
8184
targetSdkVersion rootProject.ext.targetSdkVersion
8285
versionCode 1
@@ -107,13 +110,10 @@ android {
107110
dependencies {
108111
// The version of react-native is set by the React Native Gradle Plugin
109112
implementation("com.facebook.react:react-android")
110-
implementation("com.facebook.react:flipper-integration")
111113

112114
if (hermesEnabled.toBoolean()) {
113115
implementation("com.facebook.react:hermes-android")
114116
} else {
115117
implementation jscFlavor
116118
}
117119
}
118-
119-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
android:icon="@mipmap/ic_launcher"
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
11-
android:theme="@style/AppTheme">
11+
android:theme="@style/AppTheme"
12+
android:supportsRtl="true">
1213
<activity
1314
android:name=".MainActivity"
1415
android:label="@string/app_name"

android/app/src/main/java/com/rnofficial1/MainActivity.kt renamed to android/app/src/main/java/com/test2/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.rnofficial1
1+
package com.test2
22

33
import com.facebook.react.ReactActivity
44
import com.facebook.react.ReactActivityDelegate
@@ -11,7 +11,7 @@ class MainActivity : ReactActivity() {
1111
* Returns the name of the main component registered from JavaScript. This is used to schedule
1212
* rendering of the component.
1313
*/
14-
override fun getMainComponentName(): String = "RNofficial1"
14+
override fun getMainComponentName(): String = "Test2"
1515

1616
/**
1717
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]

0 commit comments

Comments
 (0)