Skip to content

Commit

Permalink
[Chore] ACLocationManager 사용을 위한 git merge develop (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
cirtuare committed Jan 20, 2025
2 parents a7f22bd + 764cc3d commit 6c9dbe9
Show file tree
Hide file tree
Showing 34 changed files with 811 additions and 347 deletions.
48 changes: 40 additions & 8 deletions ACON-iOS/ACON-iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ACON-iOS/ACON-iOS/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

self.window = UIWindow(windowScene: windowScene)
// let navigationController = UINavigationController(rootViewController: LoginViewController())
// navigationController.navigationBar.isHidden = true
self.window?.rootViewController = LoginViewController()
let navigationController = UINavigationController(rootViewController: LoginViewController())
navigationController.navigationBar.isHidden = true
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
}

Expand Down
86 changes: 84 additions & 2 deletions ACON-iOS/ACON-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ enum StringLiterals {

static let uploadSpotName = "가게명 등록하기"

static let dropAcornsHere = "이곳에 도토리 남기기"
static let dropAcornsHere = "도토리로 리뷰남기기"

static let shallWeDropAcorns = "이제 도토리를\n떨어트려볼까요?"
static let shallWeDropAcorns = "도토리를 떨어트려\n리뷰를 남겨 볼까요?"

static let useAcornToReview = "도토리를 사용해 리뷰를 남겨주세요."

Expand All @@ -97,6 +97,10 @@ enum StringLiterals {

static let noMatchingSpots = "앗! 일치하는 장소가 없어요."

static let clickAcorn = "도토리를 터치해보세요"

static let noAcorn = "도토리가 부족해요!"

}

enum SpotList {
Expand Down Expand Up @@ -136,6 +140,7 @@ enum StringLiterals {
static let localAcorn = "로컬 도토리"

static let plainAcorn = "일반 도토리"

}

enum SpotListFilter {
Expand Down Expand Up @@ -183,6 +188,7 @@ enum StringLiterals {

}


enum WebView {

static let error = "에러"
Expand All @@ -202,4 +208,80 @@ enum StringLiterals {
static let refreshToken = "refreshToken"

}


enum DislikeTypes {

static let dakbal = "닭발"

static let hoeYukhoe = "회/육회"

static let gopchang = "곱창/대창/막창"

static let soondae = "순대/선지"

static let yanggogi = "양고기"

static let none = " "

}

enum FavoriteSpotRankTypes {

static let mood = "분위기가 감각적인"

static let new = "새로운 음식의 경험"

static let quality = "합리적인 가격과 양"

static let special = "특별한 날, 고급스러운"

}

enum FavoriteSpotTypes {

static let restaurant = "음식점"

static let cafe = "카페"

}

enum FavoriteSpotStyles {

static let nopo = "노포"

static let modern = "모던"

}

enum FavoriteCuisineTypes {

static let korean = "한식"

static let western = "양식"

static let chinese = "중식"

static let japanese = "일식"

static let koreanStreet = "분식"

static let asian = "아시안"

}

enum OnboardingType {

static let progressNumberList = ["01", "02", "03", "04", "05"]

static let progressTitleList = [
"어떤 음식을 피하고 싶으신가요?",
"선호 음식 Top3까지 순위를 매겨주세요.",
"지주 가는 곳이 어디인가요?",
"어떤 분위기의 공간이 좋으세요?",
"선호하는 맛집 스타일의\n 순위를 매겨주세요."
]

}

}

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions ACON-iOS/ACON-iOS/Global/Resources/Lottie/drop1Acorn.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ACON-iOS/ACON-iOS/Global/Resources/Lottie/drop2Acorn.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ACON-iOS/ACON-iOS/Global/Resources/Lottie/drop3Acorn.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ACON-iOS/ACON-iOS/Global/Resources/Lottie/drop4Acorn.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ACON-iOS/ACON-iOS/Global/Resources/Lottie/drop5Acorn.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions ACON-iOS/ACON-iOS/Global/UIComponents/ACToastController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import Then

final class ACToastController {
static func show(_ message: String,
bottomInset: Int = 92,
delayTime: Double = 2.0,
buttonTitle: String = "",
buttonAction: @escaping () -> Void) {


guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first else { return }

Expand All @@ -27,12 +27,12 @@ final class ACToastController {

toastView.snp.makeConstraints {
$0.height.equalTo(ScreenUtils.height*42/780)
$0.bottom.equalToSuperview().inset(ScreenUtils.height*92/780)
$0.bottom.equalToSuperview().inset(Int(ScreenUtils.height)*bottomInset/780)
$0.horizontalEdges.equalToSuperview().inset(ScreenUtils.width*20/360)
}

DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {
UIView.animate(withDuration: 2.0) {
DispatchQueue.main.asyncAfter(deadline: .now() + delayTime) {
UIView.animate(withDuration: delayTime) {
toastView.alpha = 0
} completion: { _ in
toastView.removeFromSuperview()
Expand Down Expand Up @@ -63,7 +63,6 @@ final class ACToastView: BaseView {
}

private func setUI() {

addSubviews(messageLabel)

messageLabel.snp.makeConstraints {
Expand Down
28 changes: 18 additions & 10 deletions ACON-iOS/ACON-iOS/Global/Utils/ACLocationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ extension ACLocationManagerDelegate {
}

func locationManagerDidChangeAuthorization(_ manager: ACLocationManager) {
if manager.locationManager.authorizationStatus == .authorizedWhenInUse || manager.locationManager.authorizationStatus == .authorizedAlways {
manager.locationManager.requestLocation()
}
// TODO: - 이거 안 하면 위치 접근 권한 뜰 때 누르고, 다시 한 번 더 눌러야 제대로 된 서버통신 진행됨.
// NOTE: 위치 접근 권한 변경 시 바로 위치 로드
// if manager.locationManager.authorizationStatus == .authorizedWhenInUse || manager.locationManager.authorizationStatus == .authorizedAlways {
// manager.checkUserCurrentLocationAuthorization(manager.locationManager.authorizationStatus)
// }
}

}
Expand All @@ -38,6 +40,7 @@ class ACLocationManager: NSObject {

let locationManager = CLLocationManager()
private let multicastDelegate = MulticastDelegate<ACLocationManagerDelegate>()
private var isRequestingLocation: Bool = false

private override init() {
super.init()
Expand Down Expand Up @@ -92,13 +95,15 @@ class ACLocationManager: NSObject {
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.requestWhenInUseAuthorization()
case .denied, .restricted:
// TODO: 설정 이동 Alert 커스텀 Alert으로 변경
let scenes = UIApplication.shared.connectedScenes
let windowScene = scenes.first as? UIWindowScene
let window = windowScene?.windows.first
window?.rootViewController?.showDefaultAlert(title: StringLiterals.Alert.gpsDeniedTitle, message: StringLiterals.Alert.gpsDeniedMessage)
let alertHandler = AlertHandler()
alertHandler.showLocationAccessFailAlert(from: (window?.rootViewController)!)
case .authorizedWhenInUse, .authorizedAlways:
locationManager.requestLocation()
guard !isRequestingLocation else { return }
isRequestingLocation = true
locationManager.startUpdatingLocation()
default:
print("zz 여기로안빠질듯")
}
Expand All @@ -109,12 +114,15 @@ class ACLocationManager: NSObject {
extension ACLocationManager: CLLocationManagerDelegate {

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let coordinate = locations.last?.coordinate {
multicastDelegate.invoke { delegate in
delegate.locationManager(self, didUpdateLocation: coordinate)
}
guard isRequestingLocation, let coordinate = locations.last?.coordinate else {
return
}
isRequestingLocation = false
stopUpdatingLocation()

multicastDelegate.invoke { delegate in
delegate.locationManager(self, didUpdateLocation: coordinate)
}
}

func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class LocalVerificationFinishedViewController: BaseViewController {
var dismissCompletion: (() -> Void)?

override func viewDidDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
super.viewDidDisappear(animated)

if isBeingDismissed {
dismissCompletion?()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ extension FavoriteSpotRankCollectionView: UICollectionViewDelegateFlowLayout {
layout collectionViewLayout: UICollectionViewLayout,
minimumLineSpacingForSectionAt section: Int
) -> CGFloat {
return 5
return ScreenUtils.height * 12 / 780
}

func collectionView(
_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
minimumInteritemSpacingForSectionAt section: Int
) -> CGFloat {
return ScreenUtils.width * 3 / 360
return ScreenUtils.width * 12 / 360
}

func collectionView(
Expand All @@ -83,8 +83,9 @@ extension FavoriteSpotRankCollectionView: UICollectionViewDelegateFlowLayout {
insetForSectionAt section: Int
) -> UIEdgeInsets {
let horizontalInset = ScreenUtils.width * 20 / 360
let verticalInset = ScreenUtils.width * 84 / 780
return UIEdgeInsets(
top: 0,
top: verticalInset,
left: horizontalInset,
bottom: 0,
right: horizontalInset
Expand Down
Loading

0 comments on commit 6c9dbe9

Please sign in to comment.