@8bitbish/screenshot-service 1.2.1 → 1.2.2

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>Developer Mode needed</h4>
479
+ <div id="dev-mode-banner-detail">Your iPhone needs Developer Mode turned on before screenshot capture will work.</div>
480
+ <ol>
481
+ <li>On your iPhone: <strong>Settings → Privacy &amp; Security → Developer Mode</strong></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,6 @@
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
490
528
 
491
529
  function show(name, label) {
492
530
  for (const k in screens) screens[k].classList.remove('active');
@@ -564,14 +602,10 @@
564
602
  (needsDevMode ? ' needs-action' : (d.available ? '' : ' unavailable')) +
565
603
  (flashNew ? ' flash-new' : '');
566
604
 
567
- // Right side: button (dev-mode action) OR status (when unavailable for other reason) OR nothing
605
+ // Right side status text. Instructions for fixing dev-mode live in the banner below the list.
568
606
  let rightSide = '';
569
607
  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
- }
608
+ rightSide = `<span class="row-pending">Needs Developer Mode</span>`;
575
609
  } else if (!d.available && d.unavailableReason) {
576
610
  rightSide = `<span class="status">${escapeHtml(d.unavailableReason)}</span>`;
577
611
  }
@@ -585,28 +619,6 @@
585
619
  rightSide;
586
620
 
587
621
  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
622
  }
611
623
  function escapeHtml(s) {
612
624
  return String(s).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
@@ -621,11 +633,6 @@
621
633
  async function refreshDeviceManager(justAddedIds = new Set()) {
622
634
  const devs = await window.wizard.listDevices();
623
635
  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);
628
- }
629
636
  const mine = devs.filter(d => d.platform === platform);
630
637
  const listEl = $('device-list');
631
638
  const emptyEl = $('device-empty');
@@ -647,6 +654,14 @@
647
654
  emptyEl.style.display = 'none';
648
655
  for (const d of mine) renderDeviceRow(listEl, d, justAddedIds);
649
656
  }
657
+
658
+ // Show the Developer Mode banner if any connected iPhone needs it.
659
+ const banner = $('dev-mode-banner');
660
+ if (banner) {
661
+ const needyCount = mine.filter(d => d.platform === 'ios' && d.developerMode === false).length;
662
+ banner.style.display = needyCount > 0 ? '' : 'none';
663
+ }
664
+
650
665
  return mine;
651
666
  }
652
667
 
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.2",
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",