mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-10-14 22:37:23 +00:00
Align Meshtastic phone sync and chat UI refresh
This commit is contained in:
@@ -425,6 +425,7 @@ void UiController::onChatEvent(sys::Event* event)
|
||||
if (is_current_conversation)
|
||||
{
|
||||
(void)updateConversationViewForIncoming(*latest);
|
||||
reloadConversationView();
|
||||
service_.markConversationRead(current_conv_);
|
||||
}
|
||||
else
|
||||
@@ -444,13 +445,7 @@ void UiController::onChatEvent(sys::Event* event)
|
||||
const ChatMessage* msg = service_.getMessage(result_event->msg_id);
|
||||
if (!msg || !conversation_->updateMessageStatus(result_event->msg_id, msg->status))
|
||||
{
|
||||
auto messages = service_.getRecentMessages(current_conv_, 50);
|
||||
conversation_->clearMessages();
|
||||
for (const auto& m : messages)
|
||||
{
|
||||
conversation_->addMessage(m);
|
||||
}
|
||||
conversation_->scrollToBottom();
|
||||
reloadConversationView();
|
||||
}
|
||||
}
|
||||
(void)result_event;
|
||||
@@ -912,6 +907,22 @@ bool UiController::updateConversationViewForIncoming(const chat::ChatMessage& ms
|
||||
return true;
|
||||
}
|
||||
|
||||
void UiController::reloadConversationView()
|
||||
{
|
||||
if (!conversation_ || team_conv_active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto messages = service_.getRecentMessages(current_conv_, 50);
|
||||
conversation_->clearMessages();
|
||||
for (const auto& msg : messages)
|
||||
{
|
||||
conversation_->addMessage(msg);
|
||||
}
|
||||
conversation_->scrollToBottom();
|
||||
}
|
||||
|
||||
bool UiController::isTeamConversation(const chat::ConversationId& conv) const
|
||||
{
|
||||
return isTeamConversationId(conv);
|
||||
|
||||
@@ -2087,7 +2087,8 @@ static void start_selected_node_key_verification()
|
||||
}
|
||||
if (!node->has_public_key)
|
||||
{
|
||||
::ui::SystemNotification::show("No public key yet", 1800);
|
||||
const bool requested = mesh->requestNodeInfo(node->node_id, true);
|
||||
::ui::SystemNotification::show(requested ? "Requesting node info" : "No public key yet", 1800);
|
||||
contacts_focus_to_list();
|
||||
return;
|
||||
}
|
||||
@@ -2100,7 +2101,9 @@ static void start_selected_node_key_verification()
|
||||
static void toggle_selected_node_key_trust()
|
||||
{
|
||||
const auto* node = get_selected_node();
|
||||
if (!node || !g_contacts_state.contact_service)
|
||||
app::IAppFacade& app_ctx = app::appFacade();
|
||||
chat::IMeshAdapter* mesh = app_ctx.getMeshAdapter();
|
||||
if (!node || !g_contacts_state.contact_service || !mesh)
|
||||
{
|
||||
::ui::SystemNotification::show("Key trust unavailable", 1800);
|
||||
contacts_focus_to_list();
|
||||
@@ -2108,7 +2111,8 @@ static void toggle_selected_node_key_trust()
|
||||
}
|
||||
if (!node->has_public_key)
|
||||
{
|
||||
::ui::SystemNotification::show("No public key yet", 1800);
|
||||
const bool requested = mesh->requestNodeInfo(node->node_id, true);
|
||||
::ui::SystemNotification::show(requested ? "Requesting node info" : "No public key yet", 1800);
|
||||
contacts_focus_to_list();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user