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

Android - Display Sync code expiry when showing the pairing codes #23051

Merged
merged 23 commits into from
Jun 20, 2024

Conversation

AlexeyBarabash
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash commented Apr 12, 2024

Resolves brave/brave-browser#37725

This PR does two things:

  • displays Sync code expiry when showing the pairing codes, as the parent issue describes;
  • adjusts colors of Brave Sync screens on Android from obsolete orange to actual bluish.

Parent issue: brave/brave-browser#31904

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

I. QR code

  1. Create a sync chain
  2. Press Add New Device button
  3. Press Add a Mobile Device
  4. Ensure the countdown started from 30 minutes
  5. Adjust system time 28-29 minutes forward to speedup test
  6. Wait till 0 seconds countdown
  7. Ensure QR code became hidden, Code expired warning is shown, Generate New Code button appeared
  8. Press Generate New Code button
  9. Ensure there is a new QR code, Generate New Code button is hidden and there is a new coundown from 30 minutes.

II. Code words

  1. Create a sync chain
  2. Press Add New Device button
  3. Press Add a Computer
  4. Ensure the countdown started from 1 to 2 days, it depends on the local time.
    *. There is no point to wait 2 days to verify, also it is impossible to adjust the time and date after a midday because when the system time is adjusted backwards, java.util.Timer gets stopped.

Videos:

Light theme:

Light_v5.mp4

Dark theme:

Dark_v5.mp4

@AlexeyBarabash AlexeyBarabash added the CI/skip Do not run CI builds (except noplatform) label Apr 12, 2024
@AlexeyBarabash AlexeyBarabash force-pushed the sync_code_countdown branch 9 times, most recently from ad73b42 to 08519d6 Compare April 19, 2024 11:58
@AlexeyBarabash AlexeyBarabash added UI feature/sync CI/skip Do not run CI builds (except noplatform) and removed CI/skip Do not run CI builds (except noplatform) labels Apr 19, 2024
@AlexeyBarabash AlexeyBarabash removed the CI/skip Do not run CI builds (except noplatform) label Apr 19, 2024
@AlexeyBarabash AlexeyBarabash changed the title WIP: sync code countdown on Android Android - Display Sync code expiry when showing the pairing codes Apr 19, 2024
@AlexeyBarabash AlexeyBarabash marked this pull request as ready for review April 19, 2024 18:58
@AlexeyBarabash AlexeyBarabash requested review from a team as code owners April 19, 2024 18:58
Copy link
Contributor

[puLL-Merge] - brave/brave-core@23051

Description

This PR makes various UI changes to the Brave Sync settings screens on Android. It updates colors, layouts, and text to match a new design. It also adds a new feature to display countdown timers for sync codes and QR codes, showing how long they remain valid before expiring.

Changes

Changes

android/brave_java_resources.gni

  • Adds new drawable resources for Brave Sync button styles, tab layouts, countdown backgrounds, etc.

android/brave_java_sources.gni

  • Adds a new Java class BraveSyncCodeCountdownFragment to implement the sync code countdown UI.

android/java/org/chromium/chrome/browser/BraveSyncWorker.java

  • Adds new native methods to get the expiration time of a sync code and format the remaining time as a user-friendly string.

android/java/org/chromium/chrome/browser/settings/BraveSyncCodeCountdownFragment.java

  • New class that displays the countdown timer UI for sync codes, updating the text each second. Handles showing the code expired message when the countdown reaches zero.

android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java

  • Major changes to the sync settings UI
  • Updates colors, layouts, text and styles to match new designs
  • Adds a tab layout to switch between QR code and code words options
  • Generates new QR codes and code words with expiration times
  • Shows the new countdown fragment for QR codes and code words
  • Refactors the enabling of different views and layouts

android/java/res/*

  • Many changes to layout XMLs, dimensions, colors, strings etc to implement the new UI design

browser/android/brave_sync_worker.cc

  • Implements the new native methods to get sync code expiration time and format the time remaining

Security Hotspots

None found. The changes deal with UI and don't appear to introduce any new security risks.

AlexeyBarabash and others added 23 commits June 20, 2024 14:13
fixes brave/brave-browser#37725

Co-authored-by: Deep Pandya <5146988+deeppandya@users.noreply.github.com>
- #2 padding of title
- #3 text colors
- #6 line-hight issue

The initial Sync page on Android is now broken due to changed styles - wip.
Co-authored-by: Deep Pandya <5146988+deeppandya@users.noreply.github.com>
@AlexeyBarabash
Copy link
Contributor Author

removed roboto_mono_regular.ttf and rebased

@AlexeyBarabash AlexeyBarabash merged commit 9c96ab1 into master Jun 20, 2024
19 checks passed
@AlexeyBarabash AlexeyBarabash deleted the sync_code_countdown branch June 20, 2024 13:05
@github-actions github-actions bot added this to the 1.69.x - Nightly milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants