Skip to content

Commit

Permalink
Merge pull request Health-Food-Me#256 from L-j-h-c/feature/Health-Foo…
Browse files Browse the repository at this point in the history
…d-Me#255

[Fix] Health-Food-Me#255 - 카카오 로그인 오류 해결
  • Loading branch information
L-j-h-c authored Sep 11, 2022
2 parents 41b8127 + f2e828b commit 63b6416
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ struct SocialLoginEntity: Codable {

// MARK: - User
struct User: Codable {
let id, name, email, agent: String
let id, name, agent: String
let email: String?

enum CodingKeys: String, CodingKey {
case id = "_id"
Expand Down
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 63b6416

Please sign in to comment.