Skip to content

Conversation

@snughnu
Copy link
Contributor

@snughnu snughnu commented Apr 9, 2025

배경

  • 관련PR: [Feat] 로그인화면에서의 API연동과 앱을 시작할 때의 토큰 관리 로직을 작성했습니다. #83 [Feat] 회원가입2 UI 구현 #29
  • 회원가입화면2에서 회원가입화면1로 갔다가 다시 회원가입화면2로 갔을 때 사용자의 설정이 남아있는 문제를 해결하였습니다.
    • DIContainer에서 뷰컨트롤러를 등록하는 과정은 뷰컨트롤러를 pop하였음에도 메모리에서 해제되지 않는 문제가 있었습니다.
  • 일부 UI 디자인을 변경하였습니다.
  • 토큰을 재발급할 때 다음의 문제점을 수정하였습니다.
    • 액세스 토큰이 만료되었을 때, 토큰의 재발급은 성공하지만(Response는 성공) 정상적으로 저장하지 못하여 최종적으로 실패함

작업 내용

스크린샷 2025-04-09 16 00 39
  • 구글-소셜로그인과 관련된 로직과 UI를 삭제하였습니다.
  • 프로필 선택의 UI를 일부 변경했습니다.
    - 회원가입화면2의 상태 초기화를 위해 resetSignUpData() 메서드를 추가하였습니다.
  • DIContainer에서 뷰컨트롤러를 등록하는 로직을 삭제하고 뷰컨트롤러를 직접 생성하는 로직으로 변경하였습니다.
  • 토큰 재발급 문제에서는 키체인에 저장할 때의 로직을 변경하였습니다.

테스트 방법

임시로 사용하였던 다음 코드도 변경되었습니다.

        // MARK: - for test
        deleteTokensForTest()
        func deleteTokensForTest() {
            let deleteQueries: [[String: Any]] = [
                [kSecClass as String: kSecClassGenericPassword,
                 kSecAttrAccount as String: "accessToken", kSecAttrService as String: "Popcorn"],
                [kSecClass as String: kSecClassGenericPassword,
                 kSecAttrAccount as String: "refreshToken", kSecAttrService as String: "Popcorn"],
                [kSecClass as String: kSecClassGenericPassword,
                 kSecAttrAccount as String: "accessExpiredAt", kSecAttrService as String: "Popcorn"],
                [kSecClass as String: kSecClassGenericPassword,
                 kSecAttrAccount as String: "refreshExpiredAt", kSecAttrService as String: "Popcorn"],
                [kSecClass as String: kSecClassGenericPassword,
                 kSecAttrAccount as String: "loginType", kSecAttrService as String: "Popcorn"]
            ]

            for query in deleteQueries {
                let status = SecItemDelete(query as CFDictionary)
                if status == errSecSuccess {
                    print("✅ \(query[kSecAttrService as String]!) 삭제 성공")
                } else {
                    print("❌ \(query[kSecAttrService as String]!) 삭제 실패: \(status)")
                }
            }
            print("🚨 테스트: 모든 토큰 및 만료 날짜 정보가 삭제되었습니다.")
        }

리뷰 노트

  • 변경 및 수정하는 로직이 대부분이라서 커밋 및 PR이 일관적이지 못했습니다.

@snughnu snughnu added the 👨‍🏭 Refactor 리팩토링 label Apr 9, 2025
@snughnu snughnu self-assigned this Apr 9, 2025
Copy link
Member

@MinwooJe MinwooJe left a comment

Choose a reason for hiding this comment

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

p1)
회원가입 화면2에서 뒤로가기 버튼을 눌렀는데도 여전히 데이터가 존재한다는 건 회원가입 화면 2 뷰컨트롤러가 메모리에서 해제되지 않는 것 같애요...

내비게이션 컨트롤러에서 popViewController를 호출하면 해당 뷰 컨트롤러는 메모리에서 해제되는데... 디버깅이 필요한 것 같습니다ㅠ

회원가입 2로 넘어가려고 하니 이메일 인증이 지금 안되는 것 같애서 확인할 수 가 없네요ㅠ

- 회원가입화면2에서 resetData를 하는 메서드 대신 DIContainer에서 뷰컨트롤러를 관여하지 않도록 로직 변경
Copy link
Member

@MinwooJe MinwooJe left a comment

Choose a reason for hiding this comment

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

DIContainer에서 뷰컨트롤러를 생성해서 메모리 해제가 안됐던거네요! 수고하셨습니다~

@MinwooJe MinwooJe merged commit e805d53 into GDSC-Popcorn:develop Apr 10, 2025
1 check passed
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.

2 participants