-
-
Notifications
You must be signed in to change notification settings - Fork 16
First iteration of AddSubscriptionScreen
cleanup
#727
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR is the first iteration of cleaning up the AddSubscriptionScreen
by removing overloads and moving UI logic to the view model. The main goal is to reduce complexity in the UI layer and better separate concerns.
- Removed one overload of
AddSubscriptionScreen
and consolidated the logic - Moved file picking logic and initialization logic from UI to the view model
- Simplified UI state management by removing success handling from the composable
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
AddSubscriptionScreen.kt | Removed overload, simplified LaunchedEffect calls, moved UI logic to view model |
AddSubscriptionModel.kt | Added initialize() and onFilePicked() methods, moved Toast handling from UI to view model |
Comments suppressed due to low confidence (1)
app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt:1
- The
createSubscription()
method returnsUnit
, not aJob
orDeferred
, soinvokeOnCompletion
cannot be called on it. This will cause a compilation error.
package at.bitfire.icsdroid.model
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt
Outdated
Show resolved
Hide resolved
Okay, I will take a look at this... |
I mean, in any case, even though it's now being displayed from the ViewModel, before, the toast was still being triggered from the VM, so it doesn't make any sense... |
…el.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
I will ignore copilot. |
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
…nto clean-add-subscription-screem
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding local file does not work. After picking file the subscribe button does not show up.
app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/at/bitfire/icsdroid/model/AddSubscriptionModel.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments. Looks good otherwise.
@IntDef(Toast.LENGTH_SHORT, Toast.LENGTH_LONG) | ||
annotation class ToastDuration | ||
|
||
suspend fun toastAsync( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessarily confusing to me. I am sorry, that I said we could extract it to utils. It does not make sense. I think it's much better to simply trigger and handle cancelation in place when needed. Either in the screens (preferably) or the view model if you think that's much cleaner.
Purpose
Right now
AddSubscriptionScreen
has a lot of overloads, and complicatedLaunchedEffect
calls.Simply too much logic is on the UI. We should move it to the view model, or simplify/remove as needed.
Related to #726
Short description
AddSubscriptionScreen
Checklist