Skip to content

Fix direct chat back button: pop instead of dismiss, enlarge hit area - #9

Open
topAmity wants to merge 1 commit into
mainfrom
fix/direct-chat-back-button
Open

Fix direct chat back button: pop instead of dismiss, enlarge hit area#9
topAmity wants to merge 1 commit into
mainfrom
fix/direct-chat-back-button

Conversation

@topAmity

Copy link
Copy Markdown
Collaborator

AmityChatPage's back button had two issues in direct (conversation) chat:

  1. Closes the whole UIKit instead of returning to the chat list. The chat room is pushed onto the nav stack by AmityChatHomePage, so "back" must pop. It called dismissOrPop(), which checks presentingViewController first and dismisses the entire modal when the nav stack itself was presented modally (the common host integration). AmityGroupChatPage already pops directly; direct chat now matches by preferring popViewController whenever it is not the nav-stack root, falling back to dismissOrPop() otherwise.

  2. Back tap can fall through to the adjacent avatar (which, when a chatPageBehavior is registered, opens the profile image viewer). The back button was a bare 16x16 target with .buttonStyle(.plain) sitting 12pt from a 40x40 avatar. Expanded the tappable region to the 44x44 minimum with .contentShape(Rectangle()), which also hardens hit-test routing when the page is embedded in a custom container/nav wrapper.

AmityChatPage's back button had two issues in direct (conversation) chat:

1. Closes the whole UIKit instead of returning to the chat list.
   The chat room is pushed onto the nav stack by AmityChatHomePage, so
   "back" must pop. It called dismissOrPop(), which checks
   presentingViewController first and dismisses the entire modal when the
   nav stack itself was presented modally (the common host integration).
   AmityGroupChatPage already pops directly; direct chat now matches by
   preferring popViewController whenever it is not the nav-stack root,
   falling back to dismissOrPop() otherwise.

2. Back tap can fall through to the adjacent avatar (which, when a
   chatPageBehavior is registered, opens the profile image viewer).
   The back button was a bare 16x16 target with .buttonStyle(.plain)
   sitting 12pt from a 40x40 avatar. Expanded the tappable region to the
   44x44 minimum with .contentShape(Rectangle()), which also hardens
   hit-test routing when the page is embedded in a custom container/nav
   wrapper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant