Skip to content

Commit

Permalink
✨ :: [#496] 로그아웃, 로그인에 Analytics UserID 지정
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Apr 23, 2024
1 parent 33a3236 commit 7ff8b92
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import ErrorModule
import Foundation
Expand Down Expand Up @@ -65,6 +66,7 @@ public final class ContainSongsViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
logoutRelay.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseDomainInterface
import BaseFeatureInterface
Expand Down Expand Up @@ -81,6 +82,7 @@ public final class MultiPurposePopupViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
logoutRelay.accept(error)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down Expand Up @@ -116,6 +118,7 @@ public final class MultiPurposePopupViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
logoutRelay.accept(error)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down Expand Up @@ -145,6 +148,7 @@ public final class MultiPurposePopupViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
logoutRelay.accept(error)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down Expand Up @@ -179,6 +183,7 @@ public final class MultiPurposePopupViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
logoutRelay.accept(error)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseFeature
import Combine
Expand Down Expand Up @@ -212,6 +213,7 @@ final class PlayerViewModel: ViewModelType {
logoutUseCase.execute()
.andThen(Observable.just(()))
.bind { _ in
AnalyticsLogManager.setUserID(userID: nil)
output.onLogout.send(())
}
.disposed(by: disposeBag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseDomainInterface
import BaseFeature
Expand Down Expand Up @@ -151,6 +152,7 @@ public final class PlayListDetailViewModel: ViewModelType {

if wmError == .tokenExpired {
logoutRelay.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
}
Expand Down Expand Up @@ -219,6 +221,7 @@ public final class PlayListDetailViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
logoutRelay.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AppDomainInterface
import AuthDomainInterface
import BaseFeature
Expand Down Expand Up @@ -112,6 +113,7 @@ public final class IntroViewModel: ViewModelType {
.flatMap { isExist in
output.userInfoResult.onNext(.success(""))
if isExist {
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(Observable.just(false))
} else {
Expand All @@ -136,6 +138,7 @@ public final class IntroViewModel: ViewModelType {
logoutUseCase.execute()
.andThen(Observable.just(()))
.bind {
AnalyticsLogManager.setUserID(userID: nil)
Utility.PreferenceManager.startPage = 4
}
.disposed(by: disposeBag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import AuthenticationServices
import BaseFeature
Expand Down Expand Up @@ -82,6 +83,7 @@ public final class LoginViewModel: NSObject, ViewModelType { // 네이버 델리
.asObservable()
}
.bind {
AnalyticsLogManager.setUserID(userID: $0.id)
PreferenceManager.shared.setUserInfo(
ID: AES256.encrypt(string: $0.id),
platform: $0.platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseFeature
import Foundation
Expand Down Expand Up @@ -66,6 +67,7 @@ public final class AfterLoginViewModel: ViewModelType {
input.pressLogOut
.compactMap { PreferenceManager.userInfo?.platform }
.flatMap { [naverLoginInstance, logoutUseCase] platform in
AnalyticsLogManager.setUserID(userID: nil)
switch platform {
case "naver":
naverLoginInstance?.resetToken()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseDomainInterface
import BaseFeature
Expand Down Expand Up @@ -170,6 +171,7 @@ public final class FavoriteViewModel: ViewModelType {

if wmError == .tokenExpired {
output.onLogout.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
}
Expand Down Expand Up @@ -241,6 +243,7 @@ public final class FavoriteViewModel: ViewModelType {

if wmError == .tokenExpired {
output.onLogout.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseDomainInterface
import BaseFeature
Expand Down Expand Up @@ -168,6 +169,7 @@ public final class MyPlayListViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
output.onLogout.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down Expand Up @@ -221,6 +223,7 @@ public final class MyPlayListViewModel: ViewModelType {
let wmError = error.asWMError
if wmError == .tokenExpired {
output.onLogout.accept(wmError)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseDomainInterface
import BaseFeature
Expand Down Expand Up @@ -91,6 +92,7 @@ public final class ProfilePopViewModel {

if wmError == .tokenExpired {
output.onLogout.accept(error)
AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(.never())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2023 yongbeomkwak. All rights reserved.
//

import AnalyticsLogManager
import AuthDomainInterface
import BaseDomainInterface
import BaseFeature
Expand Down Expand Up @@ -60,6 +61,7 @@ public final class RequestViewModel: ViewModelType {
naverLoginInstance?.requestDeleteToken()
}

AnalyticsLogManager.setUserID(userID: nil)
return logoutUseCase.execute()
.andThen(Single.just(entity))
}
Expand Down

0 comments on commit 7ff8b92

Please sign in to comment.