From 5150c2ee62dba57e954a8ef436118218e0ff50cb Mon Sep 17 00:00:00 2001 From: Somethingweirdhere Date: Thu, 28 Jun 2018 23:56:39 +0200 Subject: [PATCH] This thing actually works lol --- .../local/subscription/SubscriptionFragment.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java index 4b311a852..8f02158bc 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.java @@ -73,6 +73,7 @@ import java.util.Locale; import java.util.concurrent.TimeUnit; import icepick.State; +import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.Observer; import io.reactivex.Single; @@ -406,18 +407,20 @@ public class SubscriptionFragment extends BaseStateFragment { - new LongOperation().execute(SubscriptionEntity.from(result)); + new LongOperation().execute(result); }, (@NonNull Throwable throwable) -> { }); } - private class LongOperation extends AsyncTask { + private class LongOperation extends AsyncTask { @Override - protected Void doInBackground(SubscriptionEntity... params) { - subscriptionService.subscriptionTable().delete(params[0]); + protected Void doInBackground(ChannelInfo... params) { + ChannelInfo info = params[0]; + Flowable> subscription = subscriptionService.subscriptionTable().getSubscription(info.getServiceId(), info.getUrl()); + subscriptionService.subscriptionTable().delete(subscription.blockingFirst()); return null; } }