Skip to content

Commit 6d80815

Browse files
Removed Total file, Progress was stuck at 0% fixed and added stop or cancel transfer
total 43872768 in every folder — phantom row, now gone That wasn't a file at all — it was ls -la's total N summary line being parsed as an entry. The parser skipped empty lines but not this, so it appeared in every folder with a checkbox. One-line fix to skip /^total\s+\d+$/. (Selecting it before would also have poisoned downloads with a guaranteed-failed entry.) 2. Stuck "0%" while gigabytes move Your screenshot shows the exact failure: stat gave no usable total for that file, so the UI sat at 0% with "Calculating…" while 1.5 GB flowed. Two fixes: Sizes now travel with the request — the file list already knows every size from ls, so selections carry a sizeHint and the first progress event has totals immediately (verified: first event carried totalBytes: 67203777). Bytes-moved headline — when no total exists, the big readout shows 1.5 GB transferred instead of a lying 0% complete. 3. Upload MBs adb push reports nothing mid-flight, so the main process now runs the push as a tracked child while polling the remote size every 500ms. Proven live: a 67MB upload emitted 54%, 89% with real byte counts; totals are announced up-front from local stat. 4. Stop button New Stop button in the sheet header (× still just hides to the pill). A transfer registry tracks live child processes per transfer ID; Stop kills them, loops abort between files, and handlers report {cancelled: true} so the sheet shows "Transfer cancelled" instead of an error. Batch return shapes changed to {results, cancelled} — call sites updated. Also fixed as a bonus: progress events now carry the transfer ID, so a previous transfer's late events can't paint over a new one.
1 parent 66ba188 commit 6d80815

13 files changed

Lines changed: 2761 additions & 395 deletions

File tree

‎assets/classes.dex‎

6.35 KB
Binary file not shown.

‎main.js‎

Lines changed: 722 additions & 166 deletions
Large diffs are not rendered by default.

‎preload.js‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ contextBridge.exposeInMainWorld('api', {
5555
// files
5656
listFiles: (serial, remotePath) => ipcRenderer.invoke('files:list', { serial, remotePath }),
5757
previewFile: (serial, remotePath) => ipcRenderer.invoke('files:preview', { serial, remotePath }),
58-
pullFile: (serial, remotePath) => ipcRenderer.invoke('files:pull', { serial, remotePath }),
59-
pullBatch: (serial, files, destDir) => ipcRenderer.invoke('files:pullBatch', { serial, files, destDir }),
60-
pushFile: (serial, remoteDir) => ipcRenderer.invoke('files:push', { serial, remoteDir }),
61-
pushBatch: (serial, remoteDir) => ipcRenderer.invoke('files:pushBatch', { serial, remoteDir }),
62-
pushBatchFiles: (serial, remoteDir, filePaths) => ipcRenderer.invoke('files:pushBatchFiles', { serial, remoteDir, filePaths }),
58+
pullFile: (serial, remotePath, opts) => ipcRenderer.invoke('files:pull', { serial, remotePath, ...(opts || {}) }),
59+
pullBatch: (serial, files, destDir, opts) => ipcRenderer.invoke('files:pullBatch', { serial, files, destDir, ...(opts || {}) }),
60+
pushFile: (serial, remoteDir, opts) => ipcRenderer.invoke('files:push', { serial, remoteDir, ...(opts || {}) }),
61+
pushBatch: (serial, remoteDir, opts) => ipcRenderer.invoke('files:pushBatch', { serial, remoteDir, ...(opts || {}) }),
62+
pushBatchFiles: (serial, remoteDir, filePaths, opts) => ipcRenderer.invoke('files:pushBatchFiles', { serial, remoteDir, filePaths, ...(opts || {}) }),
63+
cancelTransfer: (transferId) => ipcRenderer.invoke('files:cancelTransfer', { transferId }),
6364
deleteFile: (serial, remotePath) => ipcRenderer.invoke('files:delete', { serial, remotePath }),
6465
onPullProgress: (cb) => ipcRenderer.on('files:pullProgress', (_e, data) => cb(data)),
6566
onPushProgress: (cb) => ipcRenderer.on('files:pushProgress', (_e, data) => cb(data)),
@@ -104,9 +105,11 @@ contextBridge.exposeInMainWorld('api', {
104105
stopAudio: () => ipcRenderer.invoke('audio:stop'),
105106
audioStatus: () => ipcRenderer.invoke('audio:status'),
106107
setVolume: (serial, level) => ipcRenderer.invoke('audio:setVolume', { serial, level }),
107-
mediaKey: (serial, action) => ipcRenderer.invoke('media:key', { serial, action }),
108+
getVolume: (serial) => ipcRenderer.invoke('audio:getVolume', serial),
109+
mediaKey: (serial, action, pkg) => ipcRenderer.invoke('media:key', { serial, action, package: pkg }),
108110
nowPlaying: (serial) => ipcRenderer.invoke('media:nowPlaying', serial),
109111
artwork: (serial, uri) => ipcRenderer.invoke('media:artwork', { serial, uri }),
112+
artworkBatch: (serial, uris) => ipcRenderer.invoke('media:artworkBatch', { serial, uris }),
110113

111114
// camera
112115
listCameras: (serial) => ipcRenderer.invoke('camera:list', serial),

‎r8.jar‎

14.6 MB
Binary file not shown.

‎renderer/controlbar.js‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,17 @@ if (!serial) {
136136
}
137137
window.api.cameraRecordStatus().then((active) => { camRecording = !!active; paintCamRec(); }).catch(() => {});
138138

139-
action('c-stop', () => window.api.stopCamera(), { busy: 'Stopping camera…' });
139+
action('c-stop', () => window.api.stopCamera(), {
140+
busy: 'Stopping camera…',
141+
done: (res) => {
142+
// A stop also ends an in-flight recording (finalized main-side).
143+
camRecording = false;
144+
paintCamRec();
145+
if (res && res.recording) return `Stopped — saved ${String(res.recording).split(/[\\/]/).pop()}`;
146+
if (res && res.recordError) return 'Stopped — recording failed';
147+
return 'Stopped';
148+
},
149+
});
140150

141151
action('a-redock', () => window.api.cameraRedock(), {
142152
done: (ok) => (ok ? 'Snapped back under the video' : 'No docked session'),

‎renderer/index.html‎

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,6 @@ <h3><span class="head-dot" style="background:var(--cat-photos)"></span>Storage</
281281
<span id="file-sel-count" class="muted tiny"></span>
282282
<button id="file-download-btn" class="primary-btn tiny" disabled>Download selected</button>
283283
<button id="file-upload-btn" class="ghost-btn tiny" disabled>Upload to here</button>
284-
<div id="file-transfer-progress" class="transfer-progress hidden">
285-
<div class="transfer-bar"><div id="file-transfer-fill" class="transfer-fill"></div></div>
286-
<span id="file-transfer-label" class="muted tiny"></span>
287-
</div>
288284
</div>
289285
<div id="file-list" class="mono file-list"></div>
290286
<div id="file-drop-overlay" class="file-drop-overlay hidden">
@@ -1067,6 +1063,54 @@ <h3>Android system binaries &amp; drivers</h3>
10671063
</div>
10681064
</div>
10691065

1066+
<!-- Transfer center: floating sheet for file uploads/downloads -->
1067+
<div id="transfer-pill" class="transfer-pill hidden" title="Show transfers">
1068+
<span id="transfer-pill-icon">&#11015;</span><span id="transfer-pill-text" class="mono">0%</span>
1069+
</div>
1070+
<section id="transfer-center" class="transfer-center hidden" aria-live="polite">
1071+
<div class="tc-grip"></div>
1072+
<div class="tc-head">
1073+
<span id="tc-icon" class="tc-icon">&#11015;</span>
1074+
<span id="tc-title" class="tc-title">Transferring Files</span>
1075+
<span id="tc-count" class="tc-count-pill">0 items</span>
1076+
<span class="tc-head-spacer"></span>
1077+
<button id="tc-stop" class="ghost-btn tiny hidden" title="Stop this transfer">Stop</button>
1078+
<button id="tc-collapse" class="icon-btn" title="Collapse">&#9662;</button>
1079+
<button id="tc-close" class="icon-btn" title="Close">&times;</button>
1080+
</div>
1081+
<div id="tc-body">
1082+
<div class="tc-overall-row">
1083+
<span id="tc-pct" class="tc-pct">0%</span><span id="tc-complete-word" class="tc-complete muted">complete</span>
1084+
<span class="tc-head-spacer"></span>
1085+
<span id="tc-eta" class="tc-eta">Calculating&hellip;</span>
1086+
</div>
1087+
<div class="transfer-bar tc-overall-bar"><div id="tc-overall-fill" class="transfer-fill"></div></div>
1088+
<div class="tc-meta-row">
1089+
<span id="tc-speed" class="tc-speed mono">&mdash;</span>
1090+
<span class="tc-head-spacer"></span>
1091+
<span id="tc-totals" class="tc-totals mono">&mdash;</span>
1092+
</div>
1093+
<div id="tc-route" class="tc-route muted"></div>
1094+
<div id="tc-active" class="tc-active hidden">
1095+
<div class="tc-active-top">
1096+
<span id="tc-active-idx" class="tc-active-idx">ACTIVE ITEM</span>
1097+
<span class="tc-head-spacer"></span>
1098+
<span id="tc-active-pct" class="tc-active-pct mono">0%</span>
1099+
</div>
1100+
<div class="tc-active-main">
1101+
<span id="tc-active-icon" class="tc-item-icon">&#128196;</span>
1102+
<span class="tc-active-text">
1103+
<span id="tc-active-name" class="tc-active-name"></span>
1104+
<span id="tc-active-sub" class="tc-active-sub muted"></span>
1105+
</span>
1106+
</div>
1107+
<div class="transfer-bar tc-item-bar"><div id="tc-active-fill" class="transfer-fill"></div></div>
1108+
</div>
1109+
<div class="tc-queue-head"><span id="tc-queue-title">Transfer Queue</span></div>
1110+
<div id="tc-queue" class="tc-queue"></div>
1111+
</div>
1112+
</section>
1113+
10701114
<script src="renderer.js"></script>
10711115
</body>
10721116
</html>

0 commit comments

Comments
 (0)