discord-jadx/app/src/main/java/com/discord/app/AppActivity.java

797 lines
34 KiB
Java

package com.discord.app;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.LocaleList;
import android.os.Looper;
import android.util.TypedValue;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.widget.TextViewCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.preference.PreferenceManager;
import c.a.d.j;
import c.a.d.k;
import c.a.d.l;
import com.discord.app.AppTransitionActivity;
import com.discord.models.domain.ModelUserSettings;
import com.discord.screenshot_detection.ScreenshotDetector;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreUserSettingsSystem;
import com.discord.utilities.ShareUtils;
import com.discord.utilities.accessibility.AccessibilityMonitor;
import com.discord.utilities.accessibility.AccessibilityUtils;
import com.discord.utilities.analytics.AnalyticsUtils;
import com.discord.utilities.billing.GooglePlayBillingManager;
import com.discord.utilities.bugreports.BugReportManager;
import com.discord.utilities.drawable.DrawableCompat;
import com.discord.utilities.font.FontUtils;
import com.discord.utilities.intent.IntentUtils;
import com.discord.utilities.lifecycle.ApplicationProvider;
import com.discord.utilities.media.AudioOutputMonitor;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.views.ToolbarTitleLayout;
import com.discord.widgets.debugging.WidgetFatalCrash;
import com.discord.widgets.share.WidgetIncomingShare;
import com.discord.widgets.tabs.NavigationTab;
import com.discord.widgets.tabs.WidgetTabsHost;
import com.discord.widgets.voice.call.WidgetVoiceCallIncoming;
import com.discord.widgets.voice.fullscreen.WidgetCallFullscreen;
import com.google.android.material.textfield.TextInputLayout;
import d0.z.d.a0;
import d0.z.d.m;
import d0.z.d.o;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import kotlin.Lazy;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import rx.subjects.PublishSubject;
import rx.subjects.Subject;
/* compiled from: AppActivity.kt */
public class AppActivity extends c.a.d.d implements AppComponent {
public static boolean l;
public static final Intent m = new Intent();
public static boolean n = true;
public final LinkedHashMap<Integer, Function1<Intent, Unit>> o = new LinkedHashMap<>();
public int p = -1;
public String q = "";
public boolean r = true;
/* renamed from: s reason: collision with root package name */
public final Subject<Void, Void> f1583s;
public Toolbar t;
public final Lazy u;
public Intent v;
public final AppPermissionsRequests w;
/* compiled from: AppActivity.kt */
public static final class AppAction extends AppActivity {
/* renamed from: x reason: collision with root package name */
public final Lazy f1584x = d0.g.lazy(new a(this));
/* compiled from: AppActivity.kt */
public static final class a extends o implements Function0<Class<? extends AppFragment>> {
public final /* synthetic */ AppAction this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(AppAction appAction) {
super(0);
this.this$0 = appAction;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public Class<? extends AppFragment> mo1invoke() {
int hashCode;
String action = this.this$0.c().getAction();
return (action != null && ((hashCode = action.hashCode()) == -1173264947 ? action.equals("android.intent.action.SEND") : !(hashCode == -1103390587 ? !action.equals("com.discord.intent.action.SDK") : hashCode != -58484670 || !action.equals("android.intent.action.SEND_MULTIPLE")))) ? WidgetIncomingShare.class : WidgetTabsHost.class;
}
}
@Override // com.discord.app.AppActivity
public Class<? extends AppComponent> d() {
return (Class) this.f1584x.getValue();
}
@Override // com.discord.app.AppActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
public void onCreate(Bundle bundle) {
AppActivity.super.onCreate(bundle);
if (AppActivity.l) {
finish();
}
}
}
/* compiled from: AppActivity.kt */
public static final class Call extends AppActivity {
/* renamed from: x reason: collision with root package name */
public final Class<? extends AppComponent> f1585x = WidgetCallFullscreen.class;
@Override // com.discord.app.AppActivity
public Class<? extends AppComponent> d() {
return this.f1585x;
}
}
/* compiled from: AppActivity.kt */
public static final class IncomingCall extends AppActivity {
/* renamed from: x reason: collision with root package name */
public final Class<? extends AppComponent> f1586x = WidgetVoiceCallIncoming.SystemCallIncoming.class;
@Override // com.discord.app.AppActivity
public Class<? extends AppComponent> d() {
return this.f1586x;
}
}
/* compiled from: AppActivity.kt */
public static final class Main extends AppActivity {
}
/* compiled from: kotlin-style lambda group */
public static final class a extends o implements Function0<Unit> {
public final /* synthetic */ int i;
public final /* synthetic */ Object j;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(int i, Object obj) {
super(0);
this.i = i;
this.j = obj;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final Unit mo1invoke() {
int i = this.i;
if (i == 0) {
mo1invoke();
return Unit.a;
} else if (i == 1) {
mo1invoke();
return Unit.a;
} else {
throw null;
}
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke reason: collision with other method in class */
public final void mo1invoke() {
int i = this.i;
AppTransitionActivity.a aVar = null;
boolean z2 = true;
if (i == 0) {
AppActivity appActivity = (AppActivity) this.j;
AppActivity.l = IntentUtils.INSTANCE.consumeExternalRoutingIntent(appActivity.c(), appActivity);
Intent c2 = ((AppActivity) this.j).c();
AppActivity appActivity2 = (AppActivity) this.j;
Objects.requireNonNull(appActivity2);
Serializable serializableExtra = c2 != null ? c2.getSerializableExtra("transition") : null;
if (!(serializableExtra instanceof AppTransitionActivity.Transition)) {
serializableExtra = null;
}
AppTransitionActivity.Transition transition = (AppTransitionActivity.Transition) serializableExtra;
if (AccessibilityUtils.INSTANCE.isReducedMotionEnabled()) {
transition = AppTransitionActivity.Transition.TYPE_FADE_FAST;
} else if (transition == null) {
l lVar = l.g;
transition = appActivity2.g(l.d) ? AppTransitionActivity.Transition.TYPE_SLIDE_HORIZONTAL : null;
}
if (transition != null) {
aVar = transition.getAnimations();
}
appActivity2.j = aVar;
if (((AppActivity) this.j).getSupportFragmentManager().findFragmentByTag(((AppActivity) this.j).d().getName()) == null) {
z2 = false;
}
if (!z2) {
l lVar2 = l.g;
FragmentManager supportFragmentManager = ((AppActivity) this.j).getSupportFragmentManager();
AppActivity appActivity3 = (AppActivity) this.j;
Class<? extends AppComponent> d = appActivity3.d();
m.checkNotNullParameter(appActivity3, "context");
m.checkNotNullParameter(d, "screen");
if (supportFragmentManager != null) {
FragmentTransaction beginTransaction = supportFragmentManager.beginTransaction();
m.checkNotNullExpressionValue(beginTransaction, "fragmentManager.beginTransaction()");
Fragment instantiate = Fragment.instantiate(appActivity3, d.getName());
m.checkNotNullExpressionValue(instantiate, "Fragment.instantiate(context, screen.name)");
beginTransaction.replace(16908290, instantiate, d.getName());
beginTransaction.commit();
}
}
} else if (i == 1) {
Objects.requireNonNull((AppActivity) this.j);
AppActivity appActivity4 = (AppActivity) this.j;
if (appActivity4.t == null) {
appActivity4.n((Toolbar) appActivity4.findViewById(2131361871));
}
} else {
throw null;
}
}
}
/* compiled from: AppActivity.kt */
public static final class b extends o implements Function0<Unit> {
public static final b i = new b();
public b() {
super(0);
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
if (AppActivity.n) {
AppActivity.n = false;
AppLog.i("Application activity initialized.");
StoreStream.Companion companion = StoreStream.Companion;
ApplicationProvider applicationProvider = ApplicationProvider.INSTANCE;
companion.initialize(applicationProvider.get());
AnalyticsUtils.INSTANCE.initAppOpen(applicationProvider.get());
AudioManagerFeatureFlag audioManagerFeatureFlag = AudioManagerFeatureFlag.b;
if (!AudioManagerFeatureFlag.a().b()) {
AudioOutputMonitor.Companion.initialize(applicationProvider.get());
}
AccessibilityMonitor.Companion.initialize(applicationProvider.get());
ShareUtils.INSTANCE.updateDirectShareTargets(applicationProvider.get());
GooglePlayBillingManager.INSTANCE.init(applicationProvider.get());
AppLog appLog = AppLog.g;
m.checkNotNullParameter(appLog, "logger");
Application application = applicationProvider.get();
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(applicationProvider.get());
m.checkNotNullExpressionValue(defaultSharedPreferences, "PreferenceManager.getDef…pplicationProvider.get())");
ScreenshotDetector.a = new ScreenshotDetector(application, appLog, defaultSharedPreferences);
BugReportManager.Companion.init();
}
}
}
/* compiled from: AppActivity.kt */
public static final class c extends o implements Function1<StoreUserSettingsSystem.Settings, Unit> {
public final /* synthetic */ AppActivity this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public c(AppActivity appActivity) {
super(1);
this.this$0 = appActivity;
}
/* 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] */
/* JADX WARNING: Removed duplicated region for block: B:18:0x0079 */
@Override // kotlin.jvm.functions.Function1
public Unit invoke(StoreUserSettingsSystem.Settings settings) {
boolean z2;
StoreUserSettingsSystem.Settings settings2 = settings;
m.checkNotNullParameter(settings2, "it");
AppActivity appActivity = this.this$0;
boolean z3 = AppActivity.l;
Objects.requireNonNull(appActivity);
Locale localeObject = ModelUserSettings.getLocaleObject(settings2.getLocale());
m.checkNotNullExpressionValue(localeObject, "ModelUserSettings.getLocaleObject(model.locale)");
if (appActivity.f(localeObject)) {
appActivity.b(settings2.getLocale(), true);
} else {
String theme = settings2.getTheme();
c.a.d.c cVar = new c.a.d.c(appActivity);
TypedValue typedValue = new TypedValue();
cVar.this$0.getTheme().resolveAttribute(2130970194, typedValue, true);
if (!(!m.areEqual(typedValue.string, theme))) {
int fontScale = settings2.getFontScale();
FontUtils fontUtils = FontUtils.INSTANCE;
ContentResolver contentResolver = appActivity.getContentResolver();
m.checkNotNullExpressionValue(contentResolver, "contentResolver");
if (!((fontScale == -1 && appActivity.p != fontUtils.getSystemFontScaleInt(contentResolver)) || !(fontScale == -1 || appActivity.p == fontScale))) {
z2 = false;
if (z2) {
AppActivity.i(this.this$0, false, 1, null);
}
return Unit.a;
}
}
}
z2 = true;
if (z2) {
}
return Unit.a;
}
}
/* compiled from: AppActivity.kt */
public static final class d extends o implements Function1<ScreenshotDetector.Screenshot, Unit> {
public final /* synthetic */ AppActivity this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public d(AppActivity appActivity) {
super(1);
this.this$0 = appActivity;
}
/* 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 Unit invoke(ScreenshotDetector.Screenshot screenshot) {
ScreenshotDetector.Screenshot screenshot2 = screenshot;
m.checkNotNullParameter(screenshot2, "screenshot");
BugReportManager.Companion.get().onScreenshot(this.this$0, screenshot2);
return Unit.a;
}
}
/* compiled from: AppActivity.kt */
public static final class e extends o implements Function0<Class<? extends AppComponent>> {
public final /* synthetic */ AppActivity this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public e(AppActivity appActivity) {
super(0);
this.this$0 = appActivity;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public Class<? extends AppComponent> mo1invoke() {
Intent intent = this.this$0.getIntent();
Class<? extends AppComponent> cls = (Class) (intent != null ? intent.getSerializableExtra("com.discord.intent.extra.EXTRA_SCREEN") : null);
return cls != null ? cls : WidgetTabsHost.class;
}
}
/* compiled from: AppActivity.kt */
public static final class f implements Runnable {
public final /* synthetic */ View i;
public final /* synthetic */ InputMethodManager j;
public f(View view, InputMethodManager inputMethodManager) {
this.i = view;
this.j = inputMethodManager;
}
@Override // java.lang.Runnable
public final void run() {
try {
View view = this.i;
if (view instanceof TextInputLayout) {
view = ((TextInputLayout) view).getEditText();
if (view == null) {
view = this.i;
}
}
view.requestFocus();
this.j.showSoftInput(view, 2);
} catch (Exception e) {
AppLog.g.d("Error Opening/Closing the Keyboard", e);
}
}
}
/* compiled from: AppActivity.kt */
public static final class g implements View.OnClickListener {
public final /* synthetic */ AppActivity i;
public g(AppActivity appActivity) {
this.i = appActivity;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
AppActivity appActivity = this.i;
boolean z2 = AppActivity.l;
appActivity.hideKeyboard(null);
this.i.onBackPressed();
}
}
public AppActivity() {
PublishSubject k0 = PublishSubject.k0();
m.checkNotNullExpressionValue(k0, "PublishSubject.create()");
this.f1583s = k0;
this.u = d0.g.lazy(new e(this));
this.v = m;
int i = AppPermissionsRequests.a;
m.checkNotNullParameter(this, "activity");
this.w = new j(this);
}
public static void i(AppActivity appActivity, boolean z2, int i, Object obj) {
if ((i & 1) != 0) {
z2 = true;
}
if (appActivity.r) {
appActivity.finish();
if (z2) {
AppTransitionActivity.Transition transition = AppTransitionActivity.Transition.TYPE_FADE;
appActivity.overridePendingTransition(transition.getAnimations().f1589c, transition.getAnimations().d);
appActivity.getIntent().putExtra("transition", transition);
}
l.d(appActivity, appActivity.d(), appActivity.getIntent());
}
}
@Override // android.view.ContextThemeWrapper
public void applyOverrideConfiguration(Configuration configuration) {
if (configuration != null) {
int i = configuration.uiMode;
Context baseContext = getBaseContext();
m.checkNotNullExpressionValue(baseContext, "baseContext");
Resources resources = baseContext.getResources();
m.checkNotNullExpressionValue(resources, "baseContext.resources");
configuration.setTo(resources.getConfiguration());
configuration.uiMode = i;
}
super.applyOverrideConfiguration(configuration);
}
@Override // androidx.appcompat.app.AppCompatActivity, android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper
public void attachBaseContext(Context context) {
b.i.mo1invoke();
if (context == null) {
context = this;
}
if (!n) {
Resources resources = context.getResources();
m.checkNotNullExpressionValue(resources, "oldContext.resources");
Configuration configuration = resources.getConfiguration();
float targetFontScaleFloat = FontUtils.INSTANCE.getTargetFontScaleFloat(context);
configuration.fontScale = targetFontScaleFloat;
this.p = d0.a0.a.roundToInt(targetFontScaleFloat * 100.0f);
context = context.createConfigurationContext(configuration);
m.checkNotNullExpressionValue(context, "oldContext.createConfigurationContext(config)");
}
super.attachBaseContext(context);
}
public final void b(String str, boolean z2) {
Locale localeObject = ModelUserSettings.getLocaleObject(str);
m.checkNotNullExpressionValue(localeObject, "locale");
if (f(localeObject)) {
Locale.setDefault(localeObject);
if (Build.VERSION.SDK_INT >= 24) {
Resources resources = getResources();
m.checkNotNullExpressionValue(resources, "resources");
resources.getConfiguration().setLocale(localeObject);
} else {
Resources resources2 = getResources();
m.checkNotNullExpressionValue(resources2, "resources");
resources2.getConfiguration().locale = localeObject;
}
Resources resources3 = getResources();
Resources resources4 = getResources();
m.checkNotNullExpressionValue(resources4, "resources");
Configuration configuration = resources4.getConfiguration();
Resources resources5 = getResources();
m.checkNotNullExpressionValue(resources5, "resources");
resources3.updateConfiguration(configuration, resources5.getDisplayMetrics());
if (z2) {
i(this, false, 1, null);
}
}
}
public final Intent c() {
Intent intent = this.v;
Intent intent2 = m;
if (intent != intent2) {
return intent;
}
Intent intent3 = getIntent();
return intent3 != null ? intent3 : new Intent(intent2);
}
public Class<? extends AppComponent> d() {
return (Class) this.u.getValue();
}
public final ToolbarTitleLayout e() {
Toolbar toolbar = this.t;
ToolbarTitleLayout toolbarTitleLayout = null;
View childAt = toolbar != null ? toolbar.getChildAt(0) : null;
if (childAt instanceof ToolbarTitleLayout) {
toolbarTitleLayout = childAt;
}
return toolbarTitleLayout;
}
public final boolean f(Locale locale) {
if (Build.VERSION.SDK_INT >= 24) {
Resources resources = getResources();
m.checkNotNullExpressionValue(resources, "resources");
Configuration configuration = resources.getConfiguration();
m.checkNotNullExpressionValue(configuration, "resources.configuration");
LocaleList locales = configuration.getLocales();
m.checkNotNullExpressionValue(locales, "resources.configuration.locales");
if (!locales.isEmpty()) {
Resources resources2 = getResources();
m.checkNotNullExpressionValue(resources2, "resources");
Configuration configuration2 = resources2.getConfiguration();
m.checkNotNullExpressionValue(configuration2, "resources.configuration");
if (!(!m.areEqual(configuration2.getLocales().get(0), locale))) {
return false;
}
}
} else {
Resources resources3 = getResources();
m.checkNotNullExpressionValue(resources3, "resources");
if (resources3.getConfiguration().locale != null) {
Resources resources4 = getResources();
m.checkNotNullExpressionValue(resources4, "resources");
if (!(!m.areEqual(resources4.getConfiguration().locale, locale))) {
return false;
}
}
}
return true;
}
public final boolean g(List<? extends d0.e0.c<? extends AppComponent>> list) {
m.checkNotNullParameter(list, "screens");
if ((list instanceof Collection) && list.isEmpty()) {
return false;
}
Iterator<T> it = list.iterator();
while (it.hasNext()) {
if (m.areEqual(d0.z.a.getJavaClass((d0.e0.c) it.next()), d())) {
return true;
}
}
return false;
}
@Override // com.discord.app.AppComponent
public Subject<Void, Void> getUnsubscribeSignal() {
return this.f1583s;
}
public final boolean h(d0.e0.c<? extends AppComponent> cVar) {
m.checkNotNullParameter(cVar, "screen");
return m.areEqual(d0.z.a.getJavaClass(cVar), d());
}
public final void hideKeyboard(View view) {
m(false, view);
}
public final void j(Context context) {
m.checkNotNullParameter(context, "context");
if (!h(a0.getOrCreateKotlinClass(WidgetTabsHost.class))) {
List<d0.e0.c<? extends AppFragment>> list = l.a;
m.checkNotNullParameter(context, "context");
Intent intent = new Intent();
intent.addFlags(67108864);
l.c(context, false, intent, 2);
}
}
public final Toolbar k(boolean z2, @DrawableRes Integer num, @StringRes Integer num2, @ColorInt Integer num3) {
Toolbar toolbar = this.t;
Drawable drawable = null;
if (toolbar == null) {
return null;
}
if (z2) {
int themedDrawableRes$default = DrawableCompat.getThemedDrawableRes$default(toolbar, 2130969368, 0, 2, (Object) null);
Context context = toolbar.getContext();
if (num != null) {
themedDrawableRes$default = num.intValue();
}
drawable = ContextCompat.getDrawable(context, themedDrawableRes$default);
if (!(num3 == null || drawable == null)) {
androidx.core.graphics.drawable.DrawableCompat.setTint(drawable, num3.intValue());
}
toolbar.setNavigationContentDescription(getString(2131886808));
}
toolbar.setNavigationIcon(drawable);
if (num2 == null) {
return toolbar;
}
toolbar.setNavigationContentDescription(getString(num2.intValue()));
return toolbar;
}
public final Unit l(CharSequence charSequence, @DrawableRes Integer num) {
ToolbarTitleLayout e2 = e();
if (e2 == null) {
return null;
}
TextView textView = e2.i.f147c;
m.checkNotNullExpressionValue(textView, "binding.toolbarTitle");
textView.setText(charSequence);
if (num != null) {
Resources resources = e2.getResources();
int intValue = num.intValue();
Context context = e2.getContext();
m.checkNotNullExpressionValue(context, "context");
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(e2.i.f147c, ResourcesCompat.getDrawable(resources, intValue, context.getTheme()), (Drawable) null, (Drawable) null, (Drawable) null);
} else {
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(e2.i.f147c, (Drawable) null, (Drawable) null, (Drawable) null, (Drawable) null);
}
return Unit.a;
}
public final void m(boolean z2, View view) {
IBinder iBinder;
View childAt;
Object systemService = getSystemService("input_method");
Objects.requireNonNull(systemService, "null cannot be cast to non-null type android.view.inputmethod.InputMethodManager");
InputMethodManager inputMethodManager = (InputMethodManager) systemService;
if (view == null || (iBinder = view.getWindowToken()) == null) {
FrameLayout frameLayout = (FrameLayout) findViewById(16908290);
iBinder = (frameLayout == null || (childAt = frameLayout.getChildAt(0)) == null) ? null : childAt.getApplicationWindowToken();
}
if (!z2) {
try {
inputMethodManager.hideSoftInputFromWindow(iBinder, 0);
} catch (Exception e2) {
AppLog.g.d("Error Opening/Closing the Keyboard", e2);
}
} else if (view != null) {
view.postDelayed(new f(view, inputMethodManager), 250);
}
}
public final void n(Toolbar toolbar) {
this.t = toolbar;
if (e() == null) {
Toolbar toolbar2 = this.t;
if (toolbar2 != null) {
toolbar2.addView(new ToolbarTitleLayout(this), 0);
}
ToolbarTitleLayout e2 = e();
if (e2 != null) {
e2.setBackground(ContextCompat.getDrawable(this, DrawableCompat.getThemedDrawableRes$default(this, 2130969982, 0, 2, (Object) null)));
}
Toolbar toolbar3 = this.t;
if (toolbar3 != null) {
toolbar3.setNavigationOnClickListener(new g(this));
}
}
}
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
a aVar = new a(0, this);
boolean z2 = true;
a aVar2 = new a(1, this);
try {
StoreStream.Companion companion = StoreStream.Companion;
String theme = companion.getUserSettingsSystem().getTheme();
Lazy lazy = RebrandFeatureFlag.a;
int i = RebrandFeatureFlag.a().d;
if (i != 2) {
if (i != 3) {
z2 = false;
}
}
int i2 = 2131951648;
if (!z2 || !m.areEqual(theme, "light")) {
if (!z2 || !m.areEqual(theme, "dark")) {
if (z2 && m.areEqual(theme, "pureEvil")) {
i2 = 2131951651;
} else if (!z2) {
if (m.areEqual(theme, "light")) {
i2 = 2131951657;
} else if (!m.areEqual(theme, "dark")) {
if (m.areEqual(theme, "pureEvil")) {
i2 = 2131951650;
}
}
}
}
i2 = 2131951654;
} else {
i2 = 2131951661;
}
setTheme(i2);
b(companion.getUserSettingsSystem().getLocale(), false);
aVar.mo1invoke();
aVar2.mo1invoke();
if (!h(a0.getOrCreateKotlinClass(WidgetTabsHost.class)) || companion.getTabsNavigation().getSelectedTab() != NavigationTab.HOME) {
companion.getAnalytics().appUiViewed(d());
}
} catch (Exception e2) {
if (!h(a0.getOrCreateKotlinClass(WidgetFatalCrash.class))) {
WidgetFatalCrash.Companion companion2 = WidgetFatalCrash.Companion;
String name = d().getName();
m.checkNotNullExpressionValue(name, "screen.name");
companion2.launch(this, e2, name);
}
finish();
}
}
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
public void onDestroy() {
this.o.clear();
super.onDestroy();
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent == null) {
intent = m;
}
this.v = intent;
l = IntentUtils.INSTANCE.consumeExternalRoutingIntent(c(), this);
Intent c2 = c();
for (Map.Entry<Integer, Function1<Intent, Unit>> entry : this.o.entrySet()) {
entry.getValue().invoke(c2);
}
}
@Override // com.discord.app.AppTransitionActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
public void onPause() {
super.onPause();
this.f1583s.onNext(null);
}
@Override // com.discord.app.AppTransitionActivity, androidx.fragment.app.FragmentActivity, android.app.Activity
public void onResume() {
super.onResume();
l lVar = l.g;
m.checkNotNullParameter(this, "activity");
boolean booleanExtra = c().getBooleanExtra("INTENT_RECREATE", false);
if (booleanExtra) {
c().removeExtra("INTENT_RECREATE");
new Handler(Looper.getMainLooper()).post(new k(this));
}
if (!booleanExtra) {
StoreStream.Companion companion = StoreStream.Companion;
if (!(!m.areEqual(companion.getUserSettingsSystem().getLocale(), this.q)) || !(!m.areEqual(this.q, ""))) {
this.q = companion.getUserSettingsSystem().getLocale();
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(companion.getUserSettingsSystem().observeSettings(true), this, null, 2, null), getClass(), (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new c(this), 62, (Object) null);
ScreenshotDetector screenshotDetector = ScreenshotDetector.a;
if (screenshotDetector == null) {
m.throwUninitializedPropertyAccessException("screenshotDetector");
}
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(screenshotDetector.b, this, null, 2, null), getClass(), (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new d(this), 62, (Object) null);
return;
}
i(this, false, 1, null);
}
}
public final void showKeyboard(View view) {
m.checkNotNullParameter(view, "view");
m(true, view);
}
}