html2apk 0.9.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 +217 -5
- package/package.json +15 -4
- package/src/desktop/main.js +551 -25
- package/src/desktop/renderer/index.html +1 -1
- package/src/desktop/renderer/renderer.js +517 -35
- package/src/desktop/renderer/styles.css +13 -3
- package/src/runtime-manager/index.js +79 -17
- package/src/templates/cordova-plugin-html2apk-bridge/plugin.xml +33 -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 +5187 -1634
- package/src/templates/cordova-plugin-html2apk-bridge/www/html2apk-bridge.js +485 -12
- package/src/templates/html2apk-early-bridge.js +485 -12
- package/src/templates/html2apk-runtime-console.js +169 -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 = {};
|
|
@@ -21,6 +23,33 @@
|
|
|
21
23
|
"battery:changed": "bateria:mudou",
|
|
22
24
|
"location:changed": "localizacao:mudou",
|
|
23
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",
|
|
24
53
|
"notification:received": "notificacao:recebida",
|
|
25
54
|
"notification:clicked": "notificacao:clicada"
|
|
26
55
|
};
|
|
@@ -28,6 +57,7 @@
|
|
|
28
57
|
var notificationListeners = [];
|
|
29
58
|
var initialNotification = null;
|
|
30
59
|
var initialLink = null;
|
|
60
|
+
var initialShare = null;
|
|
31
61
|
|
|
32
62
|
function markReady() {
|
|
33
63
|
if (deviceReady) {
|
|
@@ -474,16 +504,20 @@
|
|
|
474
504
|
return normalized;
|
|
475
505
|
}
|
|
476
506
|
|
|
477
|
-
function downloadFileOptions(urlOrOptions, nameOrOptions) {
|
|
507
|
+
function downloadFileOptions(urlOrOptions, nameOrOptions, options) {
|
|
478
508
|
var normalized;
|
|
479
509
|
var source;
|
|
480
510
|
|
|
481
511
|
if (urlOrOptions && typeof urlOrOptions === "object" && !Array.isArray(urlOrOptions)) {
|
|
482
512
|
normalized = cloneSerializable(urlOrOptions) || {};
|
|
483
|
-
|
|
513
|
+
applyDownloadName(normalized, nameOrOptions);
|
|
514
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
515
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
516
|
+
}
|
|
517
|
+
return normalized;
|
|
484
518
|
}
|
|
485
519
|
|
|
486
|
-
normalized = {};
|
|
520
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
487
521
|
source = String(urlOrOptions || "").trim();
|
|
488
522
|
if (source.indexOf("data:") === 0) {
|
|
489
523
|
applyBase64DownloadSource(normalized, source);
|
|
@@ -510,16 +544,20 @@
|
|
|
510
544
|
return applyBase64DownloadSource(normalized, base64);
|
|
511
545
|
}
|
|
512
546
|
|
|
513
|
-
function downloadLocalFileOptions(fileOrOptions, nameOrOptions) {
|
|
547
|
+
function downloadLocalFileOptions(fileOrOptions, nameOrOptions, options) {
|
|
514
548
|
var normalized;
|
|
515
549
|
var source;
|
|
516
550
|
|
|
517
551
|
if (fileOrOptions && typeof fileOrOptions === "object" && !Array.isArray(fileOrOptions)) {
|
|
518
552
|
normalized = cloneSerializable(fileOrOptions) || {};
|
|
519
|
-
|
|
553
|
+
applyDownloadName(normalized, nameOrOptions);
|
|
554
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
555
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
556
|
+
}
|
|
557
|
+
return normalized;
|
|
520
558
|
}
|
|
521
559
|
|
|
522
|
-
normalized = {};
|
|
560
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
523
561
|
source = String(fileOrOptions || "").trim();
|
|
524
562
|
if (/^(content|file):\/\//.test(source)) {
|
|
525
563
|
normalized.uri = source;
|
|
@@ -534,6 +572,115 @@
|
|
|
534
572
|
return applyDownloadName(normalized, nameOrOptions);
|
|
535
573
|
}
|
|
536
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
|
+
|
|
537
684
|
function wallpaperOptions(sourceOrOptions, options) {
|
|
538
685
|
var normalized;
|
|
539
686
|
var source;
|
|
@@ -578,6 +725,61 @@
|
|
|
578
725
|
return normalized;
|
|
579
726
|
}
|
|
580
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
|
+
|
|
581
783
|
function secureItemOptions(keyOrOptions, value, options) {
|
|
582
784
|
var normalized;
|
|
583
785
|
if (keyOrOptions && typeof keyOrOptions === "object" && !Array.isArray(keyOrOptions)) {
|
|
@@ -817,6 +1019,14 @@
|
|
|
817
1019
|
toast: function (message) {
|
|
818
1020
|
return call("toast", [String(message || "")]);
|
|
819
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
|
+
},
|
|
820
1030
|
fullscreen: function (enabled) {
|
|
821
1031
|
return call("fullscreen", [Boolean(enabled)]);
|
|
822
1032
|
},
|
|
@@ -877,6 +1087,87 @@
|
|
|
877
1087
|
compartilhar: function (options) {
|
|
878
1088
|
return call("share", [options || {}]);
|
|
879
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
|
+
},
|
|
880
1171
|
abrirUrl: function (url) {
|
|
881
1172
|
return call("openUrl", [String(url || "")]);
|
|
882
1173
|
},
|
|
@@ -945,14 +1236,14 @@
|
|
|
945
1236
|
compartilharArquivo: function (nameOrOptions, options) {
|
|
946
1237
|
return call("shareStoredFile", [storedFileNameOptions(nameOrOptions, options)]);
|
|
947
1238
|
},
|
|
948
|
-
baixarArquivo: function (urlOrOptions, nameOrOptions) {
|
|
949
|
-
return call("downloadFile", [downloadFileOptions(urlOrOptions, nameOrOptions)]);
|
|
1239
|
+
baixarArquivo: function (urlOrOptions, nameOrOptions, options) {
|
|
1240
|
+
return call("downloadFile", [downloadFileOptions(urlOrOptions, nameOrOptions, options)]);
|
|
950
1241
|
},
|
|
951
1242
|
baixarBase64: function (nameOrOptions, base64, options) {
|
|
952
1243
|
return call("downloadFile", [downloadBase64Options(nameOrOptions, base64, options)]);
|
|
953
1244
|
},
|
|
954
|
-
baixarArquivoLocal: function (fileOrOptions, nameOrOptions) {
|
|
955
|
-
return call("downloadFile", [downloadLocalFileOptions(fileOrOptions, nameOrOptions)]);
|
|
1245
|
+
baixarArquivoLocal: function (fileOrOptions, nameOrOptions, options) {
|
|
1246
|
+
return call("downloadFile", [downloadLocalFileOptions(fileOrOptions, nameOrOptions, options)]);
|
|
956
1247
|
},
|
|
957
1248
|
definirPapelParede: function (sourceOrOptions, options) {
|
|
958
1249
|
return call("setWallpaper", [wallpaperOptions(sourceOrOptions, options)]);
|
|
@@ -963,6 +1254,12 @@
|
|
|
963
1254
|
abrirConfiguracaoPapelParede: function () {
|
|
964
1255
|
return call("openWallpaperSettings");
|
|
965
1256
|
},
|
|
1257
|
+
capturarTela: function (options) {
|
|
1258
|
+
return call("captureScreen", [options || {}]);
|
|
1259
|
+
},
|
|
1260
|
+
tirarPrint: function (options) {
|
|
1261
|
+
return call("captureScreen", [options || {}]);
|
|
1262
|
+
},
|
|
966
1263
|
infoDispositivo: function () {
|
|
967
1264
|
return call("deviceInfo");
|
|
968
1265
|
},
|
|
@@ -981,6 +1278,18 @@
|
|
|
981
1278
|
infoDesempenho: function () {
|
|
982
1279
|
return call("performanceInfo");
|
|
983
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
|
+
},
|
|
984
1293
|
appsAbertos: function () {
|
|
985
1294
|
return call("openAppsMemory");
|
|
986
1295
|
},
|
|
@@ -1044,12 +1353,24 @@
|
|
|
1044
1353
|
abrirConfiguracaoSobreposicao: function () {
|
|
1045
1354
|
return call("openOverlaySettings");
|
|
1046
1355
|
},
|
|
1047
|
-
iniciarIconeFlutuante: function () {
|
|
1048
|
-
return call("startFloatingIcon");
|
|
1356
|
+
iniciarIconeFlutuante: function (options) {
|
|
1357
|
+
return call("startFloatingIcon", [floatingIconOptions(options)]);
|
|
1049
1358
|
},
|
|
1050
1359
|
pararIconeFlutuante: function () {
|
|
1051
1360
|
return call("stopFloatingIcon");
|
|
1052
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
|
+
},
|
|
1053
1374
|
obterNotificacaoInicial: function () {
|
|
1054
1375
|
return call("getInitialNotification").then(function (notification) {
|
|
1055
1376
|
initialNotification = notification && notification.id ? notification : null;
|
|
@@ -1062,6 +1383,12 @@
|
|
|
1062
1383
|
return initialLink;
|
|
1063
1384
|
});
|
|
1064
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
|
+
},
|
|
1065
1392
|
aoEvento: onEvent,
|
|
1066
1393
|
aoMinimizar: function (listener) {
|
|
1067
1394
|
return onEvent("app:background", listener);
|
|
@@ -1077,12 +1404,67 @@
|
|
|
1077
1404
|
}
|
|
1078
1405
|
return onEvent("link:aberto", listener);
|
|
1079
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
|
+
},
|
|
1080
1420
|
aoMudarRede: function (listener) {
|
|
1081
1421
|
return onEvent("rede:mudou", listener);
|
|
1082
1422
|
},
|
|
1083
1423
|
aoMudarBateria: function (listener) {
|
|
1084
1424
|
return onEvent("bateria:mudou", listener);
|
|
1085
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
|
+
},
|
|
1086
1468
|
aoClicarNotificacao: function (listener) {
|
|
1087
1469
|
if (typeof listener !== "function") {
|
|
1088
1470
|
throw new TypeError("listener must be a function");
|
|
@@ -1107,6 +1489,7 @@
|
|
|
1107
1489
|
cancelNotification: api.cancelarNotificacao,
|
|
1108
1490
|
cancelNotificationLoop: api.cancelarLoopNotificacoes,
|
|
1109
1491
|
vibrate: api.vibrar,
|
|
1492
|
+
loading: api.aguardar,
|
|
1110
1493
|
manterTelaLigada: api.manterTelaAcordada,
|
|
1111
1494
|
keepScreenAwake: api.manterTelaAcordada,
|
|
1112
1495
|
keepScreenOn: api.manterTelaAcordada,
|
|
@@ -1133,6 +1516,46 @@
|
|
|
1133
1516
|
readText: api.lerTextoCopiado,
|
|
1134
1517
|
shareText: api.compartilharTexto,
|
|
1135
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,
|
|
1136
1559
|
openUrl: api.abrirUrl,
|
|
1137
1560
|
openExternalUrl: api.abrirUrl,
|
|
1138
1561
|
abrirUrlExterno: api.abrirUrl,
|
|
@@ -1178,12 +1601,20 @@
|
|
|
1178
1601
|
wallpaper: api.definirPapelParede,
|
|
1179
1602
|
wallpaperInfo: api.infoPapelParede,
|
|
1180
1603
|
openWallpaperSettings: api.abrirConfiguracaoPapelParede,
|
|
1604
|
+
captureScreen: api.capturarTela,
|
|
1605
|
+
takeScreenshot: api.capturarTela,
|
|
1606
|
+
screenshot: api.capturarTela,
|
|
1181
1607
|
deviceInfo: api.infoDispositivo,
|
|
1182
1608
|
networkInfo: api.infoRede,
|
|
1183
1609
|
batteryInfo: api.infoBateria,
|
|
1184
1610
|
memoryInfo: api.infoMemoria,
|
|
1185
1611
|
storageInfo: api.infoArmazenamento,
|
|
1186
1612
|
performanceInfo: api.infoDesempenho,
|
|
1613
|
+
currentVolume: api.volumeAtual,
|
|
1614
|
+
getVolume: api.volumeAtual,
|
|
1615
|
+
setVolume: api.definirVolume,
|
|
1616
|
+
increaseVolume: api.aumentarVolume,
|
|
1617
|
+
decreaseVolume: api.diminuirVolume,
|
|
1187
1618
|
openAppsMemory: api.appsAbertos,
|
|
1188
1619
|
openAppsInfo: api.infoAppsAbertos,
|
|
1189
1620
|
getLocation: api.obterLocalizacao,
|
|
@@ -1210,15 +1641,51 @@
|
|
|
1210
1641
|
requestOverlayPermission: api.solicitarPermissaoSobreposicao,
|
|
1211
1642
|
openOverlaySettings: api.abrirConfiguracaoSobreposicao,
|
|
1212
1643
|
startFloatingIcon: api.iniciarIconeFlutuante,
|
|
1644
|
+
configureFloatingIcon: api.configurarIconeFlutuante,
|
|
1645
|
+
setFloatingIconOpacity: api.definirOpacidadeIconeFlutuante,
|
|
1213
1646
|
stopFloatingIcon: api.pararIconeFlutuante,
|
|
1647
|
+
minimizeApp: api.minimizarApp,
|
|
1648
|
+
closeApp: api.fecharApp,
|
|
1649
|
+
exitApp: api.fecharApp,
|
|
1214
1650
|
getInitialNotification: api.obterNotificacaoInicial,
|
|
1215
1651
|
getInitialLink: api.obterLinkInicial,
|
|
1652
|
+
getInitialShare: api.obterCompartilhamentoInicial,
|
|
1653
|
+
onShareReceived: api.aoReceberCompartilhamento,
|
|
1654
|
+
onReceiveShare: api.aoReceberCompartilhamento,
|
|
1216
1655
|
onEvent: api.aoEvento,
|
|
1217
1656
|
onMinimize: api.aoMinimizar,
|
|
1218
1657
|
onAppResume: api.aoVoltarParaApp,
|
|
1219
1658
|
onOpenLink: api.aoAbrirLink,
|
|
1220
1659
|
onNetworkChange: api.aoMudarRede,
|
|
1221
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,
|
|
1222
1689
|
onNotificationClick: api.aoClicarNotificacao
|
|
1223
1690
|
});
|
|
1224
1691
|
|
|
@@ -1257,6 +1724,12 @@
|
|
|
1257
1724
|
emitEvent("link:aberto", link);
|
|
1258
1725
|
}
|
|
1259
1726
|
});
|
|
1727
|
+
api.obterCompartilhamentoInicial().then(function (share) {
|
|
1728
|
+
if (share) {
|
|
1729
|
+
initialShare = share;
|
|
1730
|
+
emitEvent("compartilhamento:recebido", share);
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1260
1733
|
}, false);
|
|
1261
1734
|
}
|
|
1262
1735
|
})();
|