Skip to content

Gate radio station features behind API v7.13.0#168

Merged
phanan merged 1 commit into
masterfrom
feat/radio-version-gate
Apr 7, 2026
Merged

Gate radio station features behind API v7.13.0#168
phanan merged 1 commit into
masterfrom
feat/radio-version-gate

Conversation

@phanan
Copy link
Copy Markdown
Member

@phanan phanan commented Apr 7, 2026

Summary

  • Radio stations are only available since Koel v7.13.0
  • Added Feature.radioStations to the existing feature flag system (same pattern as podcasts)
  • Library menu item and search results section are now hidden for older API versions
  • The search provider already handles missing radio_stations key gracefully

Test plan

  • Unit tests for Feature.radioStations.isSupported() with various API versions
  • Verified radio items hidden when API version < 7.13.0
  • Verified radio items shown when API version >= 7.13.0

Summary by CodeRabbit

  • Bug Fixes

    • Radio stations section now only displays when supported by the server version, preventing display of unavailable features across different platform instances.
  • Tests

    • Added test coverage for feature support detection logic to ensure proper functionality across varying server versions.

Radio stations are only available since Koel v7.13.0. Hide the library
menu item and search results section for older API versions.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

This change adds conditional feature support for radio stations, gating UI rendering based on API version compatibility. A new Feature.radioStations enum value with minimum API version 7.13.0 is introduced, and the Radio menu item and search section now render only when the feature is supported. Comprehensive test coverage validates the feature support detection logic.

Changes

Cohort / File(s) Summary
Feature Definition
lib/utils/features.dart, test/utils/features_test.dart
Added Feature.radioStations enum value with API version 7.13.0 support mapping. New test file validates feature support logic across multiple API versions for both radio stations and podcasts.
Conditional UI Rendering
lib/ui/screens/library.dart, lib/ui/screens/search.dart
Wrapped Radio menu item and Radio Stations search section with Feature.radioStations.isSupported() conditionals to prevent rendering on unsupported API versions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Hops through version gates with glee,
Radio stations now conditionally free,
7.13 and up shall play,
Older APIs find their own way! ✨📻

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: gating radio station features behind API v7.13.0, which is the primary objective across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/radio-version-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
lib/ui/screens/library.dart (1)

75-81: Add a route/screen-level guard for radio support too.

This menu gate is good, but RadioStationsScreen can still fetch on direct navigation. Consider guarding in lib/ui/screens/radio_stations.dart as well to prevent unsupported API calls outside this menu path.

Proposed hardening patch (radio_stations.dart)
+import 'package:app/utils/features.dart';

 class _RadioStationsScreenState extends State<RadioStationsScreen> {
   var _loading = false;
+  bool get _supported => Feature.radioStations.isSupported();

   `@override`
   void initState() {
     super.initState();
-    _fetchData();
+    if (_supported) _fetchData();
   }

   Future<void> _fetchData() async {
+    if (!_supported) return;
     if (_loading) return;
     setState(() => _loading = true);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/ui/screens/library.dart` around lines 75 - 81, Add a screen-level guard
inside RadioStationsScreen (e.g., in its initState and/or build) to check
Feature.radioStations.isSupported() and prevent any fetch or API calls when
unsupported: if unsupported, immediately navigate back or render a
fallback/unsupported widget instead of proceeding, and ensure methods that call
the API (e.g., fetchRadioStations / any network calls triggered from initState
or didChangeDependencies) early-return when the feature is not supported so no
unsupported API requests are made.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/ui/screens/library.dart`:
- Around line 75-81: Add a screen-level guard inside RadioStationsScreen (e.g.,
in its initState and/or build) to check Feature.radioStations.isSupported() and
prevent any fetch or API calls when unsupported: if unsupported, immediately
navigate back or render a fallback/unsupported widget instead of proceeding, and
ensure methods that call the API (e.g., fetchRadioStations / any network calls
triggered from initState or didChangeDependencies) early-return when the feature
is not supported so no unsupported API requests are made.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 97caadd2-b6ad-49e1-a997-ade6f30183a3

📥 Commits

Reviewing files that changed from the base of the PR and between 68ce9fe and 6ee3b71.

📒 Files selected for processing (4)
  • lib/ui/screens/library.dart
  • lib/ui/screens/search.dart
  • lib/utils/features.dart
  • test/utils/features_test.dart

@phanan phanan merged commit 1f4d548 into master Apr 7, 2026
2 checks passed
@phanan phanan deleted the feat/radio-version-gate branch April 7, 2026 19:27
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.

1 participant