mirror of
https://github.com/smittix/intercept.git
synced 2026-07-14 20:48:11 -07:00
fix(bluetooth): fix locate button not switching to bt_locate mode
Remove the split fast-path in doLocateHandoff that called BtLocate.handoff()
directly when the module was already loaded. That path relied on handoff()
internally calling switchMode, causing a double switchMode in the lazy-load
path and no guaranteed mode switch in the fast path.
Now doLocateHandoff always calls switchMode('bt_locate') first (lazy-loading
script/styles as needed), then calls BtLocate.handoff() in .then(). Removed
the redundant switchMode call from BtLocate.handoff() since the caller owns
the mode transition.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1790,14 +1790,8 @@ const BluetoothMode = (function() {
|
|||||||
mac_cluster_count: device.mac_cluster_count || 0
|
mac_cluster_count: device.mac_cluster_count || 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// If BtLocate is already loaded, hand off directly
|
// Always switch to bt_locate mode first (loads script + styles if needed,
|
||||||
if (typeof BtLocate !== 'undefined') {
|
// initializes the module), then hand off device data.
|
||||||
BtLocate.handoff(payload);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Switch to bt_locate mode first — this loads the script, styles,
|
|
||||||
// and initializes the module. Then hand off the device data.
|
|
||||||
if (typeof switchMode === 'function') {
|
if (typeof switchMode === 'function') {
|
||||||
switchMode('bt_locate').then(function() {
|
switchMode('bt_locate').then(function() {
|
||||||
if (typeof BtLocate !== 'undefined') {
|
if (typeof BtLocate !== 'undefined') {
|
||||||
|
|||||||
@@ -1792,11 +1792,6 @@ const BtLocate = (function() {
|
|||||||
const irkInput = document.getElementById('btLocateIrk');
|
const irkInput = document.getElementById('btLocateIrk');
|
||||||
if (irkInput) irkInput.value = deviceInfo.irk_hex;
|
if (irkInput) irkInput.value = deviceInfo.irk_hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to bt_locate mode
|
|
||||||
if (typeof switchMode === 'function') {
|
|
||||||
switchMode('bt_locate');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearHandoff() {
|
function clearHandoff() {
|
||||||
|
|||||||
Reference in New Issue
Block a user