Skip to content

Conversation

@513sojin
Copy link
Collaborator

@513sojin 513sojin commented Dec 5, 2023

🌱 작업한 내용

  • 위치 허용에 따라 설정으로 진입하는 팝업 추가
  • RNAlertVC 를 사용했는데 왼쪽 버튼은 dismiss로 코드가 고정되어있어서 enum으로 custom인 경우를 추가해주었습니다

🌱 PR Point

  • 위치 서비스 여부에 따라 팝업을 띄워주었습니다
  • 위치 서비스를 이용하면서, 러넥트 위치 서비스를 끈 경우 설정화면을 유도하는 팝업을 띄웠습니다.
  • 원래는 viewDidLoad 시점에만 검색화면의 키보드를 띄워주는데, 지금 코드는
  1. viewDidLoad 시점에 위치 서비스를 껐는지 켰는지를 확인
  2. 팝업을 띄울 필요가 없는 경우(위치서비스 다 키고 허용한 경우) 키보드를 올�려줌
    문제 : 분기처리를 해주다보니 키보드 올라오는 속도가 좀 느려요 (...) 고민입니다 ..

📸 스크린샷

구현 내용 스크린샷
위치 서비스가 꺼진 경우
러넥트 위치 서비스가 꺼진 경우

📮 관련 이슈

@513sojin 513sojin added the Feat 새로운 기능 구현 label Dec 5, 2023
@513sojin 513sojin requested a review from thingineeer December 5, 2023 14:37
@513sojin 513sojin self-assigned this Dec 5, 2023
Copy link
Collaborator

@thingineeer thingineeer 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 +13 to +17
enum AlertType {
case defaultType
case custom
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

OCP 원칙 잘 지킨거 좋네요

}

private func presentServiceAlertVC() {
let requestLocationServiceAlert = UIAlertController(title: "위치 정보 이용", message: "위치 서비스를 사용할 수 없습니다.\n디바이스의 '설정 > 개인정보 보호'에서\n위치 서비스를 먼저 켜주세요.", preferredStyle: .alert)
Copy link
Collaborator

@thingineeer thingineeer Dec 5, 2023

Choose a reason for hiding this comment

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

'설정 > 개인정보 보호'에서\n위치 서비스를 먼저 켜주세요. 부분에서
'위치 서비스' 와 같이 작은따옴표를 추가하는 건 어떠신가요!? 🫠

Comment on lines +181 to +199
private func presentAlertVC() {
let alertVC = RNAlertVC(description: "위치 접근을 허용해야 사용할 수 있어요.\n[설정] - [애플리케이션] - [위치접근]을\n허용해 주세요.")
alertVC.modalPresentationStyle = .overFullScreen
alertVC.alertType = .custom

alertVC.leftButtonTapAction = {
alertVC.dismiss(animated: false)
self.navigationController?.popViewController(animated: true)
}
alertVC.rightButtonTapAction = {
if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(url)
alertVC.dismiss(animated: false)
}
self.navigationController?.popViewController(animated: true)
}

self.present(alertVC, animated: false)
}
Copy link
Collaborator

@thingineeer thingineeer Dec 5, 2023

Choose a reason for hiding this comment

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

두 알람의 alpha를 통일 시켜보는 것이 어떠신지 궁금합니다~ 🫠

현재 RNAlert의 속성만 변경 가능하다면 같은 뷰이니, 통일했으면 좋겠습니다!
그게 아니라면 다른 곳에서도 변경이 되어버리니,, 메모 해놓고 차후에 수정하면 좋을 것 같습니다

아니면 이참에 모든 background alpha를 통일해 보는 것도 좋을 지도..?

RNAlertVC 같은 경우

