Rendi affidabile pausa con slate e conferma i controlli laterali.
Evita buchi HLS/YouTube in pausa (path slate ricreata, reload player, no patch recording inutili) e richiede conferma su tasti laterali app/regia. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,6 +52,18 @@ module Public
|
||||
muteError: t("regia.js.mute_error"),
|
||||
closeError: t("regia.js.close_error"),
|
||||
closeConfirm: t("regia.js.close_confirm"),
|
||||
pauseConfirmTitle: t("regia.js.pause_confirm_title"),
|
||||
pauseConfirmBody: t("regia.js.pause_confirm_body"),
|
||||
resumeConfirmTitle: t("regia.js.resume_confirm_title"),
|
||||
resumeConfirmBody: t("regia.js.resume_confirm_body"),
|
||||
muteConfirmTitle: t("regia.js.mute_confirm_title"),
|
||||
muteConfirmBody: t("regia.js.mute_confirm_body"),
|
||||
unmuteConfirmTitle: t("regia.js.unmute_confirm_title"),
|
||||
unmuteConfirmBody: t("regia.js.unmute_confirm_body"),
|
||||
advancePeriodTitle: t("regia.js.advance_period_title"),
|
||||
advancePeriodBody: t("regia.js.advance_period_body"),
|
||||
confirmAction: t("regia.modal.confirm_action"),
|
||||
stopConfirmTitle: t("regia.js.stop_confirm_title"),
|
||||
linkUnavailable: t("regia.js.link_unavailable"),
|
||||
linkCopied: t("regia.js.link_copied"),
|
||||
copyPrompt: t("regia.js.copy_prompt"),
|
||||
|
||||
@@ -74,7 +74,48 @@ module Mediamtx
|
||||
set_always_available(session, enabled: true)
|
||||
end
|
||||
|
||||
# Slate alwaysAvailable: copertina sullo stesso path quando il telefono è offline.
|
||||
# Garantisce path config + slate: se MediaMTX ha perso la config (restart → all_others),
|
||||
# in pausa non resterebbe nessuno stream verso HLS/YouTube.
|
||||
def ensure_path_with_slate!(session)
|
||||
path = session.mediamtx_path_name
|
||||
response = @conn.get("/v3/config/paths/get/#{CGI.escape(path)}")
|
||||
missing = response.status == 404 ||
|
||||
(response.body.is_a?(Hash) && response.body["error"].present?)
|
||||
|
||||
if missing
|
||||
forget_always_available(path)
|
||||
begin
|
||||
create_path(session)
|
||||
rescue Error
|
||||
# Path creato in parallelo o già presente: forza solo la slate.
|
||||
forget_always_available(path)
|
||||
set_always_available(session, enabled: true)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
conf = response.body.is_a?(Hash) ? response.body : {}
|
||||
desired = slate_file_path(session)
|
||||
if conf["alwaysAvailable"] == true && conf["alwaysAvailableFile"].to_s == desired.to_s
|
||||
remember_always_available(path, enabled: true)
|
||||
return true
|
||||
end
|
||||
|
||||
forget_always_available(path)
|
||||
set_always_available(session, enabled: true)
|
||||
end
|
||||
|
||||
# Spegnere record solo se attivo: ogni PATCH path ricarica MediaMTX e distrugge i muxer HLS.
|
||||
def disable_recording_if_active!(session)
|
||||
path = session.mediamtx_path_name
|
||||
response = @conn.get("/v3/config/paths/get/#{CGI.escape(path)}")
|
||||
return true unless response.success?
|
||||
return true unless response.body.is_a?(Hash) && response.body["record"] == true
|
||||
|
||||
set_path_recording(session, enabled: false)
|
||||
end
|
||||
|
||||
# Slate alwaysAvailable: copertina sullo stesso path quando il telefono è offline.
|
||||
# Resta accesa anche con publisher in onda (MediaMTX usa il publisher se presente).
|
||||
def set_always_available(session, enabled:)
|
||||
path = session.mediamtx_path_name
|
||||
|
||||
@@ -79,9 +79,8 @@ module Mediamtx
|
||||
end
|
||||
|
||||
def restore_slate_path!(session)
|
||||
return if session.platform == "matchlivetv"
|
||||
|
||||
Client.for_session(session).set_always_available(session, enabled: true)
|
||||
# Anche su matchlivetv: dopo restart MediaMTX la path può cadere su all_others senza slate.
|
||||
Client.for_session(session).ensure_path_with_slate!(session)
|
||||
rescue Client::Error => e
|
||||
Rails.logger.warn("[PublisherSync] enable slate session=#{session.id}: #{e.message}")
|
||||
end
|
||||
@@ -146,6 +145,14 @@ module Mediamtx
|
||||
nil
|
||||
end
|
||||
|
||||
def self.remember_recording_off!(session_id)
|
||||
redis = Redis.new(url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0"))
|
||||
redis.set("mediamtx:recording:#{session_id}", "0", ex: 48.hours.to_i)
|
||||
redis.set(format("mediamtx:recording:patched_at:%s", session_id), Time.current.to_i, ex: 48.hours.to_i)
|
||||
rescue Redis::BaseError
|
||||
nil
|
||||
end
|
||||
|
||||
def recording_state_key(session_id)
|
||||
"mediamtx:recording:#{session_id}"
|
||||
end
|
||||
|
||||
@@ -7,11 +7,13 @@ module Sessions
|
||||
def call
|
||||
cancel_timeout_job
|
||||
@session.pause! if @session.may_pause?
|
||||
Mediamtx::PublisherSync.forget_recording_state!(@session.id)
|
||||
begin
|
||||
mtx = Mediamtx::Client.for_session(@session)
|
||||
mtx.set_path_recording(@session, enabled: false)
|
||||
mtx.set_always_available(@session, enabled: true)
|
||||
# Ricrea/riallinea slate prima di spegnere l'RTMP del telefono.
|
||||
mtx.ensure_path_with_slate!(@session)
|
||||
# PATCH recording solo se era attivo (evita kill muxer HLS a ogni pausa).
|
||||
mtx.disable_recording_if_active!(@session)
|
||||
Mediamtx::PublisherSync.remember_recording_off!(@session.id)
|
||||
rescue Mediamtx::Client::Error => e
|
||||
Rails.logger.warn("[Sessions::Pause] MediaMTX: #{e.message}")
|
||||
end
|
||||
|
||||
@@ -4,10 +4,15 @@ module Streams
|
||||
ENV.fetch("MEDIAMTX_SLATES_CUSTOM_DIR", "/slates/custom")
|
||||
end
|
||||
|
||||
# ActiveStorage checksum is base64 e può contenere "/", "+", "=" — non usabile come path.
|
||||
def self.safe_digest(checksum)
|
||||
checksum.to_s.tr("+/", "-_").delete("=")
|
||||
end
|
||||
|
||||
def self.filename_for(record)
|
||||
return nil unless record.cover_slate.attached?
|
||||
|
||||
digest = record.cover_slate.blob.checksum
|
||||
digest = safe_digest(record.cover_slate.blob.checksum)
|
||||
prefix = record.class.name.underscore
|
||||
"#{prefix}-#{record.id}-#{digest}.mp4"
|
||||
end
|
||||
|
||||
@@ -31,8 +31,11 @@ module Streams
|
||||
end
|
||||
|
||||
host_path = result.slate_local_path
|
||||
filename = File.basename(host_path)
|
||||
mediamtx_path = "#{CoverSlatePaths.slates_custom_root}/#{filename}"
|
||||
filename = CoverSlatePaths.filename_for(result.record)
|
||||
raise Error, "slate filename missing" if filename.blank?
|
||||
|
||||
# Path completo (non File.basename): il checksum AS può contenere "/" e spezzerebbe il path.
|
||||
mediamtx_path = CoverSlatePaths.expected_path(result.record)
|
||||
|
||||
if cloud_node?
|
||||
push_to_agent!(filename, result.record, host_path)
|
||||
|
||||
@@ -219,7 +219,8 @@
|
||||
}
|
||||
|
||||
function onEnterPause() {
|
||||
nudgePlayback();
|
||||
// Camera → slate cambia risoluzione/codec: senza reload HLS.js resta spesso bloccato.
|
||||
hardReloadPlayer();
|
||||
}
|
||||
|
||||
function hardReloadPlayer() {
|
||||
|
||||
@@ -165,4 +165,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/regia.js?v=19"></script>
|
||||
<script src="/regia.js?v=20"></script>
|
||||
|
||||
@@ -21,7 +21,7 @@ module MatchLiveTv
|
||||
end
|
||||
|
||||
def hls_public_url
|
||||
ENV.fetch("HLS_PUBLIC_URL", "http://localhost:8888")
|
||||
ENV.fetch("HLS_PUBLIC_URL") { "#{app_public_url.chomp('/')}/hls" }
|
||||
end
|
||||
|
||||
def mediamtx_hls_url
|
||||
|
||||
@@ -57,7 +57,7 @@ de:
|
||||
username_label: Benutzername
|
||||
password_label: Passwort
|
||||
submit: Anmelden
|
||||
initial_credentials_html: "Anfangs-Zugangsdaten: <code>admin</code> / <code>admin</code>. Ändere das Passwort nach der ersten Anmeldung."
|
||||
initial_credentials_html: "Anfangs-Zugangsdaten: <code>admin</code> / <code>AdminPass123</code>. Ändere das Passwort nach der ersten Anmeldung."
|
||||
passwords:
|
||||
edit:
|
||||
title: Passwort ändern
|
||||
|
||||
@@ -57,7 +57,7 @@ en:
|
||||
username_label: Username
|
||||
password_label: Password
|
||||
submit: Log in
|
||||
initial_credentials_html: "Initial credentials: <code>admin</code> / <code>admin</code>. Change the password after the first login."
|
||||
initial_credentials_html: "Initial credentials: <code>admin</code> / <code>AdminPass123</code>. Change the password after the first login."
|
||||
passwords:
|
||||
edit:
|
||||
title: Change password
|
||||
|
||||
@@ -57,7 +57,7 @@ es:
|
||||
username_label: Usuario
|
||||
password_label: Contraseña
|
||||
submit: Acceder
|
||||
initial_credentials_html: "Credenciales iniciales: <code>admin</code> / <code>admin</code>. Cambia la contraseña después del primer acceso."
|
||||
initial_credentials_html: "Credenciales iniciales: <code>admin</code> / <code>AdminPass123</code>. Cambia la contraseña después del primer acceso."
|
||||
passwords:
|
||||
edit:
|
||||
title: Cambiar contraseña
|
||||
|
||||
@@ -57,7 +57,7 @@ fr:
|
||||
username_label: Nom d'utilisateur
|
||||
password_label: Mot de passe
|
||||
submit: Se connecter
|
||||
initial_credentials_html: "Identifiants initiaux : <code>admin</code> / <code>admin</code>. Changez le mot de passe après la première connexion."
|
||||
initial_credentials_html: "Identifiants initiaux : <code>admin</code> / <code>AdminPass123</code>. Changez le mot de passe après la première connexion."
|
||||
passwords:
|
||||
edit:
|
||||
title: Changer le mot de passe
|
||||
|
||||
@@ -61,7 +61,7 @@ it:
|
||||
username_label: Username
|
||||
password_label: Password
|
||||
submit: Accedi
|
||||
initial_credentials_html: "Credenziali iniziali: <code>admin</code> / <code>admin</code>. Cambia la password dopo il primo accesso."
|
||||
initial_credentials_html: "Credenziali iniziali: <code>admin</code> / <code>AdminPass123</code>. Cambia la password dopo il primo accesso."
|
||||
passwords:
|
||||
edit:
|
||||
title: Cambia password
|
||||
|
||||
@@ -491,6 +491,7 @@ de:
|
||||
modal:
|
||||
set_won_title: Satz gewonnen
|
||||
confirm: Satz beenden
|
||||
confirm_action: Bestätigen
|
||||
cancel: Abbrechen
|
||||
board:
|
||||
next_period: Nächstes Viertel
|
||||
@@ -530,6 +531,17 @@ de:
|
||||
mute_error: Fehler beim Stummschalten
|
||||
close_error: Fehler beim Beenden
|
||||
close_confirm: Übertragung endgültig beenden?
|
||||
pause_confirm_title: Livestream pausieren?
|
||||
pause_confirm_body: Das Cover bleibt on air, bis du fortsetzt.
|
||||
resume_confirm_title: Livestream fortsetzen?
|
||||
resume_confirm_body: Die Kamera geht wieder on air statt des Covers.
|
||||
mute_confirm_title: Audio stummschalten?
|
||||
mute_confirm_body: Das Mikrofon wird nicht mehr an den Stream gesendet, bis du es wieder aktivierst.
|
||||
unmute_confirm_title: Audio wieder aktivieren?
|
||||
unmute_confirm_body: Das Mikrofon ist wieder aktiv im Stream.
|
||||
advance_period_title: Zum nächsten Abschnitt wechseln?
|
||||
advance_period_body: Die Anzeigetafel wechselt zum nächsten Abschnitt und der aktuelle Stand wird gespeichert.
|
||||
stop_confirm_title: Livestream beenden?
|
||||
link_unavailable: Link nicht verfügbar
|
||||
link_copied: Link kopiert
|
||||
copy_prompt: "Link kopieren:"
|
||||
|
||||
@@ -494,6 +494,7 @@ en:
|
||||
modal:
|
||||
set_won_title: Set won
|
||||
confirm: Close set
|
||||
confirm_action: Confirm
|
||||
cancel: Cancel
|
||||
board:
|
||||
next_period: Next quarter
|
||||
@@ -533,6 +534,17 @@ en:
|
||||
mute_error: Error muting audio
|
||||
close_error: Error closing
|
||||
close_confirm: Permanently close the live stream?
|
||||
pause_confirm_title: Pause the live stream?
|
||||
pause_confirm_body: The cover slate will stay on air until you resume.
|
||||
resume_confirm_title: Resume the live stream?
|
||||
resume_confirm_body: The camera will go back on air instead of the cover slate.
|
||||
mute_confirm_title: Mute audio?
|
||||
mute_confirm_body: The microphone will not be sent to the stream until you unmute.
|
||||
unmute_confirm_title: Unmute audio?
|
||||
unmute_confirm_body: The microphone will be active on the stream again.
|
||||
advance_period_title: Advance to the next period?
|
||||
advance_period_body: The scoreboard will move to the next period and the current period score will be saved.
|
||||
stop_confirm_title: End the live stream?
|
||||
link_unavailable: Link not available
|
||||
link_copied: Link copied
|
||||
copy_prompt: "Copy the link:"
|
||||
|
||||
@@ -491,6 +491,7 @@ es:
|
||||
modal:
|
||||
set_won_title: Set ganado
|
||||
confirm: Cerrar set
|
||||
confirm_action: Confirmar
|
||||
cancel: Cancelar
|
||||
board:
|
||||
next_period: Siguiente cuarto
|
||||
@@ -530,6 +531,17 @@ es:
|
||||
mute_error: Error al silenciar el audio
|
||||
close_error: Error al cerrar
|
||||
close_confirm: "¿Cerrar definitivamente la retransmisión?"
|
||||
pause_confirm_title: "¿Pausar el directo?"
|
||||
pause_confirm_body: La portada seguirá en antena hasta que lo reanudes.
|
||||
resume_confirm_title: "¿Reanudar el directo?"
|
||||
resume_confirm_body: La cámara volverá a antena en lugar de la portada.
|
||||
mute_confirm_title: "¿Silenciar el audio?"
|
||||
mute_confirm_body: El micrófono no se enviará al stream hasta que lo reactives.
|
||||
unmute_confirm_title: "¿Reactivar el audio?"
|
||||
unmute_confirm_body: El micrófono volverá a estar activo en el stream.
|
||||
advance_period_title: "¿Pasar al periodo siguiente?"
|
||||
advance_period_body: El marcador pasará al siguiente periodo y se guardará el marcador del periodo actual.
|
||||
stop_confirm_title: "¿Terminar el directo?"
|
||||
link_unavailable: Enlace no disponible
|
||||
link_copied: Enlace copiado
|
||||
copy_prompt: "Copia el enlace:"
|
||||
|
||||
@@ -491,6 +491,7 @@ fr:
|
||||
modal:
|
||||
set_won_title: Set gagné
|
||||
confirm: Terminer le set
|
||||
confirm_action: Confirmer
|
||||
cancel: Annuler
|
||||
board:
|
||||
next_period: Quart-temps suivant
|
||||
@@ -530,6 +531,17 @@ fr:
|
||||
mute_error: Erreur lors de la coupure audio
|
||||
close_error: Erreur de clôture
|
||||
close_confirm: Clôturer définitivement le direct ?
|
||||
pause_confirm_title: Mettre le direct en pause ?
|
||||
pause_confirm_body: La couverture restera à l'antenne jusqu'à la reprise.
|
||||
resume_confirm_title: Reprendre le direct ?
|
||||
resume_confirm_body: La caméra reviendra à l'antenne à la place de la couverture.
|
||||
mute_confirm_title: Couper l'audio ?
|
||||
mute_confirm_body: Le micro ne sera plus envoyé au flux tant que vous ne le réactivez pas.
|
||||
unmute_confirm_title: Réactiver l'audio ?
|
||||
unmute_confirm_body: Le micro sera à nouveau actif sur le flux.
|
||||
advance_period_title: Passer à la période suivante ?
|
||||
advance_period_body: Le tableau passera à la période suivante et le score de la période en cours sera enregistré.
|
||||
stop_confirm_title: Terminer le direct ?
|
||||
link_unavailable: Lien non disponible
|
||||
link_copied: Lien copié
|
||||
copy_prompt: "Copiez le lien :"
|
||||
|
||||
@@ -515,6 +515,7 @@ it:
|
||||
modal:
|
||||
set_won_title: Set vinto
|
||||
confirm: Chiudi set
|
||||
confirm_action: Conferma
|
||||
cancel: Annulla
|
||||
board:
|
||||
next_period: Prossimo quarto
|
||||
@@ -554,6 +555,17 @@ it:
|
||||
mute_error: Errore silenziamento audio
|
||||
close_error: Errore chiusura
|
||||
close_confirm: Chiudere definitivamente la diretta?
|
||||
pause_confirm_title: Mettere in pausa?
|
||||
pause_confirm_body: La diretta passerà alla copertina finché non la riprendi.
|
||||
resume_confirm_title: Riprendere la diretta?
|
||||
resume_confirm_body: La telecamera tornerà in onda al posto della copertina.
|
||||
mute_confirm_title: Silenziare l'audio?
|
||||
mute_confirm_body: Il microfono non verrà inviato allo stream finché non lo riattivi.
|
||||
unmute_confirm_title: Riattivare l'audio?
|
||||
unmute_confirm_body: Il microfono tornerà attivo sullo stream.
|
||||
advance_period_title: Passare al periodo successivo?
|
||||
advance_period_body: Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.
|
||||
stop_confirm_title: Terminare la diretta?
|
||||
link_unavailable: Link non disponibile
|
||||
link_copied: Link copiato
|
||||
copy_prompt: "Copia il link:"
|
||||
|
||||
+72
-13
@@ -33,6 +33,18 @@
|
||||
muteError: "Errore silenziamento audio",
|
||||
closeError: "Errore chiusura",
|
||||
closeConfirm: "Chiudere definitivamente la diretta?",
|
||||
pauseConfirmTitle: "Mettere in pausa?",
|
||||
pauseConfirmBody: "La diretta passerà alla copertina finché non la riprendi.",
|
||||
resumeConfirmTitle: "Riprendere la diretta?",
|
||||
resumeConfirmBody: "La telecamera tornerà in onda al posto della copertina.",
|
||||
muteConfirmTitle: "Silenziare l'audio?",
|
||||
muteConfirmBody: "Il microfono non verrà inviato allo stream finché non lo riattivi.",
|
||||
unmuteConfirmTitle: "Riattivare l'audio?",
|
||||
unmuteConfirmBody: "Il microfono tornerà attivo sullo stream.",
|
||||
advancePeriodTitle: "Passare al periodo successivo?",
|
||||
advancePeriodBody: "Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.",
|
||||
confirmAction: "Conferma",
|
||||
stopConfirmTitle: "Terminare la diretta?",
|
||||
linkUnavailable: "Link non disponibile",
|
||||
linkCopied: "Link copiato",
|
||||
copyPrompt: "Copia il link:",
|
||||
@@ -389,13 +401,18 @@
|
||||
if (cfg.board === "volley" || cfg.board === "racket") {
|
||||
if (data.set_won && action !== "close_set") {
|
||||
const winner = data.winner === "home" ? cfg.homeName : cfg.awayName;
|
||||
openModal(I18N.setWonTitle, fillTemplate(I18N.setWonBodyTemplate, { winner }), () => postScore("close_set"));
|
||||
openModal(I18N.setWonTitle, fillTemplate(I18N.setWonBodyTemplate, { winner }), () => postScore("close_set"), I18N.closeSetTitle);
|
||||
}
|
||||
}
|
||||
if (data.match_won) {
|
||||
const winner = data.winner === "home" ? cfg.homeName : cfg.awayName;
|
||||
openModal(I18N.matchWonTitle, fillTemplate(I18N.matchWonBodyTemplate, { winner }), () => stopStream());
|
||||
}
|
||||
if (data.match_won) {
|
||||
const winner = data.winner === "home" ? cfg.homeName : cfg.awayName;
|
||||
openModal(
|
||||
I18N.matchWonTitle,
|
||||
fillTemplate(I18N.matchWonBodyTemplate, { winner }),
|
||||
() => performStopStream(),
|
||||
I18N.confirmAction
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (prevHome != null && els.homePoints) els.homePoints.textContent = prevHome;
|
||||
const awayEl = document.getElementById("away-points");
|
||||
@@ -406,9 +423,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
function openModal(title, body, onConfirm) {
|
||||
function openModal(title, body, onConfirm, confirmLabel) {
|
||||
els.modalTitle.textContent = title;
|
||||
els.modalBody.textContent = body;
|
||||
if (els.modalConfirm) {
|
||||
els.modalConfirm.textContent = confirmLabel || I18N.confirmAction;
|
||||
}
|
||||
els.modal.classList.add("open");
|
||||
pendingAction = onConfirm;
|
||||
}
|
||||
@@ -440,7 +460,9 @@
|
||||
btn.addEventListener("click", () => {
|
||||
const action = btn.dataset.action;
|
||||
if (action === "close_set") {
|
||||
openModal(I18N.closeSetTitle, I18N.closeSetConfirm, () => postScore("close_set"));
|
||||
openModal(I18N.closeSetTitle, I18N.closeSetConfirm, () => postScore("close_set"), I18N.closeSetTitle);
|
||||
} else if (action === "advance_period") {
|
||||
openModal(I18N.advancePeriodTitle, I18N.advancePeriodBody, () => handleAction("advance_period"));
|
||||
} else {
|
||||
handleAction(action);
|
||||
}
|
||||
@@ -689,9 +711,8 @@
|
||||
toast(audioMuted ? I18N.muted : I18N.unmuted);
|
||||
}
|
||||
|
||||
async function stopStream() {
|
||||
const ok = confirm(I18N.closeConfirm);
|
||||
if (!ok) return null;
|
||||
async function performStopStream() {
|
||||
if (!cfg.stopUrl) return null;
|
||||
const res = await fetch(cfg.stopUrl, { method: "POST", headers: { Accept: "application/json" } });
|
||||
if (!res.ok) throw new Error(I18N.closeError);
|
||||
const data = await res.json();
|
||||
@@ -701,9 +722,47 @@
|
||||
return data;
|
||||
}
|
||||
|
||||
els.btnPause?.addEventListener("click", () => togglePauseStream().catch((e) => toast(e.message)));
|
||||
els.btnAudioMute?.addEventListener("click", () => toggleMuteAudio().catch((e) => toast(e.message)));
|
||||
document.getElementById("btn-stop")?.addEventListener("click", () => stopStream().catch((e) => toast(e.message)));
|
||||
function requestStopStream() {
|
||||
openModal(I18N.stopConfirmTitle, I18N.closeConfirm, () => performStopStream(), I18N.confirmAction);
|
||||
}
|
||||
|
||||
function requestPauseToggle() {
|
||||
if (streamPaused) {
|
||||
openModal(I18N.resumeConfirmTitle, I18N.resumeConfirmBody, async () => {
|
||||
await togglePauseStream();
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
openModal(I18N.pauseConfirmTitle, I18N.pauseConfirmBody, async () => {
|
||||
await togglePauseStream();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function requestMuteToggle() {
|
||||
if (audioMuted) {
|
||||
openModal(I18N.unmuteConfirmTitle, I18N.unmuteConfirmBody, async () => {
|
||||
await toggleMuteAudio();
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
openModal(I18N.muteConfirmTitle, I18N.muteConfirmBody, async () => {
|
||||
await toggleMuteAudio();
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function stopStream() {
|
||||
// Compatibilità: conferma via modal (non window.confirm).
|
||||
requestStopStream();
|
||||
return null;
|
||||
}
|
||||
|
||||
els.btnPause?.addEventListener("click", () => requestPauseToggle());
|
||||
els.btnAudioMute?.addEventListener("click", () => requestMuteToggle());
|
||||
document.getElementById("btn-stop")?.addEventListener("click", () => requestStopStream());
|
||||
|
||||
let minQualityBusy = false;
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ RSpec.describe Mediamtx::PublisherSync do
|
||||
allow(Mediamtx::PublisherOnline).to receive(:active?).and_return(true)
|
||||
allow_any_instance_of(described_class).to receive(:redis).and_return(redis)
|
||||
allow(client).to receive(:set_path_recording)
|
||||
allow(client).to receive(:ensure_path_with_slate!)
|
||||
allow(client).to receive(:set_always_available)
|
||||
end
|
||||
|
||||
it "abilita la registrazione quando il publisher è online e la sessione è live" do
|
||||
|
||||
@@ -43,7 +43,7 @@ RSpec.describe Streams::SlateDistributor do
|
||||
|
||||
it "usa path custom su nodo home quando la slate è su disco" do
|
||||
attach_ready_cover(club)
|
||||
custom = "/slates/custom/#{File.basename(Streams::CoverSlatePaths.expected_path(club))}"
|
||||
custom = Streams::CoverSlatePaths.expected_path(club)
|
||||
expect(described_class.slate_path_for_session(session)).to eq(custom)
|
||||
end
|
||||
|
||||
@@ -72,9 +72,8 @@ RSpec.describe Streams::SlateDistributor do
|
||||
allow(http).to receive(:read_timeout=)
|
||||
allow(http).to receive(:request).and_return(response)
|
||||
|
||||
filename = File.basename(Streams::CoverSlatePaths.expected_path(club))
|
||||
path = described_class.slate_path_for_session(session)
|
||||
expect(path).to eq("/slates/custom/#{filename}")
|
||||
expect(path).to eq(Streams::CoverSlatePaths.expected_path(club))
|
||||
expect(http).to have_received(:request)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,7 +99,7 @@ services:
|
||||
HCLOUD_SSH_KEY: ${HCLOUD_SSH_KEY:-matchlivetv-stream-hetzner}
|
||||
HCLOUD_NETWORK_ID: ${HCLOUD_NETWORK_ID:-}
|
||||
HCLOUD_USER_DATA_FILE: /opt/matchlivetv/infra/stream-node/cloud-init.yaml
|
||||
HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:8888}
|
||||
HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:3000/hls}
|
||||
APP_PUBLIC_URL: ${APP_PUBLIC_URL:-http://localhost:3000}
|
||||
PRIVACY_CONTACT_EMAIL: ${PRIVACY_CONTACT_EMAIL:-privacy@matchlivetv.it}
|
||||
SUPPORT_CONTACT_EMAIL: ${SUPPORT_CONTACT_EMAIL:-}
|
||||
@@ -170,6 +170,7 @@ services:
|
||||
- ${MATCHLIVETV_VIDEOS_ROOT:-/media/videos/matchlivetv}/recordings:/recordings
|
||||
- ${MATCHLIVETV_VIDEOS_ROOT:-/media/videos/matchlivetv}/active_storage:/app/storage
|
||||
- ${MATCHLIVETV_VIDEOS_ROOT:-/media/videos/matchlivetv}/log:/app/log
|
||||
- ./slates:/slates
|
||||
- ${HCLOUD_USER_DATA_HOST_DIR:-./stream-node}:/opt/matchlivetv/infra/stream-node:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/up"]
|
||||
@@ -250,7 +251,7 @@ services:
|
||||
RAILS_INTERNAL_URL: http://rails:3000
|
||||
MEDIAMTX_HLS_URL: http://mediamtx:8888
|
||||
MEDIAMTX_INTERNAL_RTMP_URL: rtmp://mediamtx:1935
|
||||
HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:8888}
|
||||
HLS_PUBLIC_URL: ${HLS_PUBLIC_URL:-http://localhost:3000/hls}
|
||||
APP_PUBLIC_URL: ${APP_PUBLIC_URL:-http://localhost:3000}
|
||||
MAILER_FROM: ${MAILER_FROM:-Match Live TV <noreply@matchlivetv.it>}
|
||||
SMTP_ADDRESS: ${SMTP_ADDRESS:-}
|
||||
|
||||
@@ -160,6 +160,7 @@ services:
|
||||
- ../backend:/app
|
||||
- recordings:/recordings
|
||||
- bundle_cache:/usr/local/bundle
|
||||
- ./slates:/slates
|
||||
- ./stream-node:/opt/matchlivetv/infra/stream-node:ro
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/up"]
|
||||
|
||||
+308
@@ -0,0 +1,308 @@
|
||||
package com.matchlivetv.match_live_tv
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.SystemClock
|
||||
import android.view.KeyEvent
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.uiautomator.UiObject2
|
||||
import androidx.test.uiautomator.Until
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* E2E emulatore: login → wizard partita → upload copertina sponsor → salva.
|
||||
* Richiede backend locale su http://10.0.2.2:3000 (variante collaudoDebug).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class E2ECoverUploadTest {
|
||||
private lateinit var device: UiDevice
|
||||
private val ctx by lazy { InstrumentationRegistry.getInstrumentation().targetContext }
|
||||
private val pkg by lazy { ctx.packageName }
|
||||
|
||||
private fun s(id: Int): String = ctx.getString(id)
|
||||
private fun su(id: Int): String = s(id).uppercase()
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
grantRuntimePermissions()
|
||||
launchApp()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun wizard_uploadsMatchCover_andShowsMatchSource() {
|
||||
loginIfNeeded()
|
||||
waitForAnyText(su(R.string.matches_new), "NUOVA PARTITA", "NEW MATCH", timeoutMs = 60_000)
|
||||
|
||||
openMatchWizardViaQuickStart()
|
||||
|
||||
waitForText(s(R.string.wizard_step_title_match), timeoutMs = 45_000)
|
||||
scrollUntilVisible(s(R.string.wizard_match_cover_title))
|
||||
|
||||
tapClickableText(s(R.string.wizard_match_cover_change))
|
||||
pickFirstPhotoFromPicker()
|
||||
|
||||
waitForTextContains(
|
||||
s(R.string.wizard_match_cover_source_match),
|
||||
"Questa partita",
|
||||
"This match",
|
||||
timeoutMs = 20_000,
|
||||
)
|
||||
|
||||
tapClickableText(s(R.string.wizard_action_next))
|
||||
waitForText(s(R.string.wizard_step_title_transmission), timeoutMs = 45_000)
|
||||
|
||||
assertTrue(
|
||||
"Wizard non ha salvato la copertina (step trasmissione non raggiunto)",
|
||||
device.hasObject(By.text(s(R.string.wizard_step_title_transmission))),
|
||||
)
|
||||
}
|
||||
|
||||
private fun waitForTextContains(vararg needles: String, timeoutMs: Long) {
|
||||
val deadline = SystemClock.elapsedRealtime() + timeoutMs
|
||||
while (SystemClock.elapsedRealtime() < deadline) {
|
||||
for (needle in needles) {
|
||||
if (device.hasObject(By.textContains(needle))) return
|
||||
}
|
||||
SystemClock.sleep(250)
|
||||
}
|
||||
error("Nessun testo contenente: ${needles.joinToString()}")
|
||||
}
|
||||
|
||||
private fun loginIfNeeded() {
|
||||
waitForAnyText(
|
||||
s(R.string.login_email),
|
||||
su(R.string.login_submit),
|
||||
su(R.string.matches_new),
|
||||
timeoutMs = 45_000,
|
||||
)
|
||||
if (hasMatchList()) return
|
||||
|
||||
val email = InstrumentationRegistry.getArguments().getString("email") ?: "dir@test.com"
|
||||
val password = InstrumentationRegistry.getArguments().getString("password") ?: "TestPass123!"
|
||||
|
||||
repeat(3) {
|
||||
val emailField = waitForRes("login_email")
|
||||
val passwordField = waitForRes("login_password")
|
||||
pasteIntoField(emailField, email)
|
||||
pasteIntoField(passwordField, password)
|
||||
device.pressKeyCode(KeyEvent.KEYCODE_ENTER)
|
||||
device.waitForIdle()
|
||||
SystemClock.sleep(1500)
|
||||
tapLoginSubmit()
|
||||
SystemClock.sleep(4000)
|
||||
if (hasMatchList()) return
|
||||
}
|
||||
error("Login fallito")
|
||||
}
|
||||
|
||||
private fun openMatchWizardViaQuickStart() {
|
||||
tapClickableText(su(R.string.matches_new))
|
||||
waitForText(s(R.string.sheet_quick_option), timeoutMs = 15_000)
|
||||
tapClickableText(s(R.string.sheet_quick_option))
|
||||
}
|
||||
|
||||
private fun pickFirstPhotoFromPicker() {
|
||||
val pickerPkg = "com.google.android.photopicker"
|
||||
val deadline = SystemClock.elapsedRealtime() + 25_000
|
||||
while (SystemClock.elapsedRealtime() < deadline) {
|
||||
if (device.hasObject(By.pkg(pickerPkg))) break
|
||||
SystemClock.sleep(400)
|
||||
}
|
||||
if (!device.hasObject(By.pkg(pickerPkg))) {
|
||||
error("Photo picker non aperto")
|
||||
}
|
||||
|
||||
SystemClock.sleep(1500)
|
||||
|
||||
if (device.hasObject(By.textContains("cover_test"))) {
|
||||
tapClickableTextContains("cover_test")
|
||||
} else {
|
||||
val thumb = device.findObjects(By.pkg(pickerPkg).clickable(true))
|
||||
.filter {
|
||||
val b = it.visibleBounds
|
||||
b.top >= 1200 && b.width() >= 250
|
||||
}
|
||||
.minByOrNull { it.visibleBounds.top }
|
||||
if (thumb != null) {
|
||||
thumb.click()
|
||||
} else {
|
||||
device.click(device.displayWidth / 6, 1450)
|
||||
}
|
||||
}
|
||||
device.waitForIdle()
|
||||
SystemClock.sleep(1000)
|
||||
|
||||
if (device.hasObject(By.text("Fine"))) {
|
||||
tapClickableText("Fine")
|
||||
} else if (device.hasObject(By.text("Done"))) {
|
||||
tapClickableText("Done")
|
||||
} else {
|
||||
device.click((device.displayWidth * 0.85).toInt(), (device.displayHeight * 0.92).toInt())
|
||||
}
|
||||
waitForWizardReturn()
|
||||
}
|
||||
|
||||
private fun waitForWizardReturn() {
|
||||
device.wait(Until.hasObject(By.pkg(pkg)), 15_000)
|
||||
device.waitForIdle()
|
||||
SystemClock.sleep(800)
|
||||
confirmPickerIfNeeded()
|
||||
}
|
||||
|
||||
private fun tapClickableTextContains(needle: String) {
|
||||
val label = device.findObject(By.textContains(needle))
|
||||
?: error("Testo non trovato: $needle")
|
||||
var node: UiObject2? = label
|
||||
repeat(8) {
|
||||
val current = node ?: return@repeat
|
||||
if (current.isClickable) {
|
||||
current.click()
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
node = current.parent
|
||||
}
|
||||
label.click()
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
private fun confirmPickerIfNeeded() {
|
||||
val confirmLabels = listOf("Done", "Fatto", "OK", "Select", "Seleziona")
|
||||
for (label in confirmLabels) {
|
||||
val btn = device.findObject(By.text(label).clickable(true))
|
||||
if (btn != null) {
|
||||
btn.click()
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun scrollUntilVisible(text: String) {
|
||||
repeat(8) {
|
||||
if (device.hasObject(By.text(text))) return
|
||||
scrollDown(1)
|
||||
}
|
||||
waitForText(text, timeoutMs = 10_000)
|
||||
}
|
||||
|
||||
private fun grantRuntimePermissions() {
|
||||
listOf(
|
||||
"android.permission.CAMERA",
|
||||
"android.permission.RECORD_AUDIO",
|
||||
"android.permission.POST_NOTIFICATIONS",
|
||||
"android.permission.READ_MEDIA_IMAGES",
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
).forEach { permission ->
|
||||
device.executeShellCommand("pm grant $pkg $permission")
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchApp() {
|
||||
val intent = ctx.packageManager.getLaunchIntentForPackage(pkg)?.apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
} ?: error("Launch intent mancante per $pkg")
|
||||
ctx.startActivity(intent)
|
||||
device.wait(Until.hasObject(By.pkg(pkg).depth(0)), 15_000)
|
||||
}
|
||||
|
||||
private fun hasMatchList(): Boolean =
|
||||
device.hasObject(By.text(su(R.string.matches_new))) ||
|
||||
device.hasObject(By.text("NUOVA PARTITA")) ||
|
||||
device.hasObject(By.text("NEW MATCH"))
|
||||
|
||||
private fun waitForRes(tag: String): UiObject2 {
|
||||
val obj = device.wait(Until.findObject(By.res(tag)), 10_000)
|
||||
?: device.wait(Until.findObject(By.res("$pkg:id/$tag")), 2_000)
|
||||
?: error("Nodo non trovato: $tag")
|
||||
return obj
|
||||
}
|
||||
|
||||
private fun tapLoginSubmit() {
|
||||
val btn = device.wait(Until.findObject(By.res("login_submit")), 3_000)
|
||||
?: device.wait(Until.findObject(By.res("$pkg:id/login_submit")), 1_000)
|
||||
if (btn != null) {
|
||||
val bounds = btn.visibleBounds
|
||||
device.click(bounds.centerX(), bounds.centerY())
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
val nodes = device.findObjects(By.text(su(R.string.login_submit))) +
|
||||
device.findObjects(By.text("ACCEDI")) +
|
||||
device.findObjects(By.text("LOG IN"))
|
||||
val target = nodes.lastOrNull { it.isClickable } ?: nodes.lastOrNull()
|
||||
target?.click()
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
private fun pasteIntoField(field: UiObject2, value: String) {
|
||||
field.click()
|
||||
device.waitForIdle()
|
||||
field.clear()
|
||||
field.text = value
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
private fun waitForText(text: String, timeoutMs: Long): UiObject2 {
|
||||
val obj = device.wait(Until.findObject(By.text(text)), timeoutMs)
|
||||
assertNotNull("Testo non trovato entro ${timeoutMs}ms: $text", obj)
|
||||
return obj!!
|
||||
}
|
||||
|
||||
private fun waitForAnyText(vararg texts: String, timeoutMs: Long) {
|
||||
val deadline = SystemClock.elapsedRealtime() + timeoutMs
|
||||
while (SystemClock.elapsedRealtime() < deadline) {
|
||||
for (text in texts) {
|
||||
if (device.hasObject(By.text(text))) return
|
||||
}
|
||||
SystemClock.sleep(250)
|
||||
}
|
||||
error("Nessuno dei testi trovato: ${texts.joinToString()}")
|
||||
}
|
||||
|
||||
private fun tapClickableText(text: String) {
|
||||
repeat(8) {
|
||||
val clickable = device.findObject(By.text(text).clickable(true))
|
||||
val label = clickable ?: device.findObject(By.text(text))
|
||||
if (label != null) {
|
||||
val b = label.visibleBounds
|
||||
if (b.height() >= 16 && b.bottom <= device.displayHeight && b.top >= 0) {
|
||||
var node: UiObject2? = label
|
||||
for (i in 0 until 6) {
|
||||
val current = node ?: break
|
||||
if (current.isClickable) {
|
||||
current.click()
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
node = current.parent
|
||||
}
|
||||
label.click()
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
}
|
||||
scrollDown(1)
|
||||
device.waitForIdle()
|
||||
}
|
||||
error("Testo non cliccabile visibile: $text")
|
||||
}
|
||||
|
||||
private fun scrollDown(steps: Int = 2) {
|
||||
val centerX = device.displayWidth / 2
|
||||
val startY = (device.displayHeight * 0.75).toInt()
|
||||
val endY = (device.displayHeight * 0.25).toInt()
|
||||
repeat(steps) {
|
||||
device.swipe(centerX, startY, centerX, endY, 24)
|
||||
device.waitForIdle()
|
||||
SystemClock.sleep(300)
|
||||
}
|
||||
}
|
||||
}
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
package com.matchlivetv.match_live_tv
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.SystemClock
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.uiautomator.UiObject2
|
||||
import androidx.test.uiautomator.Until
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* E2E: in diretta, ogni tasto laterale critico apre un dialog di conferma
|
||||
* e Annulla non esegue l'azione.
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class E2ESideConfirmDialogTest {
|
||||
private lateinit var device: UiDevice
|
||||
private val ctx by lazy { InstrumentationRegistry.getInstrumentation().targetContext }
|
||||
private val pkg by lazy { ctx.packageName }
|
||||
|
||||
private fun s(id: Int): String = ctx.getString(id)
|
||||
private fun su(id: Int): String = s(id).uppercase()
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
grantRuntimePermissions()
|
||||
launchApp()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sideButtons_showConfirmDialog_andCancel() {
|
||||
ensureLoggedIn()
|
||||
openMatchWizardViaQuickStart()
|
||||
waitForText(s(R.string.wizard_step_title_match), timeoutMs = 45_000)
|
||||
scrollDown()
|
||||
tapClickableText(s(R.string.wizard_action_next))
|
||||
waitForText(s(R.string.wizard_step_title_transmission), timeoutMs = 45_000)
|
||||
skipToNetworkAndStart()
|
||||
|
||||
waitForAnyText(
|
||||
s(R.string.broadcast_status_live),
|
||||
s(R.string.broadcast_status_connecting),
|
||||
s(R.string.broadcast_status_paused),
|
||||
timeoutMs = 90_000,
|
||||
)
|
||||
SystemClock.sleep(2_000)
|
||||
|
||||
assertConfirmThenCancel(
|
||||
contentDesc = s(R.string.broadcast_pause_cd),
|
||||
dialogTitle = s(R.string.broadcast_pause_title),
|
||||
)
|
||||
assertConfirmThenCancel(
|
||||
contentDesc = s(R.string.broadcast_mute_cd),
|
||||
dialogTitle = s(R.string.broadcast_mute_title),
|
||||
)
|
||||
assertConfirmThenCancel(
|
||||
contentDesc = s(R.string.broadcast_share_regia_cd),
|
||||
dialogTitle = s(R.string.broadcast_share_regia_title),
|
||||
)
|
||||
assertConfirmThenCancel(
|
||||
contentDesc = s(R.string.broadcast_terminate_cd),
|
||||
dialogTitle = s(R.string.broadcast_terminate_title),
|
||||
)
|
||||
|
||||
// Dopo Annulla su termina, la diretta deve essere ancora aperta.
|
||||
assertTrue(
|
||||
"La diretta non deve chiudersi dopo Annulla su termina",
|
||||
device.hasObject(By.desc(s(R.string.broadcast_pause_cd))) ||
|
||||
device.hasObject(By.desc(s(R.string.broadcast_resume_cd))) ||
|
||||
device.hasObject(By.text(s(R.string.broadcast_status_live))) ||
|
||||
device.hasObject(By.text(s(R.string.broadcast_status_connecting))) ||
|
||||
device.hasObject(By.text(s(R.string.broadcast_status_paused))),
|
||||
)
|
||||
}
|
||||
|
||||
private fun assertConfirmThenCancel(contentDesc: String, dialogTitle: String) {
|
||||
val btn = device.wait(Until.findObject(By.desc(contentDesc)), 15_000)
|
||||
?: error("Pulsante laterale non trovato: $contentDesc")
|
||||
btn.click()
|
||||
device.waitForIdle()
|
||||
val title = device.wait(Until.findObject(By.text(dialogTitle)), 8_000)
|
||||
assertTrue("Dialog conferma assente per $contentDesc (atteso: $dialogTitle)", title != null)
|
||||
tapClickableText(s(R.string.action_cancel))
|
||||
SystemClock.sleep(600)
|
||||
assertFalse(
|
||||
"Dialog ancora aperto dopo Annulla: $dialogTitle",
|
||||
device.hasObject(By.text(dialogTitle)),
|
||||
)
|
||||
}
|
||||
|
||||
private fun skipToNetworkAndStart() {
|
||||
val onNetworkStep = {
|
||||
device.hasObject(By.text(s(R.string.wizard_network_test_start_label))) ||
|
||||
device.hasObject(By.text("AVVIA TEST RETE"))
|
||||
}
|
||||
repeat(5) {
|
||||
if (onNetworkStep()) return@repeat
|
||||
runCatching { tapClickableText(s(R.string.wizard_action_next)) }
|
||||
scrollUp()
|
||||
SystemClock.sleep(800)
|
||||
}
|
||||
waitForAnyText(s(R.string.wizard_network_test_start_label), "AVVIA TEST RETE", timeoutMs = 45_000)
|
||||
tapClickableText(s(R.string.wizard_network_test_start_label))
|
||||
waitForText(s(R.string.wizard_action_start), timeoutMs = 45_000)
|
||||
waitUntilEnabled(s(R.string.wizard_action_start), timeoutMs = 30_000)
|
||||
tapClickableText(s(R.string.wizard_action_start))
|
||||
}
|
||||
|
||||
private fun ensureLoggedIn() {
|
||||
waitForAnyText(
|
||||
s(R.string.login_email),
|
||||
su(R.string.login_submit),
|
||||
su(R.string.matches_new),
|
||||
timeoutMs = 45_000,
|
||||
)
|
||||
if (hasMatchList()) return
|
||||
fillLogin()
|
||||
tapLoginSubmit()
|
||||
SystemClock.sleep(3_000)
|
||||
waitForAnyText(su(R.string.matches_new), timeoutMs = 60_000)
|
||||
}
|
||||
|
||||
private fun fillLogin() {
|
||||
val email = device.findObject(By.clazz("android.widget.EditText"))
|
||||
?: error("Campo email non trovato")
|
||||
pasteIntoField(email, "dir@test.com")
|
||||
val fields = device.findObjects(By.clazz("android.widget.EditText"))
|
||||
val password = fields.getOrNull(1) ?: error("Campo password non trovato")
|
||||
pasteIntoField(password, "TestPass123!")
|
||||
}
|
||||
|
||||
private fun tapLoginSubmit() {
|
||||
tapClickableText(su(R.string.login_submit))
|
||||
}
|
||||
|
||||
private fun openMatchWizardViaQuickStart() {
|
||||
tapClickableText(su(R.string.matches_new))
|
||||
waitForText(s(R.string.sheet_quick_option), timeoutMs = 15_000)
|
||||
tapClickableText(s(R.string.sheet_quick_option))
|
||||
}
|
||||
|
||||
private fun grantRuntimePermissions() {
|
||||
listOf(
|
||||
"android.permission.CAMERA",
|
||||
"android.permission.RECORD_AUDIO",
|
||||
"android.permission.POST_NOTIFICATIONS",
|
||||
).forEach { permission ->
|
||||
device.executeShellCommand("pm grant $pkg $permission")
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchApp() {
|
||||
val intent = ctx.packageManager.getLaunchIntentForPackage(pkg)?.apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
} ?: error("Launch intent mancante per $pkg")
|
||||
ctx.startActivity(intent)
|
||||
device.wait(Until.hasObject(By.pkg(pkg).depth(0)), 15_000)
|
||||
}
|
||||
|
||||
private fun hasMatchList(): Boolean =
|
||||
device.hasObject(By.text(su(R.string.matches_new)))
|
||||
|
||||
private fun pasteIntoField(field: UiObject2, value: String) {
|
||||
field.click()
|
||||
device.waitForIdle()
|
||||
field.clear()
|
||||
field.text = value
|
||||
device.waitForIdle()
|
||||
}
|
||||
|
||||
private fun waitForText(text: String, timeoutMs: Long): UiObject2 {
|
||||
val obj = device.wait(Until.findObject(By.text(text)), timeoutMs)
|
||||
?: error("Testo non trovato entro ${timeoutMs}ms: $text")
|
||||
return obj
|
||||
}
|
||||
|
||||
private fun waitForAnyText(vararg texts: String, timeoutMs: Long) {
|
||||
val deadline = SystemClock.elapsedRealtime() + timeoutMs
|
||||
while (SystemClock.elapsedRealtime() < deadline) {
|
||||
for (text in texts) {
|
||||
if (device.hasObject(By.text(text))) return
|
||||
}
|
||||
SystemClock.sleep(250)
|
||||
}
|
||||
error("Nessuno dei testi trovato: ${texts.joinToString()}")
|
||||
}
|
||||
|
||||
private fun tapClickableText(text: String) {
|
||||
repeat(6) {
|
||||
val clickable = device.findObject(By.text(text).clickable(true))
|
||||
val label = clickable ?: device.findObject(By.text(text))
|
||||
if (label != null) {
|
||||
var node: UiObject2? = label
|
||||
for (i in 0 until 6) {
|
||||
val current = node ?: break
|
||||
if (current.isClickable) {
|
||||
current.click()
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
node = current.parent
|
||||
}
|
||||
label.click()
|
||||
device.waitForIdle()
|
||||
return
|
||||
}
|
||||
scrollDown(1)
|
||||
device.waitForIdle()
|
||||
}
|
||||
error("Testo non cliccabile visibile: $text")
|
||||
}
|
||||
|
||||
private fun waitUntilEnabled(text: String, timeoutMs: Long) {
|
||||
val deadline = SystemClock.elapsedRealtime() + timeoutMs
|
||||
while (SystemClock.elapsedRealtime() < deadline) {
|
||||
val label = device.findObject(By.text(text))
|
||||
if (label != null) {
|
||||
var node: UiObject2? = label
|
||||
for (i in 0 until 6) {
|
||||
val current = node ?: break
|
||||
if (current.isClickable && current.isEnabled) return
|
||||
node = current.parent
|
||||
}
|
||||
}
|
||||
SystemClock.sleep(500)
|
||||
}
|
||||
error("Pulsante non abilitato entro timeout: $text")
|
||||
}
|
||||
|
||||
private fun scrollDown(steps: Int = 2) {
|
||||
val centerX = device.displayWidth / 2
|
||||
val startY = (device.displayHeight * 0.75).toInt()
|
||||
val endY = (device.displayHeight * 0.25).toInt()
|
||||
repeat(steps) {
|
||||
device.swipe(centerX, startY, centerX, endY, 24)
|
||||
device.waitForIdle()
|
||||
SystemClock.sleep(300)
|
||||
}
|
||||
}
|
||||
|
||||
private fun scrollUp(steps: Int = 1) {
|
||||
val centerX = device.displayWidth / 2
|
||||
val startY = (device.displayHeight * 0.35).toInt()
|
||||
val endY = (device.displayHeight * 0.75).toInt()
|
||||
repeat(steps) {
|
||||
device.swipe(centerX, startY, centerX, endY, 24)
|
||||
device.waitForIdle()
|
||||
SystemClock.sleep(300)
|
||||
}
|
||||
}
|
||||
}
|
||||
+110
-26
@@ -123,7 +123,7 @@ fun BroadcastControlsOverlay(
|
||||
onSelectMinQuality: (String) -> Unit = {},
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var showTerminateConfirm by remember { mutableStateOf(false) }
|
||||
var pendingConfirm by remember { mutableStateOf<SideConfirmAction?>(null) }
|
||||
var showMinQualityPicker by remember { mutableStateOf(false) }
|
||||
val autoLabel = stringResource(R.string.broadcast_min_quality_auto)
|
||||
|
||||
@@ -140,25 +140,21 @@ fun BroadcastControlsOverlay(
|
||||
)
|
||||
}
|
||||
|
||||
if (showTerminateConfirm) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showTerminateConfirm = false },
|
||||
containerColor = MatchColors.SurfaceElevated,
|
||||
title = { Text(stringResource(R.string.broadcast_terminate_title)) },
|
||||
text = { Text(stringResource(R.string.broadcast_terminate_message)) },
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
showTerminateConfirm = false
|
||||
onTerminate()
|
||||
},
|
||||
) {
|
||||
Text(stringResource(R.string.broadcast_terminate_confirm), color = MatchColors.PrimaryRed)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { showTerminateConfirm = false }) {
|
||||
Text(stringResource(R.string.action_cancel), color = MatchColors.TextSecondary)
|
||||
pendingConfirm?.let { action ->
|
||||
SideActionConfirmDialog(
|
||||
action = action,
|
||||
isPaused = isPaused,
|
||||
audioMuted = audioMuted,
|
||||
onDismiss = { pendingConfirm = null },
|
||||
onConfirm = {
|
||||
pendingConfirm = null
|
||||
when (action) {
|
||||
SideConfirmAction.SHARE_LIVE -> onShareLive()
|
||||
SideConfirmAction.SHARE_REGIA -> onShareRegia()
|
||||
SideConfirmAction.ADVANCE_PERIOD -> onAdvancePeriod?.invoke()
|
||||
SideConfirmAction.PAUSE_OR_RESUME -> onPauseOrResume()
|
||||
SideConfirmAction.TOGGLE_MUTE -> onToggleAudioMute()
|
||||
SideConfirmAction.TERMINATE -> onTerminate()
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -216,13 +212,13 @@ fun BroadcastControlsOverlay(
|
||||
SideIconButton(
|
||||
icon = Icons.Default.Share,
|
||||
contentDescription = stringResource(R.string.broadcast_share_live_cd),
|
||||
onClick = onShareLive,
|
||||
onClick = { pendingConfirm = SideConfirmAction.SHARE_LIVE },
|
||||
enabled = shareLiveEnabled,
|
||||
)
|
||||
SideIconButton(
|
||||
icon = Icons.Default.Videocam,
|
||||
contentDescription = stringResource(R.string.broadcast_share_regia_cd),
|
||||
onClick = onShareRegia,
|
||||
onClick = { pendingConfirm = SideConfirmAction.SHARE_REGIA },
|
||||
)
|
||||
SideIconButton(
|
||||
icon = Icons.Default.Tune,
|
||||
@@ -240,7 +236,7 @@ fun BroadcastControlsOverlay(
|
||||
SideIconButton(
|
||||
icon = Icons.Default.SkipNext,
|
||||
contentDescription = stringResource(R.string.broadcast_next_period_cd),
|
||||
onClick = onAdvancePeriod,
|
||||
onClick = { pendingConfirm = SideConfirmAction.ADVANCE_PERIOD },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -258,7 +254,7 @@ fun BroadcastControlsOverlay(
|
||||
} else {
|
||||
stringResource(R.string.broadcast_pause_cd)
|
||||
},
|
||||
onClick = onPauseOrResume,
|
||||
onClick = { pendingConfirm = SideConfirmAction.PAUSE_OR_RESUME },
|
||||
highlighted = isPaused,
|
||||
)
|
||||
SideIconButton(
|
||||
@@ -268,13 +264,13 @@ fun BroadcastControlsOverlay(
|
||||
} else {
|
||||
stringResource(R.string.broadcast_mute_cd)
|
||||
},
|
||||
onClick = onToggleAudioMute,
|
||||
onClick = { pendingConfirm = SideConfirmAction.TOGGLE_MUTE },
|
||||
highlighted = audioMuted,
|
||||
)
|
||||
SideIconButton(
|
||||
icon = Icons.Default.Stop,
|
||||
contentDescription = stringResource(R.string.broadcast_terminate_cd),
|
||||
onClick = { showTerminateConfirm = true },
|
||||
onClick = { pendingConfirm = SideConfirmAction.TERMINATE },
|
||||
danger = true,
|
||||
)
|
||||
}
|
||||
@@ -770,6 +766,94 @@ private fun MinQualityOptionChip(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SideActionConfirmDialog(
|
||||
action: SideConfirmAction,
|
||||
isPaused: Boolean,
|
||||
audioMuted: Boolean,
|
||||
onDismiss: () -> Unit,
|
||||
onConfirm: () -> Unit,
|
||||
) {
|
||||
val title: String
|
||||
val message: String
|
||||
val confirmLabel: String
|
||||
val confirmColor: Color
|
||||
when (action) {
|
||||
SideConfirmAction.SHARE_LIVE -> {
|
||||
title = stringResource(R.string.broadcast_share_live_title)
|
||||
message = stringResource(R.string.broadcast_share_live_message)
|
||||
confirmLabel = stringResource(R.string.action_confirm)
|
||||
confirmColor = Color.White
|
||||
}
|
||||
SideConfirmAction.SHARE_REGIA -> {
|
||||
title = stringResource(R.string.broadcast_share_regia_title)
|
||||
message = stringResource(R.string.broadcast_share_regia_message)
|
||||
confirmLabel = stringResource(R.string.action_confirm)
|
||||
confirmColor = Color.White
|
||||
}
|
||||
SideConfirmAction.ADVANCE_PERIOD -> {
|
||||
title = stringResource(R.string.broadcast_advance_period_title)
|
||||
message = stringResource(R.string.broadcast_advance_period_message)
|
||||
confirmLabel = stringResource(R.string.action_confirm)
|
||||
confirmColor = Color.White
|
||||
}
|
||||
SideConfirmAction.PAUSE_OR_RESUME -> {
|
||||
if (isPaused) {
|
||||
title = stringResource(R.string.broadcast_resume_title)
|
||||
message = stringResource(R.string.broadcast_resume_message)
|
||||
} else {
|
||||
title = stringResource(R.string.broadcast_pause_title)
|
||||
message = stringResource(R.string.broadcast_pause_message)
|
||||
}
|
||||
confirmLabel = stringResource(R.string.action_confirm)
|
||||
confirmColor = Color.White
|
||||
}
|
||||
SideConfirmAction.TOGGLE_MUTE -> {
|
||||
if (audioMuted) {
|
||||
title = stringResource(R.string.broadcast_unmute_title)
|
||||
message = stringResource(R.string.broadcast_unmute_message)
|
||||
} else {
|
||||
title = stringResource(R.string.broadcast_mute_title)
|
||||
message = stringResource(R.string.broadcast_mute_message)
|
||||
}
|
||||
confirmLabel = stringResource(R.string.action_confirm)
|
||||
confirmColor = Color.White
|
||||
}
|
||||
SideConfirmAction.TERMINATE -> {
|
||||
title = stringResource(R.string.broadcast_terminate_title)
|
||||
message = stringResource(R.string.broadcast_terminate_message)
|
||||
confirmLabel = stringResource(R.string.broadcast_terminate_confirm)
|
||||
confirmColor = MatchColors.PrimaryRed
|
||||
}
|
||||
}
|
||||
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
containerColor = MatchColors.SurfaceElevated,
|
||||
title = { Text(title) },
|
||||
text = { Text(message) },
|
||||
confirmButton = {
|
||||
TextButton(onClick = onConfirm) {
|
||||
Text(confirmLabel, color = confirmColor)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = onDismiss) {
|
||||
Text(stringResource(R.string.action_cancel), color = MatchColors.TextSecondary)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private enum class SideConfirmAction {
|
||||
SHARE_LIVE,
|
||||
SHARE_REGIA,
|
||||
ADVANCE_PERIOD,
|
||||
PAUSE_OR_RESUME,
|
||||
TOGGLE_MUTE,
|
||||
TERMINATE,
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun SideIconButton(
|
||||
|
||||
+14
-4
@@ -14,6 +14,7 @@ import kotlin.coroutines.resume
|
||||
|
||||
enum class ScoreDialogKind {
|
||||
SET_WON,
|
||||
CLOSE_SET,
|
||||
CLOSE_SET_ANYWAY,
|
||||
MATCH_WON,
|
||||
}
|
||||
@@ -78,6 +79,9 @@ fun ScoreDialogRouter(
|
||||
onDismiss = host::resolve,
|
||||
)
|
||||
}
|
||||
ScoreDialogKind.CLOSE_SET -> {
|
||||
CloseSetConfirmDialog(onDismiss = host::resolve)
|
||||
}
|
||||
ScoreDialogKind.CLOSE_SET_ANYWAY -> {
|
||||
CloseSetAnywayDialog(onDismiss = host::resolve)
|
||||
}
|
||||
@@ -136,10 +140,16 @@ class LiveScoreActions(
|
||||
awayPoints = score.awayPoints,
|
||||
currentSet = score.currentSet,
|
||||
)
|
||||
if (winner == null) {
|
||||
val ok = dialogHost.show(ScoreDialogState(kind = ScoreDialogKind.CLOSE_SET_ANYWAY))
|
||||
if (!ok) return
|
||||
}
|
||||
val ok = dialogHost.show(
|
||||
ScoreDialogState(
|
||||
kind = if (winner == null) {
|
||||
ScoreDialogKind.CLOSE_SET_ANYWAY
|
||||
} else {
|
||||
ScoreDialogKind.CLOSE_SET
|
||||
},
|
||||
),
|
||||
)
|
||||
if (!ok) return
|
||||
scoreController.closeSet()
|
||||
afterCloseSet(onStopStream)
|
||||
}
|
||||
|
||||
+22
@@ -38,6 +38,28 @@ fun SetWonDialog(
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CloseSetConfirmDialog(onDismiss: (confirmed: Boolean) -> Unit) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { onDismiss(false) },
|
||||
containerColor = MatchColors.Surface,
|
||||
title = { Text(stringResource(R.string.score_action_close_set)) },
|
||||
text = {
|
||||
Text(stringResource(R.string.broadcast_close_set_confirm_message))
|
||||
},
|
||||
confirmButton = {
|
||||
FilledTonalButton(onClick = { onDismiss(true) }) {
|
||||
Text(stringResource(R.string.score_action_close_set), color = Color.Black)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = { onDismiss(false) }) {
|
||||
Text(stringResource(R.string.action_cancel))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CloseSetAnywayDialog(onDismiss: (confirmed: Boolean) -> Unit) {
|
||||
AlertDialog(
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<string name="action_logout">Abmelden</string>
|
||||
<string name="action_login">Anmelden</string>
|
||||
<string name="action_cancel">Abbrechen</string>
|
||||
<string name="action_confirm">Bestätigen</string>
|
||||
<string name="action_save">Speichern</string>
|
||||
<string name="login_email">E-Mail</string>
|
||||
<string name="login_password">Passwort</string>
|
||||
@@ -172,6 +173,21 @@
|
||||
<string name="broadcast_terminate_title">Livestream beenden?</string>
|
||||
<string name="broadcast_terminate_message">Der Stream wird für alle Zuschauer beendet.</string>
|
||||
<string name="broadcast_terminate_confirm">BEENDEN</string>
|
||||
<string name="broadcast_pause_title">Livestream pausieren?</string>
|
||||
<string name="broadcast_pause_message">Das Cover bleibt on air, bis du fortsetzt.</string>
|
||||
<string name="broadcast_resume_title">Livestream fortsetzen?</string>
|
||||
<string name="broadcast_resume_message">Die Kamera geht wieder on air statt des Covers.</string>
|
||||
<string name="broadcast_mute_title">Audio stummschalten?</string>
|
||||
<string name="broadcast_mute_message">Das Mikrofon wird nicht mehr an den Stream gesendet, bis du es wieder aktivierst.</string>
|
||||
<string name="broadcast_unmute_title">Audio wieder aktivieren?</string>
|
||||
<string name="broadcast_unmute_message">Das Mikrofon ist wieder aktiv im Stream.</string>
|
||||
<string name="broadcast_advance_period_title">Zum nächsten Abschnitt wechseln?</string>
|
||||
<string name="broadcast_advance_period_message">Die Anzeigetafel wechselt zum nächsten Abschnitt und der aktuelle Stand wird gespeichert.</string>
|
||||
<string name="broadcast_share_live_title">Livestream teilen?</string>
|
||||
<string name="broadcast_share_live_message">Es öffnet sich das Teilen-Menü mit dem öffentlichen Live-Link.</string>
|
||||
<string name="broadcast_share_regia_title">Regie-Link teilen?</string>
|
||||
<string name="broadcast_share_regia_message">Es öffnet sich das Teilen-Menü mit dem Link zur Fernsteuerung des Spielstands.</string>
|
||||
<string name="broadcast_close_set_confirm_message">Bestätigst du das Beenden des aktuellen Satzes?</string>
|
||||
<string name="broadcast_hide_controls_cd">Steuerung ausblenden</string>
|
||||
<string name="broadcast_show_controls_cd">Steuerung einblenden</string>
|
||||
<string name="broadcast_share_live_cd">Livestream teilen</string>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<string name="action_logout">Log out</string>
|
||||
<string name="action_login">Log in</string>
|
||||
<string name="action_cancel">Cancel</string>
|
||||
<string name="action_confirm">Confirm</string>
|
||||
<string name="action_save">Save</string>
|
||||
<string name="login_email">Email</string>
|
||||
<string name="login_password">Password</string>
|
||||
@@ -172,6 +173,21 @@
|
||||
<string name="broadcast_terminate_title">End the live stream?</string>
|
||||
<string name="broadcast_terminate_message">The stream will be closed for all viewers.</string>
|
||||
<string name="broadcast_terminate_confirm">END</string>
|
||||
<string name="broadcast_pause_title">Pause the live stream?</string>
|
||||
<string name="broadcast_pause_message">The cover slate will stay on air until you resume.</string>
|
||||
<string name="broadcast_resume_title">Resume the live stream?</string>
|
||||
<string name="broadcast_resume_message">The camera will go back on air instead of the cover slate.</string>
|
||||
<string name="broadcast_mute_title">Mute audio?</string>
|
||||
<string name="broadcast_mute_message">The microphone will not be sent to the stream until you unmute.</string>
|
||||
<string name="broadcast_unmute_title">Unmute audio?</string>
|
||||
<string name="broadcast_unmute_message">The microphone will be active on the stream again.</string>
|
||||
<string name="broadcast_advance_period_title">Advance to the next period?</string>
|
||||
<string name="broadcast_advance_period_message">The scoreboard will move to the next period and the current period score will be saved.</string>
|
||||
<string name="broadcast_share_live_title">Share the live stream?</string>
|
||||
<string name="broadcast_share_live_message">This opens the share sheet with the public live link.</string>
|
||||
<string name="broadcast_share_regia_title">Share the control room link?</string>
|
||||
<string name="broadcast_share_regia_message">This opens the share sheet with the remote scoring link.</string>
|
||||
<string name="broadcast_close_set_confirm_message">Confirm closing the current set?</string>
|
||||
<string name="broadcast_hide_controls_cd">Hide controls</string>
|
||||
<string name="broadcast_show_controls_cd">Show controls</string>
|
||||
<string name="broadcast_share_live_cd">Share live stream</string>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<string name="action_logout">Salir</string>
|
||||
<string name="action_login">Acceder</string>
|
||||
<string name="action_cancel">Cancelar</string>
|
||||
<string name="action_confirm">Confirmar</string>
|
||||
<string name="action_save">Guardar</string>
|
||||
<string name="login_email">Email</string>
|
||||
<string name="login_password">Contraseña</string>
|
||||
@@ -172,6 +173,21 @@
|
||||
<string name="broadcast_terminate_title">¿Terminar el directo?</string>
|
||||
<string name="broadcast_terminate_message">El streaming se cerrará para todos los espectadores.</string>
|
||||
<string name="broadcast_terminate_confirm">TERMINAR</string>
|
||||
<string name="broadcast_pause_title">¿Pausar el directo?</string>
|
||||
<string name="broadcast_pause_message">La portada seguirá en antena hasta que lo reanudes.</string>
|
||||
<string name="broadcast_resume_title">¿Reanudar el directo?</string>
|
||||
<string name="broadcast_resume_message">La cámara volverá a antena en lugar de la portada.</string>
|
||||
<string name="broadcast_mute_title">¿Silenciar el audio?</string>
|
||||
<string name="broadcast_mute_message">El micrófono no se enviará al stream hasta que lo reactives.</string>
|
||||
<string name="broadcast_unmute_title">¿Reactivar el audio?</string>
|
||||
<string name="broadcast_unmute_message">El micrófono volverá a estar activo en el stream.</string>
|
||||
<string name="broadcast_advance_period_title">¿Pasar al periodo siguiente?</string>
|
||||
<string name="broadcast_advance_period_message">El marcador pasará al siguiente periodo y se guardará el marcador del periodo actual.</string>
|
||||
<string name="broadcast_share_live_title">¿Compartir el directo?</string>
|
||||
<string name="broadcast_share_live_message">Se abrirá el menú de compartir con el enlace público del directo.</string>
|
||||
<string name="broadcast_share_regia_title">¿Compartir el enlace de regie?</string>
|
||||
<string name="broadcast_share_regia_message">Se abrirá el menú de compartir con el enlace para gestionar el marcador a distancia.</string>
|
||||
<string name="broadcast_close_set_confirm_message">¿Confirmas el cierre del set actual?</string>
|
||||
<string name="broadcast_hide_controls_cd">Ocultar controles</string>
|
||||
<string name="broadcast_show_controls_cd">Mostrar controles</string>
|
||||
<string name="broadcast_share_live_cd">Compartir directo</string>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<string name="action_logout">Déconnexion</string>
|
||||
<string name="action_login">Connexion</string>
|
||||
<string name="action_cancel">Annuler</string>
|
||||
<string name="action_confirm">Confirmer</string>
|
||||
<string name="action_save">Enregistrer</string>
|
||||
<string name="login_email">E-mail</string>
|
||||
<string name="login_password">Mot de passe</string>
|
||||
@@ -172,6 +173,21 @@
|
||||
<string name="broadcast_terminate_title">Terminer le direct ?</string>
|
||||
<string name="broadcast_terminate_message">Le streaming sera fermé pour tous les spectateurs.</string>
|
||||
<string name="broadcast_terminate_confirm">TERMINER</string>
|
||||
<string name="broadcast_pause_title">Mettre le direct en pause ?</string>
|
||||
<string name="broadcast_pause_message">La couverture restera à l\'antenne jusqu\'à la reprise.</string>
|
||||
<string name="broadcast_resume_title">Reprendre le direct ?</string>
|
||||
<string name="broadcast_resume_message">La caméra reviendra à l\'antenne à la place de la couverture.</string>
|
||||
<string name="broadcast_mute_title">Couper l\'audio ?</string>
|
||||
<string name="broadcast_mute_message">Le micro ne sera plus envoyé au flux tant que vous ne le réactivez pas.</string>
|
||||
<string name="broadcast_unmute_title">Réactiver l\'audio ?</string>
|
||||
<string name="broadcast_unmute_message">Le micro sera à nouveau actif sur le flux.</string>
|
||||
<string name="broadcast_advance_period_title">Passer à la période suivante ?</string>
|
||||
<string name="broadcast_advance_period_message">Le tableau passera à la période suivante et le score de la période en cours sera enregistré.</string>
|
||||
<string name="broadcast_share_live_title">Partager le direct ?</string>
|
||||
<string name="broadcast_share_live_message">Cela ouvre le menu de partage avec le lien public du direct.</string>
|
||||
<string name="broadcast_share_regia_title">Partager le lien régie ?</string>
|
||||
<string name="broadcast_share_regia_message">Cela ouvre le menu de partage avec le lien de scoring distant.</string>
|
||||
<string name="broadcast_close_set_confirm_message">Confirmez la clôture du set en cours ?</string>
|
||||
<string name="broadcast_hide_controls_cd">Masquer les commandes</string>
|
||||
<string name="broadcast_show_controls_cd">Afficher les commandes</string>
|
||||
<string name="broadcast_share_live_cd">Partager le direct</string>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<string name="action_logout">Esci</string>
|
||||
<string name="action_login">Accedi</string>
|
||||
<string name="action_cancel">Annulla</string>
|
||||
<string name="action_confirm">Conferma</string>
|
||||
<string name="action_save">Salva</string>
|
||||
<string name="login_email">Email</string>
|
||||
<string name="login_password">Password</string>
|
||||
@@ -173,6 +174,21 @@
|
||||
<string name="broadcast_terminate_title">Terminare la diretta?</string>
|
||||
<string name="broadcast_terminate_message">Lo streaming verrà chiuso per tutti gli spettatori.</string>
|
||||
<string name="broadcast_terminate_confirm">TERMINA</string>
|
||||
<string name="broadcast_pause_title">Mettere in pausa?</string>
|
||||
<string name="broadcast_pause_message">La diretta passerà alla copertina finché non la riprendi.</string>
|
||||
<string name="broadcast_resume_title">Riprendere la diretta?</string>
|
||||
<string name="broadcast_resume_message">La telecamera tornerà in onda al posto della copertina.</string>
|
||||
<string name="broadcast_mute_title">Silenziare l\'audio?</string>
|
||||
<string name="broadcast_mute_message">Il microfono non verrà inviato allo stream finché non lo riattivi.</string>
|
||||
<string name="broadcast_unmute_title">Riattivare l\'audio?</string>
|
||||
<string name="broadcast_unmute_message">Il microfono tornerà attivo sullo stream.</string>
|
||||
<string name="broadcast_advance_period_title">Passare al periodo successivo?</string>
|
||||
<string name="broadcast_advance_period_message">Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.</string>
|
||||
<string name="broadcast_share_live_title">Condividere la diretta?</string>
|
||||
<string name="broadcast_share_live_message">Aprirai il menu di condivisione con il link pubblico della diretta.</string>
|
||||
<string name="broadcast_share_regia_title">Condividere il link regia?</string>
|
||||
<string name="broadcast_share_regia_message">Aprirai il menu di condivisione con il link per gestire il punteggio da remoto.</string>
|
||||
<string name="broadcast_close_set_confirm_message">Confermi la chiusura del set corrente?</string>
|
||||
<string name="broadcast_hide_controls_cd">Nascondi controlli</string>
|
||||
<string name="broadcast_show_controls_cd">Mostra controlli</string>
|
||||
<string name="broadcast_share_live_cd">Condividi diretta</string>
|
||||
|
||||
@@ -74,6 +74,7 @@ enum L10n {
|
||||
private static let table: [String: [String: String]] = [
|
||||
"it": [
|
||||
"action.cancel": "Annulla",
|
||||
"action.confirm": "Conferma",
|
||||
"action.delete": "Elimina",
|
||||
"action.exit": "Esci",
|
||||
"action.login": "Accedi",
|
||||
@@ -174,6 +175,21 @@ enum L10n {
|
||||
"broadcast.terminate.confirm": "TERMINA",
|
||||
"broadcast.terminate.message": "Lo streaming verrà chiuso per tutti gli spettatori.",
|
||||
"broadcast.terminate.title": "Terminare la diretta?",
|
||||
"broadcast.pause.title": "Mettere in pausa?",
|
||||
"broadcast.pause.message": "La diretta passerà alla copertina finché non la riprendi.",
|
||||
"broadcast.resume.title": "Riprendere la diretta?",
|
||||
"broadcast.resume.message": "La telecamera tornerà in onda al posto della copertina.",
|
||||
"broadcast.mute.title": "Silenziare l'audio?",
|
||||
"broadcast.mute.message": "Il microfono non verrà inviato allo stream finché non lo riattivi.",
|
||||
"broadcast.unmute.title": "Riattivare l'audio?",
|
||||
"broadcast.unmute.message": "Il microfono tornerà attivo sullo stream.",
|
||||
"broadcast.advance.period.title": "Passare al periodo successivo?",
|
||||
"broadcast.advance.period.message": "Il tabellone passerà al periodo successivo e il punteggio del periodo corrente sarà salvato.",
|
||||
"broadcast.share.live.title": "Condividere la diretta?",
|
||||
"broadcast.share.live.message": "Aprirai il menu di condivisione con il link pubblico della diretta.",
|
||||
"broadcast.share.regia.title": "Condividere il link regia?",
|
||||
"broadcast.share.regia.message": "Aprirai il menu di condivisione con il link per gestire il punteggio da remoto.",
|
||||
"broadcast.close.set.confirm.message": "Confermi la chiusura del set corrente?",
|
||||
"broadcast.tooltip.add.point": "Aggiungi punto %1$@",
|
||||
"broadcast.tooltip.plus.side": "+%1$d %2$@",
|
||||
"broadcast.tooltip.remove.point": "Togli punto %1$@",
|
||||
@@ -389,6 +405,7 @@ enum L10n {
|
||||
],
|
||||
"en": [
|
||||
"action.cancel": "Cancel",
|
||||
"action.confirm": "Confirm",
|
||||
"action.delete": "Delete",
|
||||
"action.exit": "Exit",
|
||||
"action.login": "Log in",
|
||||
@@ -489,6 +506,21 @@ enum L10n {
|
||||
"broadcast.terminate.confirm": "END",
|
||||
"broadcast.terminate.message": "The stream will be closed for all viewers.",
|
||||
"broadcast.terminate.title": "End the live stream?",
|
||||
"broadcast.pause.title": "Pause the live stream?",
|
||||
"broadcast.pause.message": "The cover slate will stay on air until you resume.",
|
||||
"broadcast.resume.title": "Resume the live stream?",
|
||||
"broadcast.resume.message": "The camera will go back on air instead of the cover slate.",
|
||||
"broadcast.mute.title": "Mute audio?",
|
||||
"broadcast.mute.message": "The microphone will not be sent to the stream until you unmute.",
|
||||
"broadcast.unmute.title": "Unmute audio?",
|
||||
"broadcast.unmute.message": "The microphone will be active on the stream again.",
|
||||
"broadcast.advance.period.title": "Advance to the next period?",
|
||||
"broadcast.advance.period.message": "The scoreboard will move to the next period and the current period score will be saved.",
|
||||
"broadcast.share.live.title": "Share the live stream?",
|
||||
"broadcast.share.live.message": "This opens the share sheet with the public live link.",
|
||||
"broadcast.share.regia.title": "Share the control room link?",
|
||||
"broadcast.share.regia.message": "This opens the share sheet with the remote scoring link.",
|
||||
"broadcast.close.set.confirm.message": "Confirm closing the current set?",
|
||||
"broadcast.tooltip.add.point": "Add point %1$@",
|
||||
"broadcast.tooltip.plus.side": "+%1$d %2$@",
|
||||
"broadcast.tooltip.remove.point": "Remove point %1$@",
|
||||
@@ -704,6 +736,7 @@ enum L10n {
|
||||
],
|
||||
"fr": [
|
||||
"action.cancel": "Annuler",
|
||||
"action.confirm": "Confirmer",
|
||||
"action.delete": "Supprimer",
|
||||
"action.exit": "Quitter",
|
||||
"action.login": "Connexion",
|
||||
@@ -804,6 +837,21 @@ enum L10n {
|
||||
"broadcast.terminate.confirm": "TERMINER",
|
||||
"broadcast.terminate.message": "Le streaming sera fermé pour tous les spectateurs.",
|
||||
"broadcast.terminate.title": "Terminer le direct ?",
|
||||
"broadcast.pause.title": "Mettre le direct en pause ?",
|
||||
"broadcast.pause.message": "La couverture restera à l'antenne jusqu'à la reprise.",
|
||||
"broadcast.resume.title": "Reprendre le direct ?",
|
||||
"broadcast.resume.message": "La caméra reviendra à l'antenne à la place de la couverture.",
|
||||
"broadcast.mute.title": "Couper l'audio ?",
|
||||
"broadcast.mute.message": "Le micro ne sera plus envoyé au flux tant que vous ne le réactivez pas.",
|
||||
"broadcast.unmute.title": "Réactiver l'audio ?",
|
||||
"broadcast.unmute.message": "Le micro sera à nouveau actif sur le flux.",
|
||||
"broadcast.advance.period.title": "Passer à la période suivante ?",
|
||||
"broadcast.advance.period.message": "Le tableau passera à la période suivante et le score de la période en cours sera enregistré.",
|
||||
"broadcast.share.live.title": "Partager le direct ?",
|
||||
"broadcast.share.live.message": "Cela ouvre le menu de partage avec le lien public du direct.",
|
||||
"broadcast.share.regia.title": "Partager le lien régie ?",
|
||||
"broadcast.share.regia.message": "Cela ouvre le menu de partage avec le lien de scoring distant.",
|
||||
"broadcast.close.set.confirm.message": "Confirmez la clôture du set en cours ?",
|
||||
"broadcast.tooltip.add.point": "Ajouter un point %1$@",
|
||||
"broadcast.tooltip.plus.side": "+%1$d %2$@",
|
||||
"broadcast.tooltip.remove.point": "Retirer un point %1$@",
|
||||
@@ -1019,6 +1067,7 @@ enum L10n {
|
||||
],
|
||||
"de": [
|
||||
"action.cancel": "Abbrechen",
|
||||
"action.confirm": "Bestätigen",
|
||||
"action.delete": "Löschen",
|
||||
"action.exit": "Beenden",
|
||||
"action.login": "Anmelden",
|
||||
@@ -1119,6 +1168,21 @@ enum L10n {
|
||||
"broadcast.terminate.confirm": "BEENDEN",
|
||||
"broadcast.terminate.message": "Der Stream wird für alle Zuschauer beendet.",
|
||||
"broadcast.terminate.title": "Livestream beenden?",
|
||||
"broadcast.pause.title": "Livestream pausieren?",
|
||||
"broadcast.pause.message": "Das Cover bleibt on air, bis du fortsetzt.",
|
||||
"broadcast.resume.title": "Livestream fortsetzen?",
|
||||
"broadcast.resume.message": "Die Kamera geht wieder on air statt des Covers.",
|
||||
"broadcast.mute.title": "Audio stummschalten?",
|
||||
"broadcast.mute.message": "Das Mikrofon wird nicht mehr an den Stream gesendet, bis du es wieder aktivierst.",
|
||||
"broadcast.unmute.title": "Audio wieder aktivieren?",
|
||||
"broadcast.unmute.message": "Das Mikrofon ist wieder aktiv im Stream.",
|
||||
"broadcast.advance.period.title": "Zum nächsten Abschnitt wechseln?",
|
||||
"broadcast.advance.period.message": "Die Anzeigetafel wechselt zum nächsten Abschnitt und der aktuelle Stand wird gespeichert.",
|
||||
"broadcast.share.live.title": "Livestream teilen?",
|
||||
"broadcast.share.live.message": "Es öffnet sich das Teilen-Menü mit dem öffentlichen Live-Link.",
|
||||
"broadcast.share.regia.title": "Regie-Link teilen?",
|
||||
"broadcast.share.regia.message": "Es öffnet sich das Teilen-Menü mit dem Link zur Fernsteuerung des Spielstands.",
|
||||
"broadcast.close.set.confirm.message": "Bestätigst du das Beenden des aktuellen Satzes?",
|
||||
"broadcast.tooltip.add.point": "Punkt hinzufügen %1$@",
|
||||
"broadcast.tooltip.plus.side": "+%1$d %2$@",
|
||||
"broadcast.tooltip.remove.point": "Punkt entfernen %1$@",
|
||||
@@ -1334,6 +1398,7 @@ enum L10n {
|
||||
],
|
||||
"es": [
|
||||
"action.cancel": "Cancelar",
|
||||
"action.confirm": "Confirmar",
|
||||
"action.delete": "Eliminar",
|
||||
"action.exit": "Salir",
|
||||
"action.login": "Acceder",
|
||||
@@ -1434,6 +1499,21 @@ enum L10n {
|
||||
"broadcast.terminate.confirm": "TERMINAR",
|
||||
"broadcast.terminate.message": "El streaming se cerrará para todos los espectadores.",
|
||||
"broadcast.terminate.title": "¿Terminar el directo?",
|
||||
"broadcast.pause.title": "¿Pausar el directo?",
|
||||
"broadcast.pause.message": "La portada seguirá en antena hasta que lo reanudes.",
|
||||
"broadcast.resume.title": "¿Reanudar el directo?",
|
||||
"broadcast.resume.message": "La cámara volverá a antena en lugar de la portada.",
|
||||
"broadcast.mute.title": "¿Silenciar el audio?",
|
||||
"broadcast.mute.message": "El micrófono no se enviará al stream hasta que lo reactives.",
|
||||
"broadcast.unmute.title": "¿Reactivar el audio?",
|
||||
"broadcast.unmute.message": "El micrófono volverá a estar activo en el stream.",
|
||||
"broadcast.advance.period.title": "¿Pasar al periodo siguiente?",
|
||||
"broadcast.advance.period.message": "El marcador pasará al siguiente periodo y se guardará el marcador del periodo actual.",
|
||||
"broadcast.share.live.title": "¿Compartir el directo?",
|
||||
"broadcast.share.live.message": "Se abrirá el menú de compartir con el enlace público del directo.",
|
||||
"broadcast.share.regia.title": "¿Compartir el enlace de regie?",
|
||||
"broadcast.share.regia.message": "Se abrirá el menú de compartir con el enlace para gestionar el marcador a distancia.",
|
||||
"broadcast.close.set.confirm.message": "¿Confirmas el cierre del set actual?",
|
||||
"broadcast.tooltip.add.point": "Añadir punto %1$@",
|
||||
"broadcast.tooltip.plus.side": "+%1$d %2$@",
|
||||
"broadcast.tooltip.remove.point": "Quitar punto %1$@",
|
||||
|
||||
@@ -4,6 +4,15 @@ private let sideToolbarWidth: CGFloat = 44
|
||||
private let iconButtonSize: CGFloat = 36
|
||||
private let scoreButtonHeight: CGFloat = 32
|
||||
|
||||
private enum SideConfirmAction {
|
||||
case shareLive
|
||||
case shareRegia
|
||||
case advancePeriod
|
||||
case pauseOrResume
|
||||
case toggleMute
|
||||
case terminate
|
||||
}
|
||||
|
||||
struct BroadcastControlsOverlay: View {
|
||||
let controlsVisible: Bool
|
||||
let onToggleControls: () -> Void
|
||||
@@ -46,7 +55,7 @@ struct BroadcastControlsOverlay: View {
|
||||
var sessionQualityPreset: String = "720p_30_2.5mbps"
|
||||
var onSelectMinQuality: (String) -> Void = { _ in }
|
||||
|
||||
@State private var showTerminateConfirm = false
|
||||
@State private var pendingConfirm: SideConfirmAction?
|
||||
@State private var showMinQualityPicker = false
|
||||
|
||||
var body: some View {
|
||||
@@ -118,11 +127,62 @@ struct BroadcastControlsOverlay: View {
|
||||
)
|
||||
}
|
||||
}
|
||||
.alert(L10n.t("broadcast.terminate.title"), isPresented: $showTerminateConfirm) {
|
||||
Button(L10n.t("action.cancel"), role: .cancel) {}
|
||||
Button(L10n.t("broadcast.terminate.confirm"), role: .destructive, action: onTerminate)
|
||||
} message: {
|
||||
Text(L10n.t("broadcast.terminate.message"))
|
||||
.alert(
|
||||
sideConfirmTitle,
|
||||
isPresented: Binding(
|
||||
get: { pendingConfirm != nil },
|
||||
set: { if !$0 { pendingConfirm = nil } }
|
||||
)
|
||||
) {
|
||||
Button(L10n.t("action.cancel"), role: .cancel) { pendingConfirm = nil }
|
||||
if pendingConfirm == .terminate {
|
||||
Button(L10n.t("broadcast.terminate.confirm"), role: .destructive, action: performPendingConfirm)
|
||||
} else {
|
||||
Button(L10n.t("action.confirm"), action: performPendingConfirm)
|
||||
}
|
||||
} message: {
|
||||
Text(sideConfirmMessage)
|
||||
}
|
||||
}
|
||||
|
||||
private var sideConfirmTitle: String {
|
||||
switch pendingConfirm {
|
||||
case .shareLive: return L10n.t("broadcast.share.live.title")
|
||||
case .shareRegia: return L10n.t("broadcast.share.regia.title")
|
||||
case .advancePeriod: return L10n.t("broadcast.advance.period.title")
|
||||
case .pauseOrResume:
|
||||
return isPaused ? L10n.t("broadcast.resume.title") : L10n.t("broadcast.pause.title")
|
||||
case .toggleMute:
|
||||
return audioMuted ? L10n.t("broadcast.unmute.title") : L10n.t("broadcast.mute.title")
|
||||
case .terminate: return L10n.t("broadcast.terminate.title")
|
||||
case .none: return ""
|
||||
}
|
||||
}
|
||||
|
||||
private var sideConfirmMessage: String {
|
||||
switch pendingConfirm {
|
||||
case .shareLive: return L10n.t("broadcast.share.live.message")
|
||||
case .shareRegia: return L10n.t("broadcast.share.regia.message")
|
||||
case .advancePeriod: return L10n.t("broadcast.advance.period.message")
|
||||
case .pauseOrResume:
|
||||
return isPaused ? L10n.t("broadcast.resume.message") : L10n.t("broadcast.pause.message")
|
||||
case .toggleMute:
|
||||
return audioMuted ? L10n.t("broadcast.unmute.message") : L10n.t("broadcast.mute.message")
|
||||
case .terminate: return L10n.t("broadcast.terminate.message")
|
||||
case .none: return ""
|
||||
}
|
||||
}
|
||||
|
||||
private func performPendingConfirm() {
|
||||
guard let action = pendingConfirm else { return }
|
||||
pendingConfirm = nil
|
||||
switch action {
|
||||
case .shareLive: onShareLive()
|
||||
case .shareRegia: onShareRegia()
|
||||
case .advancePeriod: onAdvancePeriod?()
|
||||
case .pauseOrResume: onPauseOrResume()
|
||||
case .toggleMute: onToggleAudioMute()
|
||||
case .terminate: onTerminate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,13 +191,13 @@ struct BroadcastControlsOverlay: View {
|
||||
SideIconButton(
|
||||
systemName: "square.and.arrow.up",
|
||||
accessibilityLabel: L10n.t("broadcast.share.live.cd"),
|
||||
action: onShareLive,
|
||||
action: { pendingConfirm = .shareLive },
|
||||
enabled: shareLiveEnabled
|
||||
)
|
||||
SideIconButton(
|
||||
systemName: "video.fill",
|
||||
accessibilityLabel: L10n.t("broadcast.share.regia.cd"),
|
||||
action: onShareRegia
|
||||
action: { pendingConfirm = .shareRegia }
|
||||
)
|
||||
SideIconButton(
|
||||
systemName: "slider.horizontal.3",
|
||||
@@ -151,11 +211,11 @@ struct BroadcastControlsOverlay: View {
|
||||
action: onCloseSet
|
||||
)
|
||||
}
|
||||
if let onAdvancePeriod {
|
||||
if onAdvancePeriod != nil {
|
||||
SideIconButton(
|
||||
systemName: "forward.end.fill",
|
||||
accessibilityLabel: L10n.t("broadcast.next.period.cd"),
|
||||
action: onAdvancePeriod
|
||||
action: { pendingConfirm = .advancePeriod }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -168,19 +228,19 @@ struct BroadcastControlsOverlay: View {
|
||||
SideIconButton(
|
||||
systemName: isPaused ? "play.fill" : "pause.fill",
|
||||
accessibilityLabel: isPaused ? L10n.t("broadcast.resume.cd") : L10n.t("broadcast.pause.cd"),
|
||||
action: onPauseOrResume,
|
||||
action: { pendingConfirm = .pauseOrResume },
|
||||
highlighted: isPaused
|
||||
)
|
||||
SideIconButton(
|
||||
systemName: audioMuted ? "speaker.slash.fill" : "speaker.wave.2.fill",
|
||||
accessibilityLabel: audioMuted ? L10n.t("broadcast.unmute.cd") : L10n.t("broadcast.mute.cd"),
|
||||
action: onToggleAudioMute,
|
||||
action: { pendingConfirm = .toggleMute },
|
||||
highlighted: audioMuted
|
||||
)
|
||||
SideIconButton(
|
||||
systemName: "stop.fill",
|
||||
accessibilityLabel: L10n.t("broadcast.terminate.cd"),
|
||||
action: { showTerminateConfirm = true },
|
||||
action: { pendingConfirm = .terminate },
|
||||
danger: true
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import SwiftUI
|
||||
|
||||
enum ScoreDialogKind {
|
||||
case setWon
|
||||
case closeSet
|
||||
case closeSetAnyway
|
||||
case matchWon
|
||||
}
|
||||
@@ -92,10 +93,10 @@ final class LiveScoreActions {
|
||||
awayPoints: score.awayPoints,
|
||||
currentSet: score.currentSet
|
||||
)
|
||||
if winner == nil {
|
||||
let ok = await dialogHost.show(ScoreDialogState(kind: .closeSetAnyway))
|
||||
if !ok { return }
|
||||
}
|
||||
let ok = await dialogHost.show(
|
||||
ScoreDialogState(kind: winner == nil ? .closeSetAnyway : .closeSet)
|
||||
)
|
||||
if !ok { return }
|
||||
guard await scoreController.closeSetAsync() else { return }
|
||||
onScoreboardChanged()
|
||||
await afterCloseSet()
|
||||
@@ -149,6 +150,13 @@ struct ScoreDialogRouter: View {
|
||||
primaryButton: .default(Text(L10n.t("score.action.close.set"))) { host.resolve(true) },
|
||||
secondaryButton: .cancel(Text(L10n.t("score.action.continue.scoring"))) { host.resolve(false) }
|
||||
)
|
||||
case .closeSet:
|
||||
return Alert(
|
||||
title: Text(L10n.t("score.action.close.set")),
|
||||
message: Text(L10n.t("broadcast.close.set.confirm.message")),
|
||||
primaryButton: .default(Text(L10n.t("score.action.close.set"))) { host.resolve(true) },
|
||||
secondaryButton: .cancel(Text(L10n.t("action.cancel"))) { host.resolve(false) }
|
||||
)
|
||||
case .closeSetAnyway:
|
||||
return Alert(
|
||||
title: Text(L10n.t("score.action.close.set")),
|
||||
|
||||
Reference in New Issue
Block a user