56 lines
2.3 KiB
Java
56 lines
2.3 KiB
Java
package com.discord.stores;
|
|
|
|
import com.discord.api.directory.DirectoryEntry;
|
|
import com.discord.stores.utilities.RestCallState;
|
|
import com.discord.stores.utilities.Success;
|
|
import d0.t.n;
|
|
import d0.t.u;
|
|
import d0.z.d.o;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
/* compiled from: StoreDirectories.kt */
|
|
public final class StoreDirectories$addServerToDirectory$1 extends o implements Function0<Unit> {
|
|
public final /* synthetic */ long $channelId;
|
|
public final /* synthetic */ DirectoryEntry $directoryEntry;
|
|
public final /* synthetic */ StoreDirectories this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public StoreDirectories$addServerToDirectory$1(StoreDirectories storeDirectories, long j, DirectoryEntry directoryEntry) {
|
|
super(0);
|
|
this.this$0 = storeDirectories;
|
|
this.$channelId = j;
|
|
this.$directoryEntry = directoryEntry;
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: invoke */
|
|
public final void mo1invoke() {
|
|
Map access$getDirectoriesMap$p = StoreDirectories.access$getDirectoriesMap$p(this.this$0);
|
|
Long valueOf = Long.valueOf(this.$channelId);
|
|
RestCallState restCallState = (RestCallState) StoreDirectories.access$getDirectoriesMap$p(this.this$0).get(Long.valueOf(this.$channelId));
|
|
DirectoryEntry directoryEntry = null;
|
|
List<DirectoryEntry> list = restCallState != null ? (List) restCallState.invoke() : null;
|
|
if (list == null) {
|
|
list = n.emptyList();
|
|
}
|
|
ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(list, 10));
|
|
boolean z2 = false;
|
|
for (DirectoryEntry directoryEntry2 : list) {
|
|
if (directoryEntry2.d().g() == this.$directoryEntry.d().g()) {
|
|
z2 = true;
|
|
directoryEntry2 = this.$directoryEntry;
|
|
}
|
|
arrayList.add(directoryEntry2);
|
|
}
|
|
if (!z2) {
|
|
directoryEntry = this.$directoryEntry;
|
|
}
|
|
access$getDirectoriesMap$p.put(valueOf, new Success(u.plus((Collection) arrayList, (Iterable) n.listOfNotNull(directoryEntry))));
|
|
this.this$0.markChanged();
|
|
}
|
|
}
|