react-native-persona 1.2.4 → 1.2.8
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/CHANGELOG.md +33 -0
- package/RNPersonaInquiry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/ios/PersonaInquiry.swift +79 -33
- package/package.json +2 -2
- package/persona-tools/Theme.js +187 -166
- package/persona-tools/Theme.ts +36 -7
- package/persona-tools/lib/AndroidResourcePrinter.js +793 -538
- package/persona-tools/lib/AndroidResourcePrinter.spec.js +387 -154
- package/persona-tools/lib/AndroidResourcePrinter.spec.ts +285 -8
- package/persona-tools/lib/AndroidResourcePrinter.ts +280 -12
- package/persona-tools/tools/AndroidThemeGenerator.js +5 -1
- package/persona-tools/tools/AndroidThemeGenerator.ts +22 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## [v1.2.8] - 2021-12-07
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Added iOS passthroughs for camera text color/size/font and footnote text size
|
|
15
|
+
- Added Android passthroughs for camera text color/size/font and footnote text size
|
|
16
|
+
- Added iOS/Android passthroughs for button text size
|
|
17
|
+
- Upgrade to iOS Inquiry SDK 1.1.22
|
|
18
|
+
- Upgrade to Android Inquiry SDK 1.1.17
|
|
19
|
+
|
|
20
|
+
## [v1.2.7] - 2021-10-20
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Applied button text color and border radius theming to `buttonStyleSecondary`
|
|
25
|
+
- Upgrade to iOS Inquiry SDK 1.1.20
|
|
26
|
+
|
|
27
|
+
## [v1.2.6] - 2021-09-20
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Added passthrough for title and body text sizes
|
|
32
|
+
|
|
33
|
+
## [v1.2.5] - 2021-09-10
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Update React peer dependency to allow React 17
|
|
38
|
+
- Added iOS passthrough for `titleTextAlignment` and `bodyTextAlignment`
|
|
39
|
+
- Upgrade to iOS Inquiry SDK 1.1.18
|
|
40
|
+
- Upgrade to Android Inquiry SDK 1.1.13
|
|
41
|
+
- Support Selfie config to skip the start/biometrics consent screen
|
|
42
|
+
|
|
10
43
|
## [v1.2.4] - 2021-08-26
|
|
11
44
|
|
|
12
45
|
### Changed
|
package/RNPersonaInquiry.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -79,7 +79,7 @@ dependencies {
|
|
|
79
79
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
80
80
|
|
|
81
81
|
// NOTE: After updating, please update the `sdkVersions.android` in example/package.json
|
|
82
|
-
implementation 'com.withpersona.sdk:inquiry:1.1.
|
|
82
|
+
implementation 'com.withpersona.sdk:inquiry:1.1.17'
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
def configureReactNativePom(def pom) {
|
package/ios/PersonaInquiry.swift
CHANGED
|
@@ -162,9 +162,15 @@ extension PersonaInquiry {
|
|
|
162
162
|
theme.titleTextColor = color
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
if let fontName = dictionary["titleTextFont"]
|
|
166
|
-
let
|
|
167
|
-
|
|
165
|
+
if let fontName = dictionary["titleTextFont"] {
|
|
166
|
+
let fontSize = int(from: dictionary["titleTextSize"]) ?? 28
|
|
167
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
168
|
+
theme.titleTextFont = font
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if let alignment = alignment(from: dictionary["titleTextAlignment"]) {
|
|
173
|
+
theme.titleTextAlignment = alignment
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
if let fontName = dictionary["cardTitleTextFont"],
|
|
@@ -176,18 +182,26 @@ extension PersonaInquiry {
|
|
|
176
182
|
theme.bodyTextColor = color
|
|
177
183
|
}
|
|
178
184
|
|
|
179
|
-
if let fontName = dictionary["bodyTextFont"]
|
|
180
|
-
let
|
|
181
|
-
|
|
185
|
+
if let fontName = dictionary["bodyTextFont"] {
|
|
186
|
+
let fontSize = int(from: dictionary["bodyTextSize"]) ?? 17
|
|
187
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
188
|
+
theme.bodyTextFont = font
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if let alignment = alignment(from: dictionary["bodyTextAlignment"]) {
|
|
193
|
+
theme.bodyTextAlignment = alignment
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
if let color = color(from: dictionary["footnoteTextColor"]) {
|
|
185
197
|
theme.footnoteTextColor = color
|
|
186
198
|
}
|
|
187
199
|
|
|
188
|
-
if let fontName = dictionary["footnoteTextFont"]
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
if let fontName = dictionary["footnoteTextFont"] {
|
|
201
|
+
let fontSize = int(from: dictionary["footnoteTextSize"]) ?? 14
|
|
202
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
203
|
+
theme.footnoteTextFont = font
|
|
204
|
+
}
|
|
191
205
|
}
|
|
192
206
|
|
|
193
207
|
if let color = color(from: dictionary["formLabelTextColor"]) {
|
|
@@ -264,25 +278,8 @@ extension PersonaInquiry {
|
|
|
264
278
|
theme.buttonDisabledTextColor = color
|
|
265
279
|
}
|
|
266
280
|
|
|
267
|
-
if let alignment = dictionary["buttonTextAlignment"] {
|
|
268
|
-
|
|
269
|
-
switch alignment {
|
|
270
|
-
case "left":
|
|
271
|
-
return NSTextAlignment.left
|
|
272
|
-
case "center":
|
|
273
|
-
return NSTextAlignment.center
|
|
274
|
-
case "right":
|
|
275
|
-
return NSTextAlignment.right
|
|
276
|
-
case "justified":
|
|
277
|
-
return NSTextAlignment.justified
|
|
278
|
-
case "natural":
|
|
279
|
-
return NSTextAlignment.natural
|
|
280
|
-
default:
|
|
281
|
-
// Default to left on invalid input
|
|
282
|
-
return NSTextAlignment.left
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
theme.buttonTextAlignment = buttonTextAlignment
|
|
281
|
+
if let alignment = alignment(from: dictionary["buttonTextAlignment"]) {
|
|
282
|
+
theme.buttonTextAlignment = alignment
|
|
286
283
|
}
|
|
287
284
|
|
|
288
285
|
if let radiusString = dictionary["buttonCornerRadius"],
|
|
@@ -291,9 +288,11 @@ extension PersonaInquiry {
|
|
|
291
288
|
theme.buttonCornerRadius = radius
|
|
292
289
|
}
|
|
293
290
|
|
|
294
|
-
if let fontName = dictionary["buttonFont"]
|
|
295
|
-
|
|
291
|
+
if let fontName = dictionary["buttonFont"] {
|
|
292
|
+
let fontSize = int(from: dictionary["buttonTextSize"]) ?? 18
|
|
293
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
296
294
|
theme.buttonFont = font
|
|
295
|
+
}
|
|
297
296
|
}
|
|
298
297
|
|
|
299
298
|
if let color = color(from: dictionary["selectedCellBackgroundColor"]) {
|
|
@@ -320,9 +319,33 @@ extension PersonaInquiry {
|
|
|
320
319
|
theme.cameraInstructionsTextColor = color
|
|
321
320
|
}
|
|
322
321
|
|
|
323
|
-
if let fontName = dictionary["cameraInstructionsTextFont"]
|
|
324
|
-
let
|
|
325
|
-
|
|
322
|
+
if let fontName = dictionary["cameraInstructionsTextFont"] {
|
|
323
|
+
let fontSize = int(from: dictionary["cameraInstructionsTextSize"]) ?? 20
|
|
324
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
325
|
+
theme.cameraInstructionsTextFont = font
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if let color = color(from: dictionary["cameraHintTextColor"]) {
|
|
330
|
+
theme.cameraHintTextColor = color
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if let fontName = dictionary["cameraHintTextFont"] {
|
|
334
|
+
let fontSize = int(from: dictionary["cameraHintTextSize"]) ?? 16
|
|
335
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
336
|
+
theme.cameraHintTextFont = font
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if let color = color(from: dictionary["cameraGuideHintTextColor"]) {
|
|
341
|
+
theme.cameraGuideHintTextColor = color
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if let fontName = dictionary["cameraGuideHintTextFont"] {
|
|
345
|
+
let fontSize = int(from: dictionary["cameraGuideHintTextSize"]) ?? 18
|
|
346
|
+
if let font = UIFont(name: fontName, size: CGFloat(fontSize)) {
|
|
347
|
+
theme.cameraGuideHintTextFont = font
|
|
348
|
+
}
|
|
326
349
|
}
|
|
327
350
|
|
|
328
351
|
if let successAssetName = dictionary["successAssetName"],
|
|
@@ -475,6 +498,29 @@ extension PersonaInquiry {
|
|
|
475
498
|
return Int(string)
|
|
476
499
|
}
|
|
477
500
|
|
|
501
|
+
/// Returns an NSTextAlignment from a string
|
|
502
|
+
private func alignment(from string: String?) -> NSTextAlignment? {
|
|
503
|
+
guard let string = string else { return nil }
|
|
504
|
+
var textAlignment: NSTextAlignment? {
|
|
505
|
+
switch string {
|
|
506
|
+
case "left":
|
|
507
|
+
return NSTextAlignment.left
|
|
508
|
+
case "center":
|
|
509
|
+
return NSTextAlignment.center
|
|
510
|
+
case "right":
|
|
511
|
+
return NSTextAlignment.right
|
|
512
|
+
case "justified":
|
|
513
|
+
return NSTextAlignment.justified
|
|
514
|
+
case "natural":
|
|
515
|
+
return NSTextAlignment.natural
|
|
516
|
+
default:
|
|
517
|
+
// return nil to default to InquiryTheme value
|
|
518
|
+
return nil
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return textAlignment
|
|
522
|
+
}
|
|
523
|
+
|
|
478
524
|
/// Converts an Attributes object to a dictionary
|
|
479
525
|
private func attributesToDictionary(attributes: Persona.Attributes?) -> Dictionary<String, Any?> {
|
|
480
526
|
var dictionary = [String: Any?]()
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-persona",
|
|
3
3
|
"title": "React Native Persona",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.8",
|
|
5
5
|
"description": "Launch a mobile native implementation of the Persona inquiry flow from React Native.",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/react-native": "^0.62.0",
|
|
49
49
|
"jest": "^26.6.3",
|
|
50
50
|
"prettier": "^2.2.1",
|
|
51
|
-
"react": "
|
|
51
|
+
"react": ">=16.9.0",
|
|
52
52
|
"react-native": ">=0.62.2",
|
|
53
53
|
"ts-jest": "^26.4.4",
|
|
54
54
|
"typescript": "^3.8.3"
|
package/persona-tools/Theme.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.IOS_THEME_CONFIG_KEY = exports.ANDROID_THEME_CONFIG_KEY = void 0;
|
|
@@ -10,183 +10,204 @@ const config_1 = __importDefault(require("./config"));
|
|
|
10
10
|
const COLOR_REGEX = /^[a-zA-Z0-9]{6}$/;
|
|
11
11
|
var ANDROID_THEME_CONFIG_KEY;
|
|
12
12
|
(function (ANDROID_THEME_CONFIG_KEY) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
13
|
+
ANDROID_THEME_CONFIG_KEY["backgroundColor"] = "backgroundColor";
|
|
14
|
+
ANDROID_THEME_CONFIG_KEY["primaryColor"] = "primaryColor";
|
|
15
|
+
ANDROID_THEME_CONFIG_KEY["darkPrimaryColor"] = "darkPrimaryColor";
|
|
16
|
+
ANDROID_THEME_CONFIG_KEY["accentColor"] = "accentColor";
|
|
17
|
+
ANDROID_THEME_CONFIG_KEY["titleTextColor"] = "titleTextColor";
|
|
18
|
+
ANDROID_THEME_CONFIG_KEY["titleTextFont"] = "titleTextFont";
|
|
19
|
+
ANDROID_THEME_CONFIG_KEY["titleTextSize"] = "titleTextSize";
|
|
20
|
+
ANDROID_THEME_CONFIG_KEY["bodyTextColor"] = "bodyTextColor";
|
|
21
|
+
ANDROID_THEME_CONFIG_KEY["bodyTextFont"] = "bodyTextFont";
|
|
22
|
+
ANDROID_THEME_CONFIG_KEY["bodyTextSize"] = "bodyTextSize";
|
|
23
|
+
ANDROID_THEME_CONFIG_KEY["footnoteTextColor"] = "footnoteTextColor";
|
|
24
|
+
ANDROID_THEME_CONFIG_KEY["footnoteTextFont"] = "footnoteTextFont";
|
|
25
|
+
ANDROID_THEME_CONFIG_KEY["footnoteTextSize"] = "footnoteTextSize";
|
|
26
|
+
ANDROID_THEME_CONFIG_KEY["cameraInstructionsTextColor"] = "cameraInstructionsTextColor";
|
|
27
|
+
ANDROID_THEME_CONFIG_KEY["cameraInstructionsTextFont"] = "cameraInstructionsTextFont";
|
|
28
|
+
ANDROID_THEME_CONFIG_KEY["cameraInstructionsTextSize"] = "cameraInstructionsTextSize";
|
|
29
|
+
ANDROID_THEME_CONFIG_KEY["cameraHintTextColor"] = "cameraHintTextColor";
|
|
30
|
+
ANDROID_THEME_CONFIG_KEY["cameraHintTextFont"] = "cameraHintTextFont";
|
|
31
|
+
ANDROID_THEME_CONFIG_KEY["cameraHintTextSize"] = "cameraHintTextSize";
|
|
32
|
+
ANDROID_THEME_CONFIG_KEY["cameraGuideHintTextColor"] = "cameraGuideHintTextColor";
|
|
33
|
+
ANDROID_THEME_CONFIG_KEY["cameraGuideHintTextFont"] = "cameraGuideHintTextFont";
|
|
34
|
+
ANDROID_THEME_CONFIG_KEY["cameraGuideHintTextSize"] = "cameraGuideHintTextSize";
|
|
35
|
+
// formLabelTextColor = "formLabelTextColor",
|
|
36
|
+
// formLabelTextFont = "formLabelTextFont",
|
|
37
|
+
ANDROID_THEME_CONFIG_KEY["textFieldTextColor"] = "textFieldTextColor";
|
|
38
|
+
ANDROID_THEME_CONFIG_KEY["textFieldTextFont"] = "textFieldTextFont";
|
|
39
|
+
ANDROID_THEME_CONFIG_KEY["pickerTextColor"] = "pickerTextColor";
|
|
40
|
+
ANDROID_THEME_CONFIG_KEY["pickerTextFont"] = "pickerTextFont";
|
|
41
|
+
ANDROID_THEME_CONFIG_KEY["buttonBackgroundColor"] = "buttonBackgroundColor";
|
|
42
|
+
ANDROID_THEME_CONFIG_KEY["buttonDisabledBackgroundColor"] = "buttonDisabledBackgroundColor";
|
|
43
|
+
ANDROID_THEME_CONFIG_KEY["buttonTouchedBackgroundColor"] = "buttonTouchedBackgroundColor";
|
|
44
|
+
ANDROID_THEME_CONFIG_KEY["buttonTextColor"] = "buttonTextColor";
|
|
45
|
+
ANDROID_THEME_CONFIG_KEY["buttonDisabledTextColor"] = "buttonDisabledTextColor";
|
|
46
|
+
// buttonTextAlignment = "buttonTextAlignment",
|
|
47
|
+
ANDROID_THEME_CONFIG_KEY["buttonCornerRadius"] = "buttonCornerRadius";
|
|
48
|
+
ANDROID_THEME_CONFIG_KEY["buttonFont"] = "buttonFont";
|
|
49
|
+
ANDROID_THEME_CONFIG_KEY["buttonTextSize"] = "buttonTextSize";
|
|
50
|
+
ANDROID_THEME_CONFIG_KEY["progressColor"] = "progressColor";
|
|
51
|
+
ANDROID_THEME_CONFIG_KEY["successAsset"] = "successAsset";
|
|
52
|
+
ANDROID_THEME_CONFIG_KEY["failAsset"] = "failAsset";
|
|
53
|
+
ANDROID_THEME_CONFIG_KEY["loadingAnimationAsset"] = "loadingAnimationAsset";
|
|
54
|
+
ANDROID_THEME_CONFIG_KEY["loadingAnimationWidthPercent"] = "loadingAnimationWidthPercent";
|
|
55
|
+
ANDROID_THEME_CONFIG_KEY["selfieAnimationAsset"] = "selfieAnimationAsset";
|
|
56
|
+
ANDROID_THEME_CONFIG_KEY["selfieAnimationWidthPercent"] = "selfieAnimationWidthPercent";
|
|
57
|
+
})(ANDROID_THEME_CONFIG_KEY = exports.ANDROID_THEME_CONFIG_KEY || (exports.ANDROID_THEME_CONFIG_KEY = {}));
|
|
45
58
|
var IOS_THEME_CONFIG_KEY;
|
|
46
59
|
(function (IOS_THEME_CONFIG_KEY) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
60
|
+
IOS_THEME_CONFIG_KEY["backgroundColor"] = "backgroundColor";
|
|
61
|
+
IOS_THEME_CONFIG_KEY["primaryColor"] = "primaryColor";
|
|
62
|
+
IOS_THEME_CONFIG_KEY["darkPrimaryColor"] = "darkPrimaryColor";
|
|
63
|
+
IOS_THEME_CONFIG_KEY["accentColor"] = "accentColor";
|
|
64
|
+
IOS_THEME_CONFIG_KEY["progressColor"] = "progressColor";
|
|
65
|
+
IOS_THEME_CONFIG_KEY["overlayBackgroundColor"] = "overlayBackgroundColor";
|
|
66
|
+
IOS_THEME_CONFIG_KEY["titleTextColor"] = "titleTextColor";
|
|
67
|
+
IOS_THEME_CONFIG_KEY["titleTextFont"] = "titleTextFont";
|
|
68
|
+
IOS_THEME_CONFIG_KEY["titleTextSize"] = "titleTextSize";
|
|
69
|
+
IOS_THEME_CONFIG_KEY["titleTextAlignment"] = "titleTextAlignment";
|
|
70
|
+
IOS_THEME_CONFIG_KEY["bodyTextColor"] = "bodyTextColor";
|
|
71
|
+
IOS_THEME_CONFIG_KEY["bodyTextFont"] = "bodyTextFont";
|
|
72
|
+
IOS_THEME_CONFIG_KEY["bodyTextSize"] = "bodyTextSize";
|
|
73
|
+
IOS_THEME_CONFIG_KEY["bodyTextAlignment"] = "bodyTextAlignment";
|
|
74
|
+
IOS_THEME_CONFIG_KEY["footnoteTextColor"] = "footnoteTextColor";
|
|
75
|
+
IOS_THEME_CONFIG_KEY["footnoteTextFont"] = "footnoteTextFont";
|
|
76
|
+
IOS_THEME_CONFIG_KEY["footnoteTextSize"] = "footnoteTextSize";
|
|
77
|
+
IOS_THEME_CONFIG_KEY["formLabelTextColor"] = "formLabelTextColor";
|
|
78
|
+
IOS_THEME_CONFIG_KEY["formLabelTextFont"] = "formLabelTextFont";
|
|
79
|
+
IOS_THEME_CONFIG_KEY["textFieldTextColor"] = "textFieldTextColor";
|
|
80
|
+
IOS_THEME_CONFIG_KEY["textFieldBackgroundColor"] = "textFieldBackgroundColor";
|
|
81
|
+
IOS_THEME_CONFIG_KEY["textFieldBorderColor"] = "textFieldBorderColor";
|
|
82
|
+
IOS_THEME_CONFIG_KEY["pickerTextColor"] = "pickerTextColor";
|
|
83
|
+
IOS_THEME_CONFIG_KEY["pickerTextFont"] = "pickerTextFont";
|
|
84
|
+
IOS_THEME_CONFIG_KEY["cameraInstructionsTextColor"] = "cameraInstructionsTextColor";
|
|
85
|
+
IOS_THEME_CONFIG_KEY["cameraInstructionsTextFont"] = "cameraInstructionsTextFont";
|
|
86
|
+
IOS_THEME_CONFIG_KEY["cameraInstructionsTextSize"] = "cameraInstructionsTextFont";
|
|
87
|
+
IOS_THEME_CONFIG_KEY["cameraHintTextColor"] = "cameraHintTextColor";
|
|
88
|
+
IOS_THEME_CONFIG_KEY["cameraHintTextFont"] = "cameraHintTextFont";
|
|
89
|
+
IOS_THEME_CONFIG_KEY["cameraHintTextSize"] = "cameraHintTextSize";
|
|
90
|
+
IOS_THEME_CONFIG_KEY["cameraGuideHintTextColor"] = "cameraGuideHintTextColor";
|
|
91
|
+
IOS_THEME_CONFIG_KEY["cameraGuideHintTextFont"] = "cameraGuideHintTextFont";
|
|
92
|
+
IOS_THEME_CONFIG_KEY["cameraGuideHintTextSize"] = "cameraGuideHintTextSize";
|
|
93
|
+
IOS_THEME_CONFIG_KEY["buttonBackgroundColor"] = "buttonBackgroundColor";
|
|
94
|
+
IOS_THEME_CONFIG_KEY["buttonDisabledBackgroundColor"] = "buttonDisabledBackgroundColor";
|
|
95
|
+
IOS_THEME_CONFIG_KEY["buttonTouchedBackgroundColor"] = "buttonTouchedBackgroundColor";
|
|
96
|
+
IOS_THEME_CONFIG_KEY["buttonImageTintColor"] = "buttonImageTintColor";
|
|
97
|
+
IOS_THEME_CONFIG_KEY["buttonImageHidden"] = "buttonImageHidden";
|
|
98
|
+
IOS_THEME_CONFIG_KEY["buttonCornerRadius"] = "buttonCornerRadius";
|
|
99
|
+
IOS_THEME_CONFIG_KEY["buttonTextAlignment"] = "buttonTextAlignment";
|
|
100
|
+
IOS_THEME_CONFIG_KEY["buttonDisabledTextColor"] = "buttonDisabledTextColor";
|
|
101
|
+
IOS_THEME_CONFIG_KEY["buttonTextColor"] = "buttonTextColor";
|
|
102
|
+
IOS_THEME_CONFIG_KEY["buttonFont"] = "buttonFont";
|
|
103
|
+
IOS_THEME_CONFIG_KEY["buttonTextSize"] = "buttonTextSize";
|
|
104
|
+
IOS_THEME_CONFIG_KEY["selectedCellBackgroundColor"] = "selectedCellBackgroundColor";
|
|
105
|
+
IOS_THEME_CONFIG_KEY["closeButtonTintColor"] = "closeButtonTintColor";
|
|
106
|
+
IOS_THEME_CONFIG_KEY["cancelButtonBackgroundColor"] = "cancelButtonBackgroundColor";
|
|
107
|
+
IOS_THEME_CONFIG_KEY["cameraButtonBackgroundColor"] = "cameraButtonBackgroundColor";
|
|
108
|
+
IOS_THEME_CONFIG_KEY["cameraGuideCornersColor"] = "cameraGuideCornersColor";
|
|
109
|
+
IOS_THEME_CONFIG_KEY["successAssetName"] = "successAssetName";
|
|
110
|
+
IOS_THEME_CONFIG_KEY["successAssetWidth"] = "successAssetWidth";
|
|
111
|
+
IOS_THEME_CONFIG_KEY["successAssetHeight"] = "successAssetHeight";
|
|
112
|
+
IOS_THEME_CONFIG_KEY["verificationFailAssetName"] = "verificationFailAssetName";
|
|
113
|
+
IOS_THEME_CONFIG_KEY["verificationFailAssetWidth"] = "verificationFailAssetWidth";
|
|
114
|
+
IOS_THEME_CONFIG_KEY["verificationFailAssetHeight"] = "verificationFailAssetHeight";
|
|
115
|
+
IOS_THEME_CONFIG_KEY["failAssetName"] = "failAssetName";
|
|
116
|
+
IOS_THEME_CONFIG_KEY["failAssetWidth"] = "failAssetWidth";
|
|
117
|
+
IOS_THEME_CONFIG_KEY["failAssetHeight"] = "failAssetHeight";
|
|
118
|
+
IOS_THEME_CONFIG_KEY["loadingAnimationAssetName"] = "loadingAnimationAssetName";
|
|
119
|
+
IOS_THEME_CONFIG_KEY["loadingAnimationAssetWidth"] = "loadingAnimationAssetWidth";
|
|
120
|
+
IOS_THEME_CONFIG_KEY["loadingAnimationAssetHeight"] = "loadingAnimationAssetHeight";
|
|
121
|
+
IOS_THEME_CONFIG_KEY["processingAnimationAssetName"] = "processingAnimationAssetName";
|
|
122
|
+
IOS_THEME_CONFIG_KEY["processingAnimationAssetWidth"] = "processingAnimationAssetWidth";
|
|
123
|
+
IOS_THEME_CONFIG_KEY["processingAnimationAssetHeight"] = "processingAnimationAssetHeight";
|
|
124
|
+
IOS_THEME_CONFIG_KEY["selfieAnimationAssetName"] = "selfieAnimationAssetName";
|
|
125
|
+
IOS_THEME_CONFIG_KEY["selfieAnimationAssetWidth"] = "selfieAnimationAssetWidth";
|
|
126
|
+
IOS_THEME_CONFIG_KEY["selfieAnimationAssetHeight"] = "selfieAnimationAssetHeight";
|
|
127
|
+
})(IOS_THEME_CONFIG_KEY = exports.IOS_THEME_CONFIG_KEY || (exports.IOS_THEME_CONFIG_KEY = {}));
|
|
102
128
|
class Theme {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
async print(platform = "android") {
|
|
130
|
+
const config = await config_1.default.get();
|
|
131
|
+
const themeConfig = platform === "android" ? config["androidTheme"] : config["iosTheme"];
|
|
132
|
+
let usesCustomFontAndroid = false;
|
|
133
|
+
let usesCustomFontIos = false;
|
|
134
|
+
const head = platform === "android"
|
|
135
|
+
? ["Style Item", "Value", "Note"]
|
|
136
|
+
: ["Style Item", "Value", "Note"];
|
|
137
|
+
const table = new cli_table_1.default({
|
|
138
|
+
head,
|
|
139
|
+
// prettier-ignore
|
|
140
|
+
chars: { 'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }
|
|
141
|
+
});
|
|
142
|
+
console.log("Specified theme values:");
|
|
143
|
+
const keyEnum = platform === "android" ? ANDROID_THEME_CONFIG_KEY : IOS_THEME_CONFIG_KEY;
|
|
144
|
+
for (const key in keyEnum) {
|
|
145
|
+
let override = themeConfig[key];
|
|
146
|
+
let colorOverride = key.includes("Color") || key.includes("color");
|
|
147
|
+
if (override) {
|
|
148
|
+
if (colorOverride) {
|
|
149
|
+
override = normalizeColor(override, key);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
override = override.toString();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (key.includes("Font")) {
|
|
156
|
+
if (platform == "android") {
|
|
157
|
+
usesCustomFontAndroid = true;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
usesCustomFontIos = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
let row;
|
|
164
|
+
row = [
|
|
165
|
+
key,
|
|
166
|
+
override
|
|
167
|
+
? valueColor(colorOverride, override)
|
|
168
|
+
: chalk_1.default.yellow("unspecified"),
|
|
169
|
+
key.includes("Font")
|
|
170
|
+
? chalk_1.default.cyan("Fonts that are not built-in need to be installed.")
|
|
171
|
+
: ""
|
|
172
|
+
];
|
|
173
|
+
table.push(row);
|
|
125
174
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (key.includes("Font")) {
|
|
132
|
-
if (platform == "android") {
|
|
133
|
-
usesCustomFontAndroid = true;
|
|
175
|
+
console.log(table.toString());
|
|
176
|
+
if (usesCustomFontAndroid) {
|
|
177
|
+
console.log(chalk_1.default.yellow(" NOTE") +
|
|
178
|
+
": A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml");
|
|
134
179
|
}
|
|
135
|
-
|
|
136
|
-
|
|
180
|
+
if (usesCustomFontIos) {
|
|
181
|
+
console.log(chalk_1.default.yellow(" NOTE") +
|
|
182
|
+
": A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app");
|
|
137
183
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let row;
|
|
141
|
-
|
|
142
|
-
row = [
|
|
143
|
-
key,
|
|
144
|
-
override
|
|
145
|
-
? valueColor(colorOverride, override)
|
|
146
|
-
: chalk_1.default.yellow("unspecified"),
|
|
147
|
-
key.includes("Font")
|
|
148
|
-
? chalk_1.default.cyan("Fonts that are not built-in need to be installed.")
|
|
149
|
-
: ""
|
|
150
|
-
];
|
|
151
|
-
|
|
152
|
-
table.push(row);
|
|
153
|
-
}
|
|
154
|
-
console.log(table.toString());
|
|
155
|
-
if (usesCustomFontAndroid) {
|
|
156
|
-
console.log(chalk_1.default.yellow(" NOTE") +
|
|
157
|
-
": A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml");
|
|
184
|
+
// Add newline for spacing
|
|
185
|
+
console.log("");
|
|
158
186
|
}
|
|
159
|
-
if (usesCustomFontIos) {
|
|
160
|
-
console.log(chalk_1.default.yellow(" NOTE") +
|
|
161
|
-
": A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app");
|
|
162
|
-
}
|
|
163
|
-
// Add newline for spacing
|
|
164
|
-
console.log("");
|
|
165
|
-
}
|
|
166
187
|
}
|
|
188
|
+
// set default print color for non-color overrides
|
|
167
189
|
function valueColor(isColorOverride, override) {
|
|
168
|
-
|
|
190
|
+
return isColorOverride ? chalk_1.default.hex(override)(override) : chalk_1.default.magentaBright(override);
|
|
169
191
|
}
|
|
170
|
-
|
|
171
192
|
function normalizeColor(colorHex, themeKey) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
if (!COLOR_REGEX.test(hex)) {
|
|
177
|
-
if (themeKey) {
|
|
178
|
-
console.error(`Received a color value of ${chalk_1.default.yellow(colorHex)} for ${chalk_1.default.red(themeKey)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk_1.default
|
|
179
|
-
.bgHex("#FFFFFF")
|
|
180
|
-
.hex("#7E66B7")("#290087")}`);
|
|
193
|
+
let hex = colorHex;
|
|
194
|
+
if (colorHex[0] === "#") {
|
|
195
|
+
hex = colorHex.slice(1);
|
|
181
196
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
197
|
+
if (!COLOR_REGEX.test(hex)) {
|
|
198
|
+
if (themeKey) {
|
|
199
|
+
console.error(`Received a color value of ${chalk_1.default.yellow(colorHex)} for ${chalk_1.default.red(themeKey)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk_1.default
|
|
200
|
+
.bgHex("#FFFFFF")
|
|
201
|
+
.hex("#7E66B7")("#290087")}`);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
console.error(`Received a color value of ${chalk_1.default.yellow(colorHex)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk_1.default
|
|
205
|
+
.bgHex("#FFFFFF")
|
|
206
|
+
.hex("#7E66B7")("#290087")}`);
|
|
207
|
+
}
|
|
208
|
+
console.log("");
|
|
209
|
+
process.exit(1);
|
|
186
210
|
}
|
|
187
|
-
|
|
188
|
-
process.exit(1);
|
|
189
|
-
}
|
|
190
|
-
return colorHex;
|
|
211
|
+
return colorHex;
|
|
191
212
|
}
|
|
192
213
|
exports.default = new Theme();
|