discord-jadx/app/src/main/java/com/discord/utilities/systemlog/SystemLogReport.java

55 lines
2.7 KiB
Java

package com.discord.utilities.systemlog;
import android.content.Context;
import android.content.SharedPreferences;
import com.discord.utilities.analytics.AnalyticsTracker;
import com.discord.utilities.cache.SharedPreferencesProvider;
import com.discord.utilities.debug.HistoricalProcessExitReason;
import com.discord.utilities.rx.ObservableExtensionsKt;
import com.discord.utilities.systemlog.SystemLogUtils;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import d0.z.d.m;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
/* compiled from: SystemLogReport.kt */
public final class SystemLogReport {
private static final String CACHE_KEY_LAST_STORED_TOMBSTONE_HASH = "CACHE_KEY_SYSTEM_LOG_STORE_LAST_STORED_TOMBSTONE_HASH";
public static final SystemLogReport INSTANCE = new SystemLogReport();
private SystemLogReport() {
}
public static final /* synthetic */ boolean access$checkHashChanged(SystemLogReport systemLogReport, String str) {
return systemLogReport.checkHashChanged(str);
}
public static final /* synthetic */ void access$sendReport(SystemLogReport systemLogReport, SystemLogUtils.Tombstone tombstone) {
systemLogReport.sendReport(tombstone);
}
private final boolean checkHashChanged(String str) {
if (m.areEqual(getPrefsSessionDurable().getString(CACHE_KEY_LAST_STORED_TOMBSTONE_HASH, null), str)) {
return false;
}
SharedPreferences.Editor edit = getPrefsSessionDurable().edit();
m.checkNotNullExpressionValue(edit, "editor");
edit.putString(CACHE_KEY_LAST_STORED_TOMBSTONE_HASH, str);
edit.apply();
return true;
}
private final SharedPreferences getPrefsSessionDurable() {
return SharedPreferencesProvider.INSTANCE.getPrefsSessionDurable();
}
private final void sendReport(SystemLogUtils.Tombstone tombstone) {
boolean didCrashOnPreviousExecution = FirebaseCrashlytics.getInstance().didCrashOnPreviousExecution();
HistoricalProcessExitReason.Reason lastReason = HistoricalProcessExitReason.INSTANCE.getLastReason();
AnalyticsTracker.INSTANCE.appNativeCrash(didCrashOnPreviousExecution, lastReason != null ? lastReason.getReason() : null, lastReason != null ? lastReason.getReason() : null, tombstone != null ? tombstone.getGroupHash() : null, tombstone != null ? tombstone.getCause() : null);
}
public final void reportLastCrash() {
ObservableExtensionsKt.appSubscribe$default(SystemLogUtils.INSTANCE.fetchLastTombstone(), SystemLogReport.class, (Context) null, (Function1) null, SystemLogReport$reportLastCrash$1.INSTANCE, (Function0) null, (Function0) null, SystemLogReport$reportLastCrash$2.INSTANCE, 54, (Object) null);
}
}