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

Add konsist vm checks #5212

Merged
merged 8 commits into from
Oct 2, 2023
Merged

Add konsist vm checks #5212

merged 8 commits into from
Oct 2, 2023

Conversation

albin-mullvad
Copy link
Collaborator

@albin-mullvad albin-mullvad commented Sep 29, 2023

This PR aims to add some Konsist checks for our view models.


This change is Reviewable

@albin-mullvad albin-mullvad force-pushed the add-konsist-vm-checks branch 3 times, most recently from 67daee9 to 8c458bf Compare September 29, 2023 17:47
@Pururun Pururun added the Android Issues related to Android label Oct 1, 2023
@albin-mullvad albin-mullvad requested review from Rawa and Pururun October 2, 2023 06:53
@albin-mullvad albin-mullvad self-assigned this Oct 2, 2023
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

Reviewed 32 of 33 files at r1, all commit messages.
Reviewable status: 32 of 33 files reviewed, 4 unresolved discussions (waiting on @albin-mullvad)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt line 40 at r1 (raw file):

    private val _toastMessages = MutableSharedFlow<String>(extraBufferCapacity = 1)
    @Suppress("konsist.ensurePublicPropertiesUsePermittedNames")

I guess the long term solution to this would be to fold toast messages into side effects? Otherwise I guess it should be permitted. Or I guess it will be fixed by going to full compose?


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt line 43 at r1 (raw file):

    val toastMessages = _toastMessages.asSharedFlow()

    @Suppress("konsist.ensurePublicPropertiesUsePermittedNames") var accountToken: String? = null

Maybe we should create an issue to improve this behaviour? So that we don't just add a suppress and forget about it.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt line 69 at r1 (raw file):

            )

    @Suppress("konsist.ensurePublicPropertiesUsePermittedNames")

This should be a uiSideEffect. I guess either we should create a linear issue or include this change in this PR.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt line 54 at r1 (raw file):

    private val _toastMessages = MutableSharedFlow<String>(extraBufferCapacity = 1)
    @Suppress("konsist.ensurePublicPropertiesUsePermittedNames")

See comment above.

Copy link
Collaborator Author

@albin-mullvad albin-mullvad left a comment

Choose a reason for hiding this comment

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

Reviewable status: 32 of 33 files reviewed, 4 unresolved discussions (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt line 40 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

I guess the long term solution to this would be to fold toast messages into side effects? Otherwise I guess it should be permitted. Or I guess it will be fixed by going to full compose?

Yes! https://linear.app/mullvad/issue/DROID-388/use-side-effects-for-all-one-shot-ui-updates


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt line 43 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Maybe we should create an issue to improve this behaviour? So that we don't just add a suppress and forget about it.

Good point! New issue: https://linear.app/mullvad/issue/DROID-387/avoid-exposing-account-token-in-device-list-view-model


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt line 69 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

This should be a uiSideEffect. I guess either we should create a linear issue or include this change in this PR.

Yes! https://linear.app/mullvad/issue/DROID-388/use-side-effects-for-all-one-shot-ui-updates


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt line 54 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

See comment above.

Yes! https://linear.app/mullvad/issue/DROID-388/use-side-effects-for-all-one-shot-ui-updates

@albin-mullvad albin-mullvad requested a review from Pururun October 2, 2023 09:18
Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

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

@albin-mullvad albin-mullvad force-pushed the add-konsist-vm-checks branch from 8c458bf to 8af8d3c Compare October 2, 2023 09:45
@albin-mullvad albin-mullvad merged commit 76a67da into main Oct 2, 2023
9 of 14 checks passed
@albin-mullvad albin-mullvad deleted the add-konsist-vm-checks branch October 2, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues related to Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants