Skip to content

Commit 3d3974f

Browse files
enedclaude
andauthored
fix: Android initialization bug and iOS 14 availability annotations (#647)
* fix: Android initialization bug and iOS 14 availability annotations - Fix Android PlatformException on first run after initialize (fixes #645) - Update currentDispatcherHandle when initialize() is called - Add validation for callback handle - Add iOS 14.0 availability annotation to LoggingDebugHandler (fixes #641) - Prevents build errors when os.Logger is used - Update documentation with iOS 14.0 minimum deployment target requirement (fixes #639) Co-Authored-By: Claude <noreply@anthropic.com> * docs: add version management guidelines for melos workflow * chore: regenerate pigeon files after pub upgrade * fix: remove invalid handle validation that was rejecting valid callback handles The handle validation was too strict and incorrectly rejected valid callback handles (including 0) which caused all initialize calls to fail in integration tests --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 83f0f7c commit 3d3974f

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

CLAUDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## Version Management
2+
- **DO NOT manually edit CHANGELOG.md files** - Melos handles changelog generation automatically
3+
- **Use semantic commit messages** for proper versioning:
4+
- `fix:` for bug fixes (patch version bump)
5+
- `feat:` for new features (minor version bump)
6+
- `BREAKING CHANGE:` or `!` for breaking changes (major version bump)
7+
- Example: `fix: prevent iOS build errors with Logger availability`
8+
- Melos will generate changelog entries from commit messages during release
9+
110
## Pre-Commit Requirements
211
**CRITICAL**: Always run from project root before ANY commit:
312
1. `dart analyze` (check for code errors)

docs/quickstart.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ flutter pub get
2323
Android works automatically - no additional setup required! ✅
2424

2525
### iOS
26+
27+
<Warning>
28+
**iOS Minimum Deployment Target:** iOS 14.0 or later is required. Update your project's deployment target in Xcode:
29+
1. Open `ios/Runner.xcodeproj` in Xcode
30+
2. Select the Runner target
31+
3. Set "Minimum Deployments" to iOS 14.0 or later
32+
4. Or edit `ios/Runner.xcodeproj/project.pbxproj` and set `IPHONEOS_DEPLOYMENT_TARGET = 14.0;`
33+
</Warning>
34+
2635
iOS requires a 5-minute setup in Xcode. Choose your approach based on your needs:
2736

2837
#### Option A: Periodic Tasks (Recommended for most use cases)

workmanager_android/android/src/main/kotlin/dev/fluttercommunity/workmanager/WorkmanagerPlugin.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ class WorkmanagerPlugin :
4747
callback: (Result<Unit>) -> Unit,
4848
) {
4949
try {
50-
preferenceManager.saveCallbackDispatcherHandleKey(request.callbackHandle)
50+
val handle = request.callbackHandle
51+
52+
// Save to SharedPreferences
53+
preferenceManager.saveCallbackDispatcherHandleKey(handle)
54+
55+
// Update the local variable to match
56+
currentDispatcherHandle = handle
57+
5158
callback(Result.success(Unit))
5259
} catch (e: Exception) {
5360
callback(Result.failure(e))

workmanager_android/android/src/main/kotlin/dev/fluttercommunity/workmanager/pigeon/WorkmanagerApi.g.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// // Copyright 2024 The Flutter Workmanager Authors. All rights reserved.
22
// // Use of this source code is governed by a MIT-style license that can be
33
// // found in the LICENSE file.
4-
// Autogenerated from Pigeon (v26.0.0), do not edit directly.
4+
// Autogenerated from Pigeon (v26.0.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
77

workmanager_apple/ios/Sources/workmanager_apple/LoggingDebugHandler.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import os
33

44
/**
55
* A debug handler that outputs debug information to iOS's unified logging system.
6+
* Note: This class requires iOS 14.0 or later due to the use of os.Logger.
67
*/
8+
@available(iOS 14.0, *)
79
public class LoggingDebugHandler: WorkmanagerDebug {
810
private let logger = os.Logger(subsystem: "dev.fluttercommunity.workmanager", category: "debug")
911

workmanager_apple/ios/Sources/workmanager_apple/pigeon/WorkmanagerApi.g.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// // Copyright 2024 The Flutter Workmanager Authors. All rights reserved.
22
// // Use of this source code is governed by a MIT-style license that can be
33
// // found in the LICENSE file.
4-
// Autogenerated from Pigeon (v26.0.0), do not edit directly.
4+
// Autogenerated from Pigeon (v26.0.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66

77
import Foundation

workmanager_platform_interface/lib/src/pigeon/workmanager_api.g.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// // Copyright 2024 The Flutter Workmanager Authors. All rights reserved.
22
// // Use of this source code is governed by a MIT-style license that can be
33
// // found in the LICENSE file.
4-
// Autogenerated from Pigeon (v26.0.0), do not edit directly.
4+
// Autogenerated from Pigeon (v26.0.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers
77

0 commit comments

Comments
 (0)