diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd9c70a22d..e8f0d158b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ ([#3566](https://github.com/Automattic/pocket-casts-android/pull/3566)) * Fix issue causing the Account Details page to become unresponsive after viewing an offer ([#3574](https://github.com/Automattic/pocket-casts-android/pull/3574)) + * Fix crash in Android 15 with the background task manager + ([#3632](https://github.com/Automattic/pocket-casts-android/pull/3632)) * Updates * Filter out chapters that do not belong in table of contents. See [the specification](https://github.com/Podcastindex-org/podcast-namespace/blob/main/chapters/jsonChapters.md) for more details. ([#3556](https://github.com/Automattic/pocket-casts-android/pull/3556)) diff --git a/app/src/androidTest/java/au/com/shiftyjelly/pocketcasts/repositories/download/UpdateEpisodeDetailsTest.kt b/app/src/androidTest/java/au/com/shiftyjelly/pocketcasts/repositories/download/UpdateEpisodeDetailsTest.kt index e357b6de348..2988b83a2e3 100644 --- a/app/src/androidTest/java/au/com/shiftyjelly/pocketcasts/repositories/download/UpdateEpisodeDetailsTest.kt +++ b/app/src/androidTest/java/au/com/shiftyjelly/pocketcasts/repositories/download/UpdateEpisodeDetailsTest.kt @@ -60,7 +60,7 @@ class UpdateEpisodeDetailsTest { onBlocking { findByUuid(episode.uuid) }.doReturn(episode) } - val episodeUuids = listOf(episode.uuid).toTypedArray() + val episodeUuids: Array = listOf(episode.uuid).toTypedArray() val data = Data.Builder().putStringArray(UpdateEpisodeDetailsTask.INPUT_EPISODE_UUIDS, episodeUuids).build() val worker = TestListenableWorkerBuilder(context, inputData = data) .setWorkerFactory(TestWorkerFactory(episodeManager)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a68a618eeaa..7bcb3287843 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -55,7 +55,7 @@ test = "1.6.1" tracks = "6.0.3" wear-compose = "1.4.1" webkit = "1.12.1" -work = "2.9.1" +work = "2.10.0" [libraries] # About Libraries diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/download/DownloadManagerImpl.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/download/DownloadManagerImpl.kt index 3e52ceadd35..d30c636dbbe 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/download/DownloadManagerImpl.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/download/DownloadManagerImpl.kt @@ -143,7 +143,7 @@ class DownloadManagerImpl @Inject constructor( // FIXME this is a hack to avoid an issue where this listener says downloads // on the watch app are enqueued when they are actually still running. - val queriedState = workManager.getWorkInfoById(workInfo.id).get().state + val queriedState = workManager.getWorkInfoById(workInfo.id).get()?.state if (Util.isWearOs(context) && queriedState == WorkInfo.State.RUNNING) { getRequirementsAsync(episode) } else { diff --git a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/PodcastSyncProcess.kt b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/PodcastSyncProcess.kt index d209bb1a04b..c19f5986bdd 100644 --- a/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/PodcastSyncProcess.kt +++ b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/sync/PodcastSyncProcess.kt @@ -62,6 +62,7 @@ import kotlin.math.roundToInt import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import kotlinx.coroutines.rx2.rxCompletable @@ -314,7 +315,7 @@ class PodcastSyncProcess( emitter.onComplete() } else { ProcessLifecycleOwner.get().lifecycleScope.launch { - WorkManager.getInstance(context).getWorkInfoByIdFlow(workRequestId).first { it.state.isFinished } + WorkManager.getInstance(context).getWorkInfoByIdFlow(workRequestId).firstOrNull { it?.state?.isFinished ?: true } logTime("Refresh - sync up next", startTime) emitter.onComplete() }