apkfuckery/com.discord/smali/com/discord/stores/StoreRunningGame.smali

634 lines
19 KiB
Smali

.class public final Lcom/discord/stores/StoreRunningGame;
.super Lcom/discord/stores/Store;
.source "StoreRunningGame.kt"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/discord/stores/StoreRunningGame$RunningGame;,
Lcom/discord/stores/StoreRunningGame$Companion;
}
.end annotation
# static fields
.field public static final Companion:Lcom/discord/stores/StoreRunningGame$Companion;
.field private static final RUNNING_GAME_HEARTBEAT_INTERVAL_SECS:J = 0x5aL
# instance fields
.field private context:Landroid/content/Context;
.field private final forceGameDetectionSubject:Lrx/subjects/BehaviorSubject;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lrx/subjects/BehaviorSubject<",
"Lkotlin/Unit;",
">;"
}
.end annotation
.end field
.field private runningGame:Lcom/discord/stores/StoreRunningGame$RunningGame;
.field private runningGameHeartbeatSub:Lrx/Subscription;
.field private final runningGameSubject:Lrx/subjects/BehaviorSubject;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lrx/subjects/BehaviorSubject<",
"Lcom/discord/stores/StoreRunningGame$RunningGame;",
">;"
}
.end annotation
.end field
.field private final stream:Lcom/discord/stores/StoreStream;
.field private final trackedLaunchedTimes:Ljava/util/HashMap;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/HashMap<",
"Ljava/lang/String;",
"Ljava/lang/Long;",
">;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.locals 2
new-instance v0, Lcom/discord/stores/StoreRunningGame$Companion;
const/4 v1, 0x0
invoke-direct {v0, v1}, Lcom/discord/stores/StoreRunningGame$Companion;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
sput-object v0, Lcom/discord/stores/StoreRunningGame;->Companion:Lcom/discord/stores/StoreRunningGame$Companion;
return-void
.end method
.method public constructor <init>(Lcom/discord/stores/StoreStream;)V
.locals 1
const-string v0, "stream"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
invoke-direct {p0}, Lcom/discord/stores/Store;-><init>()V
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->stream:Lcom/discord/stores/StoreStream;
iget-object p1, p0, Lcom/discord/stores/StoreRunningGame;->runningGame:Lcom/discord/stores/StoreRunningGame$RunningGame;
invoke-static {p1}, Lrx/subjects/BehaviorSubject;->bI(Ljava/lang/Object;)Lrx/subjects/BehaviorSubject;
move-result-object p1
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->runningGameSubject:Lrx/subjects/BehaviorSubject;
new-instance p1, Ljava/util/HashMap;
invoke-direct {p1}, Ljava/util/HashMap;-><init>()V
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->trackedLaunchedTimes:Ljava/util/HashMap;
sget-object p1, Lkotlin/Unit;->bbV:Lkotlin/Unit;
invoke-static {p1}, Lrx/subjects/BehaviorSubject;->bI(Ljava/lang/Object;)Lrx/subjects/BehaviorSubject;
move-result-object p1
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->forceGameDetectionSubject:Lrx/subjects/BehaviorSubject;
return-void
.end method
.method public static final synthetic access$getContext$p(Lcom/discord/stores/StoreRunningGame;)Landroid/content/Context;
.locals 1
iget-object p0, p0, Lcom/discord/stores/StoreRunningGame;->context:Landroid/content/Context;
if-nez p0, :cond_0
const-string v0, "context"
invoke-static {v0}, Lkotlin/jvm/internal/j;->dq(Ljava/lang/String;)V
:cond_0
return-object p0
.end method
.method public static final synthetic access$getRunningGame$p(Lcom/discord/stores/StoreRunningGame;)Lcom/discord/stores/StoreRunningGame$RunningGame;
.locals 0
iget-object p0, p0, Lcom/discord/stores/StoreRunningGame;->runningGame:Lcom/discord/stores/StoreRunningGame$RunningGame;
return-object p0
.end method
.method public static final synthetic access$getRunningGameHeartbeatSub$p(Lcom/discord/stores/StoreRunningGame;)Lrx/Subscription;
.locals 0
iget-object p0, p0, Lcom/discord/stores/StoreRunningGame;->runningGameHeartbeatSub:Lrx/Subscription;
return-object p0
.end method
.method public static final synthetic access$getRunningGameSubject$p(Lcom/discord/stores/StoreRunningGame;)Lrx/subjects/BehaviorSubject;
.locals 0
iget-object p0, p0, Lcom/discord/stores/StoreRunningGame;->runningGameSubject:Lrx/subjects/BehaviorSubject;
return-object p0
.end method
.method public static final synthetic access$isGameDetectionForceStopped$p(Lcom/discord/stores/StoreRunningGame;)Z
.locals 0
invoke-direct {p0}, Lcom/discord/stores/StoreRunningGame;->isGameDetectionForceStopped()Z
move-result p0
return p0
.end method
.method public static final synthetic access$setContext$p(Lcom/discord/stores/StoreRunningGame;Landroid/content/Context;)V
.locals 0
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->context:Landroid/content/Context;
return-void
.end method
.method public static final synthetic access$setGameDetectionForceStopped$p(Lcom/discord/stores/StoreRunningGame;Z)V
.locals 0
invoke-direct {p0, p1}, Lcom/discord/stores/StoreRunningGame;->setGameDetectionForceStopped(Z)V
return-void
.end method
.method public static final synthetic access$setRunningGame$p(Lcom/discord/stores/StoreRunningGame;Lcom/discord/stores/StoreRunningGame$RunningGame;)V
.locals 0
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->runningGame:Lcom/discord/stores/StoreRunningGame$RunningGame;
return-void
.end method
.method public static final synthetic access$setRunningGameHeartbeatSub$p(Lcom/discord/stores/StoreRunningGame;Lrx/Subscription;)V
.locals 0
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->runningGameHeartbeatSub:Lrx/Subscription;
return-void
.end method
.method public static final synthetic access$trackLaunchGame(Lcom/discord/stores/StoreRunningGame;Lcom/discord/stores/StoreRunningGame$RunningGame;)V
.locals 0
invoke-direct {p0, p1}, Lcom/discord/stores/StoreRunningGame;->trackLaunchGame(Lcom/discord/stores/StoreRunningGame$RunningGame;)V
return-void
.end method
.method public static final synthetic access$updatePresence(Lcom/discord/stores/StoreRunningGame;Lcom/discord/stores/StoreRunningGame$RunningGame;)V
.locals 0
invoke-direct {p0, p1}, Lcom/discord/stores/StoreRunningGame;->updatePresence(Lcom/discord/stores/StoreRunningGame$RunningGame;)V
return-void
.end method
.method private final isGameDetectionForceStopped()Z
.locals 7
const/4 v0, 0x0
:try_start_0
invoke-virtual {p0}, Lcom/discord/stores/StoreRunningGame;->getPrefs()Landroid/content/SharedPreferences;
move-result-object v1
const-string v2, "CACHE_KEY_GAME_DETECTION_FORCE_STOPPED"
invoke-interface {v1, v2, v0}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
move-result v0
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
sget-object v1, Lcom/discord/app/AppLog;->tb:Lcom/discord/app/AppLog;
const-string v2, "StoreRunningGame prefs not init"
new-instance v3, Ljava/lang/Exception;
const-string v4, "Get isGameDetectionForceStopped"
invoke-direct {v3, v4}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V
check-cast v3, Ljava/lang/Throwable;
const/4 v4, 0x0
const/4 v5, 0x4
const/4 v6, 0x0
invoke-static/range {v1 .. v6}, Lcom/discord/utilities/logging/Logger;->e$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/Throwable;Ljava/util/Map;ILjava/lang/Object;)V
:goto_0
return v0
.end method
.method private final setGameDetectionForceStopped(Z)V
.locals 6
:try_start_0
invoke-virtual {p0}, Lcom/discord/stores/StoreRunningGame;->getPrefs()Landroid/content/SharedPreferences;
move-result-object v0
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
const-string v1, "CACHE_KEY_GAME_DETECTION_FORCE_STOPPED"
invoke-interface {v0, v1, p1}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
move-result-object p1
invoke-interface {p1}, Landroid/content/SharedPreferences$Editor;->apply()V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
return-void
:catch_0
sget-object v0, Lcom/discord/app/AppLog;->tb:Lcom/discord/app/AppLog;
const-string v1, "StoreRunningGame prefs not init"
new-instance p1, Ljava/lang/Exception;
const-string v2, "Set isGameDetectionForceStopped"
invoke-direct {p1, v2}, Ljava/lang/Exception;-><init>(Ljava/lang/String;)V
move-object v2, p1
check-cast v2, Ljava/lang/Throwable;
const/4 v3, 0x0
const/4 v4, 0x4
const/4 v5, 0x0
invoke-static/range {v0 .. v5}, Lcom/discord/utilities/logging/Logger;->e$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/Throwable;Ljava/util/Map;ILjava/lang/Object;)V
return-void
.end method
.method private final trackLaunchGame(Lcom/discord/stores/StoreRunningGame$RunningGame;)V
.locals 6
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->runningGame:Lcom/discord/stores/StoreRunningGame$RunningGame;
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->n(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_3
if-nez p1, :cond_0
goto :goto_0
:cond_0
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->trackedLaunchedTimes:Ljava/util/HashMap;
invoke-virtual {p1}, Lcom/discord/stores/StoreRunningGame$RunningGame;->getPackageName()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Long;
if-eqz v0, :cond_1
invoke-virtual {v0}, Ljava/lang/Long;->longValue()J
move-result-wide v0
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v2
const-wide/32 v4, 0xdbba0
sub-long/2addr v2, v4
cmp-long v4, v0, v2
if-gtz v4, :cond_2
:cond_1
sget-object v0, Lcom/discord/utilities/analytics/AnalyticsTracker;->INSTANCE:Lcom/discord/utilities/analytics/AnalyticsTracker;
invoke-virtual {p1}, Lcom/discord/stores/StoreRunningGame$RunningGame;->getAppName()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/discord/utilities/analytics/AnalyticsTracker;->launchGame(Ljava/lang/String;)V
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->trackedLaunchedTimes:Ljava/util/HashMap;
check-cast v0, Ljava/util/Map;
invoke-virtual {p1}, Lcom/discord/stores/StoreRunningGame$RunningGame;->getPackageName()Ljava/lang/String;
move-result-object p1
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v1
invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
move-result-object v1
invoke-interface {v0, p1, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:cond_2
return-void
:cond_3
:goto_0
return-void
.end method
.method private final updatePresence(Lcom/discord/stores/StoreRunningGame$RunningGame;)V
.locals 3
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->stream:Lcom/discord/stores/StoreStream;
iget-object v0, v0, Lcom/discord/stores/StoreStream;->presences:Lcom/discord/stores/StoreUserPresence;
if-eqz p1, :cond_0
invoke-virtual {p1}, Lcom/discord/stores/StoreRunningGame$RunningGame;->getAppName()Ljava/lang/String;
move-result-object p1
goto :goto_0
:cond_0
const/4 p1, 0x0
:goto_0
invoke-static {p1}, Lcom/discord/models/domain/ModelPresence$Activity;->createForPlaying(Ljava/lang/String;)Lcom/discord/models/domain/ModelPresence$Activity;
move-result-object p1
const/4 v1, 0x1
const/4 v2, 0x0
invoke-virtual {v0, v2, p1, v1}, Lcom/discord/stores/StoreUserPresence;->updateActivity(ILcom/discord/models/domain/ModelPresence$Activity;Z)V
return-void
.end method
# virtual methods
.method public final forceGameDetection()V
.locals 2
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->forceGameDetectionSubject:Lrx/subjects/BehaviorSubject;
sget-object v1, Lkotlin/Unit;->bbV:Lkotlin/Unit;
invoke-virtual {v0, v1}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
return-void
.end method
.method public final getForceGameDetection()Lrx/Observable;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lrx/Observable<",
"Lkotlin/Unit;",
">;"
}
.end annotation
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->forceGameDetectionSubject:Lrx/subjects/BehaviorSubject;
const-string v1, "forceGameDetectionSubject"
invoke-static {v0, v1}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
check-cast v0, Lrx/Observable;
return-object v0
.end method
.method public final getRunningGame()Lrx/Observable;
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Lrx/Observable<",
"Lcom/discord/stores/StoreRunningGame$RunningGame;",
">;"
}
.end annotation
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->runningGameSubject:Lrx/subjects/BehaviorSubject;
invoke-virtual {v0}, Lrx/subjects/BehaviorSubject;->Dz()Lrx/Observable;
move-result-object v0
const-string v1, "runningGameSubject.distinctUntilChanged()"
invoke-static {v0, v1}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
return-object v0
.end method
.method public final getStream()Lcom/discord/stores/StoreStream;
.locals 1
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->stream:Lcom/discord/stores/StoreStream;
return-object v0
.end method
.method public final handleConnectionOpen()V
.locals 18
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
invoke-static {}, Lcom/discord/utilities/games/GameDetectionHelper;->isGameDetectionSupported()Z
move-result v0
if-eqz v0, :cond_0
invoke-static {}, Lcom/discord/stores/StoreStream;->getExperiments()Lcom/discord/stores/StoreExperiments;
move-result-object v0
invoke-virtual {v0}, Lcom/discord/stores/StoreExperiments;->getExperimentalAlpha()Lrx/Observable;
move-result-object v0
invoke-static {}, Lcom/discord/stores/StoreStream;->getExperiments()Lcom/discord/stores/StoreExperiments;
move-result-object v1
const-string v2, "2018-11_android_game_detection"
const/4 v3, 0x2
const/4 v4, 0x0
invoke-static {v1, v2, v4, v3, v4}, Lcom/discord/stores/StoreExperiments;->getExperiment$default(Lcom/discord/stores/StoreExperiments;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lrx/Observable;
move-result-object v1
sget-object v2, Lcom/discord/stores/StoreRunningGame$handleConnectionOpen$1;->INSTANCE:Lcom/discord/stores/StoreRunningGame$handleConnectionOpen$1;
check-cast v2, Lrx/functions/Func2;
invoke-static {v0, v1, v2}, Lrx/Observable;->a(Lrx/Observable;Lrx/Observable;Lrx/functions/Func2;)Lrx/Observable;
move-result-object v3
const-string v0, "Observable\n .co\u2026onExp to isStaffOrAlpha }"
invoke-static {v3, v0}, Lkotlin/jvm/internal/j;->g(Ljava/lang/Object;Ljava/lang/String;)V
const-wide/16 v4, 0x0
const/4 v6, 0x0
const/4 v7, 0x3
const/4 v8, 0x0
invoke-static/range {v3 .. v8}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->takeSingleUntilTimeout$default(Lrx/Observable;JZILjava/lang/Object;)Lrx/Observable;
move-result-object v9
invoke-virtual/range {p0 .. p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v10
const/4 v11, 0x0
const/4 v12, 0x0
const/4 v13, 0x0
const/4 v14, 0x0
new-instance v0, Lcom/discord/stores/StoreRunningGame$handleConnectionOpen$2;
move-object/from16 v1, p0
invoke-direct {v0, v1}, Lcom/discord/stores/StoreRunningGame$handleConnectionOpen$2;-><init>(Lcom/discord/stores/StoreRunningGame;)V
move-object v15, v0
check-cast v15, Lkotlin/jvm/functions/Function1;
const/16 v16, 0x1e
const/16 v17, 0x0
invoke-static/range {v9 .. v17}, Lcom/discord/utilities/rx/ObservableExtensionsKt;->appSubscribe$default(Lrx/Observable;Ljava/lang/Class;Landroid/content/Context;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
goto :goto_0
:cond_0
move-object/from16 v1, p0
:goto_0
return-void
.end method
.method public final handlePreLogout()V
.locals 3
.annotation runtime Lcom/discord/stores/StoreThread;
.end annotation
sget-object v0, Lcom/discord/utilities/games/GameDetectionService;->Companion:Lcom/discord/utilities/games/GameDetectionService$Companion;
iget-object v1, p0, Lcom/discord/stores/StoreRunningGame;->context:Landroid/content/Context;
if-nez v1, :cond_0
const-string v2, "context"
invoke-static {v2}, Lkotlin/jvm/internal/j;->dq(Ljava/lang/String;)V
:cond_0
invoke-virtual {v0, v1}, Lcom/discord/utilities/games/GameDetectionService$Companion;->stop(Landroid/content/Context;)V
return-void
.end method
.method protected final init(Landroid/content/Context;)V
.locals 1
const-string v0, "context"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
invoke-super {p0, p1}, Lcom/discord/stores/Store;->init(Landroid/content/Context;)V
iput-object p1, p0, Lcom/discord/stores/StoreRunningGame;->context:Landroid/content/Context;
return-void
.end method
.method public final setRunningGame(Landroid/content/Context;Lcom/discord/stores/StoreRunningGame$RunningGame;)V
.locals 2
const-string v0, "context"
invoke-static {p1, v0}, Lkotlin/jvm/internal/j;->h(Ljava/lang/Object;Ljava/lang/String;)V
iget-object v0, p0, Lcom/discord/stores/StoreRunningGame;->stream:Lcom/discord/stores/StoreStream;
new-instance v1, Lcom/discord/stores/StoreRunningGame$setRunningGame$1;
invoke-direct {v1, p0, p2, p1}, Lcom/discord/stores/StoreRunningGame$setRunningGame$1;-><init>(Lcom/discord/stores/StoreRunningGame;Lcom/discord/stores/StoreRunningGame$RunningGame;Landroid/content/Context;)V
check-cast v1, Lrx/functions/Action0;
invoke-virtual {v0, v1}, Lcom/discord/stores/StoreStream;->schedule(Lrx/functions/Action0;)V
return-void
.end method