discord-jadx/app/src/main/java/com/discord/stores/StoreAnalytics.java

934 lines
47 KiB
Java

package com.discord.stores;
import a0.a.a.b;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import b.d.b.a.a;
import co.discord.media_engine.VideoInputDeviceDescription;
import com.discord.api.channel.Channel;
import com.discord.api.channel.ChannelUtils;
import com.discord.api.guild.GuildFeature;
import com.discord.api.guildscheduledevent.GuildScheduledEvent;
import com.discord.api.message.Message;
import com.discord.api.permission.Permission;
import com.discord.api.permission.PermissionOverwrite;
import com.discord.api.role.GuildRole;
import com.discord.api.thread.ThreadMetadata;
import com.discord.api.voice.state.VoiceState;
import com.discord.app.AppComponent;
import com.discord.app.AppLog;
import com.discord.models.domain.ModelAuditLogEntry;
import com.discord.models.domain.ModelInvite;
import com.discord.models.domain.ModelNotificationSettings;
import com.discord.models.domain.ModelPayload;
import com.discord.models.guild.Guild;
import com.discord.models.member.GuildMember;
import com.discord.models.user.User;
import com.discord.rtcconnection.RtcConnection;
import com.discord.rtcconnection.audio.DiscordAudioManager;
import com.discord.utilities.KotlinExtensionsKt;
import com.discord.utilities.PermissionOverwriteUtilsKt;
import com.discord.utilities.SnowflakeUtils;
import com.discord.utilities.analytics.AnalyticsTracker;
import com.discord.utilities.analytics.AnalyticsUtils;
import com.discord.utilities.analytics.SearchType;
import com.discord.utilities.analytics.Traits;
import com.discord.utilities.collections.CollectionExtensionsKt;
import com.discord.utilities.intent.RouteHandlers;
import com.discord.utilities.rest.FileUploadAlertType;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.time.Clock;
import com.discord.widgets.chat.input.emoji.EmojiPickerContextType;
import com.discord.widgets.guilds.invite.GuildInvite;
import com.discord.widgets.voice.feedback.FeedbackIssue;
import com.discord.widgets.voice.feedback.PendingFeedback;
import d0.d0.f;
import d0.o;
import d0.t.g0;
import d0.t.h0;
import d0.t.n;
import d0.z.d.m;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Pair;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import rx.Observable;
import rx.subjects.PublishSubject;
/* compiled from: StoreAnalytics.kt */
public final class StoreAnalytics extends Store {
private String analyticsToken;
private String authToken;
private final Clock clock;
private final Dispatcher dispatcher;
private String fingerprint;
private AtomicBoolean hasTrackedAppUiShown = new AtomicBoolean(false);
private String inputMode;
private final PublishSubject<ScreenViewed> screenViewedSubject = PublishSubject.k0();
private Channel selectedVoiceChannel;
private final StoreStream stores;
/* compiled from: StoreAnalytics.kt */
public static final class ScreenViewed {
private final Class<? extends AppComponent> screen;
private final long timestamp;
public ScreenViewed(Class<? extends AppComponent> cls, long j) {
m.checkNotNullParameter(cls, "screen");
this.screen = cls;
this.timestamp = j;
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.stores.StoreAnalytics$ScreenViewed */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ ScreenViewed copy$default(ScreenViewed screenViewed, Class cls, long j, int i, Object obj) {
if ((i & 1) != 0) {
cls = screenViewed.screen;
}
if ((i & 2) != 0) {
j = screenViewed.timestamp;
}
return screenViewed.copy(cls, j);
}
public final Class<? extends AppComponent> component1() {
return this.screen;
}
public final long component2() {
return this.timestamp;
}
public final ScreenViewed copy(Class<? extends AppComponent> cls, long j) {
m.checkNotNullParameter(cls, "screen");
return new ScreenViewed(cls, j);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ScreenViewed)) {
return false;
}
ScreenViewed screenViewed = (ScreenViewed) obj;
return m.areEqual(this.screen, screenViewed.screen) && this.timestamp == screenViewed.timestamp;
}
public final Class<? extends AppComponent> getScreen() {
return this.screen;
}
public final long getTimestamp() {
return this.timestamp;
}
public int hashCode() {
Class<? extends AppComponent> cls = this.screen;
return b.a(this.timestamp) + ((cls != null ? cls.hashCode() : 0) * 31);
}
public String toString() {
StringBuilder R = a.R("ScreenViewed(screen=");
R.append(this.screen);
R.append(", timestamp=");
return a.B(R, this.timestamp, ")");
}
}
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
FeedbackIssue.values();
int[] iArr = new int[24];
$EnumSwitchMapping$0 = iArr;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_BLACK.ordinal()] = 1;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_BLURRY.ordinal()] = 2;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_LAGGING.ordinal()] = 3;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_OUT_OF_SYNC.ordinal()] = 4;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_AUDIO_MISSING.ordinal()] = 5;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_AUDIO_POOR.ordinal()] = 6;
iArr[FeedbackIssue.STREAM_REPORT_ENDED_STREAM_STOPPED_UNEXPECTEDLY.ordinal()] = 7;
iArr[FeedbackIssue.OTHER.ordinal()] = 8;
}
}
public StoreAnalytics(StoreStream storeStream, Dispatcher dispatcher, Clock clock) {
m.checkNotNullParameter(storeStream, "stores");
m.checkNotNullParameter(dispatcher, "dispatcher");
m.checkNotNullParameter(clock, "clock");
this.stores = storeStream;
this.dispatcher = dispatcher;
this.clock = clock;
}
public static final /* synthetic */ Map access$getChannelSnapshotAnalyticsProperties(StoreAnalytics storeAnalytics, Channel channel, boolean z2) {
return storeAnalytics.getChannelSnapshotAnalyticsProperties(channel, z2);
}
public static final /* synthetic */ Map access$getGuildAnalyticsPropertiesInternal(StoreAnalytics storeAnalytics, long j) {
return storeAnalytics.getGuildAnalyticsPropertiesInternal(j);
}
public static final /* synthetic */ String access$getInputMode$p(StoreAnalytics storeAnalytics) {
return storeAnalytics.inputMode;
}
public static final /* synthetic */ Channel access$getSelectedVoiceChannel$p(StoreAnalytics storeAnalytics) {
return storeAnalytics.selectedVoiceChannel;
}
public static final /* synthetic */ StoreStream access$getStores$p(StoreAnalytics storeAnalytics) {
return storeAnalytics.stores;
}
public static final /* synthetic */ Map access$getThreadSnapshotAnalyticsProperties(StoreAnalytics storeAnalytics, Channel channel) {
return storeAnalytics.getThreadSnapshotAnalyticsProperties(channel);
}
public static final /* synthetic */ void access$onScreenViewed(StoreAnalytics storeAnalytics, ScreenViewed screenViewed) {
storeAnalytics.onScreenViewed(screenViewed);
}
public static final /* synthetic */ void access$setInputMode$p(StoreAnalytics storeAnalytics, String str) {
storeAnalytics.inputMode = str;
}
public static final /* synthetic */ void access$setSelectedVoiceChannel$p(StoreAnalytics storeAnalytics, Channel channel) {
storeAnalytics.selectedVoiceChannel = channel;
}
private final void emojiPickerUpsellViewed(AnalyticsTracker.PremiumUpsellType premiumUpsellType, EmojiPickerContextType emojiPickerContextType, Map<String, ? extends Object> map) {
String str;
if (m.areEqual(emojiPickerContextType, EmojiPickerContextType.Global.INSTANCE)) {
str = "Custom Status Modal";
} else if (m.areEqual(emojiPickerContextType, EmojiPickerContextType.Chat.INSTANCE)) {
Channel channel = this.stores.getChannels$app_productionBetaRelease().getChannel(this.stores.getChannelsSelected$app_productionBetaRelease().getId());
str = (channel == null || channel.f() != 0) ? Traits.Location.Page.GUILD_CHANNEL : "DM Channel";
} else {
str = "";
}
AnalyticsTracker.premiumUpsellViewed$default(AnalyticsTracker.INSTANCE, premiumUpsellType, new Traits.Location((String) KotlinExtensionsKt.getExhaustive(str), Traits.Location.Section.EMOJI_PICKER_POPOUT, Traits.Location.Obj.BUTTON_UPSELL, Traits.Location.ObjType.SEARCH, null, 16, null), h0.plus(map, o.to("has_search_query", Boolean.TRUE)), null, 8, null);
}
/* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: com.discord.stores.StoreAnalytics */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ void emojiPickerUpsellViewed$default(StoreAnalytics storeAnalytics, AnalyticsTracker.PremiumUpsellType premiumUpsellType, EmojiPickerContextType emojiPickerContextType, Map map, int i, Object obj) {
if ((i & 4) != 0) {
map = h0.emptyMap();
}
storeAnalytics.emojiPickerUpsellViewed(premiumUpsellType, emojiPickerContextType, map);
}
private final Map<String, Object> getChannelSnapshotAnalyticsProperties(long j, boolean z2) {
Channel channel = this.stores.getChannels$app_productionBetaRelease().getChannel(j);
Map<String, Object> channelSnapshotAnalyticsProperties = channel != null ? getChannelSnapshotAnalyticsProperties(channel, z2) : null;
return channelSnapshotAnalyticsProperties != null ? channelSnapshotAnalyticsProperties : h0.emptyMap();
}
private final Map<String, Object> getChannelSnapshotAnalyticsProperties(Channel channel, boolean z2) {
PermissionOverwrite permissionOverwrite;
Object obj;
boolean z3;
Long l = (Long) a.c(channel, this.stores.getPermissions$app_productionBetaRelease().getPermissionsByChannel());
List<PermissionOverwrite> s2 = channel.s();
Boolean bool = null;
if (s2 != null) {
Iterator<T> it = s2.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
if (((PermissionOverwrite) obj).e() == channel.f()) {
z3 = true;
continue;
} else {
z3 = false;
continue;
}
if (z3) {
break;
}
}
permissionOverwrite = (PermissionOverwrite) obj;
} else {
permissionOverwrite = null;
}
if (permissionOverwrite != null) {
bool = Boolean.valueOf(PermissionOverwriteUtilsKt.denies(permissionOverwrite, Permission.VIEW_CHANNEL));
}
return h0.plus(h0.plus(AnalyticsUtils.INSTANCE.getProperties$app_productionBetaRelease(channel), h0.mapOf(o.to("channel_member_perms", l), o.to("channel_hidden", bool))), z2 ? g0.mapOf(o.to("channel_is_nsfw", Boolean.valueOf(channel.o()))) : h0.emptyMap());
}
public static /* synthetic */ Map getChannelSnapshotAnalyticsProperties$default(StoreAnalytics storeAnalytics, long j, boolean z2, int i, Object obj) {
if ((i & 2) != 0) {
z2 = false;
}
return storeAnalytics.getChannelSnapshotAnalyticsProperties(j, z2);
}
public static /* synthetic */ Map getChannelSnapshotAnalyticsProperties$default(StoreAnalytics storeAnalytics, Channel channel, boolean z2, int i, Object obj) {
if ((i & 2) != 0) {
z2 = false;
}
return storeAnalytics.getChannelSnapshotAnalyticsProperties(channel, z2);
}
@StoreThread
private final Map<String, Object> getGuildAnalyticsPropertiesInternal(long j) {
Collection<Channel> collection;
GuildMember guildMember;
List<Long> roles;
Guild guild = this.stores.getGuilds$app_productionBetaRelease().getGuildsInternal$app_productionBetaRelease().get(Long.valueOf(j));
if (guild == null) {
return new HashMap();
}
int approximateMemberCount = this.stores.getGuildMemberCounts$app_productionBetaRelease().getApproximateMemberCount(j);
Map<Long, Channel> channelsForGuildInternal$app_productionBetaRelease = this.stores.getChannels$app_productionBetaRelease().getChannelsForGuildInternal$app_productionBetaRelease(j);
if (channelsForGuildInternal$app_productionBetaRelease == null || (collection = channelsForGuildInternal$app_productionBetaRelease.values()) == null) {
collection = n.emptyList();
}
Map<Long, GuildRole> map = this.stores.getGuilds$app_productionBetaRelease().getGuildRolesInternal$app_productionBetaRelease().get(Long.valueOf(j));
int size = map != null ? map.size() : 0;
long id2 = this.stores.getUsers$app_productionBetaRelease().getMeInternal$app_productionBetaRelease().getId();
Map<Long, GuildMember> map2 = this.stores.getGuilds$app_productionBetaRelease().getGuildMembersComputedInternal$app_productionBetaRelease().get(Long.valueOf(j));
int size2 = (map2 == null || (guildMember = map2.get(Long.valueOf(id2))) == null || (roles = guildMember.getRoles()) == null) ? 0 : roles.size();
Long l = this.stores.getPermissions$app_productionBetaRelease().getGuildPermissions().get(Long.valueOf(j));
return guildPropertiesMap(guild.getId(), approximateMemberCount, collection, size, size2, l != null ? l.longValue() : 0, guild.getFeatures().contains(GuildFeature.VIP_REGIONS));
}
private final Map<String, Object> getGuildAndChannelSnapshotAnalyticsProperties(long j) {
Channel channel = this.stores.getChannels$app_productionBetaRelease().getChannel(j);
Map<String, Object> map = null;
if (channel != null) {
map = h0.plus(getGuildSnapshotAnalyticsProperties(channel.f()), getChannelSnapshotAnalyticsProperties$default(this, channel, false, 2, (Object) null));
}
return map != null ? map : h0.emptyMap();
}
private final Map<String, Object> getGuildSnapshotAnalyticsProperties(long j) {
Guild guild = this.stores.getGuilds$app_productionBetaRelease().getGuilds().get(Long.valueOf(j));
Map<String, Object> guildSnapshotAnalyticsProperties = guild != null ? getGuildSnapshotAnalyticsProperties(guild) : null;
return guildSnapshotAnalyticsProperties != null ? guildSnapshotAnalyticsProperties : h0.emptyMap();
}
private final Map<String, Object> getGuildSnapshotAnalyticsProperties(Guild guild) {
GuildMember guildMember;
List<Long> roles;
int approximateMemberCount = this.stores.getGuildMemberCounts$app_productionBetaRelease().getApproximateMemberCount(guild.getId());
Collection<Channel> values = this.stores.getChannels$app_productionBetaRelease().getChannelsForGuild(guild.getId()).values();
Map map = (Map) a.d(guild, this.stores.getGuilds$app_productionBetaRelease().getRoles());
int size = map != null ? map.size() : 0;
long id2 = this.stores.getUsers$app_productionBetaRelease().getMe().getId();
Map map2 = (Map) a.d(guild, this.stores.getGuilds$app_productionBetaRelease().getMembers());
int size2 = (map2 == null || (guildMember = (GuildMember) map2.get(Long.valueOf(id2))) == null || (roles = guildMember.getRoles()) == null) ? 0 : roles.size();
Long l = (Long) a.d(guild, this.stores.getPermissions$app_productionBetaRelease().getGuildPermissions());
return guildPropertiesMap(guild.getId(), approximateMemberCount, values, size, size2, l != null ? l.longValue() : 0, guild.getFeatures().contains(GuildFeature.VIP_REGIONS));
}
private final Map<String, Object> getSnapshotAnalyticsProperties() {
return getGuildAndChannelSnapshotAnalyticsProperties(this.stores.getChannelsSelected$app_productionBetaRelease().getId());
}
private final String getStreamFeedbackReasonFromIssue(FeedbackIssue feedbackIssue) {
if (feedbackIssue != null) {
int ordinal = feedbackIssue.ordinal();
if (ordinal == 0) {
return "OTHER";
}
switch (ordinal) {
case 10:
return "BLACK_SCREEN";
case 11:
return "BLURRY";
case 12:
return "LAGGING";
case 13:
return "OUT_OF_SYNC";
case 14:
return "AUDIO_MISSING";
case 15:
return "AUDIO_POOR";
case 16:
return "STREAM_STOPPED_UNEXPECTEDLY";
}
}
return null;
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x008e: APUT
(r2v1 kotlin.Pair[])
(5 ??[int, float, short, byte, char])
(wrap: kotlin.Pair : 0x008a: INVOKE (r3v12 kotlin.Pair) =
("thread_archived")
(wrap: java.lang.Boolean : 0x0083: INVOKE (r3v11 java.lang.Boolean) = (r3v10 boolean) type: STATIC call: java.lang.Boolean.valueOf(boolean):java.lang.Boolean)
type: STATIC call: d0.o.to(java.lang.Object, java.lang.Object):kotlin.Pair)
*/
private final Map<String, Object> getThreadSnapshotAnalyticsProperties(Channel channel) {
Integer threadMessageCount = this.stores.getThreadMessages$app_productionBetaRelease().getThreadMessageCount(channel.h());
boolean z2 = false;
int intValue = threadMessageCount != null ? threadMessageCount.intValue() : 0;
Pair[] pairArr = new Pair[9];
pairArr[0] = o.to(ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID, Long.valueOf(channel.h()));
pairArr[1] = o.to(ModelAuditLogEntry.CHANGE_KEY_GUILD_ID, Long.valueOf(channel.f()));
pairArr[2] = o.to("parent_id", Long.valueOf(channel.r()));
pairArr[3] = o.to("channel_type", Integer.valueOf(channel.A()));
pairArr[4] = o.to("thread_approximate_message_count", Integer.valueOf(f.coerceAtMost(intValue, 50)));
ThreadMetadata y2 = channel.y();
pairArr[5] = o.to("thread_archived", Boolean.valueOf(y2 != null && y2.b()));
ThreadMetadata y3 = channel.y();
if (y3 != null && y3.d()) {
z2 = true;
}
pairArr[6] = o.to("thread_locked", Boolean.valueOf(z2));
ThreadMetadata y4 = channel.y();
pairArr[7] = o.to("thread_auto_archive_duration_minutes", y4 != null ? Integer.valueOf(y4.c()) : null);
pairArr[8] = o.to("thread_approximate_creation_date", Long.valueOf((channel.h() >>> 22) + SnowflakeUtils.DISCORD_EPOCH));
return h0.mapOf(pairArr);
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0061: APUT
(r0v1 kotlin.Pair[])
(3 ??[int, float, short, byte, char])
(wrap: kotlin.Pair : 0x005c: INVOKE (r3v10 kotlin.Pair) =
("guild_num_text_channels")
(wrap: java.lang.Integer : 0x0056: INVOKE (r3v9 java.lang.Integer) = (r5v5 int) type: STATIC call: java.lang.Integer.valueOf(int):java.lang.Integer)
type: STATIC call: d0.o.to(java.lang.Object, java.lang.Object):kotlin.Pair)
*/
private final Map<String, Object> guildPropertiesMap(long j, int i, Collection<Channel> collection, int i2, int i3, long j2, boolean z2) {
int i4;
Pair[] pairArr = new Pair[9];
int i5 = 0;
pairArr[0] = o.to(ModelAuditLogEntry.CHANGE_KEY_GUILD_ID, Long.valueOf(j));
pairArr[1] = o.to("guild_size_total", Integer.valueOf(i));
pairArr[2] = o.to("guild_num_channels", Integer.valueOf(collection.size()));
if (collection.isEmpty()) {
i4 = 0;
} else {
i4 = 0;
for (Channel channel : collection) {
if (ChannelUtils.s(channel) && (i4 = i4 + 1) < 0) {
n.throwCountOverflow();
}
}
}
pairArr[3] = o.to("guild_num_text_channels", Integer.valueOf(i4));
if (!collection.isEmpty()) {
for (Channel channel2 : collection) {
if (ChannelUtils.t(channel2) && (i5 = i5 + 1) < 0) {
n.throwCountOverflow();
}
}
}
pairArr[4] = o.to("guild_num_voice_channels", Integer.valueOf(i5));
pairArr[5] = o.to("guild_num_roles", Integer.valueOf(i2));
pairArr[6] = o.to("guild_member_num_roles", Integer.valueOf(i3));
pairArr[7] = o.to("guild_member_perms", Long.valueOf(j2));
pairArr[8] = o.to("guild_is_vip", Boolean.valueOf(z2));
return h0.mutableMapOf(pairArr);
}
@StoreThread
private final void handleVideoInputUpdate(VideoInputDeviceDescription videoInputDeviceDescription, boolean z2) {
Channel channel = this.selectedVoiceChannel;
if (channel != null) {
Map<Long, VoiceState> map = this.stores.getVoiceStates$app_productionBetaRelease().get().get(Long.valueOf(channel.f()));
if (map == null) {
map = h0.emptyMap();
}
long id2 = this.stores.getUsers$app_productionBetaRelease().getMeInternal$app_productionBetaRelease().getId();
AnalyticsTracker analyticsTracker = AnalyticsTracker.INSTANCE;
RtcConnection.Metadata rtcConnectionMetadata = this.stores.getRtcConnection$app_productionBetaRelease().getRtcConnectionMetadata();
analyticsTracker.videoInputsUpdate(id2, channel, map, videoInputDeviceDescription, z2, rtcConnectionMetadata != null ? rtcConnectionMetadata.f2739b : null);
}
}
private final void onScreenViewed(ScreenViewed screenViewed) {
if (!this.hasTrackedAppUiShown.getAndSet(true)) {
this.dispatcher.schedule(new StoreAnalytics$onScreenViewed$1(this, screenViewed));
}
}
public static /* synthetic */ void onUserSettingsPaneViewed$default(StoreAnalytics storeAnalytics, String str, String str2, int i, Object obj) {
if ((i & 2) != 0) {
str2 = null;
}
storeAnalytics.onUserSettingsPaneViewed(str, str2);
}
public static /* synthetic */ void trackSearchResultSelected$default(StoreAnalytics storeAnalytics, SearchType searchType, int i, Traits.Location location, Traits.Source source, int i2, Object obj) {
if ((i2 & 4) != 0) {
location = null;
}
if ((i2 & 8) != 0) {
source = null;
}
storeAnalytics.trackSearchResultSelected(searchType, i, location, source);
}
public static /* synthetic */ void trackSearchResultViewed$default(StoreAnalytics storeAnalytics, SearchType searchType, int i, Integer num, Traits.Location location, boolean z2, int i2, Object obj) {
storeAnalytics.trackSearchResultViewed(searchType, i, (i2 & 4) != 0 ? null : num, (i2 & 8) != 0 ? null : location, (i2 & 16) != 0 ? false : z2);
}
public static /* synthetic */ void trackSearchResultsEmpty$default(StoreAnalytics storeAnalytics, SearchType searchType, Traits.Location location, boolean z2, int i, Object obj) {
if ((i & 2) != 0) {
location = null;
}
if ((i & 4) != 0) {
z2 = false;
}
storeAnalytics.trackSearchResultsEmpty(searchType, location, z2);
}
public static /* synthetic */ void trackSearchStarted$default(StoreAnalytics storeAnalytics, SearchType searchType, Traits.Location location, boolean z2, int i, Object obj) {
if ((i & 2) != 0) {
location = null;
}
if ((i & 4) != 0) {
z2 = false;
}
storeAnalytics.trackSearchStarted(searchType, location, z2);
}
/* JADX WARNING: Removed duplicated region for block: B:18:0x0028 */
/* JADX WARNING: Removed duplicated region for block: B:29:0x003e */
/* JADX WARNING: Removed duplicated region for block: B:30:0x0048 */
private final void updateTrackingData() {
boolean z2;
boolean z3;
String str = this.authToken;
boolean z4 = !(str == null || str.length() == 0);
if (!z4) {
String str2 = this.fingerprint;
if (!(str2 == null || str2.length() == 0)) {
z2 = true;
if (z4) {
String str3 = this.analyticsToken;
if (!(str3 == null || str3.length() == 0)) {
z3 = true;
if (z2) {
AnalyticsTracker.INSTANCE.getTracker().setTrackingData(null, true);
return;
} else if (z3) {
AnalyticsUtils.Tracker.setTrackingData$default(AnalyticsTracker.INSTANCE.getTracker(), this.analyticsToken, false, 2, null);
return;
} else {
AnalyticsTracker.INSTANCE.getTracker().setTrackingData(null, false);
return;
}
}
}
z3 = false;
if (z2) {
}
}
}
z2 = false;
if (z4) {
}
z3 = false;
if (z2) {
}
}
public final void ackMessage(long j) {
this.dispatcher.schedule(new StoreAnalytics$ackMessage$1(this, j));
}
public final void appLandingViewed() {
AnalyticsTracker.appLandingViewed(getPrefsSessionDurable().getLong("CACHE_KEY_LOGOUT_TS", 0));
}
public final void appUiViewed(Class<? extends AppComponent> cls) {
m.checkNotNullParameter(cls, "screen");
PublishSubject<ScreenViewed> publishSubject = this.screenViewedSubject;
publishSubject.k.onNext(new ScreenViewed(cls, this.clock.currentTimeMillis()));
}
public final void deepLinkReceived(Intent intent, RouteHandlers.AnalyticsMetadata analyticsMetadata) {
m.checkNotNullParameter(intent, "intent");
m.checkNotNullParameter(analyticsMetadata, "metadata");
Long channelId = analyticsMetadata.getChannelId();
Map<String, ? extends Object> guildAndChannelSnapshotAnalyticsProperties = channelId != null ? getGuildAndChannelSnapshotAnalyticsProperties(channelId.longValue()) : null;
if (guildAndChannelSnapshotAnalyticsProperties == null) {
guildAndChannelSnapshotAnalyticsProperties = h0.emptyMap();
}
AnalyticsTracker.INSTANCE.deepLinkReceived(intent, analyticsMetadata, guildAndChannelSnapshotAnalyticsProperties);
}
public final void emojiAutocompleteUpsellInlineViewed() {
AnalyticsTracker.premiumUpsellViewed$default(AnalyticsTracker.INSTANCE, AnalyticsTracker.PremiumUpsellType.EmojiAutocompleteInline, null, h0.emptyMap(), null, 8, null);
}
public final void emojiAutocompleteUpsellModalViewed() {
AnalyticsTracker.premiumUpsellViewed$default(AnalyticsTracker.INSTANCE, AnalyticsTracker.PremiumUpsellType.EmojiAutocompleteModal, null, h0.emptyMap(), null, 8, null);
}
public final void emojiPickerUpsellHeaderViewed(EmojiPickerContextType emojiPickerContextType) {
m.checkNotNullParameter(emojiPickerContextType, "emojiPickerContextType");
emojiPickerUpsellViewed$default(this, AnalyticsTracker.PremiumUpsellType.EmojiPickerHeaderViewed, emojiPickerContextType, null, 4, null);
}
public final void emojiPickerUpsellLockedItemClicked(EmojiPickerContextType emojiPickerContextType, boolean z2) {
m.checkNotNullParameter(emojiPickerContextType, "emojiPickerContextType");
emojiPickerUpsellViewed(AnalyticsTracker.PremiumUpsellType.EmojiPickerLockedItemClicked, emojiPickerContextType, h0.mapOf(o.to("is_animated", Boolean.valueOf(z2)), o.to("is_external", Boolean.TRUE)));
}
public final Traits.Location getEmojiPickerUpsellLocation() {
Channel channel = this.stores.getChannels$app_productionBetaRelease().getChannel(this.stores.getChannelsSelected$app_productionBetaRelease().getId());
return new Traits.Location((channel == null || channel.f() != 0) ? Traits.Location.Page.GUILD_CHANNEL : "DM Channel", Traits.Location.Section.EMOJI_PICKER_POPOUT, null, null, null, 28, null);
}
@StoreThread
public final void handleAuthToken(String str) {
this.authToken = str;
updateTrackingData();
}
@StoreThread
public final void handleConnected(boolean z2) {
if (!z2) {
this.analyticsToken = null;
updateTrackingData();
}
}
@StoreThread
public final void handleConnectionOpen(ModelPayload modelPayload) {
m.checkNotNullParameter(modelPayload, "payload");
this.analyticsToken = modelPayload.getAnalyticsToken();
updateTrackingData();
}
@StoreThread
public final void handleFingerprint(String str) {
this.fingerprint = str;
updateTrackingData();
}
@StoreThread
public final void handleIsScreenSharingChanged(boolean z2) {
handleVideoInputUpdate(this.stores.getMediaEngine$app_productionBetaRelease().getSelectedVideoInputDeviceBlocking(), z2);
}
@StoreThread
public final void handlePreLogout() {
SharedPreferences.Editor edit = getPrefsSessionDurable().edit();
m.checkNotNullExpressionValue(edit, "editor");
edit.putLong("CACHE_KEY_LOGOUT_TS", this.clock.currentTimeMillis());
edit.apply();
}
@StoreThread
public final void handleUserSpeaking(Set<Long> set) {
Channel channel;
m.checkNotNullParameter(set, "speakingUsers");
String str = this.inputMode;
if (str != null && (channel = this.selectedVoiceChannel) != null) {
long id2 = this.stores.getUsers$app_productionBetaRelease().getMeInternal$app_productionBetaRelease().getId();
AnalyticsTracker analyticsTracker = AnalyticsTracker.INSTANCE;
analyticsTracker.userSpeaking(id2, set, str, channel);
analyticsTracker.userListening(id2, set, str, channel);
}
}
@StoreThread
public final void handleVideoInputDeviceSelected(VideoInputDeviceDescription videoInputDeviceDescription) {
handleVideoInputUpdate(videoInputDeviceDescription, this.stores.getApplicationStreaming$app_productionBetaRelease().isScreenSharing());
}
@Override // com.discord.stores.Store
public void init(Context context) {
m.checkNotNullParameter(context, "context");
super.init(context);
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.computationBuffered(this.stores.getMediaSettings$app_productionBetaRelease().getInputMode()), StoreAnalytics.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreAnalytics$init$1(this), 62, (Object) null);
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.computationBuffered(this.stores.getVoiceChannelSelected$app_productionBetaRelease().observeSelectedChannel()), StoreAnalytics.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreAnalytics$init$2(this), 62, (Object) null);
Observable y2 = this.screenViewedSubject.Y(StoreAnalytics$init$3.INSTANCE).y();
m.checkNotNullExpressionValue(y2, "screenViewedSubject\n … }\n .first()");
ObservableExtensionsKt.appSubscribe$default(y2, StoreAnalytics.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new StoreAnalytics$init$4(this), 62, (Object) null);
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x003f: APUT
(r1v1 kotlin.Pair[])
(2 ??[int, float, short, byte, char])
(wrap: kotlin.Pair : 0x003a: INVOKE (r0v6 kotlin.Pair) = ("invite_guild_id"), (r0v5 java.lang.Long) type: STATIC call: d0.o.to(java.lang.Object, java.lang.Object):kotlin.Pair)
*/
public final void inviteSent(ModelInvite modelInvite, Message message, String str) {
GuildScheduledEvent guildScheduledEvent;
Channel channel;
com.discord.api.guild.Guild guild;
m.checkNotNullParameter(message, "message");
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION);
Pair[] pairArr = new Pair[5];
pairArr[0] = o.to(ModelAuditLogEntry.CHANGE_KEY_LOCATION, str);
pairArr[1] = o.to("message_id", Long.valueOf(message.o()));
Long l = null;
pairArr[2] = o.to("invite_guild_id", (modelInvite == null || (guild = modelInvite.guild) == null) ? null : Long.valueOf(guild.r()));
pairArr[3] = o.to("invite_channel_id", (modelInvite == null || (channel = modelInvite.getChannel()) == null) ? null : Long.valueOf(channel.h()));
if (!(modelInvite == null || (guildScheduledEvent = modelInvite.getGuildScheduledEvent()) == null)) {
l = Long.valueOf(guildScheduledEvent.i());
}
pairArr[4] = o.to("invite_guild_scheduled_event_id", l);
AnalyticsTracker.INSTANCE.inviteSent(modelInvite, h0.plus(h0.mapOf(pairArr), getGuildAndChannelSnapshotAnalyticsProperties(message.g())));
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0037: APUT
(r1v1 kotlin.Pair[])
(2 ??[int, float, short, byte, char])
(wrap: kotlin.Pair : 0x0032: INVOKE (r0v6 kotlin.Pair) = ("invite_guild_id"), (r0v5 java.lang.Long) type: STATIC call: d0.o.to(java.lang.Object, java.lang.Object):kotlin.Pair)
*/
public final void inviteSent(GuildInvite guildInvite, Channel channel, Message message, String str) {
m.checkNotNullParameter(message, "message");
m.checkNotNullParameter(str, ModelAuditLogEntry.CHANGE_KEY_LOCATION);
Pair[] pairArr = new Pair[5];
pairArr[0] = o.to(ModelAuditLogEntry.CHANGE_KEY_LOCATION, str);
pairArr[1] = o.to("message_id", Long.valueOf(message.o()));
Long l = null;
pairArr[2] = o.to("invite_guild_id", guildInvite != null ? guildInvite.getGuildId() : null);
pairArr[3] = o.to("invite_channel_id", guildInvite != null ? guildInvite.getChannelId() : null);
if (guildInvite != null) {
l = guildInvite.getGuildScheduledEventId();
}
pairArr[4] = o.to("invite_guild_scheduled_event_id", l);
AnalyticsTracker.INSTANCE.inviteSent(guildInvite, channel, h0.plus(h0.mapOf(pairArr), getGuildAndChannelSnapshotAnalyticsProperties(message.g())));
}
public final void inviteSuggestionOpened(long j, List<Channel> list, List<? extends User> list2) {
m.checkNotNullParameter(list, "channelSuggestions");
m.checkNotNullParameter(list2, "userSuggestions");
AnalyticsTracker.INSTANCE.inviteSuggestionOpened(j, list, list2);
}
public final void onGuildSettingsPaneViewed(String str, long j) {
m.checkNotNullParameter(str, "pane");
this.dispatcher.schedule(new StoreAnalytics$onGuildSettingsPaneViewed$1(this, j, str));
}
public final void onNotificationSettingsUpdated(ModelNotificationSettings modelNotificationSettings, Long l) {
m.checkNotNullParameter(modelNotificationSettings, "notifSettings");
this.dispatcher.schedule(new StoreAnalytics$onNotificationSettingsUpdated$1(this, l, modelNotificationSettings));
}
public final void onOverlayVoiceEvent(boolean z2) {
this.dispatcher.schedule(new StoreAnalytics$onOverlayVoiceEvent$1(this, z2));
}
public final void onThreadNotificationSettingsUpdated(long j, long j2, int i, int i2) {
this.dispatcher.schedule(new StoreAnalytics$onThreadNotificationSettingsUpdated$1(this, j, j2, i2, i));
}
public final void onUserSettingsPaneViewed(String str, String str2) {
m.checkNotNullParameter(str, "pane");
AnalyticsTracker.INSTANCE.settingsPaneViewed("user", str, str2 != null ? g0.mapOf(o.to("location_section", str2)) : null);
}
public final void openCustomEmojiPopout(Channel channel, long j, boolean z2, boolean z3, boolean z4) {
m.checkNotNullParameter(channel, "channel");
AnalyticsTracker.INSTANCE.openCustomEmojiPopout(channel.f(), j, z2, z3, z4, CollectionExtensionsKt.filterNonNullValues(getChannelSnapshotAnalyticsProperties$default(this, channel, false, 2, (Object) null)));
}
public final void openUnicodeEmojiPopout(Channel channel) {
m.checkNotNullParameter(channel, "channel");
AnalyticsTracker.INSTANCE.openUnicodeEmojiPopout(channel.f(), CollectionExtensionsKt.filterNonNullValues(getChannelSnapshotAnalyticsProperties$default(this, channel, false, 2, (Object) null)));
}
public final void streamQualityIndicatorViewed(boolean z2, Boolean bool) {
AnalyticsTracker.premiumUpsellViewed$default(AnalyticsTracker.INSTANCE, AnalyticsTracker.PremiumUpsellType.StreamQualityIndicator, null, CollectionExtensionsKt.filterNonNullValues(h0.mapOf(o.to("has_premium_stream_fps", bool), o.to("has_premium_stream_resolution", Boolean.valueOf(z2)))), null, 8, null);
}
public final void trackApplicationCommandBrowserJump(long j) {
AnalyticsTracker.INSTANCE.applicationCommandBrowserJump(j);
}
public final void trackApplicationCommandBrowserOpened(long j) {
AnalyticsTracker.INSTANCE.applicationCommandBrowserOpened(getGuildAndChannelSnapshotAnalyticsProperties(j));
}
public final void trackApplicationCommandBrowserScrolled() {
AnalyticsTracker.INSTANCE.applicationCommandBrowserScrolled();
}
public final void trackApplicationCommandSelected(long j, long j2, long j3) {
AnalyticsTracker.INSTANCE.applicationCommandSelected(j2, j3, getGuildAndChannelSnapshotAnalyticsProperties(j));
}
public final void trackApplicationCommandValidationFailure(long j, long j2, String str, boolean z2) {
m.checkNotNullParameter(str, "argumentType");
AnalyticsTracker.INSTANCE.applicationCommandValidationFailure(j, j2, str, z2);
}
public final void trackAutocompleteOpen(long j, String str, int i, int i2) {
m.checkNotNullParameter(str, "autocompleteType");
AnalyticsTracker.INSTANCE.autocompleteOpen(CollectionExtensionsKt.filterNonNullValues(getGuildAndChannelSnapshotAnalyticsProperties(j)), str, i, i2);
}
public final void trackAutocompleteSelect(long j, String str, int i, int i2, String str2, String str3, Long l) {
m.checkNotNullParameter(str, "autocompleteType");
AnalyticsTracker.INSTANCE.autocompleteSelect(CollectionExtensionsKt.filterNonNullValues(getGuildAndChannelSnapshotAnalyticsProperties(j)), str, i, i2, str2, str3, l);
}
public final void trackCallReportProblem(PendingFeedback.CallFeedback callFeedback) {
m.checkNotNullParameter(callFeedback, "pendingCallFeedback");
this.dispatcher.schedule(new StoreAnalytics$trackCallReportProblem$1(this, callFeedback));
}
@StoreThread
public final void trackChannelOpened(long j, ChannelAnalyticsViewType channelAnalyticsViewType, SelectedChannelAnalyticsLocation selectedChannelAnalyticsLocation) {
m.checkNotNullParameter(channelAnalyticsViewType, "channelView");
Channel findChannelByIdInternal$app_productionBetaRelease = this.stores.getChannels$app_productionBetaRelease().findChannelByIdInternal$app_productionBetaRelease(j);
if (findChannelByIdInternal$app_productionBetaRelease != null) {
AnalyticsTracker.INSTANCE.channelOpened(j, new StoreAnalytics$trackChannelOpened$$inlined$let$lambda$1(findChannelByIdInternal$app_productionBetaRelease, this, j, channelAnalyticsViewType, selectedChannelAnalyticsLocation));
}
}
public final void trackChatInputComponentViewed(String str) {
m.checkNotNullParameter(str, "type");
AnalyticsTracker.INSTANCE.chatInputComponentViewed(str);
}
public final void trackFailedMessageResolved(int i, int i2, int i3, boolean z2, boolean z3, FailedMessageResolutionType failedMessageResolutionType, long j, int i4, long j2) {
m.checkNotNullParameter(failedMessageResolutionType, "resolutionType");
AnalyticsTracker.INSTANCE.failedMessageResolved(i, i2, i3, z2, z3, failedMessageResolutionType, j, i4, getGuildAndChannelSnapshotAnalyticsProperties(j2));
}
public final void trackFileUploadAlertViewed(FileUploadAlertType fileUploadAlertType, int i, int i2, int i3, boolean z2, boolean z3, boolean z4) {
m.checkNotNullParameter(fileUploadAlertType, "alertType");
AnalyticsTracker.INSTANCE.fileUploadAlertViewed(fileUploadAlertType, i, i2, i3, z2, z3, z4, getSnapshotAnalyticsProperties());
}
public final void trackGuildProfileOpened(long j) {
AnalyticsTracker.INSTANCE.openGuildProfileSheet(j);
}
@StoreThread
public final void trackGuildViewed(long j) {
boolean z2;
GuildMember guildMember;
Guild guild = this.stores.getGuilds$app_productionBetaRelease().getGuildsInternal$app_productionBetaRelease().get(Long.valueOf(j));
if (guild != null) {
long id2 = this.stores.getUsers$app_productionBetaRelease().getMeInternal$app_productionBetaRelease().getId();
Map<Long, GuildMember> map = this.stores.getGuilds$app_productionBetaRelease().getGuildMembersComputedInternal$app_productionBetaRelease().get(Long.valueOf(j));
boolean pending = (map == null || (guildMember = map.get(Long.valueOf(id2))) == null) ? false : guildMember.getPending();
try {
z2 = guild.getFeatures().contains(GuildFeature.PREVIEW_ENABLED);
} catch (Exception e) {
AppLog.g.e("Guild is missing feature set", e, g0.mapOf(o.to(ModelAuditLogEntry.CHANGE_KEY_GUILD_ID, String.valueOf(guild.getId()))));
z2 = false;
}
AnalyticsTracker.INSTANCE.guildViewed(j, new StoreAnalytics$trackGuildViewed$1(h0.plus(getGuildAnalyticsPropertiesInternal(j), h0.mapOf(o.to("is_pending", Boolean.valueOf(pending)), o.to("preview_enabled", Boolean.valueOf(z2))))));
}
}
public final void trackMediaSessionJoined(Map<String, Object> map) {
m.checkNotNullParameter(map, "properties");
this.dispatcher.schedule(new StoreAnalytics$trackMediaSessionJoined$1(this, map));
}
public final void trackOpenGiftAcceptModal(String str, String str2, long j) {
m.checkNotNullParameter(str, "giftCode");
m.checkNotNullParameter(str2, ModelAuditLogEntry.CHANGE_KEY_LOCATION);
this.dispatcher.schedule(new StoreAnalytics$trackOpenGiftAcceptModal$1(this, str, j, str2));
}
public final void trackSearchResultSelected(SearchType searchType, int i, Traits.Location location, Traits.Source source) {
m.checkNotNullParameter(searchType, "searchType");
AnalyticsTracker.INSTANCE.searchResultSelected(searchType, location, source, i, getSnapshotAnalyticsProperties());
}
public final void trackSearchResultViewed(SearchType searchType, int i, Integer num, Traits.Location location, boolean z2) {
m.checkNotNullParameter(searchType, "searchType");
AnalyticsTracker.INSTANCE.searchResultViewed(searchType, i, num, location, getSnapshotAnalyticsProperties(), z2);
}
public final void trackSearchResultsEmpty(SearchType searchType, Traits.Location location, boolean z2) {
m.checkNotNullParameter(searchType, "searchType");
AnalyticsTracker.INSTANCE.searchResultsEmpty(searchType, location, getSnapshotAnalyticsProperties(), z2);
}
public final void trackSearchStarted(SearchType searchType, Traits.Location location, boolean z2) {
m.checkNotNullParameter(searchType, "searchType");
AnalyticsTracker.INSTANCE.searchStart(searchType, location, getSnapshotAnalyticsProperties(), z2);
}
public final void trackShowCallFeedbackSheet(long j) {
this.dispatcher.schedule(new StoreAnalytics$trackShowCallFeedbackSheet$1(this, j));
}
public final void trackStreamReportProblem(PendingFeedback.StreamFeedback streamFeedback) {
m.checkNotNullParameter(streamFeedback, "pendingStreamFeedback");
AnalyticsTracker.INSTANCE.reportStreamProblem(streamFeedback.getStream(), streamFeedback.getFeedbackRating(), getStreamFeedbackReasonFromIssue(streamFeedback.getIssue()), streamFeedback.getMediaSessionId(), streamFeedback.getIssueDetails());
}
public final void trackThreadBrowserTabChanged(long j, String str) {
m.checkNotNullParameter(str, "tabType");
AnalyticsTracker.INSTANCE.threadBrowserTabChanged(getGuildAndChannelSnapshotAnalyticsProperties(j), str);
}
public final void trackVideoLayoutToggled(String str, long j, Channel channel) {
m.checkNotNullParameter(str, "videoLayout");
AnalyticsTracker.INSTANCE.videoLayoutToggled(str, j, channel);
}
@StoreThread
public final void trackVideoStreamEnded(Map<String, Object> map) {
m.checkNotNullParameter(map, "properties");
Object obj = map.get("sender_user_id");
Long l = null;
if (!(obj instanceof Long)) {
obj = null;
}
Long l2 = (Long) obj;
if (l2 != null) {
long longValue = l2.longValue();
Object obj2 = map.get(ModelAuditLogEntry.CHANGE_KEY_CHANNEL_ID);
if (!(obj2 instanceof Long)) {
obj2 = null;
}
Long l3 = (Long) obj2;
if (l3 != null) {
long longValue2 = l3.longValue();
Object obj3 = map.get(ModelAuditLogEntry.CHANGE_KEY_GUILD_ID);
if (obj3 instanceof Long) {
l = obj3;
}
Integer maxViewersForStream = this.stores.getApplicationStreaming$app_productionBetaRelease().getMaxViewersForStream(longValue, longValue2, l);
if (maxViewersForStream != null) {
map.put("max_viewers", maxViewersForStream);
}
AnalyticsTracker.INSTANCE.videoStreamEnded(map);
}
}
}
public final void trackVoiceAudioOutputModeSelected(long j, DiscordAudioManager.DeviceTypes deviceTypes, DiscordAudioManager.DeviceTypes deviceTypes2) {
m.checkNotNullParameter(deviceTypes, "fromAudioOutputMode");
m.checkNotNullParameter(deviceTypes2, "toAudioOutputMode");
this.dispatcher.schedule(new StoreAnalytics$trackVoiceAudioOutputModeSelected$1(this, j, deviceTypes, deviceTypes2));
}
public final void trackVoiceConnectionFailure(Map<String, Object> map) {
m.checkNotNullParameter(map, "properties");
this.dispatcher.schedule(new StoreAnalytics$trackVoiceConnectionFailure$1(this, map));
}
public final void trackVoiceConnectionSuccess(Map<String, Object> map) {
m.checkNotNullParameter(map, "properties");
this.dispatcher.schedule(new StoreAnalytics$trackVoiceConnectionSuccess$1(this, map));
}
@StoreThread
public final void trackVoiceDisconnect(Map<String, Object> map) {
m.checkNotNullParameter(map, "properties");
this.dispatcher.schedule(new StoreAnalytics$trackVoiceDisconnect$1(this, map));
}
}