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 refresh AccountCache from VoucherRedeemer #5345

Conversation

Rawa
Copy link
Contributor

@Rawa Rawa commented Oct 23, 2023

This PR includes a temporary workaround to allow VoucherRedeemer to update the AccountCache (expiryTime) once the user has redeemed a voucher through the app.


This change is Reviewable

@linear
Copy link

linear bot commented Oct 23, 2023

DROID-429 Account expiry time not updated after redeeming voucher

After redeeming a voucher in the account screen the expiry date is not updated until leaving the screen and coming back again.

@Rawa Rawa force-pushed the account-expiry-time-not-updated-after-redeeming-voucher-droid-429 branch from 6117d59 to bae5554 Compare October 23, 2023 13:14
@Rawa Rawa self-assigned this Oct 23, 2023
@Rawa Rawa added the Android Issues related to Android label Oct 23, 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.

:lgtm:

I think we should wait with merging until Albin is back though.

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

@Pururun Pururun requested a review from albin-mullvad November 6, 2023 10:41
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.

Let's go ahead with this workaround 👍

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Rawa)


android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt line 43 at r1 (raw file):

                    if (result is VoucherSubmissionResult.Ok) {
                        val accountExpiry =
                            AccountExpiry.Available(result.submission.newExpiry.parseAsDateTime()!!)

Is the intention to crash if the date parsing fails? Would probably be nice to avoid crashing the service if possible, since that would also kill the tunnel.

Code quote:

parseAsDateTime()!!

Copy link
Contributor Author

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

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


android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt line 43 at r1 (raw file):

Previously, albin-mullvad wrote…

Is the intention to crash if the date parsing fails? Would probably be nice to avoid crashing the service if possible, since that would also kill the tunnel.

I see what you mean with crashing the service, but at the same time if we get something that is not able to be parsed to a DateTime we really want it to crash because the interface between service and daemon is faulty. If we just fail silently with some log it might be that we miss it and let it sneak out as a bug.

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/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt line 43 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

I see what you mean with crashing the service, but at the same time if we get something that is not able to be parsed to a DateTime we really want it to crash because the interface between service and daemon is faulty. If we just fail silently with some log it might be that we miss it and let it sneak out as a bug.

As we discussed offline, using !! comes with a certain risk so we'll create a separate issue to look into this further. @Pururun let's add null safety to this PR.

@Rawa please create an issue and share here 🙏

Copy link
Contributor Author

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

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


android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/VoucherRedeemer.kt line 43 at r1 (raw file):

Previously, albin-mullvad wrote…

As we discussed offline, using !! comes with a certain risk so we'll create a separate issue to look into this further. @Pururun let's add null safety to this PR.

@Rawa please create an issue and share here 🙏

After internal discussions we have decided lift this change out of this PR and make an issue for the future since it needs more testing and aligning with the internals of the daemon. For now we will try and allow it to be nullable.

@Rawa Rawa force-pushed the account-expiry-time-not-updated-after-redeeming-voucher-droid-429 branch 3 times, most recently from 9dbd3c4 to 6868f83 Compare November 15, 2023 13:08
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.

:lgtm:

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

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

@albin-mullvad albin-mullvad force-pushed the account-expiry-time-not-updated-after-redeeming-voucher-droid-429 branch from 6868f83 to 64f3900 Compare November 15, 2023 13:43
@albin-mullvad albin-mullvad merged commit 3348ee8 into main Nov 15, 2023
9 checks passed
@albin-mullvad albin-mullvad deleted the account-expiry-time-not-updated-after-redeeming-voucher-droid-429 branch November 15, 2023 13:43
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