Skip to content

Commit 2f11223

Browse files
committed
refactor: 문서가 없어도 로그아웃에는 문제가 없도록 개선
1 parent 8cf8263 commit 2f11223

3 files changed

Lines changed: 3 additions & 15 deletions

File tree

Application/DevLogInfra/Sources/Service/SocialLogin/AppleAuthenticationServiceImpl.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,7 @@ final class AppleAuthenticationServiceImpl: AuthenticationService {
116116
func signOut(_ uid: String) async throws {
117117
do {
118118
let infoRef = store.document(FirestorePath.userData(uid, document: .tokens))
119-
let doc = try await infoRef.getDocument()
120-
121-
if doc.exists {
122-
try await infoRef.updateData(["fcmToken": FieldValue.delete()])
123-
}
119+
try? await infoRef.updateData(["fcmToken": FieldValue.delete()])
124120

125121
if messaging.fcmToken != nil {
126122
do {

Application/DevLogInfra/Sources/Service/SocialLogin/GithubAuthenticationServiceImpl.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ final class GithubAuthenticationServiceImpl: NSObject, AuthenticationService {
101101
func signOut(_ uid: String) async throws {
102102
do {
103103
let infoRef = store.document(FirestorePath.userData(uid, document: .tokens))
104-
let doc = try await infoRef.getDocument()
105-
106-
if doc.exists {
107-
try await infoRef.updateData(["fcmToken": FieldValue.delete()])
108-
}
104+
try? await infoRef.updateData(["fcmToken": FieldValue.delete()])
109105

110106
if messaging.fcmToken != nil {
111107
do {

Application/DevLogInfra/Sources/Service/SocialLogin/GoogleAuthenticationServiceImpl.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ final class GoogleAuthenticationServiceImpl: AuthenticationService {
7777
func signOut(_ uid: String) async throws {
7878
do {
7979
let infoRef = store.document(FirestorePath.userData(uid, document: .tokens))
80-
let doc = try await infoRef.getDocument()
81-
82-
if doc.exists {
83-
try await infoRef.updateData(["fcmToken": FieldValue.delete()])
84-
}
80+
try? await infoRef.updateData(["fcmToken": FieldValue.delete()])
8581

8682
GIDSignIn.sharedInstance.signOut()
8783
try await GIDSignIn.sharedInstance.disconnect()

0 commit comments

Comments
 (0)