Skip to content

Conversation

@ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented Sep 27, 2025

Purpose

See #719

Short description

  • Added a new check: SubscriptionSettingsUseCase.UiState.isInitialized. Will just check whether the "initialization values" have been set (by setInitialValues for example).
  • This check is used in the LaunchedEffect block of AddSubscriptionScreen, to make sure setInitialValues is not called again when screen is recomposed (for example, when rotating the screen).
  • Also removed the @Singleton annotation from SubscriptionSettingsUseCase, because otherwise it was being shared among used instances, and state was moving around between screens.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ self-assigned this Sep 27, 2025
@ArnyminerZ ArnyminerZ linked an issue Sep 27, 2025 that may be closed by this pull request
@ArnyminerZ ArnyminerZ added the bug Something isn't working label Sep 27, 2025
@ArnyminerZ ArnyminerZ requested a review from Copilot September 27, 2025 11:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes an issue where screen orientation changes would clear UI state by preventing re-initialization of subscription settings values when the screen is recomposed.

  • Added isInitialized() check to prevent redundant initialization calls
  • Removed @Singleton annotation to avoid shared state between screen instances
  • Added early return in LaunchedEffect when UI state is already initialized

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
AddSubscriptionScreen.kt Added initialization check to prevent clearing UI state on recomposition
SubscriptionSettingsUseCase.kt Removed singleton scope and added isInitialized method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ArnyminerZ ArnyminerZ marked this pull request as ready for review September 27, 2025 11:44
@ArnyminerZ ArnyminerZ requested a review from sunkup September 27, 2025 11:44
Copy link
Member

@sunkup sunkup left a comment

Choose a reason for hiding this comment

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

Dirty workaround, but good for now. Please merge 👍

@ArnyminerZ ArnyminerZ merged commit 83012b4 into main Sep 27, 2025
8 checks passed
@ArnyminerZ ArnyminerZ deleted the 719-input-lost-on-screen-rotation-in-addsubscriptionscreen branch September 27, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input lost on screen rotation in AddSubscriptionScreen

2 participants