CH-J SM Mobileการจัดการเซิร์ฟเวอร์ผ่าน SSH
เมนู
ซอร์สที่เผยแพร่

CH-J SM Mobile

เรียกดูไดเรกทอรีและไฟล์ของรุ่นแอปพลิเคชันที่ระบุ

ดาวน์โหลด ZIP ของซอร์ส
CH-J / SM Mobile 175 ไฟล์
sm-mobile-20261016T185235Z-8e93ecc1b59a วันที่เพิ่ม: · วันที่บิลด์:
recents.dart วันที่เพิ่ม: ไม่ได้บันทึกวันที่ 2.5 KB · 89 บรรทัด
โค้ด ดาวน์โหลดไฟล์
1import '../vault.dart';
3/// A recently opened or favorite file. Stored encrypted in the Vault (it
4/// can name servers and paths); never exported with profiles.
5class RecentFile {
6 final String key, kind, name, location;
7 final Map<String, dynamic> source;
8 final DateTime opened;
9 const RecentFile({
10 required this.key,
11 required this.kind,
12 required this.name,
13 required this.location,
14 required this.source,
15 required this.opened,
16 });
18 factory RecentFile.fromJson(Map m) => RecentFile(
19 key: m['key'] as String,
20 kind: m['kind'] as String,
21 name: m['name'] as String,
22 location: m['location'] as String? ?? '',
23 source: Map<String, dynamic>.from(m['source'] as Map? ?? const {}),
24 opened: DateTime.fromMillisecondsSinceEpoch(m['opened'] as int? ?? 0),
25 );
27 Map<String, dynamic> toJson() => {
28 'key': key,
29 'kind': kind,
30 'name': name,
31 'location': location,
32 'source': source,
33 'opened': opened.millisecondsSinceEpoch,
34 };
37class RecentFiles {
38 static const section = 'documents', limit = 50;
39 final Vault vault;
40 RecentFiles(this.vault);
42 Map<String, dynamic> get _data => vault.section(section);
44 List<RecentFile> get recent => [
45 for (final m in (_data['recent'] as List? ?? const []))
46 RecentFile.fromJson(m as Map),
47 ];
49 List<RecentFile> get favorites => [
50 for (final m in (_data['favorites'] as List? ?? const []))
51 RecentFile.fromJson(m as Map),
52 ];
54 bool isFavorite(String key) => favorites.any((f) => f.key == key);
56 Future<void> touch(RecentFile file) {
57 final data = _data;
58 final list = [
59 file.toJson(),
60 for (final m in (data['recent'] as List? ?? const []))
61 if ((m as Map)['key'] != file.key) m,
62 ].take(limit).toList();
63 return vault.setSection(section, {...data, 'recent': list});
64 }
66 Future<void> setFavorite(RecentFile file, bool favorite) {
67 final data = _data;
68 final list = [
69 if (favorite) file.toJson(),
70 for (final m in (data['favorites'] as List? ?? const []))
71 if ((m as Map)['key'] != file.key) m,
72 ];
73 return vault.setSection(section, {...data, 'favorites': list});
74 }
76 Future<void> remove(String key) {
77 final data = _data;
78 return vault.setSection(section, {
79 ...data,
80 'recent': [
81 for (final m in (data['recent'] as List? ?? const []))
82 if ((m as Map)['key'] != key) m,
83 ],
84 });
85 }
87 Future<void> clear() =>
88 vault.setSection(section, {..._data, 'recent': const <Object>[]});
SHA-256e82b41b0238538924fadbcd978abda5f4bb0c4d5f1f8e2a29bfb8444f301f6ba

CH-J Proprietary Software License 1.14 · ซอร์สโค้ดนี้ให้ไว้ภายใต้ CH-J Proprietary Software License 1.14 การเปิดให้เข้าถึงไม่ได้เปลี่ยนแปลงเงื่อนไขของสัญญาอนุญาตหรือให้สิทธิ์เพิ่มเติม

SHA-256 ของไฟล์บีบอัด46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655
ไฟล์