-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce auto-updating strings objects #549
base: main
Are you sure you want to change the base?
Conversation
a53cb9b
to
9195097
Compare
ChatType::Private(user) => { | ||
self.setup_user_info(user); | ||
// TODO: Add handle own chat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
src/tdlib/chat.rs
Outdated
glib::ParamSpecInt::builder("online-member-count") | ||
.read_only() | ||
.build(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move after unread-count
.
src/strings/user_status_string.rs
Outdated
|
||
#[derive(Debug, Default)] | ||
pub(crate) struct UserStatusString { | ||
pub(super) user: OnceCell<User>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a WeakRef
} | ||
|
||
impl UserStatusString { | ||
pub(crate) fn new(user: User) -> UserStatusString { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take
already sets None
. So, this line is obsolete.
src/session/content/chat_history.rs
Outdated
@@ -52,6 +53,7 @@ mod imp { | |||
pub(super) list_view: TemplateChild<gtk::ListView>, | |||
#[template_child] | |||
pub(super) chat_action_bar: TemplateChild<ChatActionBar>, | |||
pub binding: RefCell<Option<gtk::ExpressionWatch>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this at the beginning
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap_or_default()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You already checked that.
.try_borrow() | ||
.ok() | ||
.and_then(|l| l.last().map(|(_, action)| action.clone())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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