Files
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

253 lines
12 KiB
Java

package com.google.firebase.sessions.settings;
import androidx.datastore.core.DataStore;
import androidx.datastore.preferences.core.Preferences;
import androidx.datastore.preferences.core.PreferencesKeys;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt__BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.flow.Flow;
import kotlinx.coroutines.flow.FlowKt;
/* loaded from: classes3.dex */
public final class SettingsCache {
public final DataStore dataStore;
public SessionConfigs sessionConfigs;
public static final Companion Companion = new Companion(null);
public static final Preferences.Key SESSIONS_ENABLED = PreferencesKeys.booleanKey("firebase_sessions_enabled");
public static final Preferences.Key SAMPLING_RATE = PreferencesKeys.doubleKey("firebase_sessions_sampling_rate");
public static final Preferences.Key RESTART_TIMEOUT_SECONDS = PreferencesKeys.intKey("firebase_sessions_restart_timeout");
public static final Preferences.Key CACHE_DURATION_SECONDS = PreferencesKeys.intKey("firebase_sessions_cache_duration");
public static final Preferences.Key CACHE_UPDATED_TIME = PreferencesKeys.longKey("firebase_sessions_cache_updated_time");
public SettingsCache(DataStore dataStore) {
Intrinsics.checkNotNullParameter(dataStore, "dataStore");
this.dataStore = dataStore;
BuildersKt__BuildersKt.runBlocking$default(null, new AnonymousClass1(null), 1, null);
}
/* renamed from: com.google.firebase.sessions.settings.SettingsCache$1, reason: invalid class name */
public static final class AnonymousClass1 extends SuspendLambda implements Function2 {
public Object L$0;
public int label;
public AnonymousClass1(Continuation continuation) {
super(2, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation create(Object obj, Continuation continuation) {
return SettingsCache.this.new AnonymousClass1(continuation);
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) {
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended;
SettingsCache settingsCache;
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
SettingsCache settingsCache2 = SettingsCache.this;
Flow data = settingsCache2.dataStore.getData();
this.L$0 = settingsCache2;
this.label = 1;
Object first = FlowKt.first(data, this);
if (first == coroutine_suspended) {
return coroutine_suspended;
}
settingsCache = settingsCache2;
obj = first;
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
settingsCache = (SettingsCache) this.L$0;
ResultKt.throwOnFailure(obj);
}
settingsCache.updateSessionConfigs(((Preferences) obj).toPreferences());
return Unit.INSTANCE;
}
}
public final void updateSessionConfigs(Preferences preferences) {
this.sessionConfigs = new SessionConfigs((Boolean) preferences.get(SESSIONS_ENABLED), (Double) preferences.get(SAMPLING_RATE), (Integer) preferences.get(RESTART_TIMEOUT_SECONDS), (Integer) preferences.get(CACHE_DURATION_SECONDS), (Long) preferences.get(CACHE_UPDATED_TIME));
}
public final boolean hasCacheExpired$com_google_firebase_firebase_sessions() {
SessionConfigs sessionConfigs = this.sessionConfigs;
SessionConfigs sessionConfigs2 = null;
if (sessionConfigs == null) {
Intrinsics.throwUninitializedPropertyAccessException("sessionConfigs");
sessionConfigs = null;
}
Long cacheUpdatedTime = sessionConfigs.getCacheUpdatedTime();
SessionConfigs sessionConfigs3 = this.sessionConfigs;
if (sessionConfigs3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sessionConfigs");
} else {
sessionConfigs2 = sessionConfigs3;
}
Integer cacheDuration = sessionConfigs2.getCacheDuration();
return cacheUpdatedTime == null || cacheDuration == null || (System.currentTimeMillis() - cacheUpdatedTime.longValue()) / ((long) 1000) >= ((long) cacheDuration.intValue());
}
public final Boolean sessionsEnabled() {
SessionConfigs sessionConfigs = this.sessionConfigs;
if (sessionConfigs == null) {
Intrinsics.throwUninitializedPropertyAccessException("sessionConfigs");
sessionConfigs = null;
}
return sessionConfigs.getSessionEnabled();
}
public final Double sessionSamplingRate() {
SessionConfigs sessionConfigs = this.sessionConfigs;
if (sessionConfigs == null) {
Intrinsics.throwUninitializedPropertyAccessException("sessionConfigs");
sessionConfigs = null;
}
return sessionConfigs.getSessionSamplingRate();
}
public final Integer sessionRestartTimeout() {
SessionConfigs sessionConfigs = this.sessionConfigs;
if (sessionConfigs == null) {
Intrinsics.throwUninitializedPropertyAccessException("sessionConfigs");
sessionConfigs = null;
}
return sessionConfigs.getSessionRestartTimeout();
}
public final Object updateSettingsEnabled(Boolean bool, Continuation continuation) {
Object coroutine_suspended;
Object updateConfigValue = updateConfigValue(SESSIONS_ENABLED, bool, continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return updateConfigValue == coroutine_suspended ? updateConfigValue : Unit.INSTANCE;
}
public final Object updateSamplingRate(Double d, Continuation continuation) {
Object coroutine_suspended;
Object updateConfigValue = updateConfigValue(SAMPLING_RATE, d, continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return updateConfigValue == coroutine_suspended ? updateConfigValue : Unit.INSTANCE;
}
public final Object updateSessionRestartTimeout(Integer num, Continuation continuation) {
Object coroutine_suspended;
Object updateConfigValue = updateConfigValue(RESTART_TIMEOUT_SECONDS, num, continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return updateConfigValue == coroutine_suspended ? updateConfigValue : Unit.INSTANCE;
}
public final Object updateSessionCacheDuration(Integer num, Continuation continuation) {
Object coroutine_suspended;
Object updateConfigValue = updateConfigValue(CACHE_DURATION_SECONDS, num, continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return updateConfigValue == coroutine_suspended ? updateConfigValue : Unit.INSTANCE;
}
public final Object updateSessionCacheUpdatedTime(Long l, Continuation continuation) {
Object coroutine_suspended;
Object updateConfigValue = updateConfigValue(CACHE_UPDATED_TIME, l, continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return updateConfigValue == coroutine_suspended ? updateConfigValue : Unit.INSTANCE;
}
/* JADX WARN: Can't wrap try/catch for region: R(10:0|1|(2:3|(7:5|6|7|(1:(1:10)(2:16|17))(3:18|19|(1:21))|11|12|13))|24|6|7|(0)(0)|11|12|13) */
/* JADX WARN: Code restructure failed: missing block: B:22:0x0029, code lost:
r6 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:23:0x0047, code lost:
android.util.Log.w("SettingsCache", "Failed to update cache config value: " + r6);
*/
/* JADX WARN: Removed duplicated region for block: B:18:0x0033 */
/* JADX WARN: Removed duplicated region for block: B:9:0x0023 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Object updateConfigValue(androidx.datastore.preferences.core.Preferences.Key r6, java.lang.Object r7, kotlin.coroutines.Continuation r8) {
/*
r5 = this;
boolean r0 = r8 instanceof com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$1
if (r0 == 0) goto L13
r0 = r8
com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$1 r0 = (com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$1) r0
int r1 = r0.label
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = r1 & r2
if (r3 == 0) goto L13
int r1 = r1 - r2
r0.label = r1
goto L18
L13:
com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$1 r0 = new com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$1
r0.<init>(r5, r8)
L18:
java.lang.Object r8 = r0.result
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r2 = r0.label
r3 = 1
if (r2 == 0) goto L33
if (r2 != r3) goto L2b
kotlin.ResultKt.throwOnFailure(r8) // Catch: java.io.IOException -> L29
goto L5d
L29:
r6 = move-exception
goto L47
L2b:
java.lang.IllegalStateException r6 = new java.lang.IllegalStateException
java.lang.String r7 = "call to 'resume' before 'invoke' with coroutine"
r6.<init>(r7)
throw r6
L33:
kotlin.ResultKt.throwOnFailure(r8)
androidx.datastore.core.DataStore r8 = r5.dataStore // Catch: java.io.IOException -> L29
com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$2 r2 = new com.google.firebase.sessions.settings.SettingsCache$updateConfigValue$2 // Catch: java.io.IOException -> L29
r4 = 0
r2.<init>(r7, r6, r5, r4) // Catch: java.io.IOException -> L29
r0.label = r3 // Catch: java.io.IOException -> L29
java.lang.Object r6 = androidx.datastore.preferences.core.PreferencesKt.edit(r8, r2, r0) // Catch: java.io.IOException -> L29
if (r6 != r1) goto L5d
return r1
L47:
java.lang.StringBuilder r7 = new java.lang.StringBuilder
r7.<init>()
java.lang.String r8 = "Failed to update cache config value: "
r7.append(r8)
r7.append(r6)
java.lang.String r6 = r7.toString()
java.lang.String r7 = "SettingsCache"
android.util.Log.w(r7, r6)
L5d:
kotlin.Unit r6 = kotlin.Unit.INSTANCE
return r6
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.sessions.settings.SettingsCache.updateConfigValue(androidx.datastore.preferences.core.Preferences$Key, java.lang.Object, kotlin.coroutines.Continuation):java.lang.Object");
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public Companion() {
}
}
}