From cd4aa9c7532d55c6bdb84b5892e05accf3ac338f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PontualTech=20/=20Karl=C3=A3o?= Date: Wed, 29 Apr 2026 07:30:56 -0300 Subject: [PATCH] =?UTF-8?q?feat(ble):=20bot=C3=A3o=20Copiar=20log=20+=20Li?= =?UTF-8?q?mpar=20+=20painel=20sempre=20aberto=20v1.10.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Karlão mandou log antigo achando que era novo (não dava pra distinguir log v1.10.4 de v1.10.5 sem ler timestamps). Adicionado botão 📋 Copiar log que copia texto puro pro clipboard com header 'Shivao vX.Y.Z · log diagnóstico' — fica óbvio qual versão está rodando. Mudanças: -
agora abre por padrão (open attribute) - Botão 📋 Copiar log (navigator.clipboard + fallback textarea) - Botão 🗑 Limpar pra zerar histórico antes de novo teste - Painel max-height 200→300px + font-family mono - Toast confirma cópia OK Co-Authored-By: Claude Opus 4.7 (1M context) --- app/diario-bordo.html | 30 +++++++++++++++++++++++++++--- mobile/android/app/build.gradle | 4 ++-- mobile/package.json | 2 +- server/public/index.html | 30 +++++++++++++++++++++++++++--- server/src/index.js | 2 +- 5 files changed, 58 insertions(+), 10 deletions(-) diff --git a/app/diario-bordo.html b/app/diario-bordo.html index 94ec173..d65063b 100644 --- a/app/diario-bordo.html +++ b/app/diario-bordo.html @@ -1977,9 +1977,13 @@ Marque zonas de proibição (alarme alto) ou atenção (aviso suave). Detecção
Verificando suporte...
-
+
📋 Diagnóstico (logs do pareamento) -
+
+ + +
+
Limitações: iOS Safari não suporta Web Bluetooth. APK Android usa plugin nativo. BMS proprietários (Victron, JBD) podem aparecer mas não expor Battery Service padrão.
@@ -5790,6 +5794,26 @@ async function ensureBleNativeReady(){ _bleNativeInitialized=true; } +// Copia log diagnóstico pro clipboard +async function copyDiagLog(){ + const el=document.getElementById('bt-diag'); + if(!el){toast('Log vazio');return} + // Extrai texto puro (innerText preserva quebras de linha) + const txt=`Shivao v${APP_VERSION} · log diagnóstico\n\n`+(el.innerText||el.textContent||'').trim(); + try{ + if(navigator.clipboard?.writeText){ + await navigator.clipboard.writeText(txt); + toast('✓ Log copiado · cole no chat'); + }else{ + // Fallback: textarea hack + const ta=document.createElement('textarea'); + ta.value=txt;document.body.appendChild(ta);ta.select(); + document.execCommand('copy');ta.remove(); + toast('✓ Log copiado'); + } + }catch(e){toast('Erro ao copiar: '+e.message)} +} + // Diagnóstico visível: mostra cada passo no card BLE function setBleDiag(msg,type){ const el=document.getElementById('bt-diag'); @@ -6265,7 +6289,7 @@ async function removeBluetoothDevice(id){ renderBluetoothCard(); } -const APP_VERSION='1.10.5'; +const APP_VERSION='1.10.6'; function renderBluetoothCard(){ const el=document.getElementById('bt-list'); const supportEl=document.getElementById('bt-support'); diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle index 9783657..4df6605 100644 --- a/mobile/android/app/build.gradle +++ b/mobile/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "br.com.pontualtech.shivao" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 21 - versionName "1.10.5" + versionCode 22 + versionName "1.10.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/mobile/package.json b/mobile/package.json index 911102d..82c8e32 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -1,6 +1,6 @@ { "name": "shivao-mobile", - "version": "1.10.5", + "version": "1.10.6", "description": "Shivao app nativo (Capacitor wrapper Android/iOS)", "main": "index.js", "type": "module", diff --git a/server/public/index.html b/server/public/index.html index 94ec173..d65063b 100644 --- a/server/public/index.html +++ b/server/public/index.html @@ -1977,9 +1977,13 @@ Marque zonas de proibição (alarme alto) ou atenção (aviso suave). Detecção
Verificando suporte...
-
+
📋 Diagnóstico (logs do pareamento) -
+
+ + +
+
Limitações: iOS Safari não suporta Web Bluetooth. APK Android usa plugin nativo. BMS proprietários (Victron, JBD) podem aparecer mas não expor Battery Service padrão.
@@ -5790,6 +5794,26 @@ async function ensureBleNativeReady(){ _bleNativeInitialized=true; } +// Copia log diagnóstico pro clipboard +async function copyDiagLog(){ + const el=document.getElementById('bt-diag'); + if(!el){toast('Log vazio');return} + // Extrai texto puro (innerText preserva quebras de linha) + const txt=`Shivao v${APP_VERSION} · log diagnóstico\n\n`+(el.innerText||el.textContent||'').trim(); + try{ + if(navigator.clipboard?.writeText){ + await navigator.clipboard.writeText(txt); + toast('✓ Log copiado · cole no chat'); + }else{ + // Fallback: textarea hack + const ta=document.createElement('textarea'); + ta.value=txt;document.body.appendChild(ta);ta.select(); + document.execCommand('copy');ta.remove(); + toast('✓ Log copiado'); + } + }catch(e){toast('Erro ao copiar: '+e.message)} +} + // Diagnóstico visível: mostra cada passo no card BLE function setBleDiag(msg,type){ const el=document.getElementById('bt-diag'); @@ -6265,7 +6289,7 @@ async function removeBluetoothDevice(id){ renderBluetoothCard(); } -const APP_VERSION='1.10.5'; +const APP_VERSION='1.10.6'; function renderBluetoothCard(){ const el=document.getElementById('bt-list'); const supportEl=document.getElementById('bt-support'); diff --git a/server/src/index.js b/server/src/index.js index 4ef6f1a..7e2d730 100644 --- a/server/src/index.js +++ b/server/src/index.js @@ -347,7 +347,7 @@ app.get('/.well-known/assetlinks.json', (req, res) => { }); // Atalho: /apk redireciona pra última APK release no Forgejo -const LATEST_APK_URL = 'https://git.pontualtech.work/karlao/shivao-projeto/releases/download/v1.10.5/Shivao-v1.10.5.apk'; +const LATEST_APK_URL = 'https://git.pontualtech.work/karlao/shivao-projeto/releases/download/v1.10.6/Shivao-v1.10.6.apk'; app.get('/apk', (req, res) => res.redirect(302, LATEST_APK_URL)); // Página A4 imprimível com QR Code + instruções (cola no barco/marina)