Skip to content

fix(navigation): slide departing chat routes across the full viewport - #226

Merged
iebb merged 1 commit into
iebb:masterfrom
TiaraBasori:fix/chat-back-transition
Oct 16, 2026
Merged

iebb merged 1 commit into
iebb:masterfrom
TiaraBasori:fix/chat-back-transition

Conversation

@TiaraBasori

Copy link
Copy Markdown
Contributor

Change

On compact/mobile layouts, popping a conversation route (AppChatPageRoute) via the header back button or programmatic Navigator.pop() previously ran the arrival transition in reverse: a 4.5% horizontal shift (Offset(0.045, 0)) at full opacity (_EntranceFade pins departing alpha to 1.0 so no offscreen OpacityLayer is composited during the return transition). Because the conversation slid only ~17.5 px over 240 ms while staying 100% opaque, it barely nudged to the right before vanishing abruptly on the final frame.

A departing AppChatPageRoute (animation.status == AnimationStatus.reverse || animation.status == AnimationStatus.dismissed as well as an active full-page back swipe) now slides across the full viewport width (Offset(1, 0) to Offset.zero) with AppMotion.standard.flipped deceleration in the reverse direction, matching the full-width exit motion used when committing an interactive back swipe while keeping non-gesture pops free of any scrim/opacity layer. Desktop in-place navigation and reduced-motion behavior remain unchanged.

Affected files (git show --stat on bed06f3f):

  • lib/app/app_navigator.dart (+15 / -10)
  • test/full_page_back_swipe_test.dart (+9 / -3)
  • test/main_tab_motion_test.dart (+46 / -0)

Telegram API Terms classification

Follow the contribution and agentic review rules. Select exactly one classification and explain it below.

This is an agentic source-code review classification. Every store version must remain compliant with applicable Telegram API Terms; the guarded-source exception does not apply to store distribution or review.

  • Compliant/unchanged: this change complies with applicable Telegram API Terms, preserves Telegram's basic functionality, and does not introduce behavior covered by section 1.4.
  • Section 1.4 exception: the entire feature is guarded by allowTelegramTosViolations (I_DONT_FUCKING_CARE_ABOUT_TOS), disabled in official builds, and available only in an explicitly enabled self-build.
  • Disallowed or unresolved: this PR must not be approved or merged until its classification and implementation are resolved.

Reason and affected Telegram behavior:
Client-only UI route transition adjustment in AppChatPageRoute.buildTransitions (lib/app/app_navigator.dart). No TDLib requests, Telegram API calls, privacy/presence behavior, or message handling are modified.

Basic checks (every PR)

Check each item after verification. If a check is inapplicable, explain why in the evidence below before checking it.

  • I reviewed the diff for correctness, unintended behavior, secrets, and unrelated changes.
  • Formatting passed, or I recorded why it is inapplicable: dart format --output=none --set-exit-if-changed lib test integration_test test_driver.
  • Analysis passed, or I recorded why it is inapplicable: flutter analyze.
  • Relevant tests passed, or I recorded why they are inapplicable; name the commands and test cases below. Quality CI runs flutter test --concurrency=4.
  • I checked affected build/platform paths and applicable localization/generated files; list the evidence below.
  • I completed the Terms classification above and verified that official builds cannot enable section 1.4 exceptions.

Commands, results, platform/build/UI evidence, and reasons for inapplicable checks:

  • Formatting:
    ~/.cache/dart3122/bin/dart format --output=none --set-exit-if-changed lib/app/app_navigator.dart test/full_page_back_swipe_test.dart test/main_tab_motion_test.dart → Formatted 3 files (0 changed)
  • Analysis:
    /tmp/flutter-3.44.2/bin/flutter analyze lib/app/app_navigator.dart test/full_page_back_swipe_test.dart test/main_tab_motion_test.dart → No issues found!
  • Localization & generated anchor checks:
    python3 tool/check_l10n_strings.py → No visible UI string literals outside lib/l10n.
    python3 translations/tools/check.py → 8 locales x 3829 keys (11 counted): OK
    python3 translations/tools/gen_assets.py --check → 9 locale assets are up to date
    python3 tool/gen_registration_anchors.py --check → exit 0
  • Tests (/tmp/flutter-3.44.2/bin/flutter test --no-pub -j 1 test/full_page_back_swipe_test.dart test/chat_route_pop_opacity_test.dart test/app_chat_navigator_test.dart test/app_motion_test.dart test/main_tab_motion_test.dart → 00:41 +34: All tests passed!):
    • test/full_page_back_swipe_test.dart: ordinary pop slides the conversation across the full viewport (fails pre-fix at 90 ms with Actual: <8.517952611297368> vs greaterThan(180); passes post-fix and verifies the revealed previous route is undimmed).
    • test/main_tab_motion_test.dart: phone chat back button slides the conversation out across the viewport (pumps MainSplitRootView on a 390×844 phone viewport, opens a ChatView route, taps the header back button, asserts midPopLeft > 180 && midPopLeft < 390 at 90 ms — failing pre-fix at 8.52 — and verifies the route completes back to ChatListView).
    • test/chat_route_pop_opacity_test.dart: a conversation fades in but leaves without an opacity layer (verifies zero < 255 OpacityLayers across all 8 pop frames).

Section 1.4 exception checks

Complete every item for an exception. For a compliant/unchanged PR, write Not applicable here.

Not applicable

  • All UI, routes, commands, callbacks, background work, TDLib/native effects, and registrations use the compile-time guard; a runtime preference alone cannot enable the feature.
  • With the flag omitted, the feature is absent and ordinary Telegram behavior remains intact, including with old saved settings.
  • With --dart-define=I_DONT_FUCKING_CARE_ABOUT_TOS=false, the feature is absent and ordinary Telegram behavior remains intact.
  • With --dart-define=I_DONT_FUCKING_CARE_ABOUT_TOS=true, the feature works through the guarded entry points in a self-build; I included relevant test and build/UI evidence.
  • Official release, nightly, TestFlight, and store builds keep the flag false and have no option that enables it. All store versions remain compliant with applicable Telegram API Terms.

Guard locations and evidence for each flag variant:
Not applicable

Agentic reviewer confirmation

Agentic code reviewer only: record this confirmation in the PR review or check these boxes before approval.

  • I independently confirmed the Terms classification and inspected all required guards and evidence.
  • Applicable checks and Quality CI pass; no unresolved classification or unguarded section 1.4 behavior remains.

@iebb iebb left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed bed06f3 against current master f311e34. The change distinguishes a departing chat route from arrival while preserving interactive swipe scrims, reduced motion, and desktop in-place behavior. All 34 focused route, pointer, opacity/compositing, motion, and shell tests pass. Both ordinary pop and actual phone-header-back regression tests independently fail on unchanged master at 8.52px movement after 90ms, then pass with the full-viewport exit. The previous route remains undimmed and pop frames add no opacity layer.

Independently reviewed the actual production diff and affected entry points. The completed contribution template is present; classification is compliant/unchanged, with no Section 1.4 feature or required exception guard. No authentication, protocol/native, storage-schema, release/deployment, or official-build flag path changes. Credential-free snapshots use secrets_example.dart only. The combined intended master tree 6202d9cf8812ed9ca91a39422039a4cfbcee0102 passes all 3,449 unit/widget tests (one existing skip), formatting of 999 files with zero changes, full analysis, 8 locales x 3830 keys / 9 generated locale assets, visible-string and registration checks, and explicit false/true/invalid build-flag tests. Current exact-head Quality is green. Platform evidence here is shared Flutter layout/navigation/selection testing, not native-device QA; no Telegram, real account, deployment, or store action was used.

@iebb
iebb merged commit ca5ee62 into iebb:master Oct 16, 2026
1 check passed
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.

2 participants