Skip to content

Feature/#138 회원탈퇴 UI 구현 & API 수정#155

Merged
wngus4296 merged 27 commits intodevelopfrom
feature/#138-resign
Feb 28, 2024
Merged

Feature/#138 회원탈퇴 UI 구현 & API 수정#155
wngus4296 merged 27 commits intodevelopfrom
feature/#138-resign

Conversation

@wngus4296
Copy link
Copy Markdown
Collaborator

@wngus4296 wngus4296 commented Feb 28, 2024

작업한 내용

회원 탈퇴 작업을 수정했어요.

  • 회원 탈퇴 정보 & 이유 작성 뷰를 구현했어요.
  • 30일 이내 재로그인 시 탈퇴 취소되기 때문에 해당 뷰를 구현했고, 로그인 response에 추가된 필드를 반영했어요.
  • 애플 탈퇴할 때 authorizationCode를 가져와야해서 로그인을 시켜요! 이를 위해 기존 identityTokenDelegate를 수정했어요.

네비게이션바 코드를 정리했어요.

  • 원래 화면마다 네비게이션바를 새로 configure하고 있었는데 같은 네비게이션바를 사용하는 뷰가 많아져서 공통으로 만들어줬어요!
  • 네비게이션바 사용하는 화면들 다 체크하면서 수정했어요!!

Userdefaults + rx

  • accessToken 여부에 따라 화면이 달라지는 경우가 많아서 고민하다가 userdefaults를 rx로 observe하고 있는 부분을 구현해봤어요!
  • 기존에 viewWillAppear에서 accessToken체크하던 부분을 제거하고 observe로 가져왔어요. 이렇게 하는 게 좋을지, 전처럼 viewWillAppear에 넣는 게 좋을지 용재의 의견이 궁금해요 💭

build scheme 변경

  • 아래처럼 scheme을 정리했어요. debug / release로 나눠서 shared로 설정해두었어요.
    image

스크린샷

카카오 탈퇴 애플 탈퇴 30일 내 재로그인
RPReplay_Final1709094032 RPReplay_Final1709094069 RPReplay_Final1709094069 2

관련 이슈

@wngus4296 wngus4296 self-assigned this Feb 28, 2024
Copy link
Copy Markdown
Collaborator

@longlivedrgn longlivedrgn left a comment

Choose a reason for hiding this comment

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

주현 완전 고생많았따!..🫠 우리 로그인과 회원가입 로직 부분이 점점 복잡해지고 있네... 어려운 소셜 ㅗ그인..🥲
고생했오 주현~!

Comment on lines +44 to +57
private func bindUserDefaults() {
UserDefaults.standard.rx
.observe(String.self, UserDefaultsKey.accessToken.rawValue)
.asDriver(onErrorJustReturn: nil)
.drive(with: self) { owner, accessToken in
guard let accessToken = accessToken else { return }

if accessToken.isEmpty {
self.output.checkingTicketCount.accept(-1)
} else {
self.fetchCheckingTickets()
}
}
.disposed(by: self.disposeBag)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

이 부분이 주현이가 말한 UserDefaults+Rx부분인구나!

Userdefaults를 저렇게 가져올 수 있는 거는 처음 봤네 신기하네! 새로운 거 알아갑니다..🙇‍♂️
만약 우리가 저런 식으로 UserDefaults의 값을 가져온다면, 기존에 우리가 propertyWrapper로 감싼 UserDefault가 필요없을 거 같아!

// UserDefault<T>
    var wrappedValue: T {
        get { UserDefaults.standard.object(forKey: key) as? T ?? defaultValue }
        set { UserDefaults.standard.set(newValue, forKey: key) }
    }

기존에 우리가 UserDefaults의 값을 손쉽게 가져오고 재설정하려구 위와 같이 코드를 작성해줬는데, UserDefaults rx를 활용할 경우, 위와 같은 코드가 필요가 없어지는 느낌이 있는 거 같아! 즉, 역할이 살짝 중복된다는 느낌이 있오!

그리고 내가 viewWillAppear 이벤트를 트리거로 삼아서 UserDefaults를 가져온 이유는 크게 두 가지였어!

  1. VM과 VC의 분리 => VC가 VM의 메소드를 실행시킨다기보다는 VC는 자신이 appear되었다는 이벤트만 VM에게 알리고, VM이 코어한 로직을 다 수행하는 거지!
  2. viewWillAppear를 통해서 로그인 후, 다시 UserDefaults를 확인할 수 있게 하는 로직 구현 가능. => 처음에는 로그인을 하지 않아서 공연이 비어져있지만, 로그인을 하고 왔을 때는 다시 update를 해서 화면을 띄어줘야하잖아! 그럴 때, viewWIllAppear라는 Event와 맞물려서 access token을 확인하는 것이 조금 더 자연스럽다고 생각했오! 어차피 해당 로직을 viewWillAppear에 넣어줄거라면 rx로 감싸서 쓰는거지!

Copy link
Copy Markdown
Collaborator Author

@wngus4296 wngus4296 Feb 28, 2024

Choose a reason for hiding this comment

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

현재 흐름으로 보면 accessToken 확인하는 건 viewWillAppear와 맞물려서 하는 게 더 좋을 거 같긴 하다!

내가 UserDefaults+Rx를 찾아봤을 때의 생각은 아래와 같아! 결론적으로 다르게 써보긴 했지만 ..ㅎㅎ

  • 홈(공연 리스트) 화면에 닉네임을 패치하는 부분이 있는데 viewWillAppear를 탈 때마다 userDefaults에서 가져온 값을 넣어주고 있거든! 근데 userDefaults에 계속 접근하는게 비효율적이라고 생각했어!
  • wrappedValue는 변화 감지를 못하기 때문에 viewWillAppear에서 값을 가져오는 거라
    UserDefaults+Rx로 값 변화를 감지해서 viewDidLoad(VC) 또는 init(VM) 에서 한 번만 설정하면 되기 때문이야!

Comment thread Boolti/Boolti/Sources/UILayer/Login/Main/LoginViewController.swift Outdated
override func viewWillDisappear(_ animated: Bool) {
self.tabBarController?.tabBar.isHidden = false
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍👍

Comment on lines 240 to 244
owner.entryCodeButton.isHidden = true
} else {
// 오늘 공연 여부에 따라 숨김 처리
owner.entryCodeButton.isHidden = ticketDetailItem.date.formatToDate().getBetweenDay(to: Date()) != 0
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

요기 좋다!!👍

Comment thread Boolti/Boolti/Sources/Global/Extensions/UserDefaults+.swift Outdated
Comment on lines +38 to +51

func resign() -> Observable<String?> {
let provider = ASAuthorizationAppleIDProvider()
let request = provider.createRequest()

let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.performRequests()

return authorizationController.rx.appleUserInfoDelegate
.map { userInfo in
guard let userInfo else { throw Error.userInfoNotFound }
return userInfo.authorizationCode
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

appleIdAuthorizationCode 요걸 넘겨줘야되는구나! 👍👍
뭔가 그냥 Core Data나 Swift Data에 저장해두고, 꺼내쓸까도 생각했는데에 해당 값이 바뀌나? 근데 그냥 이렇게 한번 더 불러오는 게 좋은 거 같다아!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

appleIdAuthorizationCode 요게 5분마다 변경된다고 하더라구! 그래서 탈퇴 직전에 로그인해서 받아와야 했어 ..!!

@wngus4296 wngus4296 merged commit 266fad0 into develop Feb 28, 2024
@wngus4296 wngus4296 deleted the feature/#138-resign branch February 28, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 탈퇴하기 UI + API 연결 수정

2 participants