-
Couldn't load subscription status.
- Fork 48
fix: Initialize animatedOnlineCount when view appears with stats #58
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
Conversation
Problem: - In v1.1.4, online count always shows as 0 - animatedOnlineCount is initialized to 0 as default - When onlineStats changes from nil to a value, animatedOnlineCount stays at 0 - onChange only triggers when the value changes, not on initial load Solution: - Add onAppear to initialize animatedOnlineCount from stats.onlineCount - Check if animatedOnlineCount is 0 and stats has valid count - This ensures the count displays correctly on first load Fixes the regression introduced in PR #57 where animated count feature broke the initial display of online user count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a regression in v1.1.4 where the online count always displays 0 instead of the actual number of online users. The issue occurs because animatedOnlineCount is initialized to 0 and isn't updated when stats are first loaded, since .onChange only triggers on subsequent changes, not initial values.
Key Changes:
- Added
.onAppearmodifier to initializeanimatedOnlineCountfromstats.onlineCountwhen the view first appears with valid stats
| } | ||
| .onAppear { | ||
| // Initialize animatedOnlineCount when view appears with valid stats | ||
| if animatedOnlineCount == 0 && stats.onlineCount > 0 { |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition animatedOnlineCount == 0 could prevent legitimate updates if the actual online count is 0. If the view appears when stats.onlineCount is 0 and later increases, the initialization won't trigger on subsequent appearances. Consider using a more explicit flag to track initialization state, or simplify the condition to just check if stats.onlineCount > 0.
| if animatedOnlineCount == 0 && stats.onlineCount > 0 { | |
| if animatedOnlineCount != stats.onlineCount { |
- Set distribute_external to false (internal testing only) - Remove public beta groups and external tester notifications - Skip beta review submission for internal builds - Update workflow and lane descriptions - Simplify upload_to_testflight parameters This allows faster iteration and testing without requiring Beta App Review approval for each build. Public beta releases can still be done manually through App Store Connect when needed.
- Add 'release_channel' workflow input (internal/public_beta) - Default to 'internal' for automatic releases - Support 'public_beta' for manual workflow_dispatch - Fastlane beta lane now accepts channel parameter - Dynamically configure TestFlight distribution based on channel: - internal: No beta review, internal testers only - public_beta: Submit for beta review, notify external testers - Update GitHub Release notes to reflect selected channel - Update notification messages based on channel Usage: - Automatic (push to main): Uses 'internal' by default - Manual workflow: Can select 'public_beta' in workflow dispatch UI - Local fastlane: fastlane beta channel:public_beta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| end | ||
|
|
||
| desc "Distribute existing build to beta testers" | ||
| desc "Distribute existing build to internal testers" |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The description should clarify that this lane distributes the most recent build, not necessarily a specific build number, since no build_number parameter validation is shown in the implementation.
| desc "Distribute existing build to internal testers" | |
| desc "Distribute the most recent build to internal testers" |
Code Coverage Report ❌Current coverage: 0% |
2 similar comments
Code Coverage Report ❌Current coverage: 0% |
Code Coverage Report ❌Current coverage: 0% |
Problem
In v1.1.4, the online count feature introduced in PR #57 always shows 0 people online.
Root Cause:
animatedOnlineCountis initialized to 0 as the default valueonlineStatschanges fromnilto a valid value,animatedOnlineCountstays at 0.onChangeonly triggers when the value changes, not on the initial load with a valueSolution
Add
.onAppearmodifier to initializeanimatedOnlineCountfromstats.onlineCountwhen the view first appears with valid stats.Additional Improvements
1. Change Default TestFlight Release to Internal Testing
distribute_externalto false (internal testing only)2. Add Configurable Release Channel Parameter
release_channelworkflow input (internal/public_beta)internalfor automatic releases (push to main)public_betafor manual workflow_dispatchUsage:
internalby defaultpublic_betain workflow dispatch UIfastlane beta channel:public_betaChannel Differences:
internal: No beta review required, internal testers only, immediate availabilitypublic_beta: Submit for beta review, notify external testers, requires approvalTesting
Regression Details
stats.onlineCountdirectly)animatedOnlineCountwith initialization bug)