-
Notifications
You must be signed in to change notification settings - Fork 223
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
Fix: Disabled global Auto download new episodes setting overrides podcast specifc one #3342
Conversation
…when opening auto download screen
viewModel.countPodcastsAutoDownloading() | ||
.map { it > 0 } | ||
.subscribeBy( | ||
onError = { Timber.e(it) }, | ||
onSuccess = { on -> | ||
onNewEpisodesToggleChange(on.toAutoDownloadStatus()) | ||
newEpisodesPreference?.isChecked = on | ||
}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put this code back to fix this issue. https://github.com/Automattic/pocket-casts-android/pull/3020/files
📲 You can test the changes from this Pull Request in 📱 Mobile by scanning the QR code below to install the corresponding build.
📲 You can test the changes from this Pull Request in 🚗 Automotive by scanning the QR code below to install the corresponding build.
📲 You can test the changes from this Pull Request in ⌚ Wear by scanning the QR code below to install the corresponding build.
|
fun countPodcastsAutoDownloading(): Single<Int> = podcastManager.countDownloadStatusRxSingle(Podcast.AUTO_DOWNLOAD_NEW_EPISODES) | ||
.subscribeOn(Schedulers.io()) | ||
|
||
fun countPodcasts(): Single<Int> = podcastManager.countSubscribedRxSingle() | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribeOn(Schedulers.io()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor refactor. Moved from fragment to viewmodel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
App crashes when I execute this test:
- Navigate to the Profile tab.
- Open Settings.
- Go to the Auto Download section.
- Ensure the New Episodes toggle is off.
- Navigate to the settings of any followed podcast.
- Disable the Auto Download setting.
- Tap on the Podcasts tab.
- Select any podcast.
- Open its settings.
- Enable the Auto Download setting.
- Navigate to the Profile tab.
- 💥
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView{626f1d9 VFED.V... ......ID 0,0-1080,1915 #7f0a04b4 app:id/recycler_view}, adapter:androidx.preference.PreferenceGroupAdapter@82d989f, layout:androidx.recyclerview.widget.LinearLayoutManager@5703faa, context:dagger.hilt.android.internal.managers.ViewComponentManager$FragmentContextWrapper@83664c3
at androidx.recyclerview.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:3482)
at androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java:6071)
at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:13219)
at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java:8136)
at androidx.preference.PreferenceGroupAdapter.onPreferenceChange(PreferenceGroupAdapter.java:354)
at androidx.preference.Preference.notifyChanged(Preference.java:1294)
at androidx.preference.TwoStatePreference.setChecked(TwoStatePreference.java:99)
at au.com.shiftyjelly.pocketcasts.settings.AutoDownloadSettingsFragment.setupNewEpisodesToggleStatusCheck$lambda$33(AutoDownloadSettingsFragment.kt:425)
at au.com.shiftyjelly.pocketcasts.settings.AutoDownloadSettingsFragment.$r8$lambda$U6792c7lbcG7qUaEN7BLPQFH6fM(Unknown Source:0)
at au.com.shiftyjelly.pocketcasts.settings.AutoDownloadSettingsFragment$$ExternalSyntheticLambda11.invoke(D8$$SyntheticClass:0)
at io.reactivex.rxkotlin.SubscribersKt$sam$io_reactivex_functions_Consumer$0.accept(Unknown Source:2)
at io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onSuccess(SingleSubscribeOn.java:68)
at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:56)
at io.reactivex.Single.subscribe(Single.java:3666)
at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:608)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
…download toggle enabled
@MiSikora I've fixed this issue and tested using a real device this time. For some reason, I could not reproduce this issue you found using the emulator, which does not make any sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. Would you mind adding a bug fix entry to the changelog?
For some reason, I could not reproduce this issue you found using the emulator, which does not make any sense.
I don't understand it as well. It crashes when I test it on an emulator when I test with the previous commit.
@MiSikora I bet I am have some super weird cash problem in my Android Studio. It's not the first time this happens. When you described these steps, I followed it and I could not reproduce, I repeated again and could not reproduce either. So I moved to other task that I had to use the real emulator. After that, I tried to reproduce this issue with the real device that I was using and finally I could reproduce the issue |
Description
Fixes #3338
Testing Instructions
Auto download new episodes
setting overrides podcast specifc one #3338 to make sure the issue was fixedScreenshots or Screencast
Screen_recording_20241209_130121.webm
Checklist
./gradlew spotlessApply
to automatically apply formatting/linting)I have considered whether it makes sense to add tests for my changesmodules/services/localization/src/main/res/values/strings.xml
Any jetpack compose components I added or changed are covered by compose previews