Skip to content

Conversation

Copy link

Copilot AI commented Nov 14, 2025

Adding distinct user agents for iOS/Android streams in Track objects

Plan

  • Explore repository structure and understand the code
  • Verify tests pass and linting is clean
  • Identify Track interface supports userAgent property
  • Add platform-specific user agent to Track objects in ArchiveService.ts
  • Create utility function to generate platform-specific user agent strings
  • Add tests for the new functionality
  • Run lint and typecheck
  • Run all tests to verify changes work correctly
  • Run CodeQL security check
  • Address review feedback - derive version from package.json

Implementation Summary

Successfully implemented platform-specific user agents for iOS and Android streams as requested in the issue.

New Files

  • src/utils/UserAgent.ts - Utility function that generates platform-specific user agent strings using React Native's Platform API and derives version from package.json
  • __tests__/UserAgent.test.ts - Comprehensive tests for the user agent utility (4 test cases)

Modified Files

  • src/services/ArchiveService.ts - Added userAgent to archive and live stream tracks (2 locations)
  • src/services/AudioPreviewService.ts - Added userAgent to preview tracks (1 location)
  • src/app/Home/index.tsx - Added userAgent to initial and restored live stream tracks (2 locations)
  • tsconfig.json - Added resolveJsonModule and esModuleInterop to enable importing package.json

User Agent Formats

  • iOS: WMBRApp/{version} (iOS; iPhone)
  • Android: WMBRApp/{version} (Android; SDK {version})

The version is now automatically derived from package.json instead of being hard-coded.

Verification

✅ All tests pass (29 passing tests including 4 new UserAgent tests)
✅ Linting clean (ESLint)
✅ Security check clean (CodeQL - 0 alerts)

Security Summary

No security vulnerabilities were found by CodeQL analysis. The implementation uses React Native's built-in Platform API safely and only exposes basic platform information in the user agent string, which is standard practice for HTTP requests.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add distinct user agents for iOS / Android streams</issue_title>
<issue_description>I think this would go in the Track objects in src/services/ArchiveService.ts as a userAgent prop:

https://rntp.dev/docs/api/objects/track

https://brainsandbeards.com/blog/2025-useragent-for-api-calls/</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add distinct user agents for iOS and Android streams Add platform-specific user agents for iOS/Android streams Nov 14, 2025
Copilot AI requested a review from jsit November 14, 2025 18:47
Copilot AI requested a review from jsit November 15, 2025 03:14
@jsit
Copy link
Member

jsit commented Nov 15, 2025

@copilot Fix this merge conflict please.

@jsit
Copy link
Member

jsit commented Nov 17, 2025

@copilot The tests need to be updated to either mock the package version number or use the real value.

Copy link
Member

@jsit jsit left a comment

Choose a reason for hiding this comment

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

The tests need to be updated to either mock the package version number or use the real value.

@jsit
Copy link
Member

jsit commented Nov 20, 2025

@copilot The tests need to be updated to either mock the package version number or use the real value.

jsit added 2 commits November 20, 2025 08:22
…t-to-tracks

* origin/main:
  fix: fix day grouping for early morning shows (#99) (#125)
  feat: stop playback for live, pause for archive (#30) (#106)
  chore: add path aliases (#111)
  fix: remove logo from schedule page (#118) (#119)
@jsit jsit assigned Copilot and unassigned Copilot Nov 20, 2025
@jsit
Copy link
Member

jsit commented Nov 20, 2025

@copilot The tests need to be updated to either mock the package version number or use the real value.

@jsit
Copy link
Member

jsit commented Nov 20, 2025

@copilot Please update the tests to either mock the package version number or use the real value.

@jsit
Copy link
Member

jsit commented Nov 20, 2025

@copilot The tests are now failing. The test file should either mock the version number or use the real version number.

@jsit
Copy link
Member

jsit commented Nov 20, 2025

@copilot Please update the tests to either mock the package version number or use the real value.

@jsit
Copy link
Member

jsit commented Nov 20, 2025

@copilot Try again

@jsit jsit marked this pull request as ready for review November 22, 2025 21:18
@jsit jsit requested a review from a team as a code owner November 22, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add distinct user agents for iOS / Android streams

2 participants