Skip to content

Commit

Permalink
[Merge] #141 - 로그아웃, 회원탈퇴 액션 함수 추가
Browse files Browse the repository at this point in the history
Feat [#140] 로그아웃, 회원탈퇴 액션 함수 추가
  • Loading branch information
boogios authored Feb 12, 2024
2 parents 37610c9 + 50f3081 commit 280f4f0
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 8 deletions.
1 change: 1 addition & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/ImageLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ enum ImageLiterals {
static var btnAccount: UIImage { .load(name: "btn_acoount") }
static var btnFeedback: UIImage { .load(name: "btn_feedback") }
static var btnCustomerCenter: UIImage { .load(name: "btn_customerCenter") }
static var btnLogout: UIImage { .load(name: "btn_logout") }
}

enum TransparencyInfo {
Expand Down
4 changes: 4 additions & 0 deletions DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ enum StringLiterals {
static let myPageCustomerURL = "https://joyous-ghost-8c7.notion.site/Don-t-be-e949f7751de94ba682f4bd6792cbe36e"
static let myPageFeedbackURL = "https://forms.gle/DqnypURRBDks7WqJ6"
static let myPageUseTermURL = "https://joyous-ghost-8c7.notion.site/4ac9966cf7d944bf9595352edbc1b1b0"
static let myPageMoreInfoTitle = "이용약관"
static let myPageMoreInfoButtonTitle = "자세히 보기"
static let myPageSignOutButtonTitle = "회원탈퇴"
}

enum TransparencyInfo {
Expand Down Expand Up @@ -141,6 +144,7 @@ enum StringLiterals {
static let accountInfo = "계정 정보"
static let feedback = "피드백 남기기"
static let customerCenter = "고객센터"
static let logout = "로그아웃"
}

enum Network {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "btn_logout.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ final class NetworkService: NetworkServiceType {
return nil
} else {
guard let newAccessToken = result.data?.accessToken else { throw NetworkError.unknownError }
KeychainWrapper.saveToken(accessToken, forKey: "accessToken")
KeychainWrapper.saveToken(newAccessToken, forKey: "accessToken")

return try await donNetwork(type: type, baseURL: baseURL, accessToken: newAccessToken, body: body, pathVariables: pathVariables)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ final class DontBeBottomSheetView: UIView {

let customerCenterButton = DontBeBottomSheetButton(title: StringLiterals.BottomSheet.customerCenter)

let logoutButton = DontBeBottomSheetButton(title: StringLiterals.BottomSheet.logout)

// MARK: - Life Cycles

init(singleButtonImage: UIImage) {
Expand All @@ -63,7 +65,7 @@ final class DontBeBottomSheetView: UIView {
setAddTarget()
}

init(profileEditImage: UIImage, accountInfoImage: UIImage, feedbackImage: UIImage, customerCenterImage: UIImage) {
init(profileEditImage: UIImage, accountInfoImage: UIImage, feedbackImage: UIImage, customerCenterImage: UIImage, logoutImage: UIImage) {
super.init(frame: .zero)

setMultiButtonHierarchy()
Expand Down Expand Up @@ -129,12 +131,13 @@ extension DontBeBottomSheetView {
profileEditButton,
accountInfoButton,
feedbackButton,
customerCenterButton)
customerCenterButton,
logoutButton)
}

private func setMultiButtonLayout() {
bottomsheetView.snp.makeConstraints {
$0.height.equalTo(365.adjusted)
$0.height.equalTo(434.adjusted)
}

dragIndicatorView.snp.makeConstraints {
Expand Down Expand Up @@ -167,6 +170,12 @@ extension DontBeBottomSheetView {
$0.leading.trailing.equalToSuperview().inset(15.adjusted)
$0.top.equalTo(feedbackButton.snp.bottom).offset(10.adjusted)
}

logoutButton.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(15.adjusted)
$0.top.equalTo(customerCenterButton.snp.bottom).offset(10.adjusted)
}
}

func showSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ final class MyPageAccountInfoViewController: UIViewController {
private let moreInfoTitle: UILabel = {
let label = UILabel()
label.font = .font(.body3)
label.text = "이용약관"
label.text = StringLiterals.MyPage.myPageMoreInfoTitle
label.textColor = .donBlack
return label
}()

private let moreInfoButton: UIButton = {
let button = UIButton()
button.setTitle("자세히 보기", for: .normal)
button.setTitle(StringLiterals.MyPage.myPageMoreInfoButtonTitle, for: .normal)
button.setTitleColor(.donGray7, for: .normal)
button.titleLabel?.font = .font(.body4)
return button
}()

private let signOutButton: UIButton = {
let button = UIButton()
button.setTitle("회원탈퇴", for: .normal)
button.setTitle(StringLiterals.MyPage.myPageSignOutButtonTitle, for: .normal)
button.setTitleColor(.donGray7, for: .normal)
button.titleLabel?.font = .font(.body4)
return button
Expand Down Expand Up @@ -170,6 +170,7 @@ extension MyPageAccountInfoViewController {

private func setAddTarget() {
moreInfoButton.addTarget(self, action: #selector(useTermButtonTapped), for: .touchUpInside)
signOutButton.addTarget(self, action: #selector(signOutButtonTapped), for: .touchUpInside)
}

private func setDelegate() {
Expand Down Expand Up @@ -223,6 +224,11 @@ extension MyPageAccountInfoViewController {
self.present(useTermView, animated: true, completion: nil)
}
}

@objc
private func signOutButtonTapped() {
print("signOutButtonTapped")
}
}

extension MyPageAccountInfoViewController: UITableViewDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ extension MyPageViewController {
rootView.myPageBottomsheet.accountInfoButton.addTarget(self, action: #selector(accountInfoButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.feedbackButton.addTarget(self, action: #selector(feedbackButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.customerCenterButton.addTarget(self, action: #selector(customerCenterButtonTapped), for: .touchUpInside)
rootView.myPageBottomsheet.logoutButton.addTarget(self, action: #selector(logoutButtonTapped), for: .touchUpInside)
rootView.warnBottomsheet.warnButton.addTarget(self, action: #selector(warnButtonTapped), for: .touchUpInside)
}

Expand Down Expand Up @@ -414,6 +415,12 @@ extension MyPageViewController {
}
}

@objc
private func logoutButtonTapped() {
rootView.myPageBottomsheet.handleDismiss()
print("logoutButtonTapped")
}

@objc
private func feedbackButtonTapped() {
rootView.myPageBottomsheet.handleDismiss()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ final class MyPageView: UIView {
var myPageBottomsheet = DontBeBottomSheetView(profileEditImage: ImageLiterals.MyPage.btnEditProfile,
accountInfoImage: ImageLiterals.MyPage.btnAccount,
feedbackImage: ImageLiterals.MyPage.btnFeedback,
customerCenterImage: ImageLiterals.MyPage.btnCustomerCenter)
customerCenterImage: ImageLiterals.MyPage.btnCustomerCenter,
logoutImage: ImageLiterals.MyPage.btnLogout)

var deleteBottomsheet = DontBeBottomSheetView(singleButtonImage: ImageLiterals.Posting.btnDelete)
var warnBottomsheet = DontBeBottomSheetView(singleButtonImage: ImageLiterals.Posting.btnWarn)
Expand Down

0 comments on commit 280f4f0

Please sign in to comment.