react-native-persona 1.3.0 → 1.3.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/RNPersonaInquiry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/bin/persona-tool +1 -2
  5. package/lib/commonjs/persona-tools/AndroidResourcePrinter.js +694 -0
  6. package/lib/commonjs/persona-tools/AndroidResourcePrinter.js.map +1 -0
  7. package/lib/commonjs/persona-tools/Config.js +95 -0
  8. package/lib/commonjs/persona-tools/Config.js.map +1 -0
  9. package/lib/commonjs/persona-tools/Theme.js +228 -0
  10. package/lib/commonjs/persona-tools/Theme.js.map +1 -0
  11. package/lib/commonjs/persona-tools/index.js +41 -0
  12. package/lib/commonjs/persona-tools/index.js.map +1 -0
  13. package/lib/commonjs/persona-tools/prompts.js +48 -0
  14. package/lib/commonjs/persona-tools/prompts.js.map +1 -0
  15. package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js +112 -0
  16. package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
  17. package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js +50 -0
  18. package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js.map +1 -0
  19. package/lib/module/persona-tools/AndroidResourcePrinter.js +686 -0
  20. package/lib/module/persona-tools/AndroidResourcePrinter.js.map +1 -0
  21. package/lib/module/persona-tools/Config.js +82 -0
  22. package/lib/module/persona-tools/Config.js.map +1 -0
  23. package/lib/module/persona-tools/Theme.js +212 -0
  24. package/lib/module/persona-tools/Theme.js.map +1 -0
  25. package/lib/module/persona-tools/index.js +33 -0
  26. package/lib/module/persona-tools/index.js.map +1 -0
  27. package/lib/module/persona-tools/prompts.js +31 -0
  28. package/lib/module/persona-tools/prompts.js.map +1 -0
  29. package/lib/module/persona-tools/tools/AndroidThemeGenerator.js +82 -0
  30. package/lib/module/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
  31. package/lib/module/persona-tools/tools/IosThemeInstructions.js +37 -0
  32. package/lib/module/persona-tools/tools/IosThemeInstructions.js.map +1 -0
  33. package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
  34. package/lib/typescript/persona-tools/{lib/AndroidResourcePrinter.d.ts → AndroidResourcePrinter.d.ts} +1 -1
  35. package/lib/typescript/persona-tools/{lib/prompts.d.ts → prompts.d.ts} +0 -0
  36. package/lib/typescript/{src/util.d.ts → util.d.ts} +0 -0
  37. package/package.json +2 -3
  38. package/{persona-tools/lib → src/persona-tools}/AndroidResourcePrinter.ts +1 -1
  39. package/{persona-tools → src/persona-tools}/Config.ts +0 -0
  40. package/{persona-tools → src/persona-tools}/Theme.ts +0 -0
  41. package/{persona-tools → src/persona-tools}/index.ts +1 -1
  42. package/{persona-tools/lib → src/persona-tools}/prompts.ts +0 -0
  43. package/{persona-tools → src/persona-tools}/tools/AndroidThemeGenerator.ts +2 -2
  44. package/{persona-tools → src/persona-tools}/tools/IosThemeInstructions.ts +1 -1
  45. package/lib/commonjs/util.spec.js +0 -31
  46. package/lib/commonjs/util.spec.js.map +0 -1
  47. package/lib/module/util.spec.js +0 -28
  48. package/lib/module/util.spec.js.map +0 -1
  49. package/lib/typescript/persona-tools/lib/AndroidResourcePrinter.spec.d.ts +0 -1
  50. package/lib/typescript/src/util.spec.d.ts +0 -1
  51. package/persona-tools/lib/AndroidResourcePrinter.spec.ts +0 -1228
  52. package/src/util.spec.ts +0 -22
