@reclaimprotocol/inapp-rn-sdk 0.9.4-alpha.3 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/InappRnSdk.podspec +1 -1
- package/README.md +17 -184
- package/android/build.gradle +1 -1
- package/ios/InappRnSdk.mm +18 -0
- package/ios/inapp_rn_sdk/Api.swift +7 -1
- package/package.json +1 -1
package/InappRnSdk.podspec
CHANGED
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
|
|
18
18
|
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
19
19
|
s.private_header_files = "ios/generated/**/*.h"
|
|
20
|
-
s.dependency "ReclaimInAppSdk", "~> 0.
|
|
20
|
+
s.dependency "ReclaimInAppSdk", "~> 0.10.0"
|
|
21
21
|
|
|
22
22
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
23
23
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/README.md
CHANGED
|
@@ -18,195 +18,17 @@ This SDK allows you to integrate Reclaim's in-app verification process into your
|
|
|
18
18
|
## Example
|
|
19
19
|
|
|
20
20
|
- See the [Reclaim Example - React Native](samples/example_new_arch/README.md) for a complete example of how to use the SDK in a React Native application.
|
|
21
|
+
- See the [Reclaim Example - React Native Expo](samples/example_expo/README.md) for a complete example of how to use the SDK in a React Native Expo application.
|
|
21
22
|
|
|
22
23
|
## Installation
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
npm install @reclaimprotocol/inapp-rn-sdk
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Alternative: Install from git source
|
|
29
|
-
|
|
30
|
-
#### NPM
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
npm install git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
#### Yarn
|
|
37
|
-
|
|
38
|
-
```sh
|
|
39
|
-
yarn add git+https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk.git
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Setup
|
|
43
|
-
|
|
44
|
-
### Android Setup
|
|
45
|
-
|
|
46
|
-
Add the following to your `android/app/src/main/AndroidManifest.xml` file under the `<application>` tag:
|
|
47
|
-
|
|
48
|
-
```xml
|
|
49
|
-
<activity
|
|
50
|
-
android:name="org.reclaimprotocol.inapp_sdk.ReclaimActivity"
|
|
51
|
-
android:theme="@style/Theme.ReclaimInAppSdk.LaunchTheme"
|
|
52
|
-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
|
53
|
-
android:hardwareAccelerated="true"
|
|
54
|
-
android:windowSoftInputMode="adjustResize"
|
|
55
|
-
/>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
add the following to the end of settings.gradle:
|
|
59
|
-
|
|
60
|
-
```groovy
|
|
61
|
-
dependencyResolutionManagement {
|
|
62
|
-
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
|
63
|
-
String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
|
|
64
|
-
String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/repo"
|
|
65
|
-
repositories {
|
|
66
|
-
google()
|
|
67
|
-
mavenCentral()
|
|
68
|
-
maven {
|
|
69
|
-
url "$reclaimStorageUrl"
|
|
70
|
-
}
|
|
71
|
-
maven {
|
|
72
|
-
url "$flutterStorageUrl/download.flutter.io"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
(Ignore if already added in settings.gradle from above)
|
|
79
|
-
or alternatively add the following repositories to the relevant repositories block:
|
|
80
|
-
|
|
81
|
-
```groovy
|
|
82
|
-
String flutterStorageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com"
|
|
83
|
-
String reclaimStorageUrl = System.env.RECLAIM_STORAGE_BASE_URL ?: "https://reclaim-inapp-sdk.s3.ap-south-1.amazonaws.com/android/repo"
|
|
84
|
-
maven {
|
|
85
|
-
url "$reclaimStorageUrl"
|
|
86
|
-
}
|
|
87
|
-
maven {
|
|
88
|
-
url "$flutterStorageUrl/download.flutter.io"
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Some projects may require you to add the repositories to the root `build.gradle` file or your app-level `build.gradle` file's allprojects section.
|
|
93
|
-
|
|
94
|
-
### iOS Setup
|
|
95
|
-
|
|
96
|
-
1. Make sure to define a global platform for your project in your `Podfile` with version 13.0 or higher.
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
platform :ios, '13.0' # or platform :ios, min_ios_version_supported
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Ignore if you already have this declaration in your `Podfile`.
|
|
103
|
-
|
|
104
|
-
2. Add the following to your `Podfile` to override SDK dependency:
|
|
105
|
-
|
|
106
|
-
- You can override the version of dependency when you wish to use a specific version of the SDK.
|
|
107
|
-
- You can add a declaration in your `Podfile` to install the SDK from cocoapods, or from a specific git tag, head, commit, or branch.
|
|
108
|
-
|
|
109
|
-
##### From cocoapods (recommended)
|
|
110
|
-
|
|
111
|
-
```ruby
|
|
112
|
-
# Cocoapods is the recommended way to install the SDK.
|
|
113
|
-
pod 'ReclaimInAppSdk', '~> 0.9.2'
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
##### From a specific tag
|
|
117
|
-
|
|
118
|
-
```ruby
|
|
119
|
-
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :tag => '0.9.2'
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
##### From git HEAD
|
|
123
|
-
|
|
124
|
-
```ruby
|
|
125
|
-
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git'
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
##### From a specific commit
|
|
129
|
-
|
|
130
|
-
```ruby
|
|
131
|
-
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :commit => 'eeb5a5484a5927217065e5c988fab8201cb2db2e'
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
##### From a specific branch
|
|
135
|
-
|
|
136
|
-
```ruby
|
|
137
|
-
pod 'ReclaimInAppSdk', :git => 'https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk.git', :branch => 'main'
|
|
138
|
-
```
|
|
25
|
+
Choose the appropriate installation guide based on your project setup:
|
|
139
26
|
|
|
140
|
-
|
|
27
|
+
**For React Native projects without Expo:**
|
|
28
|
+
📖 [Installation Guide for React Native (No Framework)](documentation/install-no-framework.md)
|
|
141
29
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
# ... some podfile content (removed for brevity)
|
|
146
|
-
|
|
147
|
-
target 'InappRnSdkExample' do
|
|
148
|
-
config = use_native_modules!
|
|
149
|
-
|
|
150
|
-
use_react_native!(
|
|
151
|
-
:path => config[:reactNativePath],
|
|
152
|
-
:app_path => "#{Pod::Config.instance.installation_root}/.."
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
# This is the line that you may need to add in your podfile.
|
|
156
|
-
pod 'ReclaimInAppSdk', '~> 0.9.2'
|
|
157
|
-
|
|
158
|
-
pre_install do |installer|
|
|
159
|
-
system("cd ../../ && npx bob build --target codegen")
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
# ... rest of the podfile. (removed for brevity)
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
3. Run `pod install` inside the `ios/` directory of your project.
|
|
166
|
-
|
|
167
|
-
```sh
|
|
168
|
-
cd ios/
|
|
169
|
-
pod install
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
#### Fixing performance issues on IOS physical devices
|
|
173
|
-
|
|
174
|
-
Your app performance will be severely impacted when you run debug executable on a physical device. Fixing this requires a simple change in your Xcode project xcscheme.
|
|
175
|
-
|
|
176
|
-
##### Method 1: Update Environment Variables for XCScheme (Recommended)
|
|
177
|
-
1. Open your iOS project (*.xcworkspace) in Xcode.
|
|
178
|
-
2. Click on the project target.
|
|
179
|
-
3. Click on the **Scheme** dropdown.
|
|
180
|
-
|
|
181
|
-
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/10.png?raw=true" alt="Edit current xcscheme in Xcode" width="500">
|
|
182
|
-
|
|
183
|
-
4. Click on the **Edit Scheme** button.
|
|
184
|
-
5. Click on the **Run** tab.
|
|
185
|
-
6. Click on the **Arguments** tab and check the **Environment Variables** section.
|
|
186
|
-
|
|
187
|
-
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/12.png?raw=true" alt="Enable Debug executable in Xcode" width="500">
|
|
188
|
-
|
|
189
|
-
7. Add the following environment variable:
|
|
190
|
-
- Key: `GODEBUG`
|
|
191
|
-
- Value: `asyncpreemptoff=1`
|
|
192
|
-
8. Click on the **Close** button in the dialog and build the project.
|
|
193
|
-
9. Run the app on a physical device.
|
|
194
|
-
|
|
195
|
-
##### Method 2: Disable "Debug executable"
|
|
196
|
-
|
|
197
|
-
This method is **not recommended** but could be useful if you don't want to add environment variables to the xcscheme.
|
|
198
|
-
|
|
199
|
-
1. Open your iOS project (*.xcworkspace) in Xcode.
|
|
200
|
-
2. Click on the project target.
|
|
201
|
-
3. Click on the **Scheme** dropdown.
|
|
202
|
-
|
|
203
|
-
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/10.png?raw=true" alt="Edit current xcscheme in Xcode" width="500">
|
|
204
|
-
|
|
205
|
-
4. Click on the **Edit Scheme** button.
|
|
206
|
-
5. Click on the **Run** tab.
|
|
207
|
-
6. Uncheck the **Debug executable** checkbox.
|
|
208
|
-
|
|
209
|
-
<img src="https://github.com/reclaimprotocol/reclaim-inapp-ios-sdk/blob/83f23570a47828d011b713679852053acdba89c1/Screenshots/Install/11.png?raw=true" alt="Enable Debug executable in Xcode" width="500">
|
|
30
|
+
**For React Native Expo projects:**
|
|
31
|
+
📖 [Installation Guide for React Native Expo](documentation/install-expo.md)
|
|
210
32
|
|
|
211
33
|
## Usage
|
|
212
34
|
|
|
@@ -292,12 +114,23 @@ error.innerError
|
|
|
292
114
|
|
|
293
115
|
## Troubleshooting
|
|
294
116
|
|
|
117
|
+
### iOS build issues
|
|
118
|
+
|
|
119
|
+
Incase you get errors which say `CocoaPods could not find compatible versions for pod "ReclaimInAppSdk"`, run the following in your project's `ios/` directory:
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
bundle exec pod update ReclaimInAppSdk
|
|
123
|
+
# or
|
|
124
|
+
pod update ReclaimInAppSdk
|
|
125
|
+
```
|
|
126
|
+
|
|
295
127
|
### Build failures for iOS in 0.7.x
|
|
296
128
|
|
|
297
129
|
- An accidental breaking change may cause 0.7.0, 0.7.1, 0.7.2 to fail with build failures for Android and iOS. Update 0.7.3 fixes this issue.
|
|
298
130
|
|
|
299
131
|
## Migration
|
|
300
132
|
|
|
133
|
+
- Migration steps for [0.10.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#0100)
|
|
301
134
|
- Migration steps for [0.9.2](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#092)
|
|
302
135
|
- Migration steps for [0.9.1](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#091)
|
|
303
136
|
- Migration steps for [0.9.0](https://github.com/reclaimprotocol/reclaim-inapp-reactnative-sdk/blob/main/documentation/migration.md#090)
|
package/android/build.gradle
CHANGED
|
@@ -118,7 +118,7 @@ dependencies {
|
|
|
118
118
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
119
119
|
|
|
120
120
|
//noinspection UseTomlInstead
|
|
121
|
-
implementation "org.reclaimprotocol:inapp_sdk:0.
|
|
121
|
+
implementation "org.reclaimprotocol:inapp_sdk:0.10.0"
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (isNewArchitectureEnabled()) {
|
package/ios/InappRnSdk.mm
CHANGED
|
@@ -132,6 +132,24 @@ Api *api = [[Api alloc] init];
|
|
|
132
132
|
}];
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
- (void)startVerificationFromJson:(nonnull NSString *)templateJsonString resolve:(nonnull RCTPromiseResolveBlock)resolve reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
136
|
+
NSLog(@"[InappRnSdk] starting verification");
|
|
137
|
+
|
|
138
|
+
NSLog(@"[InappRnSdk] starting verification now");
|
|
139
|
+
[api startVerificationFromJsonWithTemplate:templateJsonString
|
|
140
|
+
completionHandler:^(
|
|
141
|
+
NSDictionary<NSString *, id> *_Nullable result,
|
|
142
|
+
NSError *_Nullable error) {
|
|
143
|
+
if (error != nil) {
|
|
144
|
+
NSLog(@"[InappRnSdk] Api Error: %@", error);
|
|
145
|
+
reject(@"VERIFICATION_ERROR", @"Verification Error",
|
|
146
|
+
error);
|
|
147
|
+
} else {
|
|
148
|
+
resolve(result);
|
|
149
|
+
}
|
|
150
|
+
}];
|
|
151
|
+
}
|
|
152
|
+
|
|
135
153
|
- (void)setOverrides:(JS::NativeInappRnSdk::Overrides &)overrides
|
|
136
154
|
resolve:(nonnull RCTPromiseResolveBlock)resolve
|
|
137
155
|
reject:(nonnull RCTPromiseRejectBlock)reject {
|
|
@@ -126,7 +126,13 @@ import ReclaimInAppSdk
|
|
|
126
126
|
) async throws -> [String: Any] {
|
|
127
127
|
return try await startVerificationWithRequest(.url(url))
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
|
|
130
|
+
@objc public func startVerificationFromJson(
|
|
131
|
+
template: String
|
|
132
|
+
) async throws -> [String: Any] {
|
|
133
|
+
return try await startVerificationWithRequest(.json(JSONUtility.fromString(template) as? [AnyHashable?: Sendable?] ?? [:]))
|
|
134
|
+
}
|
|
135
|
+
|
|
130
136
|
@objc public func setOverrides(
|
|
131
137
|
provider: OverridenProviderInformation?,
|
|
132
138
|
featureOptions: OverridenFeatureOptions?,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/inapp-rn-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Reclaim Protocol's InApp React Native SDK for ZK proof generations for requests with an in-app experience of web verification",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|