feat: group the server's chats and use OpenChamber's project icons
Sessions under the server's managed chats root (chats/<date>/session-…) were grouped per directory, so each one appeared as its own session-xxxxx band. GET /api/fs/home now supplies the chats root plus its canonical and legacy aliases; every chat folder becomes the single 聊天 group. The new-session picker can target 聊天 too: the first send creates a fresh chat directory before creating the session, and a new session started from an existing chat gets a new one instead of sharing its folder. Projects merge their OpenChamber settings row (label, icon key, colour, iconBackground and uploaded/auto icon image) with /api/project. Group headers, the picker and the draft chip draw the chosen icon in its colour, and custom images are fetched through the client transport (SVG included) with a themed fallback to the glyph. The chat group uses a chat bubble rather than a folder. 0.4.8 (408).
This commit is contained in:
1 parent
91bf5e5b81
commit
79221e57d7
14 files changed
+599
-32
No files matched your search
@@ -153,6 +153,35 @@ class Client {
|
||||
];
|
||||
}
|
||||
|
||||
/// The server's home and chats root. Sessions filed under a chats root are
|
||||
/// the "聊天" group, not a project; the root can be relocated away from the
|
||||
/// home config directory, so it must come from the server.
|
||||
Future<FsHomeInfo> fsHome() async {
|
||||
final r = await _json('GET', '/api/fs/home');
|
||||
return FsHomeInfo.fromJson(r);
|
||||
}
|
||||
|
||||
/// The project's chosen/auto icon image. [projectId] is the OpenChamber
|
||||
/// settings id; SVG icons are recoloured by the server for [theme] and
|
||||
/// [iconColor].
|
||||
Future<Uint8List?> projectIconBytes(String projectId,
|
||||
{String? theme, String? iconColor}) async {
|
||||
try {
|
||||
final res = await _request(
|
||||
'GET', '/api/projects/${Uri.encodeComponent(projectId)}/icon',
|
||||
query: {
|
||||
if (theme != null && theme.isNotEmpty) 'theme': theme,
|
||||
if (iconColor != null && iconColor.isNotEmpty)
|
||||
'iconColor': iconColor,
|
||||
});
|
||||
if (res.statusCode != 200) return null;
|
||||
final bytes = await res.collect();
|
||||
return bytes.isEmpty ? null : Uint8List.fromList(bytes);
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteSession(String id) async {
|
||||
await _json('DELETE', '/api/session/${Uri.encodeComponent(id)}');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user