@@ -0,0 +1,686 @@
1
+ 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; }
2
+
3
+ import { create as createXml } from 'xmlbuilder2';
4
+
5
+ class AndroidResourcePrinter {
6
+ constructor(theme) {
7
+ _defineProperty(this, "theme", void 0);
8
+
9
+ _defineProperty(this, "root", void 0);
10
+
11
+ _defineProperty(this, "buttonDrawable", void 0);
12
+
13
+ _defineProperty(this, "buttonSecondaryDrawable", void 0);
14
+
15
+ _defineProperty(this, "buttonColor", void 0);
16
+
17
+ _defineProperty(this, "preprintQueue", []);
18
+
19
+ _defineProperty(this, "printQueue", []);
20
+
21
+ _defineProperty(this, "postPrintQueue", []);
22
+
23
+ this.theme = theme;
24
+ this.root = createXml({
25
+ version: '1.0'
26
+ }).ele('resources');
27
+ this.buttonDrawable = createXml({
28
+ version: '1.0'
29
+ }).ele('selector', {
30
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
31
+ });
32
+ this.buttonSecondaryDrawable = createXml({
33
+ version: '1.0'
34
+ }).ele('selector', {
35
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
36
+ });
37
+ this.buttonColor = createXml({
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
+ buttonSecondaryDrawable: this.buttonSecondaryDrawable,
55
+ buttonColor: this.buttonColor
56
+ };
57
+ }
58
+
59
+ print() {
60
+ this.primaryColor();
61
+ this.accentColor();
62
+ this.darkPrimaryColor();
63
+ this.backgroundColor();
64
+ this.titleText();
65
+ this.bodyText();
66
+ this.footnoteText();
67
+ this.cameraInstructionsText();
68
+ this.cameraHintText();
69
+ this.cameraGuideHintText(); // this.formLabelText();
70
+
71
+ this.textField();
72
+ this.pickerText();
73
+ this.button();
74
+ this.progressColor();
75
+ this.successAsset();
76
+ this.failAsset();
77
+ this.loadingAnimationAsset();
78
+ this.selfieAnimationAsset();
79
+ this.preprintQueue.forEach(fn => fn()); // Precreate some style namespaces
80
+
81
+ this.root = this.root.ele('style', {
82
+ name: 'RN'
83
+ }).up();
84
+ this.root = this.root.ele('style', {
85
+ name: 'RN.Persona'
86
+ }).up();
87
+ this.root = this.root.ele('style', {
88
+ name: 'RN.Persona.Text'
89
+ }).up();
90
+ this.root = this.root.ele('style', {
91
+ name: 'Persona.Inquiry.Theme',
92
+ parent: 'Base.Persona.Inquiry.Theme.Light'
93
+ });
94
+ this.printQueue.forEach(fn => fn());
95
+ this.root = this.root.up();
96
+ this.postPrintQueue.forEach(fn => fn());
97
+ }
98
+
99
+ hasTheme() {
100
+ return Object.keys(this.theme).length > 0 && Object.values(this.theme).filter(Boolean).length > 0;
101
+ }
102
+
103
+ primaryColor() {
104
+ if (!this.theme.primaryColor) return;
105
+ this.printQueue.push(() => {
106
+ this.root = this.root.ele('item', {
107
+ name: 'colorPrimary'
108
+ }).txt(this.theme.primaryColor).up().txt(' ');
109
+ });
110
+ }
111
+
112
+ accentColor() {
113
+ if (!this.theme.accentColor) return;
114
+ this.printQueue.push(() => {
115
+ this.root = this.root.ele('item', {
116
+ name: 'colorAccent'
117
+ }).txt(this.theme.accentColor).up().txt(' ');
118
+ });
119
+ }
120
+
121
+ darkPrimaryColor() {
122
+ if (!this.theme.darkPrimaryColor) return;
123
+ this.printQueue.push(() => {
124
+ this.root = this.root.ele('item', {
125
+ name: 'colorPrimaryDark'
126
+ }).txt(this.theme.darkPrimaryColor).up().txt(' ');
127
+ });
128
+ }
129
+
130
+ backgroundColor() {
131
+ if (!this.theme.backgroundColor) return;
132
+ this.preprintQueue.push(() => {
133
+ this.root = this.root.ele('color', {
134
+ name: 'customPersonaBackgroundColor'
135
+ }).txt(this.theme.backgroundColor).up().txt(' ');
136
+ });
137
+ this.printQueue.push(() => {
138
+ this.root = this.root.ele('item', {
139
+ name: 'android:colorBackground'
140
+ }).txt('@color/customPersonaBackgroundColor').up().txt(' ');
141
+ });
142
+ }
143
+
144
+ titleText() {
145
+ if (this.theme.titleTextColor || this.theme.titleTextSize || this.theme.titleTextFont) {
146
+ this.printQueue.push(() => {
147
+ this.root = this.root.ele('item', {
148
+ name: 'personaTitleTextAppearance'
149
+ }).txt('@style/RN.Persona.Text.Title').up();
150
+ }); // Create a text appearance
151
+
152
+ this.postPrintQueue.push(() => {
153
+ this.root = this.root.ele('style', {
154
+ name: 'RN.Persona.Text.Title',
155
+ parent: 'Persona.Text.Body'
156
+ });
157
+
158
+ if (this.theme.titleTextColor) {
159
+ this.root = this.root.ele('item', {
160
+ name: 'android:textColor'
161
+ }).txt(this.theme.titleTextColor).up();
162
+ }
163
+
164
+ if (this.theme.titleTextFont) {
165
+ // TODO: Add notice about how to add a custom font that can be
166
+ // referenced here on Android
167
+ this.root = this.root.ele('item', {
168
+ name: 'android:fontFamily'
169
+ }).txt(this.theme.titleTextFont).up();
170
+ } // Default values taken from `Persona.Text.Title`
171
+ // in shared/src/main/res/values/styles.xml
172
+
173
+
174
+ const textSize = this.theme.titleTextSize ? `${this.theme.titleTextSize}sp` : '26sp';
175
+ this.root = this.root.ele('item', {
176
+ name: 'android:textSize'
177
+ }).txt(textSize).up().ele('item', {
178
+ name: 'android:textStyle'
179
+ }).txt('bold').up();
180
+ this.root = this.root.up();
181
+ });
182
+ } else {
183
+ this.printQueue.push(() => {
184
+ this.root = this.root.ele('item', {
185
+ name: 'personaTitleTextAppearance'
186
+ }).txt('@style/Persona.Text.Title').up();
187
+ });
188
+ }
189
+ }
190
+
191
+ bodyText() {
192
+ if (this.theme.bodyTextColor || this.theme.bodyTextSize || this.theme.bodyTextFont) {
193
+ this.printQueue.push(() => {
194
+ this.root = this.root.ele('item', {
195
+ name: 'personaBodyTextAppearance'
196
+ }).txt('@style/RN.Persona.Text.Body').up();
197
+ }); // Create a text appearance
198
+
199
+ this.postPrintQueue.push(() => {
200
+ this.root = this.root.ele('style', {
201
+ name: 'RN.Persona.Text.Body',
202
+ parent: 'Persona.Text.Body'
203
+ });
204
+
205
+ if (this.theme.bodyTextColor) {
206
+ this.root = this.root.ele('item', {
207
+ name: 'android:textColor'
208
+ }).txt(this.theme.bodyTextColor).up();
209
+ }
210
+
211
+ if (this.theme.bodyTextFont) {
212
+ // TODO: Add notice about how to add a custom font that can be
213
+ // referenced here on Android
214
+ this.root = this.root.ele('item', {
215
+ name: 'android:fontFamily'
216
+ }).txt(this.theme.bodyTextFont).up();
217
+ }
218
+
219
+ const textSize = this.theme.bodyTextSize ? `${this.theme.bodyTextSize}sp` : '18sp';
220
+ this.root = this.root.ele('item', {
221
+ name: 'android:textSize'
222
+ }).txt(textSize).up();
223
+ this.root = this.root.up();
224
+ });
225
+ } else {
226
+ this.printQueue.push(() => {
227
+ this.root = this.root.ele('item', {
228
+ name: 'personaBodyTextAppearance'
229
+ }).txt('@style/Persona.Text.Body').up();
230
+ });
231
+ }
232
+ }
233
+
234
+ footnoteText() {
235
+ if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
236
+ this.postPrintQueue.push(() => {
237
+ var _this$theme$footnoteT;
238
+
239
+ this.root = this.root.ele('style', {
240
+ name: 'TextAppearance.AppCompat.Small'
241
+ }).ele('item', {
242
+ name: 'android:textColor'
243
+ }).txt( // Used default value found in the Android SDK
244
+ (_this$theme$footnoteT = this.theme.footnoteTextColor) !== null && _this$theme$footnoteT !== void 0 ? _this$theme$footnoteT : '?android:attr/textColorTertiary').up();
245
+
246
+ if (this.theme.footnoteTextFont) {
247
+ var _this$theme$footnoteT2;
248
+
249
+ this.root = this.root.ele('item', {
250
+ name: 'android:fontFamily'
251
+ }).txt( // Used default value found in the Android SDK
252
+ (_this$theme$footnoteT2 = this.theme.footnoteTextFont) !== null && _this$theme$footnoteT2 !== void 0 ? _this$theme$footnoteT2 : '?android:attr/textColorTertiary').up();
253
+ } // Default value found in the Android SDK
254
+
255
+
256
+ const textSize = this.theme.footnoteTextSize ? `${this.theme.footnoteTextSize}sp` : '@dimen/abc_text_size_small_material';
257
+ this.root = this.root.ele('item', {
258
+ name: 'android:textSize'
259
+ }).txt(textSize).up();
260
+ this.root = this.root.up();
261
+ });
262
+ }
263
+ }
264
+
265
+ cameraInstructionsText() {
266
+ if (this.theme.cameraInstructionsTextColor || this.theme.cameraInstructionsTextSize || this.theme.cameraInstructionsTextFont) {
267
+ this.printQueue.push(() => {
268
+ this.root = this.root.ele('item', {
269
+ name: 'personaCameraTitleTextAppearance'
270
+ }).txt('@style/RN.Persona.Text.CameraTitle').up();
271
+ }); // Create a text appearance
272
+
273
+ this.postPrintQueue.push(() => {
274
+ this.root = this.root.ele('style', {
275
+ name: 'RN.Persona.Text.CameraTitle',
276
+ parent: 'Persona.Text.CameraTitle'
277
+ });
278
+
279
+ if (this.theme.cameraInstructionsTextColor) {
280
+ this.root = this.root.ele('item', {
281
+ name: 'android:textColor'
282
+ }).txt(this.theme.cameraInstructionsTextColor).up();
283
+ }
284
+
285
+ if (this.theme.cameraInstructionsTextFont) {
286
+ // TODO: Add notice about how to add a custom font that can be
287
+ // referenced here on Android
288
+ this.root = this.root.ele('item', {
289
+ name: 'android:fontFamily'
290
+ }).txt(this.theme.cameraInstructionsTextFont).up();
291
+ }
292
+
293
+ const textSize = this.theme.cameraInstructionsTextSize ? `${this.theme.cameraInstructionsTextSize}sp` : '20sp';
294
+ this.root = this.root.ele('item', {
295
+ name: 'android:textSize'
296
+ }).txt(textSize).up();
297
+ this.root = this.root.up();
298
+ });
299
+ } else {
300
+ this.printQueue.push(() => {
301
+ this.root = this.root.ele('item', {
302
+ name: 'personaCameraTitleTextAppearance'
303
+ }).txt('@style/Persona.Text.CameraTitle').up();
304
+ });
305
+ }
306
+ }
307
+
308
+ cameraHintText() {
309
+ if (this.theme.cameraHintTextColor || this.theme.cameraHintTextSize || this.theme.cameraHintTextFont) {
310
+ this.printQueue.push(() => {
311
+ this.root = this.root.ele('item', {
312
+ name: 'personaCameraBodyTextAppearance'
313
+ }).txt('@style/RN.Persona.Text.CameraBody').up();
314
+ }); // Create a text appearance
315
+
316
+ this.postPrintQueue.push(() => {
317
+ this.root = this.root.ele('style', {
318
+ name: 'RN.Persona.Text.CameraBody',
319
+ parent: 'Persona.Text.CameraBody'
320
+ });
321
+
322
+ if (this.theme.cameraHintTextColor) {
323
+ this.root = this.root.ele('item', {
324
+ name: 'android:textColor'
325
+ }).txt(this.theme.cameraHintTextColor).up();
326
+ }
327
+
328
+ if (this.theme.cameraHintTextFont) {
329
+ // TODO: Add notice about how to add a custom font that can be
330
+ // referenced here on Android
331
+ this.root = this.root.ele('item', {
332
+ name: 'android:fontFamily'
333
+ }).txt(this.theme.cameraHintTextFont).up();
334
+ }
335
+
336
+ const textSize = this.theme.cameraHintTextSize ? `${this.theme.cameraHintTextSize}sp` : '16sp';
337
+ this.root = this.root.ele('item', {
338
+ name: 'android:textSize'
339
+ }).txt(textSize).up();
340
+ this.root = this.root.up();
341
+ });
342
+ } else {
343
+ this.printQueue.push(() => {
344
+ this.root = this.root.ele('item', {
345
+ name: 'personaCameraBodyTextAppearance'
346
+ }).txt('@style/Persona.Text.CameraBody').up();
347
+ });
348
+ }
349
+ }
350
+
351
+ cameraGuideHintText() {
352
+ if (this.theme.cameraGuideHintTextColor || this.theme.cameraGuideHintTextSize || this.theme.cameraGuideHintTextFont) {
353
+ this.printQueue.push(() => {
354
+ this.root = this.root.ele('item', {
355
+ name: 'personaCameraHintTextAppearance'
356
+ }).txt('@style/RN.Persona.Text.CameraHint').up();
357
+ }); // Create a text appearance
358
+
359
+ this.postPrintQueue.push(() => {
360
+ this.root = this.root.ele('style', {
361
+ name: 'RN.Persona.Text.CameraHint',
362
+ parent: 'Persona.Text.CameraHint'
363
+ });
364
+
365
+ if (this.theme.cameraGuideHintTextColor) {
366
+ this.root = this.root.ele('item', {
367
+ name: 'android:textColor'
368
+ }).txt(this.theme.cameraGuideHintTextColor).up();
369
+ }
370
+
371
+ if (this.theme.cameraGuideHintTextFont) {
372
+ // TODO: Add notice about how to add a custom font that can be
373
+ // referenced here on Android
374
+ this.root = this.root.ele('item', {
375
+ name: 'android:fontFamily'
376
+ }).txt(this.theme.cameraGuideHintTextFont).up();
377
+ }
378
+
379
+ const textSize = this.theme.cameraGuideHintTextSize ? `${this.theme.cameraGuideHintTextSize}sp` : '20sp';
380
+ this.root = this.root.ele('item', {
381
+ name: 'android:textSize'
382
+ }).txt(textSize).up();
383
+ this.root = this.root.up();
384
+ });
385
+ } else {
386
+ this.printQueue.push(() => {
387
+ this.root = this.root.ele('item', {
388
+ name: 'personaCameraHintTextAppearance'
389
+ }).txt('@style/Persona.Text.CameraHint').up();
390
+ });
391
+ }
392
+ }
393
+
394
+ textField() {
395
+ if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
396
+ this.printQueue.push(() => {
397
+ this.root = this.root.ele('item', {
398
+ name: 'editTextStyle'
399
+ }).txt('@style/RN.Persona.EditText').up();
400
+ });
401
+ this.postPrintQueue.push(() => {
402
+ this.root = this.root.ele('style', {
403
+ name: 'RN.Persona.EditText',
404
+ parent: 'Widget.AppCompat.EditText'
405
+ }).ele('item', {
406
+ name: 'android:textAppearance'
407
+ }).txt('@style/RN.Persona.EditText.TextAppearance').up().ele('item', {
408
+ name: 'android:textColor'
409
+ }).txt(this.theme.textFieldTextColor).up().up();
410
+ this.root = this.root.ele('style', {
411
+ name: 'RN.Persona.EditText.TextAppearance',
412
+ parent: 'Base.TextAppearance.AppCompat.Medium'
413
+ });
414
+
415
+ if (this.theme.textFieldTextColor) {
416
+ this.root = this.root.ele('item', {
417
+ name: 'android:textSize'
418
+ }).txt('18sp').up();
419
+ }
420
+
421
+ if (this.theme.textFieldTextFont) {
422
+ this.root = this.root.ele('item', {
423
+ name: 'android:fontFamily'
424
+ }).txt(this.theme.textFieldTextFont).up();
425
+ }
426
+
427
+ this.root = this.root.up();
428
+ });
429
+ }
430
+ }
431
+
432
+ pickerText() {
433
+ if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
434
+ this.printQueue.push(() => {
435
+ this.root = this.root.ele('item', {
436
+ name: 'spinnerStyle'
437
+ }).txt('@style/RN.Persona.Spinner').up();
438
+ this.root = this.root.ele('item', {
439
+ name: 'spinnerDropDownItemStyle'
440
+ }).txt('@style/RN.Persona.DropDownItem.Spinner').up();
441
+ });
442
+ this.postPrintQueue.push(() => {
443
+ var _this$theme$pickerTex, _this$theme$pickerTex2;
444
+
445
+ // Build Rn.Persona.Spinner
446
+ this.root = this.root.ele('style', {
447
+ name: 'RN.Persona.Spinner',
448
+ parent: 'Widget.AppCompat.Spinner'
449
+ }).ele('item', {
450
+ name: 'android:textColor'
451
+ }).txt((_this$theme$pickerTex = this.theme.pickerTextColor) !== null && _this$theme$pickerTex !== void 0 ? _this$theme$pickerTex : '?android:attr/textColorPrimary').up().ele('item', {
452
+ name: 'android:textAppearance'
453
+ }).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Text.Body').up().up(); // Build RN.Persona.DropDownItem.Spinner
454
+
455
+ this.root = this.root.ele('style', {
456
+ name: 'RN.Persona.DropDownItem.Spinner',
457
+ parent: 'Widget.AppCompat.DropDownItem.Spinner'
458
+ }).ele('item', {
459
+ name: 'android:textColor'
460
+ }).txt((_this$theme$pickerTex2 = this.theme.pickerTextColor) !== null && _this$theme$pickerTex2 !== void 0 ? _this$theme$pickerTex2 : '?android:attr/textColorPrimary').up().ele('item', {
461
+ name: 'android:textAppearance'
462
+ }).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Text.Body').up().up(); // Build RN.Persona.Text.Spinner
463
+
464
+ this.root = this.root.ele('style', {
465
+ name: 'RN.Persona.Text.Spinner'
466
+ });
467
+
468
+ if (this.theme.pickerTextColor) {
469
+ this.root = this.root.ele('item', {
470
+ name: 'android:textColor'
471
+ }).txt(this.theme.pickerTextColor).up();
472
+ }
473
+
474
+ if (this.theme.pickerTextFont) {
475
+ // TODO: Add notice about how to add a custom font that can be
476
+ // referenced here on Android
477
+ this.root = this.root.ele('item', {
478
+ name: 'android:fontFamily'
479
+ }).txt(this.theme.pickerTextFont).up();
480
+ }
481
+
482
+ this.root = this.root.up();
483
+ });
484
+ }
485
+ }
486
+
487
+ button() {
488
+ if (this.theme.buttonBackgroundColor || this.theme.buttonDisabledBackgroundColor || this.theme.buttonTouchedBackgroundColor || this.theme.buttonTextColor || this.theme.buttonDisabledTextColor || this.theme.buttonCornerRadius || this.theme.buttonFont || this.theme.buttonTextSize) {
489
+ this.printQueue.push(() => {
490
+ this.root = this.root.ele('item', {
491
+ name: 'buttonStyle'
492
+ }).txt('@style/RN.Persona.Button').up();
493
+ this.root = this.root.ele('item', {
494
+ name: 'buttonStyleSecondary'
495
+ }).txt('@style/RN.Persona.Button.Secondary').up();
496
+ });
497
+ const textSize = this.theme.buttonTextSize ? `${this.theme.buttonTextSize}sp` : '18sp';
498
+ this.postPrintQueue.push(() => {
499
+ var _this$theme$buttonTou, _this$theme$buttonBac, _this$theme$buttonDis, _this$theme$buttonTex, _this$theme$buttonTex2;
500
+
501
+ this.root = this.root.ele('style', {
502
+ name: 'RN.Persona.Button',
503
+ parent: 'android:style/Widget.Button'
504
+ }) // Taken from
505
+ // appcompat's res/values/values.xml
506
+ .ele('item', {
507
+ name: 'android:minHeight'
508
+ }).txt('48dip').up() // Taken from
509
+ // appcompat's res/values/values.xml
510
+ .ele('item', {
511
+ name: 'android:minWidth'
512
+ }).txt('88dip').up() // Taken from
513
+ // persona-android's shared/src/main/res/values/styles.xml
514
+ .ele('item', {
515
+ name: 'android:textSize'
516
+ }).txt(textSize).up().ele('item', {
517
+ name: 'android:background'
518
+ }).txt('@drawable/rn_persona_button').up().ele('item', {
519
+ name: 'android:textColor'
520
+ }).txt('@color/rn_persona_button').up().up(); // Build RN.Persona.Button.Secondary
521
+
522
+ this.root = this.root.ele('style', {
523
+ name: 'RN.Persona.Button.Secondary',
524
+ parent: 'RN.Persona.Button'
525
+ }).ele('item', {
526
+ name: 'android:background'
527
+ }).txt('@drawable/rn_persona_button_secondary').up().up(); // Disabled
528
+
529
+ this.buttonDrawable = this.buttonDrawable.ele('item', {
530
+ 'android:state_enabled': 'false'
531
+ }).ele('shape', {
532
+ 'android:shape': 'rectangle'
533
+ }).ele('corners', {
534
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
535
+ }).up().ele('padding', {
536
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
537
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
538
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
539
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
540
+ }).up().ele('solid', {
541
+ 'android:color': this.theme.buttonDisabledBackgroundColor ? this.theme.buttonDisabledBackgroundColor : '?attr/colorPrimaryDark'
542
+ }).up().up().up(); // touched
543
+
544
+ this.buttonDrawable = this.buttonDrawable.ele('item', {
545
+ 'android:state_pressed': 'true'
546
+ }).ele('shape', {
547
+ 'android:shape': 'rectangle'
548
+ }).ele('corners', {
549
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
550
+ }).up().ele('solid', {
551
+ 'android:color': (_this$theme$buttonTou = this.theme.buttonTouchedBackgroundColor) !== null && _this$theme$buttonTou !== void 0 ? _this$theme$buttonTou : '?attr/colorPrimaryDark'
552
+ }).up().ele('padding', {
553
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
554
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
555
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
556
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
557
+ }).up().up().up();
558
+ this.buttonDrawable = this.buttonDrawable.ele('item').ele('shape', {
559
+ 'android:shape': 'rectangle'
560
+ }).ele('corners', {
561
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
562
+ }).up().ele('solid', {
563
+ 'android:color': (_this$theme$buttonBac = this.theme.buttonBackgroundColor) !== null && _this$theme$buttonBac !== void 0 ? _this$theme$buttonBac : '?attr/colorPrimary'
564
+ }).up().ele('padding', {
565
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
566
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
567
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
568
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
569
+ }).up().up().up(); // Finish button drawable
570
+
571
+ this.buttonDrawable = this.buttonDrawable.up();
572
+ this.buttonColor = this.buttonColor.ele('item', {
573
+ 'android:state_enabled': 'false',
574
+ 'android:color': (_this$theme$buttonDis = this.theme.buttonDisabledTextColor) !== null && _this$theme$buttonDis !== void 0 ? _this$theme$buttonDis : '@android:color/darker_gray'
575
+ }).up().ele('item', {
576
+ 'android:state_pressed': 'true',
577
+ 'android:color': (_this$theme$buttonTex = this.theme.buttonTextColor) !== null && _this$theme$buttonTex !== void 0 ? _this$theme$buttonTex : '@android:color/white'
578
+ }).up().ele('item', {
579
+ 'android:color': (_this$theme$buttonTex2 = this.theme.buttonTextColor) !== null && _this$theme$buttonTex2 !== void 0 ? _this$theme$buttonTex2 : '@android:color/white'
580
+ }).up();
581
+ this.buttonColor = this.buttonColor.up(); // Disabled
582
+
583
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.ele('item', {
584
+ 'android:state_enabled': 'false'
585
+ }).ele('shape', {
586
+ 'android:shape': 'rectangle'
587
+ }).ele('corners', {
588
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
589
+ }).up().ele('padding', {
590
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
591
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
592
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
593
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
594
+ }).up().ele('solid', {
595
+ 'android:color': '@android:color/darker_gray'
596
+ }).up().up().up(); // touched
597
+
598
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.ele('item', {
599
+ 'android:state_pressed': 'true'
600
+ }).ele('shape', {
601
+ 'android:shape': 'rectangle'
602
+ }).ele('corners', {
603
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
604
+ }).up().ele('solid', {
605
+ 'android:color': '@color/grayButtonDark'
606
+ }).up().ele('padding', {
607
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
608
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
609
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
610
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
611
+ }).up().up().up();
612
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.ele('item').ele('shape', {
613
+ 'android:shape': 'rectangle'
614
+ }).ele('corners', {
615
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
616
+ }).up().ele('solid', {
617
+ 'android:color': '@color/grayButton'
618
+ }).up().ele('padding', {
619
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
620
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
621
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
622
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
623
+ }).up().up().up(); // Finish button drawable
624
+
625
+ this.buttonSecondaryDrawable = this.buttonSecondaryDrawable.up();
626
+ this.root = this.root.up();
627
+ });
628
+ }
629
+ }
630
+
631
+ progressColor() {
632
+ if (this.theme.progressColor) {
633
+ this.printQueue.push(() => {
634
+ this.root = this.root.ele('item', {
635
+ name: 'colorControlActivated'
636
+ }).txt(this.theme.progressColor).up();
637
+ });
638
+ }
639
+ }
640
+
641
+ successAsset() {
642
+ if (!this.theme.successAsset) return;
643
+ this.printQueue.push(() => {
644
+ this.root = this.root.ele('item', {
645
+ name: 'personaInquiryCompleteImage'
646
+ }).txt(this.theme.successAsset).up().txt(' ');
647
+ });
648
+ }
649
+
650
+ failAsset() {
651
+ if (!this.theme.failAsset) return;
652
+ this.printQueue.push(() => {
653
+ this.root = this.root.ele('item', {
654
+ name: 'personaInquiryFailImage'
655
+ }).txt(this.theme.failAsset).up().txt(' ');
656
+ });
657
+ }
658
+
659
+ loadingAnimationAsset() {
660
+ if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent) return;
661
+ this.printQueue.push(() => {
662
+ this.root = this.root.ele('item', {
663
+ name: 'personaInquiryLoadingLottieRaw'
664
+ }).txt(this.theme.loadingAnimationAsset).up().txt(' ');
665
+ this.root = this.root.ele('item', {
666
+ name: 'personaInquiryLoadingLottieWidthPercent'
667
+ }).txt(this.theme.loadingAnimationWidthPercent).up().txt(' ');
668
+ });
669
+ }
670
+
671
+ selfieAnimationAsset() {
672
+ if (!this.theme.selfieAnimationAsset || !this.theme.selfieAnimationWidthPercent) return;
673
+ this.printQueue.push(() => {
674
+ this.root = this.root.ele('item', {
675
+ name: 'personaInquirySelfieLottieRaw'
676
+ }).txt(this.theme.selfieAnimationAsset).up().txt(' ');
677
+ this.root = this.root.ele('item', {
678
+ name: 'personaInquirySelfieLottieWidthPercent'
679
+ }).txt(this.theme.selfieAnimationWidthPercent).up().txt(' ');
680
+ });
681
+ }
682
+
683
+ }
684
+
685
+ export default AndroidResourcePrinter;
686
+ //# sourceMappingURL=AndroidResourcePrinter.js.map