feat: Introduce auto-updating strings objects#549
feat: Introduce auto-updating strings objects#549krlade wants to merge 26 commits intopaper-plane-developers:mainfrom
Conversation
a53cb9b to
9195097
Compare
| match chat.type_() { | ||
| ChatType::Private(user) => { | ||
| self.setup_user_info(user); | ||
| // TODO: Add handle own chat; |
src/tdlib/chat.rs
Outdated
| glib::ParamSpecInt::builder("online-member-count") | ||
| .read_only() | ||
| .build(), |
src/strings/user_status_string.rs
Outdated
|
|
||
| #[derive(Debug, Default)] | ||
| pub(crate) struct UserStatusString { | ||
| pub(super) user: OnceCell<User>, |
| } | ||
|
|
||
| impl UserStatusString { | ||
| pub(crate) fn new(user: User) -> UserStatusString { |
There was a problem hiding this comment.
Should also implement From trait.
src/strings/user_status_string.rs
Outdated
| if matches!(user.type_().0, UserType::Bot(_)) { | ||
| gettext("bot") | ||
| } else { | ||
| strings::user_status(&user.status().0) | ||
| } |
There was a problem hiding this comment.
Please use match for such things.
src/strings/user_status_string.rs
Outdated
| }), | ||
| ); | ||
|
|
||
| if let UserStatus::Offline(data) = user.status().0 { |
There was a problem hiding this comment.
Please no if let else. match is more readable
src/strings/user_status_string.rs
Outdated
| _ => { | ||
| if let Some(source) = self.imp().source_id.take() { | ||
| source.remove(); | ||
| self.imp().source_id.replace(None); |
There was a problem hiding this comment.
take already sets None. So, this line is obsolete.
src/session/content/chat_history.rs
Outdated
| pub(super) list_view: TemplateChild<gtk::ListView>, | ||
| #[template_child] | ||
| pub(super) chat_action_bar: TemplateChild<ChatActionBar>, | ||
| pub binding: RefCell<Option<gtk::ExpressionWatch>>, |
| if let Some(action) = chat.actions().last() { | ||
| should_show_actions | ||
| .then(|| strings::chat_action(&action)) | ||
| .unwrap_or(String::new()) |
There was a problem hiding this comment.
right, it's the same, but looks much better
| if !chat.is_own_chat() { | ||
| match chat.type_() { | ||
| ChatType::Private(_) | ChatType::Secret(_) => { | ||
| if !chat.is_own_chat() { |
| .try_borrow() | ||
| .ok() | ||
| .and_then(|l| l.last().map(|(_, action)| action.clone())) |
There was a problem hiding this comment.
This doesn't seem to be correct.
There was a problem hiding this comment.
Basically, I've changed it because it was borrowed mutable multiple times and I didn't know how to fix this. I realized my workaround causes new problems, but left it for now since this pr is not ready to merge anyway.
Currently translated at 100.0% (262 of 262 strings) Translation: Paper Plane/Main Translate-URL: https://hosted.weblate.org/projects/paper-plane/main/pt/
Currently translated at 100.0% (262 of 262 strings) Translation: Paper Plane/Main Translate-URL: https://hosted.weblate.org/projects/paper-plane/main/pl/
Currently translated at 100.0% (262 of 262 strings) Translation: Paper Plane/Main Translate-URL: https://hosted.weblate.org/projects/paper-plane/main/pt/
Currently translated at 81.6% (214 of 262 strings) Translation: Paper Plane/Main Translate-URL: https://hosted.weblate.org/projects/paper-plane/main/ru/
These categories were taken form the desktop file of the official client.
Some of them were taken form the desktop file of the official client.
Currently translated at 100.0% (262 of 262 strings) Translation: Paper Plane/Main Translate-URL: https://hosted.weblate.org/projects/paper-plane/main/tr/
Currently translated at 100.0% (262 of 262 strings) Translation: Paper Plane/Main Translate-URL: https://hosted.weblate.org/projects/paper-plane/main/tr/
With mask it correctly matches message bubble background
We shouldn't assume that the current locale has an equivalent country code. We need to check this and set an invalid country code in this case to fix a crash. Fixes paper-plane-developers#559
Avoid defining properties when not needed and move tdlib "use" definitions.
Change send button style and stop using chat name as window title.
Also fix a crash that was caused from this update.
Tell tdlib to open selected and close unselected chat. This is needed to recieve some updates e.g. ChatOnlineMemberCount
|
Oh Jeez, 26 commits 👀 I'm master of git 😁 |

Summary