extension RNAlertVC {
    private func setUI() {
        view.backgroundColor = .black.withAlphaComponent(0.8)
        containerView.backgroundColor = .w1
    }

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

너무 좋은 의견이라고 생각합니다!!
현재 러넥트 팝업이 전부 아래의 배경색일테니 위의 배경도 아래처럼 바꾸는게 좋아보이는데 어떻게 생각하시나요?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

좋아요~~~ 이거 코어타임때 이야기 해봅시다~

Comment on lines 150 to 168
DispatchQueue.global().async { [weak self] in
guard let self = self else { return }
if CLLocationManager.locationServicesEnabled() {
switch authorizationStatus {
case .notDetermined ,.restricted ,.denied:
DispatchQueue.main.async {
self.presentAlertVC()
}
default:
DispatchQueue.main.async {
self.naviBar.showKeyboard()
}
}
} else {
DispatchQueue.main.async {
self.presentServiceAlertVC()
}
}
}
Copy link
Collaborator

@thingineeer thingineeer Dec 5, 2023

Choose a reason for hiding this comment

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

아마 비동기 로직을 바꾸지 않는 이상은 속도 변화가 없을 것 같긴 한데, 그래도 구조 같은 경우 만 본다면 if ~ else
대신 guard let 을 한 번 더 쓰면 아래와 같이 작성을 할 수 있을 것 같네요. 🫠

DispatchQueue.global().async { [weak self] in
    guard let self = self else { return }
    
    guard CLLocationManager.locationServicesEnabled() else {
        DispatchQueue.main.async {
            self.presentServiceAlertVC() // 전체 위치 서비스
        }
        return
    }
    
    switch authorizationStatus {
    case .notDetermined, .restricted, .denied:
        DispatchQueue.main.async {
            self.presentAlertVC() // 러넥트 위치 서비스
        }
    default:
        DispatchQueue.main.async {
            self.naviBar.showKeyboard()
        }
    }
} 

마지막으로 후손들을 위해 주석 다는 건 어떻게 생각하시는지 궁금하네요~ㅎ
제가 위에 남겨놓은 두 개 정도!? 🔥

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

남겨주신 코드 감사합니다 ! 이렇게 바꾸는게 나을 것 같아요 👍🏻
그리고 적절한 주석 달아두는 것도 좋은 것 같네요 ㅎ 간략하게 주석 추가해두겠습니다 ~!

@thingineeer thingineeer changed the title [Feat] - #214 코스그리기 및 업로드 팝업 추가 [Feat] #214 - 코스그리기 및 업로드 팝업 추가 Dec 9, 2023
Comment on lines +11 to +12
let latitude: Double
let longitude: Double
Copy link
Collaborator Author

@513sojin 513sojin Dec 11, 2023

Choose a reason for hiding this comment

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

< 코스 생성 api 관련 바뀐 부분> @thingineeer

  1. RNLocationModel lat, long명 바뀜
  2. path 바뀜
  3. 보내줄때 name이 바뀜
    let formData = MultipartFormData(provider: .data(jsonData), name: "courseCreateRequestDto", mimeType: "application/json")

마지막 커밋 확인 부탁드립니다 !!

Copy link
Collaborator

@thingineeer thingineeer left a comment

Choose a reason for hiding this comment

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

어렵게 오래 코딩했는데, 다 지우는게 맘 아픕니다..
하지만 어떤 부분이든, 많이 성장 했을거라 믿습니다 ‼️


let jsonData = try JSONSerialization.data(withJSONObject: content)
let formData = MultipartFormData(provider: .data(jsonData), name: "data", mimeType: "application/json")
let formData = MultipartFormData(provider: .data(jsonData), name: "courseCreateRequestDto", mimeType: "application/json")
Copy link
Collaborator

Choose a reason for hiding this comment

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

name: "courseCreateRequestDto" 이 부분이 의미하는바가 뭔지 알 수 있을까요??

Copy link
Collaborator Author

@513sojin 513sojin Dec 13, 2023

Choose a reason for hiding this comment

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

스크린샷 2023-12-11 오후 6 50 20
수정된 api에서는 courseCreateRequestDto에 현재의 path나 주소값 등등을 넣어서 보내주고 있습니다 !!

Comment on lines 454 to 453
guard let self = self else { return }
courseProvider.request(target: .uploadCourseDrawing(param: requestDto), instance: BaseResponse<CourseDrawingResponseData>.self, vc: self) { response in
LoadingIndicator.hideLoading()
switch response {
case .success(let result):
let status = result.statusCode
if 200..<300 ~= status {
do {
let responseDto = try result.map(BaseResponse<CourseDrawingResponseData>.self)
guard let data = responseDto.data else { return }
self.presentAlertVC(courseId: data.id)
} catch {
print(error.localizedDescription)
}
}
if status >= 400 {
print("400 error")
self.showNetworkFailureToast()
}
case .failure(let error):
if let response = error.response {
if let responseData = String(data: response.data, encoding: .utf8) {
print(responseData)
}
} else {
print(error.localizedDescription)
}
}
guard let data = response.data else { return }
self.presentAlertVC(courseId: data.id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이 부분 변경된 서버 통신 함수 사용해서 수정해뒀습니다
api 연결 작업할 일 또 생기면 참고하시면 될 것 같아요!!

Copy link
Collaborator

Choose a reason for hiding this comment

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

고생하셨습니다~~~

@513sojin 513sojin merged commit 0cd869d into develop Dec 15, 2023
@thingineeer thingineeer deleted the #214-코스그리기및업로드 branch February 14, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat 새로운 기능 구현 소진🍊

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] #214 - 코스 그리기, 검색 부분 수정

3 participants