feat: implement photo albums (media groups) and persist account selection
Group photos with shared media_album_id into single album bubbles with grid layout (up to 3x cols). Album navigation treats grouped photos as one unit (j/k skip entire album). Persist selected account to accounts.toml so it survives app restart. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -107,6 +107,8 @@ pub struct MessageMetadata {
|
||||
pub date: i32,
|
||||
/// Дата редактирования (0 если не редактировалось)
|
||||
pub edit_date: i32,
|
||||
/// ID медиа-альбома (0 если не часть альбома)
|
||||
pub media_album_id: i64,
|
||||
}
|
||||
|
||||
/// Контент сообщения (текст и форматирование)
|
||||
@@ -175,6 +177,7 @@ impl MessageInfo {
|
||||
sender_name,
|
||||
date,
|
||||
edit_date,
|
||||
media_album_id: 0,
|
||||
},
|
||||
content: MessageContent {
|
||||
text: content,
|
||||
@@ -213,6 +216,10 @@ impl MessageInfo {
|
||||
self.metadata.edit_date > 0
|
||||
}
|
||||
|
||||
pub fn media_album_id(&self) -> i64 {
|
||||
self.metadata.media_album_id
|
||||
}
|
||||
|
||||
pub fn text(&self) -> &str {
|
||||
&self.content.text
|
||||
}
|
||||
@@ -337,6 +344,7 @@ pub struct MessageBuilder {
|
||||
forward_from: Option<ForwardInfo>,
|
||||
reactions: Vec<ReactionInfo>,
|
||||
media: Option<MediaInfo>,
|
||||
media_album_id: i64,
|
||||
}
|
||||
|
||||
impl MessageBuilder {
|
||||
@@ -358,6 +366,7 @@ impl MessageBuilder {
|
||||
forward_from: None,
|
||||
reactions: Vec::new(),
|
||||
media: None,
|
||||
media_album_id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,6 +470,12 @@ impl MessageBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Установить ID медиа-альбома
|
||||
pub fn media_album_id(mut self, id: i64) -> Self {
|
||||
self.media_album_id = id;
|
||||
self
|
||||
}
|
||||
|
||||
/// Построить MessageInfo из данных builder'а
|
||||
pub fn build(self) -> MessageInfo {
|
||||
let mut msg = MessageInfo::new(
|
||||
@@ -480,6 +495,7 @@ impl MessageBuilder {
|
||||
self.reactions,
|
||||
);
|
||||
msg.content.media = self.media;
|
||||
msg.metadata.media_album_id = self.media_album_id;
|
||||
msg
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user