chore(samples): migrate from flutter_app_badger to app_badge_plus - #2836
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe sample app replaces ChangesApp badge provider replacement
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@sample_app/pubspec.yaml`:
- Line 23: Remove the stale flutter_app_badger.framework references from the iOS
project configuration associated with the sample app, including its build-phase
and framework-link entries, after the dependency change represented by
app_badge_plus. Regenerate the native project if appropriate, then validate that
a clean iOS build succeeds without missing-framework errors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b92e6fcb-e48f-4fbc-a074-f08e00a0f595
📒 Files selected for processing (3)
melos.yamlsample_app/lib/pages/channel_list_page.dartsample_app/pubspec.yaml
| flutter: ">=3.41.0" | ||
|
|
||
| dependencies: | ||
| app_badge_plus: ^1.3.2 |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Remove the stale flutter_app_badger native references.
sample_app/ios/Runner.xcodeproj/project.pbxproj still links flutter_app_badger.framework at lines 292 and 339. After removing this dependency, those entries can cause iOS builds to fail with a missing framework. Remove or regenerate the native references and validate a clean iOS build.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@sample_app/pubspec.yaml` at line 23, Remove the stale
flutter_app_badger.framework references from the iOS project configuration
associated with the sample app, including its build-phase and framework-link
entries, after the dependency change represented by app_badge_plus. Regenerate
the native project if appropriate, then validate that a clean iOS build succeeds
without missing-framework errors.
flutter_app_badger is unmaintained and pod-only. app_badge_plus is a maintained drop-in replacement that ships Swift Package Manager support for iOS and macOS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5245204 to
2441fed
Compare
app_badge_plus only implements Android, iOS, and macOS, so restrict the badge listener to those platforms instead of running on any non-web platform (which would fail on Windows/Linux). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the badge platform guard into an `isAppBadgeSupported` getter and rename `firebase_support.dart` to `platform_support.dart`, since the file now holds platform-capability flags beyond Firebase. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collapse the count>0 / else branch into a single `updateBadge` call clamped at zero. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1a8f5f8 to
a788f4e
Compare
Fixes FLU-623
Summary
Migrates the sample app's badge handling from the unmaintained, pod-only
flutter_app_badgertoapp_badge_plus(^1.3.2).flutter_app_badgerdoes not support Swift Package Manager (FLU-623).app_badge_plusis a maintained drop-in replacement that ships SPM support (Package.swiftfor both iOS and macOS), aligning with the ongoing SPM migration effort. After the swap,flutter pub getconfirms it no longer appears in Flutter's "plugins that do not support SPM" warning list.Changes
Dependency swap
melos.yaml/sample_app/pubspec.yaml—flutter_app_badger: ^1.5.0→app_badge_plus: ^1.3.2API update (
channel_list_page.dart)FlutterAppBadger.updateBadgeCount(count)/removeBadge()→AppBadgePlus.updateBadge(math.max(0, count))Platform guard — extracted into an
isAppBadgeSupportedgetter inplatform_support.dart(renamed fromfirebase_support.dart, since it now holds platform-capability flags beyond Firebase).app_badge_plusonly implements Android, iOS, and macOS.Notes
app_badge_plus's own plugin manifest and merged in automatically by the Android manifest merger — no manual declaration required. (This differs fromflutter_app_badger, whose permissions came transitively from the bundled ShortcutBadger AAR.)UIBackgroundModes/remote-notificationinInfo.plistis retained — required byfirebase_messaging, not the badge plugin.app_badge_plusneeds before setting a badge) is already handled viaFirebaseMessaging.instance.requestPermission();POST_NOTIFICATIONSmerges in transitively viafirebase_messaging.Testing
flutter pub getinsample_appresolves cleanly (flutter_app_badgerdropped,app_badge_plusadded).UNUserNotificationCenter.setBadgeCountpersistence on the simulator is unreliable — verify numeric badges on a physical device.🤖 Generated with Claude Code