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 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() } 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 { 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)