react-native-persona 2.2.1 → 2.2.4
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 +20 -0
- package/README.md +149 -2
- package/RNPersonaInquiry2.podspec +1 -1
- package/android/build.gradle +1 -1
- package/bin/persona-tool +1 -2
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +497 -0
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -0
- package/lib/commonjs/persona-tool/Config.js +95 -0
- package/lib/commonjs/persona-tool/Config.js.map +1 -0
- package/lib/commonjs/persona-tool/Theme.js +199 -0
- package/lib/commonjs/persona-tool/Theme.js.map +1 -0
- package/lib/commonjs/persona-tool/index.js +41 -0
- package/lib/commonjs/persona-tool/index.js.map +1 -0
- package/lib/commonjs/persona-tool/prompts.js +48 -0
- package/lib/commonjs/persona-tool/prompts.js.map +1 -0
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +99 -0
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +50 -0
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -0
- package/lib/module/persona-tool/AndroidResourcePrinter.js +489 -0
- package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -0
- package/lib/module/persona-tool/Config.js +82 -0
- package/lib/module/persona-tool/Config.js.map +1 -0
- package/lib/module/persona-tool/Theme.js +183 -0
- package/lib/module/persona-tool/Theme.js.map +1 -0
- package/lib/module/persona-tool/index.js +33 -0
- package/lib/module/persona-tool/index.js.map +1 -0
- package/lib/module/persona-tool/prompts.js +31 -0
- package/lib/module/persona-tool/prompts.js.map +1 -0
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +72 -0
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
- package/lib/module/persona-tool/tools/IosThemeInstructions.js +37 -0
- package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -0
- package/lib/typescript/{src/fields.d.ts → fields.d.ts} +0 -0
- package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
- package/lib/typescript/{persona-tools/lib → persona-tool}/AndroidResourcePrinter.d.ts +2 -2
- package/lib/typescript/{persona-tools → persona-tool}/Config.d.ts +0 -0
- package/lib/typescript/{persona-tools → persona-tool}/Theme.d.ts +0 -0
- package/lib/typescript/{persona-tools → persona-tool}/index.d.ts +0 -0
- package/lib/typescript/{persona-tools/lib → persona-tool}/prompts.d.ts +1 -1
- package/lib/typescript/{persona-tools → persona-tool}/tools/AndroidThemeGenerator.d.ts +0 -0
- package/lib/typescript/{persona-tools → persona-tool}/tools/IosThemeInstructions.d.ts +0 -0
- package/lib/typescript/{src/util.d.ts → util.d.ts} +0 -0
- package/lib/typescript/{src/versions.d.ts → versions.d.ts} +0 -0
- package/package.json +4 -5
- package/{persona-tools/lib → src/persona-tool}/AndroidResourcePrinter.ts +182 -182
- package/{persona-tools → src/persona-tool}/Config.ts +0 -0
- package/{persona-tools → src/persona-tool}/Theme.ts +0 -0
- package/{persona-tools → src/persona-tool}/index.ts +1 -1
- package/{persona-tools/lib → src/persona-tool}/prompts.ts +11 -11
- package/{persona-tools → src/persona-tool}/tools/AndroidThemeGenerator.ts +2 -2
- package/{persona-tools → src/persona-tool}/tools/IosThemeInstructions.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## [v2.2.4] - 2022-03-07
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Upgrade to Android Inquiry SDK 2.2.9
|
|
15
|
+
- Upgrade to iOS Inquiry SDK 2.2.6
|
|
16
|
+
|
|
17
|
+
## [v2.2.3] - 2022-03-02
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Re-added `persona-tool` which was removed by accident in a refactor
|
|
22
|
+
|
|
23
|
+
## [v2.2.2] - 2022-02-24
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Upgrade to Android Inquiry SDK 2.2.8
|
|
28
|
+
- Upgrade to iOS Inquiry SDK 2.2.4
|
|
29
|
+
|
|
10
30
|
## [v2.2.1] - 2022-02-17
|
|
11
31
|
|
|
12
32
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,3 +1,150 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Persona Android SDKs and Demo
|
|
2
|
+
|
|
3
|
+
## Development
|
|
4
|
+
|
|
5
|
+
First, run yarn in the project root.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
yarn
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
To test changes to SDK, we will use the Example App in `example` app.
|
|
12
|
+
|
|
13
|
+
### Start Metro bundler.
|
|
14
|
+
|
|
15
|
+
This will bundle JavaScript and serve it to your React Native sample app. Keep the Metro bundler running in a terminal.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
yarn example start
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Metro bundler compiles source code and caches compiled targets to speed up incremental rebuilds. However, it's possible
|
|
22
|
+
that this can lead to random failures if things get out of sync. If you ever run into any weird issues, it's worth
|
|
23
|
+
running `yarn example start --reset-cache` again.
|
|
24
|
+
|
|
25
|
+
### Start example app in iOS simulator
|
|
26
|
+
|
|
27
|
+
Use the built-in CLI command with Metro running.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
yarn example ios
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or open `ios/example.xcworkspace` in XCode and build + run.
|
|
34
|
+
|
|
35
|
+
### Start example app in Android simulator
|
|
36
|
+
|
|
37
|
+
Use the built-in CLI command with Metro running.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
yarn example android
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or open the Android project in Android Studio and build + run.
|
|
44
|
+
|
|
45
|
+
### Theming the example app
|
|
46
|
+
|
|
47
|
+
Run the `persona-tool` to customize the theme.
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
$ cd example
|
|
51
|
+
$ yarn persona-tool
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
# Installing in your own project
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
yarn add react-native-persona
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import {Environment, Inquiry} from "react-native-persona";
|
|
66
|
+
|
|
67
|
+
// Start an inquiry.
|
|
68
|
+
Inquiry.fromTemplate('itmpl_Ygs16MKTkA6obnF8C3Rb17dm')
|
|
69
|
+
.environment(Environment.SANDBOX)
|
|
70
|
+
.onComplete((inquiryId, status, fields) =>
|
|
71
|
+
Alert.alert('Complete', `Inquiry ${inquiryId} completed with status "${status}."`,),
|
|
72
|
+
)
|
|
73
|
+
.onCanceled((inquiryId, sessionToken) =>
|
|
74
|
+
Alert.alert('Canceled', `Inquiry ${inquiryId} was cancelled`),
|
|
75
|
+
)
|
|
76
|
+
.onError(error => Alert.alert('Error', error.message))
|
|
77
|
+
.build()
|
|
78
|
+
.start();
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Theming
|
|
82
|
+
|
|
83
|
+
Theming can be handled universally through our persona-tools CLI provided in this repository.
|
|
84
|
+
|
|
85
|
+
To test themes, use the example app:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
cd example
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Link the `persona-tool` using the following command (only necessary during development, linked automatically when the
|
|
92
|
+
package is installed using `yarn add` or `npm install`).
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
yarn dev-only:link-bin
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
To unlink:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
yarn dev-only:unlink-bin
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Run through the tool using `yarn persona-tool` and following the instructions to add the required snippet to
|
|
105
|
+
your `package.json`.
|
|
106
|
+
|
|
107
|
+
Update theme colors accordingly:
|
|
108
|
+
|
|
109
|
+
- Example: Update `persona.androidTheme.backgroundColor` to `#FFFFFF`
|
|
110
|
+
|
|
111
|
+
Run `yarn persona-tool` again.
|
|
112
|
+
|
|
113
|
+
Launch the example app and launch a flow.
|
|
114
|
+
|
|
115
|
+
### Updating SDK Versions
|
|
116
|
+
|
|
117
|
+
*Android*
|
|
118
|
+
|
|
119
|
+
Update the sdk version in `android/build.gradle`
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
implementation 'com.withpersona.sdk2:inquiry:X.Y.Z'
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
*iOS*
|
|
126
|
+
|
|
127
|
+
Update the sdk version in `RNPersonaInquiry2.podspec`
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
s.dependency 'PersonaInquirySDK2', '~> X.Y.Z'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Go to `example/ios` directory, update the Podfiles by running
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
pod update PersonaInquirySDK2 --repo-update
|
|
137
|
+
pod install --repo-update
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
*React Native*
|
|
141
|
+
|
|
142
|
+
Bump react native version in `package.json` if needed.
|
|
143
|
+
|
|
144
|
+
Commit and push changed files including:
|
|
145
|
+
|
|
146
|
+
- `android/build.gradle`
|
|
147
|
+
- `RNPersonaInquiry2.podspec`
|
|
148
|
+
- `package.json`
|
|
149
|
+
- `example/ios/Podfile.lock`
|
|
2
150
|
|
|
3
|
-
Please refer to the docs: https://docs.withpersona.com/docs/react-native-sdk-integration
|
package/android/build.gradle
CHANGED
package/bin/persona-tool
CHANGED
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _xmlbuilder = require("xmlbuilder2");
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
|
|
12
|
+
class AndroidResourcePrinter {
|
|
13
|
+
constructor(theme) {
|
|
14
|
+
_defineProperty(this, "theme", void 0);
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "root", void 0);
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "buttonDrawable", void 0);
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "buttonColor", void 0);
|
|
21
|
+
|
|
22
|
+
_defineProperty(this, "preprintQueue", []);
|
|
23
|
+
|
|
24
|
+
_defineProperty(this, "printQueue", []);
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "postPrintQueue", []);
|
|
27
|
+
|
|
28
|
+
this.theme = theme;
|
|
29
|
+
this.root = (0, _xmlbuilder.create)({
|
|
30
|
+
version: '1.0'
|
|
31
|
+
}).ele('resources');
|
|
32
|
+
this.buttonDrawable = (0, _xmlbuilder.create)({
|
|
33
|
+
version: '1.0'
|
|
34
|
+
}).ele('selector', {
|
|
35
|
+
'xmlns:android': 'http://schemas.android.com/apk/res/android'
|
|
36
|
+
});
|
|
37
|
+
this.buttonColor = (0, _xmlbuilder.create)({
|
|
38
|
+
version: '1.0'
|
|
39
|
+
}).ele('selector', {
|
|
40
|
+
'xmlns:android': 'http://schemas.android.com/apk/res/android'
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
process() {
|
|
45
|
+
if (!this.hasTheme()) {
|
|
46
|
+
this.root = this.root.up();
|
|
47
|
+
} else {
|
|
48
|
+
this.print();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
style: this.root,
|
|
53
|
+
buttonDrawable: this.buttonDrawable,
|
|
54
|
+
buttonColor: this.buttonColor
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
print() {
|
|
59
|
+
this.primaryColor();
|
|
60
|
+
this.accentColor();
|
|
61
|
+
this.darkPrimaryColor();
|
|
62
|
+
this.backgroundColor();
|
|
63
|
+
this.titleText();
|
|
64
|
+
this.bodyText();
|
|
65
|
+
this.footnoteText(); // this.formLabelText();
|
|
66
|
+
|
|
67
|
+
this.textField();
|
|
68
|
+
this.pickerText();
|
|
69
|
+
this.button();
|
|
70
|
+
this.progressColor();
|
|
71
|
+
this.successAsset();
|
|
72
|
+
this.failAsset();
|
|
73
|
+
this.loadingAnimationAsset();
|
|
74
|
+
this.selfieAnimationAsset();
|
|
75
|
+
this.preprintQueue.forEach(fn => fn()); // Precreate some style namespaces
|
|
76
|
+
|
|
77
|
+
this.root = this.root.ele('style', {
|
|
78
|
+
name: 'RN'
|
|
79
|
+
}).up();
|
|
80
|
+
this.root = this.root.ele('style', {
|
|
81
|
+
name: 'RN.Persona'
|
|
82
|
+
}).up();
|
|
83
|
+
this.root = this.root.ele('style', {
|
|
84
|
+
name: 'RN.Persona.Text'
|
|
85
|
+
}).up();
|
|
86
|
+
this.root = this.root.ele('style', {
|
|
87
|
+
name: 'Persona.Inquiry2.Theme',
|
|
88
|
+
parent: 'Base.Persona.Inquiry2.Theme'
|
|
89
|
+
});
|
|
90
|
+
this.printQueue.forEach(fn => fn());
|
|
91
|
+
this.root = this.root.up();
|
|
92
|
+
this.postPrintQueue.forEach(fn => fn());
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
hasTheme() {
|
|
96
|
+
return Object.keys(this.theme).length > 0 && Object.values(this.theme).filter(Boolean).length > 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
primaryColor() {
|
|
100
|
+
if (!this.theme.primaryColor) return;
|
|
101
|
+
this.printQueue.push(() => {
|
|
102
|
+
this.root = this.root.ele('item', {
|
|
103
|
+
name: 'colorPrimary'
|
|
104
|
+
}).txt(this.theme.primaryColor).up().txt(' ');
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
accentColor() {
|
|
109
|
+
if (!this.theme.accentColor) return;
|
|
110
|
+
this.printQueue.push(() => {
|
|
111
|
+
this.root = this.root.ele('item', {
|
|
112
|
+
name: 'colorSecondary'
|
|
113
|
+
}).txt(this.theme.accentColor).up().txt(' ');
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
darkPrimaryColor() {
|
|
118
|
+
if (!this.theme.darkPrimaryColor) return;
|
|
119
|
+
this.printQueue.push(() => {
|
|
120
|
+
this.root = this.root.ele('item', {
|
|
121
|
+
name: 'colorPrimaryVariant'
|
|
122
|
+
}).txt(this.theme.darkPrimaryColor).up().txt(' ');
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
backgroundColor() {
|
|
127
|
+
if (!this.theme.backgroundColor) return;
|
|
128
|
+
this.preprintQueue.push(() => {
|
|
129
|
+
this.root = this.root.ele('color', {
|
|
130
|
+
name: 'customPersonaBackgroundColor'
|
|
131
|
+
}).txt(this.theme.backgroundColor).up().txt(' ');
|
|
132
|
+
});
|
|
133
|
+
this.printQueue.push(() => {
|
|
134
|
+
this.root = this.root.ele('item', {
|
|
135
|
+
name: 'android:colorBackground'
|
|
136
|
+
}).txt('@color/customPersonaBackgroundColor').up().txt(' ');
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
titleText() {
|
|
141
|
+
if (this.theme.titleTextColor || this.theme.titleTextFont) {
|
|
142
|
+
this.printQueue.push(() => {
|
|
143
|
+
this.root = this.root.ele('item', {
|
|
144
|
+
name: 'textAppearanceHeadline6'
|
|
145
|
+
}).txt('@style/RN.Persona.Text.Title').up();
|
|
146
|
+
}); // Create a text appearance
|
|
147
|
+
|
|
148
|
+
this.postPrintQueue.push(() => {
|
|
149
|
+
this.root = this.root.ele('style', {
|
|
150
|
+
name: 'RN.Persona.Text.Title',
|
|
151
|
+
parent: 'Persona.Inquiry2.Text.Body'
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (this.theme.titleTextColor) {
|
|
155
|
+
this.root = this.root.ele('item', {
|
|
156
|
+
name: 'android:textColor'
|
|
157
|
+
}).txt(this.theme.titleTextColor).up();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (this.theme.titleTextFont) {
|
|
161
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
162
|
+
// referenced here on Android
|
|
163
|
+
this.root = this.root.ele('item', {
|
|
164
|
+
name: 'android:fontFamily'
|
|
165
|
+
}).txt(this.theme.titleTextFont).up();
|
|
166
|
+
} // Default values taken from `Persona.Text.Title`
|
|
167
|
+
// in shared/src/main/res/values/styles.xml
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
this.root = this.root.ele('item', {
|
|
171
|
+
name: 'android:textSize'
|
|
172
|
+
}).txt('26sp').up().ele('item', {
|
|
173
|
+
name: 'android:textStyle'
|
|
174
|
+
}).txt('bold').up();
|
|
175
|
+
this.root = this.root.up();
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
this.printQueue.push(() => {
|
|
179
|
+
this.root = this.root.ele('item', {
|
|
180
|
+
name: 'textAppearanceHeadline6'
|
|
181
|
+
}).txt('@style/Persona.Text.Title').up();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
bodyText() {
|
|
187
|
+
if (this.theme.bodyTextColor || this.theme.bodyTextFont) {
|
|
188
|
+
this.printQueue.push(() => {
|
|
189
|
+
this.root = this.root.ele('item', {
|
|
190
|
+
name: 'textAppearanceSubtitle1'
|
|
191
|
+
}).txt('@style/RN.Persona.Text.Body').up();
|
|
192
|
+
}); // Create a text appearance
|
|
193
|
+
|
|
194
|
+
this.postPrintQueue.push(() => {
|
|
195
|
+
this.root = this.root.ele('style', {
|
|
196
|
+
name: 'RN.Persona.Text.Body',
|
|
197
|
+
parent: 'Persona.Inquiry2.Text.Body'
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
if (this.theme.bodyTextColor) {
|
|
201
|
+
this.root = this.root.ele('item', {
|
|
202
|
+
name: 'android:textColor'
|
|
203
|
+
}).txt(this.theme.bodyTextColor).up();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (this.theme.bodyTextFont) {
|
|
207
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
208
|
+
// referenced here on Android
|
|
209
|
+
this.root = this.root.ele('item', {
|
|
210
|
+
name: 'android:fontFamily'
|
|
211
|
+
}).txt(this.theme.bodyTextFont).up();
|
|
212
|
+
} // Default values taken from `Persona.Text.Body`
|
|
213
|
+
// in shared/src/main/res/values/styles.xml
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
this.root = this.root.ele('item', {
|
|
217
|
+
name: 'android:textSize'
|
|
218
|
+
}).txt('18sp').up();
|
|
219
|
+
this.root = this.root.up();
|
|
220
|
+
});
|
|
221
|
+
} else {
|
|
222
|
+
this.printQueue.push(() => {
|
|
223
|
+
this.root = this.root.ele('item', {
|
|
224
|
+
name: 'textAppearanceSubtitle1'
|
|
225
|
+
}).txt('@style/Persona.Inquiry2.Text.Body').up();
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
footnoteText() {
|
|
231
|
+
if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
|
|
232
|
+
this.postPrintQueue.push(() => {
|
|
233
|
+
var _this$theme$footnoteT;
|
|
234
|
+
|
|
235
|
+
this.root = this.root.ele('style', {
|
|
236
|
+
name: 'TextAppearance.AppCompat.Small'
|
|
237
|
+
}).ele('item', {
|
|
238
|
+
name: 'android:textSize'
|
|
239
|
+
}) // Used default value found in the Android SDK
|
|
240
|
+
.txt('@dimen/abc_text_size_small_material').up().ele('item', {
|
|
241
|
+
name: 'android:textColor'
|
|
242
|
+
}).txt( // Used default value found in the Android SDK
|
|
243
|
+
(_this$theme$footnoteT = this.theme.footnoteTextColor) !== null && _this$theme$footnoteT !== void 0 ? _this$theme$footnoteT : '?android:attr/textColorTertiary').up();
|
|
244
|
+
|
|
245
|
+
if (this.theme.footnoteTextFont) {
|
|
246
|
+
var _this$theme$footnoteT2;
|
|
247
|
+
|
|
248
|
+
this.root = this.root.ele('item', {
|
|
249
|
+
name: 'android:fontFamily'
|
|
250
|
+
}).txt( // Used default value found in the Android SDK
|
|
251
|
+
(_this$theme$footnoteT2 = this.theme.footnoteTextFont) !== null && _this$theme$footnoteT2 !== void 0 ? _this$theme$footnoteT2 : '?android:attr/textColorTertiary').up();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
this.root = this.root.up();
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
textField() {
|
|
260
|
+
if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
|
|
261
|
+
this.printQueue.push(() => {
|
|
262
|
+
this.root = this.root.ele('item', {
|
|
263
|
+
name: 'editTextStyle'
|
|
264
|
+
}).txt('@style/RN.Persona.EditText').up();
|
|
265
|
+
});
|
|
266
|
+
this.postPrintQueue.push(() => {
|
|
267
|
+
this.root = this.root.ele('style', {
|
|
268
|
+
name: 'RN.Persona.EditText',
|
|
269
|
+
parent: 'Persona.Inquiry2.EditText'
|
|
270
|
+
}).ele('item', {
|
|
271
|
+
name: 'android:textAppearance'
|
|
272
|
+
}).txt('@style/RN.Persona.EditText.TextAppearance').up().ele('item', {
|
|
273
|
+
name: 'android:textColor'
|
|
274
|
+
}).txt(this.theme.textFieldTextColor).up().up();
|
|
275
|
+
this.root = this.root.ele('style', {
|
|
276
|
+
name: 'RN.Persona.EditText.TextAppearance',
|
|
277
|
+
parent: 'Base.TextAppearance.TextAppearance.MaterialComponents.Body1'
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
if (this.theme.textFieldTextColor) {
|
|
281
|
+
this.root = this.root.ele('item', {
|
|
282
|
+
name: 'android:textSize'
|
|
283
|
+
}).txt('18sp').up();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (this.theme.textFieldTextFont) {
|
|
287
|
+
this.root = this.root.ele('item', {
|
|
288
|
+
name: 'android:fontFamily'
|
|
289
|
+
}).txt(this.theme.textFieldTextFont).up();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
this.root = this.root.up();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
pickerText() {
|
|
298
|
+
if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
|
|
299
|
+
this.printQueue.push(() => {
|
|
300
|
+
this.root = this.root.ele('item', {
|
|
301
|
+
name: 'spinnerStyle'
|
|
302
|
+
}).txt('@style/RN.Persona.Spinner').up();
|
|
303
|
+
this.root = this.root.ele('item', {
|
|
304
|
+
name: 'spinnerDropDownItemStyle'
|
|
305
|
+
}).txt('@style/RN.Persona.DropDownItem.Spinner').up();
|
|
306
|
+
});
|
|
307
|
+
this.postPrintQueue.push(() => {
|
|
308
|
+
var _this$theme$pickerTex, _this$theme$pickerTex2;
|
|
309
|
+
|
|
310
|
+
// Build Rn.Persona.Spinner
|
|
311
|
+
this.root = this.root.ele('style', {
|
|
312
|
+
name: 'RN.Persona.Spinner',
|
|
313
|
+
parent: 'Persona.Inquiry2.Spinner'
|
|
314
|
+
}).ele('item', {
|
|
315
|
+
name: 'android:textColor'
|
|
316
|
+
}).txt((_this$theme$pickerTex = this.theme.pickerTextColor) !== null && _this$theme$pickerTex !== void 0 ? _this$theme$pickerTex : '?android:attr/textColorPrimary').up().ele('item', {
|
|
317
|
+
name: 'android:textAppearance'
|
|
318
|
+
}).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Inquiry2.Text.Body').up().up(); // Build RN.Persona.DropDownItem.Spinner
|
|
319
|
+
|
|
320
|
+
this.root = this.root.ele('style', {
|
|
321
|
+
name: 'RN.Persona.DropDownItem.Spinner',
|
|
322
|
+
parent: 'Persona.Inquiry2.Spinner'
|
|
323
|
+
}).ele('item', {
|
|
324
|
+
name: 'android:textColor'
|
|
325
|
+
}).txt((_this$theme$pickerTex2 = this.theme.pickerTextColor) !== null && _this$theme$pickerTex2 !== void 0 ? _this$theme$pickerTex2 : '?android:attr/textColorPrimary').up().ele('item', {
|
|
326
|
+
name: 'android:textAppearance'
|
|
327
|
+
}).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Inquiry2.Text.Body').up().up(); // Build RN.Persona.Text.Spinner
|
|
328
|
+
|
|
329
|
+
this.root = this.root.ele('style', {
|
|
330
|
+
name: 'RN.Persona.Text.Spinner'
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
if (this.theme.pickerTextColor) {
|
|
334
|
+
this.root = this.root.ele('item', {
|
|
335
|
+
name: 'android:textColor'
|
|
336
|
+
}).txt(this.theme.pickerTextColor).up();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (this.theme.pickerTextFont) {
|
|
340
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
341
|
+
// referenced here on Android
|
|
342
|
+
this.root = this.root.ele('item', {
|
|
343
|
+
name: 'android:fontFamily'
|
|
344
|
+
}).txt(this.theme.pickerTextFont).up();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
this.root = this.root.up();
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
button() {
|
|
353
|
+
if (this.theme.buttonBackgroundColor || this.theme.buttonDisabledBackgroundColor || this.theme.buttonTouchedBackgroundColor || this.theme.buttonTextColor || this.theme.buttonDisabledTextColor || this.theme.buttonCornerRadius || this.theme.buttonFont) {
|
|
354
|
+
this.printQueue.push(() => {
|
|
355
|
+
this.root = this.root.ele('item', {
|
|
356
|
+
name: 'buttonStyle'
|
|
357
|
+
}).txt('@style/RN.Persona.Button').up();
|
|
358
|
+
});
|
|
359
|
+
this.postPrintQueue.push(() => {
|
|
360
|
+
var _this$theme$buttonTou, _this$theme$buttonBac, _this$theme$buttonDis, _this$theme$buttonTex, _this$theme$buttonTex2;
|
|
361
|
+
|
|
362
|
+
this.root = this.root.ele('style', {
|
|
363
|
+
name: 'RN.Persona.Button',
|
|
364
|
+
parent: 'Persona.Inquiry2.Button'
|
|
365
|
+
}) // Taken from
|
|
366
|
+
// appcompat's res/values/values.xml
|
|
367
|
+
.ele('item', {
|
|
368
|
+
name: 'android:minHeight'
|
|
369
|
+
}).txt('48dip').up() // Taken from
|
|
370
|
+
// appcompat's res/values/values.xml
|
|
371
|
+
.ele('item', {
|
|
372
|
+
name: 'android:minWidth'
|
|
373
|
+
}).txt('88dip').up() // Taken from
|
|
374
|
+
// persona-android's shared/src/main/res/values/styles.xml
|
|
375
|
+
.ele('item', {
|
|
376
|
+
name: 'android:textSize'
|
|
377
|
+
}).txt('18sp').up().ele('item', {
|
|
378
|
+
name: 'android:background'
|
|
379
|
+
}).txt('@drawable/rn_persona_button').up().ele('item', {
|
|
380
|
+
name: 'android:textColor'
|
|
381
|
+
}).txt('@color/rn_persona_button').up().up(); // Disabled
|
|
382
|
+
|
|
383
|
+
this.buttonDrawable = this.buttonDrawable.ele('item', {
|
|
384
|
+
'android:state_enabled': 'false'
|
|
385
|
+
}).ele('shape', {
|
|
386
|
+
'android:shape': 'rectangle'
|
|
387
|
+
}).ele('corners', {
|
|
388
|
+
'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
|
|
389
|
+
}).up().ele('padding', {
|
|
390
|
+
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
391
|
+
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
392
|
+
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
393
|
+
'android:bottom': '@dimen/abc_button_padding_vertical_material'
|
|
394
|
+
}).up().ele('solid', {
|
|
395
|
+
'android:color': this.theme.buttonDisabledBackgroundColor ? this.theme.buttonDisabledBackgroundColor : '?attr/colorPrimaryVariant'
|
|
396
|
+
}).up().up().up(); // touched
|
|
397
|
+
|
|
398
|
+
this.buttonDrawable = this.buttonDrawable.ele('item', {
|
|
399
|
+
'android:state_pressed': 'true'
|
|
400
|
+
}).ele('shape', {
|
|
401
|
+
'android:shape': 'rectangle'
|
|
402
|
+
}).ele('corners', {
|
|
403
|
+
'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
|
|
404
|
+
}).up().ele('solid', {
|
|
405
|
+
'android:color': (_this$theme$buttonTou = this.theme.buttonTouchedBackgroundColor) !== null && _this$theme$buttonTou !== void 0 ? _this$theme$buttonTou : '?attr/colorPrimaryVariant'
|
|
406
|
+
}).up().ele('padding', {
|
|
407
|
+
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
408
|
+
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
409
|
+
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
410
|
+
'android:bottom': '@dimen/abc_button_padding_vertical_material'
|
|
411
|
+
}).up().up().up();
|
|
412
|
+
this.buttonDrawable = this.buttonDrawable.ele('item').ele('shape', {
|
|
413
|
+
'android:shape': 'rectangle'
|
|
414
|
+
}).ele('corners', {
|
|
415
|
+
'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
|
|
416
|
+
}).up().ele('solid', {
|
|
417
|
+
'android:color': (_this$theme$buttonBac = this.theme.buttonBackgroundColor) !== null && _this$theme$buttonBac !== void 0 ? _this$theme$buttonBac : '?attr/colorPrimary'
|
|
418
|
+
}).up().ele('padding', {
|
|
419
|
+
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
420
|
+
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
421
|
+
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
422
|
+
'android:bottom': '@dimen/abc_button_padding_vertical_material'
|
|
423
|
+
}).up().up().up(); // Finish button drawable
|
|
424
|
+
|
|
425
|
+
this.buttonDrawable = this.buttonDrawable.up();
|
|
426
|
+
this.buttonColor = this.buttonColor.ele('item', {
|
|
427
|
+
'android:state_enabled': 'false',
|
|
428
|
+
'android:color': (_this$theme$buttonDis = this.theme.buttonDisabledTextColor) !== null && _this$theme$buttonDis !== void 0 ? _this$theme$buttonDis : '@android:color/darker_gray'
|
|
429
|
+
}).up().ele('item', {
|
|
430
|
+
'android:state_pressed': 'true',
|
|
431
|
+
'android:color': (_this$theme$buttonTex = this.theme.buttonTextColor) !== null && _this$theme$buttonTex !== void 0 ? _this$theme$buttonTex : '@android:color/white'
|
|
432
|
+
}).up().ele('item', {
|
|
433
|
+
'android:color': (_this$theme$buttonTex2 = this.theme.buttonTextColor) !== null && _this$theme$buttonTex2 !== void 0 ? _this$theme$buttonTex2 : '@android:color/white'
|
|
434
|
+
}).up();
|
|
435
|
+
this.buttonColor = this.buttonColor.up();
|
|
436
|
+
this.root = this.root.up();
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
progressColor() {
|
|
442
|
+
if (this.theme.progressColor) {
|
|
443
|
+
this.printQueue.push(() => {
|
|
444
|
+
this.root = this.root.ele('item', {
|
|
445
|
+
name: 'colorControlActivated'
|
|
446
|
+
}).txt(this.theme.progressColor).up();
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
successAsset() {
|
|
452
|
+
if (!this.theme.successAsset) return;
|
|
453
|
+
this.printQueue.push(() => {
|
|
454
|
+
this.root = this.root.ele('item', {
|
|
455
|
+
name: 'personaInquiryCompleteImage'
|
|
456
|
+
}).txt(this.theme.successAsset).up().txt(' ');
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
failAsset() {
|
|
461
|
+
if (!this.theme.failAsset) return;
|
|
462
|
+
this.printQueue.push(() => {
|
|
463
|
+
this.root = this.root.ele('item', {
|
|
464
|
+
name: 'personaInquiryFailImage'
|
|
465
|
+
}).txt(this.theme.failAsset).up().txt(' ');
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
loadingAnimationAsset() {
|
|
470
|
+
if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent) return;
|
|
471
|
+
this.printQueue.push(() => {
|
|
472
|
+
this.root = this.root.ele('item', {
|
|
473
|
+
name: 'personaInquiryLoadingLottieRaw'
|
|
474
|
+
}).txt(this.theme.loadingAnimationAsset).up().txt(' ');
|
|
475
|
+
this.root = this.root.ele('item', {
|
|
476
|
+
name: 'personaInquiryLoadingLottieWidthPercent'
|
|
477
|
+
}).txt(this.theme.loadingAnimationWidthPercent).up().txt(' ');
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
selfieAnimationAsset() {
|
|
482
|
+
if (!this.theme.selfieAnimationAsset || !this.theme.selfieAnimationWidthPercent) return;
|
|
483
|
+
this.printQueue.push(() => {
|
|
484
|
+
this.root = this.root.ele('item', {
|
|
485
|
+
name: 'personaInquirySelfieLottieRaw'
|
|
486
|
+
}).txt(this.theme.selfieAnimationAsset).up().txt(' ');
|
|
487
|
+
this.root = this.root.ele('item', {
|
|
488
|
+
name: 'personaInquirySelfieLottieWidthPercent'
|
|
489
|
+
}).txt(this.theme.selfieAnimationWidthPercent).up().txt(' ');
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
var _default = AndroidResourcePrinter;
|
|
496
|
+
exports.default = _default;
|
|
497
|
+
//# sourceMappingURL=AndroidResourcePrinter.js.map
|