Skip to content

Commit

Permalink
fixed for review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangHanDong committed Dec 30, 2024
1 parent eaa666d commit a12f0d6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
22 changes: 21 additions & 1 deletion src/home/spaces_dock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ use crate::shared::adaptive_view::DisplayContext;
use crate::shared::color_tooltip::*;
use crate::shared::verification_badge::{VerificationBadge, VerificationText};
use crate::verification::VerificationStateAction;
use crate::sliding_sync::get_client;
use matrix_sdk::encryption::VerificationState;


live_design! {
use link::theme::*;
use link::shaders::*;
Expand Down Expand Up @@ -172,7 +174,7 @@ live_design! {
}
}

#[derive(Live, LiveHook, Widget)]
#[derive(Live, Widget)]
pub struct Profile {
#[deref]
view: View,
Expand Down Expand Up @@ -257,3 +259,21 @@ impl MatchEvent for Profile {
}
}
}

impl LiveHook for Profile {
fn after_new_from_doc(&mut self, cx:&mut Cx) {
if let Some(client) = get_client() {
let current_verification_state = client.encryption().verification_state().get();
if let Some(mut badge) = self
.widget(id!(verification_badge))
.borrow_mut::<VerificationBadge>()
{
if badge.verification_state != current_verification_state {
badge.verification_state = current_verification_state;
badge.update_icon_visibility();
badge.redraw(cx);
}
}
}
}
}
10 changes: 4 additions & 6 deletions src/shared/color_tooltip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ live_design! {
pub ColorTooltip = {{ColorTooltip}} {
width: Fill,
height: Fill,
visible: false
flow: Overlay
align: {x: 0.0, y: 0.0}

Expand All @@ -20,26 +19,25 @@ live_design! {
}

content : <View> {
width: Fit
width: 300
height: Fit

visible: false,
padding: 2.0

tooltip_bg = <RoundedView> {
width: Fit,
width: Fill,
height: Fit,
padding: 7,

draw_bg: {
// color: #ff0000aa,
color: #fff,
border_width: 1.5,
border_color: #fff,
radius: 3.0
}

tooltip_label = <Label> {
width: Fit,
width: Fill,
height: Fit,
draw_text: {
text_style: <REGULAR_TEXT> {}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/verification_badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ pub enum VerificationText {
impl VerificationText {
pub fn get_text(&self) -> &'static str {
match self {
VerificationText::Verified => "This device is fully verified.",
VerificationText::Unverified => " This device is unverified. To view your encrypted message history, please verify it from another client.",
VerificationText::Verified => "This device is fully verified.To view your encrypted message history, please verify it from another client.",
VerificationText::Unverified => "This device is unverified. To view your encrypted message history, please verify it from another client.",
VerificationText::Unknown => " Verification state is unknown.",
}
}
Expand Down

0 comments on commit a12f0d6

Please sign in to comment.