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,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
- return applyDownloadName(normalized, nameOrOptions);
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
- return applyDownloadName(normalized, nameOrOptions);
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
  },
@@ -999,9 +1308,47 @@
999
1308
  aoMudarLocalizacao: function (listener) {
1000
1309
  return onEvent("localizacao:mudou", listener);
1001
1310
  },
1311
+ medirVelocidade: function (callback, options) {
1312
+ var listener = function (local) {
1313
+ if (typeof callback !== "function") return;
1314
+ var ms = typeof local.velocidade === "number" ? local.velocidade : 0;
1315
+ var kmh = ms * 3.6;
1316
+ callback(kmh, local);
1317
+ };
1318
+ var stopEvent = api.aoMudarLocalizacao(listener);
1319
+ return api.acompanharLocalizacao(Object.assign({ altaPrecisao: true, intervaloMs: 2000 }, options || {}))
1320
+ .then(function (result) {
1321
+ var watchId = result && result.watchId;
1322
+ return function pararMedicao() {
1323
+ stopEvent();
1324
+ if (watchId) {
1325
+ return api.pararLocalizacao(watchId);
1326
+ }
1327
+ return Promise.resolve();
1328
+ };
1329
+ });
1330
+ },
1002
1331
  autenticarBiometria: function (options) {
1003
1332
  return call("authenticateBiometric", [options || {}]);
1004
1333
  },
1334
+ solicitarBloqueio: function (options) {
1335
+ return call("requestDeviceLock", [options || {}]);
1336
+ },
1337
+ solicitarSegundoPlano: function (options) {
1338
+ return call("requestBackgroundExecution", [options || {}]);
1339
+ },
1340
+ configurarInicioAutomatico: function (enable) {
1341
+ return call("setAutoStartOnBoot", [{ ativar: !!enable }]);
1342
+ },
1343
+ aoLigarDispositivo: function (callback) {
1344
+ if (typeof callback === "function") {
1345
+ call("getInitialLink").then(function(link) {
1346
+ if (link === "html2apk://boot") {
1347
+ callback();
1348
+ }
1349
+ });
1350
+ }
1351
+ },
1005
1352
  salvarSeguro: function (keyOrOptions, value, options) {
1006
1353
  return call("saveSecureItem", [secureItemOptions(keyOrOptions, value, options)]);
1007
1354
  },
@@ -1044,12 +1391,24 @@
1044
1391
  abrirConfiguracaoSobreposicao: function () {
1045
1392
  return call("openOverlaySettings");
1046
1393
  },
1047
- iniciarIconeFlutuante: function () {
1048
- return call("startFloatingIcon");
1394
+ iniciarIconeFlutuante: function (options) {
1395
+ return call("startFloatingIcon", [floatingIconOptions(options)]);
1049
1396
  },
1050
1397
  pararIconeFlutuante: function () {
1051
1398
  return call("stopFloatingIcon");
1052
1399
  },
1400
+ configurarIconeFlutuante: function (options) {
1401
+ return call("configureFloatingIcon", [floatingIconOptions(options)]);
1402
+ },
1403
+ definirOpacidadeIconeFlutuante: function (opacity) {
1404
+ return call("configureFloatingIcon", [floatingIconOptions(opacity)]);
1405
+ },
1406
+ minimizarApp: function () {
1407
+ return call("minimizeApp");
1408
+ },
1409
+ fecharApp: function () {
1410
+ return call("closeApp");
1411
+ },
1053
1412
  obterNotificacaoInicial: function () {
1054
1413
  return call("getInitialNotification").then(function (notification) {
1055
1414
  initialNotification = notification && notification.id ? notification : null;
@@ -1062,6 +1421,12 @@
1062
1421
  return initialLink;
1063
1422
  });
1064
1423
  },
1424
+ obterCompartilhamentoInicial: function () {
1425
+ return call("getInitialShare").then(function (share) {
1426
+ initialShare = share && (share.text || share.texto || share.uri || (share.items && share.items.length)) ? normalizeReceivedShare(share) : null;
1427
+ return initialShare;
1428
+ });
1429
+ },
1065
1430
  aoEvento: onEvent,
1066
1431
  aoMinimizar: function (listener) {
1067
1432
  return onEvent("app:background", listener);
@@ -1077,12 +1442,67 @@
1077
1442
  }
1078
1443
  return onEvent("link:aberto", listener);
1079
1444
  },
