mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
refactor: separate voice controls and configurable Realtime connections
This commit is contained in:
1 parent
0ba00f4662
commit
1a1cbadf5b
21 files changed
+3126
-2793
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/** Read layer lifecycle through the supplied manager. */
|
||||
export function readLayerLifecycleSummary(
|
||||
dataManager,
|
||||
layerId,
|
||||
{ fallbackEnabled = false } = {},
|
||||
) {
|
||||
let lifecycle = null;
|
||||
try {
|
||||
lifecycle = dataManager?.getLayerLifecycleState?.(layerId) || null;
|
||||
} catch {
|
||||
lifecycle = null;
|
||||
}
|
||||
if (lifecycle) {
|
||||
const enabled = Boolean(lifecycle.enabled);
|
||||
return {
|
||||
enabled,
|
||||
lifecycleState:
|
||||
lifecycle.lifecycleState || (enabled ? 'enabled' : 'disabled'),
|
||||
lifecycleUncertain: Boolean(
|
||||
lifecycle.uncertain ?? lifecycle.lifecycleUncertain,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
let enabled = Boolean(fallbackEnabled);
|
||||
try {
|
||||
const managerEnabled = dataManager?.isEnabled?.(layerId);
|
||||
if (typeof managerEnabled === 'boolean') enabled = managerEnabled;
|
||||
} catch {
|
||||
// Retain the caller's observed fallback when the lightweight adapter fails.
|
||||
}
|
||||
return {
|
||||
enabled,
|
||||
lifecycleState: enabled ? 'enabled' : 'disabled',
|
||||
lifecycleUncertain: false,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user