Commit 5d05619
refactor: Migrate internal interfaces to pigeon (#613)
* feat: Complete Pigeon migration for workmanager_platform_interface
- Move all enum definitions (NetworkType, BackoffPolicy, etc.) to Pigeon for type-safe communication
- Replace duplicate Constraints class with Pigeon-generated version while maintaining API compatibility
- Remove unused enums.dart and options.dart files
- Add centralized Melos task for Pigeon code generation
- Configure Pigeon for Kotlin/Swift only (no C++/Objective-C generation)
- Fix null safety issues across platform implementations
- All packages pass comprehensive dart analyze
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: Complete Android Pigeon migration for workmanager_android
- Replace MethodChannel with type-safe Pigeon WorkmanagerHostApi in WorkmanagerPlugin
- Update Pigeon configuration to generate directly in workmanager_android and workmanager_apple packages
- Remove manual data extraction and parsing from Extractor.kt and WorkmanagerCallHandler.kt (300+ lines eliminated)
- Extract essential WorkManager utilities to WorkManagerUtils.kt for clean separation
- Add extension functions to convert Pigeon types to Android WorkManager types
- Maintain full API compatibility while gaining type safety
- Build and analysis pass successfully
Benefits:
- Type-safe communication between Dart and Kotlin
- Eliminates manual data wrangling and method channel boilerplate
- Better error handling and validation
- Cleaner separation of concerns
- Reduced maintenance burden
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: Convert WM object to instantiable WorkManagerWrapper class
- Replace static WM object with WorkManagerWrapper class that takes context as constructor parameter
- Create WorkManagerWrapper instance when plugin is attached to engine, destroy when detached
- Eliminate context parameter passing throughout all method calls
- Improve separation of concerns and lifecycle management
- Remove unused helper function
- All methods now use clean instance-based API without context wrangling
Benefits:
- Better lifecycle management with proper cleanup
- Cleaner API without context parameter passing
- Improved encapsulation and object-oriented design
- Thread-safe WorkManager instance management
- Reduced boilerplate code
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: Remove unnecessary null checks in Pigeon host API handlers
- Remove all "plugin not attached" null checks since Pigeon guarantees host API handlers are not called when plugin is detached
- Use non-null assertion (\!\!) for workManagerWrapper since Pigeon manages lifecycle correctly
- Simplify all method implementations by removing redundant error handling
- Reduce boilerplate code and improve readability
Benefits:
- Cleaner code without unnecessary defensive programming
- Trust Pigeon's lifecycle management guarantees
- Reduced complexity and maintenance burden
- Better performance without redundant checks
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(android): simplify WorkManagerWrapper to accept Pigeon request objects directly
- Update WorkManagerWrapper.enqueueOneOffTask and enqueuePeriodicTask to accept Pigeon request objects instead of individual parameters
- Remove duplicate extension functions from WorkmanagerPlugin.kt (now in WorkManagerUtils.kt)
- Improve context lifecycle management with proper null handling
- Add documentation about Pigeon's guarantee that handlers aren't called when plugin is detached
- Eliminate 300+ lines of manual parameter extraction code
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(android): remove unnecessary BackoffPolicyTaskConfig class
- Eliminate intermediate BackoffPolicyTaskConfig class that only added complexity
- Directly use Pigeon BackoffPolicyConfig values in WorkManager calls
- Remove unused kotlin.math.max import
- Simplify backoff criteria handling with inline conversion
Reduces code complexity while maintaining the same functionality.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(android): add API version checks and improve code formatting
- Add API level checks for requiresDeviceIdle (API 23+) and TEMPORARILY_UNMETERED (API 30+)
- Improve code formatting and readability
- Add proper fallback for TEMPORARILY_UNMETERED on older APIs
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(apple): migrate iOS to Pigeon with pure Swift implementation
- Replace SwiftWorkmanagerPlugin with Pigeon-based implementation
- Remove unnecessary Objective-C .h/.m files - modern Flutter plugins only need Swift
- Implement WorkmanagerHostApi protocol for type-safe communication
- Add proper Flutter imports to all Swift files to resolve compilation issues
- Remove conflicting NetworkType.swift (replaced by Pigeon-generated types)
- Update podspec to remove header file references
- Fix class inheritance and method override issues
iOS plugin now uses Pigeon end-to-end, matching Android implementation.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(apple): optimize iOS plugin code quality and reduce repetition
- Add generic executeIfSupported and executeIfSupportedVoid helper methods
- Create createUnsupportedVersionError helper for consistent error handling
- Add createBackgroundOperation helper to eliminate duplicate operation setup
- Refactor all API methods to use helper functions, reducing code duplication
- Simplify network requirements logic in registerProcessingTask
- Remove repetitive iOS 13+ availability checks and error creation
- Improve code readability while maintaining identical functionality
Reduces ~100 lines of repetitive code while improving maintainability.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(apple): complete iOS Dart layer migration to Pigeon
- Replace MethodChannel with WorkmanagerHostApi in workmanager_apple.dart
- Migrate all API calls to use Pigeon request objects
- Remove flutter/services.dart dependency as it's no longer needed
- Maintain full feature parity with previous MethodChannel implementation
- Add proper support for all constraints and parameters
This completes the Pigeon migration for the iOS platform, bringing:
- Type-safe communication between Dart and Swift
- Automatic serialization/deserialization
- Better error handling and debugging
- Consistent API across Android and iOS platforms
* feat: migrate background channel communication to Pigeon across all platforms
- Replace MethodChannel with WorkmanagerFlutterApi for background task execution
- Update main Dart implementation to use Pigeon WorkmanagerFlutterApi
- Migrate Android BackgroundWorker to use Pigeon API calls
- Migrate iOS BackgroundWorker to use Pigeon API calls
- Remove all MethodChannel dependencies from background communication
- Maintain backward compatibility with existing background task handlers
This completes the full Pigeon migration for both foreground and background
communication channels, providing type-safe, cross-platform messaging.
* fix: compilation errors in iOS and Android after Pigeon migration
- Fix Swift compilation error in iOS BackgroundWorker by replacing non-existent mapKeys with proper Dictionary conversion
- Add missing getCallbackHandle static method to Android SharedPreferenceHelper
- Verify both iOS and Android builds compile successfully
* fix: resolve linter and test issues after Pigeon migration
- Fix ktlint issues in Kotlin files (trailing spaces, line length, naming conventions)
- Add .editorconfig to exclude Pigeon-generated files from linting
- Remove unused import in Android test file
- Simplify unit tests with TODOs for proper Pigeon mocking
- Ensure all linters pass: ktlint, dart format, flutter analyze
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: clean up formatting and prepare for unit test implementation
- Run ktlint, dart format, and SwiftLint across all code
- Fix iOS native test by removing obsolete NetworkType test
- Move .editorconfig to root and configure to ignore Pigeon files
- Add .swiftlint.yml to exclude Pigeon-generated files
- Update CLAUDE.md with Pigeon and GitHub Actions documentation
- Remove old CLAUDE.md files from individual packages
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: complete comprehensive unit tests and finalize Pigeon migration
- Refactor unit tests to focus on platform-specific business logic rather than Pigeon internals
- Add comprehensive test coverage for Android WorkManager and iOS BGTaskScheduler differences
- Test enum mappings, constraints validation, input handling, and edge cases
- Remove obsolete native test files (ExtractorTests.kt)
- Fix iOS native test placeholder after NetworkType migration
- Update CLAUDE.md with testing strategy, preferences, and migration status
- Verify all tests pass: Dart unit tests (39 total), native Android tests, native iOS tests
- Confirm example app builds successfully for both Android APK and iOS
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve CI formatting and analysis issues
- Add formatter.exclude patterns in analysis_options.yml to prevent formatting of .g.dart files
- Add analyzer.exclude for all generated files (.g.dart, .g.kt, .g.swift)
- Commit all remaining changes to resolve package-analysis CI failures
- Update CLAUDE.md with GitHub Actions troubleshooting information
- Fix dart format touching Pigeon-generated files during CI
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: remove non-Dart files from analysis_options.yml
- Remove .g.kt and .g.swift patterns from analyzer.exclude
- analysis_options.yml should only contain Dart-specific exclusions
- Kotlin and Swift file exclusions are handled by ktlint and SwiftLint respectively
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: regenerate Pigeon files with melos and update documentation
- Regenerate Pigeon files using `melos run generate:pigeon`
- Update CLAUDE.md to recommend using melos for Pigeon regeneration
- Document that generated files may have different formatting than dart format
- Note that formatting differences are expected and handled by exclusion patterns
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve dart format CI and iOS integration test issues
- Fix dart format CI workflow to exclude .g.dart files using find command
- Fix iOS isScheduledByUniqueName to throw UnsupportedError (Android-only feature)
- Add unit test for iOS isScheduledByUniqueName UnsupportedError behavior
- Document dart format exclusion research and solutions in global CLAUDE.md
- Update project CLAUDE.md with format workflow solution
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: improve SharedPreferenceHelper callback handling and add comprehensive tests
- Modified SharedPreferenceHelper to call callback immediately on init when preferences are already loaded
- Added comprehensive unit tests for SharedPreferenceHelper covering all callback scenarios
- Updated Android build.gradle with compatible Mockito versions for testing
- Fixed example app error handling for Workmanager initialization
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: format Kotlin test file with ktlint and update CLAUDE.md reminder
- Ran ktlint -F on SharedPreferenceHelperTest.kt to fix formatting
- Added critical reminder to CLAUDE.md to always run ktlint after Kotlin changes
- Ensures consistent formatting before commits
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: build issues on ios
* revert: simplify iOS Info.plist configuration to fix CI build issues
- Reverted from configuration-specific Info-Debug.plist/Info-Release.plist back to single Info.plist
- Kept NSBonjourServices and NSLocalNetworkUsageDescription for debugging support
- Added version field to pubspec.yaml to fix CFBundleShortVersionString warnings
- Fixes rsync.samba sandbox errors and Target Device Version parsing issues in CI
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: modernize iOS CI to use latest iPhone 16 simulators
- Updated native iOS tests to use iPhone 16 instead of iPhone 15
- Updated drive_ios integration tests to use iPhone 16 Pro instead of iPhone 15 Pro
- Should resolve SDK version and device compatibility issues in CI
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: add iOS environment setup to examples workflow
- Add explicit Xcode developer path setup for example_ios job
- Add iOS SDK version verification
- Add flutter clean and pub get before build to prevent sandbox issues
- Should resolve "rsync.samba sandbox" and "Failed to parse Target Device Version" errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Revert "fix: add iOS environment setup to examples workflow"
This reverts commit 7b359a7.
* fix: resolve iOS CI sandbox errors by disabling User Script Sandboxing
- Set ENABLE_USER_SCRIPT_SANDBOXING = NO in all iOS build configurations
- This fixes "Sandbox: rsync.samba deny file-write-create" errors in CI
- Update macOS runners from macos-latest to macos-13 for better stability
- Resolves "Failed to parse Target Device Version" and sandbox permission issues
Reference: flutter/flutter#128739
Reference: CocoaPods/Xcodeproj#989
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* revert: keep macOS runners as macos-latest
- Revert macOS runners back to macos-latest from macos-13
- The main fix is ENABLE_USER_SCRIPT_SANDBOXING = NO, not the macOS version
- Keep using latest macOS runners for best compatibility
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: update CHANGELOG.md files with Future release improvements
- Add SharedPreferenceHelper callback improvements to workmanager_android CHANGELOG
- Add iOS configuration and CI fixes to workmanager CHANGELOG
- Document CHANGELOG management approach in CLAUDE.md using "Future" header
- Keep entries concise and focused on user-facing impact
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: simplify CHANGELOG entries to focus on user-facing changes
- Remove internal CI/CD and example app details from CHANGELOG
- Keep only user-facing SharedPreferenceHelper improvement in workmanager_android
- Summarize internal improvements in one line for workmanager
- Focus on what matters to package users, not development infrastructure
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b45313b commit 5d05619
File tree
55 files changed
+5726
-2161
lines changed- .github/workflows
- example
- ios
- Runner.xcodeproj
- RunnerTests
- Runner
- lib
- workmanager_android
- android
- src
- main/kotlin/dev/fluttercommunity/workmanager
- pigeon
- test/kotlin/dev/fluttercommunity/workmanager
- lib
- test
- workmanager_apple
- ios
- Classes
- pigeon
- lib
- test
- workmanager_platform_interface
- android/src/main/kotlin/dev/fluttercommunity/workmanager/pigeon
- ios/Classes/pigeon
- lib
- src
- pigeon
- pigeons
- workmanager
- lib/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
55 files changed
+5726
-2161
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
33 | 42 | | |
34 | | - | |
| 43 | + | |
35 | 44 | | |
36 | | - | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| |||
57 | 66 | | |
58 | 67 | | |
59 | 68 | | |
60 | | - | |
| 69 | + | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
413 | 427 | | |
414 | 428 | | |
415 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
| 9 | + | |
| 10 | + | |
5 | 11 | | |
6 | 12 | | |
7 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | 186 | | |
188 | 187 | | |
189 | 188 | | |
| |||
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
| 228 | + | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
| |||
284 | 283 | | |
285 | 284 | | |
286 | 285 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 286 | | |
305 | 287 | | |
306 | 288 | | |
| |||
502 | 484 | | |
503 | 485 | | |
504 | 486 | | |
| 487 | + | |
505 | 488 | | |
506 | 489 | | |
507 | 490 | | |
| |||
524 | 507 | | |
525 | 508 | | |
526 | 509 | | |
| 510 | + | |
| 511 | + | |
527 | 512 | | |
528 | | - | |
| 513 | + | |
529 | 514 | | |
530 | 515 | | |
531 | 516 | | |
| |||
542 | 527 | | |
543 | 528 | | |
544 | 529 | | |
| 530 | + | |
545 | 531 | | |
546 | 532 | | |
547 | 533 | | |
| |||
583 | 569 | | |
584 | 570 | | |
585 | 571 | | |
| 572 | + | |
586 | 573 | | |
587 | 574 | | |
588 | 575 | | |
| |||
640 | 627 | | |
641 | 628 | | |
642 | 629 | | |
| 630 | + | |
643 | 631 | | |
644 | 632 | | |
645 | 633 | | |
| |||
651 | 639 | | |
652 | 640 | | |
653 | 641 | | |
| 642 | + | |
654 | 643 | | |
655 | 644 | | |
656 | 645 | | |
| |||
664 | 653 | | |
665 | 654 | | |
666 | 655 | | |
| 656 | + | |
| 657 | + | |
667 | 658 | | |
668 | | - | |
| 659 | + | |
669 | 660 | | |
670 | 661 | | |
671 | 662 | | |
| |||
682 | 673 | | |
683 | 674 | | |
684 | 675 | | |
| 676 | + | |
685 | 677 | | |
686 | 678 | | |
687 | 679 | | |
| |||
696 | 688 | | |
697 | 689 | | |
698 | 690 | | |
| 691 | + | |
| 692 | + | |
699 | 693 | | |
700 | | - | |
| 694 | + | |
701 | 695 | | |
702 | 696 | | |
703 | 697 | | |
| |||
714 | 708 | | |
715 | 709 | | |
716 | 710 | | |
| 711 | + | |
717 | 712 | | |
718 | 713 | | |
719 | 714 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments