Skip to content

Conversation

@graycreate
Copy link
Member

@graycreate graycreate commented Oct 18, 2025

Problem

In v1.1.4, the online count feature introduced in PR #57 always shows 0 people online.

Root Cause:

  • animatedOnlineCount is initialized to 0 as the default value
  • When onlineStats changes from nil to a valid value, animatedOnlineCount stays at 0
  • .onChange only triggers when the value changes, not on the initial load with a value

Solution

Add .onAppear modifier to initialize animatedOnlineCount from stats.onlineCount when the view first appears with valid stats.

Additional Improvements

1. Change Default TestFlight Release to Internal Testing

  • 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
  • This allows faster iteration without Beta App Review approval

2. Add Configurable Release Channel Parameter

  • Add release_channel workflow input (internal/public_beta)
  • Default to internal for automatic releases (push to main)
  • Support public_beta for manual workflow_dispatch
  • Fastlane beta lane now accepts channel parameter
  • Dynamically configure TestFlight distribution based on channel

Usage:

  • Automatic (push to main): Uses internal by default
  • Manual workflow: Select public_beta in workflow dispatch UI
  • Local fastlane: fastlane beta channel:public_beta

Channel Differences:

  • internal: No beta review required, internal testers only, immediate availability
  • public_beta: Submit for beta review, notify external testers, requires approval

Testing

  • Verified regex parsing works correctly with V2EX HTML
  • The count should now display correctly on first load
  • Animation still works when count changes during refresh
  • Release channel configuration tested with workflow syntax validation

Regression Details

  • Working version: v1.1.3 (used stats.onlineCount directly)
  • Broken version: v1.1.4 (introduced animatedOnlineCount with initialization bug)
  • Fixed version: This PR

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.
Copilot AI review requested due to automatic review settings October 18, 2025 08:13
Copy link

Copilot AI left a 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 .onAppear modifier to initialize animatedOnlineCount from stats.onlineCount when the view first appears with valid stats

}
.onAppear {
// Initialize animatedOnlineCount when view appears with valid stats
if animatedOnlineCount == 0 && stats.onlineCount > 0 {
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
if animatedOnlineCount == 0 && stats.onlineCount > 0 {
if animatedOnlineCount != stats.onlineCount {

Copilot uses AI. Check for mistakes.
- 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.
@github-actions github-actions bot added size/M and removed size/XS labels Oct 18, 2025
- 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
Copilot AI review requested due to automatic review settings October 18, 2025 08:23
@github-actions github-actions bot added size/M and removed size/M labels Oct 18, 2025
Copy link

Copilot AI left a 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"
Copy link

Copilot AI Oct 18, 2025

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.

Suggested change
desc "Distribute existing build to internal testers"
desc "Distribute the most recent build to internal testers"

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

Code Coverage Report ❌

Current coverage: 0%

2 similar comments
@github-actions
Copy link

Code Coverage Report ❌

Current coverage: 0%

@github-actions
Copy link

Code Coverage Report ❌

Current coverage: 0%

@graycreate graycreate merged commit 99015c5 into main Oct 18, 2025
6 checks passed
@graycreate graycreate deleted the fix/online-count-initialization branch October 18, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants