Skip to content

Commit

Permalink
Merge pull request #205 from kevinaboos/more_login_status_updates
Browse files Browse the repository at this point in the history
Add more details to status messages shown on the login screen.
  • Loading branch information
kevinaboos authored Oct 15, 2024
2 parents a308213 + 8c1e738 commit 406d434
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/login/login_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ live_design! {

status_label = <Label> {
width: 250, height: Fit
padding: {left: 5, right: 5}
padding: {left: 5, right: 5, top: 10, bottom: 10}
draw_text: {
color: (MESSAGE_TEXT_COLOR)
text_style: <REGULAR_TEXT> {}
Expand Down
9 changes: 8 additions & 1 deletion src/persistent_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ pub async fn restore_session(
let FullSessionPersisted { client_session, user_session, sync_token } =
serde_json::from_str(&serialized_session)?;

let status_str = format!(
"Loaded session file for {user_id}. Trying to connect to homeserver ({})...",
client_session.homeserver,
);
log!("{status_str}");
Cx::post_action(LoginAction::Status(status_str));

// Build the client with the previous settings from the session.
let client = Client::builder()
.server_name_or_homeserver_url(client_session.homeserver)
Expand All @@ -115,7 +122,7 @@ pub async fn restore_session(
.build()
.await?;

let status_str = format!("Restoring previous login session for {}...", user_session.meta.user_id);
let status_str = format!("Authenticating previous login session for {}...", user_session.meta.user_id);
log!("{status_str}");
Cx::post_action(LoginAction::Status(status_str));

Expand Down
2 changes: 1 addition & 1 deletion src/shared/avatar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ live_design! {
visible: false,
align: { x: 0.5, y: 0.5 }
img = <Image> {
fit: Smallest,
fit: Stretch,
width: Fill, height: Fill,
source: (IMG_DEFAULT_AVATAR),
draw_bg: {
Expand Down
2 changes: 1 addition & 1 deletion src/sliding_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ async fn async_main_loop(
if let Some(session) = persistent_state::restore_session(specified_username).await.ok() {
Some(session)
} else {
let status_err = "Error: failed to restore previous user session.";
let status_err = "Error: failed to restore previous user session. Please login again.";
log!("{status_err}");
Cx::post_action(LoginAction::Status(status_err.to_string()));

Expand Down

0 comments on commit 406d434

Please sign in to comment.