1445
+ aoReceberCompartilhamento: function (listener) {
1446
+ if (typeof listener !== "function") {
1447
+ throw new TypeError("listener must be a function");
1448
+ }
1449
+ if (initialShare) {
1450
+ setTimeout(function () {
1451
+ listener(normalizeReceivedShare(initialShare));
1452
+ }, 0);
1453
+ }
1454
+ return onEvent("compartilhamento:recebido", function (detail) {
1455
+ listener(normalizeReceivedShare(detail));
1456
+ });
1457
+ },
1080
1458
  aoMudarRede: function (listener) {
1081
1459
  return onEvent("rede:mudou", listener);
1082
1460
  },
1083
1461
  aoMudarBateria: function (listener) {
1084
1462
  return onEvent("bateria:mudou", listener);
1085
1463
  },
1464
+ aoConectarUSB: function (listener) {
1465
+ return onEvent("usb:conectado", listener);
1466
+ },
1467
+ aoDesconectarUSB: function (listener) {
1468
+ return onEvent("usb:desconectado", listener);
1469
+ },
1470
+ aoConectarFone: function (listener) {
1471
+ return onEvent("fone:conectado", listener);
1472
+ },
1473
+ aoDesconectarFone: function (listener) {
1474
+ return onEvent("fone:desconectado", listener);
1475
+ },
1476
+ aoMudarVolume: function (listener) {
1477
+ return onEvent("volume:mudou", listener);
1478
+ },
1479
+ aoAbrirTeclado: function (listener) {
1480
+ return onEvent("teclado:abriu", listener);
1481
+ },
1482
+ aoFecharTeclado: function (listener) {
1483
+ return onEvent("teclado:fechou", listener);
1484
+ },
1485
+ aoSacudirCelular: function (listener) {
1486
+ return onEvent("celular:sacudido", listener);
1487
+ },
1488
+ aoVirarCelularParaBaixo: function (listener) {
1489
+ return onEvent("celular:tela_para_baixo", listener);
1490
+ },
1491
+ aoAproximarObjeto: function (listener) {
1492
+ return onEvent("proximidade:perto", listener);
1493
+ },
1494
+ aoTirarPrint: function (listener) {
1495
+ return onEvent("print:tela", listener);
1496
+ },
1497
+ aoMudarOrientacao: function (listener) {
1498
+ return onEvent("orientacao:mudou", listener);
1499
+ },
1500
+ aoNFC: function (listener) {
1501
+ return onEvent("nfc:recebido", listener);
1502
+ },
1503
+ aoReceberNotificacao: function (listener) {
1504
+ return onEvent("notificacao:recebida", listener);
1505
+ },
1086
1506
  aoClicarNotificacao: function (listener) {
1087
1507
  if (typeof listener !== "function") {
1088
1508
  throw new TypeError("listener must be a function");
@@ -1107,6 +1527,7 @@
1107
1527
  cancelNotification: api.cancelarNotificacao,
1108
1528
  cancelNotificationLoop: api.cancelarLoopNotificacoes,
1109
1529
  vibrate: api.vibrar,
1530
+ loading: api.aguardar,
1110
1531
  manterTelaLigada: api.manterTelaAcordada,
1111
1532
  keepScreenAwake: api.manterTelaAcordada,
1112
1533
  keepScreenOn: api.manterTelaAcordada,
@@ -1133,6 +1554,46 @@
1133
1554
  readText: api.lerTextoCopiado,
1134
1555
  shareText: api.compartilharTexto,
1135
1556
  share: api.compartilhar,
1557
+ shareApp: api.compartilharApp,
1558
+ share_me: api.compartilharApp,
1559
+ scanBluetooth: api.procurarBT,
1560
+ procurarBluetooth: api.procurarBT,
1561
+ buscarBT: api.procurarBT,
1562
+ connectBluetooth: api.conectarBT,
1563
+ conectarBluetooth: api.conectarBT,
1564
+ sendBluetooth: api.enviarBT,
1565
+ onBluetoothConnect: api.aoConectarBT,
1566
+ onBluetoothConnected: api.aoConectarBT,
1567
+ onBluetoothData: api.aoReceberDadosBT,
1568
+ onBTData: api.aoReceberDadosBT,
1569
+ onBluetoothError: api.aoDarErroBT,
1570
+ onBTError: api.aoDarErroBT,
1571
+ scanWiFi: api.procurarWiFi,
1572
+ scanWifi: api.procurarWiFi,
1573
+ procurarWifi: api.procurarWiFi,
1574
+ connectWiFi: api.conectarWiFi,
1575
+ connectWifi: api.conectarWiFi,
1576
+ conectarWifi: api.conectarWiFi,
1577
+ sendWiFi: api.enviarWiFi,
1578
+ sendWifi: api.enviarWiFi,
1579
+ enviarWifi: api.enviarWiFi,
1580
+ onWiFiConnect: api.aoConectarWiFi,
1581
+ onWifiConnect: api.aoConectarWiFi,
1582
+ onWiFiConnected: api.aoConectarWiFi,
1583
+ onWifiConnected: api.aoConectarWiFi,
1584
+ onWiFiData: api.aoReceberDadosWiFi,
1585
+ onWifiData: api.aoReceberDadosWiFi,
1586
+ onWiFiError: api.aoDarErroWiFi,
1587
+ onWifiError: api.aoDarErroWiFi,
1588
+ recognizeText: api.ocr,
1589
+ textFromImage: api.ocr,
1590
+ speak: api.falar,
1591
+ textToSpeech: api.falar,
1592
+ stopSpeaking: api.pararFala,
1593
+ stopSpeech: api.pararFala,
1594
+ listen: api.ouvir,
1595
+ recognizeSpeech: api.ouvir,
1596
+ speechToText: api.ouvir,
1136
1597
  openUrl: api.abrirUrl,
1137
1598
  openExternalUrl: api.abrirUrl,
1138
1599
  abrirUrlExterno: api.abrirUrl,
@@ -1178,19 +1639,32 @@
1178
1639
  wallpaper: api.definirPapelParede,
1179
1640
  wallpaperInfo: api.infoPapelParede,
1180
1641
  openWallpaperSettings: api.abrirConfiguracaoPapelParede,
1642
+ captureScreen: api.capturarTela,
1643
+ takeScreenshot: api.capturarTela,
1644
+ screenshot: api.capturarTela,
1181
1645
  deviceInfo: api.infoDispositivo,
1182
1646
  networkInfo: api.infoRede,
1183
1647
  batteryInfo: api.infoBateria,
1184
1648
  memoryInfo: api.infoMemoria,
1185
1649
  storageInfo: api.infoArmazenamento,
1186
1650
  performanceInfo: api.infoDesempenho,
1651
+ currentVolume: api.volumeAtual,
1652
+ getVolume: api.volumeAtual,
1653
+ setVolume: api.definirVolume,
1654
+ increaseVolume: api.aumentarVolume,
1655
+ decreaseVolume: api.diminuirVolume,
1187
1656
  openAppsMemory: api.appsAbertos,
1188
1657
  openAppsInfo: api.infoAppsAbertos,
1189
1658
  getLocation: api.obterLocalizacao,
1190
1659
  watchLocation: api.acompanharLocalizacao,
1191
1660
  stopLocationWatch: api.pararLocalizacao,
1192
1661
  onLocationChange: api.aoMudarLocalizacao,
1662
+ measureSpeed: api.medirVelocidade,
1193
1663
  authenticateBiometric: api.autenticarBiometria,
1664
+ requestDeviceLock: api.solicitarBloqueio,
1665
+ requestBackgroundExecution: api.solicitarSegundoPlano,
1666
+ setAutoStartOnBoot: api.configurarInicioAutomatico,
1667
+ onDeviceBoot: api.aoLigarDispositivo,
1194
1668
  saveSecure: api.salvarSeguro,
1195
1669
  secureSet: api.salvarSeguro,
1196
1670
  readSecure: api.lerSeguro,
@@ -1210,15 +1684,51 @@
1210
1684
  requestOverlayPermission: api.solicitarPermissaoSobreposicao,
1211
1685
  openOverlaySettings: api.abrirConfiguracaoSobreposicao,
1212
1686
  startFloatingIcon: api.iniciarIconeFlutuante,
1687
+ configureFloatingIcon: api.configurarIconeFlutuante,
1688
+ setFloatingIconOpacity: api.definirOpacidadeIconeFlutuante,
1213
1689
  stopFloatingIcon: api.pararIconeFlutuante,
1690
+ minimizeApp: api.minimizarApp,
1691
+ closeApp: api.fecharApp,
1692
+ exitApp: api.fecharApp,
1214
1693
  getInitialNotification: api.obterNotificacaoInicial,
1215
1694
  getInitialLink: api.obterLinkInicial,
1695
+ getInitialShare: api.obterCompartilhamentoInicial,
1696
+ onShareReceived: api.aoReceberCompartilhamento,
1697
+ onReceiveShare: api.aoReceberCompartilhamento,
1216
1698
  onEvent: api.aoEvento,
1217
1699
  onMinimize: api.aoMinimizar,
1218
1700
  onAppResume: api.aoVoltarParaApp,
1219
1701
  onOpenLink: api.aoAbrirLink,
1220
1702
  onNetworkChange: api.aoMudarRede,
1221
1703
  onBatteryChange: api.aoMudarBateria,
1704
+ onUSBConnect: api.aoConectarUSB,
1705
+ onUsbConnect: api.aoConectarUSB,
1706
+ onUSBDisconnect: api.aoDesconectarUSB,
1707
+ onUsbDisconnect: api.aoDesconectarUSB,
1708
+ onHeadphoneConnect: api.aoConectarFone,
1709
+ onHeadphoneConnected: api.aoConectarFone,
1710
+ onHeadphoneDisconnect: api.aoDesconectarFone,
1711
+ onHeadphoneDisconnected: api.aoDesconectarFone,
1712
+ onVolumeChange: api.aoMudarVolume,
1713
+ onKeyboardOpen: api.aoAbrirTeclado,
1714
+ onKeyboardOpened: api.aoAbrirTeclado,
1715
+ onKeyboardClose: api.aoFecharTeclado,
1716
+ onKeyboardClosed: api.aoFecharTeclado,
1717
+ onPhoneShake: api.aoSacudirCelular,
1718
+ onShake: api.aoSacudirCelular,
1719
+ onPhoneFaceDown: api.aoVirarCelularParaBaixo,
1720
+ onFaceDown: api.aoVirarCelularParaBaixo,
1721
+ onProximityNear: api.aoAproximarObjeto,
1722
+ onObjectNear: api.aoAproximarObjeto,
1723
+ onScreenshot: api.aoTirarPrint,
1724
+ onScreenshotTaken: api.aoTirarPrint,
1725
+ onOrientationChange: api.aoMudarOrientacao,
1726
+ onNFC: api.aoNFC,
1727
+ onNfc: api.aoNFC,
1728
+ onNFCReceived: api.aoNFC,
1729
+ onNfcReceived: api.aoNFC,
1730
+ onNotificationReceived: api.aoReceberNotificacao,
1731
+ onReceiveNotification: api.aoReceberNotificacao,
1222
1732
  onNotificationClick: api.aoClicarNotificacao
1223
1733
  });
1224
1734
 
@@ -1257,6 +1767,12 @@
1257
1767
  emitEvent("link:aberto", link);
1258
1768
  }
1259
1769
  });
1770
+ api.obterCompartilhamentoInicial().then(function (share) {
1771
+ if (share) {
1772
+ initialShare = share;
1773
+ emitEvent("compartilhamento:recebido", share);
1774
+ }
1775
+ });
1260
1776
  }, false);
1261
1777
  }
1262
1778
  })();