package com.discord.stores; import android.app.Application; import android.content.Context; import c.a.d.k0; import c.a.e.d; import com.discord.app.AppLog; import com.discord.app.AudioManagerFeatureFlag; import com.discord.rtcconnection.RtcConnection; import com.discord.stores.StoreMessagesLoader; import com.discord.stores.StoreRtcConnection; import com.discord.utilities.contacts.ContactsFetcher; import com.discord.utilities.networking.NetworkMonitor; import com.discord.utilities.persister.Persister; import com.discord.utilities.rx.ObservableExtensionsKt; import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1; import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2; import com.discord.utilities.time.TimeElapsed; import com.discord.utilities.voice.VoiceEngineServiceController; import d0.z.d.k; import d0.z.d.m; import d0.z.d.o; import java.util.List; import java.util.Objects; import java.util.Set; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function1; import rx.Observable; import rx.functions.Func4; import rx.subjects.BehaviorSubject; /* compiled from: StoreStream.kt */ public final class StoreStream$deferredInit$1 extends o implements Function0 { public final /* synthetic */ Application $context; public final /* synthetic */ StoreStream this$0; /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$1 reason: invalid class name */ public static final class AnonymousClass1 extends o implements Function1 { public final /* synthetic */ StoreStream$deferredInit$1 this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass1(StoreStream$deferredInit$1 storeStream$deferredInit$1) { super(1); this.this$0 = storeStream$deferredInit$1; } /* 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(Boolean bool) { invoke(bool.booleanValue()); return Unit.a; } public final void invoke(boolean z2) { StoreStream.access$handlePreLogout(this.this$0.this$0); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$10 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass10 extends k implements Function1 { public AnonymousClass10(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleBackgrounded", "handleBackgrounded(Z)V", 0); } /* 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(Boolean bool) { invoke(bool.booleanValue()); return Unit.a; } public final void invoke(boolean z2) { StoreStream.access$handleBackgrounded((StoreStream) this.receiver, z2); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$11 reason: invalid class name */ public static final class AnonymousClass11 implements Func4 { public static final AnonymousClass11 INSTANCE = new AnonymousClass11(); /* JADX WARNING: Code restructure failed: missing block: B:7:0x0025, code lost: if (r4.booleanValue() != false) goto L_0x0027; */ public final Boolean call(Boolean bool, Boolean bool2, Boolean bool3, Boolean bool4) { boolean z2; m.checkNotNullExpressionValue(bool, "experimentsInitialized"); if (bool.booleanValue()) { m.checkNotNullExpressionValue(bool4, "cachesInitialized"); if (bool4.booleanValue()) { if (bool2.booleanValue()) { m.checkNotNullExpressionValue(bool3, "channelsSelectedInitialized"); } z2 = true; return Boolean.valueOf(z2); } } z2 = false; return Boolean.valueOf(z2); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$12 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass12 extends k implements Function1 { public AnonymousClass12(BehaviorSubject behaviorSubject) { super(1, behaviorSubject, BehaviorSubject.class, "onNext", "onNext(Ljava/lang/Object;)V", 0); } /* 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(Boolean bool) { invoke(bool); return Unit.a; } public final void invoke(Boolean bool) { ((BehaviorSubject) this.receiver).onNext(bool); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$2 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass2 extends k implements Function1 { public AnonymousClass2(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleAuthToken", "handleAuthToken(Ljava/lang/String;)V", 0); } /* 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(String str) { invoke(str); return Unit.a; } public final void invoke(String str) { StoreStream.access$handleAuthToken((StoreStream) this.receiver, str); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$3 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass3 extends k implements Function1 { public AnonymousClass3(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleFingerprint", "handleFingerprint(Ljava/lang/String;)V", 0); } /* 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(String str) { invoke(str); return Unit.a; } public final void invoke(String str) { StoreStream.access$handleFingerprint((StoreStream) this.receiver, str); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$4 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass4 extends k implements Function1 { public AnonymousClass4(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleMessagesLoaded", "handleMessagesLoaded(Lcom/discord/stores/StoreMessagesLoader$ChannelChunk;)V", 0); } /* 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(StoreMessagesLoader.ChannelChunk channelChunk) { invoke(channelChunk); return Unit.a; } public final void invoke(StoreMessagesLoader.ChannelChunk channelChunk) { m.checkNotNullParameter(channelChunk, "p1"); StoreStream.access$handleMessagesLoaded((StoreStream) this.receiver, channelChunk); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$5 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass5 extends k implements Function1 { public AnonymousClass5(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleChannelSelected", "handleChannelSelected(J)V", 0); } /* 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(Long l) { invoke(l.longValue()); return Unit.a; } public final void invoke(long j) { StoreStream.access$handleChannelSelected((StoreStream) this.receiver, j); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$6 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass6 extends k implements Function1 { public AnonymousClass6(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleVoiceChannelSelected", "handleVoiceChannelSelected(J)V", 0); } /* 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(Long l) { invoke(l.longValue()); return Unit.a; } public final void invoke(long j) { StoreStream.access$handleVoiceChannelSelected((StoreStream) this.receiver, j); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$7 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass7 extends k implements Function1, Unit> { public AnonymousClass7(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleSpeakingUsers", "handleSpeakingUsers(Ljava/util/Set;)V", 0); } /* 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(Set set) { invoke((Set) set); return Unit.a; } public final void invoke(Set set) { m.checkNotNullParameter(set, "p1"); StoreStream.access$handleSpeakingUsers((StoreStream) this.receiver, set); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$8 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass8 extends k implements Function1 { public AnonymousClass8(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleRtcConnectionStateChanged", "handleRtcConnectionStateChanged(Lcom/discord/rtcconnection/RtcConnection$StateChange;)V", 0); } /* 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(RtcConnection.StateChange stateChange) { invoke(stateChange); return Unit.a; } public final void invoke(RtcConnection.StateChange stateChange) { m.checkNotNullParameter(stateChange, "p1"); StoreStream.access$handleRtcConnectionStateChanged((StoreStream) this.receiver, stateChange); } } /* compiled from: StoreStream.kt */ /* renamed from: com.discord.stores.StoreStream$deferredInit$1$9 reason: invalid class name */ public static final /* synthetic */ class AnonymousClass9 extends k implements Function1, Unit> { public AnonymousClass9(StoreStream storeStream) { super(1, storeStream, StoreStream.class, "handleSpeakingUpdates", "handleSpeakingUpdates(Ljava/util/List;)V", 0); } /* 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(List list) { invoke((List) list); return Unit.a; } public final void invoke(List list) { m.checkNotNullParameter(list, "p1"); StoreStream.access$handleSpeakingUpdates((StoreStream) this.receiver, list); } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public StoreStream$deferredInit$1(StoreStream storeStream, Application application) { super(0); this.this$0 = storeStream; this.$context = application; } @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public final void mo1invoke() { TimeElapsed timeElapsed = new TimeElapsed(StoreStream.access$getClock$p(this.this$0), 0, 2, null); NetworkMonitor networkMonitor = new NetworkMonitor(this.$context, AppLog.g); ContactsFetcher contactsFetcher = new ContactsFetcher(this.$context); StoreStream.access$startStoreInitializationTimer(this.this$0, networkMonitor); this.this$0.getExperiments$app_productionBetaRelease().init(this.$context); AudioManagerFeatureFlag audioManagerFeatureFlag = AudioManagerFeatureFlag.b; AudioManagerFeatureFlag a = AudioManagerFeatureFlag.a(); StoreExperiments experiments$app_productionBetaRelease = this.this$0.getExperiments$app_productionBetaRelease(); Objects.requireNonNull(a); m.checkNotNullParameter(experiments$app_productionBetaRelease, "storeExperiments"); Observable F = experiments$app_productionBetaRelease.observeUserExperiment("2021-05_opensl_default_enable_android", true).x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE); m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }"); Observable Z = F.Z(1); m.checkNotNullExpressionValue(Z, "storeExperiments.observe…erNull()\n .take(1)"); ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.computationLatest(Z), AudioManagerFeatureFlag.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new k0(a), 62, (Object) null); this.this$0.getMediaEngine$app_productionBetaRelease().init(this.$context); this.this$0.getAccessibility$app_productionBetaRelease().init(this.$context); this.this$0.getGatewaySocket$app_productionBetaRelease().init(this.$context, networkMonitor); this.this$0.getNavigation$app_productionBetaRelease().init(this.$context); this.this$0.getNux$app_productionBetaRelease().init(this.$context); this.this$0.getChannels$app_productionBetaRelease().init(); this.this$0.getUsers$app_productionBetaRelease().init(this.$context); this.this$0.getGuilds$app_productionBetaRelease().init(this.$context); this.this$0.getPermissions$app_productionBetaRelease().init(); this.this$0.getGuildsSorted$app_productionBetaRelease().init(this.$context); this.this$0.getGuildsNsfw$app_productionBetaRelease().init(this.$context); this.this$0.getGuildSelected$app_productionBetaRelease().init(this.$context); this.this$0.getChannelsSelected$app_productionBetaRelease().init(); this.this$0.getMediaSettings$app_productionBetaRelease().init(); this.this$0.getMessages$app_productionBetaRelease().init(this.$context); this.this$0.getMessagesLoader$app_productionBetaRelease().init(this.$context); this.this$0.getMessageAck$app_productionBetaRelease().init(this.$context); this.this$0.getMessagesMostRecent$app_productionBetaRelease().init(this.$context); this.this$0.getNotifications$app_productionBetaRelease().init(this.$context); this.this$0.getRtcConnection$app_productionBetaRelease().init(this.$context, networkMonitor); this.this$0.getReadStates$app_productionBetaRelease().init(this.$context); this.this$0.getVoiceChannelSelected$app_productionBetaRelease().init(this.$context); this.this$0.getVoiceSpeaking$app_productionBetaRelease().init(this.$context); this.this$0.getVoiceParticipants$app_productionBetaRelease().init(this.$context); this.this$0.getConnectivity$app_productionBetaRelease().init(networkMonitor); this.this$0.getClientVersion$app_productionBetaRelease().init(this.$context); this.this$0.getMediaSettings$app_productionBetaRelease().init(this.$context); this.this$0.getAnalytics$app_productionBetaRelease().init(this.$context); this.this$0.getCollapsedChannelCategories$app_productionBetaRelease().init(this.$context); StoreStream.access$getAudioManager$p(this.this$0).init(this.$context); this.this$0.getGuildSettings$app_productionBetaRelease().init(this.$context); this.this$0.getNotices$app_productionBetaRelease().init(this.$context); this.this$0.getUserConnections$app_productionBetaRelease().init(this.$context); this.this$0.getChangeLogStore$app_productionBetaRelease().init(this.$context); this.this$0.getReviewRequestStore$app_productionBetaRelease().init(this.$context); this.this$0.getPresences$app_productionBetaRelease().init(this.$context); this.this$0.getSpotify$app_productionBetaRelease().init(this.$context); StoreStream.access$getStreamRtcConnection$p(this.this$0).init(networkMonitor); this.this$0.getGuildsSorted$app_productionBetaRelease().init(this.$context); this.this$0.getExpandedGuildFolders$app_productionBetaRelease().init(this.$context); this.this$0.getAudioDevices$app_productionBetaRelease().init(); this.this$0.getUserRelationships$app_productionBetaRelease().init(); this.this$0.getMaskedLinks$app_productionBetaRelease().init(this.$context); this.this$0.getRtcRegion$app_productionBetaRelease().init(); this.this$0.getStickers$app_productionBetaRelease().init(); this.this$0.getGooglePlayPurchases$app_productionBetaRelease().init(this.$context); this.this$0.getPhone$app_productionBetaRelease().init(this.$context); this.this$0.getApplicationInteractions$app_productionBetaRelease().init(this.$context); this.this$0.getStageSelfPresence$app_productionBetaRelease().init(); this.this$0.getContactSync$app_productionBetaRelease().init(contactsFetcher); this.this$0.getAudioManagerV2$app_productionBetaRelease().init(this.$context); this.this$0.getOutboundPromotions$app_productionBetaRelease().init(this.$context); StoreStream storeStream = this.this$0; StoreStream.access$dispatchSubscribe(storeStream, storeStream.getAuthentication$app_productionBetaRelease().getPreLogoutSignal$app_productionBetaRelease(), "streamPreLogout", new AnonymousClass1(this)); StoreStream storeStream2 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream2, storeStream2.getAuthentication$app_productionBetaRelease().getAuthedToken$app_productionBetaRelease(), "streamAuthedToken", new AnonymousClass2(this.this$0)); StoreStream storeStream3 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream3, storeStream3.getAuthentication$app_productionBetaRelease().getFingerPrint$app_productionBetaRelease(), "streamAuthedFingerprint", new AnonymousClass3(this.this$0)); StoreStream storeStream4 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream4, storeStream4.getMessagesLoader$app_productionBetaRelease().get(), "streamMessagesLoaded", new AnonymousClass4(this.this$0)); StoreStream storeStream5 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream5, storeStream5.getChannelsSelected$app_productionBetaRelease().observeId(), "streamChannelSelected", new AnonymousClass5(this.this$0)); StoreStream storeStream6 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream6, storeStream6.getVoiceChannelSelected$app_productionBetaRelease().observeSelectedVoiceChannelId(), "streamVoiceChannelSelected", new AnonymousClass6(this.this$0)); StoreStream storeStream7 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream7, storeStream7.getVoiceSpeaking$app_productionBetaRelease().observeSpeakingUsers(), "streamUserSpeaking", new AnonymousClass7(this.this$0)); StoreStream storeStream8 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream8, storeStream8.getRtcConnection$app_productionBetaRelease().getConnectionState(), "streamRtcConnectionStateChanged", new AnonymousClass8(this.this$0)); StoreStream storeStream9 = this.this$0; StoreStream.access$dispatchSubscribe(storeStream9, storeStream9.getRtcConnection$app_productionBetaRelease().getSpeakingUpdates(), "streamRtcSpeakingUpdates", new AnonymousClass9(this.this$0)); StoreStream.access$initGatewaySocketListeners(this.this$0); StoreStream.access$dispatchSubscribe(this.this$0, d.d.a(), "streamBackgrounded", new AnonymousClass10(this.this$0)); StoreStream storeStream10 = this.this$0; Observable h = Observable.h(storeStream10.getExperiments$app_productionBetaRelease().isInitialized().r(), this.this$0.getAuthentication$app_productionBetaRelease().observeIsAuthed$app_productionBetaRelease(), this.this$0.getChannelsSelected$app_productionBetaRelease().observeInitializedForAuthedUser(), Persister.Companion.isPreloaded(), AnonymousClass11.INSTANCE); m.checkNotNullExpressionValue(h, "Observable\n .comb…tedInitialized)\n }"); StoreStream.access$dispatchSubscribe(storeStream10, h, "streamInit", new AnonymousClass12(StoreStream.access$getInitialized$p(this.this$0))); AppLog.i("[StoreStream] Application stores initialized in: " + timeElapsed.getSeconds() + " seconds."); VoiceEngineServiceController.Companion.getINSTANCE().init(this.$context); StoreStream storeStream11 = this.this$0; StoreStream.access$maybeLogNotificationPermissionStatus(storeStream11, this.$context, StoreStream.access$getClock$p(storeStream11)); } }