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

Device list resets after going to settings #5128

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

Pururun
Copy link
Contributor

@Pururun Pururun commented Sep 7, 2023

This is because the device list is not updated unless specifically told so.

Added so that it always updates on successful device list events.

Also improved the compose view.


This change is Reviewable

@linear
Copy link

linear bot commented Sep 7, 2023

DROID-194 Device list resets after going to settings

After clicking on settings and then going back to the too many devices screen the list is reset as it was when it was first opened, regardless if the user have removed any devices.

Steps to reproduce:

  1. Remove a device from the device list
  2. Open settings by click on the cog in the upper right corner
  3. Close settings
  4. Note that the removed device is back in the device list.

@Pururun Pururun added the Android Issues related to Android label Sep 12, 2023
Copy link
Contributor

@Rawa Rawa 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 r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

            .map {
                if (it is DeviceListEvent.Available) {
                    cachedDeviceList.value = DeviceList.Available(it.devices)

I believe this fix is fine for now but we should probably revisit/reimagine how the DeviceRepository works, it feels unnaturally complex with multiple streams containing deviceList, deviceState, deviceRemovalEvent etc.

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 r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

            .map {
                if (it is DeviceListEvent.Available) {
                    cachedDeviceList.value = DeviceList.Available(it.devices)

This is probably find, but did you test various cases to check whether this cache works as expected? For instance to make sure that the cache never is used in the wrong situation, e.g. if the user tries to log in to another account (and an updated device list fails to be fetched).

Code quote:

cachedDeviceList.value = DeviceList.Available(it.devices)

@Pururun Pururun force-pushed the device-list-resets-after-going-to-settings-droid-194 branch from 4d9b115 to 0a5236d Compare September 18, 2023 10:43
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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

Previously, albin-mullvad wrote…

This is probably find, but did you test various cases to check whether this cache works as expected? For instance to make sure that the cache never is used in the wrong situation, e.g. if the user tries to log in to another account (and an updated device list fails to be fetched).

probably fine*

Copy link
Contributor Author

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @albin-mullvad)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

I believe this fix is fine for now but we should probably revisit/reimagine how the DeviceRepository works, it feels unnaturally complex with multiple streams containing deviceList, deviceState, deviceRemovalEvent etc.

Yes agree, very unnecessarily complex.


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

Previously, albin-mullvad wrote…

probably fine*

I have tested logging in to a different account, but not where an updated list fails to fetch.

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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

I have tested logging in to a different account, but not where an updated list fails to fetch.

Can that scenario also be tested either manually or/and using automated tests? Otherwise this one looks ready to merge.

@Pururun Pururun force-pushed the device-list-resets-after-going-to-settings-droid-194 branch from 0a5236d to 6a51ebc Compare October 2, 2023 09:07
Copy link
Contributor Author

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

Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @albin-mullvad and @Rawa)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

Previously, albin-mullvad wrote…

Can that scenario also be tested either manually or/and using automated tests? Otherwise this one looks ready to merge.

Tested it manually and it seems to work fine in that scenario. I think we can merge.

@Pururun Pururun force-pushed the device-list-resets-after-going-to-settings-droid-194 branch from 6a51ebc to 44774e0 Compare October 2, 2023 09:36
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 2 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt line 60 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Tested it manually and it seems to work fine in that scenario. I think we can merge.

Great! 🚀

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@Pururun Pururun force-pushed the device-list-resets-after-going-to-settings-droid-194 branch from 44774e0 to fef7d02 Compare October 2, 2023 12:33
Copy link
Contributor

@Rawa Rawa 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: :shipit: complete! all files reviewed, all discussions resolved

@Pururun Pururun merged commit 15fa64e into main Oct 2, 2023
12 checks passed
@Pururun Pururun deleted the device-list-resets-after-going-to-settings-droid-194 branch October 2, 2023 13:07
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