Browse Source

chore: Upgrade crate dependencies

merge-requests/1716/head
Kévin Commaille 2 years ago
parent
commit
48a0c9261e
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 1440
      Cargo.lock
  2. 6
      Cargo.toml
  3. 2
      src/session/model/room/mod.rs
  4. 24
      src/session/model/room/timeline/mod.rs
  5. 34
      src/user_facing_error.rs

1440
Cargo.lock generated

File diff suppressed because it is too large Load Diff

6
Cargo.toml

@ -65,7 +65,7 @@ sourceview = { package = "sourceview5", version = "0.8" }
[dependencies.matrix-sdk]
git = "https://github.com/matrix-org/matrix-rust-sdk.git"
rev = "88c4dec35f05ae295e0f2bf0362d6f5d72606d92"
rev = "6f2d8e0e506d277693f6e234f5a6c63ac44c6920"
features = [
"socks",
"sso-login",
@ -76,14 +76,14 @@ features = [
[dependencies.matrix-sdk-ui]
git = "https://github.com/matrix-org/matrix-rust-sdk.git"
rev = "88c4dec35f05ae295e0f2bf0362d6f5d72606d92"
rev = "6f2d8e0e506d277693f6e234f5a6c63ac44c6920"
default-features = false
features = ["e2e-encryption", "native-tls"]
[dependencies.ruma]
# version = "0.9.4"
git = "https://github.com/ruma/ruma.git"
rev = "4c00bd010dbdca6005bd599b52e90a0b7015d056"
rev = "b6200c01a120120faf9f744ab4f171ff3beefd72"
features = [
"unstable-unspecified",
"client-api-c",

2
src/session/model/room/mod.rs

@ -1162,7 +1162,7 @@ impl Room {
/// Load the display name from the SDK.
async fn load_display_name(&self) {
let matrix_room = self.matrix_room().clone();
let handle = spawn_tokio!(async move { matrix_room.display_name().await });
let handle = spawn_tokio!(async move { matrix_room.computed_display_name().await });
// FIXME: We should retry if the request failed
match handle.await.unwrap() {

24
src/session/model/room/timeline/mod.rs

@ -8,8 +8,8 @@ use futures_util::StreamExt;
use gtk::{gio, glib, glib::clone, prelude::*, subclass::prelude::*};
use matrix_sdk::Error as MatrixError;
use matrix_sdk_ui::timeline::{
default_event_filter, AnyOtherFullStateEventContent, BackPaginationStatus, PaginationOptions,
RoomExt, Timeline as SdkTimeline, TimelineItem as SdkTimelineItem, TimelineItemContent,
default_event_filter, AnyOtherFullStateEventContent, PaginationStatus, RoomExt,
Timeline as SdkTimeline, TimelineItem as SdkTimelineItem, TimelineItemContent,
};
use ruma::{
events::{
@ -48,12 +48,12 @@ pub enum TimelineState {
Complete,
}
impl From<BackPaginationStatus> for TimelineState {
fn from(value: BackPaginationStatus) -> Self {
impl From<PaginationStatus> for TimelineState {
fn from(value: PaginationStatus) -> Self {
match value {
BackPaginationStatus::Idle => Self::Ready,
BackPaginationStatus::Paginating => Self::Loading,
BackPaginationStatus::TimelineStartReached => Self::Complete,
PaginationStatus::Idle => Self::Ready,
PaginationStatus::Paginating => Self::Loading,
PaginationStatus::TimelineEndReached => Self::Complete,
}
}
}
@ -453,14 +453,8 @@ impl Timeline {
self.set_state(TimelineState::Loading);
let matrix_timeline = self.matrix_timeline();
let handle = spawn_tokio!(async move {
matrix_timeline
.paginate_backwards(PaginationOptions::until_num_items(
MAX_BATCH_SIZE,
MAX_BATCH_SIZE,
))
.await
});
let handle =
spawn_tokio!(async move { matrix_timeline.paginate_backwards(MAX_BATCH_SIZE).await });
if let Err(error) = handle.await.unwrap() {
error!("Could not load timeline: {error}");

34
src/user_facing_error.rs

@ -1,13 +1,14 @@
use std::time::{Duration, SystemTime};
use gettextrs::gettext;
use matrix_sdk::{
ruma::api::{
client::error::{
Error as ClientApiError, ErrorBody,
ErrorKind::{Forbidden, LimitExceeded, UserDeactivated},
},
error::FromHttpResponseError,
use matrix_sdk::{ClientBuildError, Error, HttpError, RumaApiError};
use ruma::api::{
client::error::{
Error as ClientApiError, ErrorBody,
ErrorKind::{Forbidden, LimitExceeded, UserDeactivated},
RetryAfter,
},
ClientBuildError, Error, HttpError, RumaApiError,
error::FromHttpResponseError,
};
use crate::ngettext_f;
@ -34,11 +35,20 @@ impl UserFacingError for HttpError {
},
))) => {
match kind {
Forbidden => gettext("The provided username or password is invalid."),
Forbidden { .. } => gettext("The provided username or password is invalid."),
UserDeactivated => gettext("The account is deactivated."),
LimitExceeded { retry_after_ms } => {
if let Some(ms) = retry_after_ms {
let secs = ms.as_secs() as u32;
LimitExceeded { retry_after } => {
if let Some(retry_after) = retry_after {
let duration = match retry_after {
RetryAfter::Delay(duration) => *duration,
RetryAfter::DateTime(until) => until
.duration_since(SystemTime::now())
// An error means that the date provided is in the past, which
// doesn't make sense. Let's not panic anyway and default to 1
// second.
.unwrap_or_else(|_| Duration::from_secs(1)),
};
let secs = duration.as_secs() as u32;
ngettext_f(
// Translators: Do NOT translate the content between '{' and '}',
// this is a variable name.

Loading…
Cancel
Save