Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ final class AppleAuthenticationService: AuthenticationService {
}

func deleteAuth(_ uid: String) async throws {
guard let currentUser = Auth.auth().currentUser else {
throw AuthError.notAuthenticated
}

let token = try await refreshAppleAccessToken()

try await revokeAppleAccessToken(token: token)
Expand All @@ -110,8 +114,9 @@ final class AppleAuthenticationService: AuthenticationService {

_ = try await deleteFunction.call(["uid": uid])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

uid 파라미터 대신 currentUser.uid를 사용하는 것이 더 안전하고 명확합니다. 함수 시작 부분에서 currentUser의 유효성을 이미 확인했으므로, 이 currentUseruid를 사용하여 Firestore 데이터를 삭제하는 것이 일관성을 유지하고 잠재적인 불일치 문제를 방지할 수 있습니다.

Suggested change
_ = try await deleteFunction.call(["uid": uid])
_ = try await deleteFunction.call(["uid": currentUser.uid])


try await signOut(uid)
try await user?.delete()
try await currentUser.delete()
try await messaging.deleteToken()
try Auth.auth().signOut()
}

func link(uid: String, email: String) async throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,19 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
}

func deleteAuth(_ uid: String) async throws {
guard let currentUser = Auth.auth().currentUser else {
throw AuthError.notAuthenticated
}

try await revokeAccessToken()

let deleteFunction = functions.httpsCallable("deleteUserFirestoreData")

_ = try await deleteFunction.call(["uid": uid])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

uid 파라미터 대신 currentUser.uid를 사용하는 것이 더 안전하고 명확합니다. 함수 시작 부분에서 currentUser의 유효성을 이미 확인했으므로, 이 currentUseruid를 사용하여 Firestore 데이터를 삭제하는 것이 일관성을 유지하고 잠재적인 불일치 문제를 방지할 수 있습니다.

Suggested change
_ = try await deleteFunction.call(["uid": uid])
_ = try await deleteFunction.call(["uid": currentUser.uid])


try await signOut(uid)
try await user?.delete()
try await currentUser.delete()
try await messaging.deleteToken()
try Auth.auth().signOut()
}

func link(uid: String, email: String) async throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,19 @@ final class GoogleAuthenticationService: AuthenticationService {
}

func deleteAuth(_ uid: String) async throws {
guard let currentUser = Auth.auth().currentUser else {
throw AuthError.notAuthenticated
}

let deleteFunction = functions.httpsCallable("deleteUserFirestoreData")

_ = try await deleteFunction.call(["uid": uid])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

uid 파라미터 대신 currentUser.uid를 사용하는 것이 더 안전하고 명확합니다. 함수 시작 부분에서 currentUser의 유효성을 이미 확인했으므로, 이 currentUseruid를 사용하여 Firestore 데이터를 삭제하는 것이 일관성을 유지하고 잠재적인 불일치 문제를 방지할 수 있습니다.

Suggested change
_ = try await deleteFunction.call(["uid": uid])
_ = try await deleteFunction.call(["uid": currentUser.uid])


try await signOut(uid)
try await Auth.auth().currentUser?.delete()
try await currentUser.delete()
GIDSignIn.sharedInstance.signOut()
try await GIDSignIn.sharedInstance.disconnect()
try await messaging.deleteToken()
try Auth.auth().signOut()
}

func link(uid: String, email: String) async throws {
Expand Down
1 change: 1 addition & 0 deletions DevLog/Presentation/ViewModel/SettingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ final class SettingViewModel: Store {
send(.setAlert(isPresented: false))
send(.setLoading(true))
try await deleteAuthuseCase.execute()
sessionUseCase.execute(false)
} catch {
send(.setAlert(isPresented: true, type: .error))
}
Expand Down