@8bitbish/screenshot-service 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -320,6 +320,34 @@
320
320
  font-size: 12px;
321
321
  font-weight: 500;
322
322
  }
323
+ .dev-mode-banner {
324
+ margin: 8px 0 20px;
325
+ padding: 14px 16px;
326
+ background: rgba(241, 192, 98, 0.08);
327
+ border: 1px solid rgba(241, 192, 98, 0.4);
328
+ border-radius: 10px;
329
+ color: var(--text);
330
+ }
331
+ .dev-mode-banner h4 {
332
+ margin: 0 0 6px;
333
+ color: var(--warn);
334
+ font-size: 13px;
335
+ font-weight: 600;
336
+ text-transform: uppercase;
337
+ letter-spacing: 0.06em;
338
+ }
339
+ .dev-mode-banner ol {
340
+ margin: 8px 0 0;
341
+ padding-left: 20px;
342
+ font-size: 13.5px;
343
+ color: var(--text);
344
+ }
345
+ .dev-mode-banner ol li { margin: 4px 0; color: var(--text); }
346
+ .dev-mode-banner .auto-note {
347
+ margin-top: 10px;
348
+ font-size: 12.5px;
349
+ color: var(--muted);
350
+ }
323
351
  .device-row.flash-new {
324
352
  background: rgba(61, 220, 151, 0.14);
325
353
  border-color: rgba(61, 220, 151, 0.55);
@@ -446,6 +474,17 @@
446
474
  <p class="muted" id="dm-sub">These are connected right now. Add as many as you want.</p>
447
475
  <ul class="device-list" id="device-list"></ul>
448
476
  <div class="empty-state" id="device-empty" style="display: none"></div>
477
+ <div class="dev-mode-banner" id="dev-mode-banner" style="display: none">
478
+ <h4>Finish on your iPhone</h4>
479
+ <div id="dev-mode-banner-detail">We've just unlocked the Developer Mode option in your iPhone's Settings. Apple requires you to flip the toggle yourself — it can't be done from this Mac when a passcode is set.</div>
480
+ <ol>
481
+ <li>On your iPhone, open <strong>Settings → Privacy &amp; Security → Developer Mode</strong> <em>(it's now visible)</em></li>
482
+ <li>Toggle <strong>Developer Mode</strong> on</li>
483
+ <li>Tap <strong>Restart</strong> when prompted</li>
484
+ <li>After the iPhone reboots, tap <strong>Turn On</strong> and enter your passcode</li>
485
+ </ol>
486
+ <div class="auto-note"><span class="live-dot"></span> We'll detect it automatically once it's on — no need to come back here.</div>
487
+ </div>
449
488
  <div class="add-row">
450
489
  <button class="btn ghost" id="btn-add-device">+ Add another device</button>
451
490
  </div>
@@ -486,7 +525,7 @@
486
525
  let lastDevices = []; // most recent listDevices() result
487
526
  let pendingAddSnapshot = null; // Set<string> of device IDs at the moment user clicked "+ Add"
488
527
  let history = [];
489
- const devModeRequested = new Set(); // device IDs for which we've already sent enableIosDevMode
528
+ const revealedUdids = new Set(); // UDIDs we've already called reveal-developer-mode on this session
490
529
 
491
530
  function show(name, label) {
492
531
  for (const k in screens) screens[k].classList.remove('active');
@@ -564,14 +603,10 @@
564
603
  (needsDevMode ? ' needs-action' : (d.available ? '' : ' unavailable')) +
565
604
  (flashNew ? ' flash-new' : '');
566
605
 
567
- // Right side: button (dev-mode action) OR status (when unavailable for other reason) OR nothing
606
+ // Right side status text. Instructions for fixing dev-mode live in the banner below the list.
568
607
  let rightSide = '';
569
608
  if (needsDevMode) {
570
- if (devModeRequested.has(d.id)) {
571
- rightSide = `<span class="row-pending">On iPhone: toggle on &amp; restart</span>`;
572
- } else {
573
- rightSide = `<button class="row-action" data-action="enable-dev-mode">Open on iPhone</button>`;
574
- }
609
+ rightSide = `<span class="row-pending">Needs Developer Mode</span>`;
575
610
  } else if (!d.available && d.unavailableReason) {
576
611
  rightSide = `<span class="status">${escapeHtml(d.unavailableReason)}</span>`;
577
612
  }
@@ -585,28 +620,6 @@
585
620
  rightSide;
586
621
 
587
622
  if (!existing) listEl.appendChild(li);
588
-
589
- // Wire the action button (idempotent — re-attached on every render)
590
- const actionBtn = li.querySelector('button.row-action');
591
- if (actionBtn) {
592
- actionBtn.onclick = () => sendEnableDevMode(d.id, actionBtn);
593
- }
594
- }
595
-
596
- async function sendEnableDevMode(deviceId, buttonEl) {
597
- buttonEl.disabled = true;
598
- buttonEl.textContent = 'Opening…';
599
- try {
600
- await window.wizard.enableIosDevMode(deviceId);
601
- devModeRequested.add(deviceId);
602
- // Re-render the row immediately so the action swaps to instructions.
603
- const fresh = lastDevices.find(x => x.id === deviceId);
604
- if (fresh) renderDeviceRow($('device-list'), fresh, new Set());
605
- } catch (err) {
606
- buttonEl.disabled = false;
607
- buttonEl.textContent = 'Try again';
608
- alert(`Couldn't open Developer Mode on the iPhone: ${err.message || err}`);
609
- }
610
623
  }
611
624
  function escapeHtml(s) {
612
625
  return String(s).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -621,11 +634,18 @@
621
634
  async function refreshDeviceManager(justAddedIds = new Set()) {
622
635
  const devs = await window.wizard.listDevices();
623
636
  lastDevices = devs;
624
- // Clear "request sent" state for any iPhone whose Developer Mode has flipped to ON.
625
- for (const id of Array.from(devModeRequested)) {
626
- const d = devs.find(x => x.id === id);
627
- if (!d || d.developerMode === true) devModeRequested.delete(id);
637
+
638
+ // Auto-reveal Developer Mode for any iPhone that needs it. The call tells iOS to
639
+ // surface the Developer Mode toggle in Settings → Privacy & Security so the user
640
+ // can actually find it (Apple hides this item until a Mac requests it). Once per
641
+ // session per device — re-running has no effect on the iPhone.
642
+ for (const d of devs) {
643
+ if (d.platform === 'ios' && d.developerMode === false && !revealedUdids.has(d.id)) {
644
+ revealedUdids.add(d.id);
645
+ window.wizard.enableIosDevMode(d.id).catch(() => {}); // best-effort, banner has the same info anyway
646
+ }
628
647
  }
648
+
629
649
  const mine = devs.filter(d => d.platform === platform);
630
650
  const listEl = $('device-list');
631
651
  const emptyEl = $('device-empty');
@@ -647,6 +667,14 @@
647
667
  emptyEl.style.display = 'none';
648
668
  for (const d of mine) renderDeviceRow(listEl, d, justAddedIds);
649
669
  }
670
+
671
+ // Show the Developer Mode banner if any connected iPhone needs it.
672
+ const banner = $('dev-mode-banner');
673
+ if (banner) {
674
+ const needyCount = mine.filter(d => d.platform === 'ios' && d.developerMode === false).length;
675
+ banner.style.display = needyCount > 0 ? '' : 'none';
676
+ }
677
+
650
678
  return mine;
651
679
  }
652
680
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@8bitbish/screenshot-service",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Capture screenshots and recordings from connected iPhone and Android devices, with a built-in visual setup wizard.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",