Skip to content

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.

feat(android): list what this phone sent, with a 3 day window

baiyuzee3a08882b8d2
diff --git a/ui/lib/l10n/app_en.arb b/ui/lib/l10n/app_en.arb
index 9d100d8..0984ec2 100644
--- a/ui/lib/l10n/app_en.arb
+++ b/ui/lib/l10n/app_en.arb
@@ -1675,6 +1675,9 @@
"mNoPairedDevices": "Pair with a computer first",
"mSent": "Sent",
"mSendFootnote": "Text and files go into the records on the computer and, by its setting, into its clipboard. What you copy on the phone is not sent by itself.",
+ "mSentRecords": "Sent",
+ "mViewAll": "View all",
+ "mClearCache": "Clear",
"mSendFailed": "Couldn’t send: {detail}",
"@mSendFailed": {
"placeholders": {
diff --git a/ui/lib/l10n/app_ja.arb b/ui/lib/l10n/app_ja.arb
index 72176dd..5cf7fde 100644
--- a/ui/lib/l10n/app_ja.arb
+++ b/ui/lib/l10n/app_ja.arb
@@ -656,6 +656,9 @@
"mNoPairedDevices": "先にパソコンとペアリングしてください",
"mSent": "送信しました",
"mSendFootnote": "テキストとファイルはパソコンの履歴に入り、設定に従ってクリップボードにも入ります。スマホでコピーした内容は自動では送られません。",
+ "mSentRecords": "送信履歴",
+ "mViewAll": "すべて見る",
+ "mClearCache": "キャッシュを消去",
"mSendFailed": "送信できませんでした:{detail}",
"mCopy": "コピー",
"mCopied": "スマホのクリップボードにコピーしました",
diff --git a/ui/lib/l10n/app_localizations.dart b/ui/lib/l10n/app_localizations.dart
index 0fceb68..aa3504e 100644
--- a/ui/lib/l10n/app_localizations.dart
+++ b/ui/lib/l10n/app_localizations.dart
@@ -4046,6 +4046,24 @@ abstract class AppLocalizations {
/// **'Text and files go into the records on the computer and, by its setting, into its clipboard. What you copy on the phone is not sent by itself.'**
String get mSendFootnote;
+ /// No description provided for @mSentRecords.
+ ///
+ /// In en, this message translates to:
+ /// **'Sent'**
+ String get mSentRecords;
+
+ /// No description provided for @mViewAll.
+ ///
+ /// In en, this message translates to:
+ /// **'View all'**
+ String get mViewAll;
+
+ /// No description provided for @mClearCache.
+ ///
+ /// In en, this message translates to:
+ /// **'Clear'**
+ String get mClearCache;
+
/// No description provided for @mSendFailed.
///
/// In en, this message translates to:
diff --git a/ui/lib/l10n/app_localizations_en.dart b/ui/lib/l10n/app_localizations_en.dart
index d9d4b0d..0878ac3 100644
--- a/ui/lib/l10n/app_localizations_en.dart
+++ b/ui/lib/l10n/app_localizations_en.dart
@@ -2478,6 +2478,15 @@ class AppLocalizationsEn extends AppLocalizations {
String get mSendFootnote =>
'Text and files go into the records on the computer and, by its setting, into its clipboard. What you copy on the phone is not sent by itself.';
+ @override
+ String get mSentRecords => 'Sent';
+
+ @override
+ String get mViewAll => 'View all';
+
+ @override
+ String get mClearCache => 'Clear';
+
@override
String mSendFailed(String detail) {
return 'Couldn’t send: $detail';
diff --git a/ui/lib/l10n/app_localizations_ja.dart b/ui/lib/l10n/app_localizations_ja.dart
index a552577..112e584 100644
--- a/ui/lib/l10n/app_localizations_ja.dart
+++ b/ui/lib/l10n/app_localizations_ja.dart
@@ -2299,6 +2299,15 @@ class AppLocalizationsJa extends AppLocalizations {
String get mSendFootnote =>
'テキストとファイルはパソコンの履歴に入り、設定に従ってクリップボードにも入ります。スマホでコピーした内容は自動では送られません。';
+ @override
+ String get mSentRecords => '送信履歴';
+
+ @override
+ String get mViewAll => 'すべて見る';
+
+ @override
+ String get mClearCache => 'キャッシュを消去';
+
@override
String mSendFailed(String detail) {
return '送信できませんでした:$detail';
diff --git a/ui/lib/l10n/app_localizations_zh.dart b/ui/lib/l10n/app_localizations_zh.dart
index bb5186f..ed45435 100644
--- a/ui/lib/l10n/app_localizations_zh.dart
+++ b/ui/lib/l10n/app_localizations_zh.dart
@@ -2273,6 +2273,15 @@ class AppLocalizationsZh extends AppLocalizations {
String get mSendFootnote =>
'文字和文件会进电脑的复制记录,并按电脑的设置写入剪贴板。手机上复制的内容不会自动发出,粘贴到这里再发送。';
+ @override
+ String get mSentRecords => '发送记录';
+
+ @override
+ String get mViewAll => '查看全部';
+
+ @override
+ String get mClearCache => '清除缓存';
+
@override
String mSendFailed(String detail) {
return '发送失败:$detail';
@@ -4642,6 +4651,15 @@ class AppLocalizationsZhHantHk extends AppLocalizationsZh {
String get mSendFootnote =>
'文字和檔案會進電腦的複製記錄,並按電腦的設定寫入剪貼簿。手機上複製的內容不會自動發出,貼到這裏再傳送。';
+ @override
+ String get mSentRecords => '傳送記錄';
+
+ @override
+ String get mViewAll => '查看全部';
+
+ @override
+ String get mClearCache => '清除快取';
+
@override
String mSendFailed(String detail) {
return '傳送失敗:$detail';
@@ -7011,6 +7029,15 @@ class AppLocalizationsZhHantTw extends AppLocalizationsZh {
String get mSendFootnote =>
'文字和檔案會進電腦的複製記錄,並按電腦的設定寫入剪貼簿。手機上複製的內容不會自動發出,貼到這裡再傳送。';
+ @override
+ String get mSentRecords => '傳送記錄';
+
+ @override
+ String get mViewAll => '查看全部';
+
+ @override
+ String get mClearCache => '清除快取';
+
@override
String mSendFailed(String detail) {
return '傳送失敗:$detail';
diff --git a/ui/lib/l10n/app_zh.arb b/ui/lib/l10n/app_zh.arb
index 06297f6..c093ba3 100644
--- a/ui/lib/l10n/app_zh.arb
+++ b/ui/lib/l10n/app_zh.arb
@@ -656,6 +656,9 @@
"mNoPairedDevices": "先和电脑配对",
"mSent": "已发送",
"mSendFootnote": "文字和文件会进电脑的复制记录,并按电脑的设置写入剪贴板。手机上复制的内容不会自动发出,粘贴到这里再发送。",
+ "mSentRecords": "发送记录",
+ "mViewAll": "查看全部",
+ "mClearCache": "清除缓存",
"mSendFailed": "发送失败:{detail}",
"mCopy": "复制",
"mCopied": "已复制到手机剪贴板",
diff --git a/ui/lib/l10n/app_zh_Hant_HK.arb b/ui/lib/l10n/app_zh_Hant_HK.arb
index 925d1ab..93c565c 100644
--- a/ui/lib/l10n/app_zh_Hant_HK.arb
+++ b/ui/lib/l10n/app_zh_Hant_HK.arb
@@ -656,6 +656,9 @@
"mNoPairedDevices": "先和電腦配對",
"mSent": "已傳送",
"mSendFootnote": "文字和檔案會進電腦的複製記錄,並按電腦的設定寫入剪貼簿。手機上複製的內容不會自動發出,貼到這裏再傳送。",
+ "mSentRecords": "傳送記錄",
+ "mViewAll": "查看全部",
+ "mClearCache": "清除快取",
"mSendFailed": "傳送失敗:{detail}",
"mCopy": "複製",
"mCopied": "已複製到手機剪貼簿",
diff --git a/ui/lib/l10n/app_zh_Hant_TW.arb b/ui/lib/l10n/app_zh_Hant_TW.arb
index e3ea124..02a104f 100644
--- a/ui/lib/l10n/app_zh_Hant_TW.arb
+++ b/ui/lib/l10n/app_zh_Hant_TW.arb
@@ -656,6 +656,9 @@
"mNoPairedDevices": "先和電腦配對",
"mSent": "已傳送",
"mSendFootnote": "文字和檔案會進電腦的複製記錄,並按電腦的設定寫入剪貼簿。手機上複製的內容不會自動發出,貼到這裡再傳送。",
+ "mSentRecords": "傳送記錄",
+ "mViewAll": "查看全部",
+ "mClearCache": "清除快取",
"mSendFailed": "傳送失敗:{detail}",
"mCopy": "複製",
"mCopied": "已複製到手機剪貼簿",
diff --git a/ui/lib/mobile/send_tab.dart b/ui/lib/mobile/send_tab.dart
index c86f8fc..07293b8 100644
--- a/ui/lib/mobile/send_tab.dart
+++ b/ui/lib/mobile/send_tab.dart
@@ -3,11 +3,15 @@ import 'package:file_selector/file_selector.dart';
import 'package:flutter/services.dart';
import '../app_state.dart';
+import '../gen/pasteferry/v1/daemon.pb.dart';
+import '../records.dart';
import '../i18n.dart';
import '../icons.dart';
import '../main.dart' show AppScope;
import '../theme.dart';
import '../widgets/common.dart';
+import 'record_actions.dart';
+import 'records_tab.dart' show showRecordSheet;
import 'ui.dart';
/// 发送页(design/phone-sync.md 3.2.3 节):手机上的文字发给在线的设备。
@@ -228,6 +232,9 @@ class _SendTabState extends State<SendTab> with WidgetsBindingObserver {
padding: const EdgeInsets.symmetric(horizontal: Insets.xs),
child: Text(l.mSendFootnote, style: TextStyle(fontSize: 13, height: 1.5, color: p.textDim)),
),
+ const SizedBox(height: Insets.xl),
+ _SentRecords(),
+
],
),
),
@@ -323,3 +330,116 @@ Future<bool?> showFileConfirmSheet(BuildContext context, List<(String, String, i
),
);
}
+
+/// 发送记录:本机发出去的内容,只显示最近 3 天,高度固定,不挤压上面的发送区。
+class _SentRecords extends StatelessWidget {
+ static const _days = 3;
+
+ @override
+ Widget build(BuildContext context) {
+ final state = AppScope.of(context);
+ final l = context.l10n;
+ final p = context.palette;
+ final since = DateTime.now().subtract(const Duration(days: _days));
+ final sent = state.records
+ .where((r) => r.outgoing && recordTime(r).isAfter(since))
+ .toList();
+ if (sent.isEmpty) return const SizedBox.shrink();
+ final shown = sent.take(3).toList();
+
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Row(
+ children: [
+ Text(l.mSentRecords, style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: p.textDim)),
+ const Spacer(),
+ TextButton(
+ style: TextButton.styleFrom(padding: const EdgeInsets.symmetric(horizontal: Insets.xs)),
+ onPressed: () => showSentRecordsSheet(context, sent),
+ child: Text(l.mViewAll),
+ ),
+ ],
+ ),
+ DecoratedBox(
+ decoration: BoxDecoration(
+ color: p.surface,
+ borderRadius: BorderRadius.circular(Radii.lg),
+ border: Border.all(color: p.border),
+ ),
+ child: Column(
+ children: [
+ for (var i = 0; i < shown.length; i++) ...[
+ if (i > 0) const Divider(height: 1, indent: 52),
+ ListTile(
+ dense: true,
+ leading: Icon(isMedia(shown[i]) ? AppIcons.folder : AppIcons.docOnClipboard, size: 20, color: p.textDim),
+ title: Text(contentTitle(shown[i]),
+ maxLines: 1, overflow: TextOverflow.ellipsis, style: const TextStyle(fontSize: 15)),
+ subtitle: Text(relativeTime(recordTime(shown[i])), style: TextStyle(fontSize: 12, color: p.textDim)),
+ onTap: () => showRecordSheet(context, shown[i]),
+ ),
+ ],
+ ],
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+/// 查看全部发送记录,可以一直往上翻;右上角能清空。
+Future<void> showSentRecordsSheet(BuildContext context, List<ClipRecord> sent) {
+ final state = AppScope.read(context);
+ final l = context.l10n;
+ final p = context.palette;
+ return showModalBottomSheet<void>(
+ context: context,
+ isScrollControlled: true,
+ useSafeArea: true,
+ builder: (sheetCtx) => ConstrainedBox(
+ constraints: BoxConstraints(maxHeight: MediaQuery.sizeOf(sheetCtx).height * 0.85),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(Insets.lg, Insets.md, Insets.sm, 0),
+ child: Row(
+ children: [
+ Text(l.mSentRecords, style: const TextStyle(fontSize: 17, fontWeight: FontWeight.w600)),
+ const Spacer(),
+ TextButton(
+ style: TextButton.styleFrom(foregroundColor: p.danger),
+ onPressed: () async {
+ final ids = [for (final r in sent) r.id];
+ try {
+ await state.deleteRecords(ids: ids);
+ if (sheetCtx.mounted) Navigator.pop(sheetCtx);
+ } catch (_) {}
+ },
+ child: Text(l.mClearCache),
+ ),
+ ],
+ ),
+ ),
+ Flexible(
+ child: ListView.separated(
+ shrinkWrap: true,
+ itemCount: sent.length,
+ separatorBuilder: (_, _) => const Divider(height: 1, indent: 52),
+ itemBuilder: (_, i) {
+ final r = sent[i];
+ return ListTile(
+ leading: Icon(isMedia(r) ? AppIcons.folder : AppIcons.docOnClipboard, size: 20, color: p.textDim),
+ title: Text(contentTitle(r), maxLines: 2, overflow: TextOverflow.ellipsis),
+ subtitle: Text(relativeTime(recordTime(r)), style: TextStyle(fontSize: 12, color: p.textDim)),
+ onTap: () => showRecordSheet(context, r),
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+}