Skip to content
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

Don't show "0%" at the beginning when being added as second device #3409

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Nov 4, 2024

Mitigation for #3392, follow-up for #3337.

When creating a chatmail account, when logging in to an existing email account, and when importing a backup from the Welcome Activity, we're still showing "0%" even after this PR. So, an alternative to this PR would be to make percent > 0 ? String.format(Util.getLocale(), " %d%%", percent) : ""; into a function and call it from all these places, too, and never show "0%" anywhere ever again.

@Hocuri Hocuri requested review from r10s and adbenitez November 4, 2024 12:54
Copy link

github-actions bot commented Nov 4, 2024

To test the changes in this pull request, install this apk:
📦 app-preview.apk

@@ -84,7 +84,8 @@ public void handleEvent(@NonNull DcEvent event) {
} else if (permille < 1000) {
percent = permille/10;
percentMax = 100;
statusLineText = getString(R.string.transferring) + String.format(Util.getLocale(), " %d%%", percent);
String formattedPercent = percent > 0 ? String.format(Util.getLocale(), " %d%%", percent) : "";
statusLineText = getString(R.string.transferring) + formattedPercent;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, not related to this PR but this string concatenation is not good, for RTL languages it will not be mirrored properly 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The good news is that it's not a sentence, so that it's not that bad if the order is wrong for RTL messages. I.e. "10% Transferring..." and "Transferring... 10%" is both right.

@Hocuri
Copy link
Collaborator Author

Hocuri commented Nov 5, 2024

Merging since it's a mitigation for a bug that's possibly a regression

@Hocuri Hocuri merged commit 23458a6 into main Nov 5, 2024
2 checks passed
@Hocuri Hocuri deleted the hoc/show-no-0-percent branch November 5, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants