diff --git a/Runnect-iOS/.swiftlint.yml b/Runnect-iOS/.swiftlint.yml index b4b8db1c..05d158e0 100644 --- a/Runnect-iOS/.swiftlint.yml +++ b/Runnect-iOS/.swiftlint.yml @@ -5,6 +5,7 @@ disabled_rules: - type_name - legacy_constructor - unused_setter_value + - file_length included: - Runnect-iOS diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 4da9bef8..a8ffdaee 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -119,6 +119,7 @@ CE9291252965C9FB0010959C /* CourseDetailInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9291242965C9FB0010959C /* CourseDetailInfoView.swift */; }; CE9291272965D0ED0010959C /* StatsInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9291262965D0ED0010959C /* StatsInfoView.swift */; }; CE9291292965E01D0010959C /* RNTimeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9291282965E01D0010959C /* RNTimeFormatter.swift */; }; + CEB0BCBC29D123350048CCD5 /* GuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB0BCBB29D123350048CCD5 /* GuideView.swift */; }; CEB8416E2962C45300BF8080 /* LocationSearchResultTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB8416D2962C45300BF8080 /* LocationSearchResultTVC.swift */; }; CEB841702963360800BF8080 /* CountDownVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB8416F2963360800BF8080 /* CountDownVC.swift */; }; CEC2A6852961F92C00160BF7 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC2A6842961F92C00160BF7 /* CustomButton.swift */; }; @@ -271,6 +272,7 @@ CE9291242965C9FB0010959C /* CourseDetailInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDetailInfoView.swift; sourceTree = ""; }; CE9291262965D0ED0010959C /* StatsInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsInfoView.swift; sourceTree = ""; }; CE9291282965E01D0010959C /* RNTimeFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNTimeFormatter.swift; sourceTree = ""; }; + CEB0BCBB29D123350048CCD5 /* GuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuideView.swift; sourceTree = ""; }; CEB8416D2962C45300BF8080 /* LocationSearchResultTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSearchResultTVC.swift; sourceTree = ""; }; CEB8416F2963360800BF8080 /* CountDownVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountDownVC.swift; sourceTree = ""; }; CEC2A6842961F92C00160BF7 /* CustomButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButton.swift; sourceTree = ""; }; @@ -997,6 +999,7 @@ CE9291242965C9FB0010959C /* CourseDetailInfoView.swift */, CE9291262965D0ED0010959C /* StatsInfoView.swift */, CE6B63D729673450003F900F /* ListEmptyView.swift */, + CEB0BCBB29D123350048CCD5 /* GuideView.swift */, ); path = UIComponents; sourceTree = ""; @@ -1350,6 +1353,7 @@ CECA695C296E61D6002AF05C /* PrivateCourseNotUploadedResponseDto.swift in Sources */, CE6655EC295D88D000C64E12 /* UITableView+.swift in Sources */, CEEC6B3A2961C4F300D00E1E /* CourseDrawingHomeVC.swift in Sources */, + CEB0BCBC29D123350048CCD5 /* GuideView.swift in Sources */, CEC2A6902962B06C00160BF7 /* convertLocationObject.swift in Sources */, CEC2A6852961F92C00160BF7 /* CustomButton.swift in Sources */, CE6B63D3296725E6003F900F /* CourseListCVC.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/xcshareddata/xcschemes/Runnect-iOS.xcscheme b/Runnect-iOS/Runnect-iOS.xcodeproj/xcshareddata/xcschemes/Runnect-iOS.xcscheme new file mode 100644 index 00000000..911cbe3a --- /dev/null +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/xcshareddata/xcschemes/Runnect-iOS.xcscheme @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIImage+.swift b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIImage+.swift index 86abf3bd..61958e84 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIImage+.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Extension/UIKit+/UIImage+.swift @@ -42,4 +42,35 @@ extension UIImage { UIGraphicsEndImageContext() self.init(cgImage: (image?.cgImage)!) } + + static func imageFromView(view: UIView) -> UIImage? { + UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.isOpaque, 0.0) + view.drawHierarchy(in: view.bounds, afterScreenUpdates: true) + defer { UIGraphicsEndImageContext() } + guard let context = UIGraphicsGetCurrentContext() else { return nil } + view.layer.render(in: context) + let image = UIGraphicsGetImageFromCurrentImageContext() + return image + } + + static func cropImage(_ inputImage: UIImage, toRect cropRect: CGRect, viewWidth: CGFloat, viewHeight: CGFloat) -> UIImage? { + let imageViewScale = max(inputImage.size.width / viewWidth, + inputImage.size.height / viewHeight) + + // Scale cropRect to handle images larger than shown-on-screen size + let cropZone = CGRect(x: cropRect.origin.x * imageViewScale, + y: cropRect.origin.y * imageViewScale, + width: cropRect.size.width * imageViewScale, + height: cropRect.size.height * imageViewScale) + + // Perform cropping in Core Graphics + guard let cutImageRef: CGImage = inputImage.cgImage?.cropping(to: cropZone) + else { + return nil + } + + // Return image to UIImage + let croppedImage: UIImage = UIImage(cgImage: cutImageRef) + return croppedImage + } } diff --git a/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift b/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift index ae8c8e9d..b3bf5bc6 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Literal/ImageLiterals.swift @@ -41,6 +41,7 @@ enum ImageLiterals { static var icLocationPoint: UIImage { .load(named: "ic_location_point") } static var icAlert: UIImage { .load(named: "ic_alert") } static var icLocationOverlay: UIImage { .load(named: "ic_location_overlay") } + static var icLogoCircle: UIImage { .load(named: "ic_logo_circle") } // img static var imgBackground: UIImage { .load(named: "img_background") } diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/Contents.json b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/Contents.json new file mode 100644 index 00000000..fb29a134 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/Contents.json @@ -0,0 +1,26 @@ +{ + "images" : [ + { + "filename" : "runnect logo-01 1 1.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "runnect logo-01 1 1@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "runnect logo-01 1 1@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "template-rendering-intent" : "original" + } +} diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1.png b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1.png new file mode 100644 index 00000000..c4a60ab3 Binary files /dev/null and b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1.png differ diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1@2x.png b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1@2x.png new file mode 100644 index 00000000..7306fce6 Binary files /dev/null and b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1@2x.png differ diff --git a/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1@3x.png b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1@3x.png new file mode 100644 index 00000000..efb25c9b Binary files /dev/null and b/Runnect-iOS/Runnect-iOS/Global/Resource/Assets.xcassets/ic_logo_circle.imageset/runnect logo-01 1 1@3x.png differ diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/GuideView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/GuideView.swift new file mode 100644 index 00000000..519b87d1 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/GuideView.swift @@ -0,0 +1,86 @@ +// +// GuideView.swift +// Runnect-iOS +// +// Created by sejin on 2023/03/27. +// + +import UIKit + +final class GuideView: UIView { + + // MARK: - UI Components + + private let logoImageView = UIImageView().then { + $0.image = ImageLiterals.imgAppIcon + $0.backgroundColor = .gray + $0.contentMode = .scaleAspectFit + $0.layer.cornerRadius = 22 + $0.clipsToBounds = true + } + + private let titleContainerView = UIView().then { + $0.backgroundColor = .clear + } + + private let titleLabel = UILabel().then { + $0.textColor = .black + $0.font = .b6 + $0.numberOfLines = 1 + $0.adjustsFontSizeToFitWidth = true + $0.minimumScaleFactor = 0.7 + $0.textAlignment = .center + } + + // MARK: - initialization + + init(title: String) { + super.init(frame: .zero) + setUI() + setLayout() + setTitle(title: title) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - Methods + +extension GuideView { + private func setUI() { + self.backgroundColor = .white + self.layer.cornerRadius = 22 + self.clipsToBounds = true + self.layer.applyShadow(color: .black, alpha: 0.12, x: 0, y: 2, blur: 11, spread: 0) + } + + private func setLayout() { + self.addSubviews(logoImageView, titleContainerView) + titleContainerView.addSubviews(titleLabel) + + self.snp.makeConstraints { make in + make.width.greaterThanOrEqualTo(200) + } + + logoImageView.snp.makeConstraints { make in + make.leading.top.bottom.equalToSuperview() + make.width.height.equalTo(44) + } + + titleContainerView.snp.makeConstraints { make in + make.leading.equalTo(logoImageView.snp.centerX) + make.top.bottom.trailing.equalToSuperview() + } + + titleLabel.snp.makeConstraints { make in + make.center.equalToSuperview() + } + } + + func setTitle(title: String) { + self.titleLabel.text = title + } +} diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift index 65d9c0be..d76afa7e 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/MapView/RNMapView.swift @@ -19,10 +19,13 @@ final class RNMapView: UIView { @Published var pathDistance: Double = 0 @Published var markerCount = 0 + private let screenWidth = UIScreen.main.bounds.width + private let screenHeight = UIScreen.main.bounds.height + let pathImage = PassthroughSubject() - var cancelBag = Set() + private var cancelBag = Set() - let locationManager = CLLocationManager() + private let locationManager = CLLocationManager() private var isDrawMode: Bool = false private var markers = [RNMarker]() { didSet { @@ -37,17 +40,13 @@ final class RNMapView: UIView { private var bottomPadding: CGFloat = 0 private let locationOverlayIcon = NMFOverlayImage(image: ImageLiterals.icLocationOverlay) - private lazy var dummyMap = RNMapView(frame: CGRect(x: 0, y: 0, width: 300, height: 300)).then { - $0.isUserInteractionEnabled = false - } - // MARK: - UI Components let map = NMFNaverMapView() private var startMarker = RNStartMarker() private let pathOverlay = NMFPath() private let locationButton = UIButton(type: .custom) - + // MARK: - initialization public init() { @@ -78,7 +77,6 @@ final class RNMapView: UIView { // MARK: - Methods extension RNMapView { - /// isDrawMode (편집 모드) 설정 @discardableResult func setDrawMode(to isDrawMode: Bool) -> Self { @@ -151,20 +149,18 @@ extension RNMapView { } /// 캡처를 위한 좌표 설정 및 카메라 이동 - func makeDummyMarkerAndCameraMove(at locations: [NMGLatLng]) { - addSubview(dummyMap) - sendSubviewToBack(dummyMap) - dummyMap.makeMarkersWithStartMarker(at: locations, moveCameraToStartMarker: false) + func makeCameraMoveForCapture(at locations: [NMGLatLng]) { + map.mapView.contentInset = UIEdgeInsets(top: screenHeight/4, left: 0, bottom: screenHeight/4, right: 0) let bounds = makeMBR(at: locations) let cameraUpdate = NMFCameraUpdate(fit: bounds, padding: 100) cameraUpdate.animation = .none - dummyMap.map.mapView.moveCamera(cameraUpdate) { isCancelled in + LoadingIndicator.showLoading() + map.mapView.moveCamera(cameraUpdate) { isCancelled in if isCancelled { print("카메라 이동 취소") + LoadingIndicator.hideLoading() } else { - LoadingIndicator.showLoading() - DispatchQueue.main.asyncAfter(deadline: .now()+2) { - self.dummyMap.map.mapView.zoomLevel -= 1 + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { self.makePathImage() LoadingIndicator.hideLoading() } @@ -224,6 +220,13 @@ extension RNMapView { return self } + /// 네이버 지도 로고 Margin 설정 + @discardableResult + func makeNaverLogoMargin(inset: UIEdgeInsets) -> Self { + map.mapView.logoMargin = inset + return self + } + /// 현재 존재하는 Marker들 위치 리턴 func getMarkersLatLng() -> [NMGLatLng] { return self.markersLatLngs @@ -243,26 +246,23 @@ extension RNMapView { /// 더미 뷰를 UIImage로 변환하여 pathImage에 send func makePathImage() { - self.pathImage.send(UIImage(view: dummyMap.map.mapView)) + if let image = UIImage.imageFromView(view: map.mapView) { + guard let newImage = self.cropImage(inputImage: image) else { + print("이미지 생성 실패") + return + } + self.pathImage.send(newImage) + } } /// 현재 시점까지의 마커들을 캡쳐하여 pahImage에 send func capturePathImage() { - makeDummyMarkerAndCameraMove(at: self.markersLatLngs) + makeCameraMoveForCapture(at: self.markersLatLngs) } /// 바운더리(MBR) 생성 func makeMBR(at locations: [NMGLatLng]) -> NMGLatLngBounds { - var latitudes = [Double]() - var longitudes = [Double]() - locations.forEach { latLng in - latitudes.append(latLng.lat) - longitudes.append(latLng.lng) - } - - let southWest = NMGLatLng(lat: latitudes.min() ?? 0, lng: longitudes.min() ?? 0) - let northEast = NMGLatLng(lat: latitudes.max() ?? 0, lng: longitudes.max() ?? 0) - return NMGLatLngBounds(southWest: southWest, northEast: northEast) + return NMGLatLngBounds(latLngs: locations) } /// 직전의 마커 생성을 취소하고 경로선도 제거 @@ -385,7 +385,7 @@ extension RNMapView: NMFMapViewCameraDelegate, NMFMapViewTouchDelegate { guard isDrawMode && markers.count < 19 else { return } self.makeMarker(at: latlng) } - + func mapView(_ mapView: NMFMapView, cameraDidChangeByReason reason: Int, animated: Bool) { let locationOverlay = map.mapView.locationOverlay if locationOverlay.icon != locationOverlayIcon { @@ -395,3 +395,10 @@ extension RNMapView: NMFMapViewCameraDelegate, NMFMapViewTouchDelegate { } extension RNMapView: CLLocationManagerDelegate {} + +extension RNMapView { + func cropImage(inputImage image: UIImage) -> UIImage? { + let y = screenHeight > 800 ? screenHeight/4 + 150 : screenHeight/4 - 40 + return UIImage.cropImage(image, toRect: CGRect(x: 0, y: y, width: screenWidth*2, height: 500.adjustedH), viewWidth: screenWidth, viewHeight: 400.adjustedH) + } +} diff --git a/Runnect-iOS/Runnect-iOS/Global/Utils/RNUtils/UserManager.swift b/Runnect-iOS/Runnect-iOS/Global/Utils/RNUtils/UserManager.swift index 304d071c..93811ba6 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Utils/RNUtils/UserManager.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Utils/RNUtils/UserManager.swift @@ -44,10 +44,10 @@ final class UserManager { do { let responseDto = try result.map(BaseResponse.self) guard let data = responseDto.data else { return } - self.accessToken = data.data.accessToken - self.refreshToken = data.data.refreshToken + self.accessToken = data.accessToken + self.refreshToken = data.refreshToken self.isKakao = provider == "KAKAO" ? true : false - completion(.success(data.data.nickname)) + completion(.success(data.nickname ?? "")) } catch { print(error.localizedDescription) completion(.failure(.networkFail)) @@ -77,10 +77,10 @@ final class UserManager { do { let responseDto = try result.map(BaseResponse.self) guard let data = responseDto.data else { return } - self.accessToken = data.data.accessToken - self.refreshToken = data.data.refreshToken + self.accessToken = data.accessToken + self.refreshToken = data.refreshToken self.isKakao = provider == "KAKAO" ? true : false - completion(.success(data.data.nickname)) + completion(.success(data.nickname ?? "")) } catch { print(error.localizedDescription) completion(.failure(.networkFail)) diff --git a/Runnect-iOS/Runnect-iOS/Global/Utils/adjusted+.swift b/Runnect-iOS/Runnect-iOS/Global/Utils/adjusted+.swift index ebe564dc..904de361 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Utils/adjusted+.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Utils/adjusted+.swift @@ -9,7 +9,7 @@ import UIKit /** - Description: - 스크린 너비 375를 기준으로 디자인이 나왔을 때 현재 기기의 스크린 사이즈에 비례하는 수치를 Return한다. + 스크린 너비 390를 기준으로 디자인이 나왔을 때 현재 기기의 스크린 사이즈에 비례하는 수치를 Return한다. - Note: 기기별 대응에 사용하면 된다. diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/ActivityRecordInfoDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/ActivityRecordInfoDto.swift index 71b8f553..1dfd6fda 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/ActivityRecordInfoDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/ActivityRecordInfoDto.swift @@ -18,7 +18,7 @@ struct ActivityRecordInfoDto: Codable { struct ActivityRecord: Codable { let id, courseId: Int let publicCourseId: Int? - let machineId, title: String + let title: String let image: String let createdAt: String let distance: Double diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/MyPageDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/MyPageDto.swift index c59b0e62..3cb1bd22 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/MyPageDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/MyPageDto/MyPageDto.swift @@ -16,6 +16,6 @@ struct MyPageDto: Codable { // MARK: - User struct User: Codable { - let machineId, nickname, latestStamp: String + let nickname, latestStamp: String let level, levelPercent: Int } diff --git a/Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/ResponseDto/SignInResponseDto.swift b/Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/ResponseDto/SignInResponseDto.swift index 1e36747d..6ca13491 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/ResponseDto/SignInResponseDto.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Dto/SignInDto/ResponseDto/SignInResponseDto.swift @@ -10,16 +10,8 @@ import Foundation // MARK: - SignInResponseDto struct SignInResponseDto: Codable { - let status: Int - let success: Bool - let message: String - let data: SignInResponseData -} - -// MARK: - SignInResponseData - -struct SignInResponseData: Codable { - let type, nickname, accessToken: String + let type, accessToken: String + let nickname: String? let email: String? let refreshToken: String } diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/AuthRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/AuthRouter.swift index e6f3ad40..06cfc2a8 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/AuthRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/AuthRouter.swift @@ -39,14 +39,14 @@ extension AuthRouter: TargetType { var task: Moya.Task { switch self { case .signIn(let token, let provider): - return .requestParameters(parameters: ["token": token, "social": provider], encoding: JSONEncoding.default) + return .requestParameters(parameters: ["token": token, "provider": provider], encoding: JSONEncoding.default) } } var headers: [String: String]? { switch self { case .signIn: - return Config.headerWithAccessToken + return Config.defaultHeader } } } diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift index 2c779635..dd36f92a 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/CourseRouter.swift @@ -90,7 +90,8 @@ extension CourseRouter: TargetType { switch self { case .uploadCourseDrawing: return ["Content-Type": "multipart/form-data", - "machineId": Config.deviceId] + "accessToken": Config.accessToken, + "refreshToken": Config.refreshToken] default: return Config.headerWithAccessToken } diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift index 2bfa41df..57b20f0b 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/PublicCourseRouter.swift @@ -44,7 +44,7 @@ extension PublicCourseRouter: TargetType { } var task: Moya.Task { - switch  self { + switch self { case .getCourseSearchData(let keyword): return .requestParameters(parameters: ["keyword": keyword], encoding: URLEncoding.default) case .courseUploadingData(param: let param): diff --git a/Runnect-iOS/Runnect-iOS/Network/Router/UserRouter.swift b/Runnect-iOS/Runnect-iOS/Network/Router/UserRouter.swift index c820973d..9da8a5be 100644 --- a/Runnect-iOS/Runnect-iOS/Network/Router/UserRouter.swift +++ b/Runnect-iOS/Runnect-iOS/Network/Router/UserRouter.swift @@ -10,7 +10,6 @@ import Foundation import Moya enum UserRouter { - case signUp(nickname: String) case getMyPageInfo case updateUserNickname(nickname: String) } @@ -26,15 +25,13 @@ extension UserRouter: TargetType { var path: String { switch self { - case .signUp, .getMyPageInfo, .updateUserNickname: + case .getMyPageInfo, .updateUserNickname: return "/user" } } var method: Moya.Method { switch self { - case .signUp: - return .post case .getMyPageInfo: return .get case .updateUserNickname: @@ -44,8 +41,6 @@ extension UserRouter: TargetType { var task: Moya.Task { switch self { - case .signUp(let nickname): - return .requestParameters(parameters: ["nickname": nickname], encoding: JSONEncoding.default) case .getMyPageInfo: return .requestPlain case .updateUserNickname(let nickname): diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift index f9452fb4..856bf47c 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift @@ -15,6 +15,8 @@ final class CourseDrawingHomeVC: UIViewController { // MARK: - UI Components + private let guideView = GuideView(title: "코스그리기를 눌러 나만의 코스를 만들어봐요!") + private lazy var mapView = RNMapView() .setPositionMode(mode: .normal) .makeContentPadding(padding: UIEdgeInsets(top: -calculateTopInset(), left: 0, bottom: tabBarHeight, right: 0)) @@ -58,7 +60,7 @@ extension CourseDrawingHomeVC { } private func setLayout() { - view.addSubviews(mapView, drawCourseButton) + view.addSubviews(mapView, drawCourseButton, guideView) mapView.snp.makeConstraints { make in make.top.bottom.equalToSuperview() @@ -70,5 +72,10 @@ extension CourseDrawingHomeVC { make.bottom.equalTo(view.safeAreaLayoutGuide).inset(24) make.height.equalTo(44) } + + guideView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(7) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(23) + } } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift index 9891e0ac..417e95ef 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingVC.swift @@ -40,13 +40,15 @@ final class CourseDrawingVC: UIViewController { $0.alpha = 0 } + private let guideView = GuideView(title: "지점과 지점을 연결해 코스를 완성하세요!") + private lazy var naviBarContainerStackView = UIStackView( arrangedSubviews: [notchCoverView, naviBar] ).then { $0.axis = .vertical } - private let mapView = RNMapView() + private let mapView = RNMapView().makeNaverLogoMargin(inset: UIEdgeInsets(top: 52, left: 0, bottom: 0, right: 0)) private let departureLocationLabel = UILabel().then { $0.font = .b1 @@ -264,7 +266,7 @@ extension CourseDrawingVC { } private func setHiddenViewsLayout() { - view.addSubviews(naviBarForEditing, distanceContainerView, completeButton, undoButton) + view.addSubviews(naviBarForEditing, guideView, distanceContainerView, completeButton, undoButton) view.sendSubviewToBack(naviBarForEditing) naviBarForEditing.snp.makeConstraints { make in @@ -272,6 +274,12 @@ extension CourseDrawingVC { make.height.equalTo(48) } + guideView.snp.makeConstraints { make in + make.centerY.equalTo(naviBarForEditing.snp.centerY) + make.leading.equalTo(view.safeAreaLayoutGuide).inset(55) + make.trailing.equalTo(view.safeAreaLayoutGuide).inset(27) + } + distanceContainerView.snp.makeConstraints { make in make.width.equalTo(96) make.height.equalTo(44) @@ -298,7 +306,7 @@ extension CourseDrawingVC { } private func showHiddenViews(withDuration: TimeInterval = 0) { - [naviBarForEditing, distanceContainerView, completeButton, undoButton].forEach { subView in + [naviBarForEditing, guideView, distanceContainerView, completeButton, undoButton].forEach { subView in view.bringSubviewToFront(subView) } @@ -308,8 +316,11 @@ extension CourseDrawingVC { self.departureInfoContainerView.transform = CGAffineTransform(translationX: 0, y: 172) } + self.guideView.transform = CGAffineTransform(translationX: 0, y: -100) + UIView.animate(withDuration: withDuration) { self.naviBarForEditing.alpha = 1 + self.guideView.transform = .identity self.distanceContainerView.transform = CGAffineTransform(translationX: 0, y: -151) self.completeButton.transform = CGAffineTransform(translationX: 0, y: -112) self.undoButton.transform = CGAffineTransform(translationX: 0, y: -(self.undoButton.frame.height+95)) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/NickNameSetUpVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/NickNameSetUpVC.swift index 4f51f24f..6006e1e7 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/NickNameSetUpVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/NickNameSetUpVC.swift @@ -100,7 +100,7 @@ extension NickNameSetUpVC { @objc func startButtonDidTap() { guard let nickname = nicknameTextField.text else { return } - self.signIn(nickname: nickname) + self.updateUserNickname(nickname: nickname) } } @@ -150,9 +150,9 @@ extension NickNameSetUpVC: UITextFieldDelegate { // MARK: - Network extension NickNameSetUpVC { - func signIn(nickname: String) { + func updateUserNickname(nickname: String) { LoadingIndicator.showLoading() - userProvider.request(.signUp(nickname: nickname)) { [weak self] response in + userProvider.request(.updateUserNickname(nickname: nickname)) { [weak self] response in LoadingIndicator.hideLoading() guard let self = self else { return } switch response { diff --git a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInSocialLoginVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInSocialLoginVC.swift index aa0afcc4..2d73d8ef 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInSocialLoginVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInSocialLoginVC.swift @@ -74,8 +74,9 @@ extension SignInSocialLoginVC { } @objc func kakaoLoginButtonDidTap(_ sender: Any) { - // isKakaoTalkLoginAvailable(): 카톡 설치 되어있으면 true - if (UserApi.isKakaoTalkLoginAvailable()) { // 카톡 설치되어있으면 -> 카톡으로 로그인 + // isKakaoTalkLoginAvailable() : 카톡 설치 되어있으면 true + if UserApi.isKakaoTalkLoginAvailable() { + // 카톡 설치되어있으면 -> 카톡으로 로그인 UserApi.shared.loginWithKakaoTalk {(oauthToken, error) in if let error = error { print(error) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift index 9b6c2cd6..b8dc1c89 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift @@ -41,16 +41,8 @@ extension SplashVC { private func checkDidSignIn() { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { if UserManager.shared.hasAccessToken { - UserManager.shared.autoSignIn { [weak self] result in - switch result { - case .success(let nickname): - print(nickname) - self?.pushToTabBarController() - case .failure(let error): - print(error) - self?.pushToSignInView() - } - } + // accessToken 재발급 + self.pushToTabBarController() } else { self.pushToSignInView() }