Skip to content

Commit

Permalink
Logout from Gravatar when logging out in PocketCasts
Browse files Browse the repository at this point in the history
  • Loading branch information
hamorillo committed Oct 31, 2024
1 parent aeea00c commit fad4f18
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/services/repositories/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ dependencies {
implementation(libs.coroutines.rx2)
implementation(libs.device.names)
implementation(libs.guava)
implementation(libs.gravatar)
implementation(libs.gravatar.qe)
implementation(libs.lifecycle.process)
implementation(libs.lifecycle.reactivestreams.ktx)
implementation(libs.material)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ import au.com.shiftyjelly.pocketcasts.repositories.searchhistory.SearchHistoryMa
import au.com.shiftyjelly.pocketcasts.repositories.subscription.SubscriptionManager
import au.com.shiftyjelly.pocketcasts.repositories.sync.AccountManagerStatusInfo
import au.com.shiftyjelly.pocketcasts.repositories.sync.SyncManager
import au.com.shiftyjelly.pocketcasts.utils.featureflag.Feature
import au.com.shiftyjelly.pocketcasts.utils.featureflag.FeatureFlag
import au.com.shiftyjelly.pocketcasts.utils.log.LogBuffer
import com.automattic.android.tracks.crashlogging.CrashLogging
import com.gravatar.quickeditor.GravatarQuickEditor
import com.gravatar.types.Email
import dagger.hilt.android.qualifiers.ApplicationContext
import io.reactivex.BackpressureStrategy
import io.reactivex.Flowable
Expand Down Expand Up @@ -113,6 +117,20 @@ class UserManagerImpl @Inject constructor(
override fun signOut(playbackManager: PlaybackManager, wasInitiatedByUser: Boolean) {
if (wasInitiatedByUser || !settings.getFullySignedOut()) {
LogBuffer.i(LogBuffer.TAG_BACKGROUND_TASKS, "Signing out")

// Logout from Gravatar
if (FeatureFlag.isEnabled(Feature.GRAVATAR_NATIVE_QUICK_EDITOR)) {
(getSignInState().blockingFirst() as? SignInState.SignedIn)?.email?.let { email ->
applicationScope.launch {
GravatarQuickEditor.logout(
email = Email(
email,
),
)
}
}
}

subscriptionManager.clearCachedStatus()
syncManager.signOut {
applicationScope.launch {
Expand Down

0 comments on commit fad4f18

Please sign in to comment.