Skip to content

Commit

Permalink
Merge pull request #363 from boostcampwm2023/iOS/bug#362
Browse files Browse the repository at this point in the history
bug: 릴리즈 시 발생했던 버그들 수정
  • Loading branch information
chopmozzi authored Feb 22, 2024
2 parents a017bef + cdf14fd commit e1cb19e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
6 changes: 4 additions & 2 deletions iOS/Layover/Layover/Scenes/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
35 changes: 29 additions & 6 deletions iOS/Layover/Layover/Scenes/UploadPost/UploadPostInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }
Expand All @@ -160,15 +181,17 @@ 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)
}
}

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 }
Expand Down
2 changes: 2 additions & 0 deletions iOS/Layover/Layover/Scenes/UploadPost/UploadPostModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ enum UploadPostModels {
let administrativeArea: String?
let locality: String?
let subLocality: String?
let latitude: Double
let longitude: Double
}

enum AddressType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e1cb19e

Please sign in to comment.