Files
rr3-apk/decompiled-community/sources/com/tapjoy/TJSession.java
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

237 lines
8.2 KiB
Java

package com.tapjoy;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import java.lang.ref.WeakReference;
import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;
import kotlin.TuplesKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes4.dex */
public final class TJSession {
public static final TJSession INSTANCE = new TJSession();
public static String a = "";
public static Integer b;
public static Integer c;
public static Integer d;
public static Long e;
public static Long f;
public static long g;
public static Long h;
public static volatile boolean i;
public static boolean j;
public static TJKeyValueStorage k;
public static boolean l;
public final String getSessionId() {
if (a.length() == 0) {
a = a();
}
return a;
}
public final Long getSessionLastDuration() {
return h;
}
public final Long getSessionLastLength() {
return h;
}
public final Long getSessionLastTime() {
return f;
}
public final int getSessionMonthlyFrequency() {
Integer num = c;
if (num != null) {
return num.intValue();
}
return 0;
}
public final int getSessionTotalCount() {
Integer num = d;
if (num != null) {
return num.intValue();
}
return 0;
}
public final Long getSessionTotalLength() {
return e;
}
public final int getSessionWeeklyFrequency() {
Integer num = b;
if (num != null) {
return num.intValue();
}
return 0;
}
public final boolean isSemiAutoSessionTrackingStarted() {
return j;
}
public final void onActivityStart(Activity activity) {
if (activity == null) {
TapjoyLog.e("TJSession", "onActivityStart: The given activity was null");
return;
}
com.tapjoy.internal.j.a(activity.getApplication());
com.tapjoy.internal.j.b++;
com.tapjoy.internal.j.c.a = new WeakReference(activity);
if (startSession()) {
com.tapjoy.internal.g.a(activity);
}
}
public final void onActivityStop(Activity activity) {
if (activity == null) {
TapjoyLog.e("TJSession", "onActivityStop: The given activity was null");
return;
}
int i2 = com.tapjoy.internal.j.b - 1;
com.tapjoy.internal.j.b = i2;
com.tapjoy.internal.j.c.a = null;
if (i2 < 0) {
com.tapjoy.internal.j.b = 0;
}
if (com.tapjoy.internal.j.b > 0) {
return;
}
endSession();
}
public final void setAutomaticSessionTracking(Context applicationContext, Hashtable<String, ?> hashtable) {
boolean equals;
Intrinsics.checkNotNullParameter(applicationContext, "applicationContext");
if (hashtable != null) {
equals = StringsKt__StringsJVMKt.equals(String.valueOf(hashtable.get(TapjoyConnectFlag.DISABLE_AUTOMATIC_SESSION_TRACKING)), "true", true);
if (equals) {
TapjoyLog.i("TJSession", "Automatic session tracking is disabled.");
return;
}
}
com.tapjoy.internal.c.a(applicationContext);
}
public final void setContext(Context context) {
Map mapOf;
if (context != null) {
TJKeyValueStorage tJKeyValueStorage = new TJKeyValueStorage(context, TapjoyConstants.TJC_PREFERENCE);
k = tJKeyValueStorage;
SharedPreferences sharedPreferences = context.getSharedPreferences("fiverocks", 0);
Intrinsics.checkNotNullExpressionValue(sharedPreferences, "getSharedPreferences(...)");
mapOf = MapsKt__MapsKt.mapOf(TuplesKt.to("fql", "pref_daily_frequency_last"), TuplesKt.to("fq", "pref_daily_frequency"), TuplesKt.to("ss", "pref_session_total_count"), TuplesKt.to("std", "pref_session_total_duration"), TuplesKt.to("slt", "pref_session_last_time"), TuplesKt.to("sld", "pref_session_last_duration"));
new TJPreferencesMigration(tJKeyValueStorage, sharedPreferences, mapOf, CollectionsKt__CollectionsKt.emptyList()).migrateAllKeysIfExists();
int i2 = tJKeyValueStorage.getInt("pref_daily_frequency", 0);
INSTANCE.getClass();
b = Integer.valueOf(Integer.bitCount(i2 & 127));
c = Integer.valueOf(Integer.bitCount(i2 & 1073741823));
int i3 = tJKeyValueStorage.getInt("pref_session_total_count", 0);
if (i3 > 0) {
d = Integer.valueOf(i3);
}
long j2 = tJKeyValueStorage.getLong("pref_session_total_duration", 0L);
if (j2 > 0) {
e = Long.valueOf(j2);
}
long j3 = tJKeyValueStorage.getLong("pref_session_last_time", 0L);
if (j3 > 0) {
f = Long.valueOf(j3);
}
long j4 = tJKeyValueStorage.getLong("pref_session_last_duration", 0L);
if (j4 > 0) {
h = Long.valueOf(j4);
}
}
}
public final void setSemiAutoSessionTrackingStarted(boolean z) {
j = z;
}
public static String a() {
TapjoyLog.i("TJSession", "generating sessionID...");
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
UUID randomUUID = UUID.randomUUID();
StringBuilder sb = new StringBuilder();
sb.append(currentTimeMillis);
sb.append(randomUUID);
String SHA256 = TapjoyUtil.SHA256(sb.toString());
Intrinsics.checkNotNullExpressionValue(SHA256, "SHA256(...)");
return SHA256;
} catch (Exception e2) {
TapjoyLog.e("TJSession", "unable to generate session id: " + e2);
return "";
}
}
public final Long getDuration() {
if (g > 0) {
return Long.valueOf(System.currentTimeMillis() - g);
}
return null;
}
public final void initSession() {
if (l) {
a = a();
l = false;
}
if (startSession()) {
com.tapjoy.internal.g.a(null);
}
}
/* JADX WARN: Removed duplicated region for block: B:25:0x00cf */
/* JADX WARN: Removed duplicated region for block: B:27:0x00d1 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final boolean startSession() {
/*
Method dump skipped, instructions count: 302
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.tapjoy.TJSession.startSession():boolean");
}
public final void endSession() {
l = true;
if (i) {
i = false;
TapjoyLog.i("TJSession", "The session ended");
long currentTimeMillis = System.currentTimeMillis() - g;
TJKeyValueStorage tJKeyValueStorage = k;
long j2 = (tJKeyValueStorage != null ? tJKeyValueStorage.getLong("pref_session_total_duration", 0L) : 0L) + currentTimeMillis;
TJKeyValueStorage tJKeyValueStorage2 = k;
if (tJKeyValueStorage2 != null) {
tJKeyValueStorage2.setValue("pref_session_total_duration", Long.valueOf(j2));
}
e = Long.valueOf(j2);
long currentTimeMillis2 = System.currentTimeMillis();
TJKeyValueStorage tJKeyValueStorage3 = k;
if (tJKeyValueStorage3 != null) {
tJKeyValueStorage3.setValue("pref_session_last_time", Long.valueOf(currentTimeMillis2));
}
TJKeyValueStorage tJKeyValueStorage4 = k;
if (tJKeyValueStorage4 != null) {
tJKeyValueStorage4.setValue("pref_session_last_duration", Long.valueOf(currentTimeMillis));
}
f = Long.valueOf(currentTimeMillis2);
h = Long.valueOf(currentTimeMillis);
}
}
}