From fc439b750e359e300f71d35600f217ed7af57afc Mon Sep 17 00:00:00 2001 From: chopmozzi <44396392+chopmozzi@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:45:37 +0900 Subject: [PATCH 1/4] =?UTF-8?q?:bug:=20=EC=9C=84=EC=B9=98=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=A9=94=ED=83=80=EB=8D=B0=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=EA=B0=80=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=EC=95=88=EB=90=98=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UploadPost/UploadPostInteractor.swift | 35 +++++++++++++++---- .../Scenes/UploadPost/UploadPostModels.swift | 2 ++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/iOS/Layover/Layover/Scenes/UploadPost/UploadPostInteractor.swift b/iOS/Layover/Layover/Scenes/UploadPost/UploadPostInteractor.swift index e28cb82..6ce5d53 100644 --- a/iOS/Layover/Layover/Scenes/UploadPost/UploadPostInteractor.swift +++ b/iOS/Layover/Layover/Scenes/UploadPost/UploadPostInteractor.swift @@ -51,6 +51,7 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD var tags: [String]? = [] var videoAddress: Models.AddressInfo? var currentAddress: Models.AddressInfo? + var addressType: Models.AddressType? // MARK: - Object LifeCycle @@ -98,7 +99,10 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD return Models.AddressInfo( administrativeArea: administrativeArea, locality: locality, - subLocality: subLocality) + subLocality: subLocality, + latitude: location.coordinate.latitude, + longitude: location.coordinate.longitude + ) } catch { os_log(.error, log: .data, "Failed to fetch Current Address with error: %@", error.localizedDescription) return nil @@ -120,7 +124,10 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD return Models.AddressInfo( administrativeArea: administrativeArea, locality: locality, - subLocality: subLocality) + subLocality: subLocality, + latitude: videoLocation.latitude, + longitude: videoLocation.longitude + ) } catch { os_log(.error, log: .data, "Failed to fetch Video Address with error: %@", error.localizedDescription) return nil @@ -136,15 +143,29 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD guard let worker, let videoURL, let isMuted, - let coordinate = locationManager.getCurrentLocation()?.coordinate else { return } + let addressType + else { return } + + var addressInfo: Models.AddressInfo? + switch addressType { + case .video: + if let videoAddress { + addressInfo = videoAddress + } + case .current: + if let currentAddress { + addressInfo = currentAddress + } + } + guard let addressInfo else { return } Task { if isMuted { await exportVideoWithoutAudio(at: videoURL) } let uploadPostResponse = await worker.uploadPost(with: UploadPost(title: request.title, content: request.content, - latitude: coordinate.latitude, - longitude: coordinate.longitude, + latitude: addressInfo.latitude, + longitude: addressInfo.longitude, tag: request.tags, videoURL: videoURL)) guard let boardID = uploadPostResponse?.id else { return } @@ -160,8 +181,9 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD videoAddress = await videoAddressInfo currentAddress = await currentAddressInfo + addressType = videoAddress != nil ? .video : .current - let response: Models.FetchCurrentAddress.Response = Models.FetchCurrentAddress.Response(addressInfo: [ videoAddress, currentAddress].compactMap { $0 }) + let response: Models.FetchCurrentAddress.Response = Models.FetchCurrentAddress.Response(addressInfo: [videoAddress, currentAddress].compactMap { $0 }) await MainActor.run { presenter?.presentCurrentAddress(with: response) } @@ -169,6 +191,7 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD func selectAddress(with request: UploadPostModels.SelectAddress.Request) { var response: Models.FetchCurrentAddress.Response + addressType = request.addressType switch request.addressType { case .video: guard let videoAddress else { return } diff --git a/iOS/Layover/Layover/Scenes/UploadPost/UploadPostModels.swift b/iOS/Layover/Layover/Scenes/UploadPost/UploadPostModels.swift index 8c93182..8f82dfd 100644 --- a/iOS/Layover/Layover/Scenes/UploadPost/UploadPostModels.swift +++ b/iOS/Layover/Layover/Scenes/UploadPost/UploadPostModels.swift @@ -22,6 +22,8 @@ enum UploadPostModels { let administrativeArea: String? let locality: String? let subLocality: String? + let latitude: Double + let longitude: Double } enum AddressType { From 5c30f1b92dab54bbdae9cb0c491d9d299a0d7901 Mon Sep 17 00:00:00 2001 From: chopmozzi <44396392+chopmozzi@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:46:25 +0900 Subject: [PATCH 2/4] =?UTF-8?q?:bug:=20=EC=8B=A0=EA=B3=A0=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift b/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift index 185440c..2d759fa 100644 --- a/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift +++ b/iOS/Layover/Layover/Scenes/Playback/PlaybackInteractor.swift @@ -308,7 +308,7 @@ final class PlaybackInteractor: PlaybackBusinessLogic, PlaybackDataStore { } func reportVideo(with request: PlaybackModels.ReportPlaybackVideo.Request) { - if request.indexPathRow < playbackVideoInfos.count { return } + if request.indexPathRow >= playbackVideoInfos.count { return } boardID = playbackVideoInfos[request.indexPathRow].boardID presenter?.presentReportVideo() } From 83d07e774f82ac81489fa04e623ededbb8b79ee3 Mon Sep 17 00:00:00 2001 From: chopmozzi <44396392+chopmozzi@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:50:15 +0900 Subject: [PATCH 3/4] =?UTF-8?q?:bug:=20iOS=20=ED=98=B8=ED=99=98=EC=84=B1?= =?UTF-8?q?=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Layover/Layover/Scenes/Home/HomeViewController.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iOS/Layover/Layover/Scenes/Home/HomeViewController.swift b/iOS/Layover/Layover/Scenes/Home/HomeViewController.swift index 8387aca..926cbf0 100644 --- a/iOS/Layover/Layover/Scenes/Home/HomeViewController.swift +++ b/iOS/Layover/Layover/Scenes/Home/HomeViewController.swift @@ -139,8 +139,10 @@ final class HomeViewController: BaseViewController { section.interGroupSpacing = 13 section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30) section.orthogonalScrollingBehavior = .groupPagingCentered - section.orthogonalScrollingProperties.decelerationRate = .normal - section.orthogonalScrollingProperties.bounce = .never + if #available(iOS 17.0, *) { + section.orthogonalScrollingProperties.decelerationRate = .normal + section.orthogonalScrollingProperties.bounce = .never + } section.visibleItemsInvalidationHandler = { items, offset, environment in let containerWidth = environment.container.contentSize.width From cdf14fd1b7842c5a24853a9a3e9136cede0cd3d3 Mon Sep 17 00:00:00 2001 From: chopmozzi <44396392+chopmozzi@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:04:02 +0900 Subject: [PATCH 4/4] =?UTF-8?q?:bug:=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=8B=A4=ED=8C=A8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/UploadPost/UploadPostPresenterTests.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/iOS/Layover/LayoverTests/Scenes/UploadPost/UploadPostPresenterTests.swift b/iOS/Layover/LayoverTests/Scenes/UploadPost/UploadPostPresenterTests.swift index 4e44de1..4ccde26 100644 --- a/iOS/Layover/LayoverTests/Scenes/UploadPost/UploadPostPresenterTests.swift +++ b/iOS/Layover/LayoverTests/Scenes/UploadPost/UploadPostPresenterTests.swift @@ -116,7 +116,10 @@ class UploadPostPresenterTests: XCTestCase { let response = Models.FetchCurrentAddress.Response(addressInfo: [Models.AddressInfo( administrativeArea: nil, locality: nil, - subLocality: nil)]) + subLocality: nil, + latitude: 0, + longitude: 0 + )]) // when sut.presentCurrentAddress(with: response)