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

Improve animation duration calculation #5991

Merged

Conversation

Rawa
Copy link
Contributor

@Rawa Rawa commented Mar 20, 2024

This PR implements a new algorithm to evaluate the distance between two location that is then used to decide which type of animation we are using.


This change is Reviewable

@Rawa Rawa self-assigned this Mar 20, 2024
@Rawa Rawa added the Android Issues related to Android label Mar 20, 2024
@Rawa Rawa requested review from albin-mullvad and Pururun March 20, 2024 13:03
Copy link

linear bot commented Mar 20, 2024

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


android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt line 100 at r1 (raw file):

}

private fun Float.toAnimationDuration() =

This is just a preference, but since we are doing some kind of conversion from float to int here, could we set the return type explicitly here so that if we do for some reason change this function and the return type becomes int it will show an error immediately?


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 4 at r1 (raw file):

import kotlin.math.sqrt
import kotlin.test.assertTrue

Use jupiter assertTrue

@Rawa Rawa force-pushed the investigate-why-malmo-to-south-africa-does-not-do-far-droid-773 branch from ad1a721 to 10a50f8 Compare March 20, 2024 15:14
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: 1 of 6 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt line 100 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

This is just a preference, but since we are doing some kind of conversion from float to int here, could we set the return type explicitly here so that if we do for some reason change this function and the return type becomes int it will show an error immediately?

Good point! I'll add it.


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 4 at r1 (raw file):

Previously, Pururun (Jonatan Rhodin) wrote…

Use jupiter assertTrue

🙏 Thanks!

@albin-mullvad albin-mullvad requested a review from Pururun March 21, 2024 08:31
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 6 files at r1, 4 of 5 files at r3, all commit messages.
Reviewable status: 5 of 6 files reviewed, 3 unresolved discussions (waiting on @Pururun and @Rawa)


android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt line 100 at r3 (raw file):

}

private fun Float.toAnimationDuration(): Int =

I suggest renaming to toAnimationDurationMillis to avoid any risk of confusion

Code quote:

toAnimationDuration

android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 4 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

🙏 Thanks!

Was this detected by Detekt? Otherwise it might be a good idea to such a rule


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 23 at r3 (raw file):

    @Test
    fun `ensure seppDistance respects lateral value is respected`() {

typo?

Code quote:

respects lateral value is respected

@Rawa Rawa force-pushed the investigate-why-malmo-to-south-africa-does-not-do-far-droid-773 branch from 10a50f8 to c88e120 Compare March 21, 2024 08:46
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: 3 of 6 files reviewed, 1 unresolved discussion (waiting on @albin-mullvad and @Pururun)


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 4 at r1 (raw file):

Previously, albin-mullvad wrote…

Was this detected by Detekt? Otherwise it might be a good idea to such a rule

Unfortunately not :( , I'll add an issue to add a Konsist rule:
https://linear.app/mullvad/issue/DROID-804/add-konsist-rule-to-block-usage-of-kotlintestasserttrue


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 23 at r3 (raw file):

Previously, albin-mullvad wrote…

typo?

Yes! Thanks!

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 2 of 2 files at r4, all commit messages.
Reviewable status: 5 of 6 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 4 at r1 (raw file):

Previously, Rawa (David Göransson) wrote…

Unfortunately not :( , I'll add an issue to add a Konsist rule:
https://linear.app/mullvad/issue/DROID-804/add-konsist-rule-to-block-usage-of-kotlintestasserttrue

Nice 👍

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: 5 of 6 files reviewed, 1 unresolved discussion (waiting on @Pururun)


android/lib/model/src/test/kotlin/net/mullvad/mullvadvpn/model/LatLongTest.kt line 4 at r1 (raw file):

Previously, albin-mullvad wrote…

Nice 👍

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

@Rawa Rawa force-pushed the investigate-why-malmo-to-south-africa-does-not-do-far-droid-773 branch from c88e120 to 9d35783 Compare March 22, 2024 09:55
@Rawa Rawa merged commit 01a98bb into main Mar 22, 2024
26 checks passed
@Rawa Rawa deleted the investigate-why-malmo-to-south-africa-does-not-do-far-droid-773 branch March 22, 2024 10: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