html2apk 0.9.0 → 12.0.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.
@@ -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
- return applyDownloadName(normalized, nameOrOptions);
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
- return applyDownloadName(normalized, nameOrOptions);
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
  },
@@ -1018,9 +1327,47 @@ var api = {
1018
1327
  aoMudarLocalizacao: function (listener) {
1019
1328
  return onEvent("localizacao:mudou", listener);
1020
1329
  },
1330
+ medirVelocidade: function (callback, options) {
1331
+ var listener = function (local) {
1332
+ if (typeof callback !== "function") return;
1333
+ var ms = typeof local.velocidade === "number" ? local.velocidade : 0;
1334
+ var kmh = ms * 3.6;
1335
+ callback(kmh, local);
1336
+ };
1337
+ var stopEvent = api.aoMudarLocalizacao(listener);
1338
+ return api.acompanharLocalizacao(Object.assign({ altaPrecisao: true, intervaloMs: 2000 }, options || {}))
1339
+ .then(function (result) {
1340
+ var watchId = result && result.watchId;
1341
+ return function pararMedicao() {
1342
+ stopEvent();
1343
+ if (watchId) {
1344
+ return api.pararLocalizacao(watchId);
1345
+ }
1346
+ return Promise.resolve();
1347
+ };
1348
+ });
1349
+ },
1021
1350
  autenticarBiometria: function (options) {
1022
1351
  return call("authenticateBiometric", [options || {}]);
1023
1352
  },
1353
+ solicitarBloqueio: function (options) {
1354
+ return call("requestDeviceLock", [options || {}]);
1355
+ },
1356
+ solicitarSegundoPlano: function (options) {
1357
+ return call("requestBackgroundExecution", [options || {}]);
1358
+ },
1359
+ configurarInicioAutomatico: function (enable) {
1360
+ return call("setAutoStartOnBoot", [{ ativar: !!enable }]);
1361
+ },
1362
+ aoLigarDispositivo: function (callback) {
1363
+ if (typeof callback === "function") {
1364
+ call("getInitialLink").then(function(link) {
1365
+ if (link === "html2apk://boot") {
1366
+ callback();
1367
+ }
1368
+ });
1369
+ }
1370
+ },
1024
1371
  salvarSeguro: function (keyOrOptions, value, options) {
1025
1372
  return call("saveSecureItem", [secureItemOptions(keyOrOptions, value, options)]);
1026
1373
  },
@@ -1063,12 +1410,24 @@ var api = {
1063
1410
  abrirConfiguracaoSobreposicao: function () {
1064
1411
  return call("openOverlaySettings");
1065
1412
  },
1066
- iniciarIconeFlutuante: function () {
1067
- return call("startFloatingIcon");
1413
+ iniciarIconeFlutuante: function (options) {
1414
+ return call("startFloatingIcon", [floatingIconOptions(options)]);
1068
1415
  },
1069
1416
  pararIconeFlutuante: function () {
1070
1417
  return call("stopFloatingIcon");
1071
1418
  },
1419
+ configurarIconeFlutuante: function (options) {
1420
+ return call("configureFloatingIcon", [floatingIconOptions(options)]);
1421
+ },
1422
+ definirOpacidadeIconeFlutuante: function (opacity) {
1423
+ return call("configureFloatingIcon", [floatingIconOptions(opacity)]);
1424
+ },
1425
+ minimizarApp: function () {
1426
+ return call("minimizeApp");
1427
+ },
1428
+ fecharApp: function () {
1429
+ return call("closeApp");
1430
+ },
1072
1431
  obterNotificacaoInicial: function () {
1073
1432
  return call("getInitialNotification").then(function (notification) {
1074
1433
  initialNotification = notification && notification.id ? notification : null;
@@ -1081,6 +1440,12 @@ var api = {
1081
1440
  return initialLink;
1082
1441
  });
1083
1442
  },
1443
+ obterCompartilhamentoInicial: function () {
1444
+ return call("getInitialShare").then(function (share) {
1445
+ initialShare = share && (share.text || share.texto || share.uri || (share.items && share.items.length)) ? normalizeReceivedShare(share) : null;
1446
+ return initialShare;
1447
+ });
1448
+ },
1084
1449
  aoEvento: onEvent,
1085
1450
  aoMinimizar: function (listener) {
1086
1451
  return onEvent("app:background", listener);
@@ -1099,12 +1464,67 @@ var api = {
1099
1464
  }
1100
1465
  return onEvent("link:aberto", listener);
1101
1466
  },
1467
+ aoReceberCompartilhamento: function (listener) {
1468
+ if (typeof listener !== "function") {
1469
+ throw new TypeError("listener must be a function");
1470
+ }
1471
+ if (initialShare) {
1472
+ setTimeout(function () {
1473
+ listener(normalizeReceivedShare(initialShare));
1474
+ }, 0);
1475
+ }
1476
+ return onEvent("compartilhamento:recebido", function (detail) {
1477
+ listener(normalizeReceivedShare(detail));
1478
+ });
1479
+ },
1102
1480
  aoMudarRede: function (listener) {
1103
1481
  return onEvent("rede:mudou", listener);
1104
1482
  },
1105
1483
  aoMudarBateria: function (listener) {
1106
1484
  return onEvent("bateria:mudou", listener);
1107
1485
  },
1486
+ aoConectarUSB: function (listener) {
1487
+ return onEvent("usb:conectado", listener);
1488
+ },
1489
+ aoDesconectarUSB: function (listener) {
1490
+ return onEvent("usb:desconectado", listener);
1491
+ },
1492
+ aoConectarFone: function (listener) {
1493
+ return onEvent("fone:conectado", listener);
1494
+ },
1495
+ aoDesconectarFone: function (listener) {
1496
+ return onEvent("fone:desconectado", listener);
1497
+ },
1498
+ aoMudarVolume: function (listener) {
1499
+ return onEvent("volume:mudou", listener);
1500
+ },
1501
+ aoAbrirTeclado: function (listener) {
1502
+ return onEvent("teclado:abriu", listener);
1503
+ },
1504
+ aoFecharTeclado: function (listener) {
1505
+ return onEvent("teclado:fechou", listener);
1506
+ },
1507
+ aoSacudirCelular: function (listener) {
1508
+ return onEvent("celular:sacudido", listener);
1509
+ },
1510
+ aoVirarCelularParaBaixo: function (listener) {
1511
+ return onEvent("celular:tela_para_baixo", listener);
1512
+ },
1513
+ aoAproximarObjeto: function (listener) {
1514
+ return onEvent("proximidade:perto", listener);
1515
+ },
1516
+ aoTirarPrint: function (listener) {
1517
+ return onEvent("print:tela", listener);
1518
+ },
1519
+ aoMudarOrientacao: function (listener) {
1520
+ return onEvent("orientacao:mudou", listener);
1521
+ },
1522
+ aoNFC: function (listener) {
1523
+ return onEvent("nfc:recebido", listener);
1524
+ },
1525
+ aoReceberNotificacao: function (listener) {
1526
+ return onEvent("notificacao:recebida", listener);
1527
+ },
1108
1528
  aoClicarNotificacao: function (listener) {
1109
1529
  if (typeof listener !== "function") {
1110
1530
  throw new TypeError("listener must be a function");
@@ -1137,6 +1557,7 @@ Object.assign(api, {
1137
1557
  cancelNotification: api.cancelarNotificacao,
1138
1558
  cancelNotificationLoop: api.cancelarLoopNotificacoes,
1139
1559
  vibrate: api.vibrar,
1560
+ loading: api.aguardar,
1140
1561
  manterTelaLigada: api.manterTelaAcordada,
1141
1562
  keepScreenAwake: api.manterTelaAcordada,
1142
1563
  keepScreenOn: api.manterTelaAcordada,
@@ -1163,6 +1584,46 @@ Object.assign(api, {
1163
1584
  readText: api.lerTextoCopiado,
1164
1585
  shareText: api.compartilharTexto,
1165
1586
  share: api.compartilhar,
1587
+ shareApp: api.compartilharApp,
1588
+ share_me: api.compartilharApp,
1589
+ scanBluetooth: api.procurarBT,
1590
+ procurarBluetooth: api.procurarBT,
1591
+ buscarBT: api.procurarBT,
1592
+ connectBluetooth: api.conectarBT,
1593
+ conectarBluetooth: api.conectarBT,
1594
+ sendBluetooth: api.enviarBT,
1595
+ onBluetoothConnect: api.aoConectarBT,
1596
+ onBluetoothConnected: api.aoConectarBT,
1597
+ onBluetoothData: api.aoReceberDadosBT,
1598
+ onBTData: api.aoReceberDadosBT,
1599
+ onBluetoothError: api.aoDarErroBT,
1600
+ onBTError: api.aoDarErroBT,
1601
+ scanWiFi: api.procurarWiFi,
1602
+ scanWifi: api.procurarWiFi,
1603
+ procurarWifi: api.procurarWiFi,
1604
+ connectWiFi: api.conectarWiFi,
1605
+ connectWifi: api.conectarWiFi,
1606
+ conectarWifi: api.conectarWiFi,
1607
+ sendWiFi: api.enviarWiFi,
1608
+ sendWifi: api.enviarWiFi,
1609
+ enviarWifi: api.enviarWiFi,
1610
+ onWiFiConnect: api.aoConectarWiFi,
1611
+ onWifiConnect: api.aoConectarWiFi,
1612
+ onWiFiConnected: api.aoConectarWiFi,
1613
+ onWifiConnected: api.aoConectarWiFi,
1614
+ onWiFiData: api.aoReceberDadosWiFi,
1615
+ onWifiData: api.aoReceberDadosWiFi,
1616
+ onWiFiError: api.aoDarErroWiFi,
1617
+ onWifiError: api.aoDarErroWiFi,
1618
+ recognizeText: api.ocr,
1619
+ textFromImage: api.ocr,
1620
+ speak: api.falar,
1621
+ textToSpeech: api.falar,
1622
+ stopSpeaking: api.pararFala,
1623
+ stopSpeech: api.pararFala,
1624
+ listen: api.ouvir,
1625
+ recognizeSpeech: api.ouvir,
1626
+ speechToText: api.ouvir,
1166
1627
  openUrl: api.abrirUrl,
1167
1628
  openExternalUrl: api.abrirUrlExterno,
1168
1629
  openOutsideApp: api.abrirForaDoApp,
@@ -1206,19 +1667,32 @@ Object.assign(api, {
1206
1667
  wallpaper: api.definirPapelParede,
1207
1668
  wallpaperInfo: api.infoPapelParede,
1208
1669
  openWallpaperSettings: api.abrirConfiguracaoPapelParede,
1670
+ captureScreen: api.capturarTela,
1671
+ takeScreenshot: api.capturarTela,
1672
+ screenshot: api.capturarTela,
1209
1673
  deviceInfo: api.infoDispositivo,
1210
1674
  networkInfo: api.infoRede,
1211
1675
  batteryInfo: api.infoBateria,
1212
1676
  memoryInfo: api.infoMemoria,
1213
1677
  storageInfo: api.infoArmazenamento,
1214
1678
  performanceInfo: api.infoDesempenho,
1679
+ currentVolume: api.volumeAtual,
1680
+ getVolume: api.volumeAtual,
1681
+ setVolume: api.definirVolume,
1682
+ increaseVolume: api.aumentarVolume,
1683
+ decreaseVolume: api.diminuirVolume,
1215
1684
  openAppsMemory: api.appsAbertos,
1216
1685
  openAppsInfo: api.infoAppsAbertos,
1217
1686
  getLocation: api.obterLocalizacao,
1218
1687
  watchLocation: api.acompanharLocalizacao,
1219
1688
  stopLocationWatch: api.pararLocalizacao,
1220
1689
  onLocationChange: api.aoMudarLocalizacao,
1690
+ measureSpeed: api.medirVelocidade,
1221
1691
  authenticateBiometric: api.autenticarBiometria,
1692
+ requestDeviceLock: api.solicitarBloqueio,
1693
+ requestBackgroundExecution: api.solicitarSegundoPlano,
1694
+ setAutoStartOnBoot: api.configurarInicioAutomatico,
1695
+ onDeviceBoot: api.aoLigarDispositivo,
1222
1696
  saveSecure: api.salvarSeguro,
1223
1697
  secureSet: api.salvarSeguro,
1224
1698
  readSecure: api.lerSeguro,
@@ -1238,15 +1712,51 @@ Object.assign(api, {
1238
1712
  requestOverlayPermission: api.solicitarPermissaoSobreposicao,
1239
1713
  openOverlaySettings: api.abrirConfiguracaoSobreposicao,
1240
1714
  startFloatingIcon: api.iniciarIconeFlutuante,
1715
+ configureFloatingIcon: api.configurarIconeFlutuante,
1716
+ setFloatingIconOpacity: api.definirOpacidadeIconeFlutuante,
1241
1717
  stopFloatingIcon: api.pararIconeFlutuante,
1718
+ minimizeApp: api.minimizarApp,
1719
+ closeApp: api.fecharApp,
1720
+ exitApp: api.fecharApp,
1242
1721
  getInitialNotification: api.obterNotificacaoInicial,
1243
1722
  getInitialLink: api.obterLinkInicial,
1723
+ getInitialShare: api.obterCompartilhamentoInicial,
1724
+ onShareReceived: api.aoReceberCompartilhamento,
1725
+ onReceiveShare: api.aoReceberCompartilhamento,
1244
1726
  onEvent: api.aoEvento,
1245
1727
  onMinimize: api.aoMinimizar,
1246
1728
  onAppResume: api.aoVoltarParaApp,
1247
1729
  onOpenLink: api.aoAbrirLink,
1248
1730
  onNetworkChange: api.aoMudarRede,
1249
1731
  onBatteryChange: api.aoMudarBateria,
1732
+ onUSBConnect: api.aoConectarUSB,
1733
+ onUsbConnect: api.aoConectarUSB,
1734
+ onUSBDisconnect: api.aoDesconectarUSB,
1735
+ onUsbDisconnect: api.aoDesconectarUSB,
1736
+ onHeadphoneConnect: api.aoConectarFone,
1737
+ onHeadphoneConnected: api.aoConectarFone,
1738
+ onHeadphoneDisconnect: api.aoDesconectarFone,
1739
+ onHeadphoneDisconnected: api.aoDesconectarFone,
1740
+ onVolumeChange: api.aoMudarVolume,
1741
+ onKeyboardOpen: api.aoAbrirTeclado,
1742
+ onKeyboardOpened: api.aoAbrirTeclado,
1743
+ onKeyboardClose: api.aoFecharTeclado,
1744
+ onKeyboardClosed: api.aoFecharTeclado,
1745
+ onPhoneShake: api.aoSacudirCelular,
1746
+ onShake: api.aoSacudirCelular,
1747
+ onPhoneFaceDown: api.aoVirarCelularParaBaixo,
1748
+ onFaceDown: api.aoVirarCelularParaBaixo,
1749
+ onProximityNear: api.aoAproximarObjeto,
1750
+ onObjectNear: api.aoAproximarObjeto,
1751
+ onScreenshot: api.aoTirarPrint,
1752
+ onScreenshotTaken: api.aoTirarPrint,
1753
+ onOrientationChange: api.aoMudarOrientacao,
1754
+ onNFC: api.aoNFC,
1755
+ onNfc: api.aoNFC,
1756
+ onNFCReceived: api.aoNFC,
1757
+ onNfcReceived: api.aoNFC,
1758
+ onNotificationReceived: api.aoReceberNotificacao,
1759
+ onReceiveNotification: api.aoReceberNotificacao,
1250
1760
  onNotificationClick: api.aoClicarNotificacao
1251
1761
  });
1252
1762
 
@@ -1348,6 +1858,12 @@ if (typeof window !== "undefined") {
1348
1858
  emitEvent("link:aberto", link);
1349
1859
  }
1350
1860
  });
1861
+ api.obterCompartilhamentoInicial().then(function (share) {
1862
+ if (share) {
1863
+ initialShare = share;
1864
+ emitEvent("compartilhamento:recebido", share);
1865
+ }
1866
+ });
1351
1867
  }, false);
1352
1868
  }
1353
1869