Skip to content

Commit

Permalink
[Feat] Health-Food-Me#255 - 로그아웃 시 카카오 로그인 logout 하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
L-j-h-c committed Sep 11, 2022
1 parent 41b8127 commit aee0343
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ extension MainInfoTVC {
distanceLabel.text = "\(data.restaurant.distance)m"
}
self.expandableData = data.restaurant.toDomain()
print(self.expandableData)

initialReload()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit

import SnapKit
import MessageUI
import KakaoSDKUser

enum HamburgerType {
case editName
Expand Down Expand Up @@ -431,9 +432,11 @@ extension HamburgerBarVC {
self.makeAlert(alertType: .logoutAlert,
title: I18N.HelfmeAlert.logout,
subtitle: I18N.HelfmeAlert.logoutContent) {
let loginVC = ModuleFactory.resolve().makeLoginVC()
UserManager.shared.clearUserInform()
self.navigationController?.pushViewController(loginVC, animated: true)
if UserManager.shared.isAppleLoginned {

} else {
self.logoutWithKakao()
}
}
}

Expand All @@ -444,6 +447,24 @@ extension HamburgerBarVC {
}
}

private func logoutWithKakao() {
UserApi.shared.logout {(error) in
if let error = error {
print(error)
}
else {
print("카카오 로그아웃 완료")
UserManager.shared.clearUserInform()
self.pushSocialLoginVC()
}
}
}

private func pushSocialLoginVC() {
let loginVC = ModuleFactory.resolve().makeLoginVC()
self.navigationController?.pushViewController(loginVC, animated: true)
}

private func presentSocialLoginAlert() {
let alert = ModuleFactory.resolve().makeHelfmeLoginAlertVC()
alert.modalPresentationStyle = .overFullScreen
Expand Down

0 comments on commit aee0343

Please sign in to comment.