Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
0lynny committed Sep 20, 2022
2 parents 4915ca0 + 4bf9a2b commit 906892b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import Foundation
struct ScrapListEntity: Codable {
let _id, name, logo: String
let score: Double
let category: String
let hashtag: [String]
let category: [String]
let address: String
let latitude, longtitude: Double

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,11 @@ extension MainMapVC {
UserService.shared.getScrapList(userId: userID) { result in
switch(result) {
case .success(let entity):

if let scrapList = entity as? [ScrapListEntity] {
if scrapList.isEmpty { self.showUpperToast() }
self.showUpperToast(scrapCount: scrapList.count)
self.currentScrapList = scrapList
if !self.currentCategory.isEmpty {
self.fetchCategoryList(zoom: self.currentZoom)
self.fetchCategoryList(zoom: MapLiterals.ZoomScale.Maximum)
} else {
self.mapView.scrapButtonSelected.accept(scrapList)
}
Expand All @@ -337,7 +336,8 @@ extension MainMapVC {
}
}
} else {
fetchRestaurantList(zoom: self.currentZoom)
resetCurrentCategory()
fetchRestaurantList(zoom: MapLiterals.ZoomScale.Maximum)
}
}

Expand Down Expand Up @@ -470,7 +470,7 @@ extension MainMapVC {
guard let self = self else { return }
let accumulate = MapAccumulationCalculator.zoomLevelToDistance(level: zoomLevel)
self.currentZoom = Double(accumulate)
self.fetchRestaurantList(zoom: Double(accumulate))
self.fetchRestaurantList(zoom: MapLiterals.ZoomScale.Maximum)
}).disposed(by: self.disposeBag)

mapView.setSelectPoint
Expand Down Expand Up @@ -575,6 +575,11 @@ extension MainMapVC {
}
}

private func resetCurrentCategory() {
selectedCategories = Array(repeating: false, count: 10)
currentCategory = ""
}

private func matchRestaurantId(position: NMGLatLng) -> String {
var id = ""
restaurantData.forEach { entity in
Expand Down Expand Up @@ -783,8 +788,10 @@ extension MainMapVC {
}

extension MainMapVC {
private func showUpperToast() {
makeVibrate()
private func showUpperToast(scrapCount: Int) {
scrapListEmptyToastView.title = (scrapCount == 0
? I18N.Map.Main.scrapEmptyGuide
: "\(scrapCount)개의 스크랩 식당이 있습니다")
scrapListEmptyToastView.snp.remakeConstraints { make in
make.width.equalTo(300)
make.height.equalTo(40)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ extension NaverMapContainerView {
}
if let caption = point.restaurantName {
marker.captionText = caption
marker.captionTextSize = 14
marker.captionHaloColor = .helfmeWhite
marker.isForceShowCaption = false
marker.captionTextSize = 12
marker.captionMinZoom = 12
marker.captionColor = .helfmeBlack
}
Expand All @@ -260,6 +262,8 @@ extension NaverMapContainerView {
}).first else { return }
if let seletedMark = self.selectedMarker,
let type = selectedMarkerType?.type {
seletedMark.isForceShowCaption = false
seletedMark.zIndex = 0
switch type {
case .healthFood:
setHealthMarkState(mark: seletedMark, selectState: false)
Expand All @@ -274,6 +278,8 @@ extension NaverMapContainerView {
setNormalMarkState(mark: marker, selectState: true)
}
self.selectedMarker = marker
self.selectedMarker?.zIndex = 100
self.selectedMarker?.isForceShowCaption = true
self.selectedMarkerType = selectedPoint
}

Expand Down

0 comments on commit 906892b

Please sign in to comment.