892 lines
26 KiB
Smali
892 lines
26 KiB
Smali
.class public final Lcom/discord/stores/StoreSpotify;
|
|
.super Ljava/lang/Object;
|
|
.source "StoreSpotify.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field public final clock:Lcom/discord/utilities/time/Clock;
|
|
|
|
.field public final dispatcher:Lcom/discord/stores/Dispatcher;
|
|
|
|
.field public expireStateSub:Lrx/Subscription;
|
|
|
|
.field public final publishStateTrigger:Lrx/subjects/BehaviorSubject;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lrx/subjects/BehaviorSubject<",
|
|
"Lkotlin/Unit;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public final spotifyApiClient:Lcom/discord/utilities/spotify/SpotifyApiClient;
|
|
|
|
.field public spotifyState:Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
|
|
.field public final stream:Lcom/discord/stores/StoreStream;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lcom/discord/stores/StoreStream;Lcom/discord/stores/Dispatcher;Lcom/discord/utilities/time/Clock;)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
if-eqz p2, :cond_1
|
|
|
|
if-eqz p3, :cond_0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/StoreSpotify;->stream:Lcom/discord/stores/StoreStream;
|
|
|
|
iput-object p2, p0, Lcom/discord/stores/StoreSpotify;->dispatcher:Lcom/discord/stores/Dispatcher;
|
|
|
|
iput-object p3, p0, Lcom/discord/stores/StoreSpotify;->clock:Lcom/discord/utilities/time/Clock;
|
|
|
|
invoke-static {}, Lrx/subjects/BehaviorSubject;->p()Lrx/subjects/BehaviorSubject;
|
|
|
|
move-result-object p1
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/StoreSpotify;->publishStateTrigger:Lrx/subjects/BehaviorSubject;
|
|
|
|
new-instance p1, Lcom/discord/utilities/spotify/SpotifyApiClient;
|
|
|
|
iget-object p2, p0, Lcom/discord/stores/StoreSpotify;->clock:Lcom/discord/utilities/time/Clock;
|
|
|
|
invoke-direct {p1, p2}, Lcom/discord/utilities/spotify/SpotifyApiClient;-><init>(Lcom/discord/utilities/time/Clock;)V
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/StoreSpotify;->spotifyApiClient:Lcom/discord/utilities/spotify/SpotifyApiClient;
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "clock"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const-string p1, "dispatcher"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_2
|
|
const-string p1, "stream"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getClock$p(Lcom/discord/stores/StoreSpotify;)Lcom/discord/utilities/time/Clock;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/stores/StoreSpotify;->clock:Lcom/discord/utilities/time/Clock;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getDispatcher$p(Lcom/discord/stores/StoreSpotify;)Lcom/discord/stores/Dispatcher;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/stores/StoreSpotify;->dispatcher:Lcom/discord/stores/Dispatcher;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getExpireStateSub$p(Lcom/discord/stores/StoreSpotify;)Lrx/Subscription;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/stores/StoreSpotify;->expireStateSub:Lrx/Subscription;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getPublishStateTrigger$p(Lcom/discord/stores/StoreSpotify;)Lrx/subjects/BehaviorSubject;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/stores/StoreSpotify;->publishStateTrigger:Lrx/subjects/BehaviorSubject;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$getSpotifyState$p(Lcom/discord/stores/StoreSpotify;)Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
.locals 0
|
|
|
|
iget-object p0, p0, Lcom/discord/stores/StoreSpotify;->spotifyState:Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static final synthetic access$publishState(Lcom/discord/stores/StoreSpotify;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Lcom/discord/stores/StoreSpotify;->publishState()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$setExpireStateSub$p(Lcom/discord/stores/StoreSpotify;Lrx/Subscription;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/StoreSpotify;->expireStateSub:Lrx/Subscription;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$setSpotifyState$p(Lcom/discord/stores/StoreSpotify;Lcom/discord/stores/StoreSpotify$SpotifyState;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/discord/stores/StoreSpotify;->spotifyState:Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$startStateExpiration(Lcom/discord/stores/StoreSpotify;J)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1, p2}, Lcom/discord/stores/StoreSpotify;->startStateExpiration(J)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private final publishState()V
|
|
.locals 24
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
.end annotation
|
|
|
|
move-object/from16 v0, p0
|
|
|
|
iget-object v1, v0, Lcom/discord/stores/StoreSpotify;->spotifyState:Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
|
|
const/4 v2, 0x2
|
|
|
|
const/4 v3, 0x1
|
|
|
|
const/4 v4, 0x0
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
iget-object v1, v0, Lcom/discord/stores/StoreSpotify;->stream:Lcom/discord/stores/StoreStream;
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreStream;->getPresences$app_productionDiscordExternalRelease()Lcom/discord/stores/StoreUserPresence;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, v2, v4, v3}, Lcom/discord/stores/StoreUserPresence;->updateActivity(ILcom/discord/models/domain/activity/ModelActivity;Z)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
iget-object v1, v0, Lcom/discord/stores/StoreSpotify;->stream:Lcom/discord/stores/StoreStream;
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreStream;->getUserConnections$app_productionDiscordExternalRelease()Lcom/discord/stores/StoreUserConnections;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreUserConnections;->getConnectedAccounts()Ljava/util/List;
|
|
|
|
move-result-object v1
|
|
|
|
instance-of v5, v1, Ljava/util/Collection;
|
|
|
|
const/4 v6, 0x0
|
|
|
|
if-eqz v5, :cond_2
|
|
|
|
invoke-interface {v1}, Ljava/util/Collection;->isEmpty()Z
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :cond_2
|
|
|
|
:cond_1
|
|
const/4 v1, 0x0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
invoke-interface {v1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v1
|
|
|
|
:cond_3
|
|
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :cond_1
|
|
|
|
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v5
|
|
|
|
check-cast v5, Lcom/discord/models/domain/ModelConnectedAccount;
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/ModelConnectedAccount;->getType()Ljava/lang/String;
|
|
|
|
move-result-object v7
|
|
|
|
sget-object v8, Lcom/discord/utilities/platform/Platform;->SPOTIFY:Lcom/discord/utilities/platform/Platform;
|
|
|
|
invoke-virtual {v8}, Lcom/discord/utilities/platform/Platform;->getPlatformId()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-static {v7, v8}, Lx/u/b/j;->areEqual(Ljava/lang/Object;Ljava/lang/Object;)Z
|
|
|
|
move-result v7
|
|
|
|
if-eqz v7, :cond_4
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/ModelConnectedAccount;->isShowActivity()Z
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :cond_4
|
|
|
|
const/4 v5, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_4
|
|
const/4 v5, 0x0
|
|
|
|
:goto_0
|
|
if-eqz v5, :cond_3
|
|
|
|
const/4 v1, 0x1
|
|
|
|
:goto_1
|
|
if-nez v1, :cond_5
|
|
|
|
return-void
|
|
|
|
:cond_5
|
|
iget-object v1, v0, Lcom/discord/stores/StoreSpotify;->spotifyState:Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
|
|
if-eqz v1, :cond_d
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreSpotify$SpotifyState;->component1()Lcom/discord/models/domain/spotify/ModelSpotifyTrack;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreSpotify$SpotifyState;->component2()Z
|
|
|
|
move-result v7
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreSpotify$SpotifyState;->component4()J
|
|
|
|
move-result-wide v8
|
|
|
|
if-eqz v7, :cond_c
|
|
|
|
if-eqz v5, :cond_c
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getAlbum()Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_6
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;->getImages()Ljava/util/List;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_6
|
|
|
|
invoke-static {v1}, Lx/q/l;->firstOrNull(Ljava/util/List;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lcom/discord/models/domain/spotify/ModelSpotifyAlbum$AlbumImage;
|
|
|
|
if-eqz v1, :cond_6
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/spotify/ModelSpotifyAlbum$AlbumImage;->getUrl()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_6
|
|
|
|
const-string v7, "/"
|
|
|
|
filled-new-array {v7}, [Ljava/lang/String;
|
|
|
|
move-result-object v7
|
|
|
|
const/4 v10, 0x6
|
|
|
|
invoke-static {v1, v7, v6, v6, v10}, Lx/a0/u;->split$default(Ljava/lang/CharSequence;[Ljava/lang/String;ZII)Ljava/util/List;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_6
|
|
|
|
invoke-static {v1}, Lx/q/l;->last(Ljava/util/List;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/lang/String;
|
|
|
|
goto :goto_2
|
|
|
|
:cond_6
|
|
move-object v1, v4
|
|
|
|
:goto_2
|
|
const/16 v7, 0x3a
|
|
|
|
if-eqz v1, :cond_7
|
|
|
|
new-instance v10, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
sget-object v11, Lcom/discord/utilities/platform/Platform;->SPOTIFY:Lcom/discord/utilities/platform/Platform;
|
|
|
|
invoke-virtual {v11}, Lcom/discord/utilities/platform/Platform;->getPlatformId()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v10, v7}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v10, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
move-object v14, v1
|
|
|
|
goto :goto_3
|
|
|
|
:cond_7
|
|
move-object v14, v4
|
|
|
|
:goto_3
|
|
sget-object v1, Lcom/discord/utilities/platform/Platform;->SPOTIFY:Lcom/discord/utilities/platform/Platform;
|
|
|
|
invoke-virtual {v1}, Lcom/discord/utilities/platform/Platform;->getProperName()Ljava/lang/String;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getAlbum()Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_8
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
move-object v13, v1
|
|
|
|
goto :goto_4
|
|
|
|
:cond_8
|
|
move-object v13, v4
|
|
|
|
:goto_4
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getArtists()Ljava/util/List;
|
|
|
|
move-result-object v15
|
|
|
|
const/16 v16, 0x0
|
|
|
|
const/16 v17, 0x0
|
|
|
|
const/16 v18, 0x0
|
|
|
|
const/16 v19, 0x0
|
|
|
|
const/16 v20, 0x0
|
|
|
|
sget-object v21, Lcom/discord/stores/StoreSpotify$publishState$activity$1;->INSTANCE:Lcom/discord/stores/StoreSpotify$publishState$activity$1;
|
|
|
|
const/16 v22, 0x1f
|
|
|
|
invoke-static/range {v15 .. v22}, Lx/q/l;->joinToString$default(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;I)Ljava/lang/String;
|
|
|
|
move-result-object v15
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getArtists()Ljava/util/List;
|
|
|
|
move-result-object v16
|
|
|
|
const/16 v19, 0x0
|
|
|
|
const/16 v20, 0x0
|
|
|
|
const/16 v21, 0x0
|
|
|
|
sget-object v22, Lcom/discord/stores/StoreSpotify$publishState$activity$2;->INSTANCE:Lcom/discord/stores/StoreSpotify$publishState$activity$2;
|
|
|
|
const/16 v23, 0x1f
|
|
|
|
invoke-static/range {v16 .. v23}, Lx/q/l;->joinToString$default(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;I)Ljava/lang/String;
|
|
|
|
move-result-object v16
|
|
|
|
invoke-static {v8, v9}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v17
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getDurationMs()J
|
|
|
|
move-result-wide v18
|
|
|
|
add-long v18, v18, v8
|
|
|
|
invoke-static/range {v18 .. v19}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v18
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
sget-object v8, Lcom/discord/utilities/platform/Platform;->SPOTIFY:Lcom/discord/utilities/platform/Platform;
|
|
|
|
invoke-virtual {v8}, Lcom/discord/utilities/platform/Platform;->getPlatformId()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v1, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
iget-object v7, v0, Lcom/discord/stores/StoreSpotify;->stream:Lcom/discord/stores/StoreStream;
|
|
|
|
invoke-virtual {v7}, Lcom/discord/stores/StoreStream;->getUsers$app_productionDiscordExternalRelease()Lcom/discord/stores/StoreUser;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v7}, Lcom/discord/stores/StoreUser;->getMeInternal$app_productionDiscordExternalRelease()Lcom/discord/models/domain/ModelUser$Me;
|
|
|
|
move-result-object v7
|
|
|
|
if-eqz v7, :cond_9
|
|
|
|
invoke-virtual {v7}, Lcom/discord/models/domain/ModelUser;->getId()J
|
|
|
|
move-result-wide v7
|
|
|
|
invoke-static {v7, v8}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v7
|
|
|
|
goto :goto_5
|
|
|
|
:cond_9
|
|
move-object v7, v4
|
|
|
|
:goto_5
|
|
invoke-virtual {v1, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v19
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getAlbum()Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_a
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
:cond_a
|
|
move-object/from16 v20, v4
|
|
|
|
invoke-static/range {v10 .. v20}, Lcom/discord/models/domain/activity/ModelActivity;->createForListening(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;)Lcom/discord/models/domain/activity/ModelActivity;
|
|
|
|
move-result-object v1
|
|
|
|
iget-object v4, v0, Lcom/discord/stores/StoreSpotify;->stream:Lcom/discord/stores/StoreStream;
|
|
|
|
invoke-virtual {v4}, Lcom/discord/stores/StoreStream;->getPresences$app_productionDiscordExternalRelease()Lcom/discord/stores/StoreUserPresence;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4, v2, v1, v3}, Lcom/discord/stores/StoreUserPresence;->updateActivity(ILcom/discord/models/domain/activity/ModelActivity;Z)V
|
|
|
|
sget-object v1, Lcom/discord/utilities/analytics/AnalyticsTracker;->INSTANCE:Lcom/discord/utilities/analytics/AnalyticsTracker;
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v5}, Lcom/discord/models/domain/spotify/ModelSpotifyTrack;->getAlbum()Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;
|
|
|
|
move-result-object v4
|
|
|
|
if-eqz v4, :cond_b
|
|
|
|
invoke-virtual {v4}, Lcom/discord/models/domain/spotify/ModelSpotifyAlbum;->getImages()Ljava/util/List;
|
|
|
|
move-result-object v4
|
|
|
|
if-eqz v4, :cond_b
|
|
|
|
invoke-interface {v4}, Ljava/util/Collection;->isEmpty()Z
|
|
|
|
move-result v4
|
|
|
|
xor-int/lit8 v6, v4, 0x1
|
|
|
|
:cond_b
|
|
invoke-virtual {v1, v2, v6}, Lcom/discord/utilities/analytics/AnalyticsTracker;->activityUpdatedSpotify(Ljava/lang/String;Z)V
|
|
|
|
goto :goto_6
|
|
|
|
:cond_c
|
|
iget-object v1, v0, Lcom/discord/stores/StoreSpotify;->stream:Lcom/discord/stores/StoreStream;
|
|
|
|
invoke-virtual {v1}, Lcom/discord/stores/StoreStream;->getPresences$app_productionDiscordExternalRelease()Lcom/discord/stores/StoreUserPresence;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, v2, v4, v3}, Lcom/discord/stores/StoreUserPresence;->updateActivity(ILcom/discord/models/domain/activity/ModelActivity;Z)V
|
|
|
|
:goto_6
|
|
return-void
|
|
|
|
:cond_d
|
|
invoke-static {}, Lx/u/b/j;->throwNpe()V
|
|
|
|
throw v4
|
|
.end method
|
|
|
|
.method private final startStateExpiration(J)V
|
|
.locals 10
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
.end annotation
|
|
|
|
const-wide/16 v0, 0x1388
|
|
|
|
add-long/2addr p1, v0
|
|
|
|
sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-static {p1, p2, v0}, Lrx/Observable;->h(JLjava/util/concurrent/TimeUnit;)Lrx/Observable;
|
|
|
|
move-result-object v1
|
|
|
|
const-string p1, "Observable\n .time\u2026), TimeUnit.MILLISECONDS)"
|
|
|
|
invoke-static {v1, p1}, Lx/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-class v2, Lcom/discord/stores/StoreSpotify;
|
|
|
|
new-instance v4, Lcom/discord/stores/StoreSpotify$startStateExpiration$1;
|
|
|
|
invoke-direct {v4, p0}, Lcom/discord/stores/StoreSpotify$startStateExpiration$1;-><init>(Lcom/discord/stores/StoreSpotify;)V
|
|
|
|
new-instance v7, Lcom/discord/stores/StoreSpotify$startStateExpiration$2;
|
|
|
|
invoke-direct {v7, p0}, Lcom/discord/stores/StoreSpotify$startStateExpiration$2;-><init>(Lcom/discord/stores/StoreSpotify;)V
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/16 v8, 0x1a
|
|
|
|
const/4 v9, 0x0
|
|
|
|
invoke-static/range {v1 .. v9}, 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
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final handleConnectionOpen(Lcom/discord/models/domain/ModelPayload;)V
|
|
.locals 1
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-virtual {p1}, Lcom/discord/models/domain/ModelPayload;->getConnectedAccounts()Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "payload.connectedAccounts"
|
|
|
|
invoke-static {p1, v0}, Lx/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0, p1}, Lcom/discord/stores/StoreSpotify;->handleUserConnections(Ljava/util/List;)V
|
|
|
|
iget-object p1, p0, Lcom/discord/stores/StoreSpotify;->publishStateTrigger:Lrx/subjects/BehaviorSubject;
|
|
|
|
sget-object v0, Lkotlin/Unit;->a:Lkotlin/Unit;
|
|
|
|
invoke-virtual {p1, v0}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "payload"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public final handleConnectionReady(Z)V
|
|
.locals 1
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
.end annotation
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
iget-object p1, p0, Lcom/discord/stores/StoreSpotify;->publishStateTrigger:Lrx/subjects/BehaviorSubject;
|
|
|
|
sget-object v0, Lkotlin/Unit;->a:Lkotlin/Unit;
|
|
|
|
invoke-virtual {p1, v0}, Lrx/subjects/BehaviorSubject;->onNext(Ljava/lang/Object;)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public final handlePreLogout()V
|
|
.locals 1
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput-object v0, p0, Lcom/discord/stores/StoreSpotify;->spotifyState:Lcom/discord/stores/StoreSpotify$SpotifyState;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public final handleUserConnections(Ljava/util/List;)V
|
|
.locals 5
|
|
.annotation runtime Lcom/discord/stores/StoreThread;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/List<",
|
|
"Lcom/discord/models/domain/ModelConnectedAccount;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
if-eqz p1, :cond_3
|
|
|
|
invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p1
|
|
|
|
:cond_0
|
|
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
move-object v2, v1
|
|
|
|
check-cast v2, Lcom/discord/models/domain/ModelConnectedAccount;
|
|
|
|
sget-object v3, Lcom/discord/utilities/platform/Platform;->SPOTIFY:Lcom/discord/utilities/platform/Platform;
|
|
|
|
invoke-virtual {v3}, Ljava/lang/Enum;->name()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v2}, Lcom/discord/models/domain/ModelConnectedAccount;->getType()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v4, 0x1
|
|
|
|
invoke-static {v3, v2, v4}, Lx/a0/p;->equals(Ljava/lang/String;Ljava/lang/String;Z)Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
move-object v1, v0
|
|
|
|
:goto_0
|
|
check-cast v1, Lcom/discord/models/domain/ModelConnectedAccount;
|
|
|
|
iget-object p1, p0, Lcom/discord/stores/StoreSpotify;->spotifyApiClient:Lcom/discord/utilities/spotify/SpotifyApiClient;
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
invoke-virtual {v1}, Lcom/discord/models/domain/ModelConnectedAccount;->getId()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_2
|
|
invoke-virtual {p1, v0}, Lcom/discord/utilities/spotify/SpotifyApiClient;->setSpotifyAccountId(Ljava/lang/String;)V
|
|
|
|
return-void
|
|
|
|
:cond_3
|
|
const-string p1, "accounts"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public final init(Landroid/content/Context;)V
|
|
.locals 12
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-static {p1}, Lcom/discord/utilities/integrations/SpotifyHelper;->registerSpotifyBroadcastReceivers(Landroid/content/Context;)V
|
|
|
|
iget-object p1, p0, Lcom/discord/stores/StoreSpotify;->publishStateTrigger:Lrx/subjects/BehaviorSubject;
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/StoreSpotify;->spotifyApiClient:Lcom/discord/utilities/spotify/SpotifyApiClient;
|
|
|
|
invoke-virtual {v0}, Lcom/discord/utilities/spotify/SpotifyApiClient;->getSpotifyTrack()Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/stores/StoreSpotify$init$1;->INSTANCE:Lcom/discord/stores/StoreSpotify$init$1;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->k(Lf0/l/i;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Lrx/Observable;->a()Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/stores/StoreSpotify$init$2;->INSTANCE:Lcom/discord/stores/StoreSpotify$init$2;
|
|
|
|
invoke-static {p1, v0, v1}, Lrx/Observable;->a(Lrx/Observable;Lrx/Observable;Lrx/functions/Func2;)Lrx/Observable;
|
|
|
|
move-result-object p1
|
|
|
|
const-wide/16 v0, 0x2
|
|
|
|
sget-object v2, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-virtual {p1, v0, v1, v2}, Lrx/Observable;->b(JLjava/util/concurrent/TimeUnit;)Lrx/Observable;
|
|
|
|
move-result-object v3
|
|
|
|
const-string p1, "Observable.combineLatest\u2026unce(2, TimeUnit.SECONDS)"
|
|
|
|
invoke-static {v3, p1}, Lx/u/b/j;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-class v4, Lcom/discord/stores/StoreSpotify;
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/4 v7, 0x0
|
|
|
|
const/4 v8, 0x0
|
|
|
|
new-instance v9, Lcom/discord/stores/StoreSpotify$init$3;
|
|
|
|
invoke-direct {v9, p0}, Lcom/discord/stores/StoreSpotify$init$3;-><init>(Lcom/discord/stores/StoreSpotify;)V
|
|
|
|
const/16 v10, 0x1e
|
|
|
|
const/4 v11, 0x0
|
|
|
|
invoke-static/range {v3 .. v11}, 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
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "context"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public final setCurrentTrackId(Ljava/lang/String;)V
|
|
.locals 1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/StoreSpotify;->spotifyApiClient:Lcom/discord/utilities/spotify/SpotifyApiClient;
|
|
|
|
invoke-virtual {v0, p1}, Lcom/discord/utilities/spotify/SpotifyApiClient;->fetchSpotifyTrack(Ljava/lang/String;)V
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
const-string p1, "trackId"
|
|
|
|
invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public final setPlayingStatus(ZI)V
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lcom/discord/stores/StoreSpotify;->dispatcher:Lcom/discord/stores/Dispatcher;
|
|
|
|
new-instance v1, Lcom/discord/stores/StoreSpotify$setPlayingStatus$1;
|
|
|
|
invoke-direct {v1, p0, p1, p2}, Lcom/discord/stores/StoreSpotify$setPlayingStatus$1;-><init>(Lcom/discord/stores/StoreSpotify;ZI)V
|
|
|
|
invoke-virtual {v0, v1}, Lcom/discord/stores/Dispatcher;->schedule(Lkotlin/jvm/functions/Function0;)V
|
|
|
|
return-void
|
|
.end method
|