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 info dialog for device name #5033

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

sabercodic
Copy link
Contributor

@sabercodic sabercodic commented Aug 22, 2023

This change is Reviewable

@sabercodic sabercodic added the Android Issues related to Android label Aug 22, 2023
@linear
Copy link

linear bot commented Aug 22, 2023

DROID-94 Add info dialog for device name

To help users further to understand the device concept, an info button next to the device name in the account view is added that opens an info dialog that explains the device concept.

Note: The Confluence and Zeplin links references other work related to the device concept as well


Confluence: https://mullvad.atlassian.net/l/cp/1tRhWft7

Zeplin: https://zpl.io/XYon3P8

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch 2 times, most recently from 4edf1fa to 38599da Compare August 22, 2023 15:11
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 8 of 8 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/InformationView.kt line 38 at r1 (raw file):

) {
    return if (content.isNotEmpty()) {

This is probably unnecessary to have in this commit.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt line 15 at r1 (raw file):

                appendLine(stringResource(id = R.string.device_name_info_part1))
                appendLine(stringResource(id = R.string.device_name_info_part2))
                appendLine(stringResource(id = R.string.device_name_info_part3))

Any specific reason on why this needed to be split up in three parts?


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 151 at r1 (raw file):

                    painter = painterResource(id = R.drawable.icon_info),
                    contentDescription = null,
                    tint = MullvadWhite

User material colors.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/AccountUiState.kt line 10 at r1 (raw file):

    val accountExpiry: DateTime?

    data class DefaultUiState(

Is there a better way to do this?
I know that we use it in VpnSettings, but it feels like it just creates a lot of duplicate code.
Maybe adding a parameter that is called dialogState?


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

import net.mullvad.mullvadvpn.model.DeviceState

data class AccountViewModelState(

Do we need a ViewModel state? Seems like it is adding unneeded complexity.

Copy link
Collaborator

@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.

Reviewed 3 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @Pururun and @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 151 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

User material colors.

MullvadWhite and other colors have been marked as Deprecated or internal as of #5034 and should therefore not be used. Instead material colors should be used as mentioned by @Pururun . If not possible we'll discuss it on a case-to-case basis.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 143 at r2 (raw file):

                )
                val horizontalPadding = Dimens.mediumPadding
                val verticalPadding = Dimens.infoButtonVerticalPadding

Are these vals necessary?

Code quote:

                val horizontalPadding = Dimens.mediumPadding
                val verticalPadding = Dimens.infoButtonVerticalPadding

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch from 38599da to 92cf778 Compare August 24, 2023 09:23
Copy link
Contributor Author

@sabercodic sabercodic 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: 6 of 9 files reviewed, 5 unresolved discussions (waiting on @albin-mullvad and @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt line 15 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Any specific reason on why this needed to be split up in three parts?

to be same as desktop


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 151 at r1 (raw file):

Previously, albin-mullvad wrote…

MullvadWhite and other colors have been marked as Deprecated or internal as of #5034 and should therefore not be used. Instead material colors should be used as mentioned by @Pururun . If not possible we'll discuss it on a case-to-case basis.

Done.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 143 at r2 (raw file):

Previously, albin-mullvad wrote…

Are these vals necessary?

Done.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/AccountUiState.kt line 10 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Is there a better way to do this?
I know that we use it in VpnSettings, but it feels like it just creates a lot of duplicate code.
Maybe adding a parameter that is called dialogState?

I did it to keep integrity on our architecture, should I change it?


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/InformationView.kt line 38 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

This is probably unnecessary to have in this commit.

Done.

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch from 92cf778 to 8768709 Compare August 24, 2023 09:25
Copy link
Collaborator

@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.

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Pururun and @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 136 at r3 (raw file):

                modifier = Modifier.padding(start = Dimens.sideMargin, end = Dimens.sideMargin)
            )
            Row {

Out of curiosity, why did you have to add this Row?

Code quote:

Row {

@sabercodic
Copy link
Contributor Author

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 136 at r3 (raw file):

Previously, albin-mullvad wrote…

Out of curiosity, why did you have to add this Row?

to place info icon next to the device name

Copy link
Contributor Author

@sabercodic sabercodic 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: all files reviewed, 5 unresolved discussions (waiting on @albin-mullvad and @Pururun)


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

Previously, Pururun (Jonatan Rhodin) wrote…

Do we need a ViewModel state? Seems like it is adding unneeded complexity.

I did it to keep integrity on our architecture, should I change it?

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 all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/AccountUiState.kt line 10 at r1 (raw file):

Previously, sabercodic wrote…

I did it to keep integrity on our architecture, should I change it?

I was thinking we should use something else, since when we have used it in VpnSettings it has caused a lot of easy to miss bugs. More or less states are not kept when the dialog is showing.


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

Previously, sabercodic wrote…

I did it to keep integrity on our architecture, should I change it?

See comment above.

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch 2 times, most recently from 89ca2ac to 7cf1a8a Compare September 4, 2023 07:41
Copy link
Contributor Author

@sabercodic sabercodic 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: 4 of 9 files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/AccountUiState.kt line 10 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

I was thinking we should use something else, since when we have used it in VpnSettings it has caused a lot of easy to miss bugs. More or less states are not kept when the dialog is showing.

Done.


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

Previously, Pururun (Jonatan Rhodin) wrote…

See comment above.

Done.

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 5 of 5 files at r5, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/AccountUiState.kt line 10 at r1 (raw file):

Previously, sabercodic wrote…

Done.

Nice, I think it's an improvement. I guess from a future-proof perspective I think it could be even better if instead of a boolean for every dialog we could have some kind of dialogState.
So something like this:

sealed interface AccountDialogState
data object None: AccountDialogState
data object DeviceInfoDialog: AccountDialogState

And then we can add
val dialogState: AccountDialogState to AccountUiState


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

Previously, sabercodic wrote…

Done.

Still not sure why we need a ui state and a view model state when they are the same. I guess we could move the dialogState idea from the view model state here?

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch from 7cf1a8a to db77389 Compare September 7, 2023 14:28
Copy link
Contributor Author

@sabercodic sabercodic 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: 4 of 9 files reviewed, 3 unresolved discussions (waiting on @albin-mullvad and @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/AccountUiState.kt line 10 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Nice, I think it's an improvement. I guess from a future-proof perspective I think it could be even better if instead of a boolean for every dialog we could have some kind of dialogState.
So something like this:

sealed interface AccountDialogState
data object None: AccountDialogState
data object DeviceInfoDialog: AccountDialogState

And then we can add
val dialogState: AccountDialogState to AccountUiState

Done.


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

Previously, Pururun (Jonatan Rhodin) wrote…

Still not sure why we need a ui state and a view model state when they are the same. I guess we could move the dialogState idea from the view model state here?

Done.

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch 2 times, most recently from 270f49e to 6e3fea3 Compare September 7, 2023 15:38
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 6 of 6 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @albin-mullvad and @sabercodic)


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

Previously, sabercodic wrote…

Done.

Nice work. I think it would be better to call the single state UiState, that is what it is called before your PR.

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch 2 times, most recently from 566a374 to d7dee1d Compare September 11, 2023 12:36
Copy link
Contributor Author

@sabercodic sabercodic 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: 5 of 10 files reviewed, 2 unresolved discussions (waiting on @albin-mullvad and @Pururun)


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

Previously, Pururun (Jonatan Rhodin) wrote…

Nice work. I think it would be better to call the single state UiState, that is what it is called before your PR.

Done.

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.

:lgtm:

Reviewed 5 of 5 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @albin-mullvad)

Copy link
Collaborator

@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.

Reviewed 1 of 8 files at r1, 2 of 6 files at r6, 5 of 5 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 134 at r7 (raw file):

                modifier = Modifier.padding(start = Dimens.sideMargin, end = Dimens.sideMargin)
            )
            uiState.deviceName?.let {

Why was this changed? Seems unrelated to adding the dialog. It seems like this would result in not showing the spinner if the device name is null.

This conditional check is also different from below if (uiState.accountNumber != null) {

Code quote:

uiState.deviceName?.let {

Copy link
Contributor Author

@sabercodic sabercodic 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: all files reviewed, 1 unresolved discussion (waiting on @albin-mullvad)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 134 at r7 (raw file):

Previously, albin-mullvad wrote…

Why was this changed? Seems unrelated to adding the dialog. It seems like this would result in not showing the spinner if the device name is null.

This conditional check is also different from below if (uiState.accountNumber != null) {

Done.

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch 4 times, most recently from 99c5881 to 6383a1a Compare September 22, 2023 13:07
@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch from 6383a1a to b9706b7 Compare September 25, 2023 09:08
Copy link
Contributor Author

@sabercodic sabercodic left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 4 of 29 files reviewed, 1 unresolved discussion (waiting on @albin-mullvad and @Pururun)

Copy link
Collaborator

@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.

Reviewed 6 of 6 files at r8, 20 of 20 files at r9, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 170 at r9 (raw file):

            if (uiState.accountNumber != null) {
                CopyableObfuscationView(content = uiState.accountNumber)
            }

Why this if-statement? The CopyableObfuscationView has a built in spinner which is supposed to be showen the the content is empty.

Code quote:

            if (uiState.accountNumber != null) {
                CopyableObfuscationView(content = uiState.accountNumber)
            }

android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountUiState.kt line 10 at r9 (raw file):

    val deviceName: String,
    val accountNumber: String?,
    val accountExpiry: DateTime?,

Is there a reason for not unifying these properties? Since they are very similar I suggest that either all or none are nullable.

Code quote:

    val deviceName: String,
    val accountNumber: String?,
    val accountExpiry: DateTime?,

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch from b9706b7 to ee5e485 Compare September 27, 2023 10:12
Copy link
Contributor Author

@sabercodic sabercodic 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: 26 of 29 files reviewed, 2 unresolved discussions (waiting on @albin-mullvad and @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt line 170 at r9 (raw file):

Previously, albin-mullvad wrote…

Why this if-statement? The CopyableObfuscationView has a built in spinner which is supposed to be showen the the content is empty.

Done.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountUiState.kt line 10 at r9 (raw file):

Previously, albin-mullvad wrote…

Is there a reason for not unifying these properties? Since they are very similar I suggest that either all or none are nullable.

Done.

Copy link
Collaborator

@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.

Reviewed 3 of 3 files at r10, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sabercodic)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountUiState.kt line 10 at r9 (raw file):

Previously, sabercodic wrote…

Done.

Since it's now nullable, callers should also be updated

Copy link
Contributor Author

@sabercodic sabercodic 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: all files reviewed, 1 unresolved discussion (waiting on @albin-mullvad)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountUiState.kt line 10 at r9 (raw file):

Previously, albin-mullvad wrote…

Since it's now nullable, callers should also be updated

Done.

@sabercodic sabercodic force-pushed the add-info-dialog-for-device-name-droid-94 branch from ee5e485 to 0c1a5ec Compare September 27, 2023 11:57
Copy link
Collaborator

@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.

Reviewed 3 of 3 files at r11, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@Pururun Pururun merged commit 1c7246b into main Sep 27, 2023
15 checks passed
@Pururun Pururun deleted the add-info-dialog-for-device-name-droid-94 branch September 27, 2023 13:26
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.

3 participants