Skip to content

[TV] Confirm before logging out from the profile modal - #5796

Merged
sztomek merged 3 commits into
mainfrom
feat/tv-logout-confirmation
Aug 28, 2026
Merged

[TV] Confirm before logging out from the profile modal#5796
sztomek merged 3 commits into
mainfrom
feat/tv-logout-confirmation

Conversation

@sztomek

@sztomek sztomek commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a confirmation dialog before logging out from the Android TV profile modal, bringing it to parity with the Apple TV app. Previously tapping Log out signed the user out immediately, with no chance to cancel an accidental D-pad selection — a destructive action (it clears all downloaded podcasts and data from the device).

Now tapping Log out swaps the profile modal content for an in-place confirmation (TvConfirmationContent) with a title, an explanatory message, a Log out confirm button, and a Cancel button. Focus lands on Cancel by default (the safe choice for a destructive action). Pressing Back / dismissing while the confirmation is showing returns to the profile menu rather than closing the whole modal; only confirming actually signs out.

Reuses the existing shared TvConfirmationContent component (already used for other TV confirmations) and the existing log_out / cancel strings, so the change is a small state toggle inside TvProfileModal plus two new strings for the confirmation copy.

Fixes PCDROID-740 https://linear.app/a8c/issue/PCDROID-740/logout-confirmation-dialog

Testing Instructions

  1. On an Android TV device/emulator, sign in and open the profile modal (top-bar profile icon).
  2. Move focus to Log out and press SELECT.
  3. Confirm the modal now shows the Log out? confirmation with Log out and Cancel buttons, focus starting on Cancel.
  4. Press Back (or select Cancel) → returns to the profile menu, still signed in.
  5. Re-open, select Log out, then select the Log out confirm button → you are signed out and returned to the Welcome screen.

Screenshots or Screencast

Screenshot_20260827_143009

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the Event Horizon schema to reflect any new or changed analytics. (No change needed — no analytics in this PR.)

@claude

claude Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 2m 1s —— View job


Small, correct change. The state toggle is sound: onLogOut in TvScaffold.kt:168 clears isProfileModalVisible, so isShowingLogoutConfirmation is discarded with the composition and can't leak into a signed-out profile, and intercepting TvModal's onDismissRequest gives the described back-out-of-confirmation behaviour since DialogProperties handles BACK by default. The warning copy is accurate about the wipe — TvSignOutManager.signOutAndWipeData() really does clear downloads, user prefs and TV prefs. Two non-blocking points below, both about matching the confirmation pattern already established in TvEpisodeActionsModal.

Non-blocking

  • tv/src/main/java/au/com/shiftyjelly/pocketcasts/home/TvProfileModal.kt:69 — cancelling returns focus to Starred Episodes instead of Log out, because TvProfileModalContent leaves composition and its FocusRequester/LaunchedEffect are recreated; TvEpisodeActionsModal handles this with returnFocusLabel. (thread)

Nits

  • modules/services/localization/src/main/res/values/strings.xml:273 — "restore them" overpromises; deleteDownloadedFiles() removes the episode files permanently, so logging back in syncs subscriptions but not downloads. (thread)
    • branch feat/tv-logout-confirmation

message = stringResource(LR.string.tv_profile_log_out_confirmation_message),
confirmLabel = stringResource(LR.string.log_out),
onConfirm = onLogOut,
onCancel = { isShowingLogoutConfirmation = false },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(non-blocking) Cancelling drops focus on Starred Episodes, not back on Log out. TvProfileModalContent leaves composition while the confirmation shows, so its remember { FocusRequester() } and LaunchedEffect are recreated and re-request focus on the first button — the user has to D-pad down three rows to get back to where they were.

TvEpisodeActionsModal solves exactly this with returnFocusLabel (TvEpisodeActionsModal.kt:64, :114-117, :176-183), which restores focus to the button that opened the confirmation. Worth matching here, e.g. keep the confirmation state inside TvProfileModalContent and focus the Log out button when it returns to null.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed by matching the returnFocusLabel pattern from TvEpisodeActionsModal. Moved the confirmation state into TvProfileModalContent so it no longer leaves composition (with its own BackHandler for Back-to-cancel), and on cancel it now attaches the FocusRequester to the Log out button rather than the first row — so focus returns to where the user was.

<string name="tv_search_error_subtitle">Check your connection and try again.</string>
<string name="tv_profile_starred_episodes">Starred Episodes</string>
<string name="tv_profile_log_out_confirmation_title">Log out?</string>
<string name="tv_profile_log_out_confirmation_message">This removes all downloaded podcasts and data from this device. You can log in again to restore them.</string>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(nit) "You can log in again to restore them" overpromises for downloads. TvSignOutManager.deleteDownloadedFiles() deletes the episode/cloud/temp directories outright; logging back in restores subscriptions and sync state, but downloaded files have to be re-downloaded. Consider "You can log in again to sync your podcasts back." or similar.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed — reworded to "…You can log in again to sync your podcasts back." Confirmed TvSignOutManager.deleteDownloadedFiles() deletes the download directories via deleteRecursively(), so the old "restore them" wording did overpromise for downloads; sync state comes back on re-login, downloads have to be re-downloaded.

@sztomek sztomek added [Type] Feature Adding a new feature. [Area] TV labels Aug 27, 2026
@sztomek sztomek added this to the 8.20 milestone Aug 27, 2026
@sztomek
sztomek marked this pull request as ready for review August 27, 2026 13:01
@sztomek
sztomek requested a review from a team as a code owner August 27, 2026 13:01
@sztomek
sztomek requested review from geekygecko and removed request for a team August 27, 2026 13:01
@claude

claude Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 29s —— View job


No new commits since my last review (3623646 is still HEAD), so nothing further to review — both earlier findings remain open.

Non-blocking

  • tv/src/main/java/au/com/shiftyjelly/pocketcasts/home/TvProfileModal.kt:69 — cancelling returns focus to the first button instead of Log out (thread).

Nits

  • modules/services/localization/src/main/res/values/strings.xml:273 — "restore them" overpromises for deleted downloads (thread).
    • branch feat/tv-logout-confirmation

@sztomek
sztomek force-pushed the feat/tv-settings-sheet branch from e142cb8 to 5c360df Compare August 27, 2026 13:23
@sztomek
sztomek force-pushed the feat/tv-logout-confirmation branch from 3623646 to 0d77740 Compare August 27, 2026 13:26
@claude

claude Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 1m 35s —— View job


0d77740 addresses both open findings. Focus restoration now follows the TvEpisodeActionsModal pattern — confirmation state moved into TvProfileModalContent, returnFocusToLogOut moves the FocusRequester from Starred Episodes to Log out on cancel, and BackHandler replaces the onDismissRequest intercept (same as TvEpisodeActionsModal.kt:118, so back is consumed before the dialog's own dismiss callback). The string no longer promises downloads come back. Nothing new to raise.
• branch feat/tv-logout-confirmation

@sztomek
sztomek force-pushed the feat/tv-settings-sheet branch 2 times, most recently from 3fac200 to 2ec5362 Compare August 28, 2026 07:01
@sztomek
sztomek force-pushed the feat/tv-logout-confirmation branch from 0d77740 to 4a8cbdf Compare August 28, 2026 07:02
@sztomek
sztomek force-pushed the feat/tv-settings-sheet branch from 2ec5362 to 822daef Compare August 28, 2026 11:40
Base automatically changed from feat/tv-settings-sheet to main August 28, 2026 11:57
@sztomek
sztomek force-pushed the feat/tv-logout-confirmation branch from 4a8cbdf to 8861c29 Compare August 28, 2026 12:03
@claude

claude Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 1m 14s —— View job


The branch was force-pushed (rebased into 3 commits; the previously reviewed 0d77740 no longer exists), so I re-read the whole diff at 8861c29. It is functionally the same code I signed off on: confirmation state lives in TvProfileModalContent, BackHandler cancels back to the menu, and returnFocusToLogOut moves the FocusRequester from Starred Episodes to Log out so focus lands where the user was — matching TvEpisodeActionsModal.kt:113-128,176-183. onLogOut in TvScaffold.kt:184 still clears isProfileModalVisible, so the confirmation state can't survive into a signed-out profile. Both earlier findings stay addressed; nothing new to raise.
• branch feat/tv-logout-confirmation

@sztomek
sztomek merged commit 4093e01 into main Aug 28, 2026
20 checks passed
@sztomek
sztomek deleted the feat/tv-logout-confirmation branch August 28, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant