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,9 @@ var notificationListeners = [];
|
|
|
7
7
|
var eventListeners = {};
|
|
8
8
|
var initialNotification = null;
|
|
9
9
|
var initialLink = null;
|
|
10
|
+
var initialShare = null;
|
|
11
|
+
var bluetoothServerStartPromise = null;
|
|
12
|
+
var wifiServerStartPromise = null;
|
|
10
13
|
var scheduledNotificationCounter = 0;
|
|
11
14
|
var notificationActionCounter = 0;
|
|
12
15
|
var notificationActionCallbacks = {};
|
|
@@ -23,6 +26,33 @@ var eventAliases = {
|
|
|
23
26
|
"battery:changed": "bateria:mudou",
|
|
24
27
|
"location:changed": "localizacao:mudou",
|
|
25
28
|
"biometric:failed": "biometria:falhou",
|
|
29
|
+
"share:received": "compartilhamento:recebido",
|
|
30
|
+
"sharing:received": "compartilhamento:recebido",
|
|
31
|
+
"bt:connected": "bluetooth:conectado",
|
|
32
|
+
"bluetooth:connected": "bluetooth:conectado",
|
|
33
|
+
"bt:data": "bluetooth:dados",
|
|
34
|
+
"bluetooth:data": "bluetooth:dados",
|
|
35
|
+
"bt:disconnected": "bluetooth:desconectado",
|
|
36
|
+
"bluetooth:disconnected": "bluetooth:desconectado",
|
|
37
|
+
"bt:error": "bluetooth:erro",
|
|
38
|
+
"bluetooth:error": "bluetooth:erro",
|
|
39
|
+
"wifi:connected": "wifi:conectado",
|
|
40
|
+
"wifi:data": "wifi:dados",
|
|
41
|
+
"wifi:disconnected": "wifi:desconectado",
|
|
42
|
+
"wifi:error": "wifi:erro",
|
|
43
|
+
"usb:connected": "usb:conectado",
|
|
44
|
+
"usb:disconnected": "usb:desconectado",
|
|
45
|
+
"headphone:connected": "fone:conectado",
|
|
46
|
+
"headphone:disconnected": "fone:desconectado",
|
|
47
|
+
"volume:changed": "volume:mudou",
|
|
48
|
+
"keyboard:opened": "teclado:abriu",
|
|
49
|
+
"keyboard:closed": "teclado:fechou",
|
|
50
|
+
"phone:shaken": "celular:sacudido",
|
|
51
|
+
"phone:faceDown": "celular:tela_para_baixo",
|
|
52
|
+
"proximity:near": "proximidade:perto",
|
|
53
|
+
"screenshot:taken": "print:tela",
|
|
54
|
+
"orientation:changed": "orientacao:mudou",
|
|
55
|
+
"nfc:received": "nfc:recebido",
|
|
26
56
|
"notification:received": "notificacao:recebida",
|
|
27
57
|
"notification:clicked": "notificacao:clicada"
|
|
28
58
|
};
|
|
@@ -605,16 +635,20 @@ function applyBase64DownloadSource(normalized, value) {
|
|
|
605
635
|
return normalized;
|
|
606
636
|
}
|
|
607
637
|
|
|
608
|
-
function downloadFileOptions(urlOrOptions, nameOrOptions) {
|
|
638
|
+
function downloadFileOptions(urlOrOptions, nameOrOptions, options) {
|
|
609
639
|
var normalized;
|
|
610
640
|
var source;
|
|
611
641
|
|
|
612
642
|
if (urlOrOptions && typeof urlOrOptions === "object" && !Array.isArray(urlOrOptions)) {
|
|
613
643
|
normalized = cloneSerializable(urlOrOptions) || {};
|
|
614
|
-
|
|
644
|
+
applyDownloadName(normalized, nameOrOptions);
|
|
645
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
646
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
647
|
+
}
|
|
648
|
+
return normalized;
|
|
615
649
|
}
|
|
616
650
|
|
|
617
|
-
normalized = {};
|
|
651
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
618
652
|
source = String(urlOrOptions || "").trim();
|
|
619
653
|
if (source.indexOf("data:") === 0) {
|
|
620
654
|
applyBase64DownloadSource(normalized, source);
|
|
@@ -641,16 +675,20 @@ function downloadBase64Options(nameOrOptions, base64, options) {
|
|
|
641
675
|
return applyBase64DownloadSource(normalized, base64);
|
|
642
676
|
}
|
|
643
677
|
|
|
644
|
-
function downloadLocalFileOptions(fileOrOptions, nameOrOptions) {
|
|
678
|
+
function downloadLocalFileOptions(fileOrOptions, nameOrOptions, options) {
|
|
645
679
|
var normalized;
|
|
646
680
|
var source;
|
|
647
681
|
|
|
648
682
|
if (fileOrOptions && typeof fileOrOptions === "object" && !Array.isArray(fileOrOptions)) {
|
|
649
683
|
normalized = cloneSerializable(fileOrOptions) || {};
|
|
650
|
-
|
|
684
|
+
applyDownloadName(normalized, nameOrOptions);
|
|
685
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
686
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
687
|
+
}
|
|
688
|
+
return normalized;
|
|
651
689
|
}
|
|
652
690
|
|
|
653
|
-
normalized = {};
|
|
691
|
+
normalized = cloneSerializable(options || {}) || {};
|
|
654
692
|
source = String(fileOrOptions || "").trim();
|
|
655
693
|
if (/^(content|file):\/\//.test(source)) {
|
|
656
694
|
normalized.uri = source;
|
|
@@ -665,6 +703,115 @@ function downloadLocalFileOptions(fileOrOptions, nameOrOptions) {
|
|
|
665
703
|
return applyDownloadName(normalized, nameOrOptions);
|
|
666
704
|
}
|
|
667
705
|
|
|
706
|
+
function ocrOptions(sourceOrOptions) {
|
|
707
|
+
if (sourceOrOptions && typeof sourceOrOptions === "object" && !Array.isArray(sourceOrOptions)) {
|
|
708
|
+
return cloneSerializable(sourceOrOptions) || {};
|
|
709
|
+
}
|
|
710
|
+
var source = String(sourceOrOptions || "").trim();
|
|
711
|
+
if (source.indexOf("data:") === 0) {
|
|
712
|
+
return { base64: source };
|
|
713
|
+
}
|
|
714
|
+
if (/^(content|file):\/\//.test(source)) {
|
|
715
|
+
return { uri: source, contentUri: source };
|
|
716
|
+
}
|
|
717
|
+
if (/^[A-Za-z]:[\\/]/.test(source) || source.charAt(0) === "/" || source.charAt(0) === "\\") {
|
|
718
|
+
return { path: source, caminho: source };
|
|
719
|
+
}
|
|
720
|
+
return { name: source, nome: source };
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
function normalizeReceivedShare(detail) {
|
|
724
|
+
var normalized = cloneSerializable(detail || {}) || {};
|
|
725
|
+
var kind = normalized.tipoConteudo || normalized.contentType || normalized.tipo || normalized.type;
|
|
726
|
+
if (kind) {
|
|
727
|
+
normalized.tipo = kind;
|
|
728
|
+
normalized.type = kind;
|
|
729
|
+
}
|
|
730
|
+
return normalized;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
function bluetoothReceivedData(detail) {
|
|
734
|
+
if (!detail || typeof detail !== "object") {
|
|
735
|
+
return detail;
|
|
736
|
+
}
|
|
737
|
+
if (Object.prototype.hasOwnProperty.call(detail, "dados")) {
|
|
738
|
+
return detail.dados;
|
|
739
|
+
}
|
|
740
|
+
if (Object.prototype.hasOwnProperty.call(detail, "data")) {
|
|
741
|
+
return detail.data;
|
|
742
|
+
}
|
|
743
|
+
return detail;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
function bluetoothErrorDetail(errorOrDetail) {
|
|
747
|
+
var detail = errorOrDetail && typeof errorOrDetail === "object"
|
|
748
|
+
? cloneSerializable(errorOrDetail) || {}
|
|
749
|
+
: {};
|
|
750
|
+
var message = detail.message || detail.mensagem || detail.error || detail.erro ||
|
|
751
|
+
(errorOrDetail && (errorOrDetail.message || errorOrDetail.mensagem || errorOrDetail.error || errorOrDetail.erro)) ||
|
|
752
|
+
String(errorOrDetail || "");
|
|
753
|
+
detail.ok = false;
|
|
754
|
+
detail.message = message;
|
|
755
|
+
detail.mensagem = message;
|
|
756
|
+
detail.error = message;
|
|
757
|
+
detail.erro = message;
|
|
758
|
+
detail.timestamp = detail.timestamp || Date.now();
|
|
759
|
+
return detail;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function startBluetoothServerSilently() {
|
|
763
|
+
if (bluetoothServerStartPromise) {
|
|
764
|
+
return bluetoothServerStartPromise;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
bluetoothServerStartPromise = call("startBluetoothServer").catch(function (error) {
|
|
768
|
+
bluetoothServerStartPromise = null;
|
|
769
|
+
emitEvent("bluetooth:erro", bluetoothErrorDetail(error));
|
|
770
|
+
});
|
|
771
|
+
return bluetoothServerStartPromise;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
function wifiReceivedData(detail) {
|
|
775
|
+
if (!detail || typeof detail !== "object") {
|
|
776
|
+
return detail;
|
|
777
|
+
}
|
|
778
|
+
if (Object.prototype.hasOwnProperty.call(detail, "dados")) {
|
|
779
|
+
return detail.dados;
|
|
780
|
+
}
|
|
781
|
+
if (Object.prototype.hasOwnProperty.call(detail, "data")) {
|
|
782
|
+
return detail.data;
|
|
783
|
+
}
|
|
784
|
+
return detail;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function wifiErrorDetail(errorOrDetail) {
|
|
788
|
+
var detail = errorOrDetail && typeof errorOrDetail === "object"
|
|
789
|
+
? cloneSerializable(errorOrDetail) || {}
|
|
790
|
+
: {};
|
|
791
|
+
var message = detail.message || detail.mensagem || detail.error || detail.erro ||
|
|
792
|
+
(errorOrDetail && (errorOrDetail.message || errorOrDetail.mensagem || errorOrDetail.error || errorOrDetail.erro)) ||
|
|
793
|
+
String(errorOrDetail || "");
|
|
794
|
+
detail.ok = false;
|
|
795
|
+
detail.message = message;
|
|
796
|
+
detail.mensagem = message;
|
|
797
|
+
detail.error = message;
|
|
798
|
+
detail.erro = message;
|
|
799
|
+
detail.timestamp = detail.timestamp || Date.now();
|
|
800
|
+
return detail;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function startWifiServerSilently() {
|
|
804
|
+
if (wifiServerStartPromise) {
|
|
805
|
+
return wifiServerStartPromise;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
wifiServerStartPromise = call("startWifiServer").catch(function (error) {
|
|
809
|
+
wifiServerStartPromise = null;
|
|
810
|
+
emitEvent("wifi:erro", wifiErrorDetail(error));
|
|
811
|
+
});
|
|
812
|
+
return wifiServerStartPromise;
|
|
813
|
+
}
|
|
814
|
+
|
|
668
815
|
function wallpaperOptions(sourceOrOptions, options) {
|
|
669
816
|
var normalized;
|
|
670
817
|
var source;
|
|
@@ -709,6 +856,61 @@ function wallpaperOptions(sourceOrOptions, options) {
|
|
|
709
856
|
return normalized;
|
|
710
857
|
}
|
|
711
858
|
|
|
859
|
+
function volumeOptions(streamOrOptions, value, options) {
|
|
860
|
+
var normalized = {};
|
|
861
|
+
if (streamOrOptions && typeof streamOrOptions === "object" && !Array.isArray(streamOrOptions)) {
|
|
862
|
+
normalized = cloneSerializable(streamOrOptions) || {};
|
|
863
|
+
} else {
|
|
864
|
+
if (typeof streamOrOptions === "number") {
|
|
865
|
+
normalized.value = streamOrOptions;
|
|
866
|
+
normalized.valor = streamOrOptions;
|
|
867
|
+
} else if (typeof streamOrOptions === "string") {
|
|
868
|
+
normalized.stream = streamOrOptions;
|
|
869
|
+
normalized.tipo = streamOrOptions;
|
|
870
|
+
}
|
|
871
|
+
if (typeof value !== "undefined" && value !== null && typeof value !== "object") {
|
|
872
|
+
normalized.value = value;
|
|
873
|
+
normalized.valor = value;
|
|
874
|
+
}
|
|
875
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
876
|
+
Object.assign(normalized, cloneSerializable(value) || {});
|
|
877
|
+
}
|
|
878
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
879
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return normalized;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
function adjustVolumeOptions(streamOrOptions, amountOrOptions, options, direction) {
|
|
886
|
+
var normalized = volumeOptions(streamOrOptions);
|
|
887
|
+
if (typeof amountOrOptions === "number") {
|
|
888
|
+
normalized.amount = amountOrOptions;
|
|
889
|
+
normalized.quantidade = amountOrOptions;
|
|
890
|
+
} else if (amountOrOptions && typeof amountOrOptions === "object" && !Array.isArray(amountOrOptions)) {
|
|
891
|
+
Object.assign(normalized, cloneSerializable(amountOrOptions) || {});
|
|
892
|
+
}
|
|
893
|
+
if (options && typeof options === "object" && !Array.isArray(options)) {
|
|
894
|
+
Object.assign(normalized, cloneSerializable(options) || {});
|
|
895
|
+
}
|
|
896
|
+
normalized.direction = direction;
|
|
897
|
+
normalized.direcao = direction;
|
|
898
|
+
return normalized;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
function floatingIconOptions(optionsOrOpacity) {
|
|
902
|
+
if (optionsOrOpacity && typeof optionsOrOpacity === "object" && !Array.isArray(optionsOrOpacity)) {
|
|
903
|
+
return cloneSerializable(optionsOrOpacity) || {};
|
|
904
|
+
}
|
|
905
|
+
if (typeof optionsOrOpacity === "number" || typeof optionsOrOpacity === "string") {
|
|
906
|
+
return {
|
|
907
|
+
opacity: Number(optionsOrOpacity),
|
|
908
|
+
opacidade: Number(optionsOrOpacity)
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
return {};
|
|
912
|
+
}
|
|
913
|
+
|
|
712
914
|
function secureItemOptions(keyOrOptions, value, options) {
|
|
713
915
|
var normalized;
|
|
714
916
|
if (keyOrOptions && typeof keyOrOptions === "object" && !Array.isArray(keyOrOptions)) {
|
|
@@ -830,6 +1032,14 @@ var api = {
|
|
|
830
1032
|
toast: function (message) {
|
|
831
1033
|
return call("toast", [String(message || "")]);
|
|
832
1034
|
},
|
|
1035
|
+
aguardar: function (ms) {
|
|
1036
|
+
var delay = Math.max(0, Math.min(Number(ms) || 0, 2147483647));
|
|
1037
|
+
return new Promise(function (resolve) {
|
|
1038
|
+
setTimeout(function () {
|
|
1039
|
+
resolve({ ok: true, ms: delay });
|
|
1040
|
+
}, delay);
|
|
1041
|
+
});
|
|
1042
|
+
},
|
|
833
1043
|
fullscreen: function (enabled) {
|
|
834
1044
|
return call("fullscreen", [Boolean(enabled)]);
|
|
835
1045
|
},
|
|
@@ -890,6 +1100,87 @@ var api = {
|
|
|
890
1100
|
compartilhar: function (options) {
|
|
891
1101
|
return call("share", [options || {}]);
|
|
892
1102
|
},
|
|
1103
|
+
compartilharApp: function (options) {
|
|
1104
|
+
return call("shareCurrentApp", [options || {}]);
|
|
1105
|
+
},
|
|
1106
|
+
procurarBT: function (options) {
|
|
1107
|
+
return call("scanBluetooth", [options || {}]);
|
|
1108
|
+
},
|
|
1109
|
+
conectarBT: function (idDispositivo) {
|
|
1110
|
+
return call("connectBluetooth", [String(idDispositivo || "")]);
|
|
1111
|
+
},
|
|
1112
|
+
enviarBT: function (data) {
|
|
1113
|
+
return call("sendBluetooth", [data]);
|
|
1114
|
+
},
|
|
1115
|
+
aoConectarBT: function (listener) {
|
|
1116
|
+
if (typeof listener !== "function") {
|
|
1117
|
+
throw new TypeError("listener must be a function");
|
|
1118
|
+
}
|
|
1119
|
+
startBluetoothServerSilently();
|
|
1120
|
+
return onEvent("bluetooth:conectado", listener);
|
|
1121
|
+
},
|
|
1122
|
+
aoReceberDadosBT: function (listener) {
|
|
1123
|
+
if (typeof listener !== "function") {
|
|
1124
|
+
throw new TypeError("listener must be a function");
|
|
1125
|
+
}
|
|
1126
|
+
startBluetoothServerSilently();
|
|
1127
|
+
return onEvent("bluetooth:dados", function (detail) {
|
|
1128
|
+
listener(bluetoothReceivedData(detail));
|
|
1129
|
+
});
|
|
1130
|
+
},
|
|
1131
|
+
aoDarErroBT: function (listener) {
|
|
1132
|
+
if (typeof listener !== "function") {
|
|
1133
|
+
throw new TypeError("listener must be a function");
|
|
1134
|
+
}
|
|
1135
|
+
return onEvent("bluetooth:erro", function (detail) {
|
|
1136
|
+
listener(bluetoothErrorDetail(detail));
|
|
1137
|
+
});
|
|
1138
|
+
},
|
|
1139
|
+
procurarWiFi: function (options) {
|
|
1140
|
+
return call("scanWifi", [options || {}]);
|
|
1141
|
+
},
|
|
1142
|
+
conectarWiFi: function (idDispositivo) {
|
|
1143
|
+
return call("connectWifi", [String(idDispositivo || "")]);
|
|
1144
|
+
},
|
|
1145
|
+
enviarWiFi: function (data) {
|
|
1146
|
+
return call("sendWifi", [data]);
|
|
1147
|
+
},
|
|
1148
|
+
aoConectarWiFi: function (listener) {
|
|
1149
|
+
if (typeof listener !== "function") {
|
|
1150
|
+
throw new TypeError("listener must be a function");
|
|
1151
|
+
}
|
|
1152
|
+
startWifiServerSilently();
|
|
1153
|
+
return onEvent("wifi:conectado", listener);
|
|
1154
|
+
},
|
|
1155
|
+
aoReceberDadosWiFi: function (listener) {
|
|
1156
|
+
if (typeof listener !== "function") {
|
|
1157
|
+
throw new TypeError("listener must be a function");
|
|
1158
|
+
}
|
|
1159
|
+
startWifiServerSilently();
|
|
1160
|
+
return onEvent("wifi:dados", function (detail) {
|
|
1161
|
+
listener(wifiReceivedData(detail));
|
|
1162
|
+
});
|
|
1163
|
+
},
|
|
1164
|
+
aoDarErroWiFi: function (listener) {
|
|
1165
|
+
if (typeof listener !== "function") {
|
|
1166
|
+
throw new TypeError("listener must be a function");
|
|
1167
|
+
}
|
|
1168
|
+
return onEvent("wifi:erro", function (detail) {
|
|
1169
|
+
listener(wifiErrorDetail(detail));
|
|
1170
|
+
});
|
|
1171
|
+
},
|
|
1172
|
+
ocr: function (sourceOrOptions) {
|
|
1173
|
+
return call("ocr", [ocrOptions(sourceOrOptions)]);
|
|
1174
|
+
},
|
|
1175
|
+
falar: function (text, options) {
|
|
1176
|
+
return call("speakText", [String(text || ""), options || {}]);
|
|
1177
|
+
},
|
|
1178
|
+
pararFala: function () {
|
|
1179
|
+
return call("stopSpeaking");
|
|
1180
|
+
},
|
|
1181
|
+
ouvir: function (options) {
|
|
1182
|
+
return call("recognizeSpeech", [options || {}]);
|
|
1183
|
+
},
|
|
893
1184
|
abrirUrl: function (url) {
|
|
894
1185
|
return call("openUrl", [String(url || "")]);
|
|
895
1186
|
},
|
|
@@ -964,14 +1255,14 @@ var api = {
|
|
|
964
1255
|
compartilharArquivo: function (nameOrOptions, options) {
|
|
965
1256
|
return call("shareStoredFile", [storedFileNameOptions(nameOrOptions, options)]);
|
|
966
1257
|
},
|
|
967
|
-
baixarArquivo: function (urlOrOptions, nameOrOptions) {
|
|
968
|
-
return call("downloadFile", [downloadFileOptions(urlOrOptions, nameOrOptions)]);
|
|
1258
|
+
baixarArquivo: function (urlOrOptions, nameOrOptions, options) {
|
|
1259
|
+
return call("downloadFile", [downloadFileOptions(urlOrOptions, nameOrOptions, options)]);
|
|
969
1260
|
},
|
|
970
1261
|
baixarBase64: function (nameOrOptions, base64, options) {
|
|
971
1262
|
return call("downloadFile", [downloadBase64Options(nameOrOptions, base64, options)]);
|
|
972
1263
|
},
|
|
973
|
-
baixarArquivoLocal: function (fileOrOptions, nameOrOptions) {
|
|
974
|
-
return call("downloadFile", [downloadLocalFileOptions(fileOrOptions, nameOrOptions)]);
|
|
1264
|
+
baixarArquivoLocal: function (fileOrOptions, nameOrOptions, options) {
|
|
1265
|
+
return call("downloadFile", [downloadLocalFileOptions(fileOrOptions, nameOrOptions, options)]);
|
|
975
1266
|
},
|
|
976
1267
|
definirPapelParede: function (sourceOrOptions, options) {
|
|
977
1268
|
return call("setWallpaper", [wallpaperOptions(sourceOrOptions, options)]);
|
|
@@ -982,6 +1273,12 @@ var api = {
|
|
|
982
1273
|
abrirConfiguracaoPapelParede: function () {
|
|
983
1274
|
return call("openWallpaperSettings");
|
|
984
1275
|
},
|
|
1276
|
+
capturarTela: function (options) {
|
|
1277
|
+
return call("captureScreen", [options || {}]);
|
|
1278
|
+
},
|
|
1279
|
+
tirarPrint: function (options) {
|
|
1280
|
+
return call("captureScreen", [options || {}]);
|
|
1281
|
+
},
|
|
985
1282
|
infoDispositivo: function () {
|
|
986
1283
|
return call("deviceInfo");
|
|
987
1284
|
},
|
|
@@ -1000,6 +1297,18 @@ var api = {
|
|
|
1000
1297
|
infoDesempenho: function () {
|
|
1001
1298
|
return call("performanceInfo");
|
|
1002
1299
|
},
|
|
1300
|
+
volumeAtual: function () {
|
|
1301
|
+
return call("getVolume");
|
|
1302
|
+
},
|
|
1303
|
+
definirVolume: function (streamOrOptions, value, options) {
|
|
1304
|
+
return call("setVolume", [volumeOptions(streamOrOptions, value, options)]);
|
|
1305
|
+
},
|
|
1306
|
+
aumentarVolume: function (streamOrOptions, amountOrOptions, options) {
|
|
1307
|
+
return call("adjustVolume", [adjustVolumeOptions(streamOrOptions, amountOrOptions, options, "up")]);
|
|
1308
|
+
},
|
|
1309
|
+
diminuirVolume: function (streamOrOptions, amountOrOptions, options) {
|
|
1310
|
+
return call("adjustVolume", [adjustVolumeOptions(streamOrOptions, amountOrOptions, options, "down")]);
|
|
1311
|
+
},
|
|
1003
1312
|
appsAbertos: function () {
|
|
1004
1313
|
return call("openAppsMemory");
|
|
1005
1314
|
},
|
|
@@ -1063,12 +1372,24 @@ var api = {
|
|
|
1063
1372
|
abrirConfiguracaoSobreposicao: function () {
|
|
1064
1373
|
return call("openOverlaySettings");
|
|
1065
1374
|
},
|
|
1066
|
-
iniciarIconeFlutuante: function () {
|
|
1067
|
-
return call("startFloatingIcon");
|
|
1375
|
+
iniciarIconeFlutuante: function (options) {
|
|
1376
|
+
return call("startFloatingIcon", [floatingIconOptions(options)]);
|
|
1068
1377
|
},
|
|
1069
1378
|
pararIconeFlutuante: function () {
|
|
1070
1379
|
return call("stopFloatingIcon");
|
|
1071
1380
|
},
|
|
1381
|
+
configurarIconeFlutuante: function (options) {
|
|
1382
|
+
return call("configureFloatingIcon", [floatingIconOptions(options)]);
|
|
1383
|
+
},
|
|
1384
|
+
definirOpacidadeIconeFlutuante: function (opacity) {
|
|
1385
|
+
return call("configureFloatingIcon", [floatingIconOptions(opacity)]);
|
|
1386
|
+
},
|
|
1387
|
+
minimizarApp: function () {
|
|
1388
|
+
return call("minimizeApp");
|
|
1389
|
+
},
|
|
1390
|
+
fecharApp: function () {
|
|
1391
|
+
return call("closeApp");
|
|
1392
|
+
},
|
|
1072
1393
|
obterNotificacaoInicial: function () {
|
|
1073
1394
|
return call("getInitialNotification").then(function (notification) {
|
|
1074
1395
|
initialNotification = notification && notification.id ? notification : null;
|
|
@@ -1081,6 +1402,12 @@ var api = {
|
|
|
1081
1402
|
return initialLink;
|
|
1082
1403
|
});
|
|
1083
1404
|
},
|
|
1405
|
+
obterCompartilhamentoInicial: function () {
|
|
1406
|
+
return call("getInitialShare").then(function (share) {
|
|
1407
|
+
initialShare = share && (share.text || share.texto || share.uri || (share.items && share.items.length)) ? normalizeReceivedShare(share) : null;
|
|
1408
|
+
return initialShare;
|
|
1409
|
+
});
|
|
1410
|
+
},
|
|
1084
1411
|
aoEvento: onEvent,
|
|
1085
1412
|
aoMinimizar: function (listener) {
|
|
1086
1413
|
return onEvent("app:background", listener);
|
|
@@ -1099,12 +1426,67 @@ var api = {
|
|
|
1099
1426
|
}
|
|
1100
1427
|
return onEvent("link:aberto", listener);
|
|
1101
1428
|
},
|
|
1429
|
+
aoReceberCompartilhamento: function (listener) {
|
|
1430
|
+
if (typeof listener !== "function") {
|
|
1431
|
+
throw new TypeError("listener must be a function");
|
|
1432
|
+
}
|
|
1433
|
+
if (initialShare) {
|
|
1434
|
+
setTimeout(function () {
|
|
1435
|
+
listener(normalizeReceivedShare(initialShare));
|
|
1436
|
+
}, 0);
|
|
1437
|
+
}
|
|
1438
|
+
return onEvent("compartilhamento:recebido", function (detail) {
|
|
1439
|
+
listener(normalizeReceivedShare(detail));
|
|
1440
|
+
});
|
|
1441
|
+
},
|
|
1102
1442
|
aoMudarRede: function (listener) {
|
|
1103
1443
|
return onEvent("rede:mudou", listener);
|
|
1104
1444
|
},
|
|
1105
1445
|
aoMudarBateria: function (listener) {
|
|
1106
1446
|
return onEvent("bateria:mudou", listener);
|
|
1107
1447
|
},
|
|
1448
|
+
aoConectarUSB: function (listener) {
|
|
1449
|
+
return onEvent("usb:conectado", listener);
|
|
1450
|
+
},
|
|
1451
|
+
aoDesconectarUSB: function (listener) {
|
|
1452
|
+
return onEvent("usb:desconectado", listener);
|
|
1453
|
+
},
|
|
1454
|
+
aoConectarFone: function (listener) {
|
|
1455
|
+
return onEvent("fone:conectado", listener);
|
|
1456
|
+
},
|
|
1457
|
+
aoDesconectarFone: function (listener) {
|
|
1458
|
+
return onEvent("fone:desconectado", listener);
|
|
1459
|
+
},
|
|
1460
|
+
aoMudarVolume: function (listener) {
|
|
1461
|
+
return onEvent("volume:mudou", listener);
|
|
1462
|
+
},
|
|
1463
|
+
aoAbrirTeclado: function (listener) {
|
|
1464
|
+
return onEvent("teclado:abriu", listener);
|
|
1465
|
+
},
|
|
1466
|
+
aoFecharTeclado: function (listener) {
|
|
1467
|
+
return onEvent("teclado:fechou", listener);
|
|
1468
|
+
},
|
|
1469
|
+
aoSacudirCelular: function (listener) {
|
|
1470
|
+
return onEvent("celular:sacudido", listener);
|
|
1471
|
+
},
|
|
1472
|
+
aoVirarCelularParaBaixo: function (listener) {
|
|
1473
|
+
return onEvent("celular:tela_para_baixo", listener);
|
|
1474
|
+
},
|
|
1475
|
+
aoAproximarObjeto: function (listener) {
|
|
1476
|
+
return onEvent("proximidade:perto", listener);
|
|
1477
|
+
},
|
|
1478
|
+
aoTirarPrint: function (listener) {
|
|
1479
|
+
return onEvent("print:tela", listener);
|
|
1480
|
+
},
|
|
1481
|
+
aoMudarOrientacao: function (listener) {
|
|
1482
|
+
return onEvent("orientacao:mudou", listener);
|
|
1483
|
+
},
|
|
1484
|
+
aoNFC: function (listener) {
|
|
1485
|
+
return onEvent("nfc:recebido", listener);
|
|
1486
|
+
},
|
|
1487
|
+
aoReceberNotificacao: function (listener) {
|
|
1488
|
+
return onEvent("notificacao:recebida", listener);
|
|
1489
|
+
},
|
|
1108
1490
|
aoClicarNotificacao: function (listener) {
|
|
1109
1491
|
if (typeof listener !== "function") {
|
|
1110
1492
|
throw new TypeError("listener must be a function");
|
|
@@ -1137,6 +1519,7 @@ Object.assign(api, {
|
|
|
1137
1519
|
cancelNotification: api.cancelarNotificacao,
|
|
1138
1520
|
cancelNotificationLoop: api.cancelarLoopNotificacoes,
|
|
1139
1521
|
vibrate: api.vibrar,
|
|
1522
|
+
loading: api.aguardar,
|
|
1140
1523
|
manterTelaLigada: api.manterTelaAcordada,
|
|
1141
1524
|
keepScreenAwake: api.manterTelaAcordada,
|
|
1142
1525
|
keepScreenOn: api.manterTelaAcordada,
|
|
@@ -1163,6 +1546,46 @@ Object.assign(api, {
|
|
|
1163
1546
|
readText: api.lerTextoCopiado,
|
|
1164
1547
|
shareText: api.compartilharTexto,
|
|
1165
1548
|
share: api.compartilhar,
|
|
1549
|
+
shareApp: api.compartilharApp,
|
|
1550
|
+
share_me: api.compartilharApp,
|
|
1551
|
+
scanBluetooth: api.procurarBT,
|
|
1552
|
+
procurarBluetooth: api.procurarBT,
|
|
1553
|
+
buscarBT: api.procurarBT,
|
|
1554
|
+
connectBluetooth: api.conectarBT,
|
|
1555
|
+
conectarBluetooth: api.conectarBT,
|
|
1556
|
+
sendBluetooth: api.enviarBT,
|
|
1557
|
+
onBluetoothConnect: api.aoConectarBT,
|
|
1558
|
+
onBluetoothConnected: api.aoConectarBT,
|
|
1559
|
+
onBluetoothData: api.aoReceberDadosBT,
|
|
1560
|
+
onBTData: api.aoReceberDadosBT,
|
|
1561
|
+
onBluetoothError: api.aoDarErroBT,
|
|
1562
|
+
onBTError: api.aoDarErroBT,
|
|
1563
|
+
scanWiFi: api.procurarWiFi,
|
|
1564
|
+
scanWifi: api.procurarWiFi,
|
|
1565
|
+
procurarWifi: api.procurarWiFi,
|
|
1566
|
+
connectWiFi: api.conectarWiFi,
|
|
1567
|
+
connectWifi: api.conectarWiFi,
|
|
1568
|
+
conectarWifi: api.conectarWiFi,
|
|
1569
|
+
sendWiFi: api.enviarWiFi,
|
|
1570
|
+
sendWifi: api.enviarWiFi,
|
|
1571
|
+
enviarWifi: api.enviarWiFi,
|
|
1572
|
+
onWiFiConnect: api.aoConectarWiFi,
|
|
1573
|
+
onWifiConnect: api.aoConectarWiFi,
|
|
1574
|
+
onWiFiConnected: api.aoConectarWiFi,
|
|
1575
|
+
onWifiConnected: api.aoConectarWiFi,
|
|
1576
|
+
onWiFiData: api.aoReceberDadosWiFi,
|
|
1577
|
+
onWifiData: api.aoReceberDadosWiFi,
|
|
1578
|
+
onWiFiError: api.aoDarErroWiFi,
|
|
1579
|
+
onWifiError: api.aoDarErroWiFi,
|
|
1580
|
+
recognizeText: api.ocr,
|
|
1581
|
+
textFromImage: api.ocr,
|
|
1582
|
+
speak: api.falar,
|
|
1583
|
+
textToSpeech: api.falar,
|
|
1584
|
+
stopSpeaking: api.pararFala,
|
|
1585
|
+
stopSpeech: api.pararFala,
|
|
1586
|
+
listen: api.ouvir,
|
|
1587
|
+
recognizeSpeech: api.ouvir,
|
|
1588
|
+
speechToText: api.ouvir,
|
|
1166
1589
|
openUrl: api.abrirUrl,
|
|
1167
1590
|
openExternalUrl: api.abrirUrlExterno,
|
|
1168
1591
|
openOutsideApp: api.abrirForaDoApp,
|
|
@@ -1206,12 +1629,20 @@ Object.assign(api, {
|
|
|
1206
1629
|
wallpaper: api.definirPapelParede,
|
|
1207
1630
|
wallpaperInfo: api.infoPapelParede,
|
|
1208
1631
|
openWallpaperSettings: api.abrirConfiguracaoPapelParede,
|
|
1632
|
+
captureScreen: api.capturarTela,
|
|
1633
|
+
takeScreenshot: api.capturarTela,
|
|
1634
|
+
screenshot: api.capturarTela,
|
|
1209
1635
|
deviceInfo: api.infoDispositivo,
|
|
1210
1636
|
networkInfo: api.infoRede,
|
|
1211
1637
|
batteryInfo: api.infoBateria,
|
|
1212
1638
|
memoryInfo: api.infoMemoria,
|
|
1213
1639
|
storageInfo: api.infoArmazenamento,
|
|
1214
1640
|
performanceInfo: api.infoDesempenho,
|
|
1641
|
+
currentVolume: api.volumeAtual,
|
|
1642
|
+
getVolume: api.volumeAtual,
|
|
1643
|
+
setVolume: api.definirVolume,
|
|
1644
|
+
increaseVolume: api.aumentarVolume,
|
|
1645
|
+
decreaseVolume: api.diminuirVolume,
|
|
1215
1646
|
openAppsMemory: api.appsAbertos,
|
|
1216
1647
|
openAppsInfo: api.infoAppsAbertos,
|
|
1217
1648
|
getLocation: api.obterLocalizacao,
|
|
@@ -1238,15 +1669,51 @@ Object.assign(api, {
|
|
|
1238
1669
|
requestOverlayPermission: api.solicitarPermissaoSobreposicao,
|
|
1239
1670
|
openOverlaySettings: api.abrirConfiguracaoSobreposicao,
|
|
1240
1671
|
startFloatingIcon: api.iniciarIconeFlutuante,
|
|
1672
|
+
configureFloatingIcon: api.configurarIconeFlutuante,
|
|
1673
|
+
setFloatingIconOpacity: api.definirOpacidadeIconeFlutuante,
|
|
1241
1674
|
stopFloatingIcon: api.pararIconeFlutuante,
|
|
1675
|
+
minimizeApp: api.minimizarApp,
|
|
1676
|
+
closeApp: api.fecharApp,
|
|
1677
|
+
exitApp: api.fecharApp,
|
|
1242
1678
|
getInitialNotification: api.obterNotificacaoInicial,
|
|
1243
1679
|
getInitialLink: api.obterLinkInicial,
|
|
1680
|
+
getInitialShare: api.obterCompartilhamentoInicial,
|
|
1681
|
+
onShareReceived: api.aoReceberCompartilhamento,
|
|
1682
|
+
onReceiveShare: api.aoReceberCompartilhamento,
|
|
1244
1683
|
onEvent: api.aoEvento,
|
|
1245
1684
|
onMinimize: api.aoMinimizar,
|
|
1246
1685
|
onAppResume: api.aoVoltarParaApp,
|
|
1247
1686
|
onOpenLink: api.aoAbrirLink,
|
|
1248
1687
|
onNetworkChange: api.aoMudarRede,
|
|
1249
1688
|
onBatteryChange: api.aoMudarBateria,
|
|
1689
|
+
onUSBConnect: api.aoConectarUSB,
|
|
1690
|
+
onUsbConnect: api.aoConectarUSB,
|
|
1691
|
+
onUSBDisconnect: api.aoDesconectarUSB,
|
|
1692
|
+
onUsbDisconnect: api.aoDesconectarUSB,
|
|
1693
|
+
onHeadphoneConnect: api.aoConectarFone,
|
|
1694
|
+
onHeadphoneConnected: api.aoConectarFone,
|
|
1695
|
+
onHeadphoneDisconnect: api.aoDesconectarFone,
|
|
1696
|
+
onHeadphoneDisconnected: api.aoDesconectarFone,
|
|
1697
|
+
onVolumeChange: api.aoMudarVolume,
|
|
1698
|
+
onKeyboardOpen: api.aoAbrirTeclado,
|
|
1699
|
+
onKeyboardOpened: api.aoAbrirTeclado,
|
|
1700
|
+
onKeyboardClose: api.aoFecharTeclado,
|
|
1701
|
+
onKeyboardClosed: api.aoFecharTeclado,
|
|
1702
|
+
onPhoneShake: api.aoSacudirCelular,
|
|
1703
|
+
onShake: api.aoSacudirCelular,
|
|
1704
|
+
onPhoneFaceDown: api.aoVirarCelularParaBaixo,
|
|
1705
|
+
onFaceDown: api.aoVirarCelularParaBaixo,
|
|
1706
|
+
onProximityNear: api.aoAproximarObjeto,
|
|
1707
|
+
onObjectNear: api.aoAproximarObjeto,
|
|
1708
|
+
onScreenshot: api.aoTirarPrint,
|
|
1709
|
+
onScreenshotTaken: api.aoTirarPrint,
|
|
1710
|
+
onOrientationChange: api.aoMudarOrientacao,
|
|
1711
|
+
onNFC: api.aoNFC,
|
|
1712
|
+
onNfc: api.aoNFC,
|
|
1713
|
+
onNFCReceived: api.aoNFC,
|
|
1714
|
+
onNfcReceived: api.aoNFC,
|
|
1715
|
+
onNotificationReceived: api.aoReceberNotificacao,
|
|
1716
|
+
onReceiveNotification: api.aoReceberNotificacao,
|
|
1250
1717
|
onNotificationClick: api.aoClicarNotificacao
|
|
1251
1718
|
});
|
|
1252
1719
|
|
|
@@ -1348,6 +1815,12 @@ if (typeof window !== "undefined") {
|
|
|
1348
1815
|
emitEvent("link:aberto", link);
|
|
1349
1816
|
}
|
|
1350
1817
|
});
|
|
1818
|
+
api.obterCompartilhamentoInicial().then(function (share) {
|
|
1819
|
+
if (share) {
|
|
1820
|
+
initialShare = share;
|
|
1821
|
+
emitEvent("compartilhamento:recebido", share);
|
|
1822
|
+
}
|
|
1823
|
+
});
|
|
1351
1824
|
}, false);
|
|
1352
1825
|
}
|
|
1353
1826
|
|