Skip to content

refactor: replace debug mode with extensible hook-based system #630

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

Merged
merged 12 commits into from
Jul 31, 2025

Conversation

ened
Copy link
Collaborator

@ened ened commented Jul 30, 2025

Summary

  • Replace deprecated isInDebugMode with hook-based debug handlers to slim down plugin
  • Add TaskStatus.SCHEDULED and TaskStatus.RESCHEDULED for better task lifecycle visibility
  • Fix notification flow: Started → Rescheduled → Retrying → Success
  • Add configurable notification channels and grouping for debug handlers
  • Update notification icons to cleaner symbols (▶️ ✅ ❌ 🔄 ⏹️ 📅)
  • Fix Android retry detection using runAttemptCount
  • Remove duplicate exception notifications for normal task failures
  • Improve example app structure with proper Kotlin package naming and shorthand AndroidManifest syntax
  • iOS 14+ Support: Requires notification permissions for debug handlers to show notifications

Fixes #439
Fixes #367
Fixes #556

Breaking Changes

Before: isInDebugMode parameter (deprecated but still accepted)

Workmanager().initialize(callbackDispatcher, isInDebugMode: true);

After: Hook-based debug handlers

Workmanager().initialize(callbackDispatcher);
// Platform-specific debug handler setup
WorkmanagerDebug.setCurrent(NotificationDebugHandler());

Benefits for Users

  • Eliminates App Store risks: Apps won't accidentally show debug notifications to end users
  • Optional debug system: Developers only get debug functionality if they explicitly opt-in
  • Better task lifecycle visibility: Clear status progression with platform-specific capabilities
  • Configurable notifications: Custom channels and grouping for better organization

ened added 2 commits July 30, 2025 11:40
- Remove isInDebugMode parameter from initialize() method (BREAKING)
- Implement WorkmanagerDebugHandler interface for both Android and iOS
- Add LoggingDebugHandler for development (uses native logging systems)
- Add NotificationDebugHandler for visual debugging
- Support custom debug handlers for extensible debugging
- No debug output by default - opt-in via platform-specific setup
- Clean separation between core functionality and debug concerns
- Add comprehensive documentation in docs/debug.md
- Update existing debugging.mdx instead of creating new files
- Follow proper docs.page structure with frontmatter and tabs
- Remove incorrectly placed debug.md from root docs folder
Copy link

docs-page bot commented Jul 30, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/fluttercommunity/flutter_workmanager~630

Documentation is deployed and generated using docs.page.

@ened ened mentioned this pull request Jul 30, 2025
ened and others added 7 commits July 30, 2025 12:01
- Replace isInDebugMode parameter with extensible hook system
- Add WorkmanagerDebugHandler interface/protocol for Android/iOS
- Implement LoggingDebugHandler and NotificationDebugHandler
- Add WorkmanagerDebug global registry for handler management
- Remove old DebugNotificationHelper and UserDefaultsHelper debug code
- Update documentation with proper Tabs component syntax
- Clean up workmanager/README.md to avoid duplication with docs.page
- Fix all integration tests and update mocks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
… enum

- Move TaskStatus enum to Pigeon for consistent cross-platform types
- Regenerate all Pigeon-generated files with TaskStatus enum
- Update mocks to include deprecated isInDebugMode parameter
- Add backward compatibility test ensuring deprecated parameter still compiles
- Update CLAUDE.md to document code generation workflow

All tests passing and hook-based debug system is complete with:
- Abstract WorkmanagerDebug class with static current handler
- onTaskStatusUpdate and onExceptionEncountered methods
- Complete platform consistency between Android and iOS
- Backward compatibility maintained through deprecation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update iOS deployment target to 14.0 for Logger compatibility
- Fix Android TaskStatus import errors in debug handlers
- Fix iOS internal type visibility issues
- Update example app iOS deployment target in Xcode project
- Add comprehensive pre-commit requirements including example builds
- Ensure both Android APK and iOS app build successfully

All platforms now build without errors and pass formatting checks.
All GitHub Actions fixes applied and both example builds working:
- iOS 14.0 deployment target set across all components
- Android TaskStatus imports resolved
- iOS internal type visibility fixed
- Comprehensive pre-commit requirements documented
- Both Android APK and iOS app build successfully

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Simplify changelog language to focus on user actions needed
- Remove internal implementation details (Flow observability, Pigeon updates)
- Add clear explanation for KEEP -> UPDATE default change
- Maintain consistent format across all package changelogs
- Keep only user-impacting information and migration guidance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
The ignore comment needs to be on the line where the deprecated parameter
is actually used, not above the return statement.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ened ened force-pushed the refactor/hook-based-debug-approach branch from e707f26 to 248802a Compare July 31, 2025 15:32
… notifications

- Replace deprecated isInDebugMode with hook-based debug handlers to slim down plugin
- Add TaskStatus.SCHEDULED and TaskStatus.RESCHEDULED for better task lifecycle visibility
- Fix notification flow: Started → Rescheduled → Retrying → Success
- Add configurable notification channels and grouping for debug handlers
- Update notification icons to cleaner symbols (▶️ ✅ ❌ 🔄 ⏹️ 📅)
- Add comprehensive task status documentation with platform differences
- Fix Android retry detection using runAttemptCount
- Remove duplicate exception notifications for normal task failures
- Update example apps to demonstrate new debug configuration

Fixes #439
Fixes #367
Fixes #556

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ened ened force-pushed the refactor/hook-based-debug-approach branch from 248802a to 72a86a3 Compare July 31, 2025 15:34
ened and others added 2 commits July 31, 2025 16:50
- Fix Kotlin package naming to follow conventions (dev.fluttercommunity.workmanager.example)
- Use shorthand dot notation in AndroidManifest.xml for cleaner configuration
- Apply ktlint and swiftlint formatting fixes across all platforms
- Remove trailing whitespace from Swift files

🤖 Generated with Claude Code

Co-Authored-By: Claude <[email protected]>
- Add new features: NotificationDebugHandler, LoggingDebugHandler, TaskStatus enums
- Document breaking changes for isInDebugMode deprecation
- Include bug fixes for retry detection and periodic task frequency
- Focus on user-facing changes and benefits

🤖 Generated with Claude Code

Co-Authored-By: Claude <[email protected]>
@ened ened merged commit a63621f into main Jul 31, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant