discord-jadx/app/src/main/java/com/discord/widgets/friends/FriendsListViewModel$Compan...

198 lines
10 KiB
Java

package com.discord.widgets.friends;
import com.discord.models.domain.ModelApplicationStream;
import com.discord.models.domain.ModelConnectedAccount;
import com.discord.models.experiments.domain.Experiment;
import com.discord.models.friendsuggestions.FriendSuggestion;
import com.discord.models.presence.Presence;
import com.discord.models.user.MeUser;
import com.discord.models.user.User;
import com.discord.stores.StoreApplicationStreaming;
import com.discord.stores.StoreChannelsSelected;
import com.discord.stores.StoreContactSync;
import com.discord.stores.StoreExperiments;
import com.discord.stores.StoreFriendSuggestions;
import com.discord.stores.StoreUser;
import com.discord.stores.StoreUserConnections;
import com.discord.stores.StoreUserPresence;
import com.discord.stores.StoreUserRelationships;
import com.discord.utilities.collections.SnowflakePartitionMap;
import com.discord.utilities.user.UserUtils;
import com.discord.widgets.friends.FriendsListViewModel;
import d0.t.h0;
import d0.z.d.m;
import j0.k.b;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
/* compiled from: FriendsListViewModel.kt */
public final class FriendsListViewModel$Companion$observeStores$1<T, R> implements b<Unit, FriendsListViewModel.StoreState> {
public final /* synthetic */ StoreApplicationStreaming $storeApplicationStreaming;
public final /* synthetic */ StoreChannelsSelected $storeChannelsSelected;
public final /* synthetic */ StoreContactSync $storeContactSync;
public final /* synthetic */ StoreExperiments $storeExperiments;
public final /* synthetic */ StoreFriendSuggestions $storeFriendSuggestions;
public final /* synthetic */ StoreUserPresence $storePresences;
public final /* synthetic */ StoreUserConnections $storeUserConnections;
public final /* synthetic */ StoreUserRelationships $storeUserRelationships;
public final /* synthetic */ StoreUser $storeUsers;
public FriendsListViewModel$Companion$observeStores$1(StoreChannelsSelected storeChannelsSelected, StoreUserPresence storeUserPresence, StoreUser storeUser, StoreUserRelationships storeUserRelationships, StoreApplicationStreaming storeApplicationStreaming, StoreUserConnections storeUserConnections, StoreExperiments storeExperiments, StoreContactSync storeContactSync, StoreFriendSuggestions storeFriendSuggestions) {
this.$storeChannelsSelected = storeChannelsSelected;
this.$storePresences = storeUserPresence;
this.$storeUsers = storeUser;
this.$storeUserRelationships = storeUserRelationships;
this.$storeApplicationStreaming = storeApplicationStreaming;
this.$storeUserConnections = storeUserConnections;
this.$storeExperiments = storeExperiments;
this.$storeContactSync = storeContactSync;
this.$storeFriendSuggestions = storeFriendSuggestions;
}
/* JADX WARNING: Code restructure failed: missing block: B:56:0x00e4, code lost:
if (r13.getBucket() == 1) goto L_0x00e6;
*/
/* JADX WARNING: Code restructure failed: missing block: B:63:0x00f4, code lost:
if (r4.getBucket() == 1) goto L_0x00e6;
*/
/* JADX WARNING: Removed duplicated region for block: B:53:0x00dc */
/* JADX WARNING: Removed duplicated region for block: B:59:0x00ea */
/* JADX WARNING: Removed duplicated region for block: B:66:0x00ff A[ADDED_TO_REGION] */
/* JADX WARNING: Removed duplicated region for block: B:70:0x0106 A[ADDED_TO_REGION] */
/* JADX WARNING: Removed duplicated region for block: B:74:0x010d */
/* JADX WARNING: Removed duplicated region for block: B:80:0x0123 */
/* JADX WARNING: Removed duplicated region for block: B:86:0x0137 A[ADDED_TO_REGION] */
public final FriendsListViewModel.StoreState call(Unit unit) {
boolean z2;
boolean z3;
Experiment userExperiment;
boolean z4;
boolean hasPhone;
boolean z5;
boolean z6;
long id2 = this.$storeChannelsSelected.getId();
SnowflakePartitionMap.CopiablePartitionMap<Presence> presences = this.$storePresences.getPresences();
Map<Long, User> users = this.$storeUsers.getUsers();
StoreUserRelationships.UserRelationshipsState relationshipsState = this.$storeUserRelationships.getRelationshipsState();
Map<Long, ModelApplicationStream> streamsByUser = this.$storeApplicationStreaming.getStreamsByUser();
List<ModelConnectedAccount> connectedAccounts = this.$storeUserConnections.getConnectedAccounts();
boolean z7 = connectedAccounts instanceof Collection;
boolean z8 = true;
if (!z7 || !connectedAccounts.isEmpty()) {
Iterator<T> it = connectedAccounts.iterator();
while (true) {
if (it.hasNext()) {
if (m.areEqual(it.next().getType(), "contacts")) {
z2 = true;
break;
}
} else {
break;
}
}
}
z2 = false;
if (!z7 || !connectedAccounts.isEmpty()) {
Iterator<T> it2 = connectedAccounts.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
T next = it2.next();
if (!m.areEqual(next.getType(), "contacts") || !next.isFriendSync()) {
z6 = false;
continue;
} else {
z6 = true;
continue;
}
if (z6) {
z3 = true;
break;
}
}
userExperiment = this.$storeExperiments.getUserExperiment("2021-04_contact_sync_android_main", !z2);
z4 = userExperiment == null && userExperiment.getBucket() == 1 && !z2;
boolean z9 = userExperiment == null && userExperiment.getBucket() == 1 && !z3;
MeUser me2 = this.$storeUsers.getMe();
Experiment userExperiment2 = this.$storeExperiments.getUserExperiment("2021-04_contact_sync_android_existing_user_phone_prompt", !z9 && UserUtils.INSTANCE.getHasPhone(me2));
Experiment userExperiment3 = this.$storeExperiments.getUserExperiment("2021-04_contact_sync_android_existing_user_without_phone_prompt", !z4 && !UserUtils.INSTANCE.getHasPhone(me2));
hasPhone = UserUtils.INSTANCE.getHasPhone(me2);
if (!hasPhone) {
if (z9) {
if (userExperiment2 != null) {
}
}
z5 = false;
boolean z10 = this.$storeContactSync.getFriendsListUpsellDismissed() && z5;
boolean z11 = !z4 && !z10;
Map<Long, FriendSuggestion> friendSuggestions = (userExperiment == null && userExperiment.getBucket() == 1) ? this.$storeFriendSuggestions.getFriendSuggestions() : h0.emptyMap();
boolean z12 = !(relationshipsState instanceof StoreUserRelationships.UserRelationshipsState.Loaded) && ((StoreUserRelationships.UserRelationshipsState.Loaded) relationshipsState).getRelationships().isEmpty();
Experiment userExperiment4 = this.$storeExperiments.getUserExperiment("2021-05_contact_sync_android_empty_states", !z4 && z12);
if (!z4 || !z12 || userExperiment4 == null || userExperiment4.getBucket() != 1) {
z8 = false;
}
return new FriendsListViewModel.StoreState(z11, z10, z8, id2, relationshipsState, users, presences, streamsByUser, friendSuggestions);
} else if (!hasPhone) {
if (z9) {
if (userExperiment3 != null) {
}
}
z5 = false;
if (this.$storeContactSync.getFriendsListUpsellDismissed()) {
}
if (!z4) {
}
if (userExperiment == null) {
}
if (!(relationshipsState instanceof StoreUserRelationships.UserRelationshipsState.Loaded)) {
}
Experiment userExperiment4 = this.$storeExperiments.getUserExperiment("2021-05_contact_sync_android_empty_states", !z4 && z12);
z8 = false;
return new FriendsListViewModel.StoreState(z11, z10, z8, id2, relationshipsState, users, presences, streamsByUser, friendSuggestions);
} else {
throw new NoWhenBranchMatchedException();
}
z5 = true;
if (this.$storeContactSync.getFriendsListUpsellDismissed()) {
}
if (!z4) {
}
if (userExperiment == null) {
}
if (!(relationshipsState instanceof StoreUserRelationships.UserRelationshipsState.Loaded)) {
}
Experiment userExperiment4 = this.$storeExperiments.getUserExperiment("2021-05_contact_sync_android_empty_states", !z4 && z12);
z8 = false;
return new FriendsListViewModel.StoreState(z11, z10, z8, id2, relationshipsState, users, presences, streamsByUser, friendSuggestions);
}
z3 = false;
userExperiment = this.$storeExperiments.getUserExperiment("2021-04_contact_sync_android_main", !z2);
if (userExperiment == null) {
}
if (userExperiment == null) {
}
MeUser me2 = this.$storeUsers.getMe();
Experiment userExperiment2 = this.$storeExperiments.getUserExperiment("2021-04_contact_sync_android_existing_user_phone_prompt", !z9 && UserUtils.INSTANCE.getHasPhone(me2));
Experiment userExperiment3 = this.$storeExperiments.getUserExperiment("2021-04_contact_sync_android_existing_user_without_phone_prompt", !z4 && !UserUtils.INSTANCE.getHasPhone(me2));
hasPhone = UserUtils.INSTANCE.getHasPhone(me2);
if (!hasPhone) {
}
z5 = true;
if (this.$storeContactSync.getFriendsListUpsellDismissed()) {
}
if (!z4) {
}
if (userExperiment == null) {
}
if (!(relationshipsState instanceof StoreUserRelationships.UserRelationshipsState.Loaded)) {
}
Experiment userExperiment4 = this.$storeExperiments.getUserExperiment("2021-05_contact_sync_android_empty_states", !z4 && z12);
z8 = false;
return new FriendsListViewModel.StoreState(z11, z10, z8, id2, relationshipsState, users, presences, streamsByUser, friendSuggestions);
}
}