add account profile

This commit is contained in:
Mikhail Kilin
2026-01-27 13:41:29 +03:00
parent ac684da820
commit 356d2d3064
15 changed files with 787 additions and 26 deletions

View File

@@ -66,6 +66,15 @@ pub struct App {
pub message_search_results: Vec<crate::tdlib::client::MessageInfo>,
/// Индекс выбранного результата
pub selected_search_result_index: usize,
// Profile mode
/// Режим просмотра профиля
pub is_profile_mode: bool,
/// Индекс выбранного действия в профиле
pub selected_profile_action: usize,
/// Шаг подтверждения выхода из группы (0 = не показано, 1 = первое, 2 = второе)
pub leave_group_confirmation_step: u8,
/// Информация профиля для отображения
pub profile_info: Option<crate::tdlib::ProfileInfo>,
}
impl App {
@@ -106,6 +115,10 @@ impl App {
message_search_query: String::new(),
message_search_results: Vec::new(),
selected_search_result_index: 0,
is_profile_mode: false,
selected_profile_action: 0,
leave_group_confirmation_step: 0,
profile_info: None,
}
}
@@ -537,4 +550,60 @@ impl App {
self.cursor_position = self.message_input.chars().count();
}
}
// === Profile Mode ===
/// Проверить, активен ли режим профиля
pub fn is_profile_mode(&self) -> bool {
self.is_profile_mode
}
/// Войти в режим профиля
pub fn enter_profile_mode(&mut self) {
self.is_profile_mode = true;
self.selected_profile_action = 0;
self.leave_group_confirmation_step = 0;
}
/// Выйти из режима профиля
pub fn exit_profile_mode(&mut self) {
self.is_profile_mode = false;
self.selected_profile_action = 0;
self.leave_group_confirmation_step = 0;
self.profile_info = None;
}
/// Выбрать предыдущее действие
pub fn select_previous_profile_action(&mut self) {
if self.selected_profile_action > 0 {
self.selected_profile_action -= 1;
}
}
/// Выбрать следующее действие
pub fn select_next_profile_action(&mut self, max_actions: usize) {
if self.selected_profile_action < max_actions.saturating_sub(1) {
self.selected_profile_action += 1;
}
}
/// Показать первое подтверждение выхода из группы
pub fn show_leave_group_confirmation(&mut self) {
self.leave_group_confirmation_step = 1;
}
/// Показать второе подтверждение выхода из группы
pub fn show_leave_group_final_confirmation(&mut self) {
self.leave_group_confirmation_step = 2;
}
/// Отменить подтверждение выхода из группы
pub fn cancel_leave_group(&mut self) {
self.leave_group_confirmation_step = 0;
}
/// Получить текущий шаг подтверждения
pub fn get_leave_group_confirmation_step(&self) -> u8 {
self.leave_group_confirmation_step
}
}