Files
rr3-apk/decompiled-community/sources/com/google/firebase/messaging/Store.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

116 lines
3.9 KiB
Java

package com.google.firebase.messaging;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Log;
import androidx.core.content.ContextCompat;
import androidx.webkit.ProxyConfig;
import com.ironsource.v8;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class Store {
public final SharedPreferences store;
public Store(Context context) {
this.store = context.getSharedPreferences("com.google.android.gms.appid", 0);
checkForRestore(context, "com.google.android.gms.appid-no-backup");
}
public final void checkForRestore(Context context, String str) {
File file = new File(ContextCompat.getNoBackupFilesDir(context), str);
if (file.exists()) {
return;
}
try {
if (!file.createNewFile() || isEmpty()) {
return;
}
deleteAll();
} catch (IOException e) {
if (Log.isLoggable("FirebaseMessaging", 3)) {
StringBuilder sb = new StringBuilder();
sb.append("Error creating file in no backup dir: ");
sb.append(e.getMessage());
}
}
}
public synchronized boolean isEmpty() {
return this.store.getAll().isEmpty();
}
public final String createTokenKey(String str, String str2) {
return str + "|T|" + str2 + "|" + ProxyConfig.MATCH_ALL_SCHEMES;
}
public synchronized void deleteAll() {
this.store.edit().clear().commit();
}
public synchronized Token getToken(String str, String str2) {
return Token.parse(this.store.getString(createTokenKey(str, str2), null));
}
public synchronized void saveToken(String str, String str2, String str3, String str4) {
String encode = Token.encode(str3, str4, System.currentTimeMillis());
if (encode == null) {
return;
}
SharedPreferences.Editor edit = this.store.edit();
edit.putString(createTokenKey(str, str2), encode);
edit.commit();
}
public static class Token {
public static final long REFRESH_PERIOD_MILLIS = TimeUnit.DAYS.toMillis(7);
public final String appVersion;
public final long timestamp;
public final String token;
public Token(String str, String str2, long j) {
this.token = str;
this.appVersion = str2;
this.timestamp = j;
}
public static Token parse(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
if (str.startsWith("{")) {
try {
JSONObject jSONObject = new JSONObject(str);
return new Token(jSONObject.getString("token"), jSONObject.getString(v8.i.W), jSONObject.getLong("timestamp"));
} catch (JSONException e) {
Log.w("FirebaseMessaging", "Failed to parse token: " + e);
return null;
}
}
return new Token(str, null, 0L);
}
public static String encode(String str, String str2, long j) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("token", str);
jSONObject.put(v8.i.W, str2);
jSONObject.put("timestamp", j);
return jSONObject.toString();
} catch (JSONException e) {
Log.w("FirebaseMessaging", "Failed to encode token: " + e);
return null;
}
}
public boolean needsRefresh(String str) {
return System.currentTimeMillis() > this.timestamp + REFRESH_PERIOD_MILLIS || !str.equals(this.appVersion);
}
}
}