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

[iOS] Prevent contributors counting animation from firing on scroll #1030

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

woxtu
Copy link
Contributor

@woxtu woxtu commented Sep 10, 2024

Issue

Overview (Required)

  • This PR prevents the contributors counting animation from firing on scroll

Links

Screenshot (Optional if screenshot test is present or unrelated to UI)

Before After

Movie (Optional)

Before After
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-09-10.at.23.44.30.mp4
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-09-10.at.23.51.47.mp4

Comment on lines +37 to +38
if tracker >= totalContributor { return }

Copy link
Contributor

@shin-usu shin-usu Sep 10, 2024

Choose a reason for hiding this comment

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

[nits]
It seems like that we could make a single if statement by doing the following

    func animate() {
        let interval = duration / Double(totalContributor)
        Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { time in
            if tracker >= totalContributor {
                time.invalidate()
                return
            }
            tracker += 1
        }
    }

Copy link
Contributor

@shin-usu shin-usu left a comment

Choose a reason for hiding this comment

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

I left comment, but current code is fine👍

@shin-usu shin-usu merged commit 4862d8a into DroidKaigi:main Sep 11, 2024
5 checks passed
@woxtu woxtu deleted the contributors-counting-animation branch September 13, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maybe ContributorsCount animation should only be at the beginning of screen transition
2 participants