diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 649ed2d..77297ad 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -11,11 +11,15 @@ android {
applicationId = "com.ea.games.nfs13_mod"
minSdk = 27
targetSdk = 35
- versionCode = 1
- versionName = "1.0"
+ versionCode = 1003128
+ versionName = "1.3.128"
+
+ ndk.abiFilters.add("armeabi-v7a")
+ ndk.abiFilters.add("x86")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
+ ndkVersion = "21.0.6113669"
buildTypes {
release {
@@ -46,5 +50,6 @@ dependencies {
implementation("com.parse.bolts:bolts-tasks:1.4.0")
implementation("org.apache.httpcomponents:httpclient-android:4.3.5.1")
+ implementation("com.google.code.gson:gson:2.7")
//implementation("com.android.support:support-v4:28.0.0")
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 003a08c..f63bf23 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -25,9 +25,8 @@
-
+
+
-
+ android:resizeableActivity="false">
+
+
+
+
+
+
-
diff --git a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmBroadcastReceiver.java b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmBroadcastReceiver.java
deleted file mode 100644
index be68ab9..0000000
--- a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmBroadcastReceiver.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.ea.eadp.pushnotification.forwarding;
-
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-
-/* loaded from: classes.dex */
-public class GcmBroadcastReceiver extends BroadcastReceiver {
- @Override // android.content.BroadcastReceiver
- public final void onReceive(Context context, Intent intent) {
- intent.setComponent(new ComponentName(context.getPackageName(), getIntentServiceName()));
- GcmIntentService.enqueueWork(context, getIntentServiceName(), intent);
- }
-
- protected String getIntentServiceName() {
- return GcmIntentService.class.getName();
- }
-}
diff --git a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmIntentService.java b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmIntentService.java
deleted file mode 100644
index ef9e33f..0000000
--- a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/GcmIntentService.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.ea.eadp.pushnotification.forwarding;
-
-import android.annotation.SuppressLint;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.Resources;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.v4.app.JobIntentService;
-import android.support.v4.app.NotificationCompat;
-import com.ea.eadp.http.services.HttpService;
-import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks;
-import com.ea.eadp.pushnotification.services.AndroidPushService;
-import com.ea.eadp.pushnotification.services.IPushService;
-import com.ea.nimble.ApplicationEnvironment;
-import com.ea.nimble.Global;
-import com.ea.nimble.Log;
-import com.facebook.internal.NativeProtocol;
-import com.google.android.gms.gcm.GoogleCloudMessaging;
-import java.util.List;
-
-/* loaded from: classes.dex */
-public class GcmIntentService extends JobIntentService {
- protected static final int JOB_ID = 5566;
- private static final String LOG_TAG = "GcmIntentService";
- private IPushService pushManager;
-
- public interface EnsEventFlags {
- public static final int ALL_DISABLED = 0;
- public static final int ALL_ENABLED = 3;
- public static final int CLICK_ENABLED = 1;
- public static final int RECEIVED_ENABLED = 2;
- }
-
- public interface PushIntentExtraKeys {
- public static final String ALERT = "alert";
- public static final String COLLAPSE_KEY = "collapse_key";
- public static final String DEEP_LINK_URL = "deepLinkUrl";
- public static final String ENS_EVENTS = "ensEvents";
- public static final String PN_TYPE = "pnType";
- public static final String PUSH_ID = "pushId";
- }
-
- protected boolean displayNotification(Bundle bundle) {
- return true;
- }
-
- protected HttpService getHttpService() {
- return null;
- }
-
- public static void enqueueWork(Context context, String str, Intent intent) {
- try {
- enqueueWork(context, Class.forName(str), JOB_ID, intent);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
-
- @Override // android.support.v4.app.JobIntentService
- protected void onHandleWork(@NonNull Intent intent) {
- Bundle extras = intent.getExtras();
- if (extras == null) {
- Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]);
- return;
- }
- String messageType = GoogleCloudMessaging.getInstance(getApplicationContext()).getMessageType(intent);
- if (extras.isEmpty()) {
- return;
- }
- if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR.equals(messageType)) {
- Log.Helper.LOGIS(LOG_TAG, "Error received: " + extras.toString(), new Object[0]);
- return;
- }
- if ("deleted_messages".equals(messageType)) {
- Log.Helper.LOGIS(LOG_TAG, "Deleted messages on server: " + extras.toString(), new Object[0]);
- return;
- }
- if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)) {
- onHandleMessage(intent);
- }
- }
-
- protected void onHandleMessage(Intent intent) {
- Bundle extras = intent.getExtras();
- if (extras == null) {
- Log.Helper.LOGE(this, "Skipping Push Notification: Incomplete Intent. Missing expected extras bundle.", new Object[0]);
- return;
- }
- Log.Helper.LOGIS(LOG_TAG, "Message received: " + extras.toString(), new Object[0]);
- if (displayNotification(extras)) {
- postNotification(getApplicationContext(), extras);
- }
- int i = 3;
- String string = extras.getString(PushIntentExtraKeys.ENS_EVENTS);
- if (string != null) {
- try {
- i = Integer.parseInt(string);
- } catch (NumberFormatException unused) {
- Log.Helper.LOGWS(LOG_TAG, "ensEvents flag found but not parseable as integer", new Object[0]);
- }
- }
- if (extras.containsKey(PushIntentExtraKeys.PUSH_ID)) {
- if (i >= 2 || i < 0) {
- if (this.pushManager == null) {
- this.pushManager = new AndroidPushService(getApplicationContext(), getHttpService());
- }
- if (ApplicationEnvironment.isMainApplicationRunning()) {
- this.pushManager.sendTrackingEvent(extras.getString(PushIntentExtraKeys.PUSH_ID), extras.getString(PushIntentExtraKeys.PN_TYPE), IPushService.NOTIFICATION_TYPE_RECEIVED);
- } else {
- this.pushManager.persistTrackingEvent(extras.getString(PushIntentExtraKeys.PUSH_ID), extras.getString(PushIntentExtraKeys.PN_TYPE), IPushService.NOTIFICATION_TYPE_RECEIVED);
- }
- }
- }
- }
-
- @SuppressLint({"InlinedApi"})
- private void postNotification(Context context, Bundle bundle) {
- Intent intent = new Intent();
- if (Build.VERSION.SDK_INT >= 12) {
- intent.addFlags(32);
- }
- intent.putExtras(bundle);
- intent.setPackage(context.getPackageName());
- ComponentName broadcastForwarderComponent = getBroadcastForwarderComponent();
- if (isInForeground()) {
- if (broadcastForwarderComponent != null) {
- intent.setComponent(broadcastForwarderComponent);
- sendBroadcast(intent);
- return;
- } else {
- Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not sending broadcast", new Object[0]);
- return;
- }
- }
- String string = bundle.getString(PushIntentExtraKeys.PUSH_ID);
- int hashCode = string != null ? string.hashCode() : 0;
- String str = Global.NOTIFICATION_CHANNEL_DEFAULT_ID;
- try {
- ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
- if (applicationInfo.metaData.containsKey(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY)) {
- str = applicationInfo.metaData.getString(Global.NOTIFICATION_CHANNEL_PUSHTNG_ID_KEY);
- }
- } catch (PackageManager.NameNotFoundException e) {
- android.util.Log.e(Global.NIMBLE_ID, String.format("%s>GcmIntentService.postNotification():\n%s", LOG_TAG, e.getMessage()));
- }
- NotificationCompat.Builder builder = new NotificationCompat.Builder(context, str);
- if (broadcastForwarderComponent != null) {
- String string2 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY);
- if (string2 != null && !string2.equalsIgnoreCase("do_not_collapse")) {
- intent.putExtra(PushIntentExtraKeys.COLLAPSE_KEY, string2);
- }
- intent.setComponent(broadcastForwarderComponent);
- builder.setContentIntent(PendingIntent.getBroadcast(context, hashCode, intent, 134217728));
- } else {
- Log.Helper.LOGW(this, "Broadcast listener for action 'com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST' was not found. Not setting ContentIntent", new Object[0]);
- }
- customizeNotification(builder, bundle);
- NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
- if (notificationManager != null) {
- String string3 = bundle.getString(PushIntentExtraKeys.COLLAPSE_KEY);
- if (string3 != null && !string3.equalsIgnoreCase("do_not_collapse")) {
- notificationManager.notify(string3, 0, builder.build());
- return;
- } else {
- notificationManager.notify(hashCode, builder.build());
- return;
- }
- }
- Log.Helper.LOGE(this, "Notification Manager is not available or is inaccessible. Skipping Notification formatting.", new Object[0]);
- }
-
- protected boolean isInForeground() {
- return PushLifecycleCallbacks.inForeground;
- }
-
- protected void customizeNotification(NotificationCompat.Builder builder, Bundle bundle) {
- String string = bundle.getString(PushIntentExtraKeys.ALERT);
- Resources resources = getApplicationContext().getResources();
- String packageName = getApplicationContext().getPackageName();
- String string2 = getApplicationContext().getResources().getString(resources.getIdentifier(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, "string", packageName));
- try {
- builder.setSmallIcon(resources.getIdentifier("pn_icon", "drawable", packageName));
- } catch (Exception e) {
- Log.Helper.LOGE(LOG_TAG, "PN NOT DISPLAYED: Unable to set application icon due to exception: " + e.toString(), new Object[0]);
- }
- builder.setContentTitle(string2).setStyle(new NotificationCompat.BigTextStyle().bigText(string)).setContentText(string).setAutoCancel(true).setDefaults(getApplicationContext().checkCallingOrSelfPermission("android.permission.VIBRATE") == 0 ? 7 : 5);
- }
-
- protected ComponentName getBroadcastForwarderComponent() {
- Log.Helper.LOGFUNC(this);
- PackageManager packageManager = getApplicationContext().getPackageManager();
- Intent intent = new Intent("com.ea.eadp.pushnotification.FORWARD_AS_ORDERED_BROADCAST");
- intent.setPackage(getApplicationContext().getPackageName());
- List queryBroadcastReceivers = packageManager.queryBroadcastReceivers(intent, 0);
- if (queryBroadcastReceivers.isEmpty()) {
- return null;
- }
- ActivityInfo activityInfo = queryBroadcastReceivers.get(0).activityInfo;
- return new ComponentName(activityInfo.packageName, activityInfo.name);
- }
-}
diff --git a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/PushBroadcastForwarder.java b/app/src/main/java/com/ea/eadp/pushnotification/forwarding/PushBroadcastForwarder.java
deleted file mode 100644
index 6f22754..0000000
--- a/app/src/main/java/com/ea/eadp/pushnotification/forwarding/PushBroadcastForwarder.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.ea.eadp.pushnotification.forwarding;
-
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.net.Uri;
-import android.os.Bundle;
-import com.ea.eadp.http.services.HttpService;
-import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
-import com.ea.eadp.pushnotification.services.IPushService;
-import com.ea.nimble.Log;
-
-/* loaded from: classes.dex */
-public class PushBroadcastForwarder extends BroadcastReceiver {
- private static final String LOG_TAG = "PushBroadcastForwarder";
- private IPushService pushManager;
-
- protected HttpService getHttpService() {
- return null;
- }
-
- /* JADX WARN: Removed duplicated region for block: B:17:0x003a */
- /* JADX WARN: Removed duplicated region for block: B:20:0x004f */
- /* JADX WARN: Removed duplicated region for block: B:21:0x0063 */
- @Override // android.content.BroadcastReceiver
- /*
- Code decompiled incorrectly, please refer to instructions dump.
- To view partially-correct code enable 'Show inconsistent code' option in preferences
- */
- public final void onReceive(android.content.Context r5, android.content.Intent r6) {
- /*
- r4 = this;
- android.os.Bundle r6 = r6.getExtras()
- r0 = 0
- if (r6 != 0) goto Lf
- java.lang.String r5 = "Unable to get extras from Intent"
- java.lang.Object[] r6 = new java.lang.Object[r0]
- com.ea.nimble.Log.Helper.LOGE(r4, r5, r6)
- return
- Lf:
- java.lang.String r1 = "ensEvents"
- java.lang.String r1 = r6.getString(r1)
- r2 = 3
- if (r1 == 0) goto L26
- int r1 = java.lang.Integer.parseInt(r1) // Catch: java.lang.NumberFormatException -> L1d
- goto L27
- L1d:
- java.lang.String r1 = "PushBroadcastForwarder"
- java.lang.String r3 = "ensEvents flag found but not parseable as integer"
- java.lang.Object[] r0 = new java.lang.Object[r0]
- com.ea.nimble.Log.Helper.LOGWS(r1, r3, r0)
- L26:
- r1 = 3
- L27:
- java.lang.String r0 = "pushId"
- boolean r0 = r6.containsKey(r0)
- if (r0 == 0) goto L76
- if (r1 >= r2) goto L36
- r0 = 1
- if (r1 == r0) goto L36
- if (r1 >= 0) goto L76
- L36:
- com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
- if (r0 != 0) goto L49
- com.ea.eadp.pushnotification.services.AndroidPushService r0 = new com.ea.eadp.pushnotification.services.AndroidPushService
- android.content.Context r1 = r5.getApplicationContext()
- com.ea.eadp.http.services.HttpService r2 = r4.getHttpService()
- r0.(r1, r2)
- r4.pushManager = r0
- L49:
- boolean r0 = com.ea.nimble.ApplicationEnvironment.isMainApplicationRunning()
- if (r0 == 0) goto L63
- com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
- java.lang.String r1 = "pushId"
- java.lang.String r1 = r6.getString(r1)
- java.lang.String r2 = "pnType"
- java.lang.String r2 = r6.getString(r2)
- java.lang.String r3 = "NOTIFICATION_OPENED"
- r0.sendTrackingEvent(r1, r2, r3)
- goto L76
- L63:
- com.ea.eadp.pushnotification.services.IPushService r0 = r4.pushManager
- java.lang.String r1 = "pushId"
- java.lang.String r1 = r6.getString(r1)
- java.lang.String r2 = "pnType"
- java.lang.String r2 = r6.getString(r2)
- java.lang.String r3 = "NOTIFICATION_OPENED"
- r0.persistTrackingEvent(r1, r2, r3)
- L76:
- r4.handleNewPushNotification(r5, r6)
- return
- */
- throw new UnsupportedOperationException("Method not decompiled: com.ea.eadp.pushnotification.forwarding.PushBroadcastForwarder.onReceive(android.content.Context, android.content.Intent):void");
- }
-
- protected void handleNewPushNotification(Context context, Bundle bundle) {
- Intent intent;
- String string = bundle.getString(GcmIntentService.PushIntentExtraKeys.DEEP_LINK_URL);
- if (string != null) {
- intent = new Intent("android.intent.action.VIEW", Uri.parse(string));
- Log.Helper.LOGIS(LOG_TAG, "Push notification clicked with URL: " + string, new Object[0]);
- } else {
- String pushTargetActivity = getPushTargetActivity(context);
- Log.Helper.LOGIS(LOG_TAG, "Push notification clicked with target activity: " + pushTargetActivity, new Object[0]);
- try {
- intent = new Intent(context, Class.forName(pushTargetActivity));
- } catch (ClassNotFoundException e) {
- Log.Helper.LOGES(LOG_TAG, String.format("Could not launch target activity: %s, exception: %s", pushTargetActivity, e.toString()), new Object[0]);
- return;
- }
- }
- intent.putExtras(bundle);
- intent.setFlags(603979776);
- PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 1073741824);
- if (activity == null) {
- Log.Helper.LOGE(LOG_TAG, "Unable to create PendingIntent", new Object[0]);
- }
- try {
- activity.send();
- } catch (PendingIntent.CanceledException e2) {
- Log.Helper.LOGE(LOG_TAG, String.format("Could not launch PendingIntent for PN %s", e2.toString()), new Object[0]);
- }
- }
-
- protected String getPushTargetActivity(Context context) {
- Intent launchIntentForPackage;
- ComponentName resolveActivity;
- Context applicationContext = context.getApplicationContext();
- PackageManager packageManager = applicationContext.getPackageManager();
- if (packageManager != null && (launchIntentForPackage = packageManager.getLaunchIntentForPackage(applicationContext.getPackageName())) != null && (resolveActivity = launchIntentForPackage.resolveActivity(applicationContext.getPackageManager())) != null) {
- return resolveActivity.getClassName();
- }
- Log.Helper.LOGE(this, "PackageManager service is unable or is inaccessible. Unable to get PushTargetActivity.", new Object[0]);
- return "";
- }
-}
diff --git a/app/src/main/java/com/ea/eadp/pushnotification/lifecycles/PushLifecycleCallbacks.java b/app/src/main/java/com/ea/eadp/pushnotification/lifecycles/PushLifecycleCallbacks.java
deleted file mode 100644
index d5742c0..0000000
--- a/app/src/main/java/com/ea/eadp/pushnotification/lifecycles/PushLifecycleCallbacks.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.ea.eadp.pushnotification.lifecycles;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.app.Application;
-import android.os.Bundle;
-
-@TargetApi(14)
-/* loaded from: classes.dex */
-public class PushLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
- public static final int LIFECYCLE_API_VERSION = 14;
- public static boolean inForeground;
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
- }
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivityCreated(Activity activity, Bundle bundle) {
- inForeground = true;
- }
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivityStarted(Activity activity) {
- inForeground = true;
- }
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivityResumed(Activity activity) {
- inForeground = true;
- }
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivityPaused(Activity activity) {
- inForeground = false;
- }
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivityStopped(Activity activity) {
- inForeground = false;
- }
-
- @Override // android.app.Application.ActivityLifecycleCallbacks
- public void onActivityDestroyed(Activity activity) {
- inForeground = false;
- }
-}
diff --git a/app/src/main/java/com/ea/eadp/pushnotification/models/PushNotificationConfig.java b/app/src/main/java/com/ea/eadp/pushnotification/models/PushNotificationConfig.java
deleted file mode 100644
index 9b72d74..0000000
--- a/app/src/main/java/com/ea/eadp/pushnotification/models/PushNotificationConfig.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package com.ea.eadp.pushnotification.models;
-
-import android.os.Build;
-import java.util.Locale;
-import java.util.TimeZone;
-
-/* loaded from: classes.dex */
-public class PushNotificationConfig {
- private String appId;
- private String appVersion;
- private String country;
- private String dateOfBirth;
- private String deviceIdentifier;
- private boolean disabled;
- private String disabledReason;
- private String registrationIdentifier;
- private Integer silentIntervalEnd;
- private Integer silentIntervalStart;
- private String userAlias;
- private String manufacturer = Build.MANUFACTURER;
- private String operatingSystem = Build.VERSION.RELEASE;
- private String model = Build.MODEL;
- private String deviceType = "android";
- private String locale = Locale.getDefault().toString();
- private TimeZone timezone = TimeZone.getDefault();
-
- public String getUserAlias() {
- return this.userAlias;
- }
-
- public void setUserAlias(String str) {
- this.userAlias = str;
- }
-
- public String getDeviceType() {
- return this.deviceType;
- }
-
- public void setDeviceType(String str) {
- this.deviceType = str;
- }
-
- public String getOperatingSystem() {
- return this.operatingSystem;
- }
-
- public void setOperatingSystem(String str) {
- this.operatingSystem = str;
- }
-
- public String getManufacturer() {
- return this.manufacturer;
- }
-
- public void setManufacturer(String str) {
- this.manufacturer = str;
- }
-
- public String getRegistrationIdentifier() {
- return this.registrationIdentifier;
- }
-
- public void setRegistrationIdentifier(String str) {
- this.registrationIdentifier = str;
- }
-
- public String getDeviceIdentifier() {
- return this.deviceIdentifier;
- }
-
- public void setDeviceIdentifier(String str) {
- this.deviceIdentifier = str;
- }
-
- public String getModel() {
- return this.model;
- }
-
- public void setModel(String str) {
- this.model = str;
- }
-
- public String getAppId() {
- return this.appId;
- }
-
- public void setAppId(String str) {
- this.appId = str;
- }
-
- public String getAppVersion() {
- return this.appVersion;
- }
-
- public void setAppVersion(String str) {
- this.appVersion = str;
- }
-
- public String getCountry() {
- return this.country;
- }
-
- public void setCountry(String str) {
- this.country = str;
- }
-
- public String getLocale() {
- return this.locale;
- }
-
- public void setLocale(String str) {
- this.locale = str;
- }
-
- public TimeZone getTimezone() {
- return this.timezone;
- }
-
- public void setTimezone(TimeZone timeZone) {
- this.timezone = timeZone;
- }
-
- public Integer getSilentIntervalStart() {
- return this.silentIntervalStart;
- }
-
- public void setSilentIntervalStart(Integer num) {
- this.silentIntervalStart = num;
- }
-
- public Integer getSilentIntervalEnd() {
- return this.silentIntervalEnd;
- }
-
- public void setSilentIntervalEnd(Integer num) {
- this.silentIntervalEnd = num;
- }
-
- public String getDateOfBirth() {
- return this.dateOfBirth;
- }
-
- public void setDateOfBirth(String str) {
- this.dateOfBirth = str;
- }
-
- public String getDisabledReason() {
- return this.disabledReason;
- }
-
- public void setDisabledReason(String str) {
- this.disabledReason = str;
- }
-
- public boolean isDisabled() {
- return this.disabled;
- }
-
- public void setDisabled(boolean z) {
- this.disabled = z;
- }
-}
diff --git a/app/src/main/java/com/ea/eadp/pushnotification/services/AndroidPushService.java b/app/src/main/java/com/ea/eadp/pushnotification/services/AndroidPushService.java
deleted file mode 100644
index abaf1a2..0000000
--- a/app/src/main/java/com/ea/eadp/pushnotification/services/AndroidPushService.java
+++ /dev/null
@@ -1,414 +0,0 @@
-package com.ea.eadp.pushnotification.services;
-
-import android.annotation.TargetApi;
-import android.app.Application;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.os.Build;
-import android.util.Base64;
-import com.ea.eadp.deviceid.DeviceIdService;
-import com.ea.eadp.http.models.HttpRequest;
-import com.ea.eadp.http.models.HttpRequestListener;
-import com.ea.eadp.http.models.HttpResponse;
-import com.ea.eadp.http.services.HttpService;
-import com.ea.eadp.pushnotification.forwarding.GcmIntentService;
-import com.ea.eadp.pushnotification.lifecycles.PushLifecycleCallbacks;
-import com.ea.eadp.pushnotification.listeners.IPushListener;
-import com.ea.eadp.pushnotification.models.PushNotificationConfig;
-import com.ea.nimble.Log;
-import com.ea.nimble.pushtng.PushNotification;
-import com.google.android.gms.common.GoogleApiAvailability;
-import com.google.android.gms.gcm.GoogleCloudMessaging;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonPrimitive;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-import java.lang.reflect.Type;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import java.util.Timer;
-import java.util.TimerTask;
-import org.apache.http.protocol.HTTP;
-
-/* loaded from: classes.dex */
-public final class AndroidPushService implements IPushService {
- private static final String API_KEY_KEY = "apiKey";
- private static final String API_SECRET_KEY = "apiSecret";
- public static final String AUTHORIZATION = "Authorization";
- private static final String DEVICE_ID_KEY = "deviceId";
- private static final String EVENT_LIST_KEY = "eventListKey";
- private static final String GAME_ID_KEY = "gameId";
- private static final String LOG_TAG = "PushManager";
- private static final String PUSH_SERVER_URL_KEY = "pushNotificationServerUrl";
- private static final String SHARED_PREFS_FILENAME = "PushManagerConfigurationData";
- private static final String TRACKING_PREFS_FILENAME = "PushManagerTrackingData";
- private static final String TRACKING_STATE_KEY = "state";
- private String apiKey;
- private String apiSecret;
- private String appId;
- private Context context;
- private DeviceIdService deviceIdService;
- private String gameId;
- private GoogleCloudMessaging googleCloudMessaging;
- private HttpService httpService;
- private long inAppNotificationInterval;
- private Timer inAppTimer;
- private IPushListener pushListener;
- private String pushNotificationServerUrl;
- private String senderId;
- private String startClientToken;
- private PushNotificationConfig startConfig;
-
- public AndroidPushService(GoogleCloudMessaging googleCloudMessaging, HttpService httpService, DeviceIdService deviceIdService, Context context, IPushListener iPushListener, String str, String str2, String str3, String str4, String str5, String str6, int i) {
- Log.Helper.LOGIS(LOG_TAG, "Instantiating new push mgr", new Object[0]);
- this.googleCloudMessaging = googleCloudMessaging;
- this.httpService = httpService;
- this.deviceIdService = deviceIdService;
- this.context = context;
- this.pushListener = iPushListener;
- this.senderId = str;
- this.pushNotificationServerUrl = str2;
- this.gameId = str3;
- this.appId = str4;
- this.apiKey = str5;
- this.apiSecret = str6;
- this.inAppNotificationInterval = i * 1000;
- }
-
- public AndroidPushService(Context context, HttpService httpService) {
- this.context = context;
- this.httpService = httpService;
- this.pushNotificationServerUrl = loadConfigData(PUSH_SERVER_URL_KEY);
- this.gameId = loadConfigData(GAME_ID_KEY);
- this.apiKey = loadConfigData(API_KEY_KEY);
- this.apiSecret = loadConfigData(API_SECRET_KEY);
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- public IPushListener getPushListener() {
- return this.pushListener;
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- public void setPushListener(IPushListener iPushListener) {
- this.pushListener = iPushListener;
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- @TargetApi(14)
- public void startWithConfig(final PushNotificationConfig pushNotificationConfig, final String str) {
- if (pushNotificationConfig == null) {
- Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]);
- if (this.pushListener != null) {
- this.pushListener.onConnectionError(0, "Config data is null");
- return;
- }
- return;
- }
- if (this.inAppNotificationInterval > 0) {
- this.inAppTimer = new Timer();
- this.inAppTimer.schedule(new TimerTask() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.1
- @Override // java.util.TimerTask, java.lang.Runnable
- public void run() {
- AndroidPushService.this.getInAppNotifications(pushNotificationConfig.getUserAlias(), str);
- }
- }, this.inAppNotificationInterval, this.inAppNotificationInterval);
- }
- if (pushNotificationConfig.isDisabled()) {
- registerDevice(pushNotificationConfig);
- } else {
- new Thread(new Runnable() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.2
- @Override // java.lang.Runnable
- public void run() {
- if (AndroidPushService.this.checkPlayServices()) {
- Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Attempt to register device with GCM", new Object[0]);
- try {
- String register = AndroidPushService.this.googleCloudMessaging.register(AndroidPushService.this.senderId);
- pushNotificationConfig.setRegistrationIdentifier(register);
- pushNotificationConfig.setDisabled(false);
- pushNotificationConfig.setDisabledReason(null);
- Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registered on GCM. Registration id: %s", register), new Object[0]);
- try {
- if (Build.VERSION.SDK_INT >= 14) {
- ((Application) AndroidPushService.this.context.getApplicationContext()).registerActivityLifecycleCallbacks(new PushLifecycleCallbacks());
- }
- } catch (Exception e) {
- Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to register activity lifecycle callbacks: %s", e.getLocalizedMessage());
- }
- } catch (Exception e2) {
- Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to get registration ID from GCM: %s", e2.getLocalizedMessage());
- pushNotificationConfig.setDisabled(true);
- pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE);
- }
- } else {
- Log.Helper.LOGES(AndroidPushService.LOG_TAG, "Failed to find appropriate Google Play Service SDK on device. Registering as disabled", new Object[0]);
- pushNotificationConfig.setDisabled(true);
- pushNotificationConfig.setDisabledReason(PushNotification.DISABLED_REASON_REGISTER_FAILURE);
- }
- AndroidPushService.this.registerDevice(pushNotificationConfig);
- }
- }, "startWithConfig thread").start();
- }
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- public void registerDevice(final PushNotificationConfig pushNotificationConfig) {
- if (pushNotificationConfig == null) {
- Log.Helper.LOGES(LOG_TAG, "Error: Config data is null.", new Object[0]);
- if (this.pushListener != null) {
- this.pushListener.onConnectionError(0, "Config data is null");
- return;
- }
- return;
- }
- if (pushNotificationConfig.getDeviceIdentifier() == null) {
- pushNotificationConfig.setDeviceIdentifier(this.deviceIdService.getDeviceId());
- }
- Log.Helper.LOGIS(LOG_TAG, "Attempt to register device with EADP push notification service", new Object[0]);
- try {
- try {
- HttpRequest resource = this.httpService.getResource(String.format("%s/games/%s/devices", this.pushNotificationServerUrl, this.gameId));
- resource.setHeader("Authorization", createAuthorizationHeader());
- pushNotificationConfig.setAppId(this.appId);
- GsonBuilder gsonBuilder = new GsonBuilder();
- gsonBuilder.registerTypeAdapter(TimeZone.class, new TimeZoneSerializer());
- resource.setJsonBody(gsonBuilder.create().toJson(pushNotificationConfig));
- resource.postAsync(new HttpRequestListener() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.3
- @Override // com.ea.eadp.http.models.HttpRequestListener
- public void onComplete(HttpResponse httpResponse) {
- int code = httpResponse.getCode();
- String body = httpResponse.getBody();
- if (code >= 200 && code < 300) {
- Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Registration request successful!", new Object[0]);
- Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", body), new Object[0]);
- Log.Helper.LOGIS(AndroidPushService.LOG_TAG, String.format("Device registration with server complete. Registered id: %s", pushNotificationConfig.getRegistrationIdentifier()), new Object[0]);
- if (AndroidPushService.this.pushListener != null) {
- AndroidPushService.this.pushListener.onRegistrationSuccess(code, body);
- return;
- }
- return;
- }
- String format = String.format("Registration request failed! Status: %s, Message: %s", Integer.valueOf(code), httpResponse.getMessage());
- Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]);
- Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", body), new Object[0]);
- if (AndroidPushService.this.pushListener != null) {
- AndroidPushService.this.pushListener.onConnectionError(code, format);
- }
- }
- });
- } catch (Exception e) {
- String format = String.format("Failed to register device with Exception: %s", e.getLocalizedMessage());
- Log.Helper.LOGES(LOG_TAG, format, new Object[0]);
- if (this.pushListener != null) {
- this.pushListener.onConnectionError(0, format);
- }
- }
- } finally {
- saveConfigData(pushNotificationConfig);
- }
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- public void sendTrackingEvent(String str, String str2, String str3) {
- try {
- HttpRequest resource = this.httpService.getResource(String.format("%s/games/%s/events", this.pushNotificationServerUrl, this.gameId));
- TrackingEvent trackingEvent = new TrackingEvent(str, str2, str3, loadConfigData(DEVICE_ID_KEY));
- resource.setHeader("Authorization", createAuthorizationHeader());
- resource.setJsonBody(new Gson().toJson(trackingEvent));
- resource.postAsync(new HttpRequestListener() { // from class: com.ea.eadp.pushnotification.services.AndroidPushService.4
- @Override // com.ea.eadp.http.models.HttpRequestListener
- public void onComplete(HttpResponse httpResponse) {
- int code = httpResponse.getCode();
- if (code >= 200 && code < 300) {
- Log.Helper.LOGIS(AndroidPushService.LOG_TAG, "Tracking request successful!", new Object[0]);
- Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]);
- if (AndroidPushService.this.pushListener != null) {
- AndroidPushService.this.pushListener.onTrackingSuccess(code, httpResponse.getBody());
- return;
- }
- return;
- }
- String format = String.format("Tracking request failed! Status: %s, Message: %s", Integer.valueOf(httpResponse.getCode()), httpResponse.getMessage());
- Log.Helper.LOGES(AndroidPushService.LOG_TAG, format, new Object[0]);
- Log.Helper.LOGDS(AndroidPushService.LOG_TAG, String.format("response: %s", httpResponse.getBody()), new Object[0]);
- if (AndroidPushService.this.pushListener != null) {
- AndroidPushService.this.pushListener.onConnectionError(code, format);
- }
- }
- });
- } catch (Exception e) {
- String format = String.format("Tracking request failed with Exception: %s", e.getMessage());
- Log.Helper.LOGES(LOG_TAG, format, new Object[0]);
- if (this.pushListener != null) {
- this.pushListener.onConnectionError(0, format);
- }
- }
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- public void persistTrackingEvent(String str, String str2, String str3) {
- List arrayList;
- SharedPreferences sharedPreferences = this.context.getApplicationContext().getSharedPreferences(TRACKING_PREFS_FILENAME, 0);
- String string = sharedPreferences.getString(EVENT_LIST_KEY, null);
- if (string != null) {
- arrayList = (List) new Gson().fromJson(string, List.class);
- } else {
- arrayList = new ArrayList();
- }
- HashMap hashMap = new HashMap();
- hashMap.put(GcmIntentService.PushIntentExtraKeys.PUSH_ID, str);
- hashMap.put(GcmIntentService.PushIntentExtraKeys.PN_TYPE, str2);
- hashMap.put("state", str3);
- if (arrayList == null) {
- Log.Helper.LOGE(this, "Unexpected Event List. Skipping Tracking event persistence.", new Object[0]);
- return;
- }
- arrayList.add(hashMap);
- SharedPreferences.Editor edit = sharedPreferences.edit();
- edit.putString(EVENT_LIST_KEY, new Gson().toJson(arrayList));
- edit.commit();
- }
-
- @Override // com.ea.eadp.pushnotification.services.IPushService
- public void sendPendingTrackingRequests() {
- Gson gson = new Gson();
- SharedPreferences sharedPreferences = this.context.getSharedPreferences(TRACKING_PREFS_FILENAME, 0);
- String string = sharedPreferences.getString(EVENT_LIST_KEY, null);
- if (string != null) {
- List