182 lines
9.5 KiB
Java
182 lines
9.5 KiB
Java
|
package com.discord.stores;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import com.discord.api.channel.Channel;
|
||
|
import com.discord.api.thread.ThreadListing;
|
||
|
import com.discord.restapi.utils.RetryWithDelay;
|
||
|
import com.discord.stores.ArchivedThreadsStore;
|
||
|
import com.discord.utilities.error.Error;
|
||
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
||
|
import d0.t.n;
|
||
|
import d0.t.u;
|
||
|
import d0.z.d.m;
|
||
|
import d0.z.d.o;
|
||
|
import java.util.Collection;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import kotlin.Pair;
|
||
|
import kotlin.Unit;
|
||
|
import kotlin.jvm.functions.Function0;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import rx.Subscription;
|
||
|
/* compiled from: ArchivedThreadsStore.kt */
|
||
|
public final class ArchivedThreadsStore$fetchListing$1 extends o implements Function0<Unit> {
|
||
|
public final /* synthetic */ long $channelId;
|
||
|
public final /* synthetic */ boolean $reload;
|
||
|
public final /* synthetic */ ArchivedThreadsStore.ThreadListingType $threadListingType;
|
||
|
public final /* synthetic */ ArchivedThreadsStore this$0;
|
||
|
|
||
|
/* compiled from: ArchivedThreadsStore.kt */
|
||
|
/* renamed from: com.discord.stores.ArchivedThreadsStore$fetchListing$1$1 reason: invalid class name */
|
||
|
public static final class AnonymousClass1 extends o implements Function1<Subscription, Unit> {
|
||
|
public final /* synthetic */ Pair $key;
|
||
|
public final /* synthetic */ ArchivedThreadsStore$fetchListing$1 this$0;
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass1(ArchivedThreadsStore$fetchListing$1 archivedThreadsStore$fetchListing$1, Pair pair) {
|
||
|
super(1);
|
||
|
this.this$0 = archivedThreadsStore$fetchListing$1;
|
||
|
this.$key = pair;
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Unit invoke(Subscription subscription) {
|
||
|
invoke(subscription);
|
||
|
return Unit.a;
|
||
|
}
|
||
|
|
||
|
public final void invoke(Subscription subscription) {
|
||
|
m.checkNotNullParameter(subscription, "subscription");
|
||
|
ArchivedThreadsStore.access$getFetchSubscriptions$p(this.this$0.this$0).put(this.$key, subscription);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: ArchivedThreadsStore.kt */
|
||
|
/* renamed from: com.discord.stores.ArchivedThreadsStore$fetchListing$1$2 reason: invalid class name */
|
||
|
public static final class AnonymousClass2 extends o implements Function1<Error, Unit> {
|
||
|
public final /* synthetic */ Pair $key;
|
||
|
public final /* synthetic */ ArchivedThreadsStore$fetchListing$1 this$0;
|
||
|
|
||
|
/* compiled from: ArchivedThreadsStore.kt */
|
||
|
/* renamed from: com.discord.stores.ArchivedThreadsStore$fetchListing$1$2$1 reason: invalid class name */
|
||
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
||
|
public final /* synthetic */ AnonymousClass2 this$0;
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass1(AnonymousClass2 r1) {
|
||
|
super(0);
|
||
|
this.this$0 = r1;
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function0
|
||
|
/* renamed from: invoke */
|
||
|
public final void mo1invoke() {
|
||
|
ArchivedThreadsStore.access$getListings$p(this.this$0.this$0.this$0).put(this.this$0.$key, ArchivedThreadsStore.ThreadListingState.Error.INSTANCE);
|
||
|
this.this$0.this$0.this$0.markChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass2(ArchivedThreadsStore$fetchListing$1 archivedThreadsStore$fetchListing$1, Pair pair) {
|
||
|
super(1);
|
||
|
this.this$0 = archivedThreadsStore$fetchListing$1;
|
||
|
this.$key = pair;
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Unit invoke(Error error) {
|
||
|
invoke(error);
|
||
|
return Unit.a;
|
||
|
}
|
||
|
|
||
|
public final void invoke(Error error) {
|
||
|
m.checkNotNullParameter(error, "it");
|
||
|
ArchivedThreadsStore.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass1(this));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: ArchivedThreadsStore.kt */
|
||
|
/* renamed from: com.discord.stores.ArchivedThreadsStore$fetchListing$1$3 reason: invalid class name */
|
||
|
public static final class AnonymousClass3 extends o implements Function1<ThreadListing, Unit> {
|
||
|
public final /* synthetic */ List $currentThreads;
|
||
|
public final /* synthetic */ Pair $key;
|
||
|
public final /* synthetic */ ArchivedThreadsStore$fetchListing$1 this$0;
|
||
|
|
||
|
/* compiled from: ArchivedThreadsStore.kt */
|
||
|
/* renamed from: com.discord.stores.ArchivedThreadsStore$fetchListing$1$3$1 reason: invalid class name */
|
||
|
public static final class AnonymousClass1 extends o implements Function0<Unit> {
|
||
|
public final /* synthetic */ ThreadListing $result;
|
||
|
public final /* synthetic */ AnonymousClass3 this$0;
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass1(AnonymousClass3 r1, ThreadListing threadListing) {
|
||
|
super(0);
|
||
|
this.this$0 = r1;
|
||
|
this.$result = threadListing;
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function0
|
||
|
/* renamed from: invoke */
|
||
|
public final void mo1invoke() {
|
||
|
for (Channel channel : this.$result.b()) {
|
||
|
ArchivedThreadsStore.access$getStoreStream$p(this.this$0.this$0.this$0).handleThreadCreateOrUpdate(channel);
|
||
|
}
|
||
|
Map access$getListings$p = ArchivedThreadsStore.access$getListings$p(this.this$0.this$0.this$0);
|
||
|
AnonymousClass3 r1 = this.this$0;
|
||
|
access$getListings$p.put(r1.$key, new ArchivedThreadsStore.ThreadListingState.Listing(u.plus((Collection) r1.$currentThreads, (Iterable) this.$result.b()), this.$result.a(), false));
|
||
|
this.this$0.this$0.this$0.markChanged();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public AnonymousClass3(ArchivedThreadsStore$fetchListing$1 archivedThreadsStore$fetchListing$1, Pair pair, List list) {
|
||
|
super(1);
|
||
|
this.this$0 = archivedThreadsStore$fetchListing$1;
|
||
|
this.$key = pair;
|
||
|
this.$currentThreads = list;
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Unit invoke(ThreadListing threadListing) {
|
||
|
invoke(threadListing);
|
||
|
return Unit.a;
|
||
|
}
|
||
|
|
||
|
public final void invoke(ThreadListing threadListing) {
|
||
|
m.checkNotNullParameter(threadListing, "result");
|
||
|
ArchivedThreadsStore.access$getDispatcher$p(this.this$0.this$0).schedule(new AnonymousClass1(this, threadListing));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
||
|
public ArchivedThreadsStore$fetchListing$1(ArchivedThreadsStore archivedThreadsStore, long j, ArchivedThreadsStore.ThreadListingType threadListingType, boolean z2) {
|
||
|
super(0);
|
||
|
this.this$0 = archivedThreadsStore;
|
||
|
this.$channelId = j;
|
||
|
this.$threadListingType = threadListingType;
|
||
|
this.$reload = z2;
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function0
|
||
|
/* renamed from: invoke */
|
||
|
public final void mo1invoke() {
|
||
|
Pair pair = new Pair(Long.valueOf(this.$channelId), this.$threadListingType);
|
||
|
ArchivedThreadsStore.ThreadListingState threadListingState = (ArchivedThreadsStore.ThreadListingState) ArchivedThreadsStore.access$getListings$p(this.this$0).get(pair);
|
||
|
boolean z2 = threadListingState instanceof ArchivedThreadsStore.ThreadListingState.Listing;
|
||
|
List<Channel> emptyList = (!z2 || this.$reload) ? n.emptyList() : ((ArchivedThreadsStore.ThreadListingState.Listing) threadListingState).getThreads();
|
||
|
ArchivedThreadsStore.access$getListings$p(this.this$0).put(pair, z2 ? ArchivedThreadsStore.ThreadListingState.Listing.copy$default((ArchivedThreadsStore.ThreadListingState.Listing) threadListingState, null, false, true, 3, null) : new ArchivedThreadsStore.ThreadListingState.Listing(emptyList, true, true));
|
||
|
this.this$0.markChanged();
|
||
|
Subscription subscription = (Subscription) ArchivedThreadsStore.access$getFetchSubscriptions$p(this.this$0).get(pair);
|
||
|
if (subscription != null) {
|
||
|
subscription.unsubscribe();
|
||
|
}
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.restSubscribeOn$default(RetryWithDelay.restRetry$default(RetryWithDelay.INSTANCE, this.$threadListingType.fetchNext(this.$channelId, emptyList), 0, null, null, 7, null), false, 1, null), this.this$0.getClass(), (Context) null, new AnonymousClass1(this, pair), new AnonymousClass2(this, pair), (Function0) null, (Function0) null, new AnonymousClass3(this, pair, emptyList), 50, (Object) null);
|
||
|
}
|
||
|
}
|