- 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
536 lines
23 KiB
Java
536 lines
23 KiB
Java
package com.helpshift.migrator;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.database.Cursor;
|
|
import android.util.Log;
|
|
import com.ea.nimble.Global;
|
|
import com.facebook.internal.AnalyticsEvents;
|
|
import com.google.android.gms.measurement.api.AppMeasurementSdk;
|
|
import com.helpshift.migrator.database.HSLegacySupportKeyValueStore;
|
|
import com.helpshift.migrator.database.HSNativeSDKUserDBHelper;
|
|
import com.helpshift.storage.HSPersistentStorage;
|
|
import com.helpshift.util.Utils;
|
|
import com.ironsource.ad;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.File;
|
|
import java.io.ObjectInputStream;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.Locale;
|
|
import java.util.Map;
|
|
import java.util.TimeZone;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class NativeToSdkxMigrator {
|
|
public final String DID_KEY;
|
|
public final String FAILED_KEY;
|
|
public final String LEGACY_ID_KEY;
|
|
public final String PUSH_TOKEN_KEY;
|
|
public final String SDK_LANG_KEY;
|
|
public final String SUCCESS_KEY;
|
|
public final String USER_DATA_KEY;
|
|
public int attempts;
|
|
public final Context context;
|
|
public final StringBuilder failureLogBuilder;
|
|
public final Map failureMap;
|
|
public final MigrationLogger migrationLogger;
|
|
public HSNativeSDKUserDBHelper nativeSDKUserDBHelper;
|
|
public final HSPersistentStorage persistentStorage;
|
|
public final SharedPreferences preferences;
|
|
public HSLegacySupportKeyValueStore supportKVStoreDBHelper;
|
|
|
|
public NativeToSdkxMigrator(Context context, HSPersistentStorage hSPersistentStorage) {
|
|
HashMap hashMap = new HashMap();
|
|
this.failureMap = hashMap;
|
|
this.SUCCESS_KEY = "Success";
|
|
this.FAILED_KEY = AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED;
|
|
this.DID_KEY = "DeviceId : ";
|
|
this.SDK_LANG_KEY = "SDK Language : ";
|
|
this.PUSH_TOKEN_KEY = "Push Token : ";
|
|
this.USER_DATA_KEY = "User Data : ";
|
|
this.LEGACY_ID_KEY = "Legacy Analytics Id : ";
|
|
this.attempts = 0;
|
|
this.context = context;
|
|
SharedPreferences sharedPreferences = context.getSharedPreferences("__hs_migration_prefs", 0);
|
|
this.preferences = sharedPreferences;
|
|
this.persistentStorage = hSPersistentStorage;
|
|
this.migrationLogger = new MigrationLogger(sharedPreferences);
|
|
this.failureLogBuilder = new StringBuilder("Migration Result: ");
|
|
hashMap.put("DeviceId : ", AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED);
|
|
hashMap.put("SDK Language : ", AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED);
|
|
hashMap.put("Push Token : ", AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED);
|
|
hashMap.put("Legacy Analytics Id : ", AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED);
|
|
hashMap.put("User Data : ", AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_FAILED);
|
|
}
|
|
|
|
public synchronized void migrate() {
|
|
String str;
|
|
String str2;
|
|
int i;
|
|
try {
|
|
try {
|
|
try {
|
|
} catch (Exception e) {
|
|
this.migrationLogger.e("Helpshift_Migrator", "Migration failed with exception", e);
|
|
try {
|
|
HSLegacySupportKeyValueStore hSLegacySupportKeyValueStore = this.supportKVStoreDBHelper;
|
|
if (hSLegacySupportKeyValueStore != null) {
|
|
hSLegacySupportKeyValueStore.close();
|
|
}
|
|
HSNativeSDKUserDBHelper hSNativeSDKUserDBHelper = this.nativeSDKUserDBHelper;
|
|
if (hSNativeSDKUserDBHelper != null) {
|
|
hSNativeSDKUserDBHelper.close();
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
str = "Helpshift_Migrator";
|
|
str2 = "Error closing DB instance";
|
|
Log.e(str, str2, e);
|
|
}
|
|
}
|
|
if (!shouldMigrate()) {
|
|
this.migrationLogger.d("Helpshift_Migrator", "Migration not required, skipping");
|
|
return;
|
|
}
|
|
this.supportKVStoreDBHelper = new HSLegacySupportKeyValueStore(this.context);
|
|
this.nativeSDKUserDBHelper = new HSNativeSDKUserDBHelper(this.context);
|
|
int i2 = 0;
|
|
boolean z = false;
|
|
boolean z2 = false;
|
|
boolean z3 = false;
|
|
while (true) {
|
|
i = 1;
|
|
if (i2 >= 3) {
|
|
break;
|
|
}
|
|
this.attempts++;
|
|
z = migrateKVStoreData();
|
|
z2 = migrateUserData();
|
|
logMessageOnStep("User data migration", z2);
|
|
updateFailuresMap("User Data : ", z2);
|
|
z3 = migrateLegacyAnalyticsEventIds();
|
|
logMessageOnStep("Legacy analytics event ID data migration", z3);
|
|
updateFailuresMap("Legacy Analytics Id : ", z3);
|
|
if (z && z2 && z3) {
|
|
break;
|
|
}
|
|
MigrationLogger migrationLogger = this.migrationLogger;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("Native SDK to SDK X migration failed! Attempt : ");
|
|
i2++;
|
|
sb.append(i2);
|
|
migrationLogger.e("Helpshift_Migrator", sb.toString());
|
|
}
|
|
if (!z || !z2 || !z3) {
|
|
i = -1;
|
|
}
|
|
addNativeSDKVersionLog(i);
|
|
storeFailureLog(i);
|
|
this.preferences.edit().putInt("migration_state", i).commit();
|
|
try {
|
|
HSLegacySupportKeyValueStore hSLegacySupportKeyValueStore2 = this.supportKVStoreDBHelper;
|
|
if (hSLegacySupportKeyValueStore2 != null) {
|
|
hSLegacySupportKeyValueStore2.close();
|
|
}
|
|
HSNativeSDKUserDBHelper hSNativeSDKUserDBHelper2 = this.nativeSDKUserDBHelper;
|
|
if (hSNativeSDKUserDBHelper2 != null) {
|
|
hSNativeSDKUserDBHelper2.close();
|
|
}
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
str = "Helpshift_Migrator";
|
|
str2 = "Error closing DB instance";
|
|
Log.e(str, str2, e);
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
} finally {
|
|
try {
|
|
HSLegacySupportKeyValueStore hSLegacySupportKeyValueStore3 = this.supportKVStoreDBHelper;
|
|
if (hSLegacySupportKeyValueStore3 != null) {
|
|
hSLegacySupportKeyValueStore3.close();
|
|
}
|
|
HSNativeSDKUserDBHelper hSNativeSDKUserDBHelper3 = this.nativeSDKUserDBHelper;
|
|
if (hSNativeSDKUserDBHelper3 != null) {
|
|
hSNativeSDKUserDBHelper3.close();
|
|
}
|
|
} catch (Exception e4) {
|
|
Log.e("Helpshift_Migrator", "Error closing DB instance", e4);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void storeFailureLog(int i) {
|
|
if (i != -1) {
|
|
return;
|
|
}
|
|
StringBuilder sb = this.failureLogBuilder;
|
|
sb.append(" Attempts: ");
|
|
sb.append(this.attempts);
|
|
sb.append(" , ");
|
|
StringBuilder sb2 = this.failureLogBuilder;
|
|
sb2.append("DeviceId : ");
|
|
sb2.append((String) this.failureMap.get("DeviceId : "));
|
|
sb2.append(" , ");
|
|
StringBuilder sb3 = this.failureLogBuilder;
|
|
sb3.append("User Data : ");
|
|
sb3.append((String) this.failureMap.get("User Data : "));
|
|
sb3.append(" , ");
|
|
StringBuilder sb4 = this.failureLogBuilder;
|
|
sb4.append("Push Token : ");
|
|
sb4.append((String) this.failureMap.get("Push Token : "));
|
|
sb4.append(" , ");
|
|
StringBuilder sb5 = this.failureLogBuilder;
|
|
sb5.append("SDK Language : ");
|
|
sb5.append((String) this.failureMap.get("SDK Language : "));
|
|
sb5.append(" , ");
|
|
StringBuilder sb6 = this.failureLogBuilder;
|
|
sb6.append("Legacy Analytics Id : ");
|
|
sb6.append((String) this.failureMap.get("Legacy Analytics Id : "));
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.ENGLISH);
|
|
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
jSONObject.put(ad.l0, simpleDateFormat.format(new Date()));
|
|
jSONObject.put("l", "ERROR");
|
|
jSONObject.put("msg", this.failureLogBuilder.toString());
|
|
jSONObject.put("src", "sdkx.android.10.2.2");
|
|
this.preferences.edit().putString("failure_logs", jSONObject.toString()).commit();
|
|
} catch (Exception unused) {
|
|
Log.e("Helpshift_Migrator", "Error storing failure log.");
|
|
}
|
|
}
|
|
|
|
public final void addNativeSDKVersionLog(int i) {
|
|
try {
|
|
String str = "Native SDK version: " + this.context.getSharedPreferences("HSJsonData", 0).getString("libraryVersion", "unknown") + " to SDK X version: 10.2.2";
|
|
if (i == -1) {
|
|
this.migrationLogger.e("Helpshift_Migrator", str);
|
|
this.migrationLogger.e("Helpshift_Migrator", " Migration failed!");
|
|
} else {
|
|
this.migrationLogger.d("Helpshift_Migrator", str);
|
|
this.migrationLogger.d("Helpshift_Migrator", "Migration success!");
|
|
}
|
|
} catch (Exception e) {
|
|
this.migrationLogger.e("Helpshift_Migrator", "Error fetching SDK info for logging", e);
|
|
}
|
|
}
|
|
|
|
public final boolean shouldMigrate() {
|
|
return databaseExists("__hs__db_support_key_values") && this.preferences.getInt("migration_state", 0) == 0;
|
|
}
|
|
|
|
public final void logMessageOnStep(String str, boolean z) {
|
|
String str2 = z ? " : Success" : " : Failed";
|
|
if (!z) {
|
|
this.migrationLogger.e("Helpshift_Migrator", str + str2);
|
|
return;
|
|
}
|
|
this.migrationLogger.d("Helpshift_Migrator", str + str2);
|
|
}
|
|
|
|
public final void updateFailuresMap(String str, boolean z) {
|
|
if (z) {
|
|
this.failureMap.put(str, "Success");
|
|
}
|
|
}
|
|
|
|
public final boolean migrateKVStoreData() {
|
|
boolean migrateDeviceId = migrateDeviceId();
|
|
logMessageOnStep("DeviceId migration", migrateDeviceId);
|
|
updateFailuresMap("DeviceId : ", migrateDeviceId);
|
|
boolean migratePushToken = migratePushToken();
|
|
logMessageOnStep("Push token migration", migratePushToken);
|
|
updateFailuresMap("Push Token : ", migratePushToken);
|
|
boolean migrateSDKLanguage = migrateSDKLanguage();
|
|
logMessageOnStep("SDK language migration", migrateSDKLanguage);
|
|
updateFailuresMap("SDK Language : ", migrateSDKLanguage);
|
|
return migrateDeviceId && migratePushToken && migrateSDKLanguage;
|
|
}
|
|
|
|
public final boolean migrateSDKLanguage() {
|
|
if (Utils.isNotEmpty(this.persistentStorage.getLanguage())) {
|
|
return true;
|
|
}
|
|
Object readStringFromKVDB = readStringFromKVDB("sdkLanguage");
|
|
this.persistentStorage.setLanguage(readStringFromKVDB instanceof String ? (String) readStringFromKVDB : "");
|
|
return true;
|
|
}
|
|
|
|
public final boolean migratePushToken() {
|
|
if (Utils.isNotEmpty(this.persistentStorage.getCurrentPushToken())) {
|
|
return true;
|
|
}
|
|
Object readStringFromKVDB = readStringFromKVDB("key_push_token");
|
|
this.persistentStorage.setCurrentPushToken(readStringFromKVDB instanceof String ? (String) readStringFromKVDB : "");
|
|
return true;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:21:0x004b, code lost:
|
|
|
|
if (r1 == null) goto L20;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final boolean migrateLegacyAnalyticsEventIds() {
|
|
/*
|
|
r6 = this;
|
|
java.lang.String r0 = "__hs_db_helpshift_users"
|
|
boolean r0 = r6.databaseExists(r0)
|
|
if (r0 != 0) goto La
|
|
r0 = 0
|
|
return r0
|
|
La:
|
|
org.json.JSONObject r0 = new org.json.JSONObject
|
|
r0.<init>()
|
|
r1 = 0
|
|
com.helpshift.migrator.database.HSNativeSDKUserDBHelper r2 = r6.nativeSDKUserDBHelper // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
android.database.sqlite.SQLiteDatabase r2 = r2.getReadableDatabase() // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
java.lang.String r3 = "SELECT * FROM legacy_analytics_event_id_table"
|
|
android.database.Cursor r1 = r2.rawQuery(r3, r1) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
L1c:
|
|
boolean r2 = r1.moveToNext() // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
if (r2 == 0) goto L3e
|
|
java.lang.String r2 = "identifier"
|
|
int r2 = r1.getColumnIndex(r2) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
java.lang.String r2 = r1.getString(r2) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
java.lang.String r3 = "analytics_event_id"
|
|
int r3 = r1.getColumnIndex(r3) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
java.lang.String r3 = r1.getString(r3) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
r0.put(r2, r3) // Catch: java.lang.Throwable -> L3a java.lang.Exception -> L3c
|
|
goto L1c
|
|
L3a:
|
|
r0 = move-exception
|
|
goto L61
|
|
L3c:
|
|
r2 = move-exception
|
|
goto L42
|
|
L3e:
|
|
r1.close()
|
|
goto L4e
|
|
L42:
|
|
com.helpshift.migrator.MigrationLogger r3 = r6.migrationLogger // Catch: java.lang.Throwable -> L3a
|
|
java.lang.String r4 = "Helpshift_Migrator"
|
|
java.lang.String r5 = "Error reading legacy analytics event id."
|
|
r3.e(r4, r5, r2) // Catch: java.lang.Throwable -> L3a
|
|
if (r1 == 0) goto L4e
|
|
goto L3e
|
|
L4e:
|
|
int r1 = r0.length()
|
|
if (r1 <= 0) goto L5f
|
|
com.helpshift.storage.HSPersistentStorage r1 = r6.persistentStorage
|
|
java.lang.String r2 = "legacy_event_ids"
|
|
java.lang.String r0 = r0.toString()
|
|
r1.putString(r2, r0)
|
|
L5f:
|
|
r0 = 1
|
|
return r0
|
|
L61:
|
|
if (r1 == 0) goto L66
|
|
r1.close()
|
|
L66:
|
|
throw r0
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.helpshift.migrator.NativeToSdkxMigrator.migrateLegacyAnalyticsEventIds():boolean");
|
|
}
|
|
|
|
public final boolean migrateDeviceId() {
|
|
if (Utils.isNotEmpty(this.persistentStorage.getHsDeviceId())) {
|
|
return true;
|
|
}
|
|
Object readStringFromKVDB = readStringFromKVDB("key_support_device_id");
|
|
if (readStringFromKVDB == null) {
|
|
return false;
|
|
}
|
|
this.persistentStorage.setHsDeviceId((String) readStringFromKVDB);
|
|
return true;
|
|
}
|
|
|
|
public final boolean databaseExists(String str) {
|
|
return new File(this.context.getDatabasePath(str).getAbsolutePath()).exists();
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:14:0x004c, code lost:
|
|
|
|
if (r1 == null) goto L20;
|
|
*/
|
|
/* JADX WARN: Removed duplicated region for block: B:19:0x0052 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final java.lang.Object readStringFromKVDB(java.lang.String r11) {
|
|
/*
|
|
r10 = this;
|
|
r0 = 0
|
|
com.helpshift.migrator.database.HSLegacySupportKeyValueStore r1 = r10.supportKVStoreDBHelper // Catch: java.lang.Throwable -> L30 java.lang.Exception -> L32
|
|
android.database.sqlite.SQLiteDatabase r2 = r1.getReadableDatabase() // Catch: java.lang.Throwable -> L30 java.lang.Exception -> L32
|
|
java.lang.String r5 = "key=?"
|
|
java.lang.String[] r6 = new java.lang.String[]{r11} // Catch: java.lang.Throwable -> L30 java.lang.Exception -> L32
|
|
java.lang.String r3 = "key_value_store"
|
|
r4 = 0
|
|
r7 = 0
|
|
r8 = 0
|
|
r9 = 0
|
|
android.database.Cursor r1 = r2.query(r3, r4, r5, r6, r7, r8, r9) // Catch: java.lang.Throwable -> L30 java.lang.Exception -> L32
|
|
boolean r2 = r1.moveToFirst() // Catch: java.lang.Throwable -> L27 java.lang.Exception -> L2a
|
|
if (r2 == 0) goto L2c
|
|
r2 = 1
|
|
byte[] r2 = r1.getBlob(r2) // Catch: java.lang.Throwable -> L27 java.lang.Exception -> L2a
|
|
java.lang.Object r0 = r10.toObject(r2) // Catch: java.lang.Throwable -> L27 java.lang.Exception -> L2a
|
|
goto L2c
|
|
L27:
|
|
r11 = move-exception
|
|
r0 = r1
|
|
goto L50
|
|
L2a:
|
|
r2 = move-exception
|
|
goto L34
|
|
L2c:
|
|
r1.close()
|
|
goto L4f
|
|
L30:
|
|
r11 = move-exception
|
|
goto L50
|
|
L32:
|
|
r2 = move-exception
|
|
r1 = r0
|
|
L34:
|
|
com.helpshift.migrator.MigrationLogger r3 = r10.migrationLogger // Catch: java.lang.Throwable -> L27
|
|
java.lang.String r4 = "Helpshift_Migrator"
|
|
java.lang.StringBuilder r5 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L27
|
|
r5.<init>() // Catch: java.lang.Throwable -> L27
|
|
java.lang.String r6 = "Failed to read the native db or DB does not exist. Key : "
|
|
r5.append(r6) // Catch: java.lang.Throwable -> L27
|
|
r5.append(r11) // Catch: java.lang.Throwable -> L27
|
|
java.lang.String r11 = r5.toString() // Catch: java.lang.Throwable -> L27
|
|
r3.e(r4, r11, r2) // Catch: java.lang.Throwable -> L27
|
|
if (r1 == 0) goto L4f
|
|
goto L2c
|
|
L4f:
|
|
return r0
|
|
L50:
|
|
if (r0 == 0) goto L55
|
|
r0.close()
|
|
L55:
|
|
throw r11
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.helpshift.migrator.NativeToSdkxMigrator.readStringFromKVDB(java.lang.String):java.lang.Object");
|
|
}
|
|
|
|
public final boolean migrateUserData() {
|
|
if (!databaseExists("__hs_db_helpshift_users")) {
|
|
return false;
|
|
}
|
|
ArrayList<Map> arrayList = new ArrayList();
|
|
Cursor cursor = null;
|
|
try {
|
|
try {
|
|
cursor = this.nativeSDKUserDBHelper.getReadableDatabase().rawQuery("SELECT * FROM user_table", null);
|
|
while (cursor.moveToNext()) {
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.put("anon", String.valueOf(cursor.getInt(cursor.getColumnIndex(Global.NIMBLE_AUTHENTICATOR_ANONYMOUS))));
|
|
hashMap.put("userId", cursor.getString(cursor.getColumnIndex("identifier")));
|
|
hashMap.put("userName", cursor.getString(cursor.getColumnIndex("name")));
|
|
hashMap.put("userEmail", cursor.getString(cursor.getColumnIndex("email")));
|
|
hashMap.put("userAuthToken", cursor.getString(cursor.getColumnIndex("auth_token")));
|
|
hashMap.put("isActive", String.valueOf(cursor.getInt(cursor.getColumnIndex(AppMeasurementSdk.ConditionalUserProperty.ACTIVE))));
|
|
arrayList.add(hashMap);
|
|
}
|
|
cursor.close();
|
|
for (Map map : arrayList) {
|
|
try {
|
|
boolean equals = "1".equals(map.remove("anon"));
|
|
boolean equals2 = "1".equals(map.remove("isActive"));
|
|
if (equals) {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("userId", map.get("userId"));
|
|
this.persistentStorage.storeAnonymousUserIdMap(jSONObject.toString());
|
|
} else if (equals2) {
|
|
this.persistentStorage.setActiveUser(new JSONObject(map).toString());
|
|
}
|
|
} catch (Exception e) {
|
|
this.migrationLogger.e("Helpshift_Migrator", "Error setting user data in SDK X migration", e);
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
} catch (Exception e2) {
|
|
this.migrationLogger.e("Helpshift_Migrator", "Error getting user data from native SDK", e2);
|
|
if (cursor != null) {
|
|
cursor.close();
|
|
}
|
|
return false;
|
|
}
|
|
} catch (Throwable th) {
|
|
if (cursor != null) {
|
|
cursor.close();
|
|
}
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
public final Object toObject(byte[] bArr) {
|
|
ByteArrayInputStream byteArrayInputStream;
|
|
Throwable th;
|
|
ObjectInputStream objectInputStream;
|
|
try {
|
|
byteArrayInputStream = new ByteArrayInputStream(bArr);
|
|
try {
|
|
objectInputStream = new ObjectInputStream(byteArrayInputStream);
|
|
try {
|
|
Object readObject = objectInputStream.readObject();
|
|
Utils.closeQuietly(byteArrayInputStream);
|
|
Utils.closeQuietly(objectInputStream);
|
|
return readObject;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
Utils.closeQuietly(byteArrayInputStream);
|
|
Utils.closeQuietly(objectInputStream);
|
|
throw th;
|
|
}
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
objectInputStream = null;
|
|
}
|
|
} catch (Throwable th4) {
|
|
byteArrayInputStream = null;
|
|
th = th4;
|
|
objectInputStream = null;
|
|
}
|
|
}
|
|
|
|
public String getMigrationErrorLogs() {
|
|
int i;
|
|
if (!this.preferences.getBoolean("mig_log_synced_with_webchat", false) && (i = this.preferences.getInt("migration_state", 0)) != 1 && i != 0) {
|
|
try {
|
|
String string = this.preferences.getString("error_logs", "");
|
|
if (Utils.isEmpty(string)) {
|
|
string = "[]";
|
|
}
|
|
JSONArray jSONArray = new JSONArray(string);
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("migration_state", "FAILED");
|
|
jSONObject.put("did", this.persistentStorage.getHsDeviceId());
|
|
jSONObject.put("logs", jSONArray);
|
|
return jSONObject.toString();
|
|
} catch (Exception unused) {
|
|
Log.e("Helpshift_Migrator", "Error getting error logs for migration");
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public void setErrorLogsSyncedWithWebchat(boolean z) {
|
|
this.preferences.edit().putBoolean("mig_log_synced_with_webchat", z).commit();
|
|
}
|
|
}
|