html2apk 0.8.0 → 0.11.0
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 +340 -4
- package/package.json +15 -4
- package/src/desktop/main.js +902 -0
- package/src/desktop/preload.js +1 -0
- package/src/desktop/renderer/index.html +12 -6
- package/src/desktop/renderer/renderer.js +1164 -59
- package/src/desktop/renderer/styles.css +199 -30
- package/src/runtime-manager/index.js +79 -17
- package/src/templates/cordova-plugin-html2apk-bridge/plugin.xml +50 -0
- package/src/templates/cordova-plugin-html2apk-bridge/src/android/FloatingIconService.java +33 -0
- package/src/templates/cordova-plugin-html2apk-bridge/src/android/Html2ApkBridge.java +5929 -403
- package/src/templates/cordova-plugin-html2apk-bridge/src/android/xml/html2apk_file_paths.xml +6 -0
- package/src/templates/cordova-plugin-html2apk-bridge/www/html2apk-bridge.js +882 -4
- package/src/templates/html2apk-early-bridge.js +879 -4
- package/src/templates/html2apk-runtime-console.js +321 -29
- package/examples/minimal/dist/MeuApp-1.0.0-debug.apk +0 -0
- package/examples/minimal/dist/MeuApp-1.0.0-release.aab +0 -0
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
var deviceReady = typeof document === "undefined";
|
|
9
9
|
var readyCallbacks = [];
|
|
10
|
+
var bluetoothServerStartPromise = null;
|
|
11
|
+
var wifiServerStartPromise = null;
|
|
10
12
|
var scheduledNotificationCounter = 0;
|
|
11
13
|
var notificationActionCounter = 0;
|
|
12
14
|
var notificationActionCallbacks = {};
|
|
@@ -19,6 +21,35 @@
|
|
|
19
21
|
"link:opened": "link:aberto",
|
|
20
22
|
"network:changed": "rede:mudou",
|
|
21
23
|
"battery:changed": "bateria:mudou",
|
|
24
|
+
"location:changed": "localizacao:mudou",
|
|
25
|
+
"biometric:failed": "biometria:falhou",
|
|
26
|
+
"share:received": "compartilhamento:recebido",
|
|
27
|
+
"sharing:received": "compartilhamento:recebido",
|
|
28
|
+
"bt:connected": "bluetooth:conectado",
|
|
29
|
+
"bluetooth:connected": "bluetooth:conectado",
|
|
30
|
+
"bt:data": "bluetooth:dados",
|
|
31
|
+
"bluetooth:data": "bluetooth:dados",
|
|
32
|
+
"bt:disconnected": "bluetooth:desconectado",
|
|
33
|
+
"bluetooth:disconnected": "bluetooth:desconectado",
|
|
34
|
+
"bt:error": "bluetooth:erro",
|
|
35
|
+
"bluetooth:error": "bluetooth:erro",
|
|
36
|
+
"wifi:connected": "wifi:conectado",
|
|
37
|
+
"wifi:data": "wifi:dados",
|
|
38
|
+
"wifi:disconnected": "wifi:desconectado",
|
|
39
|
+
"wifi:error": "wifi:erro",
|
|
40
|
+
"usb:connected": "usb:conectado",
|
|
41
|
+
"usb:disconnected": "usb:desconectado",
|
|
42
|
+
"headphone:connected": "fone:conectado",
|
|
43
|
+
"headphone:disconnected": "fone:desconectado",
|
|
44
|
+
"volume:changed": "volume:mudou",
|
|
45
|
+
"keyboard:opened": "teclado:abriu",
|
|
46
|
+
"keyboard:closed": "teclado:fechou",
|
|
47
|
+
"phone:shaken": "celular:sacudido",
|
|
48
|
+
"phone:faceDown": "celular:tela_para_baixo",
|
|
49
|
+
"proximity:near": "proximidade:perto",
|
|
50
|
+
"screenshot:taken": "print:tela",
|
|
51
|
+
"orientation:changed": "orientacao:mudou",
|
|
52
|
+
"nfc:received": "nfc:recebido",
|
|
22
53
|
"notification:received": "notificacao:recebida",
|
|
23
54
|
"notification:clicked": "notificacao:clicada"
|
|
24
55
|
};
|
|
@@ -26,6 +57,7 @@
|
|
|
26
57
|
var notificationListeners = [];
|
|
27
58
|
var initialNotification = null;
|
|
28
59
|
var initialLink = null;
|
|
60
|
+
var initialShare = null;
|
|
29
61
|
|
|
30
62
|
function markReady() {
|
|
31
63
|
if (deviceReady) {
|
|
@@ -406,6 +438,440 @@
|
|
|
406
438
|
});
|
|
407
439
|
}
|
|
408
440
|
|
|
441
|
+
function hasOwn(object, key) {
|
|
442
|
+
return Object.prototype.hasOwnProperty.call(object || {}, key);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function storedFileOptions(nameOrOptions, value, options) {
|
|
446
|
+
var normalized;
|
|
447
|
+
if (nameOrOptions && typeof nameOrOptions === "object" && !Array.isArray(nameOrOptions)) {
|
|
448
|
+
return cloneSerializable(nameOrOptions) || {};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
452
|
+
normalized.name = String(nameOrOptions || "");
|
|
453
|
+
normalized.nome = normalized.name;
|
|
454
|
+
normalized.value = cloneSerializable(value);
|
|
455
|
+
normalized.valor = normalized.value;
|
|
456
|
+
if (typeof value !== "string" && !hasOwn(normalized, "json")) {
|
|
457
|
+
normalized.json = true;
|
|
458
|
+
}
|
|
459
|
+
return normalized;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function storedFileNameOptions(nameOrOptions, options) {
|
|
463
|
+
var normalized;
|
|
464
|
+
if (nameOrOptions && typeof nameOrOptions === "object" && !Array.isArray(nameOrOptions)) {
|
|
465
|
+
return cloneSerializable(nameOrOptions) || {};
|
|
466
|
+
}
|
|
467
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
468
|
+
normalized.name = String(nameOrOptions || "");
|
|
469
|
+
normalized.nome = normalized.name;
|
|
470
|
+
return normalized;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function applyDownloadName(normalized, nameOrOptions) {
|
|
474
|
+
if (typeof nameOrOptions === "string") {
|
|
475
|
+
normalized.name = nameOrOptions;
|
|
476
|
+
normalized.nome = nameOrOptions;
|
|
477
|
+
normalized.fileName = nameOrOptions;
|
|
478
|
+
normalized.nomeArquivo = nameOrOptions;
|
|
479
|
+
} else if (nameOrOptions && typeof nameOrOptions === "object" && !Array.isArray(nameOrOptions)) {
|
|
480
|
+
Object.assign(normalized, cloneSerializable(nameOrOptions) || {});
|
|
481
|
+
}
|
|
482
|
+
return normalized;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function applyBase64DownloadSource(normalized, value) {
|
|
486
|
+
var source = String(value || "");
|
|
487
|
+
var comma;
|
|
488
|
+
var header;
|
|
489
|
+
var mimeType;
|
|
490
|
+
|
|
491
|
+
if (source.indexOf("data:") === 0) {
|
|
492
|
+
comma = source.indexOf(",");
|
|
493
|
+
header = comma >= 0 ? source.slice(5, comma) : "";
|
|
494
|
+
mimeType = header.split(";")[0];
|
|
495
|
+
normalized.base64 = comma >= 0 ? source.slice(comma + 1) : source;
|
|
496
|
+
if (mimeType) {
|
|
497
|
+
normalized.mimeType = normalized.mimeType || mimeType;
|
|
498
|
+
normalized.tipoMime = normalized.tipoMime || mimeType;
|
|
499
|
+
}
|
|
500
|
+
return normalized;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
normalized.base64 = source;
|
|
504
|
+
return normalized;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function downloadFileOptions(urlOrOptions, nameOrOptions, options) {
|
|
508
|
+
var normalized;
|
|
509
|
+
var source;
|
|
510
|
+
|
|
511
|
+
if (urlOrOptions && typeof urlOrOptions === "object" && !Array.isArray(urlOrOptions)) {
|
|
512
|
+
normalized = cloneSerializable(urlOrOptions) || {};
|
|
513
|
+
applyDownloadName(normalized, nameOrOptions);
|
|
514
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
515
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
516
|
+
}
|
|
517
|
+
return normalized;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
521
|
+
source = String(urlOrOptions || "").trim();
|
|
522
|
+
if (source.indexOf("data:") === 0) {
|
|
523
|
+
applyBase64DownloadSource(normalized, source);
|
|
524
|
+
} else {
|
|
525
|
+
normalized.url = source;
|
|
526
|
+
}
|
|
527
|
+
return applyDownloadName(normalized, nameOrOptions);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
function downloadBase64Options(nameOrOptions, base64, options) {
|
|
531
|
+
var normalized;
|
|
532
|
+
if (nameOrOptions && typeof nameOrOptions === "object" && !Array.isArray(nameOrOptions)) {
|
|
533
|
+
normalized = cloneSerializable(nameOrOptions) || {};
|
|
534
|
+
if (typeof base64 === "string") {
|
|
535
|
+
applyBase64DownloadSource(normalized, base64);
|
|
536
|
+
} else if (base64 && typeof base64 === "object" && !Array.isArray(base64)) {
|
|
537
|
+
Object.assign(normalized, cloneSerializable(base64) || {});
|
|
538
|
+
}
|
|
539
|
+
return normalized;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
543
|
+
applyDownloadName(normalized, String(nameOrOptions || ""));
|
|
544
|
+
return applyBase64DownloadSource(normalized, base64);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
function downloadLocalFileOptions(fileOrOptions, nameOrOptions, options) {
|
|
548
|
+
var normalized;
|
|
549
|
+
var source;
|
|
550
|
+
|
|
551
|
+
if (fileOrOptions && typeof fileOrOptions === "object" && !Array.isArray(fileOrOptions)) {
|
|
552
|
+
normalized = cloneSerializable(fileOrOptions) || {};
|
|
553
|
+
applyDownloadName(normalized, nameOrOptions);
|
|
554
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
555
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
556
|
+
}
|
|
557
|
+
return normalized;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
561
|
+
source = String(fileOrOptions || "").trim();
|
|
562
|
+
if (/^(content|file):\/\//.test(source)) {
|
|
563
|
+
normalized.uri = source;
|
|
564
|
+
normalized.contentUri = source;
|
|
565
|
+
} else if (/^[A-Za-z]:[\\/]/.test(source) || source.charAt(0) === "/" || source.charAt(0) === "\\") {
|
|
566
|
+
normalized.path = source;
|
|
567
|
+
normalized.caminho = source;
|
|
568
|
+
} else {
|
|
569
|
+
normalized.sourceName = source;
|
|
570
|
+
normalized.arquivoOrigem = source;
|
|
571
|
+
}
|
|
572
|
+
return applyDownloadName(normalized, nameOrOptions);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function ocrOptions(sourceOrOptions) {
|
|
576
|
+
if (sourceOrOptions && typeof sourceOrOptions === "object" && !Array.isArray(sourceOrOptions)) {
|
|
577
|
+
return cloneSerializable(sourceOrOptions) || {};
|
|
578
|
+
}
|
|
579
|
+
var source = String(sourceOrOptions || "").trim();
|
|
580
|
+
if (source.indexOf("data:") === 0) {
|
|
581
|
+
return { base64: source };
|
|
582
|
+
}
|
|
583
|
+
if (/^(content|file):\/\//.test(source)) {
|
|
584
|
+
return { uri: source, contentUri: source };
|
|
585
|
+
}
|
|
586
|
+
if (/^[A-Za-z]:[\\/]/.test(source) || source.charAt(0) === "/" || source.charAt(0) === "\\") {
|
|
587
|
+
return { path: source, caminho: source };
|
|
588
|
+
}
|
|
589
|
+
return { name: source, nome: source };
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function normalizeReceivedShare(detail) {
|
|
593
|
+
var normalized = cloneSerializable(detail || {}) || {};
|
|
594
|
+
var kind = normalized.tipoConteudo || normalized.contentType || normalized.tipo || normalized.type;
|
|
595
|
+
if (kind) {
|
|
596
|
+
normalized.tipo = kind;
|
|
597
|
+
normalized.type = kind;
|
|
598
|
+
}
|
|
599
|
+
return normalized;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function bluetoothReceivedData(detail) {
|
|
603
|
+
if (!detail || typeof detail !== "object") {
|
|
604
|
+
return detail;
|
|
605
|
+
}
|
|
606
|
+
if (Object.prototype.hasOwnProperty.call(detail, "dados")) {
|
|
607
|
+
return detail.dados;
|
|
608
|
+
}
|
|
609
|
+
if (Object.prototype.hasOwnProperty.call(detail, "data")) {
|
|
610
|
+
return detail.data;
|
|
611
|
+
}
|
|
612
|
+
return detail;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
function bluetoothErrorDetail(errorOrDetail) {
|
|
616
|
+
var detail = errorOrDetail && typeof errorOrDetail === "object"
|
|
617
|
+
? cloneSerializable(errorOrDetail) || {}
|
|
618
|
+
: {};
|
|
619
|
+
var message = detail.message || detail.mensagem || detail.error || detail.erro ||
|
|
620
|
+
(errorOrDetail && (errorOrDetail.message || errorOrDetail.mensagem || errorOrDetail.error || errorOrDetail.erro)) ||
|
|
621
|
+
String(errorOrDetail || "");
|
|
622
|
+
detail.ok = false;
|
|
623
|
+
detail.message = message;
|
|
624
|
+
detail.mensagem = message;
|
|
625
|
+
detail.error = message;
|
|
626
|
+
detail.erro = message;
|
|
627
|
+
detail.timestamp = detail.timestamp || Date.now();
|
|
628
|
+
return detail;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function startBluetoothServerSilently() {
|
|
632
|
+
if (bluetoothServerStartPromise) {
|
|
633
|
+
return bluetoothServerStartPromise;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
bluetoothServerStartPromise = call("startBluetoothServer").catch(function (error) {
|
|
637
|
+
bluetoothServerStartPromise = null;
|
|
638
|
+
emitEvent("bluetooth:erro", bluetoothErrorDetail(error));
|
|
639
|
+
});
|
|
640
|
+
return bluetoothServerStartPromise;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function wifiReceivedData(detail) {
|
|
644
|
+
if (!detail || typeof detail !== "object") {
|
|
645
|
+
return detail;
|
|
646
|
+
}
|
|
647
|
+
if (Object.prototype.hasOwnProperty.call(detail, "dados")) {
|
|
648
|
+
return detail.dados;
|
|
649
|
+
}
|
|
650
|
+
if (Object.prototype.hasOwnProperty.call(detail, "data")) {
|
|
651
|
+
return detail.data;
|
|
652
|
+
}
|
|
653
|
+
return detail;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function wifiErrorDetail(errorOrDetail) {
|
|
657
|
+
var detail = errorOrDetail && typeof errorOrDetail === "object"
|
|
658
|
+
? cloneSerializable(errorOrDetail) || {}
|
|
659
|
+
: {};
|
|
660
|
+
var message = detail.message || detail.mensagem || detail.error || detail.erro ||
|
|
661
|
+
(errorOrDetail && (errorOrDetail.message || errorOrDetail.mensagem || errorOrDetail.error || errorOrDetail.erro)) ||
|
|
662
|
+
String(errorOrDetail || "");
|
|
663
|
+
detail.ok = false;
|
|
664
|
+
detail.message = message;
|
|
665
|
+
detail.mensagem = message;
|
|
666
|
+
detail.error = message;
|
|
667
|
+
detail.erro = message;
|
|
668
|
+
detail.timestamp = detail.timestamp || Date.now();
|
|
669
|
+
return detail;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function startWifiServerSilently() {
|
|
673
|
+
if (wifiServerStartPromise) {
|
|
674
|
+
return wifiServerStartPromise;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
wifiServerStartPromise = call("startWifiServer").catch(function (error) {
|
|
678
|
+
wifiServerStartPromise = null;
|
|
679
|
+
emitEvent("wifi:erro", wifiErrorDetail(error));
|
|
680
|
+
});
|
|
681
|
+
return wifiServerStartPromise;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function wallpaperOptions(sourceOrOptions, options) {
|
|
685
|
+
var normalized;
|
|
686
|
+
var source;
|
|
687
|
+
var comma;
|
|
688
|
+
var header;
|
|
689
|
+
var mimeType;
|
|
690
|
+
|
|
691
|
+
if (sourceOrOptions && typeof sourceOrOptions === "object" && !Array.isArray(sourceOrOptions)) {
|
|
692
|
+
normalized = cloneSerializable(sourceOrOptions) || {};
|
|
693
|
+
} else {
|
|
694
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
695
|
+
source = String(sourceOrOptions || "").trim();
|
|
696
|
+
if (source.indexOf("data:") === 0) {
|
|
697
|
+
comma = source.indexOf(",");
|
|
698
|
+
header = comma >= 0 ? source.slice(5, comma) : "";
|
|
699
|
+
mimeType = header.split(";")[0];
|
|
700
|
+
normalized.base64 = comma >= 0 ? source.slice(comma + 1) : source;
|
|
701
|
+
if (mimeType) {
|
|
702
|
+
normalized.mimeType = normalized.mimeType || mimeType;
|
|
703
|
+
normalized.tipoMime = normalized.tipoMime || mimeType;
|
|
704
|
+
}
|
|
705
|
+
} else if (/^(content|file):\/\//.test(source)) {
|
|
706
|
+
normalized.uri = source;
|
|
707
|
+
normalized.contentUri = source;
|
|
708
|
+
} else if (/^[A-Za-z]:[\\/]/.test(source) || source.charAt(0) === "/" || source.charAt(0) === "\\") {
|
|
709
|
+
normalized.path = source;
|
|
710
|
+
normalized.caminho = source;
|
|
711
|
+
} else {
|
|
712
|
+
normalized.name = source;
|
|
713
|
+
normalized.nome = source;
|
|
714
|
+
normalized.fileName = source;
|
|
715
|
+
normalized.nomeArquivo = source;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if (normalized.alvo && !normalized.target) {
|
|
720
|
+
normalized.target = normalized.alvo;
|
|
721
|
+
}
|
|
722
|
+
if (normalized.target && !normalized.alvo) {
|
|
723
|
+
normalized.alvo = normalized.target;
|
|
724
|
+
}
|
|
725
|
+
return normalized;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function volumeOptions(streamOrOptions, value, options) {
|
|
729
|
+
var normalized = {};
|
|
730
|
+
if (streamOrOptions && typeof streamOrOptions === "object" && !Array.isArray(streamOrOptions)) {
|
|
731
|
+
normalized = cloneSerializable(streamOrOptions) || {};
|
|
732
|
+
} else {
|
|
733
|
+
if (typeof streamOrOptions === "number") {
|
|
734
|
+
normalized.value = streamOrOptions;
|
|
735
|
+
normalized.valor = streamOrOptions;
|
|
736
|
+
} else if (typeof streamOrOptions === "string") {
|
|
737
|
+
normalized.stream = streamOrOptions;
|
|
738
|
+
normalized.tipo = streamOrOptions;
|
|
739
|
+
}
|
|
740
|
+
if (typeof value !== "undefined" && value !== null && typeof value !== "object") {
|
|
741
|
+
normalized.value = value;
|
|
742
|
+
normalized.valor = value;
|
|
743
|
+
}
|
|
744
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
745
|
+
Object.assign(normalized, cloneSerializable(value) || {});
|
|
746
|
+
}
|
|
747
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
748
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return normalized;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function adjustVolumeOptions(streamOrOptions, amountOrOptions, options, direction) {
|
|
755
|
+
var normalized = volumeOptions(streamOrOptions);
|
|
756
|
+
if (typeof amountOrOptions === "number") {
|
|
757
|
+
normalized.amount = amountOrOptions;
|
|
758
|
+
normalized.quantidade = amountOrOptions;
|
|
759
|
+
} else if (amountOrOptions && typeof amountOrOptions === "object" && !Array.isArray(amountOrOptions)) {
|
|
760
|
+
Object.assign(normalized, cloneSerializable(amountOrOptions) || {});
|
|
761
|
+
}
|
|
762
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
763
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
764
|
+
}
|
|
765
|
+
normalized.direction = direction;
|
|
766
|
+
normalized.direcao = direction;
|
|
767
|
+
return normalized;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
function floatingIconOptions(optionsOrOpacity) {
|
|
771
|
+
if (optionsOrOpacity && typeof optionsOrOpacity === "object" && !Array.isArray(optionsOrOpacity)) {
|
|
772
|
+
return cloneSerializable(optionsOrOpacity) || {};
|
|
773
|
+
}
|
|
774
|
+
if (typeof optionsOrOpacity === "number" || typeof optionsOrOpacity === "string") {
|
|
775
|
+
return {
|
|
776
|
+
opacity: Number(optionsOrOpacity),
|
|
777
|
+
opacidade: Number(optionsOrOpacity)
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
return {};
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function secureItemOptions(keyOrOptions, value, options) {
|
|
784
|
+
var normalized;
|
|
785
|
+
if (keyOrOptions && typeof keyOrOptions === "object" && !Array.isArray(keyOrOptions)) {
|
|
786
|
+
return cloneSerializable(keyOrOptions) || {};
|
|
787
|
+
}
|
|
788
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
789
|
+
normalized.key = String(keyOrOptions || "");
|
|
790
|
+
normalized.chave = normalized.key;
|
|
791
|
+
normalized.value = cloneSerializable(value);
|
|
792
|
+
normalized.valor = normalized.value;
|
|
793
|
+
if (typeof value !== "string" && !hasOwn(normalized, "json")) {
|
|
794
|
+
normalized.json = true;
|
|
795
|
+
}
|
|
796
|
+
return normalized;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
function secureKeyOptions(keyOrOptions, options) {
|
|
800
|
+
var normalized;
|
|
801
|
+
if (keyOrOptions && typeof keyOrOptions === "object" && !Array.isArray(keyOrOptions)) {
|
|
802
|
+
return cloneSerializable(keyOrOptions) || {};
|
|
803
|
+
}
|
|
804
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
805
|
+
normalized.key = String(keyOrOptions || "");
|
|
806
|
+
normalized.chave = normalized.key;
|
|
807
|
+
return normalized;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
function unwrapStoredValue(result) {
|
|
811
|
+
if (!result || result.exists === false || result.existe === false) {
|
|
812
|
+
return null;
|
|
813
|
+
}
|
|
814
|
+
if (hasOwn(result, "value")) {
|
|
815
|
+
return result.value;
|
|
816
|
+
}
|
|
817
|
+
if (hasOwn(result, "valor")) {
|
|
818
|
+
return result.valor;
|
|
819
|
+
}
|
|
820
|
+
if (hasOwn(result, "base64")) {
|
|
821
|
+
return result.base64;
|
|
822
|
+
}
|
|
823
|
+
if (hasOwn(result, "content")) {
|
|
824
|
+
return result.content;
|
|
825
|
+
}
|
|
826
|
+
if (hasOwn(result, "conteudo")) {
|
|
827
|
+
return result.conteudo;
|
|
828
|
+
}
|
|
829
|
+
return result;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
function detectQRCodeFromPhoto(photo) {
|
|
833
|
+
var source;
|
|
834
|
+
var detector;
|
|
835
|
+
|
|
836
|
+
if (!photo || !photo.base64) {
|
|
837
|
+
return null;
|
|
838
|
+
}
|
|
839
|
+
if (typeof BarcodeDetector !== "function" || typeof createImageBitmap !== "function" || typeof fetch !== "function") {
|
|
840
|
+
throw new Error("QR code scanning requires BarcodeDetector support in this Android WebView.");
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
detector = new BarcodeDetector({ formats: ["qr_code"] });
|
|
844
|
+
source = "data:" + (photo.mimeType || "image/jpeg") + ";base64," + photo.base64;
|
|
845
|
+
return fetch(source)
|
|
846
|
+
.then(function (response) {
|
|
847
|
+
return response.blob();
|
|
848
|
+
})
|
|
849
|
+
.then(function (blob) {
|
|
850
|
+
return createImageBitmap(blob);
|
|
851
|
+
})
|
|
852
|
+
.then(function (image) {
|
|
853
|
+
return detector.detect(image);
|
|
854
|
+
})
|
|
855
|
+
.then(function (codes) {
|
|
856
|
+
var first = codes && codes[0];
|
|
857
|
+
if (!first) {
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
return {
|
|
861
|
+
text: first.rawValue || "",
|
|
862
|
+
texto: first.rawValue || "",
|
|
863
|
+
rawValue: first.rawValue || "",
|
|
864
|
+
valorBruto: first.rawValue || "",
|
|
865
|
+
format: first.format || "qr_code",
|
|
866
|
+
formato: first.format || "qr_code",
|
|
867
|
+
codes: codes,
|
|
868
|
+
codigos: codes,
|
|
869
|
+
photo: photo,
|
|
870
|
+
foto: photo
|
|
871
|
+
};
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
|
|
409
875
|
function normalizeEventType(type) {
|
|
410
876
|
var eventType = String(type || "");
|
|
411
877
|
return eventAliases[eventType] || eventType;
|
|
@@ -553,6 +1019,14 @@
|
|
|
553
1019
|
toast: function (message) {
|
|
554
1020
|
return call("toast", [String(message || "")]);
|
|
555
1021
|
},
|
|
1022
|
+
aguardar: function (ms) {
|
|
1023
|
+
var delay = Math.max(0, Math.min(Number(ms) || 0, 2147483647));
|
|
1024
|
+
return new Promise(function (resolve) {
|
|
1025
|
+
setTimeout(function () {
|
|
1026
|
+
resolve({ ok: true, ms: delay });
|
|
1027
|
+
}, delay);
|
|
1028
|
+
});
|
|
1029
|
+
},
|
|
556
1030
|
fullscreen: function (enabled) {
|
|
557
1031
|
return call("fullscreen", [Boolean(enabled)]);
|
|
558
1032
|
},
|
|
@@ -577,6 +1051,15 @@
|
|
|
577
1051
|
statusLanterna: function () {
|
|
578
1052
|
return call("flashlightStatus");
|
|
579
1053
|
},
|
|
1054
|
+
tirarFoto: function (options) {
|
|
1055
|
+
return call("capturePhoto", [options || {}]);
|
|
1056
|
+
},
|
|
1057
|
+
capturarVideo: function (options) {
|
|
1058
|
+
return call("captureVideo", [options || {}]);
|
|
1059
|
+
},
|
|
1060
|
+
escanearQRCode: function (options) {
|
|
1061
|
+
return api.tirarFoto(Object.assign({ base64: true }, options || {})).then(detectQRCodeFromPhoto);
|
|
1062
|
+
},
|
|
580
1063
|
solicitarPermissaoCamera: function () {
|
|
581
1064
|
return call("requestCameraPermission");
|
|
582
1065
|
},
|
|
@@ -604,6 +1087,87 @@
|
|
|
604
1087
|
compartilhar: function (options) {
|
|
605
1088
|
return call("share", [options || {}]);
|
|
606
1089
|
},
|
|
1090
|
+
compartilharApp: function (options) {
|
|
1091
|
+
return call("shareCurrentApp", [options || {}]);
|
|
1092
|
+
},
|
|
1093
|
+
procurarBT: function (options) {
|
|
1094
|
+
return call("scanBluetooth", [options || {}]);
|
|
1095
|
+
},
|
|
1096
|
+
conectarBT: function (idDispositivo) {
|
|
1097
|
+
return call("connectBluetooth", [String(idDispositivo || "")]);
|
|
1098
|
+
},
|
|
1099
|
+
enviarBT: function (data) {
|
|
1100
|
+
return call("sendBluetooth", [data]);
|
|
1101
|
+
},
|
|
1102
|
+
aoConectarBT: function (listener) {
|
|
1103
|
+
if (typeof listener !== "function") {
|
|
1104
|
+
throw new TypeError("listener must be a function");
|
|
1105
|
+
}
|
|
1106
|
+
startBluetoothServerSilently();
|
|
1107
|
+
return onEvent("bluetooth:conectado", listener);
|
|
1108
|
+
},
|
|
1109
|
+
aoReceberDadosBT: function (listener) {
|
|
1110
|
+
if (typeof listener !== "function") {
|
|
1111
|
+
throw new TypeError("listener must be a function");
|
|
1112
|
+
}
|
|
1113
|
+
startBluetoothServerSilently();
|
|
1114
|
+
return onEvent("bluetooth:dados", function (detail) {
|
|
1115
|
+
listener(bluetoothReceivedData(detail));
|
|
1116
|
+
});
|
|
1117
|
+
},
|
|
1118
|
+
aoDarErroBT: function (listener) {
|
|
1119
|
+
if (typeof listener !== "function") {
|
|
1120
|
+
throw new TypeError("listener must be a function");
|
|
1121
|
+
}
|
|
1122
|
+
return onEvent("bluetooth:erro", function (detail) {
|
|
1123
|
+
listener(bluetoothErrorDetail(detail));
|
|
1124
|
+
});
|
|
1125
|
+
},
|
|
1126
|
+
procurarWiFi: function (options) {
|
|
1127
|
+
return call("scanWifi", [options || {}]);
|
|
1128
|
+
},
|
|
1129
|
+
conectarWiFi: function (idDispositivo) {
|
|
1130
|
+
return call("connectWifi", [String(idDispositivo || "")]);
|
|
1131
|
+
},
|
|
1132
|
+
enviarWiFi: function (data) {
|
|
1133
|
+
return call("sendWifi", [data]);
|
|
1134
|
+
},
|
|
1135
|
+
aoConectarWiFi: function (listener) {
|
|
1136
|
+
if (typeof listener !== "function") {
|
|
1137
|
+
throw new TypeError("listener must be a function");
|
|
1138
|
+
}
|
|
1139
|
+
startWifiServerSilently();
|
|
1140
|
+
return onEvent("wifi:conectado", listener);
|
|
1141
|
+
},
|
|
1142
|
+
aoReceberDadosWiFi: function (listener) {
|
|
1143
|
+
if (typeof listener !== "function") {
|
|
1144
|
+
throw new TypeError("listener must be a function");
|
|
1145
|
+
}
|
|
1146
|
+
startWifiServerSilently();
|
|
1147
|
+
return onEvent("wifi:dados", function (detail) {
|
|
1148
|
+
listener(wifiReceivedData(detail));
|
|
1149
|
+
});
|
|
1150
|
+
},
|
|
1151
|
+
aoDarErroWiFi: function (listener) {
|
|
1152
|
+
if (typeof listener !== "function") {
|
|
1153
|
+
throw new TypeError("listener must be a function");
|
|
1154
|
+
}
|
|
1155
|
+
return onEvent("wifi:erro", function (detail) {
|
|
1156
|
+
listener(wifiErrorDetail(detail));
|
|
1157
|
+
});
|
|
1158
|
+
},
|
|
1159
|
+
ocr: function (sourceOrOptions) {
|
|
1160
|
+
return call("ocr", [ocrOptions(sourceOrOptions)]);
|
|
1161
|
+
},
|
|
1162
|
+
falar: function (text, options) {
|
|
1163
|
+
return call("speakText", [String(text || ""), options || {}]);
|
|
1164
|
+
},
|
|
1165
|
+
pararFala: function () {
|
|
1166
|
+
return call("stopSpeaking");
|
|
1167
|
+
},
|
|
1168
|
+
ouvir: function (options) {
|
|
1169
|
+
return call("recognizeSpeech", [options || {}]);
|
|
1170
|
+
},
|
|
607
1171
|
abrirUrl: function (url) {
|
|
608
1172
|
return call("openUrl", [String(url || "")]);
|
|
609
1173
|
},
|
|
@@ -640,8 +1204,61 @@
|
|
|
640
1204
|
escolherPasta: function () {
|
|
641
1205
|
return call("pickFolder");
|
|
642
1206
|
},
|
|
643
|
-
salvarArquivo: function (options) {
|
|
644
|
-
|
|
1207
|
+
salvarArquivo: function (nameOrOptions, value, options) {
|
|
1208
|
+
if (typeof nameOrOptions === "string") {
|
|
1209
|
+
return call("saveStoredFile", [storedFileOptions(nameOrOptions, value, options)]);
|
|
1210
|
+
}
|
|
1211
|
+
return call("saveFile", [nameOrOptions || {}]);
|
|
1212
|
+
},
|
|
1213
|
+
lerArquivo: function (nameOrOptions, options) {
|
|
1214
|
+
return call("readStoredFile", [storedFileNameOptions(nameOrOptions, options)]).then(unwrapStoredValue);
|
|
1215
|
+
},
|
|
1216
|
+
lerArquivoCompleto: function (nameOrOptions, options) {
|
|
1217
|
+
return call("readStoredFile", [storedFileNameOptions(nameOrOptions, options)]);
|
|
1218
|
+
},
|
|
1219
|
+
excluirArquivo: function (nameOrOptions, options) {
|
|
1220
|
+
return call("deleteStoredFile", [storedFileNameOptions(nameOrOptions, options)]);
|
|
1221
|
+
},
|
|
1222
|
+
infoArquivo: function (nameOrOptions, options) {
|
|
1223
|
+
return call("storedFileInfo", [storedFileNameOptions(nameOrOptions, options)]);
|
|
1224
|
+
},
|
|
1225
|
+
arquivoExiste: function (nameOrOptions, options) {
|
|
1226
|
+
return api.infoArquivo(nameOrOptions, options).then(function (info) {
|
|
1227
|
+
return Boolean(info && (info.exists || info.existe));
|
|
1228
|
+
});
|
|
1229
|
+
},
|
|
1230
|
+
listarArquivos: function () {
|
|
1231
|
+
return call("listStoredFiles");
|
|
1232
|
+
},
|
|
1233
|
+
abrirArquivo: function (nameOrOptions, options) {
|
|
1234
|
+
return call("openStoredFile", [storedFileNameOptions(nameOrOptions, options)]);
|
|
1235
|
+
},
|
|
1236
|
+
compartilharArquivo: function (nameOrOptions, options) {
|
|
1237
|
+
return call("shareStoredFile", [storedFileNameOptions(nameOrOptions, options)]);
|
|
1238
|
+
},
|
|
1239
|
+
baixarArquivo: function (urlOrOptions, nameOrOptions, options) {
|
|
1240
|
+
return call("downloadFile", [downloadFileOptions(urlOrOptions, nameOrOptions, options)]);
|
|
1241
|
+
},
|
|
1242
|
+
baixarBase64: function (nameOrOptions, base64, options) {
|
|
1243
|
+
return call("downloadFile", [downloadBase64Options(nameOrOptions, base64, options)]);
|
|
1244
|
+
},
|
|
1245
|
+
baixarArquivoLocal: function (fileOrOptions, nameOrOptions, options) {
|
|
1246
|
+
return call("downloadFile", [downloadLocalFileOptions(fileOrOptions, nameOrOptions, options)]);
|
|
1247
|
+
},
|
|
1248
|
+
definirPapelParede: function (sourceOrOptions, options) {
|
|
1249
|
+
return call("setWallpaper", [wallpaperOptions(sourceOrOptions, options)]);
|
|
1250
|
+
},
|
|
1251
|
+
infoPapelParede: function () {
|
|
1252
|
+
return call("wallpaperInfo");
|
|
1253
|
+
},
|
|
1254
|
+
abrirConfiguracaoPapelParede: function () {
|
|
1255
|
+
return call("openWallpaperSettings");
|
|
1256
|
+
},
|
|
1257
|
+
capturarTela: function (options) {
|
|
1258
|
+
return call("captureScreen", [options || {}]);
|
|
1259
|
+
},
|
|
1260
|
+
tirarPrint: function (options) {
|
|
1261
|
+
return call("captureScreen", [options || {}]);
|
|
645
1262
|
},
|
|
646
1263
|
infoDispositivo: function () {
|
|
647
1264
|
return call("deviceInfo");
|
|
@@ -661,12 +1278,57 @@
|
|
|
661
1278
|
infoDesempenho: function () {
|
|
662
1279
|
return call("performanceInfo");
|
|
663
1280
|
},
|
|
1281
|
+
volumeAtual: function () {
|
|
1282
|
+
return call("getVolume");
|
|
1283
|
+
},
|
|
1284
|
+
definirVolume: function (streamOrOptions, value, options) {
|
|
1285
|
+
return call("setVolume", [volumeOptions(streamOrOptions, value, options)]);
|
|
1286
|
+
},
|
|
1287
|
+
aumentarVolume: function (streamOrOptions, amountOrOptions, options) {
|
|
1288
|
+
return call("adjustVolume", [adjustVolumeOptions(streamOrOptions, amountOrOptions, options, "up")]);
|
|
1289
|
+
},
|
|
1290
|
+
diminuirVolume: function (streamOrOptions, amountOrOptions, options) {
|
|
1291
|
+
return call("adjustVolume", [adjustVolumeOptions(streamOrOptions, amountOrOptions, options, "down")]);
|
|
1292
|
+
},
|
|
664
1293
|
appsAbertos: function () {
|
|
665
1294
|
return call("openAppsMemory");
|
|
666
1295
|
},
|
|
667
1296
|
infoAppsAbertos: function () {
|
|
668
1297
|
return call("openAppsMemory");
|
|
669
1298
|
},
|
|
1299
|
+
obterLocalizacao: function (options) {
|
|
1300
|
+
return call("getLocation", [options || {}]);
|
|
1301
|
+
},
|
|
1302
|
+
acompanharLocalizacao: function (options) {
|
|
1303
|
+
return call("watchLocation", [options || {}]);
|
|
1304
|
+
},
|
|
1305
|
+
pararLocalizacao: function (id) {
|
|
1306
|
+
return call("stopLocationWatch", [id || ""]);
|
|
1307
|
+
},
|
|
1308
|
+
aoMudarLocalizacao: function (listener) {
|
|
1309
|
+
return onEvent("localizacao:mudou", listener);
|
|
1310
|
+
},
|
|
1311
|
+
autenticarBiometria: function (options) {
|
|
1312
|
+
return call("authenticateBiometric", [options || {}]);
|
|
1313
|
+
},
|
|
1314
|
+
salvarSeguro: function (keyOrOptions, value, options) {
|
|
1315
|
+
return call("saveSecureItem", [secureItemOptions(keyOrOptions, value, options)]);
|
|
1316
|
+
},
|
|
1317
|
+
lerSeguro: function (keyOrOptions, options) {
|
|
1318
|
+
return call("readSecureItem", [secureKeyOptions(keyOrOptions, options)]).then(unwrapStoredValue);
|
|
1319
|
+
},
|
|
1320
|
+
lerSeguroCompleto: function (keyOrOptions, options) {
|
|
1321
|
+
return call("readSecureItem", [secureKeyOptions(keyOrOptions, options)]);
|
|
1322
|
+
},
|
|
1323
|
+
removerSeguro: function (keyOrOptions, options) {
|
|
1324
|
+
return call("deleteSecureItem", [secureKeyOptions(keyOrOptions, options)]);
|
|
1325
|
+
},
|
|
1326
|
+
listarSeguro: function () {
|
|
1327
|
+
return call("listSecureKeys");
|
|
1328
|
+
},
|
|
1329
|
+
limparSeguro: function () {
|
|
1330
|
+
return call("clearSecureStorage");
|
|
1331
|
+
},
|
|
670
1332
|
statusPermissoes: function (permissions) {
|
|
671
1333
|
return call("permissionStatus", [permissions || []]);
|
|
672
1334
|
},
|
|
@@ -691,12 +1353,24 @@
|
|
|
691
1353
|
abrirConfiguracaoSobreposicao: function () {
|
|
692
1354
|
return call("openOverlaySettings");
|
|
693
1355
|
},
|
|
694
|
-
iniciarIconeFlutuante: function () {
|
|
695
|
-
return call("startFloatingIcon");
|
|
1356
|
+
iniciarIconeFlutuante: function (options) {
|
|
1357
|
+
return call("startFloatingIcon", [floatingIconOptions(options)]);
|
|
696
1358
|
},
|
|
697
1359
|
pararIconeFlutuante: function () {
|
|
698
1360
|
return call("stopFloatingIcon");
|
|
699
1361
|
},
|
|
1362
|
+
configurarIconeFlutuante: function (options) {
|
|
1363
|
+
return call("configureFloatingIcon", [floatingIconOptions(options)]);
|
|
1364
|
+
},
|
|
1365
|
+
definirOpacidadeIconeFlutuante: function (opacity) {
|
|
1366
|
+
return call("configureFloatingIcon", [floatingIconOptions(opacity)]);
|
|
1367
|
+
},
|
|
1368
|
+
minimizarApp: function () {
|
|
1369
|
+
return call("minimizeApp");
|
|
1370
|
+
},
|
|
1371
|
+
fecharApp: function () {
|
|
1372
|
+
return call("closeApp");
|
|
1373
|
+
},
|
|
700
1374
|
obterNotificacaoInicial: function () {
|
|
701
1375
|
return call("getInitialNotification").then(function (notification) {
|
|
702
1376
|
initialNotification = notification && notification.id ? notification : null;
|
|
@@ -709,6 +1383,12 @@
|
|
|
709
1383
|
return initialLink;
|
|
710
1384
|
});
|
|
711
1385
|
},
|
|
1386
|
+
obterCompartilhamentoInicial: function () {
|
|
1387
|
+
return call("getInitialShare").then(function (share) {
|
|
1388
|
+
initialShare = share && (share.text || share.texto || share.uri || (share.items && share.items.length)) ? normalizeReceivedShare(share) : null;
|
|
1389
|
+
return initialShare;
|
|
1390
|
+
});
|
|
1391
|
+
},
|
|
712
1392
|
aoEvento: onEvent,
|
|
713
1393
|
aoMinimizar: function (listener) {
|
|
714
1394
|
return onEvent("app:background", listener);
|
|
@@ -724,12 +1404,67 @@
|
|
|
724
1404
|
}
|
|
725
1405
|
return onEvent("link:aberto", listener);
|
|
726
1406
|
},
|
|
1407
|
+
aoReceberCompartilhamento: function (listener) {
|
|
1408
|
+
if (typeof listener !== "function") {
|
|
1409
|
+
throw new TypeError("listener must be a function");
|
|
1410
|
+
}
|
|
1411
|
+
if (initialShare) {
|
|
1412
|
+
setTimeout(function () {
|
|
1413
|
+
listener(normalizeReceivedShare(initialShare));
|
|
1414
|
+
}, 0);
|
|
1415
|
+
}
|
|
1416
|
+
return onEvent("compartilhamento:recebido", function (detail) {
|
|
1417
|
+
listener(normalizeReceivedShare(detail));
|
|
1418
|
+
});
|
|
1419
|
+
},
|
|
727
1420
|
aoMudarRede: function (listener) {
|
|
728
1421
|
return onEvent("rede:mudou", listener);
|
|
729
1422
|
},
|
|
730
1423
|
aoMudarBateria: function (listener) {
|
|
731
1424
|
return onEvent("bateria:mudou", listener);
|
|
732
1425
|
},
|
|
1426
|
+
aoConectarUSB: function (listener) {
|
|
1427
|
+
return onEvent("usb:conectado", listener);
|
|
1428
|
+
},
|
|
1429
|
+
aoDesconectarUSB: function (listener) {
|
|
1430
|
+
return onEvent("usb:desconectado", listener);
|
|
1431
|
+
},
|
|
1432
|
+
aoConectarFone: function (listener) {
|
|
1433
|
+
return onEvent("fone:conectado", listener);
|
|
1434
|
+
},
|
|
1435
|
+
aoDesconectarFone: function (listener) {
|
|
1436
|
+
return onEvent("fone:desconectado", listener);
|
|
1437
|
+
},
|
|
1438
|
+
aoMudarVolume: function (listener) {
|
|
1439
|
+
return onEvent("volume:mudou", listener);
|
|
1440
|
+
},
|
|
1441
|
+
aoAbrirTeclado: function (listener) {
|
|
1442
|
+
return onEvent("teclado:abriu", listener);
|
|
1443
|
+
},
|
|
1444
|
+
aoFecharTeclado: function (listener) {
|
|
1445
|
+
return onEvent("teclado:fechou", listener);
|
|
1446
|
+
},
|
|
1447
|
+
aoSacudirCelular: function (listener) {
|
|
1448
|
+
return onEvent("celular:sacudido", listener);
|
|
1449
|
+
},
|
|
1450
|
+
aoVirarCelularParaBaixo: function (listener) {
|
|
1451
|
+
return onEvent("celular:tela_para_baixo", listener);
|
|
1452
|
+
},
|
|
1453
|
+
aoAproximarObjeto: function (listener) {
|
|
1454
|
+
return onEvent("proximidade:perto", listener);
|
|
1455
|
+
},
|
|
1456
|
+
aoTirarPrint: function (listener) {
|
|
1457
|
+
return onEvent("print:tela", listener);
|
|
1458
|
+
},
|
|
1459
|
+
aoMudarOrientacao: function (listener) {
|
|
1460
|
+
return onEvent("orientacao:mudou", listener);
|
|
1461
|
+
},
|
|
1462
|
+
aoNFC: function (listener) {
|
|
1463
|
+
return onEvent("nfc:recebido", listener);
|
|
1464
|
+
},
|
|
1465
|
+
aoReceberNotificacao: function (listener) {
|
|
1466
|
+
return onEvent("notificacao:recebida", listener);
|
|
1467
|
+
},
|
|
733
1468
|
aoClicarNotificacao: function (listener) {
|
|
734
1469
|
if (typeof listener !== "function") {
|
|
735
1470
|
throw new TypeError("listener must be a function");
|
|
@@ -754,6 +1489,7 @@
|
|
|
754
1489
|
cancelNotification: api.cancelarNotificacao,
|
|
755
1490
|
cancelNotificationLoop: api.cancelarLoopNotificacoes,
|
|
756
1491
|
vibrate: api.vibrar,
|
|
1492
|
+
loading: api.aguardar,
|
|
757
1493
|
manterTelaLigada: api.manterTelaAcordada,
|
|
758
1494
|
keepScreenAwake: api.manterTelaAcordada,
|
|
759
1495
|
keepScreenOn: api.manterTelaAcordada,
|
|
@@ -763,6 +1499,11 @@
|
|
|
763
1499
|
flashlight: api.lanterna,
|
|
764
1500
|
toggleFlashlight: api.alternarLanterna,
|
|
765
1501
|
flashlightStatus: api.statusLanterna,
|
|
1502
|
+
takePhoto: api.tirarFoto,
|
|
1503
|
+
capturePhoto: api.tirarFoto,
|
|
1504
|
+
captureVideo: api.capturarVideo,
|
|
1505
|
+
scanQRCode: api.escanearQRCode,
|
|
1506
|
+
scanQrCode: api.escanearQRCode,
|
|
766
1507
|
requestCameraPermission: api.solicitarPermissaoCamera,
|
|
767
1508
|
requestMicrophonePermission: api.solicitarPermissaoMicrofone,
|
|
768
1509
|
microphoneStatus: api.statusMicrofone,
|
|
@@ -775,6 +1516,46 @@
|
|
|
775
1516
|
readText: api.lerTextoCopiado,
|
|
776
1517
|
shareText: api.compartilharTexto,
|
|
777
1518
|
share: api.compartilhar,
|
|
1519
|
+
shareApp: api.compartilharApp,
|
|
1520
|
+
share_me: api.compartilharApp,
|
|
1521
|
+
scanBluetooth: api.procurarBT,
|
|
1522
|
+
procurarBluetooth: api.procurarBT,
|
|
1523
|
+
buscarBT: api.procurarBT,
|
|
1524
|
+
connectBluetooth: api.conectarBT,
|
|
1525
|
+
conectarBluetooth: api.conectarBT,
|
|
1526
|
+
sendBluetooth: api.enviarBT,
|
|
1527
|
+
onBluetoothConnect: api.aoConectarBT,
|
|
1528
|
+
onBluetoothConnected: api.aoConectarBT,
|
|
1529
|
+
onBluetoothData: api.aoReceberDadosBT,
|
|
1530
|
+
onBTData: api.aoReceberDadosBT,
|
|
1531
|
+
onBluetoothError: api.aoDarErroBT,
|
|
1532
|
+
onBTError: api.aoDarErroBT,
|
|
1533
|
+
scanWiFi: api.procurarWiFi,
|
|
1534
|
+
scanWifi: api.procurarWiFi,
|
|
1535
|
+
procurarWifi: api.procurarWiFi,
|
|
1536
|
+
connectWiFi: api.conectarWiFi,
|
|
1537
|
+
connectWifi: api.conectarWiFi,
|
|
1538
|
+
conectarWifi: api.conectarWiFi,
|
|
1539
|
+
sendWiFi: api.enviarWiFi,
|
|
1540
|
+
sendWifi: api.enviarWiFi,
|
|
1541
|
+
enviarWifi: api.enviarWiFi,
|
|
1542
|
+
onWiFiConnect: api.aoConectarWiFi,
|
|
1543
|
+
onWifiConnect: api.aoConectarWiFi,
|
|
1544
|
+
onWiFiConnected: api.aoConectarWiFi,
|
|
1545
|
+
onWifiConnected: api.aoConectarWiFi,
|
|
1546
|
+
onWiFiData: api.aoReceberDadosWiFi,
|
|
1547
|
+
onWifiData: api.aoReceberDadosWiFi,
|
|
1548
|
+
onWiFiError: api.aoDarErroWiFi,
|
|
1549
|
+
onWifiError: api.aoDarErroWiFi,
|
|
1550
|
+
recognizeText: api.ocr,
|
|
1551
|
+
textFromImage: api.ocr,
|
|
1552
|
+
speak: api.falar,
|
|
1553
|
+
textToSpeech: api.falar,
|
|
1554
|
+
stopSpeaking: api.pararFala,
|
|
1555
|
+
stopSpeech: api.pararFala,
|
|
1556
|
+
listen: api.ouvir,
|
|
1557
|
+
recognizeSpeech: api.ouvir,
|
|
1558
|
+
speechToText: api.ouvir,
|
|
778
1559
|
openUrl: api.abrirUrl,
|
|
779
1560
|
openExternalUrl: api.abrirUrl,
|
|
780
1561
|
abrirUrlExterno: api.abrirUrl,
|
|
@@ -791,14 +1572,66 @@
|
|
|
791
1572
|
pickVideo: api.escolherVideo,
|
|
792
1573
|
pickFolder: api.escolherPasta,
|
|
793
1574
|
saveFile: api.salvarArquivo,
|
|
1575
|
+
readFile: api.lerArquivo,
|
|
1576
|
+
readStoredFile: api.lerArquivo,
|
|
1577
|
+
readStoredFileInfo: api.lerArquivoCompleto,
|
|
1578
|
+
deleteFile: api.excluirArquivo,
|
|
1579
|
+
removeFile: api.excluirArquivo,
|
|
1580
|
+
excluirArquivoArmazenado: api.excluirArquivo,
|
|
1581
|
+
removerArquivo: api.excluirArquivo,
|
|
1582
|
+
apagarArquivo: api.excluirArquivo,
|
|
1583
|
+
fileInfo: api.infoArquivo,
|
|
1584
|
+
storedFileInfo: api.infoArquivo,
|
|
1585
|
+
fileExists: api.arquivoExiste,
|
|
1586
|
+
listFiles: api.listarArquivos,
|
|
1587
|
+
listStoredFiles: api.listarArquivos,
|
|
1588
|
+
openFile: api.abrirArquivo,
|
|
1589
|
+
openStoredFile: api.abrirArquivo,
|
|
1590
|
+
shareFile: api.compartilharArquivo,
|
|
1591
|
+
shareStoredFile: api.compartilharArquivo,
|
|
1592
|
+
downloadFile: api.baixarArquivo,
|
|
1593
|
+
downloadBase64: api.baixarBase64,
|
|
1594
|
+
downloadFromBase64: api.baixarBase64,
|
|
1595
|
+
baixarArquivoBase64: api.baixarBase64,
|
|
1596
|
+
downloadLocalFile: api.baixarArquivoLocal,
|
|
1597
|
+
downloadFromFile: api.baixarArquivoLocal,
|
|
1598
|
+
baixarArquivoNormal: api.baixarArquivoLocal,
|
|
1599
|
+
setWallpaper: api.definirPapelParede,
|
|
1600
|
+
setPhoneWallpaper: api.definirPapelParede,
|
|
1601
|
+
wallpaper: api.definirPapelParede,
|
|
1602
|
+
wallpaperInfo: api.infoPapelParede,
|
|
1603
|
+
openWallpaperSettings: api.abrirConfiguracaoPapelParede,
|
|
1604
|
+
captureScreen: api.capturarTela,
|
|
1605
|
+
takeScreenshot: api.capturarTela,
|
|
1606
|
+
screenshot: api.capturarTela,
|
|
794
1607
|
deviceInfo: api.infoDispositivo,
|
|
795
1608
|
networkInfo: api.infoRede,
|
|
796
1609
|
batteryInfo: api.infoBateria,
|
|
797
1610
|
memoryInfo: api.infoMemoria,
|
|
798
1611
|
storageInfo: api.infoArmazenamento,
|
|
799
1612
|
performanceInfo: api.infoDesempenho,
|
|
1613
|
+
currentVolume: api.volumeAtual,
|
|
1614
|
+
getVolume: api.volumeAtual,
|
|
1615
|
+
setVolume: api.definirVolume,
|
|
1616
|
+
increaseVolume: api.aumentarVolume,
|
|
1617
|
+
decreaseVolume: api.diminuirVolume,
|
|
800
1618
|
openAppsMemory: api.appsAbertos,
|
|
801
1619
|
openAppsInfo: api.infoAppsAbertos,
|
|
1620
|
+
getLocation: api.obterLocalizacao,
|
|
1621
|
+
watchLocation: api.acompanharLocalizacao,
|
|
1622
|
+
stopLocationWatch: api.pararLocalizacao,
|
|
1623
|
+
onLocationChange: api.aoMudarLocalizacao,
|
|
1624
|
+
authenticateBiometric: api.autenticarBiometria,
|
|
1625
|
+
saveSecure: api.salvarSeguro,
|
|
1626
|
+
secureSet: api.salvarSeguro,
|
|
1627
|
+
readSecure: api.lerSeguro,
|
|
1628
|
+
secureGet: api.lerSeguro,
|
|
1629
|
+
readSecureItem: api.lerSeguroCompleto,
|
|
1630
|
+
deleteSecure: api.removerSeguro,
|
|
1631
|
+
removeSecure: api.removerSeguro,
|
|
1632
|
+
secureDelete: api.removerSeguro,
|
|
1633
|
+
listSecureKeys: api.listarSeguro,
|
|
1634
|
+
clearSecureStorage: api.limparSeguro,
|
|
802
1635
|
permissionStatus: api.statusPermissoes,
|
|
803
1636
|
requestNotificationPermission: api.solicitarPermissaoNotificacoes,
|
|
804
1637
|
notificationPermissionStatus: api.statusPermissaoNotificacoes,
|
|
@@ -808,15 +1641,51 @@
|
|
|
808
1641
|
requestOverlayPermission: api.solicitarPermissaoSobreposicao,
|
|
809
1642
|
openOverlaySettings: api.abrirConfiguracaoSobreposicao,
|
|
810
1643
|
startFloatingIcon: api.iniciarIconeFlutuante,
|
|
1644
|
+
configureFloatingIcon: api.configurarIconeFlutuante,
|
|
1645
|
+
setFloatingIconOpacity: api.definirOpacidadeIconeFlutuante,
|
|
811
1646
|
stopFloatingIcon: api.pararIconeFlutuante,
|
|
1647
|
+
minimizeApp: api.minimizarApp,
|
|
1648
|
+
closeApp: api.fecharApp,
|
|
1649
|
+
exitApp: api.fecharApp,
|
|
812
1650
|
getInitialNotification: api.obterNotificacaoInicial,
|
|
813
1651
|
getInitialLink: api.obterLinkInicial,
|
|
1652
|
+
getInitialShare: api.obterCompartilhamentoInicial,
|
|
1653
|
+
onShareReceived: api.aoReceberCompartilhamento,
|
|
1654
|
+
onReceiveShare: api.aoReceberCompartilhamento,
|
|
814
1655
|
onEvent: api.aoEvento,
|
|
815
1656
|
onMinimize: api.aoMinimizar,
|
|
816
1657
|
onAppResume: api.aoVoltarParaApp,
|
|
817
1658
|
onOpenLink: api.aoAbrirLink,
|
|
818
1659
|
onNetworkChange: api.aoMudarRede,
|
|
819
1660
|
onBatteryChange: api.aoMudarBateria,
|
|
1661
|
+
onUSBConnect: api.aoConectarUSB,
|
|
1662
|
+
onUsbConnect: api.aoConectarUSB,
|
|
1663
|
+
onUSBDisconnect: api.aoDesconectarUSB,
|
|
1664
|
+
onUsbDisconnect: api.aoDesconectarUSB,
|
|
1665
|
+
onHeadphoneConnect: api.aoConectarFone,
|
|
1666
|
+
onHeadphoneConnected: api.aoConectarFone,
|
|
1667
|
+
onHeadphoneDisconnect: api.aoDesconectarFone,
|
|
1668
|
+
onHeadphoneDisconnected: api.aoDesconectarFone,
|
|
1669
|
+
onVolumeChange: api.aoMudarVolume,
|
|
1670
|
+
onKeyboardOpen: api.aoAbrirTeclado,
|
|
1671
|
+
onKeyboardOpened: api.aoAbrirTeclado,
|
|
1672
|
+
onKeyboardClose: api.aoFecharTeclado,
|
|
1673
|
+
onKeyboardClosed: api.aoFecharTeclado,
|
|
1674
|
+
onPhoneShake: api.aoSacudirCelular,
|
|
1675
|
+
onShake: api.aoSacudirCelular,
|
|
1676
|
+
onPhoneFaceDown: api.aoVirarCelularParaBaixo,
|
|
1677
|
+
onFaceDown: api.aoVirarCelularParaBaixo,
|
|
1678
|
+
onProximityNear: api.aoAproximarObjeto,
|
|
1679
|
+
onObjectNear: api.aoAproximarObjeto,
|
|
1680
|
+
onScreenshot: api.aoTirarPrint,
|
|
1681
|
+
onScreenshotTaken: api.aoTirarPrint,
|
|
1682
|
+
onOrientationChange: api.aoMudarOrientacao,
|
|
1683
|
+
onNFC: api.aoNFC,
|
|
1684
|
+
onNfc: api.aoNFC,
|
|
1685
|
+
onNFCReceived: api.aoNFC,
|
|
1686
|
+
onNfcReceived: api.aoNFC,
|
|
1687
|
+
onNotificationReceived: api.aoReceberNotificacao,
|
|
1688
|
+
onReceiveNotification: api.aoReceberNotificacao,
|
|
820
1689
|
onNotificationClick: api.aoClicarNotificacao
|
|
821
1690
|
});
|
|
822
1691
|
|
|
@@ -855,6 +1724,12 @@
|
|
|
855
1724
|
emitEvent("link:aberto", link);
|
|
856
1725
|
}
|
|
857
1726
|
});
|
|
1727
|
+
api.obterCompartilhamentoInicial().then(function (share) {
|
|
1728
|
+
if (share) {
|
|
1729
|
+
initialShare = share;
|
|
1730
|
+
emitEvent("compartilhamento:recebido", share);
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
858
1733
|
}, false);
|
|
859
1734
|
}
|
|
860
1735
|
})();
|