Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions plugins/input_setup/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,25 @@

host.querySelector('[data-is-cal]').addEventListener('click', () => {
if (hasDetector) {
// Hide our own full-screen overlay while note_detect's
// Calibration Wizard runs on top. That wizard goes
// transparent (pointer-events:none) when it minimizes to
// expose the Tuner; if our overlay stayed up it would show
// through — covering the tuner with the still-mounted
// "select your input" card and looking like a second
// wizard at the input step. Restore it on done/cancel
// (one of which always fires when that wizard closes).
const ov = document.getElementById('input-setup-overlay');
const prevDisplay = ov ? ov.style.display : '';
if (ov) ov.style.display = 'none';
const restore = () => {
const o = document.getElementById('input-setup-overlay');
if (o) o.style.display = prevDisplay;
};
window.noteDetect.launchCalibration({
instrument: inst,
onDone: () => advance(inst, true),
onCancel: () => { /* stay on this panel; user can skip or retry */ },
onDone: () => { restore(); advance(inst, true); },
onCancel: () => { restore(); /* stay on this panel; user can skip or retry */ },
});
} else {
advance(inst, true);
Expand Down
48 changes: 32 additions & 16 deletions static/v3/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,39 @@
if (!instruments.length) return;
// Don't let a plugin-load race skip the mandatory input-setup step.
if (!(await waitForInputSetup(8000))) return;
const caps = window.feedBack && window.feedBack.capabilities;
if (!caps || typeof caps.command !== 'function') {
try { await window.feedBackInputSetup.launch(instruments); } catch (e) { /* proceed */ }
return;
// Hide this onboarding modal while the input-setup wizard (its own
// full-screen overlay) runs on top. Otherwise both stay stacked, and when
// the note-detect calibration wizard minimizes to expose the Tuner the
// onboarding modal shows through behind the tuner. Restored in `finally`
// before we advance to the calibration-challenge step.
const ob = document.getElementById('v3-onboarding');
const obPrevDisplay = ob ? ob.style.display : '';
if (ob) ob.style.display = 'none';
const restoreOnboarding = () => {
const o = document.getElementById('v3-onboarding');
if (o) o.style.display = obPrevDisplay;
};
try {
const caps = window.feedBack && window.feedBack.capabilities;
if (!caps || typeof caps.command !== 'function') {
try { await window.feedBackInputSetup.launch(instruments); } catch (e) { /* proceed */ }
return;
}
await new Promise((resolve) => {
let settled = false;
let unsub = null;
const done = () => { if (settled) return; settled = true; try { unsub && unsub(); } catch (e) { /* noop */ } resolve(); };
try { unsub = typeof caps.subscribe === 'function' ? caps.subscribe('input-calibration:calibration-done', done) : null; } catch (e) { unsub = null; }
// `run` is fire-and-launch; completion arrives via the event above.
// A non-handled outcome (no owner / plugin absent / error) means
// nothing was launched, so proceed immediately.
caps.command('input-calibration', 'run', { requester: 'onboarding', payload: { instruments } })
.then((r) => { if (!r || r.outcome !== 'handled') done(); })
.catch(() => done());
});
} finally {
restoreOnboarding();
}
await new Promise((resolve) => {
let settled = false;
let unsub = null;
const done = () => { if (settled) return; settled = true; try { unsub && unsub(); } catch (e) { /* noop */ } resolve(); };
try { unsub = typeof caps.subscribe === 'function' ? caps.subscribe('input-calibration:calibration-done', done) : null; } catch (e) { unsub = null; }
// `run` is fire-and-launch; completion arrives via the event above.
// A non-handled outcome (no owner / plugin absent / error) means
// nothing was launched, so proceed immediately.
caps.command('input-calibration', 'run', { requester: 'onboarding', payload: { instruments } })
.then((r) => { if (!r || r.outcome !== 'handled') done(); })
.catch(() => done());
});
}

function show(profile, opts) {
Expand Down
Loading