dojah-kyc-sdk-react-expo 0.1.1 → 0.1.2
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/README.md +46 -51
- package/app.json +5 -0
- package/build/DojahKycSdkReactExpoModule.d.ts.map +1 -1
- package/build/DojahKycSdkReactExpoModule.js.map +1 -1
- package/expo-module.config.json +15 -4
- package/ios/DojahKycScreenDelegate.swift +8 -0
- package/ios/DojahKycSdkReactExpo.podspec +2 -0
- package/ios/DojahKycSdkReactExpoModule.swift +165 -5
- package/package.json +6 -4
- package/plugin/withDojahKyc.js +109 -1
- package/src/DojahKycSdkReactExpoModule.ts +3 -3
package/README.md
CHANGED
|
@@ -6,67 +6,62 @@
|
|
|
6
6
|
npm install dojah-kyc-sdk-react-expo
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
## Setup
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
### Install expo-build-properties if you don't have it
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* Supported targetSdkVersion - 35
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Enable jetifier in grade.properties:
|
|
18
|
-
```
|
|
19
|
-
android.enableJetifier=true
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Permissions
|
|
23
|
-
|
|
24
|
-
For Android you don't need to declare permissions, its already included in the Package.
|
|
25
|
-
|
|
26
|
-
## IOS Setup
|
|
27
|
-
|
|
28
|
-
### Requirements
|
|
29
|
-
|
|
30
|
-
* Minimum iOS version - 14
|
|
31
|
-
|
|
32
|
-
### Add the following POD dependencies in your Podfile app under your App target
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
pod 'Realm', '~> 10.52.2', :modular_headers => true
|
|
36
|
-
pod 'DojahWidget', :git => 'https://github.com/dojah-inc/sdk-swift.git', :branch => 'pod-package'
|
|
13
|
+
```sh
|
|
14
|
+
npx expo install expo-build-properties
|
|
37
15
|
```
|
|
38
16
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
17
|
+
### Add the following plugins and permissions in your app.json
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"expo": {
|
|
21
|
+
...
|
|
22
|
+
"ios": {
|
|
23
|
+
"infoPlist": {
|
|
24
|
+
"NSLocationWhenInUseUsageDescription": "This app uses location services to provide a better experience.",
|
|
25
|
+
"NSLocationAlwaysUsageDescription": "This app uses location services to provide a better experience.",
|
|
26
|
+
"NSLocationUsageDescription": "This app uses location services to provide a better experience.",
|
|
27
|
+
"NSPhotoLibraryUsageDescription": "This app uses the photo library to provide a better experience.",
|
|
28
|
+
"NSCameraUsageDescription": "This app uses the camera to provide a better experience.",
|
|
29
|
+
"NSMicrophoneUsageDescription": "This app uses the microphone to provide a better experience."
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"plugins": [
|
|
33
|
+
...
|
|
34
|
+
"dojah-kyc-sdk-react-expo",
|
|
35
|
+
[
|
|
36
|
+
"expo-build-properties",
|
|
37
|
+
{
|
|
38
|
+
"ios": {
|
|
39
|
+
"extraPods": [
|
|
40
|
+
{
|
|
41
|
+
"name": "Realm",
|
|
42
|
+
"version": "~> 10.52.2",
|
|
43
|
+
"modular_headers": true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "DojahWidget",
|
|
47
|
+
"git": "https://github.com/dojah-inc/sdk-swift.git",
|
|
48
|
+
"branch": "pod-package"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
48
57
|
```
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
### Run prebuild:
|
|
51
60
|
|
|
52
61
|
```sh
|
|
53
|
-
|
|
54
|
-
pod install
|
|
62
|
+
npx expo prebuild
|
|
55
63
|
```
|
|
56
64
|
|
|
57
|
-
### Permissions
|
|
58
|
-
|
|
59
|
-
For IOS, Add the following keys to your Info.plist file:
|
|
60
|
-
|
|
61
|
-
NSCameraUsageDescription - describe why your app needs access to the camera. This is called
|
|
62
|
-
Privacy - Camera Usage Description in the visual editor.
|
|
63
|
-
|
|
64
|
-
NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend
|
|
65
|
-
to record videos. This is called Privacy - Microphone Usage Description in the visual editor.
|
|
66
|
-
|
|
67
|
-
NSLocationWhenInUseUsageDescription - describe why your app needs access to the location, if you
|
|
68
|
-
intend to verify address/location. This is called Privacy - Location Usage Description in the visual
|
|
69
|
-
editor.
|
|
70
65
|
|
|
71
66
|
## Usage
|
|
72
67
|
|
package/app.json
ADDED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DojahKycSdkReactExpoModule.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,OAAO,WAAY,SAAQ,YAAY,CAAC,gCAAgC,CAAC;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"DojahKycSdkReactExpoModule.d.ts","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,OAAO,WAAY,SAAQ,YAAY,CAAC,gCAAgC,CAAC;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAClD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GACrC,OAAO,CAAC,MAAM,CAAC;CACnB;;AAGD,wBAA+D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DojahKycSdkReactExpoModule.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAWzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAc,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';\n\ndeclare class DojahKycSdk extends NativeModule<DojahKycSdkReactExpoModuleEvents> {\n launch(widgetId: string, referenceId?: string | null,\n
|
|
1
|
+
{"version":3,"file":"DojahKycSdkReactExpoModule.js","sourceRoot":"","sources":["../src/DojahKycSdkReactExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAWzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAc,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo';\n\nimport { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';\n\ndeclare class DojahKycSdk extends NativeModule<DojahKycSdkReactExpoModuleEvents> {\n launch(widgetId: string, referenceId?: string | null,\n email?: string | null,\n extraData?: Record<string, any> | null\n ): Promise<string>;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<DojahKycSdk>('DojahKycSdk');\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"platforms": [
|
|
2
|
+
"platforms": [
|
|
3
|
+
"apple",
|
|
4
|
+
"android",
|
|
5
|
+
"web"
|
|
6
|
+
],
|
|
3
7
|
"apple": {
|
|
4
|
-
"modules": [
|
|
8
|
+
"modules": [
|
|
9
|
+
"DojahKycSdkReactExpoModule"
|
|
10
|
+
],
|
|
11
|
+
"appDelegateSubscribers": [
|
|
12
|
+
"DojahKycScreenDelegate"
|
|
13
|
+
]
|
|
5
14
|
},
|
|
6
15
|
"android": {
|
|
7
|
-
"modules": [
|
|
16
|
+
"modules": [
|
|
17
|
+
"com.dojah.dojah_Kyc_rn_expo.DojahKycSdkReactExpoModule"
|
|
18
|
+
]
|
|
8
19
|
}
|
|
9
|
-
}
|
|
20
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
|
+
import DojahWidget
|
|
2
3
|
|
|
3
4
|
public class DojahKycSdkReactExpoModule: Module {
|
|
4
5
|
// Each module class must implement the definition function. The definition consists of components
|
|
@@ -15,11 +16,26 @@ public class DojahKycSdkReactExpoModule: Module {
|
|
|
15
16
|
|
|
16
17
|
// Defines a JavaScript function that always returns a Promise and whose native code
|
|
17
18
|
// is by default dispatched on the different thread than the JavaScript runtime runs on.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
AsyncFunction("launch") { (widgetId: String, referenceId: String?, email: String?, extraData: ExtraDataRecord?,promise:Promise) in
|
|
20
|
+
|
|
21
|
+
guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else {
|
|
22
|
+
print("no root ctrl")
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
print("root ctrl: $\(String(describing: rootViewController))")
|
|
27
|
+
|
|
28
|
+
let navController = rootViewController as? UINavigationController
|
|
29
|
+
|
|
30
|
+
print("nav ctrl: $\(String(describing: navController))")
|
|
31
|
+
|
|
32
|
+
if(navController == nil){
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
DispatchQueue.main.async {
|
|
37
|
+
DojahWidgetSDK.initialize(widgetID: widgetId,referenceID: referenceId,emailAddress: email, navController: navController!)
|
|
38
|
+
}
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
// Enables the module to be used as a native view. Definition components that are accepted as part of the
|
|
@@ -36,3 +52,147 @@ public class DojahKycSdkReactExpoModule: Module {
|
|
|
36
52
|
}
|
|
37
53
|
}
|
|
38
54
|
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
struct ExtraDataRecord : Record {
|
|
59
|
+
@Field
|
|
60
|
+
var userData: UserRecord? = nil
|
|
61
|
+
|
|
62
|
+
@Field
|
|
63
|
+
var govData: GovDataRecord? = nil
|
|
64
|
+
|
|
65
|
+
@Field
|
|
66
|
+
var govId: GovIdRecord? = nil
|
|
67
|
+
|
|
68
|
+
@Field
|
|
69
|
+
var location: LocationRecord? = nil
|
|
70
|
+
|
|
71
|
+
@Field
|
|
72
|
+
var businessData: BusinessDataRecord? = nil
|
|
73
|
+
|
|
74
|
+
@Field
|
|
75
|
+
var address: String? = nil
|
|
76
|
+
|
|
77
|
+
@Field
|
|
78
|
+
var metadata: [String:Any]? = nil
|
|
79
|
+
|
|
80
|
+
// func toExtraUserData()-> ExtraUserData {
|
|
81
|
+
// return ExtraUserData(
|
|
82
|
+
// userData = userData?.toUserData(),
|
|
83
|
+
// govData = govData?.toGovData(),
|
|
84
|
+
// govId = govId?.toGovId(),
|
|
85
|
+
// location = location?.toLocation(),
|
|
86
|
+
// businessData = businessData?.toBusinessData(),
|
|
87
|
+
// address = address,
|
|
88
|
+
// metadata = metadata
|
|
89
|
+
// )
|
|
90
|
+
// }
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
struct UserRecord : Record {
|
|
96
|
+
@Field
|
|
97
|
+
var firstName: String? = nil
|
|
98
|
+
|
|
99
|
+
@Field
|
|
100
|
+
var lastName: String? = nil
|
|
101
|
+
|
|
102
|
+
@Field
|
|
103
|
+
var dob: String? = nil
|
|
104
|
+
|
|
105
|
+
@Field
|
|
106
|
+
var email: String? = nil
|
|
107
|
+
|
|
108
|
+
// func toUserData(): UserData {
|
|
109
|
+
// return UserData(
|
|
110
|
+
// firstName = firstName,
|
|
111
|
+
// lastName = lastName,
|
|
112
|
+
// dob = dob,
|
|
113
|
+
// email = email
|
|
114
|
+
// )
|
|
115
|
+
// }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
struct GovDataRecord : Record {
|
|
119
|
+
|
|
120
|
+
@Field
|
|
121
|
+
var bvn: String? = nil
|
|
122
|
+
|
|
123
|
+
@Field
|
|
124
|
+
var dl: String? = nil
|
|
125
|
+
|
|
126
|
+
@Field
|
|
127
|
+
var nin: String? = nil
|
|
128
|
+
|
|
129
|
+
@Field
|
|
130
|
+
var vnin: String? = nil
|
|
131
|
+
|
|
132
|
+
// func toGovData(): GovData {
|
|
133
|
+
// return GovData(
|
|
134
|
+
// bvn = bvn,
|
|
135
|
+
// dl = dl,
|
|
136
|
+
// nin = nin,
|
|
137
|
+
// vnin = vnin
|
|
138
|
+
// )
|
|
139
|
+
// }
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
struct GovIdRecord : Record {
|
|
143
|
+
@Field
|
|
144
|
+
var national: String? = nil
|
|
145
|
+
|
|
146
|
+
@Field
|
|
147
|
+
var passport: String? = nil
|
|
148
|
+
|
|
149
|
+
@Field
|
|
150
|
+
var dl: String? = nil
|
|
151
|
+
|
|
152
|
+
@Field
|
|
153
|
+
var voter: String? = nil
|
|
154
|
+
|
|
155
|
+
@Field
|
|
156
|
+
var nin: String? = nil
|
|
157
|
+
|
|
158
|
+
@Field
|
|
159
|
+
var others: String? = nil
|
|
160
|
+
|
|
161
|
+
// func toGovId(): GovId {
|
|
162
|
+
// return GovId(
|
|
163
|
+
// national = national,
|
|
164
|
+
// passport = passport,
|
|
165
|
+
// dl = dl,
|
|
166
|
+
// voter = voter,
|
|
167
|
+
// nin = nin,
|
|
168
|
+
// others = others
|
|
169
|
+
// )
|
|
170
|
+
// }
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
struct LocationRecord : Record {
|
|
174
|
+
@Field
|
|
175
|
+
var latitude: String? = nil
|
|
176
|
+
|
|
177
|
+
@Field
|
|
178
|
+
var longitude: String? = nil
|
|
179
|
+
|
|
180
|
+
// func toLocation(): Location {
|
|
181
|
+
// return Location(
|
|
182
|
+
// latitude = latitude,
|
|
183
|
+
// longitude = longitude
|
|
184
|
+
// )
|
|
185
|
+
// }
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
struct BusinessDataRecord : Record {
|
|
189
|
+
@Field
|
|
190
|
+
var cac: String? = nil
|
|
191
|
+
|
|
192
|
+
// func toBusinessData(): BusinessData {
|
|
193
|
+
// return BusinessData(
|
|
194
|
+
// cac = cac
|
|
195
|
+
// )
|
|
196
|
+
// }
|
|
197
|
+
}
|
|
198
|
+
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dojah-kyc-sdk-react-expo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Dojah Kyc",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
|
-
|
|
7
|
+
"expo": {
|
|
8
8
|
"plugins": [
|
|
9
9
|
"./app.plugin.js"
|
|
10
10
|
]
|
|
@@ -33,16 +33,18 @@
|
|
|
33
33
|
"author": "dojah-inc < dojah-inc@dojah.io> (https://github.com/dojah-inc)",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"homepage": "https://github.com/dojah-inc/dojah_kyc_sdk_rn_expo#readme",
|
|
36
|
-
"dependencies": {},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@types/react": "~19.0.0",
|
|
39
|
-
"expo-module-scripts": "^4.1.6",
|
|
40
38
|
"expo": "~53.0.0",
|
|
39
|
+
"expo-module-scripts": "^4.1.6",
|
|
41
40
|
"react-native": "0.79.1"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"expo": "*",
|
|
45
44
|
"react": "*",
|
|
46
45
|
"react-native": "*"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"expo-build-properties": "~0.14.6"
|
|
47
49
|
}
|
|
48
50
|
}
|
package/plugin/withDojahKyc.js
CHANGED
|
@@ -3,17 +3,23 @@ const {
|
|
|
3
3
|
withAppBuildGradle,
|
|
4
4
|
withSettingsGradle,
|
|
5
5
|
withGradleProperties,
|
|
6
|
+
withAppDelegate,
|
|
7
|
+
WarningAggregator,
|
|
6
8
|
} = require('@expo/config-plugins');
|
|
9
|
+
|
|
7
10
|
const path = require('path');
|
|
8
11
|
|
|
9
12
|
const withDojahKyc = config => {
|
|
10
13
|
return withPlugins(config, [
|
|
11
14
|
// withAppBuildGradleModification,
|
|
12
15
|
// withSettingsGradleModification,
|
|
13
|
-
|
|
16
|
+
withGradlePropertiesModification,
|
|
17
|
+
withCustomSwiftAppDelegateRootView,
|
|
18
|
+
withCustomObjcAppDelegateRootView,
|
|
14
19
|
]);
|
|
15
20
|
};
|
|
16
21
|
|
|
22
|
+
|
|
17
23
|
function withAppBuildGradleModification(config) {
|
|
18
24
|
return withAppBuildGradle(config, config => {
|
|
19
25
|
if (!config.modResults.contents.includes("project(':dojah_Kyc_rn_expo')")) {
|
|
@@ -41,6 +47,7 @@ function withSettingsGradleModification(config) {
|
|
|
41
47
|
|
|
42
48
|
function withGradlePropertiesModification(config) {
|
|
43
49
|
return withGradleProperties(config, (config) => {
|
|
50
|
+
|
|
44
51
|
if (!config.modResults) {
|
|
45
52
|
config.modResults = [];
|
|
46
53
|
}
|
|
@@ -60,5 +67,106 @@ function withGradlePropertiesModification(config) {
|
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
|
|
70
|
+
const CUSTOM_CREATE_ROOT_VIEW = `
|
|
71
|
+
override func createRootViewController() -> UIViewController {
|
|
72
|
+
let rootVC = UIViewController()
|
|
73
|
+
let nav = UINavigationController(rootViewController: rootVC)
|
|
74
|
+
return nav
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
override func setRootView(_ rootView: UIView, toRootViewController rootViewController: UIViewController) {
|
|
78
|
+
if let nav = rootViewController as? UINavigationController,
|
|
79
|
+
let firstVC = nav.viewControllers.first {
|
|
80
|
+
firstVC.view = rootView
|
|
81
|
+
} else {
|
|
82
|
+
rootViewController.view = rootView
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
const withCustomSwiftAppDelegateRootView = config => {
|
|
88
|
+
return withAppDelegate(config, config => {
|
|
89
|
+
const contents = config.modResults.contents;
|
|
90
|
+
|
|
91
|
+
const classStart = contents.indexOf("class ReactNativeDelegate");
|
|
92
|
+
if (classStart === -1) {
|
|
93
|
+
WarningAggregator.addWarningIOS(
|
|
94
|
+
"withCustomRootView",
|
|
95
|
+
"`ReactNativeDelegate` not found in AppDelegate.swift"
|
|
96
|
+
);
|
|
97
|
+
return config;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const insertionPoint = contents.indexOf("{", classStart) + 1;
|
|
101
|
+
|
|
102
|
+
const newContents =
|
|
103
|
+
contents.slice(0, insertionPoint) +
|
|
104
|
+
"\n" +
|
|
105
|
+
CUSTOM_CREATE_ROOT_VIEW +
|
|
106
|
+
"\n" +
|
|
107
|
+
contents.slice(insertionPoint);
|
|
108
|
+
|
|
109
|
+
config.modResults.contents = newContents;
|
|
110
|
+
|
|
111
|
+
return config;
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const NAV_CONTROLLER_SETUP = `
|
|
116
|
+
// Injected by withObjcNavigationRoot config plugin
|
|
117
|
+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
118
|
+
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
|
119
|
+
moduleName:@"main"
|
|
120
|
+
initialProperties:nil];
|
|
121
|
+
|
|
122
|
+
UIViewController *rootViewController = [UIViewController new];
|
|
123
|
+
rootViewController.view = rootView;
|
|
124
|
+
|
|
125
|
+
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
|
|
126
|
+
|
|
127
|
+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
128
|
+
self.window.rootViewController = navigationController;
|
|
129
|
+
[self.window makeKeyAndVisible];
|
|
130
|
+
`;
|
|
131
|
+
|
|
132
|
+
const withCustomObjcAppDelegateRootView = config => {
|
|
133
|
+
return withAppDelegate(config, config => {
|
|
134
|
+
let contents = config.modResults.contents;
|
|
135
|
+
|
|
136
|
+
// Check it's Obj-C
|
|
137
|
+
if (!contents.includes("@implementation AppDelegate")) {
|
|
138
|
+
WarningAggregator.addWarningIOS(
|
|
139
|
+
"withObjcNavigationRoot",
|
|
140
|
+
"AppDelegate.m does not appear to be an Objective-C file."
|
|
141
|
+
);
|
|
142
|
+
return config;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Match the method and locate the `return` statement
|
|
146
|
+
const didFinishPattern = /(-\s*\(BOOL\)application:\(UIApplication \*\)application didFinishLaunchingWithOptions:\(NSDictionary \*\)launchOptions\s*\{)([\s\S]*?)(\s+return\s+\[super application:application didFinishLaunchingWithOptions:launchOptions];[\s\S]*?\})/;
|
|
147
|
+
|
|
148
|
+
const match = contents.match(didFinishPattern);
|
|
149
|
+
|
|
150
|
+
if (!match) {
|
|
151
|
+
WarningAggregator.addWarningIOS(
|
|
152
|
+
"withObjcNavigationRoot",
|
|
153
|
+
"`application:didFinishLaunchingWithOptions:` method not found in AppDelegate.m"
|
|
154
|
+
);
|
|
155
|
+
return config;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const [fullMatch, methodStart, methodBody, methodEnd] = match;
|
|
159
|
+
|
|
160
|
+
// Inject just before the return
|
|
161
|
+
const updatedBody = `${methodBody.trimEnd()}\n${NAV_CONTROLLER_SETUP}\n`;
|
|
162
|
+
|
|
163
|
+
const newMethod = `${methodStart}${updatedBody}${methodEnd}`;
|
|
164
|
+
contents = contents.replace(didFinishPattern, newMethod);
|
|
165
|
+
|
|
166
|
+
config.modResults.contents = contents;
|
|
167
|
+
return config;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
63
171
|
|
|
64
172
|
module.exports = withDojahKyc;
|
|
@@ -4,9 +4,9 @@ import { DojahKycSdkReactExpoModuleEvents } from './DojahKycSdkReactExpo.types';
|
|
|
4
4
|
|
|
5
5
|
declare class DojahKycSdk extends NativeModule<DojahKycSdkReactExpoModuleEvents> {
|
|
6
6
|
launch(widgetId: string, referenceId?: string | null,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
email?: string | null,
|
|
8
|
+
extraData?: Record<string, any> | null
|
|
9
|
+
): Promise<string>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// This call loads the native module object from the JSI.
|