Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions workmanager_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.1

- **FIX**: NullPointerException on io.flutter.embedding.engine.loader.FlutterApplicationInfo.flutterAssetsDir, when App and WorkManager task triggers at the same time

## 0.9.0+2

- **FIX**: Android initialization bug and iOS 14 availability annotations (#647).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.google.common.util.concurrent.ListenableFuture
import dev.fluttercommunity.workmanager.pigeon.TaskStatus
import dev.fluttercommunity.workmanager.pigeon.WorkmanagerFlutterApi
import io.flutter.FlutterInjector
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.dart.DartExecutor
import io.flutter.embedding.engine.loader.FlutterLoader
Expand All @@ -29,8 +30,6 @@
companion object {
const val PAYLOAD_KEY = "dev.fluttercommunity.workmanager.INPUT_DATA"
const val DART_TASK_KEY = "dev.fluttercommunity.workmanager.DART_TASK"

private val flutterLoader = FlutterLoader()
}

private val payload
Expand Down Expand Up @@ -65,7 +64,7 @@
override fun startWork(): ListenableFuture<Result> {
startTime = System.currentTimeMillis()

engine = FlutterEngine(applicationContext)
val flutterLoader: FlutterLoader = FlutterInjector.instance().flutterLoader()

if (!flutterLoader.initialized()) {
flutterLoader.startInitialization(applicationContext)
Expand All @@ -76,6 +75,7 @@
null,
Handler(Looper.getMainLooper()),
) {
engine = FlutterEngine(applicationContext)
val callbackHandle = SharedPreferenceHelper.getCallbackHandle(applicationContext)
val callbackInfo = FlutterCallbackInformation.lookupCallbackInformation(callbackHandle)

Expand Down Expand Up @@ -209,7 +209,7 @@
val wasSuccessful = result.getOrNull() ?: false
stopEngine(if (wasSuccessful) Result.success() else Result.retry())
}
result.isFailure -> {

Check failure on line 212 in workmanager_android/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt

View workflow job for this annotation

GitHub Actions / format_kotlin

[ktlint] reported by reviewdog 🐶 Add a blank line between all when-conditions in case at least one multiline when-condition is found in the statement Raw Output: workmanager_android/android/src/main/kotlin/dev/fluttercommunity/workmanager/BackgroundWorker.kt:212:1: error: Add a blank line between all when-conditions in case at least one multiline when-condition is found in the statement (standard:blank-line-between-when-conditions)
val exception = result.exceptionOrNull()
// Don't call onExceptionEncountered for Dart task failures
// These are handled as normal failures via onTaskStatusUpdate
Expand Down
2 changes: 1 addition & 1 deletion workmanager_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: workmanager_android
description: Android implementation of the workmanager plugin.
version: 0.9.0+2
version: 0.9.1
# publish_to: none
homepage: https://github.com/fluttercommunity/flutter_workmanager
repository: https://github.com/fluttercommunity/flutter_workmanager
Expand Down
Loading