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

Eliminate TaskViewModel's mustRestartApp field #13326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nlebeck
Copy link
Contributor

@nlebeck nlebeck commented Feb 2, 2025

Instead of having UserDataImportWarningDialog set an onResultDismiss callback that examines mustRestartApp, and having UserDataActivity set mustRestartApp, just have UserDataActivity set the callback directly.

This approach is no more data-race-y than the previous approach, and it simplifies the code. (The behavior of restarting the app when the task finishes is specific to the user data import flow, and there is no reason for TaskViewModel to be directly aware of it.)

I tested this PR by running the app in an Android emulator and importing user data, and verifying that the app restarts the same way it did before.

Instead of having UserDataImportWarningDialog set an
`onResultDismiss` callback that examines `mustRestartApp`, and having
UserDataActivity set `mustRestartApp`, just have UserDataActivity set
the callback directly.

This approach is no more data-race-y than the previous approach, and it
simplifies the code. (The behavior of restarting the app when the task
finishes is specific to the user data import flow, and there is no
reason for TaskViewModel to be directly aware of it.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants