PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
feat(ui): add a Send Files page with a radar of paired devices
baiyuze480b66101861
diff --git a/ui/lib/app_state.dart b/ui/lib/app_state.dartindex 9d96808..e12b181 100644--- a/ui/lib/app_state.dart+++ b/ui/lib/app_state.dart@@ -18,6 +18,9 @@ enum LinkState { connecting, online, offline }/// 生成的配对码,以及本机的局域网地址(不在同一网段时对方要输入)。typedef PairingCode = ({String code, List<String> addresses});+/// 隔空传送发不出去的原因,后台服务把它写在错误消息里(见 rpc/send.go)。+enum SendFailure { offline, unsupported, disabled, needRelayConsent, noPaths, unknownDevice, other }+/// 配对失败的原因。后台服务把原因写在错误消息开头(见 rpc/server.go 的 pairingStatus)。enum PairingFailure {notFound,@@ -63,6 +66,13 @@ class AppState extends ChangeNotifier implements RecordDetails {/// 快捷粘贴窗口的状态,由后台服务转来;没连上时为 nullQuickPasteStatus? _quickPaste;+ /// 隔空传送的传输记录,收到的和发出的都在里面,按时间倒序。见 design/send-files.md+ final List<Transfer> _transfers = [];++ /// 后台服务要界面切到的页面(点了隔空传送的通知),每次请求 serial 加一+ String _pageRequest = '';+ int _pageRequestSerial = 0;+/// 正在传输的记录的进度(0–1),只在界面上展示,传完即移除。final Map<String, double> _progress = {};final Map<String, ClipboardWriteResult> _clipboardResults = {};@@ -105,6 +115,41 @@ class AppState extends ChangeNotifier implements RecordDetails {QuickPasteStatus? get quickPaste => _quickPaste;+ List<Transfer> transfers(TransferDirection direction) =>+ List.unmodifiable(_transfers.where((t) => t.direction == direction));++ /// 收到了、还没在隔空传送页看过的批数(侧边栏的数字)+ int get unseenTransfers => _transfers+ .where((t) => t.direction == TransferDirection.TRANSFER_DIRECTION_INCOMING && !t.seen && t.status == 'done')+ .length;++ /// 正在收发的批次(统计、等待、传输中),侧边栏据此显示进度环+ List<Transfer> get activeTransfers =>+ _transfers.where((t) => const {'scanning', 'waiting', 'active'}.contains(t.status)).toList();++ /// 所有正在传的批次合起来的进度(0–1);没有在传的为 null+ double? get transferProgress {+ var total = 0, done = 0;+ for (final t in _transfers) {+ if (t.status != 'active' && t.status != 'waiting') continue;+ total += t.totalBytes.toInt();+ done += t.doneBytes.toInt();+ }+ if (total <= 0) return activeTransfers.isEmpty ? null : 0;+ return (done / total).clamp(0.0, 1.0);+ }++ /// 正在发给这台设备的一批(雷达上的进度环)+ Transfer? sendingTo(String deviceId) => _transfers+ .where((t) =>+ t.direction == TransferDirection.TRANSFER_DIRECTION_OUTGOING &&+ t.deviceId == deviceId &&+ const {'scanning', 'waiting', 'active', 'queued'}.contains(t.status))+ .lastOrNull;++ String get pageRequest => _pageRequest;+ int get pageRequestSerial => _pageRequestSerial;+/// 正在搜索复制记录(搜索词不是空白)。bool get searching => _historySearch.active;String get searchQuery => _historySearch.query.trim();@@ -231,6 +276,7 @@ class AppState extends ChangeNotifier implements RecordDetails {await _loadQuickPasteStatus();await _loadDevices();+ await _loadTransfers();await refreshNotificationStatus();_events = conn.client@@ -338,6 +384,7 @@ class AppState extends ChangeNotifier implements RecordDetails {LinkState link = LinkState.online,ServiceState? serviceState,QuickPasteStatus? quickPaste,+ List<Transfer> transfers = const [],}) {_status = status;_config = config;@@ -350,6 +397,9 @@ class AppState extends ChangeNotifier implements RecordDetails {..clear()..addAll(favorites);_quickPaste = quickPaste;+ _transfers+ ..clear()+ ..addAll(transfers);_pendingPairing = pendingPairing;_serviceState = serviceState;_link = link;@@ -457,6 +507,16 @@ class AppState extends ChangeNotifier implements RecordDetails {case Event_Payload.progress:_onProgress(ev.progress);+ case Event_Payload.transferChanged:+ _upsertTransfer(ev.transferChanged);++ case Event_Payload.transferRemoved:+ _transfers.removeWhere((t) => t.id == ev.transferRemoved);++ case Event_Payload.navigate:+ _pageRequest = ev.navigate;+ _pageRequestSerial++;+default:break;}@@ -513,6 +573,30 @@ class AppState extends ChangeNotifier implements RecordDetails {}}+ void _upsertTransfer(Transfer t) {+ final i = _transfers.indexWhere((x) => x.id == t.id);+ if (i >= 0) {+ _transfers[i] = t;+ } else {+ final at = _transfers.indexWhere((x) => x.createdAtUnix < t.createdAtUnix);+ _transfers.insert(at < 0 ? _transfers.length : at, t);+ }+ }++ Future<void> _loadTransfers() async {+ final conn = _conn;+ if (conn == null) return;+ try {+ final resp = await conn.client.listTransfers(ListTransfersRequest(limit: 500));+ _transfers+ ..clear()+ ..addAll(resp.transfers);+ } on GrpcError {+ // 更新期间连上的可能还是不认识隔空传送的旧版后台服务+ _transfers.clear();+ }+ }+/// 测试用:直接注入一条后台服务的事件。@visibleForTestingvoid debugEvent(Event ev) => _onEvent(ev);@@ -795,6 +879,58 @@ class AppState extends ChangeNotifier implements RecordDetails {options: CallOptions(timeout: const Duration(seconds: 20)),);+ // ─────────────────────────── 隔空传送 ───────────────────────────++ /// 把文件发给一台设备。要经官方服务中转而用户还没同意时抛出 SendFailure.needRelayConsent。+ Future<Transfer> sendFiles(String deviceId, List<String> paths, {bool allowRelay = false}) async {+ final t = await _client.sendFiles(+ SendFilesRequest(deviceId: deviceId, paths: paths, allowRelay: allowRelay),+ );+ _upsertTransfer(t);+ notifyListeners();+ return t;+ }++ Future<void> cancelTransfer(String id) => _client.cancelTransfer(TransferRef(id: id));++ Future<void> resumeTransfer(String id) => _client.resumeTransfer(TransferRef(id: id));++ /// 只删记录,不删文件。+ Future<void> deleteTransfers({List<String>? ids, TransferDirection? clearAll}) async {+ await _client.deleteTransfers(DeleteTransfersRequest(+ ids: ids ?? const [],+ all: clearAll != null,+ direction: clearAll ?? TransferDirection.TRANSFER_DIRECTION_UNSPECIFIED,+ ));+ }++ /// 打开隔空传送页时调用:侧边栏的数字清零。+ Future<void> markTransfersSeen() async {+ if (unseenTransfers == 0 || _conn == null) return;+ try {+ await _client.markTransfersSeen(Empty());+ } on GrpcError {+ // 旧版后台服务没有这个接口+ }+ }++ /// 检查保存位置能否写入;macOS 上会在这时触发系统的文件夹授权。+ Future<CheckReceiveDirResponse> checkReceiveDir([String path = '']) =>+ _client.checkReceiveDir(CheckReceiveDirRequest(path: path));++ static SendFailure sendFailure(Object e) {+ if (e is! GrpcError) return SendFailure.other;+ return switch ((e.message ?? '').split(':').first.trim()) {+ 'offline' => SendFailure.offline,+ 'unsupported' => SendFailure.unsupported,+ 'disabled' => SendFailure.disabled,+ 'relay' => SendFailure.needRelayConsent,+ 'no_paths' => SendFailure.noPaths,+ 'unknown_device' => SendFailure.unknownDevice,+ _ => SendFailure.other,+ };+ }+Future<void> requestClipboardPermission() =>_client.requestClipboardPermission(Empty());diff --git a/ui/lib/icons.dart b/ui/lib/icons.dartindex 0fba2ce..c77b87b 100644--- a/ui/lib/icons.dart+++ b/ui/lib/icons.dart@@ -57,5 +57,9 @@ abstract final class AppIcons {static IconData get starFill => _pick(CupertinoIcons.star_fill, FluentIcons.star_24_filled);static IconData get keyboard => _pick(CupertinoIcons.keyboard, FluentIcons.keyboard_24_regular);// 回车键:快捷窗口底栏的按键提示里用。字符 ↩ 在 Mac 上会被画成彩色 emoji,所以用图标+ // 隔空传送:侧边栏的纸飞机,列表里收到(向下)与发出(向上)+ static IconData get send => _pick(CupertinoIcons.paperplane, FluentIcons.send_24_regular);+ static IconData get arrowDown => _pick(CupertinoIcons.arrow_down, FluentIcons.arrow_down_24_regular);+ static IconData get arrowUp => _pick(CupertinoIcons.arrow_up, FluentIcons.arrow_up_24_regular);static IconData get returnKey => _pick(CupertinoIcons.return_icon, FluentIcons.arrow_enter_left_20_regular);}diff --git a/ui/lib/l10n/app_en.arb b/ui/lib/l10n/app_en.arbindex 0bc34c7..cc7ba64 100644--- a/ui/lib/l10n/app_en.arb+++ b/ui/lib/l10n/app_en.arb@@ -901,5 +901,358 @@"type": "String"}}- }+ },+ "navSend": "Send Files",+ "sendSubtitle": "Drag files onto a device to send them directly",+ "sendNoDevicesTitle": "No paired devices yet",+ "sendNoDevicesBody": "Pair another computer first, then send files to it here.",+ "sendDropHint": "Drop onto a device to send",+ "sendReleaseTo": "Release to send to {name}",+ "@sendReleaseTo": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "sendLan": "Local network",+ "sendRelayLeft": "Relay · {left} left today",+ "@sendRelayLeft": {+ "placeholders": {+ "left": {+ "type": "String"+ }+ }+ },+ "sendNeedsUpdate": "Needs update",+ "sendNeedsUpdateTip": "{name} can receive files after updating to PasteFerry 2.5 or later.",+ "@sendNeedsUpdateTip": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "sendNotReceiving": "Not receiving files",+ "sendDelivered": "Delivered",+ "sendToTitle": "Send to {name}",+ "@sendToTitle": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "sendDropHere": "Drag files or folders here",+ "sendDropStarts": "Sending starts as soon as you drop them",+ "sendChooseFiles": "Choose Files…",+ "sendChooseFolder": "Choose Folder…",+ "sendDropMore": "Drop more files to send them next",+ "sendSavedWhere": "Files are saved where {name} chooses — the Downloads folder by default.",+ "@sendSavedWhere": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "sendCloseKeeps": "Closing this window doesn’t stop sending",+ "sendRemoveQueued": "Remove",+ "sendCannotDrop": "This item can’t be sent by dragging. Save it as a file first, or use Choose Files….",+ "sendErrOffline": "{name} is offline.",+ "@sendErrOffline": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "sendErrDisabled": "{name} isn’t receiving files.",+ "@sendErrDisabled": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "sendErrMissing": "Some of these files no longer exist.",+ "relayConfirmTitle": "Send through the official relay?",+ "relayConfirmBody": "{name} has no direct connection to this computer right now, so the files go through the official relay at about 0.25 MB/s. {left} of today’s relay allowance is left.",+ "@relayConfirmBody": {+ "placeholders": {+ "name": {+ "type": "String"+ },+ "left": {+ "type": "String"+ }+ }+ },+ "relayConfirmOver": "These files ({size}) are more than the remaining allowance. Sending pauses when it runs out and continues when the two computers connect directly or the allowance resets tomorrow.",+ "@relayConfirmOver": {+ "placeholders": {+ "size": {+ "type": "String"+ }+ }+ },+ "relayConfirmWithin": "This uses about {size} of today’s allowance.",+ "@relayConfirmWithin": {+ "placeholders": {+ "size": {+ "type": "String"+ }+ }+ },+ "relayExhausted": "Today’s relay allowance is used up. It resets at midnight Beijing time. Two computers that connect directly have no limit.",+ "relayDontAskToday": "Don’t ask again today for this device",+ "relaySendAnyway": "Send Anyway",+ "relayOwnServer": "Relayed — speed depends on your server",+ "transfersReceived": "Received",+ "transfersSent": "Sent",+ "transfersClearAll": "Clear All",+ "transfersClearTitle": "Clear this list?",+ "transfersClearBody": "Only the list is cleared. Files stay where they are.",+ "transfersEmptyReceived": "Files other devices send you appear here",+ "transfersEmptySent": "Files you send appear here",+ "transferFrom": "From {name}",+ "@transferFrom": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "transferTo": "To {name}",+ "@transferTo": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "transferItems": "{name} and {others} more",+ "@transferItems": {+ "placeholders": {+ "name": {+ "type": "String"+ },+ "total": {+ "type": "int"+ },+ "others": {+ "type": "int"+ }+ }+ },+ "transferFileCount": "{count, plural, =1{1 file} other{{count} files}}",+ "@transferFileCount": {+ "placeholders": {+ "count": {+ "type": "int"+ }+ }+ },+ "transferQueued": "Queued",+ "transferScanning": "Counting… {count} files found",+ "@transferScanning": {+ "placeholders": {+ "count": {+ "type": "String"+ }+ }+ },+ "transferWaitingPeer": "Waiting for {name}…",+ "@transferWaitingPeer": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "transferSending": "Sending",+ "transferReceiving": "Receiving",+ "transferCurrent": "Now: {file} ({index} of {total})",+ "@transferCurrent": {+ "placeholders": {+ "file": {+ "type": "String"+ },+ "index": {+ "type": "String"+ },+ "total": {+ "type": "String"+ }+ }+ },+ "transferLeft": "{time} left",+ "@transferLeft": {+ "placeholders": {+ "time": {+ "type": "String"+ }+ }+ },+ "etaSeconds": "{n, plural, =1{1 second} other{{n} seconds}}",+ "@etaSeconds": {+ "placeholders": {+ "n": {+ "type": "int"+ }+ }+ },+ "etaMinutes": "{n, plural, =1{1 minute} other{{n} minutes}}",+ "@etaMinutes": {+ "placeholders": {+ "n": {+ "type": "int"+ }+ }+ },+ "etaHours": "{h} h {m} min",+ "@etaHours": {+ "placeholders": {+ "h": {+ "type": "int"+ },+ "m": {+ "type": "int"+ }+ }+ },+ "transferPaused": "Paused: today’s relay allowance is used up",+ "transferInterrupted": "Interrupted — continues when reconnected",+ "transferInterruptedIncoming": "Interrupted — waiting for {name} to continue",+ "@transferInterruptedIncoming": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "transferCancelled": "Cancelled",+ "transferPeerCancelled": "Cancelled by {name}",+ "@transferPeerCancelled": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "transferExpired": "Expired",+ "transferMissing": "Moved or deleted",+ "transferNotSent": "Not sent: {reason}",+ "@transferNotSent": {+ "placeholders": {+ "reason": {+ "type": "String"+ }+ }+ },+ "transferNotReceived": "Not received: {reason}",+ "@transferNotReceived": {+ "placeholders": {+ "reason": {+ "type": "String"+ }+ }+ },+ "reasonNoSpacePeer": "{name} is out of disk space ({size} short)",+ "@reasonNoSpacePeer": {+ "placeholders": {+ "name": {+ "type": "String"+ },+ "size": {+ "type": "String"+ }+ }+ },+ "reasonNoSpace": "not enough disk space ({size} short)",+ "@reasonNoSpace": {+ "placeholders": {+ "size": {+ "type": "String"+ }+ }+ },+ "reasonDestUnavailablePeer": "{name}’s save location is unavailable",+ "@reasonDestUnavailablePeer": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "reasonDestUnavailable": "the save location is unavailable — check it in Settings",+ "reasonFileTooLarge": "the save location is on a FAT32 drive, which can’t hold files over 4 GB",+ "reasonDisabledPeer": "{name} isn’t receiving files",+ "@reasonDisabledPeer": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "reasonSourceChanged": "a file changed while it was being sent",+ "reasonSourceMissing": "a file no longer exists",+ "reasonReadError": "a file couldn’t be read",+ "reasonWriteFailed": "the files couldn’t be written",+ "reasonHashMismatch": "a file was damaged in transit",+ "reasonUnsupported": "{name} needs to update to receive files",+ "@reasonUnsupported": {+ "placeholders": {+ "name": {+ "type": "String"+ }+ }+ },+ "reasonOther": "something went wrong",+ "revealInFinder": "Show in Finder",+ "revealInFolder": "Show in Folder",+ "revealOpenFolder": "Open Folder",+ "transferResend": "Send Again",+ "transferRemove": "Remove from List",+ "transferCopyPath": "Copy Path",+ "transferPathCopied": "Path copied",+ "sendingTo": "Sending to {name} · {percent}",+ "@sendingTo": {+ "placeholders": {+ "name": {+ "type": "String"+ },+ "percent": {+ "type": "String"+ }+ }+ },+ "receivingFrom": "Receiving from {name} · {percent}",+ "@receivingFrom": {+ "placeholders": {+ "name": {+ "type": "String"+ },+ "percent": {+ "type": "String"+ }+ }+ },+ "receiveFiles": "Receive files from other devices",+ "saveTo": "Save to",+ "saveToChange": "Change…",+ "saveToDefault": "Downloads (default)",+ "saveToUseDefault": "Use Downloads",+ "receiveNotify": "Notify when files arrive",+ "receiveFootnote": "Only paired devices can send files to {device}. While files are transferring, {device} won’t go to sleep on its own.",+ "@receiveFootnote": {+ "placeholders": {+ "device": {+ "type": "String"+ }+ }+ },+ "saveDirNotFound": "This folder doesn’t exist.",+ "saveDirNotWritable": "PasteFerry can’t save files in this folder.",+ "saveDirPermission": "PasteFerry isn’t allowed to use this folder. Allow it in System Settings → Privacy & Security → Files and Folders."}diff --git a/ui/lib/l10n/app_ja.arb b/ui/lib/l10n/app_ja.arbindex e323f1f..3e4795c 100644--- a/ui/lib/l10n/app_ja.arb+++ b/ui/lib/l10n/app_ja.arb@@ -384,5 +384,100 @@"notifyFailedTitle": "受信できませんでした","notifyFailedBody": "{name}\n{error}\nこの通知または履歴から再試行できます。","notifyClipboardFailedTitle": "受信済みですがクリップボードを更新できませんでした",- "notifyClipboardFailedBody": "{name}\n{error}\nこの通知または履歴からクリップボードに入れて再試行できます。"+ "notifyClipboardFailedBody": "{name}\n{error}\nこの通知または履歴からクリップボードに入れて再試行できます。",+ "navSend": "ファイル送信",+ "sendSubtitle": "ファイルをデバイスにドラッグして、そのまま送ります",+ "sendNoDevicesTitle": "ペアリングしたデバイスがありません",+ "sendNoDevicesBody": "ほかのコンピューターとペアリングすると、ここからファイルを送れます。",+ "sendDropHint": "デバイスの上にドロップして送信",+ "sendReleaseTo": "離すと {name} に送信",+ "sendLan": "ローカルネットワーク",+ "sendRelayLeft": "中継 · 今日の残り {left}",+ "sendNeedsUpdate": "アップデートが必要",+ "sendNeedsUpdateTip": "{name} は PasteFerry 2.5 以降にアップデートするとファイルを受信できます。",+ "sendNotReceiving": "ファイルを受信しない",+ "sendDelivered": "送信済み",+ "sendToTitle": "{name} に送信",+ "sendDropHere": "ファイルやフォルダをここにドラッグ",+ "sendDropStarts": "ドロップするとすぐに送信します",+ "sendChooseFiles": "ファイルを選択…",+ "sendChooseFolder": "フォルダを選択…",+ "sendDropMore": "さらにドロップすると続けて送信します",+ "sendSavedWhere": "ファイルは {name} で設定された場所(既定は「ダウンロード」フォルダ)に保存されます。",+ "sendCloseKeeps": "ウインドウを閉じても送信は続きます",+ "sendRemoveQueued": "取り除く",+ "sendCannotDrop": "この項目はドラッグでは送れません。ファイルとして保存するか、「ファイルを選択…」を使ってください。",+ "sendErrOffline": "{name} はオフラインです。",+ "sendErrDisabled": "{name} はファイルの受信をオフにしています。",+ "sendErrMissing": "一部のファイルが見つかりません。",+ "relayConfirmTitle": "公式サービスの中継で送信しますか?",+ "relayConfirmBody": "{name} は現在このコンピューターと直接つながっていないため、公式サービスの中継(約 0.25 MB/s)で送ります。今日の中継の残りは {left} です。",+ "relayConfirmOver": "これらのファイル({size})は残りの枠を超えています。枠を使い切ると一時停止し、直接つながるか、明日枠が戻ると自動で再開します。",+ "relayConfirmWithin": "今日の枠のうち約 {size} を使います。",+ "relayExhausted": "今日の中継枠を使い切りました。北京時間の午前 0 時に戻ります。直接つながっていれば制限はありません。",+ "relayDontAskToday": "今日はこのデバイスについて確認しない",+ "relaySendAnyway": "送信する",+ "relayOwnServer": "中継中 — 速度はサーバー次第です",+ "transfersReceived": "受信",+ "transfersSent": "送信",+ "transfersClearAll": "すべて消去",+ "transfersClearTitle": "このリストを消去しますか?",+ "transfersClearBody": "記録だけを消去します。ファイルは削除されません。",+ "transfersEmptyReceived": "ほかのデバイスから届いたファイルがここに表示されます",+ "transfersEmptySent": "送信したファイルがここに表示されます",+ "transferFrom": "{name} から",+ "transferTo": "{name} へ",+ "transferItems": "{name} ほか {others} 項目",+ "transferFileCount": "{count} 個のファイル",+ "transferQueued": "待機中",+ "transferScanning": "確認中… {count} 個のファイル",+ "transferWaitingPeer": "{name} の応答を待っています…",+ "transferSending": "送信中",+ "transferReceiving": "受信中",+ "transferCurrent": "転送中:{file}({index} / {total})",+ "transferLeft": "残り {time}",+ "etaSeconds": "{n} 秒",+ "etaMinutes": "{n} 分",+ "etaHours": "{h} 時間 {m} 分",+ "transferPaused": "一時停止:今日の中継枠を使い切りました",+ "transferInterrupted": "中断 — 再接続すると続行します",+ "transferInterruptedIncoming": "中断 — {name} からの再開を待っています",+ "transferCancelled": "キャンセルしました",+ "transferPeerCancelled": "{name} がキャンセルしました",+ "transferExpired": "期限切れ",+ "transferMissing": "移動または削除済み",+ "transferNotSent": "送信できませんでした:{reason}",+ "transferNotReceived": "受信できませんでした:{reason}",+ "reasonNoSpacePeer": "{name} のディスクの空きが {size} 足りません",+ "reasonNoSpace": "ディスクの空きが {size} 足りません",+ "reasonDestUnavailablePeer": "{name} の保存先を使用できません",+ "reasonDestUnavailable": "保存先を使用できません。設定を確認してください",+ "reasonFileTooLarge": "保存先が FAT32 のディスクで、4 GB を超えるファイルを保存できません",+ "reasonDisabledPeer": "{name} はファイルの受信をオフにしています",+ "reasonSourceChanged": "送信中にファイルが変更されました",+ "reasonSourceMissing": "ファイルが見つかりません",+ "reasonReadError": "ファイルを読み取れませんでした",+ "reasonWriteFailed": "ファイルを書き込めませんでした",+ "reasonHashMismatch": "転送中にファイルが破損しました",+ "reasonUnsupported": "{name} はファイルを受信するためにアップデートが必要です",+ "reasonOther": "問題が発生しました",+ "revealInFinder": "Finder に表示",+ "revealInFolder": "フォルダに表示",+ "revealOpenFolder": "フォルダを開く",+ "transferResend": "もう一度送信",+ "transferRemove": "リストから取り除く",+ "transferCopyPath": "パスをコピー",+ "transferPathCopied": "パスをコピーしました",+ "sendingTo": "{name} に送信中 · {percent}",+ "receivingFrom": "{name} から受信中 · {percent}",+ "receiveFiles": "ほかのデバイスからファイルを受信",+ "saveTo": "保存先",+ "saveToChange": "変更…",+ "saveToDefault": "ダウンロード(既定)",+ "saveToUseDefault": "「ダウンロード」に戻す",+ "receiveNotify": "ファイルが届いたら通知",+ "receiveFootnote": "ペアリングしたデバイスだけが{device}にファイルを送れます。転送中、{device}は自動でスリープしません。",+ "saveDirNotFound": "このフォルダは存在しません。",+ "saveDirNotWritable": "PasteFerry はこのフォルダにファイルを保存できません。",+ "saveDirPermission": "PasteFerry にこのフォルダの使用が許可されていません。「システム設定 → プライバシーとセキュリティ → ファイルとフォルダ」で許可してください。"}diff --git a/ui/lib/l10n/app_localizations.dart b/ui/lib/l10n/app_localizations.dartindex c5993ec..e2b1590 100644--- a/ui/lib/l10n/app_localizations.dart+++ b/ui/lib/l10n/app_localizations.dart@@ -2419,6 +2419,576 @@ abstract class AppLocalizations {/// In en, this message translates to:/// **'{name}\n{error}\nUse Copy to clipboard to try again, here or in History.'**String notifyClipboardFailedBody(String name, String error);++ /// No description provided for @navSend.+ ///+ /// In en, this message translates to:+ /// **'Send Files'**+ String get navSend;++ /// No description provided for @sendSubtitle.+ ///+ /// In en, this message translates to:+ /// **'Drag files onto a device to send them directly'**+ String get sendSubtitle;++ /// No description provided for @sendNoDevicesTitle.+ ///+ /// In en, this message translates to:+ /// **'No paired devices yet'**+ String get sendNoDevicesTitle;++ /// No description provided for @sendNoDevicesBody.+ ///+ /// In en, this message translates to:+ /// **'Pair another computer first, then send files to it here.'**+ String get sendNoDevicesBody;++ /// No description provided for @sendDropHint.+ ///+ /// In en, this message translates to:+ /// **'Drop onto a device to send'**+ String get sendDropHint;++ /// No description provided for @sendReleaseTo.+ ///+ /// In en, this message translates to:+ /// **'Release to send to {name}'**+ String sendReleaseTo(String name);++ /// No description provided for @sendLan.+ ///+ /// In en, this message translates to:+ /// **'Local network'**+ String get sendLan;++ /// No description provided for @sendRelayLeft.+ ///+ /// In en, this message translates to:+ /// **'Relay · {left} left today'**+ String sendRelayLeft(String left);++ /// No description provided for @sendNeedsUpdate.+ ///+ /// In en, this message translates to:+ /// **'Needs update'**+ String get sendNeedsUpdate;++ /// No description provided for @sendNeedsUpdateTip.+ ///+ /// In en, this message translates to:+ /// **'{name} can receive files after updating to PasteFerry 2.5 or later.'**+ String sendNeedsUpdateTip(String name);++ /// No description provided for @sendNotReceiving.+ ///+ /// In en, this message translates to:+ /// **'Not receiving files'**+ String get sendNotReceiving;++ /// No description provided for @sendDelivered.+ ///+ /// In en, this message translates to:+ /// **'Delivered'**+ String get sendDelivered;++ /// No description provided for @sendToTitle.+ ///+ /// In en, this message translates to:+ /// **'Send to {name}'**+ String sendToTitle(String name);++ /// No description provided for @sendDropHere.+ ///+ /// In en, this message translates to:+ /// **'Drag files or folders here'**+ String get sendDropHere;++ /// No description provided for @sendDropStarts.+ ///+ /// In en, this message translates to:+ /// **'Sending starts as soon as you drop them'**+ String get sendDropStarts;++ /// No description provided for @sendChooseFiles.+ ///+ /// In en, this message translates to:+ /// **'Choose Files…'**+ String get sendChooseFiles;++ /// No description provided for @sendChooseFolder.+ ///+ /// In en, this message translates to:+ /// **'Choose Folder…'**+ String get sendChooseFolder;++ /// No description provided for @sendDropMore.+ ///+ /// In en, this message translates to:+ /// **'Drop more files to send them next'**+ String get sendDropMore;++ /// No description provided for @sendSavedWhere.+ ///+ /// In en, this message translates to:+ /// **'Files are saved where {name} chooses — the Downloads folder by default.'**+ String sendSavedWhere(String name);++ /// No description provided for @sendCloseKeeps.+ ///+ /// In en, this message translates to:+ /// **'Closing this window doesn’t stop sending'**+ String get sendCloseKeeps;++ /// No description provided for @sendRemoveQueued.+ ///+ /// In en, this message translates to:+ /// **'Remove'**+ String get sendRemoveQueued;++ /// No description provided for @sendCannotDrop.+ ///+ /// In en, this message translates to:+ /// **'This item can’t be sent by dragging. Save it as a file first, or use Choose Files….'**+ String get sendCannotDrop;++ /// No description provided for @sendErrOffline.+ ///+ /// In en, this message translates to:+ /// **'{name} is offline.'**+ String sendErrOffline(String name);++ /// No description provided for @sendErrDisabled.+ ///+ /// In en, this message translates to:+ /// **'{name} isn’t receiving files.'**+ String sendErrDisabled(String name);++ /// No description provided for @sendErrMissing.+ ///+ /// In en, this message translates to:+ /// **'Some of these files no longer exist.'**+ String get sendErrMissing;++ /// No description provided for @relayConfirmTitle.+ ///+ /// In en, this message translates to:+ /// **'Send through the official relay?'**+ String get relayConfirmTitle;++ /// No description provided for @relayConfirmBody.+ ///+ /// In en, this message translates to:+ /// **'{name} has no direct connection to this computer right now, so the files go through the official relay at about 0.25 MB/s. {left} of today’s relay allowance is left.'**+ String relayConfirmBody(String name, String left);++ /// No description provided for @relayConfirmOver.+ ///+ /// In en, this message translates to:+ /// **'These files ({size}) are more than the remaining allowance. Sending pauses when it runs out and continues when the two computers connect directly or the allowance resets tomorrow.'**+ String relayConfirmOver(String size);++ /// No description provided for @relayConfirmWithin.+ ///+ /// In en, this message translates to:+ /// **'This uses about {size} of today’s allowance.'**+ String relayConfirmWithin(String size);++ /// No description provided for @relayExhausted.+ ///+ /// In en, this message translates to:+ /// **'Today’s relay allowance is used up. It resets at midnight Beijing time. Two computers that connect directly have no limit.'**+ String get relayExhausted;++ /// No description provided for @relayDontAskToday.+ ///+ /// In en, this message translates to:+ /// **'Don’t ask again today for this device'**+ String get relayDontAskToday;++ /// No description provided for @relaySendAnyway.+ ///+ /// In en, this message translates to:+ /// **'Send Anyway'**+ String get relaySendAnyway;++ /// No description provided for @relayOwnServer.+ ///+ /// In en, this message translates to:+ /// **'Relayed — speed depends on your server'**+ String get relayOwnServer;++ /// No description provided for @transfersReceived.+ ///+ /// In en, this message translates to:+ /// **'Received'**+ String get transfersReceived;++ /// No description provided for @transfersSent.+ ///+ /// In en, this message translates to:+ /// **'Sent'**+ String get transfersSent;++ /// No description provided for @transfersClearAll.+ ///+ /// In en, this message translates to:+ /// **'Clear All'**+ String get transfersClearAll;++ /// No description provided for @transfersClearTitle.+ ///+ /// In en, this message translates to:+ /// **'Clear this list?'**+ String get transfersClearTitle;++ /// No description provided for @transfersClearBody.+ ///+ /// In en, this message translates to:+ /// **'Only the list is cleared. Files stay where they are.'**+ String get transfersClearBody;++ /// No description provided for @transfersEmptyReceived.+ ///+ /// In en, this message translates to:+ /// **'Files other devices send you appear here'**+ String get transfersEmptyReceived;++ /// No description provided for @transfersEmptySent.+ ///+ /// In en, this message translates to:+ /// **'Files you send appear here'**+ String get transfersEmptySent;++ /// No description provided for @transferFrom.+ ///+ /// In en, this message translates to:+ /// **'From {name}'**+ String transferFrom(String name);++ /// No description provided for @transferTo.+ ///+ /// In en, this message translates to:+ /// **'To {name}'**+ String transferTo(String name);++ /// No description provided for @transferItems.+ ///+ /// In en, this message translates to:+ /// **'{name} and {others} more'**+ String transferItems(String name, int total, int others);++ /// No description provided for @transferFileCount.+ ///+ /// In en, this message translates to:+ /// **'{count, plural, =1{1 file} other{{count} files}}'**+ String transferFileCount(int count);++ /// No description provided for @transferQueued.+ ///+ /// In en, this message translates to:+ /// **'Queued'**+ String get transferQueued;++ /// No description provided for @transferScanning.+ ///+ /// In en, this message translates to:+ /// **'Counting… {count} files found'**+ String transferScanning(String count);++ /// No description provided for @transferWaitingPeer.+ ///+ /// In en, this message translates to:+ /// **'Waiting for {name}…'**+ String transferWaitingPeer(String name);++ /// No description provided for @transferSending.+ ///+ /// In en, this message translates to:+ /// **'Sending'**+ String get transferSending;++ /// No description provided for @transferReceiving.+ ///+ /// In en, this message translates to:+ /// **'Receiving'**+ String get transferReceiving;++ /// No description provided for @transferCurrent.+ ///+ /// In en, this message translates to:+ /// **'Now: {file} ({index} of {total})'**+ String transferCurrent(String file, String index, String total);++ /// No description provided for @transferLeft.+ ///+ /// In en, this message translates to:+ /// **'{time} left'**+ String transferLeft(String time);++ /// No description provided for @etaSeconds.+ ///+ /// In en, this message translates to:+ /// **'{n, plural, =1{1 second} other{{n} seconds}}'**+ String etaSeconds(int n);++ /// No description provided for @etaMinutes.+ ///+ /// In en, this message translates to:+ /// **'{n, plural, =1{1 minute} other{{n} minutes}}'**+ String etaMinutes(int n);++ /// No description provided for @etaHours.+ ///+ /// In en, this message translates to:+ /// **'{h} h {m} min'**+ String etaHours(int h, int m);++ /// No description provided for @transferPaused.+ ///+ /// In en, this message translates to:+ /// **'Paused: today’s relay allowance is used up'**+ String get transferPaused;++ /// No description provided for @transferInterrupted.+ ///+ /// In en, this message translates to:+ /// **'Interrupted — continues when reconnected'**+ String get transferInterrupted;++ /// No description provided for @transferInterruptedIncoming.+ ///+ /// In en, this message translates to:+ /// **'Interrupted — waiting for {name} to continue'**+ String transferInterruptedIncoming(String name);++ /// No description provided for @transferCancelled.+ ///+ /// In en, this message translates to:+ /// **'Cancelled'**+ String get transferCancelled;++ /// No description provided for @transferPeerCancelled.+ ///+ /// In en, this message translates to:+ /// **'Cancelled by {name}'**+ String transferPeerCancelled(String name);++ /// No description provided for @transferExpired.+ ///+ /// In en, this message translates to:+ /// **'Expired'**+ String get transferExpired;++ /// No description provided for @transferMissing.+ ///+ /// In en, this message translates to:+ /// **'Moved or deleted'**+ String get transferMissing;++ /// No description provided for @transferNotSent.+ ///+ /// In en, this message translates to:+ /// **'Not sent: {reason}'**+ String transferNotSent(String reason);++ /// No description provided for @transferNotReceived.+ ///+ /// In en, this message translates to:+ /// **'Not received: {reason}'**+ String transferNotReceived(String reason);++ /// No description provided for @reasonNoSpacePeer.+ ///+ /// In en, this message translates to:+ /// **'{name} is out of disk space ({size} short)'**+ String reasonNoSpacePeer(String name, String size);++ /// No description provided for @reasonNoSpace.+ ///+ /// In en, this message translates to:+ /// **'not enough disk space ({size} short)'**+ String reasonNoSpace(String size);++ /// No description provided for @reasonDestUnavailablePeer.+ ///+ /// In en, this message translates to:+ /// **'{name}’s save location is unavailable'**+ String reasonDestUnavailablePeer(String name);++ /// No description provided for @reasonDestUnavailable.+ ///+ /// In en, this message translates to:+ /// **'the save location is unavailable — check it in Settings'**+ String get reasonDestUnavailable;++ /// No description provided for @reasonFileTooLarge.+ ///+ /// In en, this message translates to:+ /// **'the save location is on a FAT32 drive, which can’t hold files over 4 GB'**+ String get reasonFileTooLarge;++ /// No description provided for @reasonDisabledPeer.+ ///+ /// In en, this message translates to:+ /// **'{name} isn’t receiving files'**+ String reasonDisabledPeer(String name);++ /// No description provided for @reasonSourceChanged.+ ///+ /// In en, this message translates to:+ /// **'a file changed while it was being sent'**+ String get reasonSourceChanged;++ /// No description provided for @reasonSourceMissing.+ ///+ /// In en, this message translates to:+ /// **'a file no longer exists'**+ String get reasonSourceMissing;++ /// No description provided for @reasonReadError.+ ///+ /// In en, this message translates to:+ /// **'a file couldn’t be read'**+ String get reasonReadError;++ /// No description provided for @reasonWriteFailed.+ ///+ /// In en, this message translates to:+ /// **'the files couldn’t be written'**+ String get reasonWriteFailed;++ /// No description provided for @reasonHashMismatch.+ ///+ /// In en, this message translates to:+ /// **'a file was damaged in transit'**+ String get reasonHashMismatch;++ /// No description provided for @reasonUnsupported.+ ///+ /// In en, this message translates to:+ /// **'{name} needs to update to receive files'**+ String reasonUnsupported(String name);++ /// No description provided for @reasonOther.+ ///+ /// In en, this message translates to:+ /// **'something went wrong'**+ String get reasonOther;++ /// No description provided for @revealInFinder.+ ///+ /// In en, this message translates to:+ /// **'Show in Finder'**+ String get revealInFinder;++ /// No description provided for @revealInFolder.+ ///+ /// In en, this message translates to:+ /// **'Show in Folder'**+ String get revealInFolder;++ /// No description provided for @revealOpenFolder.+ ///+ /// In en, this message translates to:+ /// **'Open Folder'**+ String get revealOpenFolder;++ /// No description provided for @transferResend.+ ///+ /// In en, this message translates to:+ /// **'Send Again'**+ String get transferResend;++ /// No description provided for @transferRemove.+ ///+ /// In en, this message translates to:+ /// **'Remove from List'**+ String get transferRemove;++ /// No description provided for @transferCopyPath.+ ///+ /// In en, this message translates to:+ /// **'Copy Path'**+ String get transferCopyPath;++ /// No description provided for @transferPathCopied.+ ///+ /// In en, this message translates to:+ /// **'Path copied'**+ String get transferPathCopied;++ /// No description provided for @sendingTo.+ ///+ /// In en, this message translates to:+ /// **'Sending to {name} · {percent}'**+ String sendingTo(String name, String percent);++ /// No description provided for @receivingFrom.+ ///+ /// In en, this message translates to:+ /// **'Receiving from {name} · {percent}'**+ String receivingFrom(String name, String percent);++ /// No description provided for @receiveFiles.+ ///+ /// In en, this message translates to:+ /// **'Receive files from other devices'**+ String get receiveFiles;++ /// No description provided for @saveTo.+ ///+ /// In en, this message translates to:+ /// **'Save to'**+ String get saveTo;++ /// No description provided for @saveToChange.+ ///+ /// In en, this message translates to:+ /// **'Change…'**+ String get saveToChange;++ /// No description provided for @saveToDefault.+ ///+ /// In en, this message translates to:+ /// **'Downloads (default)'**+ String get saveToDefault;++ /// No description provided for @saveToUseDefault.+ ///+ /// In en, this message translates to:+ /// **'Use Downloads'**+ String get saveToUseDefault;++ /// No description provided for @receiveNotify.+ ///+ /// In en, this message translates to:+ /// **'Notify when files arrive'**+ String get receiveNotify;++ /// No description provided for @receiveFootnote.+ ///+ /// In en, this message translates to:+ /// **'Only paired devices can send files to {device}. While files are transferring, {device} won’t go to sleep on its own.'**+ String receiveFootnote(String device);++ /// No description provided for @saveDirNotFound.+ ///+ /// In en, this message translates to:+ /// **'This folder doesn’t exist.'**+ String get saveDirNotFound;++ /// No description provided for @saveDirNotWritable.+ ///+ /// In en, this message translates to:+ /// **'PasteFerry can’t save files in this folder.'**+ String get saveDirNotWritable;++ /// No description provided for @saveDirPermission.+ ///+ /// In en, this message translates to:+ /// **'PasteFerry isn’t allowed to use this folder. Allow it in System Settings → Privacy & Security → Files and Folders.'**+ String get saveDirPermission;}class _AppLocalizationsDelegatediff --git a/ui/lib/l10n/app_localizations_en.dart b/ui/lib/l10n/app_localizations_en.dartindex e4598bf..2f9ecf7 100644--- a/ui/lib/l10n/app_localizations_en.dart+++ b/ui/lib/l10n/app_localizations_en.dart@@ -1452,4 +1452,382 @@ class AppLocalizationsEn extends AppLocalizations {String notifyClipboardFailedBody(String name, String error) {return '$name\n$error\nUse Copy to clipboard to try again, here or in History.';}++ @override+ String get navSend => 'Send Files';++ @override+ String get sendSubtitle => 'Drag files onto a device to send them directly';++ @override+ String get sendNoDevicesTitle => 'No paired devices yet';++ @override+ String get sendNoDevicesBody =>+ 'Pair another computer first, then send files to it here.';++ @override+ String get sendDropHint => 'Drop onto a device to send';++ @override+ String sendReleaseTo(String name) {+ return 'Release to send to $name';+ }++ @override+ String get sendLan => 'Local network';++ @override+ String sendRelayLeft(String left) {+ return 'Relay · $left left today';+ }++ @override+ String get sendNeedsUpdate => 'Needs update';++ @override+ String sendNeedsUpdateTip(String name) {+ return '$name can receive files after updating to PasteFerry 2.5 or later.';+ }++ @override+ String get sendNotReceiving => 'Not receiving files';++ @override+ String get sendDelivered => 'Delivered';++ @override+ String sendToTitle(String name) {+ return 'Send to $name';+ }++ @override+ String get sendDropHere => 'Drag files or folders here';++ @override+ String get sendDropStarts => 'Sending starts as soon as you drop them';++ @override+ String get sendChooseFiles => 'Choose Files…';++ @override+ String get sendChooseFolder => 'Choose Folder…';++ @override+ String get sendDropMore => 'Drop more files to send them next';++ @override+ String sendSavedWhere(String name) {+ return 'Files are saved where $name chooses — the Downloads folder by default.';+ }++ @override+ String get sendCloseKeeps => 'Closing this window doesn’t stop sending';++ @override+ String get sendRemoveQueued => 'Remove';++ @override+ String get sendCannotDrop =>+ 'This item can’t be sent by dragging. Save it as a file first, or use Choose Files….';++ @override+ String sendErrOffline(String name) {+ return '$name is offline.';+ }++ @override+ String sendErrDisabled(String name) {+ return '$name isn’t receiving files.';+ }++ @override+ String get sendErrMissing => 'Some of these files no longer exist.';++ @override+ String get relayConfirmTitle => 'Send through the official relay?';++ @override+ String relayConfirmBody(String name, String left) {+ return '$name has no direct connection to this computer right now, so the files go through the official relay at about 0.25 MB/s. $left of today’s relay allowance is left.';+ }++ @override+ String relayConfirmOver(String size) {+ return 'These files ($size) are more than the remaining allowance. Sending pauses when it runs out and continues when the two computers connect directly or the allowance resets tomorrow.';+ }++ @override+ String relayConfirmWithin(String size) {+ return 'This uses about $size of today’s allowance.';+ }++ @override+ String get relayExhausted =>+ 'Today’s relay allowance is used up. It resets at midnight Beijing time. Two computers that connect directly have no limit.';++ @override+ String get relayDontAskToday => 'Don’t ask again today for this device';++ @override+ String get relaySendAnyway => 'Send Anyway';++ @override+ String get relayOwnServer => 'Relayed — speed depends on your server';++ @override+ String get transfersReceived => 'Received';++ @override+ String get transfersSent => 'Sent';++ @override+ String get transfersClearAll => 'Clear All';++ @override+ String get transfersClearTitle => 'Clear this list?';++ @override+ String get transfersClearBody =>+ 'Only the list is cleared. Files stay where they are.';++ @override+ String get transfersEmptyReceived =>+ 'Files other devices send you appear here';++ @override+ String get transfersEmptySent => 'Files you send appear here';++ @override+ String transferFrom(String name) {+ return 'From $name';+ }++ @override+ String transferTo(String name) {+ return 'To $name';+ }++ @override+ String transferItems(String name, int total, int others) {+ return '$name and $others more';+ }++ @override+ String transferFileCount(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: '$count files',+ one: '1 file',+ );+ return '$_temp0';+ }++ @override+ String get transferQueued => 'Queued';++ @override+ String transferScanning(String count) {+ return 'Counting… $count files found';+ }++ @override+ String transferWaitingPeer(String name) {+ return 'Waiting for $name…';+ }++ @override+ String get transferSending => 'Sending';++ @override+ String get transferReceiving => 'Receiving';++ @override+ String transferCurrent(String file, String index, String total) {+ return 'Now: $file ($index of $total)';+ }++ @override+ String transferLeft(String time) {+ return '$time left';+ }++ @override+ String etaSeconds(int n) {+ String _temp0 = intl.Intl.pluralLogic(+ n,+ locale: localeName,+ other: '$n seconds',+ one: '1 second',+ );+ return '$_temp0';+ }++ @override+ String etaMinutes(int n) {+ String _temp0 = intl.Intl.pluralLogic(+ n,+ locale: localeName,+ other: '$n minutes',+ one: '1 minute',+ );+ return '$_temp0';+ }++ @override+ String etaHours(int h, int m) {+ return '$h h $m min';+ }++ @override+ String get transferPaused => 'Paused: today’s relay allowance is used up';++ @override+ String get transferInterrupted => 'Interrupted — continues when reconnected';++ @override+ String transferInterruptedIncoming(String name) {+ return 'Interrupted — waiting for $name to continue';+ }++ @override+ String get transferCancelled => 'Cancelled';++ @override+ String transferPeerCancelled(String name) {+ return 'Cancelled by $name';+ }++ @override+ String get transferExpired => 'Expired';++ @override+ String get transferMissing => 'Moved or deleted';++ @override+ String transferNotSent(String reason) {+ return 'Not sent: $reason';+ }++ @override+ String transferNotReceived(String reason) {+ return 'Not received: $reason';+ }++ @override+ String reasonNoSpacePeer(String name, String size) {+ return '$name is out of disk space ($size short)';+ }++ @override+ String reasonNoSpace(String size) {+ return 'not enough disk space ($size short)';+ }++ @override+ String reasonDestUnavailablePeer(String name) {+ return '$name’s save location is unavailable';+ }++ @override+ String get reasonDestUnavailable =>+ 'the save location is unavailable — check it in Settings';++ @override+ String get reasonFileTooLarge =>+ 'the save location is on a FAT32 drive, which can’t hold files over 4 GB';++ @override+ String reasonDisabledPeer(String name) {+ return '$name isn’t receiving files';+ }++ @override+ String get reasonSourceChanged => 'a file changed while it was being sent';++ @override+ String get reasonSourceMissing => 'a file no longer exists';++ @override+ String get reasonReadError => 'a file couldn’t be read';++ @override+ String get reasonWriteFailed => 'the files couldn’t be written';++ @override+ String get reasonHashMismatch => 'a file was damaged in transit';++ @override+ String reasonUnsupported(String name) {+ return '$name needs to update to receive files';+ }++ @override+ String get reasonOther => 'something went wrong';++ @override+ String get revealInFinder => 'Show in Finder';++ @override+ String get revealInFolder => 'Show in Folder';++ @override+ String get revealOpenFolder => 'Open Folder';++ @override+ String get transferResend => 'Send Again';++ @override+ String get transferRemove => 'Remove from List';++ @override+ String get transferCopyPath => 'Copy Path';++ @override+ String get transferPathCopied => 'Path copied';++ @override+ String sendingTo(String name, String percent) {+ return 'Sending to $name · $percent';+ }++ @override+ String receivingFrom(String name, String percent) {+ return 'Receiving from $name · $percent';+ }++ @override+ String get receiveFiles => 'Receive files from other devices';++ @override+ String get saveTo => 'Save to';++ @override+ String get saveToChange => 'Change…';++ @override+ String get saveToDefault => 'Downloads (default)';++ @override+ String get saveToUseDefault => 'Use Downloads';++ @override+ String get receiveNotify => 'Notify when files arrive';++ @override+ String receiveFootnote(String device) {+ return 'Only paired devices can send files to $device. While files are transferring, $device won’t go to sleep on its own.';+ }++ @override+ String get saveDirNotFound => 'This folder doesn’t exist.';++ @override+ String get saveDirNotWritable =>+ 'PasteFerry can’t save files in this folder.';++ @override+ String get saveDirPermission =>+ 'PasteFerry isn’t allowed to use this folder. Allow it in System Settings → Privacy & Security → Files and Folders.';}diff --git a/ui/lib/l10n/app_localizations_ja.dart b/ui/lib/l10n/app_localizations_ja.dartindex fa40c80..e1e4248 100644--- a/ui/lib/l10n/app_localizations_ja.dart+++ b/ui/lib/l10n/app_localizations_ja.dart@@ -1330,4 +1330,358 @@ class AppLocalizationsJa extends AppLocalizations {String notifyClipboardFailedBody(String name, String error) {return '$name\n$error\nこの通知または履歴からクリップボードに入れて再試行できます。';}++ @override+ String get navSend => 'ファイル送信';++ @override+ String get sendSubtitle => 'ファイルをデバイスにドラッグして、そのまま送ります';++ @override+ String get sendNoDevicesTitle => 'ペアリングしたデバイスがありません';++ @override+ String get sendNoDevicesBody => 'ほかのコンピューターとペアリングすると、ここからファイルを送れます。';++ @override+ String get sendDropHint => 'デバイスの上にドロップして送信';++ @override+ String sendReleaseTo(String name) {+ return '離すと $name に送信';+ }++ @override+ String get sendLan => 'ローカルネットワーク';++ @override+ String sendRelayLeft(String left) {+ return '中継 · 今日の残り $left';+ }++ @override+ String get sendNeedsUpdate => 'アップデートが必要';++ @override+ String sendNeedsUpdateTip(String name) {+ return '$name は PasteFerry 2.5 以降にアップデートするとファイルを受信できます。';+ }++ @override+ String get sendNotReceiving => 'ファイルを受信しない';++ @override+ String get sendDelivered => '送信済み';++ @override+ String sendToTitle(String name) {+ return '$name に送信';+ }++ @override+ String get sendDropHere => 'ファイルやフォルダをここにドラッグ';++ @override+ String get sendDropStarts => 'ドロップするとすぐに送信します';++ @override+ String get sendChooseFiles => 'ファイルを選択…';++ @override+ String get sendChooseFolder => 'フォルダを選択…';++ @override+ String get sendDropMore => 'さらにドロップすると続けて送信します';++ @override+ String sendSavedWhere(String name) {+ return 'ファイルは $name で設定された場所(既定は「ダウンロード」フォルダ)に保存されます。';+ }++ @override+ String get sendCloseKeeps => 'ウインドウを閉じても送信は続きます';++ @override+ String get sendRemoveQueued => '取り除く';++ @override+ String get sendCannotDrop =>+ 'この項目はドラッグでは送れません。ファイルとして保存するか、「ファイルを選択…」を使ってください。';++ @override+ String sendErrOffline(String name) {+ return '$name はオフラインです。';+ }++ @override+ String sendErrDisabled(String name) {+ return '$name はファイルの受信をオフにしています。';+ }++ @override+ String get sendErrMissing => '一部のファイルが見つかりません。';++ @override+ String get relayConfirmTitle => '公式サービスの中継で送信しますか?';++ @override+ String relayConfirmBody(String name, String left) {+ return '$name は現在このコンピューターと直接つながっていないため、公式サービスの中継(約 0.25 MB/s)で送ります。今日の中継の残りは $left です。';+ }++ @override+ String relayConfirmOver(String size) {+ return 'これらのファイル($size)は残りの枠を超えています。枠を使い切ると一時停止し、直接つながるか、明日枠が戻ると自動で再開します。';+ }++ @override+ String relayConfirmWithin(String size) {+ return '今日の枠のうち約 $size を使います。';+ }++ @override+ String get relayExhausted =>+ '今日の中継枠を使い切りました。北京時間の午前 0 時に戻ります。直接つながっていれば制限はありません。';++ @override+ String get relayDontAskToday => '今日はこのデバイスについて確認しない';++ @override+ String get relaySendAnyway => '送信する';++ @override+ String get relayOwnServer => '中継中 — 速度はサーバー次第です';++ @override+ String get transfersReceived => '受信';++ @override+ String get transfersSent => '送信';++ @override+ String get transfersClearAll => 'すべて消去';++ @override+ String get transfersClearTitle => 'このリストを消去しますか?';++ @override+ String get transfersClearBody => '記録だけを消去します。ファイルは削除されません。';++ @override+ String get transfersEmptyReceived => 'ほかのデバイスから届いたファイルがここに表示されます';++ @override+ String get transfersEmptySent => '送信したファイルがここに表示されます';++ @override+ String transferFrom(String name) {+ return '$name から';+ }++ @override+ String transferTo(String name) {+ return '$name へ';+ }++ @override+ String transferItems(String name, int total, int others) {+ return '$name ほか $others 項目';+ }++ @override+ String transferFileCount(int count) {+ return '$count 個のファイル';+ }++ @override+ String get transferQueued => '待機中';++ @override+ String transferScanning(String count) {+ return '確認中… $count 個のファイル';+ }++ @override+ String transferWaitingPeer(String name) {+ return '$name の応答を待っています…';+ }++ @override+ String get transferSending => '送信中';++ @override+ String get transferReceiving => '受信中';++ @override+ String transferCurrent(String file, String index, String total) {+ return '転送中:$file($index / $total)';+ }++ @override+ String transferLeft(String time) {+ return '残り $time';+ }++ @override+ String etaSeconds(int n) {+ return '$n 秒';+ }++ @override+ String etaMinutes(int n) {+ return '$n 分';+ }++ @override+ String etaHours(int h, int m) {+ return '$h 時間 $m 分';+ }++ @override+ String get transferPaused => '一時停止:今日の中継枠を使い切りました';++ @override+ String get transferInterrupted => '中断 — 再接続すると続行します';++ @override+ String transferInterruptedIncoming(String name) {+ return '中断 — $name からの再開を待っています';+ }++ @override+ String get transferCancelled => 'キャンセルしました';++ @override+ String transferPeerCancelled(String name) {+ return '$name がキャンセルしました';+ }++ @override+ String get transferExpired => '期限切れ';++ @override+ String get transferMissing => '移動または削除済み';++ @override+ String transferNotSent(String reason) {+ return '送信できませんでした:$reason';+ }++ @override+ String transferNotReceived(String reason) {+ return '受信できませんでした:$reason';+ }++ @override+ String reasonNoSpacePeer(String name, String size) {+ return '$name のディスクの空きが $size 足りません';+ }++ @override+ String reasonNoSpace(String size) {+ return 'ディスクの空きが $size 足りません';+ }++ @override+ String reasonDestUnavailablePeer(String name) {+ return '$name の保存先を使用できません';+ }++ @override+ String get reasonDestUnavailable => '保存先を使用できません。設定を確認してください';++ @override+ String get reasonFileTooLarge => '保存先が FAT32 のディスクで、4 GB を超えるファイルを保存できません';++ @override+ String reasonDisabledPeer(String name) {+ return '$name はファイルの受信をオフにしています';+ }++ @override+ String get reasonSourceChanged => '送信中にファイルが変更されました';++ @override+ String get reasonSourceMissing => 'ファイルが見つかりません';++ @override+ String get reasonReadError => 'ファイルを読み取れませんでした';++ @override+ String get reasonWriteFailed => 'ファイルを書き込めませんでした';++ @override+ String get reasonHashMismatch => '転送中にファイルが破損しました';++ @override+ String reasonUnsupported(String name) {+ return '$name はファイルを受信するためにアップデートが必要です';+ }++ @override+ String get reasonOther => '問題が発生しました';++ @override+ String get revealInFinder => 'Finder に表示';++ @override+ String get revealInFolder => 'フォルダに表示';++ @override+ String get revealOpenFolder => 'フォルダを開く';++ @override+ String get transferResend => 'もう一度送信';++ @override+ String get transferRemove => 'リストから取り除く';++ @override+ String get transferCopyPath => 'パスをコピー';++ @override+ String get transferPathCopied => 'パスをコピーしました';++ @override+ String sendingTo(String name, String percent) {+ return '$name に送信中 · $percent';+ }++ @override+ String receivingFrom(String name, String percent) {+ return '$name から受信中 · $percent';+ }++ @override+ String get receiveFiles => 'ほかのデバイスからファイルを受信';++ @override+ String get saveTo => '保存先';++ @override+ String get saveToChange => '変更…';++ @override+ String get saveToDefault => 'ダウンロード(既定)';++ @override+ String get saveToUseDefault => '「ダウンロード」に戻す';++ @override+ String get receiveNotify => 'ファイルが届いたら通知';++ @override+ String receiveFootnote(String device) {+ return 'ペアリングしたデバイスだけが$deviceにファイルを送れます。転送中、$deviceは自動でスリープしません。';+ }++ @override+ String get saveDirNotFound => 'このフォルダは存在しません。';++ @override+ String get saveDirNotWritable => 'PasteFerry はこのフォルダにファイルを保存できません。';++ @override+ String get saveDirPermission =>+ 'PasteFerry にこのフォルダの使用が許可されていません。「システム設定 → プライバシーとセキュリティ → ファイルとフォルダ」で許可してください。';}diff --git a/ui/lib/l10n/app_localizations_zh.dart b/ui/lib/l10n/app_localizations_zh.dartindex a3079e7..9800b3f 100644--- a/ui/lib/l10n/app_localizations_zh.dart+++ b/ui/lib/l10n/app_localizations_zh.dart@@ -1314,6 +1314,358 @@ class AppLocalizationsZh extends AppLocalizations {String notifyClipboardFailedBody(String name, String error) {return '$name\n$error\n可从此通知或复制记录重新放入剪贴板。';}++ @override+ String get navSend => '隔空传送';++ @override+ String get sendSubtitle => '把文件拖到一台设备上,直接发过去';++ @override+ String get sendNoDevicesTitle => '还没有配对的设备';++ @override+ String get sendNoDevicesBody => '先配对另一台电脑,之后就能在这里给它发文件。';++ @override+ String get sendDropHint => '拖到一台设备上发送';++ @override+ String sendReleaseTo(String name) {+ return '松手发送到 $name';+ }++ @override+ String get sendLan => '局域网';++ @override+ String sendRelayLeft(String left) {+ return '中转 · 今日剩 $left';+ }++ @override+ String get sendNeedsUpdate => '需要更新';++ @override+ String sendNeedsUpdateTip(String name) {+ return '$name 更新到隔空贴 2.5 或更高版本后才能接收文件。';+ }++ @override+ String get sendNotReceiving => '不接收文件';++ @override+ String get sendDelivered => '已送达';++ @override+ String sendToTitle(String name) {+ return '发送到 $name';+ }++ @override+ String get sendDropHere => '把文件或文件夹拖到这里';++ @override+ String get sendDropStarts => '松手就开始发送';++ @override+ String get sendChooseFiles => '选择文件…';++ @override+ String get sendChooseFolder => '选择文件夹…';++ @override+ String get sendDropMore => '继续拖入文件,排在后面发送';++ @override+ String sendSavedWhere(String name) {+ return '文件存到 $name 设置的位置,默认是「下载」文件夹。';+ }++ @override+ String get sendCloseKeeps => '关闭窗口不影响发送';++ @override+ String get sendRemoveQueued => '移除';++ @override+ String get sendCannotDrop => '这个项目不能直接拖过来发送。请先把它存成文件,或者用「选择文件…」。';++ @override+ String sendErrOffline(String name) {+ return '$name 不在线。';+ }++ @override+ String sendErrDisabled(String name) {+ return '$name 关闭了接收文件。';+ }++ @override+ String get sendErrMissing => '有文件已经不在了。';++ @override+ String get relayConfirmTitle => '经官方服务中转发送?';++ @override+ String relayConfirmBody(String name, String left) {+ return '$name 现在和这台电脑没有直连,文件要经官方服务中转,速度约 0.25 MB/s。今天的中转额度还剩 $left。';+ }++ @override+ String relayConfirmOver(String size) {+ return '这些文件($size)超出了今天剩余的额度。发到额度用完时会暂停;两台电脑连上直连、或明天额度恢复后,自动继续。';+ }++ @override+ String relayConfirmWithin(String size) {+ return '这次大约用掉今天额度中的 $size。';+ }++ @override+ String get relayExhausted => '今天的中转额度已用完,北京时间 0 点恢复。两台电脑连上直连后不受限制。';++ @override+ String get relayDontAskToday => '今天发给这台设备时不再询问';++ @override+ String get relaySendAnyway => '仍然发送';++ @override+ String get relayOwnServer => '中转,速度取决于你的服务器带宽';++ @override+ String get transfersReceived => '收到的';++ @override+ String get transfersSent => '发出的';++ @override+ String get transfersClearAll => '全部清除';++ @override+ String get transfersClearTitle => '清除这个列表?';++ @override+ String get transfersClearBody => '只清除记录,文件不会被删除。';++ @override+ String get transfersEmptyReceived => '其他设备发来的文件会出现在这里';++ @override+ String get transfersEmptySent => '你发出的文件会出现在这里';++ @override+ String transferFrom(String name) {+ return '来自 $name';+ }++ @override+ String transferTo(String name) {+ return '发给 $name';+ }++ @override+ String transferItems(String name, int total, int others) {+ return '$name 等 $total 项';+ }++ @override+ String transferFileCount(int count) {+ return '$count 个文件';+ }++ @override+ String get transferQueued => '排队中';++ @override+ String transferScanning(String count) {+ return '正在统计… 已找到 $count 个文件';+ }++ @override+ String transferWaitingPeer(String name) {+ return '正在联系 $name…';+ }++ @override+ String get transferSending => '正在发送';++ @override+ String get transferReceiving => '正在接收';++ @override+ String transferCurrent(String file, String index, String total) {+ return '正在传:$file(第 $index / $total 个)';+ }++ @override+ String transferLeft(String time) {+ return '还剩 $time';+ }++ @override+ String etaSeconds(int n) {+ return '$n 秒';+ }++ @override+ String etaMinutes(int n) {+ return '$n 分钟';+ }++ @override+ String etaHours(int h, int m) {+ return '$h 小时 $m 分';+ }++ @override+ String get transferPaused => '已暂停:今天的中转额度用完了';++ @override+ String get transferInterrupted => '已中断,重新连上后继续';++ @override+ String transferInterruptedIncoming(String name) {+ return '已中断 · 等 $name 继续';+ }++ @override+ String get transferCancelled => '已取消';++ @override+ String transferPeerCancelled(String name) {+ return '$name 取消了';+ }++ @override+ String get transferExpired => '已过期';++ @override+ String get transferMissing => '已移动或删除';++ @override+ String transferNotSent(String reason) {+ return '没有发出:$reason';+ }++ @override+ String transferNotReceived(String reason) {+ return '没有收下:$reason';+ }++ @override+ String reasonNoSpacePeer(String name, String size) {+ return '$name 的磁盘空间不足,还差 $size';+ }++ @override+ String reasonNoSpace(String size) {+ return '磁盘空间不足,还差 $size';+ }++ @override+ String reasonDestUnavailablePeer(String name) {+ return '$name 的保存位置不可用';+ }++ @override+ String get reasonDestUnavailable => '保存位置不可用,请在设置里检查';++ @override+ String get reasonFileTooLarge => '保存位置在 FAT32 格式的盘上,放不下超过 4 GB 的文件';++ @override+ String reasonDisabledPeer(String name) {+ return '$name 关闭了接收文件';+ }++ @override+ String get reasonSourceChanged => '发送过程中有文件被修改了';++ @override+ String get reasonSourceMissing => '有文件已经不在了';++ @override+ String get reasonReadError => '有文件读取失败';++ @override+ String get reasonWriteFailed => '文件写入失败';++ @override+ String get reasonHashMismatch => '有文件在传输中损坏了';++ @override+ String reasonUnsupported(String name) {+ return '$name 需要更新才能接收文件';+ }++ @override+ String get reasonOther => '出了点问题';++ @override+ String get revealInFinder => '在访达中显示';++ @override+ String get revealInFolder => '在文件夹中显示';++ @override+ String get revealOpenFolder => '打开文件夹';++ @override+ String get transferResend => '重新发送';++ @override+ String get transferRemove => '从列表中移除';++ @override+ String get transferCopyPath => '拷贝路径';++ @override+ String get transferPathCopied => '已拷贝路径';++ @override+ String sendingTo(String name, String percent) {+ return '正在发给 $name · $percent';+ }++ @override+ String receivingFrom(String name, String percent) {+ return '正在接收 $name 的文件 · $percent';+ }++ @override+ String get receiveFiles => '接收其他设备发来的文件';++ @override+ String get saveTo => '保存到';++ @override+ String get saveToChange => '更改…';++ @override+ String get saveToDefault => '下载(默认)';++ @override+ String get saveToUseDefault => '改回「下载」';++ @override+ String get receiveNotify => '收到文件时通知';++ @override+ String receiveFootnote(String device) {+ return '只有已配对的设备能给$device发文件。传输期间$device不会自动睡眠。';+ }++ @override+ String get saveDirNotFound => '这个文件夹不存在。';++ @override+ String get saveDirNotWritable => '隔空贴不能把文件存到这个文件夹。';++ @override+ String get saveDirPermission =>+ '隔空贴还没有使用这个文件夹的权限。请在「系统设置 → 隐私与安全性 → 文件与文件夹」里允许。';}/// The translations for Chinese, as used in Hong Kong, using the Han script (`zh_Hant_HK`).@@ -2626,75 +2978,427 @@ class AppLocalizationsZhHantHk extends AppLocalizationsZh {String notifyClipboardFailedBody(String name, String error) {return '$name\n$error\n可從此通知或複製記錄重新放入剪貼簿。';}-}-/// The translations for Chinese, as used in Taiwan, using the Han script (`zh_Hant_TW`).-class AppLocalizationsZhHantTw extends AppLocalizationsZh {- AppLocalizationsZhHantTw() : super('zh_Hant_TW');+ @override+ String get navSend => '隔空傳送';@override- String get appName => '隔空貼';+ String get sendSubtitle => '把檔案拖到一部裝置上,直接傳過去';@override- String get navHistory => '複製記錄';+ String get sendNoDevicesTitle => '還沒有配對的裝置';@override- String get navDevices => '裝置';+ String get sendNoDevicesBody => '先配對另一部電腦,之後就能在這裏傳檔案給它。';@override- String get navSettings => '設定';+ String get sendDropHint => '拖到一部裝置上傳送';@override- String get navFavorites => '收藏';+ String sendReleaseTo(String name) {+ return '放手以傳送到 $name';+ }@override- String get linkConnecting => '正在連線…';+ String get sendLan => '區域網絡';@override- String get linkServiceNotRunning => '背景服務未執行';+ String sendRelayLeft(String left) {+ return '中轉 · 今日剩 $left';+ }@override- String get linkLanMode => '在區域網路中尋找裝置';+ String get sendNeedsUpdate => '需要更新';@override- String get linkServerUnreachable => '連不上伺服器,區域網路內照常同步';+ String sendNeedsUpdateTip(String name) {+ return '$name 更新到隔空貼 2.5 或更新版本後才能接收檔案。';+ }@override- String get linkNothingOn => '區域網路探索已關閉,也沒有設定伺服器';+ String get sendNotReceiving => '不接收檔案';@override- String get linkLanBlocked => 'macOS 阻擋了區域網路存取';+ String get sendDelivered => '已送達';@override- String linkOnlinePeers(int count) {- return '$count 台裝置在線上';+ String sendToTitle(String name) {+ return '傳送到 $name';}@override- String get linkServerConnected => '已連線到伺服器';+ String get sendDropHere => '把檔案或資料夾拖到這裏';@override- String linkConnectionLost(String detail) {- return '連線中斷:$detail';- }+ String get sendDropStarts => '放手就開始傳送';@override- String get linkServiceDisconnected => '背景服務已中斷連線';+ String get sendChooseFiles => '選擇檔案…';@override- String get linkServiceDisabled => '背景服務已停用';+ String get sendChooseFolder => '選擇資料夾…';@override- String get errServiceNotConnected => '背景服務未連線';+ String get sendDropMore => '繼續拖入檔案,排在後面傳送';@override- String get errUnimplemented => '這項功能尚未提供';+ String sendSavedWhere(String name) {+ return '檔案會存到 $name 設定的位置,預設是「下載」資料夾。';+ }@override- String get errUnavailable => '無法連線到背景服務';+ String get sendCloseKeeps => '關閉視窗不影響傳送';@override- String errServiceStart(String detail) {+ String get sendRemoveQueued => '移除';++ @override+ String get sendCannotDrop => '這個項目不能直接拖過來傳送。請先把它存成檔案,或使用「選擇檔案…」。';++ @override+ String sendErrOffline(String name) {+ return '$name 不在線上。';+ }++ @override+ String sendErrDisabled(String name) {+ return '$name 關閉了接收檔案。';+ }++ @override+ String get sendErrMissing => '有檔案已經不在了。';++ @override+ String get relayConfirmTitle => '經官方服務中轉傳送?';++ @override+ String relayConfirmBody(String name, String left) {+ return '$name 目前和這部電腦沒有直連,檔案要經官方服務中轉,速度約 0.25 MB/s。今天的中轉額度還剩 $left。';+ }++ @override+ String relayConfirmOver(String size) {+ return '這些檔案($size)超出了今天剩餘的額度。傳到額度用完時會暫停;兩部電腦連上直連、或明天額度恢復後,自動繼續。';+ }++ @override+ String relayConfirmWithin(String size) {+ return '這次大約用掉今天額度中的 $size。';+ }++ @override+ String get relayExhausted => '今天的中轉額度已用完,北京時間 0 點恢復。兩部電腦連上直連後不受限制。';++ @override+ String get relayDontAskToday => '今天傳給這部裝置時不再詢問';++ @override+ String get relaySendAnyway => '仍然傳送';++ @override+ String get relayOwnServer => '中轉,速度取決於你的伺服器頻寬';++ @override+ String get transfersReceived => '收到的';++ @override+ String get transfersSent => '傳出的';++ @override+ String get transfersClearAll => '全部清除';++ @override+ String get transfersClearTitle => '清除這個列表?';++ @override+ String get transfersClearBody => '只清除紀錄,檔案不會被刪除。';++ @override+ String get transfersEmptyReceived => '其他裝置傳來的檔案會出現在這裏';++ @override+ String get transfersEmptySent => '你傳出的檔案會出現在這裏';++ @override+ String transferFrom(String name) {+ return '來自 $name';+ }++ @override+ String transferTo(String name) {+ return '傳給 $name';+ }++ @override+ String transferItems(String name, int total, int others) {+ return '$name 等 $total 項';+ }++ @override+ String transferFileCount(int count) {+ return '$count 個檔案';+ }++ @override+ String get transferQueued => '排隊中';++ @override+ String transferScanning(String count) {+ return '正在統計… 已找到 $count 個檔案';+ }++ @override+ String transferWaitingPeer(String name) {+ return '正在聯絡 $name…';+ }++ @override+ String get transferSending => '正在傳送';++ @override+ String get transferReceiving => '正在接收';++ @override+ String transferCurrent(String file, String index, String total) {+ return '正在傳:$file(第 $index / $total 個)';+ }++ @override+ String transferLeft(String time) {+ return '還剩 $time';+ }++ @override+ String etaSeconds(int n) {+ return '$n 秒';+ }++ @override+ String etaMinutes(int n) {+ return '$n 分鐘';+ }++ @override+ String etaHours(int h, int m) {+ return '$h 小時 $m 分';+ }++ @override+ String get transferPaused => '已暫停:今天的中轉額度用完了';++ @override+ String get transferInterrupted => '已中斷,重新連上後繼續';++ @override+ String transferInterruptedIncoming(String name) {+ return '已中斷 · 等 $name 繼續';+ }++ @override+ String get transferCancelled => '已取消';++ @override+ String transferPeerCancelled(String name) {+ return '$name 取消了';+ }++ @override+ String get transferExpired => '已過期';++ @override+ String get transferMissing => '已移動或刪除';++ @override+ String transferNotSent(String reason) {+ return '沒有傳出:$reason';+ }++ @override+ String transferNotReceived(String reason) {+ return '沒有收下:$reason';+ }++ @override+ String reasonNoSpacePeer(String name, String size) {+ return '$name 的磁碟空間不足,還差 $size';+ }++ @override+ String reasonNoSpace(String size) {+ return '磁碟空間不足,還差 $size';+ }++ @override+ String reasonDestUnavailablePeer(String name) {+ return '$name 的儲存位置無法使用';+ }++ @override+ String get reasonDestUnavailable => '儲存位置無法使用,請在設定中檢查';++ @override+ String get reasonFileTooLarge => '儲存位置在 FAT32 格式的磁碟上,放不下超過 4 GB 的檔案';++ @override+ String reasonDisabledPeer(String name) {+ return '$name 關閉了接收檔案';+ }++ @override+ String get reasonSourceChanged => '傳送過程中有檔案被修改了';++ @override+ String get reasonSourceMissing => '有檔案已經不在了';++ @override+ String get reasonReadError => '有檔案讀取失敗';++ @override+ String get reasonWriteFailed => '檔案寫入失敗';++ @override+ String get reasonHashMismatch => '有檔案在傳輸中損毀了';++ @override+ String reasonUnsupported(String name) {+ return '$name 需要更新才能接收檔案';+ }++ @override+ String get reasonOther => '出了點問題';++ @override+ String get revealInFinder => '在 Finder 中顯示';++ @override+ String get revealInFolder => '在資料夾中顯示';++ @override+ String get revealOpenFolder => '打開資料夾';++ @override+ String get transferResend => '重新傳送';++ @override+ String get transferRemove => '從列表中移除';++ @override+ String get transferCopyPath => '拷貝路徑';++ @override+ String get transferPathCopied => '已拷貝路徑';++ @override+ String sendingTo(String name, String percent) {+ return '正在傳給 $name · $percent';+ }++ @override+ String receivingFrom(String name, String percent) {+ return '正在接收 $name 的檔案 · $percent';+ }++ @override+ String get receiveFiles => '接收其他裝置傳來的檔案';++ @override+ String get saveTo => '儲存到';++ @override+ String get saveToChange => '更改…';++ @override+ String get saveToDefault => '下載(預設)';++ @override+ String get saveToUseDefault => '改回「下載」';++ @override+ String get receiveNotify => '收到檔案時通知';++ @override+ String receiveFootnote(String device) {+ return '只有已配對的裝置能傳檔案給$device。傳輸期間$device不會自動睡眠。';+ }++ @override+ String get saveDirNotFound => '這個資料夾不存在。';++ @override+ String get saveDirNotWritable => '隔空貼無法把檔案存到這個資料夾。';++ @override+ String get saveDirPermission =>+ '隔空貼還沒有使用這個資料夾的權限。請在「系統設定 → 私隱與保安 → 檔案和資料夾」中允許。';+}++/// The translations for Chinese, as used in Taiwan, using the Han script (`zh_Hant_TW`).+class AppLocalizationsZhHantTw extends AppLocalizationsZh {+ AppLocalizationsZhHantTw() : super('zh_Hant_TW');++ @override+ String get appName => '隔空貼';++ @override+ String get navHistory => '複製記錄';++ @override+ String get navDevices => '裝置';++ @override+ String get navSettings => '設定';++ @override+ String get navFavorites => '收藏';++ @override+ String get linkConnecting => '正在連線…';++ @override+ String get linkServiceNotRunning => '背景服務未執行';++ @override+ String get linkLanMode => '在區域網路中尋找裝置';++ @override+ String get linkServerUnreachable => '連不上伺服器,區域網路內照常同步';++ @override+ String get linkNothingOn => '區域網路探索已關閉,也沒有設定伺服器';++ @override+ String get linkLanBlocked => 'macOS 阻擋了區域網路存取';++ @override+ String linkOnlinePeers(int count) {+ return '$count 台裝置在線上';+ }++ @override+ String get linkServerConnected => '已連線到伺服器';++ @override+ String linkConnectionLost(String detail) {+ return '連線中斷:$detail';+ }++ @override+ String get linkServiceDisconnected => '背景服務已中斷連線';++ @override+ String get linkServiceDisabled => '背景服務已停用';++ @override+ String get errServiceNotConnected => '背景服務未連線';++ @override+ String get errUnimplemented => '這項功能尚未提供';++ @override+ String get errUnavailable => '無法連線到背景服務';++ @override+ String errServiceStart(String detail) {return '啟動背景服務失敗:$detail';}@@ -3938,4 +4642,356 @@ class AppLocalizationsZhHantTw extends AppLocalizationsZh {String notifyClipboardFailedBody(String name, String error) {return '$name\n$error\n可從此通知或複製記錄重新放入剪貼簿。';}++ @override+ String get navSend => '隔空傳送';++ @override+ String get sendSubtitle => '把檔案拖到一台裝置上,直接傳過去';++ @override+ String get sendNoDevicesTitle => '還沒有配對的裝置';++ @override+ String get sendNoDevicesBody => '先配對另一台電腦,之後就能在這裡傳檔案給它。';++ @override+ String get sendDropHint => '拖到一台裝置上傳送';++ @override+ String sendReleaseTo(String name) {+ return '放開以傳送到 $name';+ }++ @override+ String get sendLan => '區域網路';++ @override+ String sendRelayLeft(String left) {+ return '中繼 · 今日剩 $left';+ }++ @override+ String get sendNeedsUpdate => '需要更新';++ @override+ String sendNeedsUpdateTip(String name) {+ return '$name 更新到隔空貼 2.5 或更新版本後才能接收檔案。';+ }++ @override+ String get sendNotReceiving => '不接收檔案';++ @override+ String get sendDelivered => '已送達';++ @override+ String sendToTitle(String name) {+ return '傳送到 $name';+ }++ @override+ String get sendDropHere => '把檔案或資料夾拖到這裡';++ @override+ String get sendDropStarts => '放開就開始傳送';++ @override+ String get sendChooseFiles => '選擇檔案…';++ @override+ String get sendChooseFolder => '選擇資料夾…';++ @override+ String get sendDropMore => '繼續拖入檔案,排在後面傳送';++ @override+ String sendSavedWhere(String name) {+ return '檔案會存到 $name 設定的位置,預設是「下載項目」檔案夾。';+ }++ @override+ String get sendCloseKeeps => '關閉視窗不影響傳送';++ @override+ String get sendRemoveQueued => '移除';++ @override+ String get sendCannotDrop => '這個項目不能直接拖過來傳送。請先把它存成檔案,或使用「選擇檔案…」。';++ @override+ String sendErrOffline(String name) {+ return '$name 不在線上。';+ }++ @override+ String sendErrDisabled(String name) {+ return '$name 關閉了接收檔案。';+ }++ @override+ String get sendErrMissing => '有檔案已經不在了。';++ @override+ String get relayConfirmTitle => '經官方服務中繼傳送?';++ @override+ String relayConfirmBody(String name, String left) {+ return '$name 目前和這台電腦沒有直連,檔案要經官方服務中繼,速度約 0.25 MB/s。今天的中繼額度還剩 $left。';+ }++ @override+ String relayConfirmOver(String size) {+ return '這些檔案($size)超出了今天剩餘的額度。傳到額度用完時會暫停;兩台電腦連上直連、或明天額度恢復後,自動繼續。';+ }++ @override+ String relayConfirmWithin(String size) {+ return '這次大約用掉今天額度中的 $size。';+ }++ @override+ String get relayExhausted => '今天的中繼額度已用完,北京時間 0 點恢復。兩台電腦連上直連後不受限制。';++ @override+ String get relayDontAskToday => '今天傳給這台裝置時不再詢問';++ @override+ String get relaySendAnyway => '仍然傳送';++ @override+ String get relayOwnServer => '中繼,速度取決於你的伺服器頻寬';++ @override+ String get transfersReceived => '收到的';++ @override+ String get transfersSent => '傳出的';++ @override+ String get transfersClearAll => '全部清除';++ @override+ String get transfersClearTitle => '清除這個列表?';++ @override+ String get transfersClearBody => '只清除紀錄,檔案不會被刪除。';++ @override+ String get transfersEmptyReceived => '其他裝置傳來的檔案會出現在這裡';++ @override+ String get transfersEmptySent => '你傳出的檔案會出現在這裡';++ @override+ String transferFrom(String name) {+ return '來自 $name';+ }++ @override+ String transferTo(String name) {+ return '傳給 $name';+ }++ @override+ String transferItems(String name, int total, int others) {+ return '$name 等 $total 項';+ }++ @override+ String transferFileCount(int count) {+ return '$count 個檔案';+ }++ @override+ String get transferQueued => '排隊中';++ @override+ String transferScanning(String count) {+ return '正在統計… 已找到 $count 個檔案';+ }++ @override+ String transferWaitingPeer(String name) {+ return '正在聯絡 $name…';+ }++ @override+ String get transferSending => '正在傳送';++ @override+ String get transferReceiving => '正在接收';++ @override+ String transferCurrent(String file, String index, String total) {+ return '正在傳:$file(第 $index / $total 個)';+ }++ @override+ String transferLeft(String time) {+ return '還剩 $time';+ }++ @override+ String etaSeconds(int n) {+ return '$n 秒';+ }++ @override+ String etaMinutes(int n) {+ return '$n 分鐘';+ }++ @override+ String etaHours(int h, int m) {+ return '$h 小時 $m 分';+ }++ @override+ String get transferPaused => '已暫停:今天的中繼額度用完了';++ @override+ String get transferInterrupted => '已中斷,重新連上後繼續';++ @override+ String transferInterruptedIncoming(String name) {+ return '已中斷 · 等 $name 繼續';+ }++ @override+ String get transferCancelled => '已取消';++ @override+ String transferPeerCancelled(String name) {+ return '$name 取消了';+ }++ @override+ String get transferExpired => '已過期';++ @override+ String get transferMissing => '已移動或刪除';++ @override+ String transferNotSent(String reason) {+ return '沒有傳出:$reason';+ }++ @override+ String transferNotReceived(String reason) {+ return '沒有收下:$reason';+ }++ @override+ String reasonNoSpacePeer(String name, String size) {+ return '$name 的磁碟空間不足,還差 $size';+ }++ @override+ String reasonNoSpace(String size) {+ return '磁碟空間不足,還差 $size';+ }++ @override+ String reasonDestUnavailablePeer(String name) {+ return '$name 的儲存位置無法使用';+ }++ @override+ String get reasonDestUnavailable => '儲存位置無法使用,請在設定中檢查';++ @override+ String get reasonFileTooLarge => '儲存位置在 FAT32 格式的磁碟上,放不下超過 4 GB 的檔案';++ @override+ String reasonDisabledPeer(String name) {+ return '$name 關閉了接收檔案';+ }++ @override+ String get reasonSourceChanged => '傳送過程中有檔案被修改了';++ @override+ String get reasonSourceMissing => '有檔案已經不在了';++ @override+ String get reasonReadError => '有檔案讀取失敗';++ @override+ String get reasonWriteFailed => '檔案寫入失敗';++ @override+ String get reasonHashMismatch => '有檔案在傳輸中損毀了';++ @override+ String reasonUnsupported(String name) {+ return '$name 需要更新才能接收檔案';+ }++ @override+ String get reasonOther => '出了點問題';++ @override+ String get revealInFinder => '在 Finder 中顯示';++ @override+ String get revealInFolder => '在資料夾中顯示';++ @override+ String get revealOpenFolder => '打開資料夾';++ @override+ String get transferResend => '重新傳送';++ @override+ String get transferRemove => '從列表中移除';++ @override+ String get transferCopyPath => '拷貝路徑';++ @override+ String get transferPathCopied => '已拷貝路徑';++ @override+ String sendingTo(String name, String percent) {+ return '正在傳給 $name · $percent';+ }++ @override+ String receivingFrom(String name, String percent) {+ return '正在接收 $name 的檔案 · $percent';+ }++ @override+ String get receiveFiles => '接收其他裝置傳來的檔案';++ @override+ String get saveTo => '儲存到';++ @override+ String get saveToChange => '更改…';++ @override+ String get saveToDefault => '下載項目(預設)';++ @override+ String get saveToUseDefault => '改回「下載項目」';++ @override+ String get receiveNotify => '收到檔案時通知';++ @override+ String receiveFootnote(String device) {+ return '只有已配對的裝置能傳檔案給$device。傳輸期間$device不會自動睡眠。';+ }++ @override+ String get saveDirNotFound => '這個資料夾不存在。';++ @override+ String get saveDirNotWritable => '隔空貼無法把檔案存到這個資料夾。';++ @override+ String get saveDirPermission =>+ '隔空貼還沒有使用這個資料夾的權限。請在「系統設定 → 隱私權與安全性 → 檔案與資料夾」中允許。';}diff --git a/ui/lib/l10n/app_zh.arb b/ui/lib/l10n/app_zh.arbindex 0ca5951..0e6dd94 100644--- a/ui/lib/l10n/app_zh.arb+++ b/ui/lib/l10n/app_zh.arb@@ -384,5 +384,100 @@"notifyFailedTitle": "接收失败","notifyFailedBody": "{name}\n{error}\n可从此通知或复制记录重试。","notifyClipboardFailedTitle": "已接收,但未能写入剪贴板",- "notifyClipboardFailedBody": "{name}\n{error}\n可从此通知或复制记录重新放入剪贴板。"+ "notifyClipboardFailedBody": "{name}\n{error}\n可从此通知或复制记录重新放入剪贴板。",+ "navSend": "隔空传送",+ "sendSubtitle": "把文件拖到一台设备上,直接发过去",+ "sendNoDevicesTitle": "还没有配对的设备",+ "sendNoDevicesBody": "先配对另一台电脑,之后就能在这里给它发文件。",+ "sendDropHint": "拖到一台设备上发送",+ "sendReleaseTo": "松手发送到 {name}",+ "sendLan": "局域网",+ "sendRelayLeft": "中转 · 今日剩 {left}",+ "sendNeedsUpdate": "需要更新",+ "sendNeedsUpdateTip": "{name} 更新到隔空贴 2.5 或更高版本后才能接收文件。",+ "sendNotReceiving": "不接收文件",+ "sendDelivered": "已送达",+ "sendToTitle": "发送到 {name}",+ "sendDropHere": "把文件或文件夹拖到这里",+ "sendDropStarts": "松手就开始发送",+ "sendChooseFiles": "选择文件…",+ "sendChooseFolder": "选择文件夹…",+ "sendDropMore": "继续拖入文件,排在后面发送",+ "sendSavedWhere": "文件存到 {name} 设置的位置,默认是「下载」文件夹。",+ "sendCloseKeeps": "关闭窗口不影响发送",+ "sendRemoveQueued": "移除",+ "sendCannotDrop": "这个项目不能直接拖过来发送。请先把它存成文件,或者用「选择文件…」。",+ "sendErrOffline": "{name} 不在线。",+ "sendErrDisabled": "{name} 关闭了接收文件。",+ "sendErrMissing": "有文件已经不在了。",+ "relayConfirmTitle": "经官方服务中转发送?",+ "relayConfirmBody": "{name} 现在和这台电脑没有直连,文件要经官方服务中转,速度约 0.25 MB/s。今天的中转额度还剩 {left}。",+ "relayConfirmOver": "这些文件({size})超出了今天剩余的额度。发到额度用完时会暂停;两台电脑连上直连、或明天额度恢复后,自动继续。",+ "relayConfirmWithin": "这次大约用掉今天额度中的 {size}。",+ "relayExhausted": "今天的中转额度已用完,北京时间 0 点恢复。两台电脑连上直连后不受限制。",+ "relayDontAskToday": "今天发给这台设备时不再询问",+ "relaySendAnyway": "仍然发送",+ "relayOwnServer": "中转,速度取决于你的服务器带宽",+ "transfersReceived": "收到的",+ "transfersSent": "发出的",+ "transfersClearAll": "全部清除",+ "transfersClearTitle": "清除这个列表?",+ "transfersClearBody": "只清除记录,文件不会被删除。",+ "transfersEmptyReceived": "其他设备发来的文件会出现在这里",+ "transfersEmptySent": "你发出的文件会出现在这里",+ "transferFrom": "来自 {name}",+ "transferTo": "发给 {name}",+ "transferItems": "{name} 等 {total} 项",+ "transferFileCount": "{count} 个文件",+ "transferQueued": "排队中",+ "transferScanning": "正在统计… 已找到 {count} 个文件",+ "transferWaitingPeer": "正在联系 {name}…",+ "transferSending": "正在发送",+ "transferReceiving": "正在接收",+ "transferCurrent": "正在传:{file}(第 {index} / {total} 个)",+ "transferLeft": "还剩 {time}",+ "etaSeconds": "{n} 秒",+ "etaMinutes": "{n} 分钟",+ "etaHours": "{h} 小时 {m} 分",+ "transferPaused": "已暂停:今天的中转额度用完了",+ "transferInterrupted": "已中断,重新连上后继续",+ "transferInterruptedIncoming": "已中断 · 等 {name} 继续",+ "transferCancelled": "已取消",+ "transferPeerCancelled": "{name} 取消了",+ "transferExpired": "已过期",+ "transferMissing": "已移动或删除",+ "transferNotSent": "没有发出:{reason}",+ "transferNotReceived": "没有收下:{reason}",+ "reasonNoSpacePeer": "{name} 的磁盘空间不足,还差 {size}",+ "reasonNoSpace": "磁盘空间不足,还差 {size}",+ "reasonDestUnavailablePeer": "{name} 的保存位置不可用",+ "reasonDestUnavailable": "保存位置不可用,请在设置里检查",+ "reasonFileTooLarge": "保存位置在 FAT32 格式的盘上,放不下超过 4 GB 的文件",+ "reasonDisabledPeer": "{name} 关闭了接收文件",+ "reasonSourceChanged": "发送过程中有文件被修改了",+ "reasonSourceMissing": "有文件已经不在了",+ "reasonReadError": "有文件读取失败",+ "reasonWriteFailed": "文件写入失败",+ "reasonHashMismatch": "有文件在传输中损坏了",+ "reasonUnsupported": "{name} 需要更新才能接收文件",+ "reasonOther": "出了点问题",+ "revealInFinder": "在访达中显示",+ "revealInFolder": "在文件夹中显示",+ "revealOpenFolder": "打开文件夹",+ "transferResend": "重新发送",+ "transferRemove": "从列表中移除",+ "transferCopyPath": "拷贝路径",+ "transferPathCopied": "已拷贝路径",+ "sendingTo": "正在发给 {name} · {percent}",+ "receivingFrom": "正在接收 {name} 的文件 · {percent}",+ "receiveFiles": "接收其他设备发来的文件",+ "saveTo": "保存到",+ "saveToChange": "更改…",+ "saveToDefault": "下载(默认)",+ "saveToUseDefault": "改回「下载」",+ "receiveNotify": "收到文件时通知",+ "receiveFootnote": "只有已配对的设备能给{device}发文件。传输期间{device}不会自动睡眠。",+ "saveDirNotFound": "这个文件夹不存在。",+ "saveDirNotWritable": "隔空贴不能把文件存到这个文件夹。",+ "saveDirPermission": "隔空贴还没有使用这个文件夹的权限。请在「系统设置 → 隐私与安全性 → 文件与文件夹」里允许。"}diff --git a/ui/lib/l10n/app_zh_Hant_HK.arb b/ui/lib/l10n/app_zh_Hant_HK.arbindex f3e7371..766f2d0 100644--- a/ui/lib/l10n/app_zh_Hant_HK.arb+++ b/ui/lib/l10n/app_zh_Hant_HK.arb@@ -384,5 +384,100 @@"notifyFailedTitle": "接收失敗","notifyFailedBody": "{name}\n{error}\n可從此通知或複製記錄重試。","notifyClipboardFailedTitle": "已接收,但無法寫入剪貼簿",- "notifyClipboardFailedBody": "{name}\n{error}\n可從此通知或複製記錄重新放入剪貼簿。"+ "notifyClipboardFailedBody": "{name}\n{error}\n可從此通知或複製記錄重新放入剪貼簿。",+ "navSend": "隔空傳送",+ "sendSubtitle": "把檔案拖到一部裝置上,直接傳過去",+ "sendNoDevicesTitle": "還沒有配對的裝置",+ "sendNoDevicesBody": "先配對另一部電腦,之後就能在這裏傳檔案給它。",+ "sendDropHint": "拖到一部裝置上傳送",+ "sendReleaseTo": "放手以傳送到 {name}",+ "sendLan": "區域網絡",+ "sendRelayLeft": "中轉 · 今日剩 {left}",+ "sendNeedsUpdate": "需要更新",+ "sendNeedsUpdateTip": "{name} 更新到隔空貼 2.5 或更新版本後才能接收檔案。",+ "sendNotReceiving": "不接收檔案",+ "sendDelivered": "已送達",+ "sendToTitle": "傳送到 {name}",+ "sendDropHere": "把檔案或資料夾拖到這裏",+ "sendDropStarts": "放手就開始傳送",+ "sendChooseFiles": "選擇檔案…",+ "sendChooseFolder": "選擇資料夾…",+ "sendDropMore": "繼續拖入檔案,排在後面傳送",+ "sendSavedWhere": "檔案會存到 {name} 設定的位置,預設是「下載」資料夾。",+ "sendCloseKeeps": "關閉視窗不影響傳送",+ "sendRemoveQueued": "移除",+ "sendCannotDrop": "這個項目不能直接拖過來傳送。請先把它存成檔案,或使用「選擇檔案…」。",+ "sendErrOffline": "{name} 不在線上。",+ "sendErrDisabled": "{name} 關閉了接收檔案。",+ "sendErrMissing": "有檔案已經不在了。",+ "relayConfirmTitle": "經官方服務中轉傳送?",+ "relayConfirmBody": "{name} 目前和這部電腦沒有直連,檔案要經官方服務中轉,速度約 0.25 MB/s。今天的中轉額度還剩 {left}。",+ "relayConfirmOver": "這些檔案({size})超出了今天剩餘的額度。傳到額度用完時會暫停;兩部電腦連上直連、或明天額度恢復後,自動繼續。",+ "relayConfirmWithin": "這次大約用掉今天額度中的 {size}。",+ "relayExhausted": "今天的中轉額度已用完,北京時間 0 點恢復。兩部電腦連上直連後不受限制。",+ "relayDontAskToday": "今天傳給這部裝置時不再詢問",+ "relaySendAnyway": "仍然傳送",+ "relayOwnServer": "中轉,速度取決於你的伺服器頻寬",+ "transfersReceived": "收到的",+ "transfersSent": "傳出的",+ "transfersClearAll": "全部清除",+ "transfersClearTitle": "清除這個列表?",+ "transfersClearBody": "只清除紀錄,檔案不會被刪除。",+ "transfersEmptyReceived": "其他裝置傳來的檔案會出現在這裏",+ "transfersEmptySent": "你傳出的檔案會出現在這裏",+ "transferFrom": "來自 {name}",+ "transferTo": "傳給 {name}",+ "transferItems": "{name} 等 {total} 項",+ "transferFileCount": "{count} 個檔案",+ "transferQueued": "排隊中",+ "transferScanning": "正在統計… 已找到 {count} 個檔案",+ "transferWaitingPeer": "正在聯絡 {name}…",+ "transferSending": "正在傳送",+ "transferReceiving": "正在接收",+ "transferCurrent": "正在傳:{file}(第 {index} / {total} 個)",+ "transferLeft": "還剩 {time}",+ "etaSeconds": "{n} 秒",+ "etaMinutes": "{n} 分鐘",+ "etaHours": "{h} 小時 {m} 分",+ "transferPaused": "已暫停:今天的中轉額度用完了",+ "transferInterrupted": "已中斷,重新連上後繼續",+ "transferInterruptedIncoming": "已中斷 · 等 {name} 繼續",+ "transferCancelled": "已取消",+ "transferPeerCancelled": "{name} 取消了",+ "transferExpired": "已過期",+ "transferMissing": "已移動或刪除",+ "transferNotSent": "沒有傳出:{reason}",+ "transferNotReceived": "沒有收下:{reason}",+ "reasonNoSpacePeer": "{name} 的磁碟空間不足,還差 {size}",+ "reasonNoSpace": "磁碟空間不足,還差 {size}",+ "reasonDestUnavailablePeer": "{name} 的儲存位置無法使用",+ "reasonDestUnavailable": "儲存位置無法使用,請在設定中檢查",+ "reasonFileTooLarge": "儲存位置在 FAT32 格式的磁碟上,放不下超過 4 GB 的檔案",+ "reasonDisabledPeer": "{name} 關閉了接收檔案",+ "reasonSourceChanged": "傳送過程中有檔案被修改了",+ "reasonSourceMissing": "有檔案已經不在了",+ "reasonReadError": "有檔案讀取失敗",+ "reasonWriteFailed": "檔案寫入失敗",+ "reasonHashMismatch": "有檔案在傳輸中損毀了",+ "reasonUnsupported": "{name} 需要更新才能接收檔案",+ "reasonOther": "出了點問題",+ "revealInFinder": "在 Finder 中顯示",+ "revealInFolder": "在資料夾中顯示",+ "revealOpenFolder": "打開資料夾",+ "transferResend": "重新傳送",+ "transferRemove": "從列表中移除",+ "transferCopyPath": "拷貝路徑",+ "transferPathCopied": "已拷貝路徑",+ "sendingTo": "正在傳給 {name} · {percent}",+ "receivingFrom": "正在接收 {name} 的檔案 · {percent}",+ "receiveFiles": "接收其他裝置傳來的檔案",+ "saveTo": "儲存到",+ "saveToChange": "更改…",+ "saveToDefault": "下載(預設)",+ "saveToUseDefault": "改回「下載」",+ "receiveNotify": "收到檔案時通知",+ "receiveFootnote": "只有已配對的裝置能傳檔案給{device}。傳輸期間{device}不會自動睡眠。",+ "saveDirNotFound": "這個資料夾不存在。",+ "saveDirNotWritable": "隔空貼無法把檔案存到這個資料夾。",+ "saveDirPermission": "隔空貼還沒有使用這個資料夾的權限。請在「系統設定 → 私隱與保安 → 檔案和資料夾」中允許。"}diff --git a/ui/lib/l10n/app_zh_Hant_TW.arb b/ui/lib/l10n/app_zh_Hant_TW.arbindex 43fde99..08015c8 100644--- a/ui/lib/l10n/app_zh_Hant_TW.arb+++ b/ui/lib/l10n/app_zh_Hant_TW.arb@@ -384,5 +384,100 @@"notifyFailedTitle": "接收失敗","notifyFailedBody": "{name}\n{error}\n可從此通知或複製記錄重試。","notifyClipboardFailedTitle": "已接收,但無法寫入剪貼簿",- "notifyClipboardFailedBody": "{name}\n{error}\n可從此通知或複製記錄重新放入剪貼簿。"+ "notifyClipboardFailedBody": "{name}\n{error}\n可從此通知或複製記錄重新放入剪貼簿。",+ "navSend": "隔空傳送",+ "sendSubtitle": "把檔案拖到一台裝置上,直接傳過去",+ "sendNoDevicesTitle": "還沒有配對的裝置",+ "sendNoDevicesBody": "先配對另一台電腦,之後就能在這裡傳檔案給它。",+ "sendDropHint": "拖到一台裝置上傳送",+ "sendReleaseTo": "放開以傳送到 {name}",+ "sendLan": "區域網路",+ "sendRelayLeft": "中繼 · 今日剩 {left}",+ "sendNeedsUpdate": "需要更新",+ "sendNeedsUpdateTip": "{name} 更新到隔空貼 2.5 或更新版本後才能接收檔案。",+ "sendNotReceiving": "不接收檔案",+ "sendDelivered": "已送達",+ "sendToTitle": "傳送到 {name}",+ "sendDropHere": "把檔案或資料夾拖到這裡",+ "sendDropStarts": "放開就開始傳送",+ "sendChooseFiles": "選擇檔案…",+ "sendChooseFolder": "選擇資料夾…",+ "sendDropMore": "繼續拖入檔案,排在後面傳送",+ "sendSavedWhere": "檔案會存到 {name} 設定的位置,預設是「下載項目」檔案夾。",+ "sendCloseKeeps": "關閉視窗不影響傳送",+ "sendRemoveQueued": "移除",+ "sendCannotDrop": "這個項目不能直接拖過來傳送。請先把它存成檔案,或使用「選擇檔案…」。",+ "sendErrOffline": "{name} 不在線上。",+ "sendErrDisabled": "{name} 關閉了接收檔案。",+ "sendErrMissing": "有檔案已經不在了。",+ "relayConfirmTitle": "經官方服務中繼傳送?",+ "relayConfirmBody": "{name} 目前和這台電腦沒有直連,檔案要經官方服務中繼,速度約 0.25 MB/s。今天的中繼額度還剩 {left}。",+ "relayConfirmOver": "這些檔案({size})超出了今天剩餘的額度。傳到額度用完時會暫停;兩台電腦連上直連、或明天額度恢復後,自動繼續。",+ "relayConfirmWithin": "這次大約用掉今天額度中的 {size}。",+ "relayExhausted": "今天的中繼額度已用完,北京時間 0 點恢復。兩台電腦連上直連後不受限制。",+ "relayDontAskToday": "今天傳給這台裝置時不再詢問",+ "relaySendAnyway": "仍然傳送",+ "relayOwnServer": "中繼,速度取決於你的伺服器頻寬",+ "transfersReceived": "收到的",+ "transfersSent": "傳出的",+ "transfersClearAll": "全部清除",+ "transfersClearTitle": "清除這個列表?",+ "transfersClearBody": "只清除紀錄,檔案不會被刪除。",+ "transfersEmptyReceived": "其他裝置傳來的檔案會出現在這裡",+ "transfersEmptySent": "你傳出的檔案會出現在這裡",+ "transferFrom": "來自 {name}",+ "transferTo": "傳給 {name}",+ "transferItems": "{name} 等 {total} 項",+ "transferFileCount": "{count} 個檔案",+ "transferQueued": "排隊中",+ "transferScanning": "正在統計… 已找到 {count} 個檔案",+ "transferWaitingPeer": "正在聯絡 {name}…",+ "transferSending": "正在傳送",+ "transferReceiving": "正在接收",+ "transferCurrent": "正在傳:{file}(第 {index} / {total} 個)",+ "transferLeft": "還剩 {time}",+ "etaSeconds": "{n} 秒",+ "etaMinutes": "{n} 分鐘",+ "etaHours": "{h} 小時 {m} 分",+ "transferPaused": "已暫停:今天的中繼額度用完了",+ "transferInterrupted": "已中斷,重新連上後繼續",+ "transferInterruptedIncoming": "已中斷 · 等 {name} 繼續",+ "transferCancelled": "已取消",+ "transferPeerCancelled": "{name} 取消了",+ "transferExpired": "已過期",+ "transferMissing": "已移動或刪除",+ "transferNotSent": "沒有傳出:{reason}",+ "transferNotReceived": "沒有收下:{reason}",+ "reasonNoSpacePeer": "{name} 的磁碟空間不足,還差 {size}",+ "reasonNoSpace": "磁碟空間不足,還差 {size}",+ "reasonDestUnavailablePeer": "{name} 的儲存位置無法使用",+ "reasonDestUnavailable": "儲存位置無法使用,請在設定中檢查",+ "reasonFileTooLarge": "儲存位置在 FAT32 格式的磁碟上,放不下超過 4 GB 的檔案",+ "reasonDisabledPeer": "{name} 關閉了接收檔案",+ "reasonSourceChanged": "傳送過程中有檔案被修改了",+ "reasonSourceMissing": "有檔案已經不在了",+ "reasonReadError": "有檔案讀取失敗",+ "reasonWriteFailed": "檔案寫入失敗",+ "reasonHashMismatch": "有檔案在傳輸中損毀了",+ "reasonUnsupported": "{name} 需要更新才能接收檔案",+ "reasonOther": "出了點問題",+ "revealInFinder": "在 Finder 中顯示",+ "revealInFolder": "在資料夾中顯示",+ "revealOpenFolder": "打開資料夾",+ "transferResend": "重新傳送",+ "transferRemove": "從列表中移除",+ "transferCopyPath": "拷貝路徑",+ "transferPathCopied": "已拷貝路徑",+ "sendingTo": "正在傳給 {name} · {percent}",+ "receivingFrom": "正在接收 {name} 的檔案 · {percent}",+ "receiveFiles": "接收其他裝置傳來的檔案",+ "saveTo": "儲存到",+ "saveToChange": "更改…",+ "saveToDefault": "下載項目(預設)",+ "saveToUseDefault": "改回「下載項目」",+ "receiveNotify": "收到檔案時通知",+ "receiveFootnote": "只有已配對的裝置能傳檔案給{device}。傳輸期間{device}不會自動睡眠。",+ "saveDirNotFound": "這個資料夾不存在。",+ "saveDirNotWritable": "隔空貼無法把檔案存到這個資料夾。",+ "saveDirPermission": "隔空貼還沒有使用這個資料夾的權限。請在「系統設定 → 隱私權與安全性 → 檔案與資料夾」中允許。"}diff --git a/ui/lib/main.dart b/ui/lib/main.dartindex 547d071..4a49b68 100644--- a/ui/lib/main.dart+++ b/ui/lib/main.dart@@ -3,11 +3,13 @@ import 'dart:io';import 'package:flutter/material.dart';import 'app_state.dart';+import 'gen/pasteferry/v1/daemon.pb.dart' show TransferDirection;import 'background_service.dart';import 'i18n.dart';import 'pages/devices_page.dart';import 'pages/favorites_page.dart';import 'pages/history_page.dart';+import 'pages/send_page.dart';import 'pages/service_page.dart';import 'pages/settings_page.dart';import 'pages/official_service_page.dart';@@ -119,7 +121,7 @@ class AppScope extends InheritedNotifier<AppState> {context.getInheritedWidgetOfExactType<AppScope>()!.notifier!;}-enum Section { history, favorites, devices, official, settings }+enum Section { history, favorites, send, devices, official, settings }class Shell extends StatefulWidget {const Shell({super.key, this.initialSection = Section.history});@@ -135,6 +137,7 @@ class _ShellState extends State<Shell> with WidgetsBindingObserver {bool _pairingDialogOpen = false;bool _officialDialogOpen = false;int _seenOfficialNavigation = 0;+ int _seenPageRequest = 0;String? _shownUpdateResult;AppLifecycleState _lifecycle = AppLifecycleState.resumed;@@ -164,6 +167,11 @@ class _ShellState extends State<Shell> with WidgetsBindingObserver {_seenOfficialNavigation = state.officialNavigationSerial;if (state.officialEnabled) _section = Section.official;}+ // 点了隔空传送的通知:后台服务让界面切到隔空传送页+ if (state.pageRequestSerial != _seenPageRequest) {+ _seenPageRequest = state.pageRequestSerial;+ if (state.pageRequest == 'send') _section = Section.send;+ }if (!state.officialEnabled && _section == Section.official) {_section = Section.settings;}@@ -281,6 +289,7 @@ class _ShellState extends State<Shell> with WidgetsBindingObserver {: switch (_section) {Section.history => const HistoryPage(),Section.favorites => const FavoritesPage(),+ Section.send => const SendPage(),Section.devices => const DevicesPage(),Section.official => const OfficialServicePage(),Section.settings => const SettingsPage(),@@ -345,6 +354,14 @@ class _Sidebar extends StatelessWidget {trailing: state.favorites.isEmpty ? null : '${state.favorites.length}',onTap: () => onSelect(Section.favorites),),+ _NavItem(+ icon: AppIcons.send,+ label: l.navSend,+ selected: current == Section.send,+ // 有文件在收发时显示进度环,否则显示新收到、还没看过的批数+ trailingWidget: _SendBadge(state: state),+ onTap: () => onSelect(Section.send),+ ),_NavItem(icon: AppIcons.deviceLaptop,label: l.navDevices,@@ -380,6 +397,7 @@ class _NavItem extends StatefulWidget {required this.selected,required this.onTap,this.trailing,+ this.trailingWidget,});final IconData icon;@@ -387,6 +405,7 @@ class _NavItem extends StatefulWidget {final bool selected;final VoidCallback onTap;final String? trailing;+ final Widget? trailingWidget;@overrideState<_NavItem> createState() => _NavItemState();@@ -435,6 +454,7 @@ class _NavItemState extends State<_NavItem> {),if (widget.trailing != null)Text(widget.trailing!, style: context.text.labelSmall),+ ?widget.trailingWidget,],),),@@ -444,6 +464,40 @@ class _NavItemState extends State<_NavItem> {}}+/// 侧边栏「隔空传送」右边的标记:有文件在收发时是一个小进度环(悬停列出每一批),+/// 否则是新收到、还没看过的批数,都没有时不显示。+class _SendBadge extends StatelessWidget {+ const _SendBadge({required this.state});++ final AppState state;++ @override+ Widget build(BuildContext context) {+ final l = context.l10n;+ final active = state.activeTransfers;+ if (active.isEmpty) {+ final n = state.unseenTransfers;+ return n == 0 ? const SizedBox.shrink() : Text('$n', style: context.text.labelSmall);+ }+ final lines = [+ for (final t in active)+ () {+ final percent = t.totalBytes > 0 ? '${(t.doneBytes.toInt() * 100 / t.totalBytes.toInt()).floor()}%' : '…';+ return t.direction == TransferDirection.TRANSFER_DIRECTION_OUTGOING+ ? l.sendingTo(t.deviceName, percent)+ : l.receivingFrom(t.deviceName, percent);+ }(),+ ];+ return Tooltip(+ message: lines.join('\n'),+ child: SizedBox.square(+ dimension: 12,+ child: CircularProgressIndicator(strokeWidth: 1.6, value: state.transferProgress),+ ),+ );+ }+}+/// 自动检查发现新版本时,侧边栏底部多一行,点开是更新窗口。不弹窗打扰。class _UpdateHint extends StatelessWidget {const _UpdateHint();diff --git a/ui/lib/pages/send_page.dart b/ui/lib/pages/send_page.dartnew file mode 100644index 0000000..483b9f0--- /dev/null+++ b/ui/lib/pages/send_page.dart@@ -0,0 +1,758 @@+import 'dart:async';+import 'dart:io';+import 'dart:math' as math;++import 'package:desktop_drop/desktop_drop.dart';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';++import '../app_state.dart';+import '../gen/pasteferry/v1/daemon.pb.dart';+import '../i18n.dart';+import '../icons.dart';+import '../main.dart';+import '../platform.dart';+import '../theme.dart';+import '../widgets/common.dart';+import '../widgets/nearby_dialog.dart';+import '../widgets/pairing_dialog.dart';+import '../widgets/radar.dart';+import '../widgets/record_hover.dart';+import '../widgets/send_dialog.dart';+import 'devices_page.dart' show platformIcon;++/// 隔空传送:雷达上是已配对的设备,把文件拖到一台上,或者点它在弹出的窗口里拖,就直接发过去。+/// 下面是收到的和发出的列表。见 design/send-files.md。+class SendPage extends StatefulWidget {+ const SendPage({super.key});++ @override+ State<SendPage> createState() => _SendPageState();+}++/// 雷达上的位置(角度,0 是正右方,顺时针)。内圈放同一局域网里的设备,外圈放其他网络的和离线的。+/// 内外圈错开角度,名字不会叠在一起。+const _innerAngles = [180.0, 0.0, -90.0, 90.0];+const _outerAngles = [-145.0, -35.0, 145.0, 35.0, 180.0, 0.0];++/// 这次启动以来检查过保存位置没有:macOS 上第一次写「下载」等文件夹时系统会弹窗,要在用户看着的时候触发+bool _receiveDirChecked = false;++class _SendPageState extends State<SendPage> with SingleTickerProviderStateMixin {+ late final AnimationController _pulse =+ AnimationController(vsync: this, duration: const Duration(milliseconds: 2800));+ TransferDirection _tab = TransferDirection.TRANSFER_DIRECTION_INCOMING;++ /// 拖着文件经过雷达时:光标的位置,以及光标下的设备+ bool _dragging = false;+ String? _dropTarget;++ /// 发送窗口开着时,雷达不接拖放(窗口下面的雷达也会收到拖放事件)+ bool _dialogOpen = false;++ /// 每台设备在雷达上占一个固定位置:(内圈?, 第几个)+ final Map<String, (bool, int)> _slots = {};++ /// 设备在雷达上的位置,拖放时据此判断落在哪台上+ final Map<String, Rect> _nodeRects = {};++ CheckReceiveDirResponse? _dirCheck;+ Timer? _deliveredTimer;++ @override+ void initState() {+ super.initState();+ WidgetsBinding.instance.addPostFrameCallback((_) => _checkReceiveDir());+ }++ @override+ void didChangeDependencies() {+ super.didChangeDependencies();+ if (MediaQuery.disableAnimationsOf(context)) {+ _pulse.stop();+ } else if (!_pulse.isAnimating) {+ _pulse.repeat();+ }+ }++ @override+ void dispose() {+ _deliveredTimer?.cancel();+ _pulse.dispose();+ super.dispose();+ }++ Future<void> _checkReceiveDir() async {+ if (_receiveDirChecked || !mounted) return;+ final state = AppScope.read(context);+ if (!state.isOnline) return;+ _receiveDirChecked = true;+ try {+ final r = await state.checkReceiveDir();+ if (mounted) setState(() => _dirCheck = r);+ } catch (_) {+ // 旧版后台服务没有这个接口+ }+ }++ Future<void> _openDialog(Device d) async {+ setState(() => _dialogOpen = true);+ await showSendDialog(context, d);+ if (mounted) setState(() => _dialogOpen = false);+ }++ String? _deviceAt(Offset pos) {+ for (final e in _nodeRects.entries) {+ if (e.value.inflate(8).contains(pos)) return e.key;+ }+ return null;+ }++ @override+ Widget build(BuildContext context) {+ final state = AppScope.of(context);+ // 停在这一页上时,新收到的都算看过+ if (state.unseenTransfers > 0) {+ WidgetsBinding.instance.addPostFrameCallback((_) => state.markTransfersSeen());+ }+ _scheduleDeliveredRefresh(state);++ return LayoutBuilder(builder: (context, box) => _body(context, state, box.maxHeight));+ }++ Widget _body(BuildContext context, AppState state, double height) {+ final l = context.l10n;+ // 雷达随窗口高度伸缩,给下面的列表至少留出几行+ final radarHeight = (height - 330).clamp(220.0, 300.0);+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ PageHeader(title: l.navSend, subtitle: l.sendSubtitle),+ if (_dirCheck != null && !_dirCheck!.ok)+ Padding(+ padding: const EdgeInsets.fromLTRB(Insets.xl, 0, Insets.xl, Insets.md),+ child: Notice(+ title: l.reasonDestUnavailable,+ message: switch (_dirCheck!.error) {+ 'not_found' => l.saveDirNotFound,+ 'permission_denied' => l.saveDirPermission,+ _ => l.saveDirNotWritable,+ },+ ),+ ),+ if (state.peers.isEmpty)+ SizedBox(+ height: radarHeight,+ child: EmptyState(+ icon: AppIcons.send,+ title: l.sendNoDevicesTitle,+ description: l.sendNoDevicesBody,+ action: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ FilledButton(onPressed: () => showPairingDialog(context), child: Text(l.addDevice)),+ const SizedBox(width: Insets.sm),+ OutlinedButton(onPressed: () => showNearbyDialog(context), child: Text(l.searchNearby)),+ ],+ ),+ ),+ )+ else+ SizedBox(height: radarHeight, child: _radar(context, state, radarHeight)),+ Expanded(child: _TransferList(direction: _tab, onDirection: (d) => setState(() => _tab = d))),+ ],+ );+ }++ /// 刚送达的设备在雷达上显示 3 秒「已送达」,到时间刷新一次+ void _scheduleDeliveredRefresh(AppState state) {+ final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;+ final recent = state+ .transfers(TransferDirection.TRANSFER_DIRECTION_OUTGOING)+ .where((t) => t.status == 'done' && now - t.finishedAtUnix.toInt() < 3);+ if (recent.isEmpty || _deliveredTimer?.isActive == true) return;+ _deliveredTimer = Timer(const Duration(seconds: 3), () {+ if (mounted) setState(() {});+ });+ }++ Widget _radar(BuildContext context, AppState state, double height) {+ final p = context.palette;+ final l = context.l10n;+ final selfPlatform = state.self?.platform ?? Platform.operatingSystem.replaceFirst('macos', 'darwin');+ final peers = state.peers;++ // 分配位置:已有的不动,新来的按内外圈占空位。换了网络的设备换到另一圈。+ // 窗口矮的时候内圈的上下两个位置会压到本机,只用左右两个,其余的放外圈+ final innerSlots = height >= 280 ? _innerAngles.length : 2;+ final ids = {for (final d in peers) d.id};+ _slots.removeWhere((id, s) => !ids.contains(id) || (s.$1 && s.$2 >= innerSlots));+ for (final d in peers) {+ final wantInner = d.online && d.lanReachable;+ final cur = _slots[d.id];+ if (cur != null && cur.$1 == wantInner) continue;+ // 内圈满了的局域网设备放外圈+ final innerFree = _slots.entries.where((e) => e.key != d.id && e.value.$1).length < innerSlots;+ final inner = wantInner && innerFree;+ if (cur != null && cur.$1 == inner) continue;+ _slots.remove(d.id);+ final used = {for (final s in _slots.values) if (s.$1 == inner) s.$2};+ final count = inner ? innerSlots : _outerAngles.length;+ final free = List.generate(count, (i) => i).where((i) => !used.contains(i)).firstOrNull;+ if (free != null) _slots[d.id] = (inner, free);+ }+ final overflow = peers.where((d) => !_slots.containsKey(d.id)).toList();++ return Column(+ children: [+ Expanded(+ child: DropTarget(+ enable: !_dialogOpen,+ onDragEntered: (e) => setState(() {+ _dragging = true;+ _dropTarget = _deviceAt(e.localPosition);+ }),+ onDragUpdated: (e) {+ final target = _deviceAt(e.localPosition);+ if (target != _dropTarget) setState(() => _dropTarget = target);+ },+ onDragExited: (_) => setState(() {+ _dragging = false;+ _dropTarget = null;+ }),+ onDragDone: (details) {+ final target = _deviceAt(details.localPosition);+ setState(() {+ _dragging = false;+ _dropTarget = null;+ });+ final d = peers.where((x) => x.id == target).firstOrNull;+ if (d == null) {+ showToast(context, l.sendDropHint);+ } else if (_canSend(d)) {+ sendFilesTo(context, d, droppedPaths(details));+ }+ },+ child: LayoutBuilder(+ builder: (context, box) {+ final center = box.biggest.center(Offset.zero);+ final outerRx = math.min(280.0, box.maxWidth / 2 - _SendNode.width / 2);+ final innerRx = math.min(130.0, outerRx * 0.5);+ final outerRy = math.min(110.0, box.maxHeight / 2 - 40);+ final innerRy = outerRy * 0.62;+ _nodeRects.clear();+ final nodes = <Widget>[];+ for (final d in peers) {+ final slot = _slots[d.id];+ if (slot == null) continue;+ final (inner, i) = slot;+ final a = (inner ? _innerAngles[i] : _outerAngles[i]) * math.pi / 180;+ final at = center ++ Offset((inner ? innerRx : outerRx) * math.cos(a), (inner ? innerRy : outerRy) * math.sin(a));+ final rect = Rect.fromLTWH(at.dx - _SendNode.width / 2, at.dy - _SendNode.avatar / 2,+ _SendNode.width, _SendNode.avatar + 36);+ _nodeRects[d.id] = rect;+ nodes.add(Positioned(+ key: ValueKey(d.id),+ left: rect.left,+ top: rect.top,+ width: _SendNode.width,+ child: _node(context, state, d),+ ));+ }+ return Stack(+ clipBehavior: Clip.none,+ children: [+ Positioned.fill(+ child: RepaintBoundary(+ child: CustomPaint(+ painter: RadarPainter(+ pulse: _pulse,+ ring: p.separator,+ wave: p.accent,+ // 圆圈就画在设备所在的内外两圈上+ orbits: [+ Size(innerRx, innerRy),+ Size(outerRx, outerRy),+ ],+ ),+ ),+ ),+ ),+ Positioned(+ left: center.dx - _SendNode.width / 2,+ top: center.dy - _SendNode.avatar / 2,+ width: _SendNode.width,+ child: RadarSelfNode(platform: selfPlatform, size: _SendNode.avatar),+ ),+ ...nodes,+ if (_dragging && _dropTarget == null)+ Positioned(+ left: 0,+ right: 0,+ bottom: 4,+ child: Text(l.sendDropHint, textAlign: TextAlign.center, style: context.text.bodySmall),+ ),+ ],+ );+ },+ ),+ ),+ ),+ if (overflow.isNotEmpty)+ Padding(+ padding: const EdgeInsets.fromLTRB(Insets.xl, 0, Insets.xl, Insets.sm),+ child: Wrap(+ spacing: Insets.sm,+ runSpacing: Insets.xs,+ alignment: WrapAlignment.center,+ children: [+ for (final d in overflow)+ ActionChip(+ avatar: Icon(platformIcon(d.platform), size: 14),+ label: Text(d.name),+ onPressed: _canSend(d) ? () => _openDialog(d) : null,+ ),+ ],+ ),+ ),+ ],+ );+ }++ bool _canSend(Device d) => d.online && d.receivesFiles && !d.receiveDisabled;++ Widget _node(BuildContext context, AppState state, Device d) {+ final l = context.l10n;+ final sending = state.sendingTo(d.id);+ final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;+ final delivered = state+ .transfers(TransferDirection.TRANSFER_DIRECTION_OUTGOING)+ .any((t) => t.deviceId == d.id && t.status == 'done' && now - t.finishedAtUnix.toInt() < 3);+ final enabled = _canSend(d);+ final String status;+ String? tip;+ if (!d.online) {+ status = l.offline;+ } else if (!d.receivesFiles) {+ status = l.sendNeedsUpdate;+ tip = l.sendNeedsUpdateTip(d.name);+ } else if (d.receiveDisabled) {+ status = l.sendNotReceiving;+ } else if (sending != null && sending.status == 'active' && sending.totalBytes > 0) {+ status = '${(sending.doneBytes.toInt() * 100 / sending.totalBytes.toInt()).floor()}%';+ } else if (delivered) {+ status = '✓ ${l.sendDelivered}';+ } else {+ status = routeLabel(l, state, d);+ }+ double? progress;+ if (sending != null) {+ progress = sending.status == 'active' && sending.totalBytes > 0+ ? sending.doneBytes.toInt() / sending.totalBytes.toInt()+ : null;+ }+ final node = _SendNode(+ device: d,+ status: status,+ enabled: enabled,+ dropping: _dragging && enabled,+ dropTarget: _dropTarget == d.id && enabled,+ sending: sending != null,+ progress: progress,+ onTap: enabled ? () => _openDialog(d) : null,+ );+ return tip == null ? node : Tooltip(message: tip, child: node);+ }+}++/// 雷达上的一台已配对设备:圆形图标、名字、状态。正在发给它时图标外面一圈进度环。+class _SendNode extends StatefulWidget {+ const _SendNode({+ required this.device,+ required this.status,+ required this.enabled,+ required this.dropping,+ required this.dropTarget,+ required this.sending,+ required this.progress,+ this.onTap,+ });++ static const width = 120.0;+ static const avatar = 46.0;++ final Device device;+ final String status;+ final bool enabled;++ /// 正拖着文件经过雷达:能接收的设备描边变亮+ final bool dropping;++ /// 光标正在这台设备上:系统蓝、略微放大+ final bool dropTarget;+ final bool sending;+ final double? progress;+ final VoidCallback? onTap;++ @override+ State<_SendNode> createState() => _SendNodeState();+}++class _SendNodeState extends State<_SendNode> {+ bool _hover = false;++ @override+ Widget build(BuildContext context) {+ final p = context.palette;+ final d = widget.device;+ final highlight = widget.enabled && (_hover || widget.dropTarget);+ final border = widget.dropTarget+ ? p.accent+ : highlight || widget.dropping+ ? p.accent.withValues(alpha: widget.dropTarget || _hover ? 1 : 0.6)+ : p.border;++ final node = Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ AnimatedScale(+ scale: widget.dropTarget ? 1.08 : 1,+ duration: const Duration(milliseconds: 120),+ child: SizedBox.square(+ dimension: _SendNode.avatar,+ child: Stack(+ alignment: Alignment.center,+ children: [+ AnimatedContainer(+ duration: const Duration(milliseconds: 120),+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: widget.dropTarget ? p.accent.withValues(alpha: 0.08) : p.surface,+ border: Border.all(color: border, width: highlight || widget.dropping ? 1.5 : 1),+ boxShadow: const [BoxShadow(color: Color(0x14000000), blurRadius: 6, offset: Offset(0, 2))],+ ),+ ),+ Icon(platformIcon(d.platform), size: 22, color: highlight ? p.accent : p.textDim),+ if (widget.sending)+ SizedBox.expand(+ child: CircularProgressIndicator(strokeWidth: 2, value: widget.progress),+ ),+ ],+ ),+ ),+ ),+ const SizedBox(height: 6),+ Text(+ d.name,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ textAlign: TextAlign.center,+ style: context.text.labelMedium?.copyWith(color: p.text),+ ),+ Text(+ widget.status,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ textAlign: TextAlign.center,+ style: context.text.labelSmall,+ ),+ ],+ );++ return Semantics(+ button: widget.enabled,+ label: d.name,+ child: MouseRegion(+ cursor: widget.enabled ? SystemMouseCursors.click : SystemMouseCursors.basic,+ onEnter: (_) => setState(() => _hover = true),+ onExit: (_) => setState(() => _hover = false),+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: widget.onTap,+ child: Opacity(opacity: widget.enabled ? 1 : 0.5, child: node),+ ),+ ),+ );+ }+}++/// 收到的、发出的列表。+class _TransferList extends StatelessWidget {+ const _TransferList({required this.direction, required this.onDirection});++ final TransferDirection direction;+ final ValueChanged<TransferDirection> onDirection;++ @override+ Widget build(BuildContext context) {+ final state = AppScope.of(context);+ final l = context.l10n;+ final list = state.transfers(direction);+ final incoming = direction == TransferDirection.TRANSFER_DIRECTION_INCOMING;+ final finished = list.where((t) => const {'done', 'failed', 'cancelled', 'declined', 'expired'}.contains(t.status));+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(Insets.xl, Insets.sm, Insets.xl, Insets.sm),+ child: Row(+ children: [+ Segmented<TransferDirection>(+ value: direction,+ segments: [+ (TransferDirection.TRANSFER_DIRECTION_INCOMING, l.transfersReceived),+ (TransferDirection.TRANSFER_DIRECTION_OUTGOING, l.transfersSent),+ ],+ onChanged: onDirection,+ ),+ const Spacer(),+ if (finished.isNotEmpty)+ TextButton(onPressed: () => _clearAll(context), child: Text(l.transfersClearAll)),+ ],+ ),+ ),+ Divider(height: 1, indent: Insets.xl, endIndent: Insets.xl, color: context.palette.border),+ Expanded(+ child: list.isEmpty+ ? Center(+ child: Text(incoming ? l.transfersEmptyReceived : l.transfersEmptySent,+ style: context.text.bodySmall),+ )+ : ListView.builder(+ padding: const EdgeInsets.fromLTRB(Insets.lg, Insets.sm, Insets.lg, Insets.xl),+ itemCount: list.length,+ itemBuilder: (context, i) => _TransferRow(key: ValueKey(list[i].id), transfer: list[i]),+ ),+ ),+ ],+ );+ }++ Future<void> _clearAll(BuildContext context) async {+ final l = context.l10n;+ final ok = await showDialog<bool>(+ context: context,+ builder: (ctx) => AlertDialog(+ title: Text(l.transfersClearTitle),+ content: Text(l.transfersClearBody),+ actions: [+ TextButton(onPressed: () => Navigator.pop(ctx, false), child: Text(l.cancel)),+ FilledButton(onPressed: () => Navigator.pop(ctx, true), child: Text(l.clear)),+ ],+ ),+ );+ if (ok != true || !context.mounted) return;+ try {+ await AppScope.read(context).deleteTransfers(clearAll: direction);+ } catch (e) {+ if (context.mounted) showToast(context, AppState.describeError(e), error: true);+ }+ }+}++/// 列表里的一批:名称与大小;来自(发给)哪台、时间、状态;进行中的显示进度。+class _TransferRow extends StatefulWidget {+ const _TransferRow({super.key, required this.transfer});++ final Transfer transfer;++ @override+ State<_TransferRow> createState() => _TransferRowState();+}++class _TransferRowState extends State<_TransferRow> {+ bool _hovered = false;++ Transfer get t => widget.transfer;+ bool get _out => t.direction == TransferDirection.TRANSFER_DIRECTION_OUTGOING;++ /// 收到的、还在原处的顶层项目+ List<String> get _present => [+ for (var i = 0; i < t.paths.length; i++)+ if (i >= t.present.length || t.present[i]) t.paths[i],+ ];++ bool get _finished => const {'done', 'failed', 'cancelled', 'declined', 'expired'}.contains(t.status);++ @override+ Widget build(BuildContext context) {+ // 鼠标停一会儿列出这一批里的全部文件,与复制记录页的提示框同一个样式+ final row = _content(context);+ if (t.items.isEmpty) return row;+ return RecordHover(record: _asRecord(), details: _TransferDetails(t), child: row);+ }++ /// 悬停提示框认的是复制记录,把这一批包装成一条文件记录+ ClipRecord _asRecord() => ClipRecord(+ id: t.id,+ kind: ClipKind.CLIP_KIND_FILE,+ status: ClipStatus.CLIP_STATUS_READY,+ outgoing: _out,+ originDeviceName: t.deviceName,+ items: [for (final it in t.items) ClipItem(name: it.name, size: it.size, isDir: it.isDir)],+ totalSize: t.totalBytes,+ createdAtUnix: t.finishedAtUnix > 0 ? t.finishedAtUnix : t.createdAtUnix,+ );++ Widget _content(BuildContext context) {+ final l = context.l10n;+ final p = context.palette;+ final active = t.status == 'active';+ final time = DateTime.fromMillisecondsSinceEpoch(+ (t.finishedAtUnix > 0 ? t.finishedAtUnix : t.createdAtUnix).toInt() * 1000);+ final status = active ? '' : transferStatusText(l, t);+ final bad = const {'failed', 'declined'}.contains(t.status);+ final meta = [+ _out ? l.transferTo(t.deviceName) : l.transferFrom(t.deviceName),+ relativeTime(time),+ if (status.isNotEmpty) status,+ ].join(' · ');++ return MouseRegion(+ onEnter: (_) => setState(() => _hovered = true),+ onExit: (_) => setState(() => _hovered = false),+ child: GestureDetector(+ onSecondaryTapUp: (d) => _menu(context, d.globalPosition),+ onDoubleTap: !_out && t.status == 'done' && _present.length == 1 ? () => openUrl(_present.first) : null,+ child: Container(+ constraints: const BoxConstraints(minHeight: 52),+ padding: const EdgeInsets.symmetric(horizontal: Insets.md, vertical: Insets.sm),+ decoration: BoxDecoration(+ color: _hovered ? p.hover : Colors.transparent,+ borderRadius: BorderRadius.circular(Radii.sm),+ ),+ child: Row(+ children: [+ Icon(_out ? AppIcons.arrowUp : AppIcons.arrowDown, size: 12, color: p.textFaint),+ const SizedBox(width: Insets.xs),+ Icon(transferIcon(t), size: 18, color: p.textDim),+ const SizedBox(width: Insets.md),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ [+ transferTitle(l, t),+ if (t.fileCount > 1) l.transferFileCount(t.fileCount.toInt()),+ if (t.totalBytes > 0) humanBytes(t.totalBytes.toInt()),+ ].join(' · '),+ style: context.text.labelLarge,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ ),+ const SizedBox(height: 2),+ Text(+ meta,+ style: context.text.bodySmall?.copyWith(color: bad ? p.danger : null),+ maxLines: 2,+ overflow: TextOverflow.ellipsis,+ ),+ if (active) ...[+ const SizedBox(height: 4),+ LinearProgressIndicator(+ minHeight: 3,+ value: t.totalBytes > 0 ? t.doneBytes.toInt() / t.totalBytes.toInt() : null,+ ),+ const SizedBox(height: 2),+ Text(progressLabel(l, t), style: context.text.bodySmall),+ if (t.currentFile.isNotEmpty && t.fileCount > 1)+ Text(+ l.transferCurrent(t.currentFile.split('/').last, '${t.currentIndex}', '${t.fileCount}'),+ style: context.text.bodySmall,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ ),+ ],+ ],+ ),+ ),+ const SizedBox(width: Insets.md),+ _trailing(context),+ ],+ ),+ ),+ ),+ );+ }++ Widget _trailing(BuildContext context) {+ final l = context.l10n;+ final state = AppScope.read(context);+ final buttons = <Widget>[];+ if (!_out && t.status == 'done' && _present.isNotEmpty) {+ buttons.add(OutlinedButton(onPressed: () => revealFile(_present.first), child: Text(revealLabel(l))));+ }+ if (_out && (t.status == 'interrupted' || t.status == 'paused')) {+ buttons.add(OutlinedButton(onPressed: () => _run(() => state.resumeTransfer(t.id)), child: Text(l.continueAction)));+ }+ if (_out && (t.status == 'failed' || t.status == 'declined') && t.paths.isNotEmpty) {+ buttons.add(OutlinedButton(onPressed: _resend, child: Text(l.transferResend)));+ }+ if (!_finished) {+ buttons.add(IconAction(icon: AppIcons.xmark, tooltip: l.cancel, onTap: () => _run(() => state.cancelTransfer(t.id))));+ }+ return Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ for (var i = 0; i < buttons.length; i++) ...[if (i > 0) const SizedBox(width: Insets.xs), buttons[i]],+ ],+ );+ }++ Future<void> _resend() async {+ final d = AppScope.read(context).peers.where((x) => x.id == t.deviceId).firstOrNull;+ if (d == null) return;+ await sendFilesTo(context, d, t.paths.toList());+ }++ Future<void> _run(Future<void> Function() action) async {+ try {+ await action();+ } catch (e) {+ if (mounted) showToast(context, AppState.describeError(e), error: true);+ }+ }++ Future<void> _menu(BuildContext context, Offset at) async {+ final l = context.l10n;+ final state = AppScope.read(context);+ final reveal = !_out && t.status == 'done' && _present.isNotEmpty;+ final path = _present.firstOrNull ?? (t.paths.isNotEmpty ? t.paths.first : null);+ final choice = await showMenu<String>(+ context: context,+ position: RelativeRect.fromLTRB(at.dx, at.dy, at.dx, at.dy),+ items: [+ if (reveal) PopupMenuItem(value: 'reveal', child: Text(revealLabel(l))),+ if (path != null) PopupMenuItem(value: 'copy', child: Text(l.transferCopyPath)),+ if (_finished) PopupMenuItem(value: 'remove', child: Text(l.transferRemove)),+ ],+ );+ if (!context.mounted) return;+ switch (choice) {+ case 'reveal':+ revealFile(_present.first);+ case 'copy':+ await Clipboard.setData(ClipboardData(text: path!));+ if (context.mounted) showToast(context, l.transferPathCopied);+ case 'remove':+ await _run(() => state.deleteTransfers(ids: [t.id]));+ }+ }+}++/// 悬停提示框要的数据:发出的那一批显示源文件所在的文件夹。+class _TransferDetails implements RecordDetails {+ _TransferDetails(this.t);++ final Transfer t;++ @override+ Future<ClipDetail> clipDetail(String clipId) async => ClipDetail(sourcePaths: t.paths);++ @override+ Future<GetImagePreviewResponse> imagePreview(String clipId, {int index = 0}) async =>+ GetImagePreviewResponse(count: 0);+}diff --git a/ui/lib/pages/send_settings.dart b/ui/lib/pages/send_settings.dartnew file mode 100644index 0000000..8cc6087--- /dev/null+++ b/ui/lib/pages/send_settings.dart@@ -0,0 +1,110 @@+import 'dart:io';++import 'package:file_selector/file_selector.dart';+import 'package:flutter/material.dart';++import '../app_state.dart';+import '../gen/pasteferry/v1/daemon.pb.dart';+import '../i18n.dart';+import '../main.dart';+import '../platform.dart';+import '../theme.dart';+import '../widgets/common.dart';+import '../widgets/send_dialog.dart' show revealLabel;++/// 设置页里的「隔空传送」一组:接不接收、存到哪里、收到时通知。见 design/send-files.md 第 3 节。+class SendSection extends StatefulWidget {+ const SendSection({super.key, required this.config, required this.onUpdate});++ final Config config;+ final Future<void> Function(Config next) onUpdate;++ @override+ State<SendSection> createState() => _SendSectionState();+}++class _SendSectionState extends State<SendSection> {+ /// 选好的保存位置不能用时的说明+ String? _dirError;++ Future<void> _choose() async {+ final l = context.l10n;+ final state = AppScope.read(context);+ final dir = await getDirectoryPath(initialDirectory: _current(widget.config));+ if (dir == null || !mounted) return;+ try {+ // 先试写一次:不能写入的位置不保存。macOS 上系统的文件夹授权也在这时弹出+ final r = await state.checkReceiveDir(dir);+ if (!mounted) return;+ if (!r.ok) {+ setState(() => _dirError = switch (r.error) {+ 'not_found' => l.saveDirNotFound,+ 'permission_denied' => l.saveDirPermission,+ _ => l.saveDirNotWritable,+ });+ return;+ }+ setState(() => _dirError = null);+ await widget.onUpdate(widget.config.deepCopy()..receiveDir = dir);+ } catch (e) {+ if (mounted) showToast(context, AppState.describeError(e), error: true);+ }+ }++ /// 现在的保存位置;没设置时是系统的「下载」文件夹+ static String _current(Config c) => c.receiveDir.isNotEmpty ? c.receiveDir : downloadsDir();++ /// 用户目录写成 ~,路径短一些+ static String _short(String path) {+ final home = Platform.environment[Platform.isWindows ? 'USERPROFILE' : 'HOME'];+ if (home != null && home.isNotEmpty && path.startsWith(home)) return '~${path.substring(home.length)}';+ return path;+ }++ @override+ Widget build(BuildContext context) {+ final l = context.l10n;+ final cfg = widget.config;+ final custom = cfg.receiveDir.isNotEmpty;+ final p = context.palette;+ return GroupSection(+ title: l.navSend,+ footnote: l.receiveFootnote(Wording.thisDeviceInText),+ child: GroupBox(+ children: [+ SettingRow(+ title: l.receiveFiles,+ child: SmallSwitch(+ value: !cfg.receiveDisabled,+ onChanged: (v) => widget.onUpdate(cfg.deepCopy()..receiveDisabled = !v),+ ),+ ),+ SettingRow(+ title: l.saveTo,+ description: _dirError ?? (custom ? _short(cfg.receiveDir) : '${l.saveToDefault} · ${_short(downloadsDir())}'),+ descriptionColor: _dirError != null ? p.danger : null,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (custom)+ TextButton(+ onPressed: () => widget.onUpdate(cfg.deepCopy()..receiveDir = ''),+ child: Text(l.saveToUseDefault),+ ),+ TextButton(onPressed: () => revealFile(_current(cfg)), child: Text(revealLabel(l))),+ OutlinedButton(onPressed: _choose, child: Text(l.saveToChange)),+ ],+ ),+ ),+ SettingRow(+ title: l.receiveNotify,+ child: SmallSwitch(+ value: !cfg.receiveNotifyDisabled,+ onChanged: (v) => widget.onUpdate(cfg.deepCopy()..receiveNotifyDisabled = !v),+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/ui/lib/pages/settings_page.dart b/ui/lib/pages/settings_page.dartindex 84e46c0..495c8ee 100644--- a/ui/lib/pages/settings_page.dart+++ b/ui/lib/pages/settings_page.dart@@ -15,6 +15,7 @@ import '../widgets/update_dialog.dart';import '../icons.dart';import '../platform.dart';import 'quick_paste_settings.dart';+import 'send_settings.dart';class SettingsPage extends StatefulWidget {const SettingsPage({super.key});@@ -304,6 +305,7 @@ class _SettingsPageState extends State<SettingsPage> {],),),+ SendSection(config: cfg, onUpdate: (next) => _update(state, next)),GroupSection(title: l.whatToSync,child: GroupBox(diff --git a/ui/lib/widgets/nearby_dialog.dart b/ui/lib/widgets/nearby_dialog.dartindex a84d780..d453b06 100644--- a/ui/lib/widgets/nearby_dialog.dart+++ b/ui/lib/widgets/nearby_dialog.dart@@ -14,6 +14,7 @@ import '../platform.dart';import '../theme.dart';import 'common.dart';import 'pairing_dialog.dart';+import 'radar.dart';Future<void> showNearbyDialog(BuildContext context) =>pushPairingSetupRoute(context, (_) => const NearbyDialog());@@ -247,7 +248,7 @@ class _NearbyDialogState extends State<NearbyDialog> with SingleTickerProviderStPositioned.fill(child: RepaintBoundary(child: CustomPaint(- painter: _RadarPainter(pulse: _pulse, ring: p.separator, wave: p.accent),+ painter: RadarPainter(pulse: _pulse, ring: p.separator, wave: p.accent),),),),@@ -255,7 +256,7 @@ class _NearbyDialogState extends State<NearbyDialog> with SingleTickerProviderStleft: center.dx - _NearbyNode.width / 2,top: center.dy - _NearbyNode.avatar / 2,width: _NearbyNode.width,- child: _SelfNode(platform: selfPlatform),+ child: RadarSelfNode(platform: selfPlatform, size: _NearbyNode.avatar),),for (final d in _devices)Builder(builder: (context) {@@ -280,77 +281,6 @@ class _NearbyDialogState extends State<NearbyDialog> with SingleTickerProviderSt}}-/// 雷达的底:几圈很淡的同心圆,两道波纹错开半个周期从本机向外扩散、逐渐变淡。-class _RadarPainter extends CustomPainter {- _RadarPainter({required this.pulse, required this.ring, required this.wave}) : super(repaint: pulse);-- final Animation<double> pulse;- final Color ring;- final Color wave;-- @override- void paint(Canvas canvas, Size size) {- final c = size.center(Offset.zero);- final maxR = size.shortestSide / 2;- final rings = Paint()- ..style = PaintingStyle.stroke- ..strokeWidth = 1- ..color = ring;- for (final f in const [0.36, 0.68, 1.0]) {- canvas.drawCircle(c, maxR * f, rings);- }- for (final offset in const [0.0, 0.5]) {- final t = (pulse.value + offset) % 1.0;- final r = 28 + (maxR - 28) * Curves.easeOut.transform(t);- canvas.drawCircle(- c,- r,- Paint()- ..style = PaintingStyle.stroke- ..strokeWidth = 1.5- ..color = wave.withValues(alpha: 0.3 * (1 - t)),- );- }- }-- @override- bool shouldRepaint(_RadarPainter old) => old.ring != ring || old.wave != wave;-}--class _SelfNode extends StatelessWidget {- const _SelfNode({required this.platform});-- final String platform;-- @override- Widget build(BuildContext context) {- final p = context.palette;- return Column(- mainAxisSize: MainAxisSize.min,- children: [- Container(- width: _NearbyNode.avatar,- height: _NearbyNode.avatar,- decoration: BoxDecoration(- shape: BoxShape.circle,- color: p.surface,- border: Border.all(color: p.accent, width: 1.5),- ),- child: Icon(platformIcon(platform), size: 22, color: p.accent),- ),- const SizedBox(height: 6),- Text(- Wording.thisDevice,- maxLines: 1,- overflow: TextOverflow.ellipsis,- textAlign: TextAlign.center,- style: context.text.labelMedium,- ),- ],- );- }-}-/// 雷达上的一台附近设备:圆形图标加名字。已配对的变淡、不能点。class _NearbyNode extends StatefulWidget {const _NearbyNode({required this.device, required this.busy, this.onTap});diff --git a/ui/lib/widgets/radar.dart b/ui/lib/widgets/radar.dartnew file mode 100644index 0000000..b272500--- /dev/null+++ b/ui/lib/widgets/radar.dart@@ -0,0 +1,89 @@+import 'package:flutter/material.dart';++import '../pages/devices_page.dart' show platformIcon;+import '../platform.dart';+import '../theme.dart';++// 雷达:「搜索附近设备」与隔空传送页共用的底图和中间的本机。++/// 雷达的底:几圈很淡的同心圆,两道波纹错开半个周期从本机向外扩散、逐渐变淡。+///+/// 给了 [orbits](每圈的横向、纵向半径)时,按它们画椭圆,与设备所在的轨道重合,+/// 波纹扩散到最外一圈;没给时画三圈正圆,铺满短边。+class RadarPainter extends CustomPainter {+ RadarPainter({required this.pulse, required this.ring, required this.wave, this.orbits})+ : super(repaint: pulse);++ final Animation<double> pulse;+ final Color ring;+ final Color wave;+ final List<Size>? orbits;++ @override+ void paint(Canvas canvas, Size size) {+ final c = size.center(Offset.zero);+ final maxR = size.shortestSide / 2;+ final rings = Paint()+ ..style = PaintingStyle.stroke+ ..strokeWidth = 1+ ..color = ring;+ final orbits = this.orbits ?? [for (final f in const [0.36, 0.68, 1.0]) Size(maxR * f, maxR * f)];+ for (final o in orbits) {+ canvas.drawOval(Rect.fromCenter(center: c, width: o.width * 2, height: o.height * 2), rings);+ }+ final outer = orbits.last;+ for (final offset in const [0.0, 0.5]) {+ final t = (pulse.value + offset) % 1.0;+ final k = Curves.easeOut.transform(t);+ final rx = 28 + (outer.width - 28) * k;+ final ry = 28 + (outer.height - 28) * k;+ canvas.drawOval(+ Rect.fromCenter(center: c, width: rx * 2, height: ry * 2),+ Paint()+ ..style = PaintingStyle.stroke+ ..strokeWidth = 1.5+ ..color = wave.withValues(alpha: 0.3 * (1 - t)),+ );+ }+ }++ @override+ bool shouldRepaint(RadarPainter old) => old.ring != ring || old.wave != wave || old.orbits != orbits;+}++/// 雷达中间的本机。+class RadarSelfNode extends StatelessWidget {+ const RadarSelfNode({super.key, required this.platform, required this.size});++ final String platform;+ final double size;++ @override+ Widget build(BuildContext context) {+ final p = context.palette;+ return Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Container(+ width: size,+ height: size,+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: p.surface,+ border: Border.all(color: p.accent, width: 1.5),+ ),+ child: Icon(platformIcon(platform), size: 22, color: p.accent),+ ),+ const SizedBox(height: 6),+ Text(+ Wording.thisDevice,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ textAlign: TextAlign.center,+ style: context.text.labelMedium,+ ),+ ],+ );+ }+}+diff --git a/ui/lib/widgets/send_dialog.dart b/ui/lib/widgets/send_dialog.dartnew file mode 100644index 0000000..a8fbeab--- /dev/null+++ b/ui/lib/widgets/send_dialog.dart@@ -0,0 +1,493 @@+import 'dart:async';+import 'dart:io';++import 'package:desktop_drop/desktop_drop.dart';+import 'package:file_selector/file_selector.dart';+import 'package:flutter/material.dart';+import 'package:grpc/grpc.dart';++import '../app_state.dart';+import '../gen/pasteferry/v1/daemon.pb.dart';+import '../i18n.dart';+import '../icons.dart';+import '../main.dart';+import '../theme.dart';+import 'common.dart';++// 隔空传送的发送:点设备弹出的窗口,以及隔空传送页与窗口共用的发送逻辑。见 design/send-files.md 第 2 节。+// 用到拖放与文件选择插件的代码只放在主窗口里,快捷粘贴窗口不引用这个文件(它没有注册插件)。++/// 今天已经同意经官方服务中转发给哪些设备:设备 ID → 日期。只记在内存里,重开 App 后再问一次+final _relayConsent = <String, String>{};++String _today() {+ final n = DateTime.now();+ return '${n.year}-${n.month}-${n.day}';+}++/// 把 [paths] 发给 [device]。要经官方服务中转时先问一次;出错时弹出提示。成功返回这一批。+Future<Transfer?> sendFilesTo(BuildContext context, Device device, List<String> paths) async {+ final l = context.l10n;+ final state = AppScope.read(context);+ if (paths.isEmpty) {+ showToast(context, l.sendCannotDrop, error: true);+ return null;+ }+ var allowRelay = _relayConsent[device.id] == _today();+ for (;;) {+ try {+ return await state.sendFiles(device.id, paths, allowRelay: allowRelay);+ } on GrpcError catch (e) {+ if (!context.mounted) return null;+ switch (AppState.sendFailure(e)) {+ case SendFailure.needRelayConsent when !allowRelay:+ if (!await confirmRelay(context, device, paths)) return null;+ allowRelay = true;+ continue;+ case SendFailure.offline:+ showToast(context, l.sendErrOffline(device.name), error: true);+ case SendFailure.unsupported:+ showToast(context, l.sendNeedsUpdateTip(device.name), error: true);+ case SendFailure.disabled:+ showToast(context, l.sendErrDisabled(device.name), error: true);+ case SendFailure.noPaths:+ showToast(context, l.sendErrMissing, error: true);+ default:+ showToast(context, AppState.describeError(e), error: true);+ }+ return null;+ } catch (e) {+ if (context.mounted) showToast(context, AppState.describeError(e), error: true);+ return null;+ }+ }+}++/// 经官方服务中转之前问一次:速度、今天剩下的额度,这些文件会不会超出。+Future<bool> confirmRelay(BuildContext context, Device device, List<String> paths) async {+ final l = context.l10n;+ final usage = AppScope.read(context).officialUsage;+ final left = usage?.remainingBytes.toInt() ?? 0;+ final exhausted = usage == null || !usage.available || left <= 0;+ final size = await _estimateSize(paths);+ if (!context.mounted) return false;+ var dontAsk = false;+ final ok = await showDialog<bool>(+ context: context,+ builder: (ctx) => StatefulBuilder(+ builder: (ctx, setState) => AlertDialog(+ title: Text(l.relayConfirmTitle),+ content: SizedBox(+ width: 420,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ if (exhausted)+ Text(l.relayExhausted)+ else ...[+ Text(l.relayConfirmBody(device.name, humanBytes(left))),+ const SizedBox(height: Insets.md),+ // 经中转的加密数据比文件本身大约多 6%+ if (size != null && size * 1.06 > left)+ Text(l.relayConfirmOver(humanBytes(size)))+ else if (size != null)+ Text(l.relayConfirmWithin(humanBytes((size * 1.06).round()))),+ const SizedBox(height: Insets.md),+ InkWell(+ onTap: () => setState(() => dontAsk = !dontAsk),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Checkbox(value: dontAsk, onChanged: (v) => setState(() => dontAsk = v ?? false)),+ Text(l.relayDontAskToday, style: context.text.bodyMedium),+ ],+ ),+ ),+ ],+ ],+ ),+ ),+ actions: [+ TextButton(onPressed: () => Navigator.pop(ctx, false), child: Text(exhausted ? l.close : l.cancel)),+ if (!exhausted) FilledButton(onPressed: () => Navigator.pop(ctx, true), child: Text(l.relaySendAnyway)),+ ],+ ),+ ),+ );+ if (ok == true && dontAsk) _relayConsent[device.id] = _today();+ return ok == true;+}++/// 估算要发的总大小,最多花 0.8 秒;大文件夹数不完时返回 null,确认框里就不比较额度。+Future<int?> _estimateSize(List<String> paths) async {+ final watch = Stopwatch()..start();+ var total = 0;+ for (final p in paths) {+ final type = FileSystemEntity.typeSync(p);+ if (type == FileSystemEntityType.file) {+ total += File(p).lengthSync();+ continue;+ }+ if (type != FileSystemEntityType.directory) continue;+ await for (final e in Directory(p).list(recursive: true, followLinks: false)) {+ if (watch.elapsedMilliseconds > 800) return null;+ if (e is File) total += await e.length();+ }+ }+ return total;+}++/// 拖放进来的项目在本机的路径。照片 App、邮件附件这类「承诺文件」由插件先存到临时目录,也有路径。+List<String> droppedPaths(DropDoneDetails details) =>+ [for (final f in details.files) if (f.path.isNotEmpty) f.path];++/// 「在访达中显示」按各平台的叫法。+String revealLabel(AppLocalizations l) => Platform.isMacOS+ ? l.revealInFinder+ : Platform.isWindows+ ? l.revealInFolder+ : l.revealOpenFolder;++/// 设备此刻的连接方式:局域网、直连、中转(官方服务时带上今天剩下的额度)。+String routeLabel(AppLocalizations l, AppState state, Device d) {+ if (!d.online) return l.offline;+ switch (d.connection) {+ case ConnectionKind.CONNECTION_KIND_RELAY:+ final usage = state.officialUsage;+ if (state.officialEnabled && usage != null && usage.available) {+ return l.sendRelayLeft(humanBytes(usage.remainingBytes.toInt()));+ }+ return l.relay;+ default:+ return d.lanReachable ? l.sendLan : l.direct;+ }+}++/// 剩余时间:不到一分钟按秒,不到一小时按分钟,再长按小时和分钟。+String etaLabel(AppLocalizations l, double seconds) {+ if (seconds < 60) return l.etaSeconds(seconds.ceil().clamp(1, 59));+ if (seconds < 3600) return l.etaMinutes((seconds / 60).ceil());+ final m = (seconds / 60).ceil();+ return l.etaHours(m ~/ 60, m % 60);+}++/// 一批的进度说明:「64% · 1.3 / 2.1 GB · 41 MB/s · 还剩 20 秒」。+String progressLabel(AppLocalizations l, Transfer t) {+ final total = t.totalBytes.toInt();+ final done = t.doneBytes.toInt();+ final parts = <String>[+ if (total > 0) '${(done * 100 / total).floor()}%',+ if (total > 0) '${humanBytes(done)} / ${humanBytes(total)}',+ if (t.bytesPerSecond > 0) '${humanBytes(t.bytesPerSecond.round())}/s',+ if (t.bytesPerSecond > 0 && total > done) l.transferLeft(etaLabel(l, (total - done) / t.bytesPerSecond)),+ ];+ return parts.join(' · ');+}++/// 一批的名称:一项时就是它的名字,多项时「报告.pdf 等 3 项」。+String transferTitle(AppLocalizations l, Transfer t) {+ if (t.items.isEmpty) return '';+ final first = t.items.first.name;+ return t.items.length == 1 ? first : l.transferItems(first, t.items.length, t.items.length - 1);+}++IconData transferIcon(Transfer t) => t.items.length == 1 && t.items.first.isDir+ ? AppIcons.folder+ : t.items.length > 1+ ? AppIcons.docOnDoc+ : AppIcons.doc;++Future<void> showSendDialog(BuildContext context, Device device) =>+ showDialog<void>(context: context, builder: (_) => SendDialog(deviceId: device.id));++/// 点雷达上的一台设备弹出的窗口:把文件拖进来,松手就发。下面列出这次发的各批和进度。+class SendDialog extends StatefulWidget {+ const SendDialog({super.key, required this.deviceId});++ final String deviceId;++ @override+ State<SendDialog> createState() => _SendDialogState();+}++class _SendDialogState extends State<SendDialog> {+ bool _dragging = false;++ /// 这个窗口里发出的批次+ final List<String> _sent = [];++ Future<void> _send(Device d, List<String> paths) async {+ final t = await sendFilesTo(context, d, paths);+ if (t != null && mounted) setState(() => _sent.add(t.id));+ }++ Future<void> _chooseFiles(Device d) async {+ final files = await openFiles();+ if (files.isEmpty || !mounted) return;+ await _send(d, [for (final f in files) f.path]);+ }++ Future<void> _chooseFolder(Device d) async {+ final dir = await getDirectoryPath();+ if (dir == null || !mounted) return;+ await _send(d, [dir]);+ }++ @override+ Widget build(BuildContext context) {+ final state = AppScope.of(context);+ final l = context.l10n;+ final p = context.palette;+ final d = state.peers.where((x) => x.id == widget.deviceId).firstOrNull;+ if (d == null) {+ // 设备在窗口开着时被取消配对了+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) Navigator.pop(context);+ });+ return const SizedBox.shrink();+ }+ final batches = [+ for (final id in _sent)+ ?state.transfers(TransferDirection.TRANSFER_DIRECTION_OUTGOING).where((t) => t.id == id).firstOrNull,+ ];+ final route = d.connection == ConnectionKind.CONNECTION_KIND_RELAY && !state.officialEnabled+ ? l.relayOwnServer+ : routeLabel(l, state, d);++ return Dialog(+ child: SizedBox(+ width: 540,+ child: Padding(+ padding: const EdgeInsets.fromLTRB(Insets.xl, Insets.lg, Insets.md, Insets.xl),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Row(+ children: [+ Expanded(child: Text(l.sendToTitle(d.name), style: context.text.titleMedium)),+ IconAction(icon: AppIcons.xmark, tooltip: l.close, onTap: () => Navigator.pop(context)),+ ],+ ),+ Text(route, style: context.text.bodySmall),+ Padding(+ padding: const EdgeInsets.only(right: Insets.md),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ if (batches.isNotEmpty) ...[+ const SizedBox(height: Insets.lg),+ for (final t in batches.reversed) _BatchRow(transfer: t),+ ],+ const SizedBox(height: Insets.lg),+ DropTarget(+ onDragEntered: (_) => setState(() => _dragging = true),+ onDragExited: (_) => setState(() => _dragging = false),+ onDragDone: (details) {+ setState(() => _dragging = false);+ _send(d, droppedPaths(details));+ },+ child: CustomPaint(+ painter: DropZonePainter(+ color: _dragging ? p.accent : p.textFaint,+ dashed: !_dragging,+ fill: _dragging ? p.accent.withValues(alpha: 0.06) : Colors.transparent,+ ),+ child: Padding(+ padding: EdgeInsets.symmetric(+ horizontal: Insets.xl,+ vertical: batches.isEmpty ? 40 : Insets.lg,+ ),+ child: Column(+ children: [+ Text(+ _dragging+ ? l.sendReleaseTo(d.name)+ : batches.isEmpty+ ? l.sendDropHere+ : l.sendDropMore,+ style: context.text.titleSmall?.copyWith(color: _dragging ? p.accent : null),+ textAlign: TextAlign.center,+ ),+ if (batches.isEmpty && !_dragging) ...[+ const SizedBox(height: 4),+ Text(l.sendDropStarts, style: context.text.bodySmall),+ ],+ const SizedBox(height: Insets.lg),+ Wrap(+ spacing: Insets.sm,+ alignment: WrapAlignment.center,+ children: [+ OutlinedButton(onPressed: () => _chooseFiles(d), child: Text(l.sendChooseFiles)),+ OutlinedButton(onPressed: () => _chooseFolder(d), child: Text(l.sendChooseFolder)),+ ],+ ),+ ],+ ),+ ),+ ),+ ),+ const SizedBox(height: Insets.md),+ Text(+ batches.isEmpty ? l.sendSavedWhere(d.name) : l.sendCloseKeeps,+ style: context.text.bodySmall,+ ),+ ],+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }+}++/// 发送窗口里的一批:名称、大小,进度或结果。+class _BatchRow extends StatelessWidget {+ const _BatchRow({required this.transfer});++ final Transfer transfer;++ @override+ Widget build(BuildContext context) {+ final l = context.l10n;+ final p = context.palette;+ final t = transfer;+ final active = t.status == 'active';+ final cancellable = const {'scanning', 'queued', 'waiting', 'active', 'paused', 'interrupted'}.contains(t.status);+ final status = switch (t.status) {+ 'done' => l.sendDelivered,+ 'active' => null,+ _ => transferStatusText(l, t),+ };+ return Padding(+ padding: const EdgeInsets.only(bottom: Insets.sm),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Icon(transferIcon(t), size: 18, color: p.textDim),+ const SizedBox(width: Insets.md),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Text(+ [transferTitle(l, t), if (t.totalBytes > 0) humanBytes(t.totalBytes.toInt())].join(' · '),+ style: context.text.labelLarge,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ ),+ if (active) ...[+ const SizedBox(height: 4),+ LinearProgressIndicator(+ minHeight: 3,+ value: t.totalBytes > 0 ? t.doneBytes.toInt() / t.totalBytes.toInt() : null,+ ),+ const SizedBox(height: 2),+ Text(progressLabel(l, t), style: context.text.bodySmall),+ if (t.currentFile.isNotEmpty && t.fileCount > 1)+ Text(+ l.transferCurrent(t.currentFile.split('/').last, '${t.currentIndex}', '${t.fileCount}'),+ style: context.text.bodySmall,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ ),+ ] else if (status != null)+ Text(+ status,+ style: context.text.bodySmall?.copyWith(+ color: t.status == 'failed' || t.status == 'declined' ? p.danger : null,+ ),+ ),+ ],+ ),+ ),+ if (cancellable)+ Padding(+ padding: const EdgeInsets.only(left: Insets.sm),+ child: t.status == 'queued'+ ? TextButton(+ onPressed: () => AppScope.read(context).cancelTransfer(t.id),+ child: Text(l.sendRemoveQueued),+ )+ : IconAction(+ icon: AppIcons.xmark,+ tooltip: l.cancel,+ onTap: () => AppScope.read(context).cancelTransfer(t.id),+ ),+ ),+ ],+ ),+ );+ }+}++/// 一批现在的状态说明(进行中的进度另外显示)。+String transferStatusText(AppLocalizations l, Transfer t) {+ final out = t.direction == TransferDirection.TRANSFER_DIRECTION_OUTGOING;+ return switch (t.status) {+ 'scanning' => l.transferScanning('${t.scannedFiles}'),+ 'queued' => l.transferQueued,+ 'waiting' => out ? l.transferWaitingPeer(t.deviceName) : l.transferReceiving,+ 'active' => out ? l.transferSending : l.transferReceiving,+ 'paused' => l.transferPaused,+ 'interrupted' => out ? l.transferInterrupted : l.transferInterruptedIncoming(t.deviceName),+ 'done' => out ? l.sendDelivered : (t.present.isNotEmpty && t.present.every((p) => !p) ? l.transferMissing : ''),+ 'cancelled' => t.error == 'peer_cancelled' ? l.transferPeerCancelled(t.deviceName) : l.transferCancelled,+ 'expired' => l.transferExpired,+ _ => out ? l.transferNotSent(transferReason(l, t)) : l.transferNotReceived(transferReason(l, t)),+ };+}++/// 失败、回绝的原因。发出的说对方,收到的说本机。+String transferReason(AppLocalizations l, Transfer t) {+ final out = t.direction == TransferDirection.TRANSFER_DIRECTION_OUTGOING;+ final short = humanBytes(t.shortfallBytes.toInt());+ return switch (t.error) {+ 'no_space' => out ? l.reasonNoSpacePeer(t.deviceName, short) : l.reasonNoSpace(short),+ 'dest_unavailable' => out ? l.reasonDestUnavailablePeer(t.deviceName) : l.reasonDestUnavailable,+ 'file_too_large' => l.reasonFileTooLarge,+ 'disabled' => l.reasonDisabledPeer(t.deviceName),+ 'source_changed' => l.reasonSourceChanged,+ 'source_missing' => l.reasonSourceMissing,+ 'read_error' => l.reasonReadError,+ 'write_failed' => l.reasonWriteFailed,+ 'hash_mismatch' => l.reasonHashMismatch,+ 'unsupported' => l.reasonUnsupported(t.deviceName),+ _ => l.reasonOther,+ };+}++/// 拖放区的边框:平时是虚线,拖着文件经过时变成实线。+class DropZonePainter extends CustomPainter {+ DropZonePainter({required this.color, required this.dashed, required this.fill});++ final Color color;+ final bool dashed;+ final Color fill;++ @override+ void paint(Canvas canvas, Size size) {+ final rect = RRect.fromRectAndRadius(Offset.zero & size, const Radius.circular(Radii.md));+ canvas.drawRRect(rect, Paint()..color = fill);+ final paint = Paint()+ ..color = color+ ..style = PaintingStyle.stroke+ ..strokeWidth = dashed ? 1 : 1.5;+ final path = Path()..addRRect(rect.deflate(0.5));+ if (!dashed) {+ canvas.drawPath(path, paint);+ return;+ }+ for (final metric in path.computeMetrics()) {+ for (var d = 0.0; d < metric.length; d += 9) {+ canvas.drawPath(metric.extractPath(d, d + 5), paint);+ }+ }+ }++ @override+ bool shouldRepaint(DropZonePainter old) => old.color != color || old.dashed != dashed || old.fill != fill;+}diff --git a/ui/linux/flutter/generated_plugin_registrant.cc b/ui/linux/flutter/generated_plugin_registrant.ccindex e71a16d..0df6c34 100644--- a/ui/linux/flutter/generated_plugin_registrant.cc+++ b/ui/linux/flutter/generated_plugin_registrant.cc@@ -6,6 +6,14 @@#include "generated_plugin_registrant.h"+#include <desktop_drop/desktop_drop_plugin.h>+#include <file_selector_linux/file_selector_plugin.h>void fl_register_plugins(FlPluginRegistry* registry) {+ g_autoptr(FlPluginRegistrar) desktop_drop_registrar =+ fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin");+ desktop_drop_plugin_register_with_registrar(desktop_drop_registrar);+ g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =+ fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");+ file_selector_plugin_register_with_registrar(file_selector_linux_registrar);}diff --git a/ui/linux/flutter/generated_plugins.cmake b/ui/linux/flutter/generated_plugins.cmakeindex 2e1de87..b6e1238 100644--- a/ui/linux/flutter/generated_plugins.cmake+++ b/ui/linux/flutter/generated_plugins.cmake@@ -3,6 +3,8 @@#list(APPEND FLUTTER_PLUGIN_LIST+ desktop_drop+ file_selector_linux)list(APPEND FLUTTER_FFI_PLUGIN_LISTdiff --git a/ui/macos/Flutter/GeneratedPluginRegistrant.swift b/ui/macos/Flutter/GeneratedPluginRegistrant.swiftindex cccf817..2aca20e 100644--- a/ui/macos/Flutter/GeneratedPluginRegistrant.swift+++ b/ui/macos/Flutter/GeneratedPluginRegistrant.swift@@ -5,6 +5,10 @@import FlutterMacOSimport Foundation+import desktop_drop+import file_selector_macosfunc RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {+ DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))+ FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))}diff --git a/ui/pubspec.lock b/ui/pubspec.lockindex 2284de3..20f19b3 100644--- a/ui/pubspec.lock+++ b/ui/pubspec.lock@@ -1,6 +1,14 @@# Generated by pub# See https://dart.dev/tools/pub/glossary#lockfilepackages:+ args:+ dependency: transitive+ description:+ name: args+ sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04+ url: "https://pub.dev"+ source: hosted+ version: "2.7.0"async:dependency: transitivedescription:@@ -41,6 +49,14 @@ packages:url: "https://pub.dev"source: hostedversion: "1.19.1"+ cross_file:+ dependency: transitive+ description:+ name: cross_file+ sha256: f141ea4f277af142a0356955707f6556f37b03947d39d55585981a06ca437bd6+ url: "https://pub.dev"+ source: hosted+ version: "0.3.5+5"crypto:dependency: transitivedescription:@@ -57,6 +73,22 @@ packages:url: "https://pub.dev"source: hostedversion: "1.0.9"+ dbus:+ dependency: transitive+ description:+ name: dbus+ sha256: a48d5da28e89bd02196e80d81ed8d7954923d00a0f4a68cc20b575038f023383+ url: "https://pub.dev"+ source: hosted+ version: "0.7.15"+ desktop_drop:+ dependency: "direct main"+ description:+ name: desktop_drop+ sha256: "47ded09c85909edfed644fd4cbb5051b040d0aed5c79e7e062ea4b3b7156dbe4"+ url: "https://pub.dev"+ source: hosted+ version: "0.8.4"fake_async:dependency: transitivedescription:@@ -65,6 +97,78 @@ packages:url: "https://pub.dev"source: hostedversion: "1.3.3"+ ffi:+ dependency: transitive+ description:+ name: ffi+ sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45"+ url: "https://pub.dev"+ source: hosted+ version: "2.2.0"+ file_selector:+ dependency: "direct main"+ description:+ name: file_selector+ sha256: bd15e43e9268db636b53eeaca9f56324d1622af30e5c34d6e267649758c84d9a+ url: "https://pub.dev"+ source: hosted+ version: "1.1.0"+ file_selector_android:+ dependency: transitive+ description:+ name: file_selector_android+ sha256: d670cd0ce77a2e785b18d8b4d0a8d6a222d6a813ec9b7ddf2790a1b4fb6fa92c+ url: "https://pub.dev"+ source: hosted+ version: "0.5.2+11"+ file_selector_ios:+ dependency: transitive+ description:+ name: file_selector_ios+ sha256: "97269e5307a0ab813b1fa2430bada0a96e0afb74848417f8676f64ba5de0051c"+ url: "https://pub.dev"+ source: hosted+ version: "0.5.3+6"+ file_selector_linux:+ dependency: transitive+ description:+ name: file_selector_linux+ sha256: da76400e7872ce7637ffdce12749ec24169c25f6195c28372208e65a24bcd2ab+ url: "https://pub.dev"+ source: hosted+ version: "0.9.4+1"+ file_selector_macos:+ dependency: transitive+ description:+ name: file_selector_macos+ sha256: d57c62362766b5e7ae739448650b66c6aab7a68ba7ecc65e04018652645ae0f4+ url: "https://pub.dev"+ source: hosted+ version: "0.9.5+1"+ file_selector_platform_interface:+ dependency: transitive+ description:+ name: file_selector_platform_interface+ sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85"+ url: "https://pub.dev"+ source: hosted+ version: "2.7.0"+ file_selector_web:+ dependency: transitive+ description:+ name: file_selector_web+ sha256: "73181fbc5257776d8ecaa6a94ab3c8e920ad143b9132a6d984a9271dfc6928d3"+ url: "https://pub.dev"+ source: hosted+ version: "0.9.5"+ file_selector_windows:+ dependency: transitive+ description:+ name: file_selector_windows+ sha256: fbefc5fb92c6d3cbe8d284a2cd971b593bb07d2cd6da8557b81a862250b4acec+ url: "https://pub.dev"+ source: hosted+ version: "0.9.3+6"fixnum:dependency: "direct main"description:@@ -104,6 +208,11 @@ packages:description: fluttersource: sdkversion: "0.0.0"+ flutter_web_plugins:+ dependency: transitive+ description: flutter+ source: sdk+ version: "0.0.0"google_cloud:dependency: transitivedescription:@@ -232,6 +341,22 @@ packages:url: "https://pub.dev"source: hostedversion: "1.9.1"+ petitparser:+ dependency: transitive+ description:+ name: petitparser+ sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"+ url: "https://pub.dev"+ source: hosted+ version: "7.0.2"+ plugin_platform_interface:+ dependency: transitive+ description:+ name: plugin_platform_interface+ sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"+ url: "https://pub.dev"+ source: hosted+ version: "2.1.8"protobuf:dependency: "direct main"description:@@ -301,6 +426,14 @@ packages:url: "https://pub.dev"source: hostedversion: "1.4.0"+ universal_platform:+ dependency: transitive+ description:+ name: universal_platform+ sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.0"vector_math:dependency: transitivedescription:@@ -325,6 +458,14 @@ packages:url: "https://pub.dev"source: hostedversion: "1.1.1"+ xml:+ dependency: transitive+ description:+ name: xml+ sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4"+ url: "https://pub.dev"+ source: hosted+ version: "7.0.1"sdks:dart: ">=3.12.2 <4.0.0"- flutter: ">=3.18.0-18.0.pre.54"+ flutter: ">=3.44.0"diff --git a/ui/pubspec.yaml b/ui/pubspec.yamlindex 7f22cb9..26c2c0f 100644--- a/ui/pubspec.yaml+++ b/ui/pubspec.yaml@@ -41,6 +41,8 @@ dependencies:protobuf: ^6.1.0fixnum: ^1.1.1fluentui_system_icons: ^1.1.273+ desktop_drop: ^0.8.4+ file_selector: ^1.1.0dev_dependencies:flutter_test:diff --git a/ui/test/send_page_test.dart b/ui/test/send_page_test.dartnew file mode 100644index 0000000..5020f70--- /dev/null+++ b/ui/test/send_page_test.dart@@ -0,0 +1,159 @@+import 'package:fixnum/fixnum.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';++import 'package:pasteferry_ui/app_state.dart';+import 'package:pasteferry_ui/gen/pasteferry/v1/daemon.pb.dart';+import 'package:pasteferry_ui/i18n.dart';+import 'package:pasteferry_ui/main.dart';+import 'package:pasteferry_ui/widgets/send_dialog.dart';++const _in = TransferDirection.TRANSFER_DIRECTION_INCOMING;+const _out = TransferDirection.TRANSFER_DIRECTION_OUTGOING;++Int64 _now([int ago = 0]) => Int64(DateTime.now().millisecondsSinceEpoch ~/ 1000 - ago);++/// 各种状态都有:同一局域网、中转、离线、旧版本、关了接收的设备;收到的与发出的各种结果。+AppState _demo(String language, {bool withActive = true}) => AppState()+ ..debugSeed(+ status: Status(version: '2.5.0', officialUsage: OfficialUsage(available: true, remainingBytes: Int64(62 << 20))),+ config: Config(language: language, deviceName: 'MacBook Pro', serviceMode: ServiceMode.SERVICE_MODE_OFFICIAL),+ self: Device(id: 'self', name: 'MacBook Pro', platform: 'darwin'),+ peers: [+ Device(id: 'air', name: 'MacBook Air', platform: 'darwin', online: true, lanReachable: true,+ connection: ConnectionKind.CONNECTION_KIND_DIRECT, receivesFiles: true),+ Device(id: 'win', name: 'Windows 台式机', platform: 'windows', online: true,+ connection: ConnectionKind.CONNECTION_KIND_RELAY, receivesFiles: true),+ Device(id: 'linux', name: 'Ubuntu 笔记本', platform: 'linux'),+ Device(id: 'old', name: 'Old PC', platform: 'windows', online: true,+ connection: ConnectionKind.CONNECTION_KIND_DIRECT),+ Device(id: 'off', name: 'iMac', platform: 'darwin', online: true, lanReachable: true,+ connection: ConnectionKind.CONNECTION_KIND_DIRECT, receivesFiles: true, receiveDisabled: true),+ ],+ transfers: [+ if (withActive)+ Transfer(id: 'r1', direction: _in, deviceId: 'air', deviceName: 'MacBook Air', status: 'active',+ items: [ClipItem(name: '照片 2026-10', isDir: true, size: Int64(2 << 30))],+ totalBytes: Int64(2 << 30), doneBytes: Int64(1 << 30), fileCount: Int64(412),+ bytesPerSecond: 42e6, currentFile: '照片 2026-10/IMG_2041.HEIC', currentIndex: Int64(281),+ createdAtUnix: _now(30)),+ Transfer(id: 'r2', direction: _in, deviceId: 'air', deviceName: 'MacBook Air', status: 'done',+ items: [ClipItem(name: '合同扫描件.pdf'), ClipItem(name: 'notes.txt'), ClipItem(name: 'a.png')],+ paths: ['/tmp/合同扫描件.pdf', '/tmp/notes.txt', '/tmp/a.png'], present: [true, true, true],+ totalBytes: Int64(18 << 20), fileCount: Int64(3), createdAtUnix: _now(120), finishedAtUnix: _now(100), seen: true),+ Transfer(id: 'r3', direction: _in, deviceId: 'win', deviceName: 'Windows 台式机', status: 'done',+ items: [ClipItem(name: 'PasteFerry.dmg')], paths: ['/tmp/PasteFerry.dmg'], present: [false],+ totalBytes: Int64(812 << 20), fileCount: Int64(1), createdAtUnix: _now(90000), finishedAtUnix: _now(90000), seen: true),+ if (withActive)+ Transfer(id: 's1', direction: _out, deviceId: 'air', deviceName: 'MacBook Air', status: 'active',+ items: [ClipItem(name: '演示视频.mov')], totalBytes: Int64(3 << 30), doneBytes: Int64(1 << 30),+ fileCount: Int64(1), bytesPerSecond: 41e6, createdAtUnix: _now(20)),+ Transfer(id: 's2', direction: _out, deviceId: 'win', deviceName: 'Windows 台式机', status: 'interrupted',+ items: [ClipItem(name: 'build.zip')], paths: ['/tmp/build.zip'], totalBytes: Int64(300 << 20),+ doneBytes: Int64(120 << 20), fileCount: Int64(1), createdAtUnix: _now(600)),+ Transfer(id: 's3', direction: _out, deviceId: 'air', deviceName: 'MacBook Air', status: 'declined',+ error: 'no_space', shortfallBytes: Int64(1200 << 20), items: [ClipItem(name: '照片 2026-10', isDir: true)],+ paths: ['/tmp/照片 2026-10'], totalBytes: Int64(2 << 30), fileCount: Int64(412), createdAtUnix: _now(3600)),+ ],+ );++void main() {+ for (final language in ['en', 'ja', 'zh-Hans', 'zh-Hant-TW', 'zh-Hant-HK']) {+ group('最小窗口下的 $language 隔空传送', () {+ setUp(() {+ final view = TestWidgetsFlutterBinding.instance.platformDispatcher.views.first;+ view.physicalSize = const Size(760, 520);+ view.devicePixelRatio = 1;+ });+ tearDown(() => TestWidgetsFlutterBinding.instance.platformDispatcher.views.first.reset());++ Future<AppLocalizations> open(WidgetTester tester, AppState state) async {+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pump();+ final l = AppLocalizations.of(tester.element(find.byType(Shell)));+ await tester.tap(find.text(l.navSend).first);+ await tester.pump();+ return l;+ }++ testWidgets('雷达与列表', (tester) async {+ final l = await open(tester, _demo(language));+ expect(find.text(l.sendSubtitle), findsOneWidget);+ for (final name in ['MacBook Air', 'Windows 台式机', 'Ubuntu 笔记本', 'Old PC', 'iMac']) {+ expect(find.text(name), findsOneWidget, reason: name);+ }+ expect(find.text(l.sendNeedsUpdate), findsOneWidget);+ expect(find.text(l.sendNotReceiving), findsOneWidget);+ expect(find.text(l.sendRelayLeft('62.0 MB')), findsOneWidget);+ // 收到的。最小窗口下列表只放得下两三行,后面的要滚动+ final list = find.byType(Scrollable).last;+ expect(find.textContaining('IMG_2041.HEIC'), findsOneWidget);+ await tester.scrollUntilVisible(find.textContaining(l.transferItems('合同扫描件.pdf', 3, 2)), 60, scrollable: list);+ await tester.scrollUntilVisible(find.textContaining(l.transferMissing), 60, scrollable: list);+ // 发出的+ await tester.tap(find.text(l.transfersSent));+ await tester.pump();+ await tester.scrollUntilVisible(find.text(l.continueAction), 60, scrollable: list);+ await tester.scrollUntilVisible(find.textContaining(l.reasonNoSpacePeer('MacBook Air', '1.2 GB')), 60,+ scrollable: list);+ expect(find.text(l.transferResend), findsOneWidget);+ });++ testWidgets('发送窗口', (tester) async {+ final l = await open(tester, _demo(language));+ await tester.tap(find.text('MacBook Air'));+ // 雷达的波纹一直在动,等不到 pumpAndSettle,等弹窗的动画放完就行+ await tester.pump(const Duration(milliseconds: 400));+ expect(find.text(l.sendToTitle('MacBook Air')), findsOneWidget);+ expect(find.text(l.sendDropHere), findsOneWidget);+ expect(find.text(l.sendChooseFolder), findsOneWidget);+ });++ testWidgets('设置里的隔空传送', (tester) async {+ await tester.pumpWidget(PasteFerryApp(state: _demo(language)));+ await tester.pump();+ final l = AppLocalizations.of(tester.element(find.byType(Shell)));+ await tester.tap(find.text(l.navSettings).first);+ await tester.pump();+ await tester.dragUntilVisible(find.text(l.receiveNotify), find.byType(ListView), const Offset(0, -100));+ expect(find.text(l.receiveFiles), findsOneWidget);+ expect(find.text(l.saveToChange), findsOneWidget);+ });+ });+ }++ testWidgets('有文件在传时侧边栏显示进度环,没有时显示新收到的个数', (tester) async {+ final state = _demo('zh-Hans');+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pump();+ final ring = find.descendant(of: find.byType(Tooltip), matching: find.byType(CircularProgressIndicator));+ expect(ring, findsOneWidget);++ final idle = _demo('zh-Hans', withActive: false);+ idle.debugEvent(Event(transferChanged: Transfer(id: 'new', direction: _in, deviceName: 'MacBook Air',+ status: 'done', items: [ClipItem(name: 'x.txt')], createdAtUnix: _now())));+ await tester.pumpWidget(PasteFerryApp(key: UniqueKey(), state: idle));+ await tester.pump();+ expect(ring, findsNothing);+ expect(find.text('1'), findsOneWidget);+ });++ testWidgets('点了隔空传送的通知,界面切到隔空传送页', (tester) async {+ final state = _demo('zh-Hans');+ await tester.pumpWidget(PasteFerryApp(state: state));+ await tester.pump();+ expect(find.text('把文件拖到一台设备上,直接发过去'), findsNothing);+ state.debugEvent(Event(navigate: 'send'));+ await tester.pump();+ expect(find.text('把文件拖到一台设备上,直接发过去'), findsOneWidget);+ });++ test('剩余时间与进度的写法', () {+ final l = lookupAppLocalizations(const Locale('zh'));+ expect(etaLabel(l, 20), '20 秒');+ expect(etaLabel(l, 90), '2 分钟');+ expect(etaLabel(l, 3900), '1 小时 5 分');+ final t = Transfer(totalBytes: Int64(2 << 30), doneBytes: Int64(1 << 30), bytesPerSecond: 40 * 1024 * 1024);+ expect(progressLabel(l, t), '50% · 1.0 GB / 2.0 GB · 40.0 MB/s · 还剩 26 秒');+ });+}diff --git a/ui/tool/screenshots/screenshots_test.dart b/ui/tool/screenshots/screenshots_test.dartindex d69ae1b..5ba6ebe 100644--- a/ui/tool/screenshots/screenshots_test.dart+++ b/ui/tool/screenshots/screenshots_test.dart@@ -20,6 +20,7 @@ import 'package:pasteferry_ui/picker/picker_view.dart';import 'package:pasteferry_ui/theme.dart';import 'package:pasteferry_ui/widgets/nearby_dialog.dart';import 'package:pasteferry_ui/widgets/pairing_dialog.dart';+import 'package:pasteferry_ui/widgets/send_dialog.dart';import 'package:fixnum/fixnum.dart';import 'package:flutter/foundation.dart';import 'package:flutter/gestures.dart';@@ -265,6 +266,50 @@ AppState _demo({LinkState link = LinkState.online,return state;}+/// 隔空传送页的演示数据:同一局域网、跨网络中转、离线的设备,收到的与发出的各种状态。+AppState _sendDemo() {+ final base = _demo();+ final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;+ Int64 ago(int s) => Int64(now - s);+ const incoming = TransferDirection.TRANSFER_DIRECTION_INCOMING;+ const outgoing = TransferDirection.TRANSFER_DIRECTION_OUTGOING;+ final photos = _t('照片 2026-10', 'Photos 2026-10', '写真 2026-10', tw: '照片 2026-10', hk: '相片 2026-10');+ final contract = _t('合同扫描件.pdf', 'signed-contract.pdf', '契約書_署名済み.pdf', tw: '合約掃描檔.pdf', hk: '合約掃描本.pdf');+ final windows = _t('Windows 台式机', 'Windows Desktop', 'Windows デスクトップ', tw: 'Windows 桌機', hk: 'Windows 桌面電腦');+ final ubuntu = _t('Ubuntu 笔记本', 'Ubuntu Laptop', 'Ubuntu ノート', tw: 'Ubuntu 筆電', hk: 'Ubuntu 手提電腦');+ base.debugSeed(+ status: base.status!..officialUsage = OfficialUsage(available: true, remainingBytes: Int64(62 * _mb)),+ config: base.config!..serviceMode = ServiceMode.SERVICE_MODE_OFFICIAL,+ self: base.self!,+ peers: [+ Device(id: 'air', name: 'MacBook Air', platform: 'darwin', online: true, lanReachable: true,+ connection: ConnectionKind.CONNECTION_KIND_DIRECT, receivesFiles: true),+ Device(id: 'win', name: windows, platform: 'windows', online: true,+ connection: ConnectionKind.CONNECTION_KIND_RELAY, receivesFiles: true),+ Device(id: 'ubuntu', name: ubuntu, platform: 'linux', receivesFiles: true),+ ],+ transfers: [+ Transfer(id: 'r1', direction: incoming, deviceId: 'air', deviceName: 'MacBook Air', status: 'active',+ items: [ClipItem(name: photos, isDir: true, size: Int64(2150 * _mb))],+ totalBytes: Int64(2150 * _mb), doneBytes: Int64(1462 * _mb), fileCount: Int64(412),+ bytesPerSecond: 42.0 * _mb, currentFile: '$photos/IMG_2041.HEIC', currentIndex: Int64(281),+ createdAtUnix: ago(40)),+ Transfer(id: 'r2', direction: incoming, deviceId: 'air', deviceName: 'MacBook Air', status: 'done',+ items: [ClipItem(name: contract), ClipItem(name: 'notes.txt'), ClipItem(name: 'IMG_2042.HEIC')],+ paths: ['/a', '/b', '/c'], present: [true, true, true], totalBytes: Int64((18.4 * _mb).round()),+ fileCount: Int64(3), createdAtUnix: ago(200), finishedAtUnix: ago(180), seen: true),+ Transfer(id: 'r3', direction: incoming, deviceId: 'win', deviceName: windows, status: 'done',+ items: [ClipItem(name: 'PasteFerry-Setup.exe')], paths: ['/d'], present: [false],+ totalBytes: Int64(42 * _mb), fileCount: Int64(1), createdAtUnix: ago(90000), finishedAtUnix: ago(90000),+ seen: true),+ Transfer(id: 's1', direction: outgoing, deviceId: 'air', deviceName: 'MacBook Air', status: 'done',+ items: [ClipItem(name: 'design-assets', isDir: true)], paths: ['/e'], totalBytes: Int64(126 * _mb),+ fileCount: Int64(58), createdAtUnix: ago(4000), finishedAtUnix: ago(3990)),+ ],+ );+ return base;+}+final _boundary = GlobalKey();Future<void> _shoot(@@ -396,6 +441,29 @@ void main() {await _shootPicker(tester, 'card-picker-search-dark', query: 'docker');});+ for (final dark in [false, true]) {+ testWidgets(dark ? 'send-dark' : 'send', (tester) async {+ await _shoot(tester, dark ? 'send-dark' : 'send',+ state: _sendDemo(),+ section: Section.send,+ brightness: dark ? Brightness.dark : Brightness.light,+ settle: false, // 雷达的波纹一直在动+ arrange: () async => tester.pump(const Duration(milliseconds: 900)));+ });+ }++ testWidgets('send-dialog', (tester) async {+ await _shoot(tester, 'send-dialog', state: _sendDemo(), section: Section.send, settle: false,+ arrange: () async {+ showDialog<void>(+ context: tester.element(find.byType(Shell)),+ builder: (_) => const SendDialog(deviceId: 'air'),+ );+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 400));+ });+ });+testWidgets('devices', (tester) async {await _shoot(tester, 'devices', state: _demo(), section: Section.devices);});diff --git a/ui/windows/flutter/generated_plugin_registrant.cc b/ui/windows/flutter/generated_plugin_registrant.ccindex 8b6d468..8366b0d 100644--- a/ui/windows/flutter/generated_plugin_registrant.cc+++ b/ui/windows/flutter/generated_plugin_registrant.cc@@ -6,6 +6,12 @@#include "generated_plugin_registrant.h"+#include <desktop_drop/desktop_drop_plugin.h>+#include <file_selector_windows/file_selector_windows.h>void RegisterPlugins(flutter::PluginRegistry* registry) {+ DesktopDropPluginRegisterWithRegistrar(+ registry->GetRegistrarForPlugin("DesktopDropPlugin"));+ FileSelectorWindowsRegisterWithRegistrar(+ registry->GetRegistrarForPlugin("FileSelectorWindows"));}diff --git a/ui/windows/flutter/generated_plugins.cmake b/ui/windows/flutter/generated_plugins.cmakeindex b93c4c3..355a495 100644--- a/ui/windows/flutter/generated_plugins.cmake+++ b/ui/windows/flutter/generated_plugins.cmake@@ -3,6 +3,8 @@#list(APPEND FLUTTER_PLUGIN_LIST+ desktop_drop+ file_selector_windows)list(APPEND FLUTTER_FFI_PLUGIN_LIST