Record screen: LIVE + SMS as square buttons bottom-left; toggle live on the fly
- move the SMS button out of the bottom panel into a left-hand square-button group (bottom-left, opposite the right control stack), add a LIVE toggle next to it - LIVE turns location sharing on/off right from the record screen, even if it was never enabled in the profile; warns if the token is still unset - LiveShare re-reads its config every tick so the toggle takes effect within ~10s
This commit is contained in:
parent
738c4e81a1
commit
c70cc1e4a4
3 changed files with 40 additions and 8 deletions
|
|
@ -1315,6 +1315,9 @@ select {
|
|||
zoom controls. Give them slots in the right-hand stack. */
|
||||
.rec-nogo-btn { right: 8px; bottom: 314px; }
|
||||
.rec-reroute-btn { right: 8px; bottom: 352px; }
|
||||
/* Left-hand group (bottom-left), opposite the right control stack: SMS + live toggle. */
|
||||
.rec-sms-btn { left: 8px; bottom: 48px; font-size: 11px; }
|
||||
.rec-live-btn { left: 8px; bottom: 86px; font-size: 10px; }
|
||||
/* Dark map: invert ONLY the tile layer (track, route, puck keep their colours).
|
||||
User-tuned filter on OSM standard tiles. Applies to every Leaflet map. */
|
||||
body.dark-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(1.5); }
|
||||
|
|
|
|||
|
|
@ -127,7 +127,12 @@ async function init() {
|
|||
// toggle so a session always sees the current choice (off unless the user turned it on).
|
||||
try {
|
||||
let liveOn = localStorage.getItem("baldav_live_on") === "1";
|
||||
let liveUrl = localStorage.getItem("baldav_live_url") || "https://4aiman.top/api/live/push";
|
||||
let liveUrl = localStorage.getItem("baldav_live_url") || "https://4aiman.top/api/trackme/push";
|
||||
// migrate the old /api/live/push endpoint to /api/trackme/push (renamed server-side)
|
||||
if (liveUrl.endsWith("/api/live/push")) {
|
||||
liveUrl = liveUrl.replace("/api/live/push", "/api/trackme/push");
|
||||
localStorage.setItem("baldav_live_url", liveUrl);
|
||||
}
|
||||
let liveToken = localStorage.getItem("baldav_live_token") || "";
|
||||
window.__TAURI__?.core?.invoke("set_live_config",
|
||||
{ enabled: liveOn, url: liveUrl, token: liveToken });
|
||||
|
|
@ -4767,7 +4772,6 @@ async function renderRecordingInline(container) {
|
|||
</div>
|
||||
<div class="rec-bottom">
|
||||
<button id="rec-hr-toggle" class="btn-secondary rec-hr-toggle${GPS.recording.hrOn ? " active" : ""}" title="Пульсометр вкл/выкл" aria-label="ЧСС"><svg viewBox="0 0 24 22" width="22" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20S3 14.5 3 8.3C3 5.6 5 4 7.2 4 9 4 10.6 5.1 12 7 13.4 5.1 15 4 16.8 4 19 4 21 5.6 21 8.3c0 1.3-.4 2.5-1 3.7"/><path d="M2 13h5l2-3 2.4 6 2-3H22"/></svg><span id="rec-hr-num" class="rec-hr-num"></span></button>
|
||||
${localStorage.getItem("baldav_sms_number") ? '<button id="rec-sms" class="btn-secondary" title="Отправить СМС с местоположением" aria-label="СМС">СМС</button>' : ''}
|
||||
<button id="rec-pause" class="btn-secondary">${GPS.recording.manualPaused ? "Продолжить" : "Пауза"}</button>
|
||||
<button id="rec-stop" class="btn-primary gps-rec recording">Стоп</button>
|
||||
</div>
|
||||
|
|
@ -4993,6 +4997,34 @@ async function renderRecordingInline(container) {
|
|||
};
|
||||
btnWrap.appendChild(followBtn);
|
||||
|
||||
// Left-side group (bottom-left, opposite the right controls): live-location toggle + SMS.
|
||||
// Live sharing can be switched on/off right here even if it was never set in the profile.
|
||||
let liveBtn = document.createElement("button");
|
||||
liveBtn.className = "rec-map-btn rec-live-btn";
|
||||
liveBtn.textContent = "LIVE";
|
||||
liveBtn.title = "Трансляция местоположения вкл/выкл";
|
||||
let liveOn = localStorage.getItem("baldav_live_on") === "1";
|
||||
liveBtn.classList.toggle("active", liveOn);
|
||||
liveBtn.onclick = async () => {
|
||||
liveOn = !liveOn;
|
||||
localStorage.setItem("baldav_live_on", liveOn ? "1" : "0");
|
||||
liveBtn.classList.toggle("active", liveOn);
|
||||
let url = localStorage.getItem("baldav_live_url") || "https://4aiman.top/api/trackme/push";
|
||||
let token = localStorage.getItem("baldav_live_token") || "";
|
||||
try { await window.__TAURI__.core.invoke("set_live_config", { enabled: liveOn, url, token }); }
|
||||
catch (e) { console.error("live toggle", e); }
|
||||
if (liveOn && !token) appAlert("Трансляция включена, но токен не задан в профиле - точки не уйдут, пока не впишешь токен.");
|
||||
};
|
||||
btnWrap.appendChild(liveBtn);
|
||||
|
||||
// SMS "я тут" button
|
||||
let smsBtn = document.createElement("button");
|
||||
smsBtn.className = "rec-map-btn rec-sms-btn";
|
||||
smsBtn.textContent = "СМС";
|
||||
smsBtn.title = "Отправить СМС с местоположением";
|
||||
smsBtn.onclick = () => sendLocationSms();
|
||||
btnWrap.appendChild(smsBtn);
|
||||
|
||||
// Roads toggle button. Roads are viewport-culled onto a canvas pane (only the segments in
|
||||
// view are drawn, redrawn on pan/zoom) so a huge road network doesn't jank the WebView.
|
||||
let roadsBtn = document.createElement("button");
|
||||
|
|
@ -5319,10 +5351,6 @@ async function renderRecordingInline(container) {
|
|||
}
|
||||
};
|
||||
|
||||
// SMS "я тут" button — only present when a contact number is configured
|
||||
let smsBtn = container.querySelector("#rec-sms");
|
||||
if (smsBtn) smsBtn.onclick = () => sendLocationSms();
|
||||
|
||||
// Stop button
|
||||
container.querySelector("#rec-stop").onclick = async () => {
|
||||
if (GPS.recording._compassCleanup) GPS.recording._compassCleanup();
|
||||
|
|
@ -8279,7 +8307,7 @@ function showProfileModal() {
|
|||
Делиться местоположением онлайн
|
||||
</label>
|
||||
<div style="font-size:11px;color:#9aa4ae;margin-top:2px">Пока включено, во время записи заезда телефон отправляет текущую точку на сервер раз в 10 секунд. Видно только тем, кому дан доступ, и только после входа. Выключается здесь же.</div>
|
||||
<label style="font-size:13px;display:block;margin-top:4px">Адрес приёма<input id="m-live-url" type="url" value="${(localStorage.getItem("baldav_live_url") || "https://4aiman.top/api/live/push").replace(/"/g, """)}" placeholder="https://4aiman.top/api/live/push" style="width:100%;margin-top:2px"></label>
|
||||
<label style="font-size:13px;display:block;margin-top:4px">Адрес приёма<input id="m-live-url" type="url" value="${((localStorage.getItem("baldav_live_url") || "https://4aiman.top/api/trackme/push").replace("/api/live/push", "/api/trackme/push")).replace(/"/g, """)}" placeholder="https://4aiman.top/api/trackme/push" style="width:100%;margin-top:2px"></label>
|
||||
<label style="font-size:13px;display:block;margin-top:4px">Токен<input id="m-live-token" type="password" value="${(localStorage.getItem("baldav_live_token") || "").replace(/"/g, """)}" placeholder="вставь токен" style="width:100%;margin-top:2px"></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ object LiveShare {
|
|||
// Latest fix from the GPS flush loop (every ~10s). Non-blocking: the network call runs on a
|
||||
// throwaway thread so it never stalls the main looper that drives GPS delivery.
|
||||
fun tick(ctx: Context, lat: Double, lon: Double, speed: Float, fixTs: Long) {
|
||||
if (!loaded) readCfg(ctx)
|
||||
// re-read every tick so toggling the record-screen LIVE button takes effect within ~10s
|
||||
readCfg(ctx)
|
||||
if (!enabled || url.isBlank() || token.isBlank()) return
|
||||
if (lat == 0.0 && lon == 0.0) return // no fix yet
|
||||
val now = System.currentTimeMillis()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue