Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 온보딩 프로세스 구현완료 #156

Merged
merged 15 commits into from
Jul 11, 2024
Merged

Conversation

hooni0918
Copy link
Member

🔗 연결된 이슈

📄 작업 내용

  • 온보딩 프로세스 전체 구현
  • 닉네임 정규식 추가하여 정해진대로 추가하는 로직 및 UI 구현
  • 정규식 따라 버튼 enable 상태 결정
  • 입력한 닉네임 옵저버블 사용하여 welcomeVC로 전달
  • 프로필 UI 구현
  • 프로필 버튼 클릭시 권한 요청
  • 프로필 이미지 가져오면 crop 이미지로 잘라서 제공
  • 프로필 지금 선택 가능/불가능 나누기
  • welcome 에서 그래픽과
구현 내용 IPhone 15 pro
GIF
Simulator Screen Recording - iPhone 15 Pro - 2024-07-11 at 00 01 13
RPReplay_Final1720623788.MP4
// 여기에 코드를 적어주세요!

📚 참고자료

👀 기타 더 이야기해볼 점

이후 한번에 반응형 Screen으로 수정할 예정입니다

@hooni0918 hooni0918 self-assigned this Jul 10, 2024
@hooni0918 hooni0918 linked an issue Jul 10, 2024 that may be closed by this pull request
7 tasks
Copy link
Contributor

@JinUng41 JinUng41 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 +5 to +8
<key>NSPhotoLibraryAddUsageDescription</key>
<string>정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!</string>
<key>NSCameraUsageDescription</key>
<string>정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!정혜진!</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

Copy link
Member Author

Choose a reason for hiding this comment

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

아 이부분 기획자 선생님들꼐 말을 해서 정확한 정보로 수정 예정입니다! 다음 스크럼때 말하겟습니다!

Comment on lines +15 to +25
let navigationBar = UIView().then {
$0.backgroundColor = .white
}

let titleLabel = UILabel().then {
$0.setText("프로필 설정", style: .body03, color: .black)
}

let separatorLine = UIView().then {
$0.backgroundColor = .gray2
}
Copy link
Contributor

Choose a reason for hiding this comment

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

시스템이 기본 제공하는 navigationItem을 사용하지 않으시고, 직접 view를 이용하여 구현하셨네요!
혹시 하단의 경계선 때문일까요?

그리고 UIView(backgroundColor: .white)로 생성도 가능하답니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

시스템이 기본 제공하는 navigationItem을 사용하지 않으시고, 직접 view를 이용하여 구현하셨네요!
혹시 하단의 경계선 때문일까요?
-> 넵 맞습니다! 온보딩 프로세스에는 네비게이션이 들어가있지 않아서 해당 프로세스에는 커스텀으로 구현해서 넣었습니다

override func setupAutoLayout() {
navigationBar.snp.makeConstraints {
$0.top.leading.trailing.equalToSuperview()
$0.height.equalTo(92)
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

Copy link
Member Author

Choose a reason for hiding this comment

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

Screen!

override func setupView() {
backgroundColor = .white

[navigationBar, separatorLine, subtitleLabel, nicknameTextField, errorLabel, nextButton].forEach { addSubview($0) }
Copy link
Contributor

Choose a reason for hiding this comment

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

addSubviews(_ views: UIView...)라는 메서드를 만들어 두긴 했습니다..ㅎ

Copy link
Member Author

Choose a reason for hiding this comment

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

코딩 습관이 무섭네요 바로 코드 수정하겟습니다!

Comment on lines +56 to +59
private func setupActions() {
nicknameView.nicknameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
nicknameView.nextButton.addTarget(self, action: #selector(nextButtonTapped), for: .touchUpInside)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

BaseViewController로부터 오버라이딩이 가능한 setupAction메서드가 있으니 해당 메서드로 작성해도 괜찮을 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

코딩 습관이 무섭네요 바로 코드 수정하겟습니다!

Comment on lines +29 to +41
if name.isEmpty {
nicknameState.value = .empty
errorMessage.value = nil
isNextButtonEnabled.value = false
} else if name.range(of: nicknameRegex, options: .regularExpression) != nil {
nicknameState.value = .valid
errorMessage.value = nil
isNextButtonEnabled.value = true
} else {
nicknameState.value = .invalid
errorMessage.value = "한글, 영문, 숫자만을 사용해 총 5자 이내로 입력해주세요."
isNextButtonEnabled.value = false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

좋은 분기 처리와 구현이네요

Copy link
Member Author

Choose a reason for hiding this comment

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

캬 이지훈 이 멋진녀석

override func viewDidLoad() {
super.viewDidLoad()
setupBindings()
setupAction()
Copy link
Contributor

Choose a reason for hiding this comment

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

setupActionviewDidLoad에서 호출하지 않아도 됩니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

일단 다 떄려박고 시작하는데 습관좀 고치겟습니다!!!!

Comment on lines +50 to +60
@objc private func confirmButtonTapped() {
let welcomeVC = WelcomeViewController(viewModel: WelcomeViewModel(nickname: viewModel.nickname))
welcomeVC.modalPresentationStyle = .fullScreen
present(welcomeVC, animated: true, completion: nil)
}

@objc private func skipButtonTapped() {
let welcomeVC = WelcomeViewController(viewModel: WelcomeViewModel(nickname: viewModel.nickname))
welcomeVC.modalPresentationStyle = .fullScreen
present(welcomeVC, animated: true, completion: nil)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

똑같은 코드가 두 개라서 리팩토링을 시도해 봐도 좋을 것 같네요.

Copy link
Member Author

Choose a reason for hiding this comment

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

어엇 위에 주석으로 처리하고 코드 원문 보면서 코드를 수정하고 삭제를 햇어야하는데 코드를 복붙을 해버렷네요 앞으로 졸면서 코딩하지 않겟습니다!!

Comment on lines +62 to +81
@objc private func cameraButtonTapped() {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .photoLibrary
imagePicker.allowsEditing = true
present(imagePicker, animated: true)
}

private func cropToCircle(image: UIImage) -> UIImage {
let shorterSide = min(image.size.width, image.size.height)
let imageBounds = CGRect(x: 0, y: 0, width: shorterSide, height: shorterSide)
UIGraphicsBeginImageContextWithOptions(imageBounds.size, false, UIScreen.main.scale)
let context = UIGraphicsGetCurrentContext()!
context.addEllipse(in: imageBounds)
context.clip()
image.draw(in: imageBounds)
let circleImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
return circleImage
}
Copy link
Contributor

Choose a reason for hiding this comment

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

고생하셨습니다.
다만 강제 언래핑이 아닌 옵셔널 바인딩으로 구현하면 어땟을까 하는 아쉬움이 있네요.

Copy link
Member Author

Choose a reason for hiding this comment

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

UIGraphicsGetImageFromCurrentImageContext함수가 현재 그래픽 컨텍스트에 그려진 이미지를 UIImage로 반환해서 가져오는 역할을 합니다. 이로인해 이미지가 반환이 되지 않는다면 프로필 등록 자체가 되지 않기 때문에 강제 언래핑을 넣었습니다.
하지만 생각해보니 이미지 등록에 실패한 에러처리가 있는것도 아니기 떄문에 강제 언래핑은 지양해야하는것이 맞는것같네요 해당부분 수정하겟습니다.

Comment on lines +52 to +54
$0.setTitle("지금은 넘어가기", for: .normal)
$0.setTitleColor(.gray5, for: .normal)
$0.titleLabel?.font = UIFont.pretendard(.body05)
Copy link
Contributor

Choose a reason for hiding this comment

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

setTitle(title, style, color)를 만들어 두었습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

다음 코드리뷰부터 기본으로 만들어놓은 메서드 사용하지 않는일 없도록 진행하겟습니다

@JinUng41 JinUng41 changed the title [Feat] 온보딩 프로세스 구현완료 [feat] 온보딩 프로세스 구현완료 Jul 11, 2024
Copy link
Member

@youz2me youz2me left a comment

Choose a reason for hiding this comment

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

고생하셧습니다 어프로브야미

@hooni0918 hooni0918 added ✨ feat 기능 구현시 사용 🛠️ fix 버그나 오류 해결시 사용 🧡 JiHoon 쌈뽕한 플러팅 꿀팁을 듣고 싶다면 labels Jul 11, 2024
Copy link
Member

@mmaybei mmaybei left a comment

Choose a reason for hiding this comment

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

수고많으셨습니당! ViewModel 참고하겠습니다 ,,ㅎㅎ

@hooni0918 hooni0918 merged commit 59588d9 into suyeon Jul 11, 2024
@hooni0918 hooni0918 deleted the feat/#154-onboarding branch July 12, 2024 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feat 기능 구현시 사용 🛠️ fix 버그나 오류 해결시 사용 🧡 JiHoon 쌈뽕한 플러팅 꿀팁을 듣고 싶다면
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 온보딩프로세스 구현
4 participants