Skip to content

Commit

Permalink
Merge pull request #130 from TeamFILL-IN/feature/#129
Browse files Browse the repository at this point in the history
๐Ÿ”จ[FIX] #129 - ์ง€๋„๋ทฐ ํ˜„์ƒ์†Œ ๋งˆ์ปค ์ค‘๋ณตํด๋ฆญ ๋ฐฉ์ง€
  • Loading branch information
jumining authored Mar 8, 2022
2 parents 8619d3c + f945bbf commit d366ada
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension SplashViewController {
}

private func presentToOnboarding() {
let onboardingNavigationController = UINavigationController(rootViewController: OnboardingFirstViewController())
let onboardingNavigationController = UINavigationController(rootViewController: OnboardingViewController())
onboardingNavigationController.modalPresentationStyle = .fullScreen
onboardingNavigationController.modalTransitionStyle = .crossDissolve
self.present(onboardingNavigationController, animated: true, completion: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,12 @@ class StudioMapViewController: UIViewController {
layoutMyLocationButton()
layoutSearchView()
layoutNavigaionBar()
getBottomSheetInfo()
totalStudioWithAPI()
setLatLngNotification()
showtmpStudioMarker()
tmpSetupMarker()
setupBottomSheetUI()
setupBottomSheetGestureRecognizer()
getBottomSheetInfo()
}

override func viewDidAppear(_ animated: Bool) {
getBottomSheetInfo()
}

// MARK: - init
Expand All @@ -113,26 +109,55 @@ class StudioMapViewController: UIViewController {
extension StudioMapViewController {

/// ์„œ๋ฒ„ ๋ถ€ํ™œ๋˜๊ธฐ ์ „๊นŒ์ง€ ํ˜„์ƒ์†Œ ๊ด€๋ จ ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธํ•  ์ž„์‹œ ํ•จ์ˆ˜ (๋„ค์ด๋ฒ„ ๊ทธ๋ฆฐํŒฉํ† ๋ฆฌ์— ํ˜„์ƒ์†Œ ํ‘œ์‹œํ•ด์คŒ)
func showtmpStudioMarker() {
func tmpSetupMarker() {
let markertmp = NMFMarker(position: NMGLatLng(lat: 37.35940010181669, lng: 127.10475679570187))
markertmp.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
markertmp.mapView = self.mapView.mapView

/// ํด๋ฆญ ์‹œ ์ด๋ฒคํŠธ ์„ค์ •
markertmp.touchHandler = { [weak self] (overlay: NMFOverlay) -> Bool in
if self?.clickCount == 1 { /// ์ด๋ฏธ ๋งˆ์ปค๊ฐ€ ํด๋ฆญ๋œ ๊ฒฝ์šฐ (์ค‘๋ณต ํด๋ฆญ ํ—ˆ์šฉ์•ˆํ•จ)
self?.clickCount = 0
markertmp.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.hideBottomSheetAndGoBack()
let secondMarkertmp = NMFMarker(position: NMGLatLng(lat: 37.36161841308457, lng: 127.10566240106306))
secondMarkertmp.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
secondMarkertmp.mapView = self.mapView.mapView

secondMarkertmp.touchHandler = { [weak self] (overlay: NMFOverlay) -> Bool in
if self?.selectedMarker == nil { /// ํด๋ฆญํ–ˆ๋˜ ํ˜„์ƒ์†Œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ (์ง€๋„๋ทฐ ์ฒ˜์Œ ๋“ค์–ด์˜ฌ ๋–„)
self?.selectedMarker = secondMarkertmp
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
self?.showBottomSheet()
} else {
self?.clickCount = 1
markertmp.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
if self?.selectedMarker == secondMarkertmp { /// ํด๋ฆญํ–ˆ๋˜ ํ˜„์ƒ์†Œ๋ฅผ ๋‹ค์‹œ ํด๋ฆญํ•˜๋Š” ๊ฒฝ์šฐ
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.hideBottomSheetAndGoBack()
} else { /// ๋‹ค๋ฅธ ํ˜„์ƒ์†Œ ํด๋ฆญ
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.selectedMarker = secondMarkertmp
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
self?.showBottomSheet()
}
}
return true
}

markertmp.touchHandler = { [weak self] (overlay: NMFOverlay) -> Bool in
if self?.selectedMarker == nil { /// ํด๋ฆญํ–ˆ๋˜ ํ˜„์ƒ์†Œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ (์ง€๋„๋ทฐ ์ฒ˜์Œ ๋“ค์–ด์˜ฌ ๋–„)
self?.selectedMarker = markertmp
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
self?.showBottomSheet()
} else {
if self?.selectedMarker == markertmp { /// ํด๋ฆญํ–ˆ๋˜ ํ˜„์ƒ์†Œ๋ฅผ ๋‹ค์‹œ ํด๋ฆญํ•˜๋Š” ๊ฒฝ์šฐ
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.selectedMarker = nil
self?.hideBottomSheetAndGoBack()
} else { /// ๋‹ค๋ฅธ ํ˜„์ƒ์†Œ ํด๋ฆญ
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.selectedMarker = markertmp
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
self?.showBottomSheet()
}
}
return true
}
}

private func setUpMapView() {
view.addSubview(mapView)
let locationOverlay = mapView.mapView.locationOverlay
Expand All @@ -156,17 +181,26 @@ extension StudioMapViewController {
let markerInfo = Studio(id: $0.id, lati: $0.lati, long: $0.long)
marker.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)

self.selectedMarkerInfo = markerInfo
StudioMapViewController.selectedMarkerID = markerInfo.id
self.studioInfoWithAPI(studioID: markerInfo.id)

marker.touchHandler = { [weak self] (overlay: NMFOverlay) -> Bool in
if self?.clickCount == 1 { /// ์ด๋ฏธ ๋งˆ์ปค๊ฐ€ ํด๋ฆญ๋œ ๊ฒฝ์šฐ (์ค‘๋ณต ํด๋ฆญ ํ—ˆ์šฉ์•ˆํ•จ)
self?.clickCount = 0
self?.hideBottomSheetAndGoBack()
marker.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
} else {
self?.clickCount = 1
if self?.selectedMarker == nil { /// ํด๋ฆญํ–ˆ๋˜ ํ˜„์ƒ์†Œ๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ (์ง€๋„๋ทฐ ์ฒ˜์Œ ๋“ค์–ด์˜ฌ ๋–„)
self?.selectedMarker = marker
self?.selectedMarkerInfo = markerInfo
StudioMapViewController.selectedMarkerID = markerInfo.id
self?.studioInfoWithAPI(studioID: markerInfo.id)
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
self?.showBottomSheet()
} else {
if self?.selectedMarker == marker { /// ํด๋ฆญํ–ˆ๋˜ ํ˜„์ƒ์†Œ๋ฅผ ๋‹ค์‹œ ํด๋ฆญํ•˜๋Š” ๊ฒฝ์šฐ
self?.selectedMarker = nil
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.hideBottomSheetAndGoBack()
} else { /// ๋‹ค๋ฅธ ํ˜„์ƒ์†Œ ํด๋ฆญ
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self?.selectedMarker = marker
self?.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudioSelected.image)
self?.showBottomSheet()
}
}
return true
}
Expand All @@ -177,9 +211,9 @@ extension StudioMapViewController {
func getBottomSheetInfo() {
StudioMapViewController.name = "ํ•„๋ฆฐ ํ˜„์ƒ์†Œ"
StudioMapViewController.address = "์†ํŠธ์‹œ ์•ฑ์žผ๊ตฌ ํ•„๋ฆฐ๋™ ์•„์š”๋กœ 12๋ฒˆ๊ธธ 13"
StudioMapViewController.time = "open 10:00-21:00"
StudioMapViewController.time = "open 00:00-24:00"
StudioMapViewController.tel = "010-1234-5678"
StudioMapViewController.price = "์ปฌ๋Ÿฌ 5000์›"
StudioMapViewController.price = "์ปฌ๋Ÿฌ 5000000000์›"
StudioMapViewController.site = ""

// StudioMapViewController.name = self.serverStudioInfo?.studio.name
Expand Down Expand Up @@ -264,12 +298,6 @@ extension StudioMapViewController {
newVC.modalPresentationStyle = .fullScreen
self.present(newVC, animated: true, completion: nil)
}

@objc func changeMarkerObserver(_ notification: Notification) {
selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnPlaceBig.image)
selectedMarker = nil
clickCount = 0
}

@objc func touchLocationButton(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
Expand Down Expand Up @@ -444,6 +472,8 @@ extension StudioMapViewController {
func hideBottomSheetAndGoBack() {
let safeAreaHeight = view.safeAreaLayoutGuide.layoutFrame.height
let bottomPadding = view.safeAreaInsets.bottom
self.selectedMarker?.iconImage = NMFOverlayImage(image: Asset.icnStudio.image)
self.selectedMarker = nil
bottomSheetViewTopConstraint.constant = safeAreaHeight + bottomPadding
UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseOut, animations: {
self.view.layoutIfNeeded()
Expand All @@ -455,10 +485,6 @@ extension StudioMapViewController {
else { return number }
return nearestVal
}

func setNotification() {
NotificationCenter.default.post(name: NSNotification.Name.changeMarker, object: nil, userInfo: nil)
}

func changeScrollEnabled() {
let contentVC = children.first as? StudioMapContentViewController
Expand Down Expand Up @@ -495,7 +521,6 @@ extension StudioMapViewController {
}
case .ended:
if velocity.y > 1500 {
setNotification()
hideBottomSheetAndGoBack()
return
}
Expand All @@ -508,7 +533,6 @@ extension StudioMapViewController {
} else if nearestValue == defaultPadding {
showBottomSheet(atState: .normal)
} else {
setNotification()
hideBottomSheetAndGoBack()
}
default:
Expand Down

0 comments on commit d366ada

Please sign in to comment.