Files
rr3-apk/smali_classes2/com/ea/eadp/pushnotification/services/AndroidPushService.smali
Daniel Elliott f3960ee359 Add Discord APKTool decompilation (Smali source for modding)
- Imported from https://github.com/supermegamestre/Project-Real-Resurrection-3
- APKTool decompilation (Smali bytecode) for modding and rebuilding APK
- Supports both 32-bit (armeabi-v7a) and 64-bit (arm64-v8a) architectures
- Includes full Smali source, resources, and native libraries
- Ready to rebuild APK after modifications with apktool b command
- Added comprehensive README-apktool.md with modding guide

This branch complements the JADX branches:
- Use JADX (main/discord-community) to UNDERSTAND code (readable Java)
- Use APKTool (this branch) to MODIFY and REBUILD APK (editable Smali)

Total: 44,417 files, 538.51 MB Smali source code
2026-02-18 16:13:44 -08:00

1233 lines
38 KiB
Smali

.class public final Lcom/ea/eadp/pushnotification/services/AndroidPushService;
.super Ljava/lang/Object;
.source "SourceFile"
# interfaces
.implements Lcom/ea/eadp/pushnotification/services/IPushService;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/ea/eadp/pushnotification/services/AndroidPushService$TimeZoneSerializer;
}
.end annotation
# static fields
.field private static final API_KEY_KEY:Ljava/lang/String; = "apiKey"
.field private static final API_SECRET_KEY:Ljava/lang/String; = "apiSecret"
.field public static final AUTHORIZATION:Ljava/lang/String; = "Authorization"
.field private static final DEVICE_ID_KEY:Ljava/lang/String; = "deviceId"
.field private static final EVENT_LIST_KEY:Ljava/lang/String; = "eventListKey"
.field private static final GAME_ID_KEY:Ljava/lang/String; = "gameId"
.field private static final LOG_TAG:Ljava/lang/String; = "PushManager"
.field private static final PUSH_SERVER_URL_KEY:Ljava/lang/String; = "pushNotificationServerUrl"
.field private static final SHARED_PREFS_FILENAME:Ljava/lang/String; = "PushManagerConfigurationData"
.field private static final TRACKING_PREFS_FILENAME:Ljava/lang/String; = "PushManagerTrackingData"
.field private static final TRACKING_STATE_KEY:Ljava/lang/String; = "state"
# instance fields
.field private final apiKey:Ljava/lang/String;
.field private final apiSecret:Ljava/lang/String;
.field private appId:Ljava/lang/String;
.field private final context:Landroid/content/Context;
.field private currentConfig:Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
.field private deviceIdService:Lcom/ea/eadp/deviceid/DeviceIdService;
.field private final gameId:Ljava/lang/String;
.field private final httpService:Lcom/ea/eadp/http/services/HttpService;
.field private inAppNotificationInterval:J
.field private inAppTimer:Ljava/util/Timer;
.field private pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
.field private final pushNotificationServerUrl:Ljava/lang/String;
.field private startClientToken:Ljava/lang/String;
.field private startConfig:Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/ea/eadp/http/services/HttpService;)V
.locals 0
.line 101
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
iput-object p2, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->httpService:Lcom/ea/eadp/http/services/HttpService;
const-string p1, "pushNotificationServerUrl"
.line 105
invoke-direct {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->loadConfigData(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
const-string p1, "gameId"
.line 106
invoke-direct {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->loadConfigData(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
const-string p1, "apiKey"
.line 107
invoke-direct {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->loadConfigData(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiKey:Ljava/lang/String;
const-string p1, "apiSecret"
.line 108
invoke-direct {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->loadConfigData(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiSecret:Ljava/lang/String;
return-void
.end method
.method public constructor <init>(Lcom/ea/eadp/http/services/HttpService;Lcom/ea/eadp/deviceid/DeviceIdService;Landroid/content/Context;Lcom/ea/eadp/pushnotification/listeners/IPushListener;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
.locals 3
.line 85
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const/4 v0, 0x0
new-array v0, v0, [Ljava/lang/Object;
const-string v1, "PushManager"
const-string v2, "Instantiating new push mgr"
.line 86
invoke-static {v1, v2, v0}, Lcom/ea/nimble/Log$Helper;->LOGIS(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->httpService:Lcom/ea/eadp/http/services/HttpService;
iput-object p2, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->deviceIdService:Lcom/ea/eadp/deviceid/DeviceIdService;
iput-object p3, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
iput-object p4, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
iput-object p5, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
iput-object p6, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
iput-object p7, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->appId:Ljava/lang/String;
iput-object p8, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiKey:Ljava/lang/String;
iput-object p9, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiSecret:Ljava/lang/String;
int-to-long p1, p10
const-wide/16 p3, 0x3e8
mul-long/2addr p1, p3
iput-wide p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppNotificationInterval:J
return-void
.end method
.method public static synthetic access$000(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Z
.locals 0
.line 49
invoke-direct {p0}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->checkPlayServices()Z
move-result p0
return p0
.end method
.method public static synthetic access$100(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Landroid/content/Context;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
return-object p0
.end method
.method public static synthetic access$300(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Lcom/ea/eadp/pushnotification/listeners/IPushListener;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
return-object p0
.end method
.method public static synthetic access$400(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Ljava/lang/String;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
return-object p0
.end method
.method public static synthetic access$500(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Ljava/lang/String;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
return-object p0
.end method
.method public static synthetic access$600(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Lcom/ea/eadp/http/services/HttpService;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->httpService:Lcom/ea/eadp/http/services/HttpService;
return-object p0
.end method
.method public static synthetic access$700(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->startConfig:Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
return-object p0
.end method
.method public static synthetic access$800(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)Ljava/lang/String;
.locals 0
.line 49
iget-object p0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->startClientToken:Ljava/lang/String;
return-object p0
.end method
.method private checkPlayServices()Z
.locals 2
.line 526
invoke-static {}, Lcom/google/android/gms/common/GoogleApiAvailabilityLight;->getInstance()Lcom/google/android/gms/common/GoogleApiAvailabilityLight;
move-result-object v0
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
invoke-virtual {v0, v1}, Lcom/google/android/gms/common/GoogleApiAvailabilityLight;->isGooglePlayServicesAvailable(Landroid/content/Context;)I
move-result v0
if-nez v0, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return v0
.end method
.method private createAuthorizationHeader()Ljava/lang/String;
.locals 2
.line 582
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiKey:Ljava/lang/String;
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const/16 v1, 0x3a
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiSecret:Ljava/lang/String;
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
sget-object v1, Ljava/nio/charset/StandardCharsets;->UTF_8:Ljava/nio/charset/Charset;
invoke-virtual {v0, v1}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
move-result-object v0
const/16 v1, 0xa
invoke-static {v0, v1}, Landroid/util/Base64;->encodeToString([BI)Ljava/lang/String;
move-result-object v0
filled-new-array {v0}, [Ljava/lang/Object;
move-result-object v0
const-string v1, "Basic %s"
invoke-static {v1, v0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method private loadConfigData(Ljava/lang/String;)Ljava/lang/String;
.locals 3
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
.line 572
invoke-virtual {v0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
const-string v1, "PushManagerConfigurationData"
const/4 v2, 0x0
invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
const/4 v1, 0x0
.line 574
invoke-interface {v0, p1, v1}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
return-object p1
.end method
.method private saveConfigData(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
.locals 3
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
.line 537
invoke-virtual {v0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
const-string v1, "PushManagerConfigurationData"
const/4 v2, 0x0
invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
.line 538
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
.line 540
invoke-virtual {p1}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->getDeviceIdentifier()Ljava/lang/String;
move-result-object v1
const-string v2, ""
if-eqz v1, :cond_0
invoke-virtual {p1}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->getDeviceIdentifier()Ljava/lang/String;
move-result-object v1
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-nez v1, :cond_0
const-string v1, "deviceId"
.line 542
invoke-virtual {p1}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->getDeviceIdentifier()Ljava/lang/String;
move-result-object p1
invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
:cond_0
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
if-eqz p1, :cond_1
.line 544
invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-nez p1, :cond_1
const-string p1, "pushNotificationServerUrl"
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
.line 546
invoke-interface {v0, p1, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
:cond_1
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
if-eqz p1, :cond_2
.line 548
invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-nez p1, :cond_2
const-string p1, "gameId"
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
.line 550
invoke-interface {v0, p1, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
:cond_2
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiKey:Ljava/lang/String;
if-eqz p1, :cond_3
.line 552
invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-nez p1, :cond_3
const-string p1, "apiKey"
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiKey:Ljava/lang/String;
.line 554
invoke-interface {v0, p1, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
:cond_3
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiSecret:Ljava/lang/String;
if-eqz p1, :cond_4
.line 556
invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-nez p1, :cond_4
const-string p1, "apiSecret"
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->apiSecret:Ljava/lang/String;
.line 558
invoke-interface {v0, p1, v1}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
.line 561
:cond_4
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
return-void
.end method
# virtual methods
.method public getInAppNotifications(Ljava/lang/String;Ljava/lang/String;)V
.locals 2
if-nez p1, :cond_1
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
if-eqz p1, :cond_0
const/4 p2, 0x0
const-string v0, "UserAlias is null"
.line 440
invoke-interface {p1, p2, v0}, Lcom/ea/eadp/pushnotification/listeners/IPushListener;->onConnectionError(ILjava/lang/String;)V
:cond_0
return-void
.line 445
:cond_1
new-instance v0, Ljava/lang/Thread;
new-instance v1, Lcom/ea/eadp/pushnotification/services/AndroidPushService$5;
invoke-direct {v1, p0, p1, p2}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$5;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService;Ljava/lang/String;Ljava/lang/String;)V
const-string p1, "getInAppNotifications thread"
invoke-direct {v0, v1, p1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V
.line 494
invoke-virtual {v0}, Ljava/lang/Thread;->start()V
return-void
.end method
.method public getPushListener()Lcom/ea/eadp/pushnotification/listeners/IPushListener;
.locals 1
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
return-object v0
.end method
.method public onRestart()V
.locals 7
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppTimer:Ljava/util/Timer;
if-eqz v0, :cond_0
iget-wide v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppNotificationInterval:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-lez v0, :cond_0
.line 503
new-instance v1, Ljava/util/Timer;
invoke-direct {v1}, Ljava/util/Timer;-><init>()V
iput-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppTimer:Ljava/util/Timer;
.line 504
new-instance v2, Lcom/ea/eadp/pushnotification/services/AndroidPushService$6;
invoke-direct {v2, p0}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$6;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)V
iget-wide v5, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppNotificationInterval:J
move-wide v3, v5
invoke-virtual/range {v1 .. v6}, Ljava/util/Timer;->schedule(Ljava/util/TimerTask;JJ)V
:cond_0
return-void
.end method
.method public onStop()V
.locals 1
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppTimer:Ljava/util/Timer;
if-eqz v0, :cond_0
.line 520
invoke-virtual {v0}, Ljava/util/Timer;->cancel()V
:cond_0
return-void
.end method
.method public persistTrackingEvent(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
.locals 6
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
.line 366
invoke-virtual {v0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;
move-result-object v0
const-string v1, "PushManagerTrackingData"
const/4 v2, 0x0
invoke-virtual {v0, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
const/4 v1, 0x0
const-string v3, "eventListKey"
.line 370
invoke-interface {v0, v3, v1}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
if-eqz v1, :cond_0
.line 373
new-instance v4, Lcom/google/gson/Gson;
invoke-direct {v4}, Lcom/google/gson/Gson;-><init>()V
const-class v5, Ljava/util/List;
.line 374
invoke-virtual {v4, v1, v5}, Lcom/google/gson/Gson;->fromJson(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/List;
goto :goto_0
.line 378
:cond_0
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
.line 381
:goto_0
new-instance v4, Ljava/util/HashMap;
invoke-direct {v4}, Ljava/util/HashMap;-><init>()V
const-string v5, "pushId"
.line 382
invoke-interface {v4, v5, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const-string p1, "pnType"
.line 383
invoke-interface {v4, p1, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
const-string p1, "state"
.line 384
invoke-interface {v4, p1, p3}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
if-nez v1, :cond_1
const-string p1, "Unexpected Event List. Skipping Tracking event persistence."
new-array p2, v2, [Ljava/lang/Object;
.line 388
invoke-static {p0, p1, p2}, Lcom/ea/nimble/Log$Helper;->LOGE(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
return-void
.line 392
:cond_1
invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 394
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object p1
.line 396
new-instance p2, Lcom/google/gson/Gson;
invoke-direct {p2}, Lcom/google/gson/Gson;-><init>()V
invoke-virtual {p2, v1}, Lcom/google/gson/Gson;->toJson(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p2
invoke-interface {p1, v3, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
.line 397
invoke-interface {p1}, Landroid/content/SharedPreferences$Editor;->apply()V
return-void
.end method
.method public registerDevice(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
.locals 8
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->currentConfig:Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
const-string v0, "PushManager"
const/4 v1, 0x0
if-nez p1, :cond_1
const-string p1, "Error: Config data is null."
new-array v2, v1, [Ljava/lang/Object;
.line 232
invoke-static {v0, p1, v2}, Lcom/ea/nimble/Log$Helper;->LOGES(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
if-eqz p1, :cond_0
const-string v0, "Config data is null"
.line 235
invoke-interface {p1, v1, v0}, Lcom/ea/eadp/pushnotification/listeners/IPushListener;->onConnectionError(ILjava/lang/String;)V
:cond_0
return-void
.line 240
:cond_1
invoke-virtual {p1}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->getDeviceIdentifier()Ljava/lang/String;
move-result-object v2
if-nez v2, :cond_2
iget-object v2, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->deviceIdService:Lcom/ea/eadp/deviceid/DeviceIdService;
.line 242
invoke-interface {v2}, Lcom/ea/eadp/deviceid/DeviceIdService;->getDeviceId()Ljava/lang/String;
move-result-object v2
invoke-virtual {p1, v2}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->setDeviceIdentifier(Ljava/lang/String;)V
:cond_2
const-string v2, "Attempt to register device with EADP push notification service"
new-array v3, v1, [Ljava/lang/Object;
.line 245
invoke-static {v0, v2, v3}, Lcom/ea/nimble/Log$Helper;->LOGIS(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
const/4 v2, 0x1
:try_start_0
const-string v3, "%s/games/%s/devices"
const/4 v4, 0x2
new-array v4, v4, [Ljava/lang/Object;
iget-object v5, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
aput-object v5, v4, v1
iget-object v5, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
aput-object v5, v4, v2
.line 250
invoke-static {v3, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v3
iget-object v4, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->httpService:Lcom/ea/eadp/http/services/HttpService;
.line 251
invoke-interface {v4, v3}, Lcom/ea/eadp/http/services/HttpService;->getResource(Ljava/lang/String;)Lcom/ea/eadp/http/models/HttpRequest;
move-result-object v3
const-string v4, "Authorization"
.line 252
invoke-direct {p0}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->createAuthorizationHeader()Ljava/lang/String;
move-result-object v5
invoke-interface {v3, v4, v5}, Lcom/ea/eadp/http/models/HttpRequest;->setHeader(Ljava/lang/String;Ljava/lang/String;)Lcom/ea/eadp/http/models/HttpRequest;
iget-object v4, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->appId:Ljava/lang/String;
.line 253
invoke-virtual {p1, v4}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->setAppId(Ljava/lang/String;)V
.line 255
new-instance v4, Lcom/google/gson/GsonBuilder;
invoke-direct {v4}, Lcom/google/gson/GsonBuilder;-><init>()V
const-class v5, Ljava/util/TimeZone;
.line 256
new-instance v6, Lcom/ea/eadp/pushnotification/services/AndroidPushService$TimeZoneSerializer;
const/4 v7, 0x0
invoke-direct {v6, v7}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$TimeZoneSerializer;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService$1;)V
invoke-virtual {v4, v5, v6}, Lcom/google/gson/GsonBuilder;->registerTypeAdapter(Ljava/lang/reflect/Type;Ljava/lang/Object;)Lcom/google/gson/GsonBuilder;
.line 257
invoke-virtual {v4}, Lcom/google/gson/GsonBuilder;->create()Lcom/google/gson/Gson;
move-result-object v4
invoke-virtual {v4, p1}, Lcom/google/gson/Gson;->toJson(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v4
invoke-interface {v3, v4}, Lcom/ea/eadp/http/models/HttpRequest;->setJsonBody(Ljava/lang/String;)Lcom/ea/eadp/http/models/HttpRequest;
.line 258
new-instance v4, Lcom/ea/eadp/pushnotification/services/AndroidPushService$3;
invoke-direct {v4, p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$3;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService;Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
invoke-interface {v3, v4}, Lcom/ea/eadp/http/models/HttpRequest;->postAsync(Lcom/ea/eadp/http/models/HttpRequestListener;)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 304
:cond_3
:goto_0
invoke-direct {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->saveConfigData(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
goto :goto_1
:catchall_0
move-exception v0
goto :goto_2
:catch_0
move-exception v3
:try_start_1
const-string v4, "Failed to register device with Exception: %s"
new-array v2, v2, [Ljava/lang/Object;
.line 294
invoke-virtual {v3}, Ljava/lang/Throwable;->getLocalizedMessage()Ljava/lang/String;
move-result-object v3
aput-object v3, v2, v1
invoke-static {v4, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v2
new-array v3, v1, [Ljava/lang/Object;
.line 295
invoke-static {v0, v2, v3}, Lcom/ea/nimble/Log$Helper;->LOGES(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
if-eqz v0, :cond_3
.line 299
invoke-interface {v0, v1, v2}, Lcom/ea/eadp/pushnotification/listeners/IPushListener;->onConnectionError(ILjava/lang/String;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
:goto_1
return-void
.line 304
:goto_2
invoke-direct {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->saveConfigData(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
.line 305
throw v0
.end method
.method public sendPendingTrackingRequests()V
.locals 6
.line 403
new-instance v0, Lcom/google/gson/Gson;
invoke-direct {v0}, Lcom/google/gson/Gson;-><init>()V
iget-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->context:Landroid/content/Context;
const-string v2, "PushManagerTrackingData"
const/4 v3, 0x0
.line 404
invoke-virtual {v1, v2, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v1
const-string v2, "eventListKey"
const/4 v4, 0x0
.line 405
invoke-interface {v1, v2, v4}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
if-eqz v2, :cond_2
const-class v4, Ljava/util/List;
.line 409
invoke-virtual {v0, v2, v4}, Lcom/google/gson/Gson;->fromJson(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/List;
if-nez v0, :cond_0
const-string v0, "Event List from Json is null!"
new-array v1, v3, [Ljava/lang/Object;
.line 412
invoke-static {p0, v0, v1}, Lcom/ea/nimble/Log$Helper;->LOGE(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V
return-void
.line 415
:cond_0
invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v0
:cond_1
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_2
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/util/Map;
if-eqz v2, :cond_1
.line 417
invoke-interface {v2}, Ljava/util/Map;->isEmpty()Z
move-result v3
if-nez v3, :cond_1
const-string v3, "pushId"
.line 419
invoke-interface {v2, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/String;
const-string v4, "pnType"
.line 420
invoke-interface {v2, v4}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v4
check-cast v4, Ljava/lang/String;
const-string v5, "state"
.line 421
invoke-interface {v2, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/String;
.line 422
invoke-virtual {p0, v3, v4, v2}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->sendTrackingEvent(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
goto :goto_0
.line 428
:cond_2
invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
.line 429
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->clear()Landroid/content/SharedPreferences$Editor;
.line 430
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
return-void
.end method
.method public sendTrackingEvent(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
.locals 5
const/4 v0, 0x0
:try_start_0
const-string v1, "%s/games/%s/events"
const/4 v2, 0x2
new-array v2, v2, [Ljava/lang/Object;
iget-object v3, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushNotificationServerUrl:Ljava/lang/String;
aput-object v3, v2, v0
iget-object v3, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->gameId:Ljava/lang/String;
const/4 v4, 0x1
aput-object v3, v2, v4
.line 312
invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v1
iget-object v2, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->httpService:Lcom/ea/eadp/http/services/HttpService;
.line 313
invoke-interface {v2, v1}, Lcom/ea/eadp/http/services/HttpService;->getResource(Ljava/lang/String;)Lcom/ea/eadp/http/models/HttpRequest;
move-result-object v1
.line 315
new-instance v2, Lcom/ea/eadp/pushnotification/services/TrackingEvent;
const-string v3, "deviceId"
invoke-direct {p0, v3}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->loadConfigData(Ljava/lang/String;)Ljava/lang/String;
move-result-object v3
invoke-direct {v2, p1, p2, p3, v3}, Lcom/ea/eadp/pushnotification/services/TrackingEvent;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
const-string p1, "Authorization"
.line 316
invoke-direct {p0}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->createAuthorizationHeader()Ljava/lang/String;
move-result-object p2
invoke-interface {v1, p1, p2}, Lcom/ea/eadp/http/models/HttpRequest;->setHeader(Ljava/lang/String;Ljava/lang/String;)Lcom/ea/eadp/http/models/HttpRequest;
.line 317
new-instance p1, Lcom/google/gson/Gson;
invoke-direct {p1}, Lcom/google/gson/Gson;-><init>()V
invoke-virtual {p1, v2}, Lcom/google/gson/Gson;->toJson(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p1
invoke-interface {v1, p1}, Lcom/ea/eadp/http/models/HttpRequest;->setJsonBody(Ljava/lang/String;)Lcom/ea/eadp/http/models/HttpRequest;
.line 319
new-instance p1, Lcom/ea/eadp/pushnotification/services/AndroidPushService$4;
invoke-direct {p1, p0}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$4;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService;)V
invoke-interface {v1, p1}, Lcom/ea/eadp/http/models/HttpRequest;->postAsync(Lcom/ea/eadp/http/models/HttpRequestListener;)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p1
.line 351
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
filled-new-array {p1}, [Ljava/lang/Object;
move-result-object p1
const-string p2, "Tracking request failed with Exception: %s"
invoke-static {p2, p1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object p1
const-string p2, "PushManager"
new-array p3, v0, [Ljava/lang/Object;
.line 352
invoke-static {p2, p1, p3}, Lcom/ea/nimble/Log$Helper;->LOGES(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
iget-object p2, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
if-eqz p2, :cond_0
.line 356
invoke-interface {p2, v0, p1}, Lcom/ea/eadp/pushnotification/listeners/IPushListener;->onConnectionError(ILjava/lang/String;)V
:cond_0
:goto_0
return-void
.end method
.method public setPushListener(Lcom/ea/eadp/pushnotification/listeners/IPushListener;)V
.locals 0
iput-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
return-void
.end method
.method public startWithConfig(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;Ljava/lang/String;)V
.locals 7
.line 123
invoke-static {p0}, Lcom/ea/nimble/Log$Helper;->LOGPUBLICFUNC(Ljava/lang/Object;)V
if-nez p1, :cond_1
const-string p1, "Error: Config data is null."
const/4 p2, 0x0
new-array v0, p2, [Ljava/lang/Object;
const-string v1, "PushManager"
.line 127
invoke-static {v1, p1, v0}, Lcom/ea/nimble/Log$Helper;->LOGES(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->pushListener:Lcom/ea/eadp/pushnotification/listeners/IPushListener;
if-eqz p1, :cond_0
const-string v0, "Config data is null"
.line 130
invoke-interface {p1, p2, v0}, Lcom/ea/eadp/pushnotification/listeners/IPushListener;->onConnectionError(ILjava/lang/String;)V
:cond_0
return-void
:cond_1
iget-wide v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppNotificationInterval:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-lez v0, :cond_2
.line 137
new-instance v1, Ljava/util/Timer;
invoke-direct {v1}, Ljava/util/Timer;-><init>()V
iput-object v1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppTimer:Ljava/util/Timer;
.line 138
new-instance v2, Lcom/ea/eadp/pushnotification/services/AndroidPushService$1;
invoke-direct {v2, p0, p1, p2}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$1;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService;Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;Ljava/lang/String;)V
iget-wide v5, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->inAppNotificationInterval:J
move-wide v3, v5
invoke-virtual/range {v1 .. v6}, Ljava/util/Timer;->schedule(Ljava/util/TimerTask;JJ)V
.line 148
:cond_2
invoke-virtual {p1}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->isDisabled()Z
move-result p2
if-eqz p2, :cond_3
.line 150
invoke-virtual {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->registerDevice(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
return-void
.line 154
:cond_3
new-instance p2, Ljava/lang/Thread;
new-instance v0, Lcom/ea/eadp/pushnotification/services/AndroidPushService$2;
invoke-direct {v0, p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService$2;-><init>(Lcom/ea/eadp/pushnotification/services/AndroidPushService;Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
const-string p1, "startWithConfig thread"
invoke-direct {p2, v0, p1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V
.line 215
invoke-virtual {p2}, Ljava/lang/Thread;->start()V
return-void
.end method
.method public updateToken(Ljava/lang/String;)V
.locals 1
iget-object v0, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->currentConfig:Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
if-eqz v0, :cond_0
.line 222
invoke-virtual {v0, p1}, Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;->setRegistrationIdentifier(Ljava/lang/String;)V
iget-object p1, p0, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->currentConfig:Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;
.line 223
invoke-virtual {p0, p1}, Lcom/ea/eadp/pushnotification/services/AndroidPushService;->registerDevice(Lcom/ea/eadp/pushnotification/models/PushNotificationConfig;)V
:cond_0
return-void
.end method