- 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
80 lines
3.3 KiB
Java
80 lines
3.3 KiB
Java
package com.firemint.realracing;
|
|
|
|
import android.content.Context;
|
|
import android.util.Log;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class SerialiseNotificationsHelper {
|
|
static final String PATH = "pastNotifications.bin";
|
|
static final String TAG = "RR3_NotificationsHelper";
|
|
static boolean bLog;
|
|
|
|
public static void Log(String str) {
|
|
}
|
|
|
|
public static void AddNotification(Context context, String str) {
|
|
SerialisedNotificationInfo LoadInformation = LoadInformation(context);
|
|
LoadInformation.AddNotification(str);
|
|
SaveInformation(context, LoadInformation);
|
|
}
|
|
|
|
public static void ClearAll(Context context) {
|
|
SerialisedNotificationInfo LoadInformation = LoadInformation(context);
|
|
LoadInformation.ClearAll();
|
|
SaveInformation(context, LoadInformation);
|
|
}
|
|
|
|
private static void SaveInformation(Context context, SerialisedNotificationInfo serialisedNotificationInfo) {
|
|
try {
|
|
FileOutputStream fileOutputStream = new FileOutputStream(new File(context.getFilesDir(), PATH));
|
|
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
|
|
objectOutputStream.writeObject(serialisedNotificationInfo);
|
|
objectOutputStream.close();
|
|
fileOutputStream.close();
|
|
} catch (Exception e) {
|
|
Log.e("RealRacing3", "Caught exception: " + e.getMessage());
|
|
}
|
|
serialisedNotificationInfo.Print("Saved Information");
|
|
}
|
|
|
|
private static SerialisedNotificationInfo LoadInformation(Context context) {
|
|
Log("Attempting to load saved information");
|
|
SerialisedNotificationInfo serialisedNotificationInfo = new SerialisedNotificationInfo();
|
|
try {
|
|
File file = new File(context.getFilesDir(), PATH);
|
|
if (file.exists()) {
|
|
Log("Found saved file. Loading information");
|
|
FileInputStream fileInputStream = new FileInputStream(file);
|
|
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
|
|
SerialisedNotificationInfo serialisedNotificationInfo2 = (SerialisedNotificationInfo) objectInputStream.readObject();
|
|
try {
|
|
objectInputStream.close();
|
|
fileInputStream.close();
|
|
serialisedNotificationInfo = serialisedNotificationInfo2;
|
|
} catch (Exception e) {
|
|
e = e;
|
|
serialisedNotificationInfo = serialisedNotificationInfo2;
|
|
Log.e("RealRacing3", "Caught exception: " + e.getMessage());
|
|
serialisedNotificationInfo.Print("Loaded Information");
|
|
return serialisedNotificationInfo;
|
|
}
|
|
} else {
|
|
Log("Saved file doesn't exist. Returning new file");
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
serialisedNotificationInfo.Print("Loaded Information");
|
|
return serialisedNotificationInfo;
|
|
}
|
|
|
|
public static SerialisedNotificationInfo GetSavedInfo(Context context) {
|
|
return LoadInformation(context);
|
|
}
|
|
}
|