MCPcopy Create free account
hub / github.com/Roy3838/Observer / toggleLockPhone

Function toggleLockPhone

app/src/components/EditAgent/SimpleCreatorModal.tsx:398–410  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

396 // tile asks for it here, from the tap. The tile only turns on once it's granted.
397 const [lockPhoneError, setLockPhoneError] = useState<string | null>(null);
398 const toggleLockPhone = async () => {
399 setLockPhoneError(null);
400 if (selectedTools.has('lock_phone')) { toggleTool('lock_phone'); return; }
401 try {
402 let status = await getPhoneLockStatus();
403 if (!status.supported) { setLockPhoneError('Needs iOS 16 or later.'); return; }
404 if (!status.authorized) status = await requestPhoneLockPermission();
405 if (status.authorized) toggleTool('lock_phone');
406 else setLockPhoneError(`Needs ${phoneLockPermissionName()}. Tap again to allow it.`);
407 } catch {
408 setLockPhoneError(`Needs ${phoneLockPermissionName()}. Tap again to allow it.`);
409 }
410 };
411
412 // --- MODIFIED: toggleTool now handles showing/hiding warnings ---
413 const toggleTool = (tool: SimpleTool) => {

Callers

nothing calls this directly

Calls 4

getPhoneLockStatusFunction · 0.90
phoneLockPermissionNameFunction · 0.90
toggleToolFunction · 0.85

Tested by

no test coverage detected