Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix]: load data time 버그 수정 #15

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions AVIRO.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@
C5DBF8382B3A5FEC00668B0D /* AVIROTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5DBF8372B3A5FEC00668B0D /* AVIROTabBarController.swift */; };
C5DBF83F2B3A6E1000668B0D /* TabBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5DBF83E2B3A6E1000668B0D /* TabBarButton.swift */; };
C5DBF8412B3A787800668B0D /* CGFloat+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5DBF8402B3A787800668B0D /* CGFloat+Extension.swift */; };
C5DBF8432B3A822900668B0D /* AVIROViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5DBF8422B3A822900668B0D /* AVIROViewController.swift */; };
C5E143A72AB43B8F007AC8C9 /* AVIROResult+DTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E143A62AB43B8F007AC8C9 /* AVIROResult+DTO.swift */; };
C5E306E72A6FB4ED00C11CF7 /* MenuField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E306E62A6FB4ED00C11CF7 /* MenuField.swift */; };
C5E430B32A5DADBE00CB67EC /* SecondRegistrationPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E430B22A5DADBE00CB67EC /* SecondRegistrationPresenter.swift */; };
Expand Down Expand Up @@ -459,7 +458,6 @@
C5DBF8372B3A5FEC00668B0D /* AVIROTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVIROTabBarController.swift; sourceTree = "<group>"; };
C5DBF83E2B3A6E1000668B0D /* TabBarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarButton.swift; sourceTree = "<group>"; };
C5DBF8402B3A787800668B0D /* CGFloat+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGFloat+Extension.swift"; sourceTree = "<group>"; };
C5DBF8422B3A822900668B0D /* AVIROViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVIROViewController.swift; sourceTree = "<group>"; };
C5E143A62AB43B8F007AC8C9 /* AVIROResult+DTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AVIROResult+DTO.swift"; sourceTree = "<group>"; };
C5E306E62A6FB4ED00C11CF7 /* MenuField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuField.swift; sourceTree = "<group>"; };
C5E430B22A5DADBE00CB67EC /* SecondRegistrationPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondRegistrationPresenter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1104,7 +1102,6 @@
isa = PBXGroup;
children = (
C5DBF8372B3A5FEC00668B0D /* AVIROTabBarController.swift */,
C5DBF8422B3A822900668B0D /* AVIROViewController.swift */,
);
path = Base;
sourceTree = "<group>";
Expand Down Expand Up @@ -2188,7 +2185,6 @@
C505C1E22B3ACEC00058F115 /* Reactive+Extension.swift in Sources */,
C5166E4D2A945228003495AA /* MyData.swift in Sources */,
C58B9AAE2A5675B9008AEAC3 /* TutorialViewController.swift in Sources */,
C5DBF8432B3A822900668B0D /* AVIROViewController.swift in Sources */,
C5FF13552A42C88D0026981D /* AVIROPlaceMenus+DTO.swift in Sources */,
C56E7A112A971504009CCAF2 /* ReportCellView.swift in Sources */,
C52066332A7E80350038ECCD /* MatchedPlaceCellModel.swift in Sources */,
Expand Down Expand Up @@ -2428,7 +2424,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = AVIRO/AVIRO.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10;
CURRENT_PROJECT_VERSION = 11;
DEVELOPMENT_TEAM = C4K2HXA435;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AVIRO/App/Info.plist;
Expand Down Expand Up @@ -2463,7 +2459,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = AVIRO/AVIRO.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 10;
CURRENT_PROJECT_VERSION = 11;
DEVELOPMENT_TEAM = C4K2HXA435;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AVIRO/App/Info.plist;
Expand Down
4 changes: 2 additions & 2 deletions AVIRO/App/LaunchScreenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ final class LaunchScreenViewController: UIViewController {

private func checkVersion() {
DispatchQueue.global().async { [weak self] in
let latestVersion = SystemUtility().latestVersion() ?? "0.0"
let currentVersion = SystemUtility.appVersion ?? "0.0"
let latestVersion = SystemUtility().latestVersion() ?? "0.0.0"
let currentVersion = SystemUtility.appVersion ?? "0.0.0"

let splitLatestVersion = latestVersion.split(separator: ".").map { $0 }
let splitCurrentVersion = currentVersion.split(separator: ".").map { $0 }
Expand Down
7 changes: 4 additions & 3 deletions AVIRO/Custom/Utility/TimeUtility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class TimeUtility {
let formatter = DateFormatter()

formatter.dateFormat = "yyyy.MM.dd"

let formattedDate = formatter.string(from: date)

return formattedDate
Expand All @@ -25,10 +25,11 @@ final class TimeUtility {
let date = Date()
let formatter = DateFormatter()

formatter.dateFormat = "YYYY-MM-dd HH:mm:ss"

formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let formattedDateTime = formatter.string(from: date)

print(formattedDateTime)
return formattedDateTime
}

Expand Down
3 changes: 2 additions & 1 deletion AVIRO/Manager/FacadeManager/MarkerModelManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ final class MarkerModelManager: MarkerModelManagerProtocol {
time: updateTime
)

AVIROAPI.manager.loadNerbyPlaceModels(with: mapModel) { result in
AVIROAPI.manager.loadNerbyPlaceModels(with: mapModel) { [weak self] result in
switch result {
case .success(let success):
if success.statusCode == 200 {
Expand Down Expand Up @@ -111,6 +111,7 @@ final class MarkerModelManager: MarkerModelManagerProtocol {
let updatedDataRaw = realm.objects(MarkerModelFromRealm.self)
let updatedDataArray = Array(updatedDataRaw).map { $0.toAVIROMarkerModel() }

self?.updateTime = TimeUtility.nowDateAndTime()
completionHandler(.success(updatedDataArray))
} else {
completionHandler(.failure(.badRequest))
Expand Down
7 changes: 3 additions & 4 deletions AVIRO/Model/LocalDataModel/MarkerModelCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ final class MarkerModelCache: MarkerModelCacheProtocol {
/// 앱이 실행 중일때 Marker Model 업데이트 하는 경우 가공된 데이터로 저장
func updateMarkerModel(_ markerModel: MarkerModel) {
if let index = markers.firstIndex(where: { $0.placeId == markerModel.placeId }) {

var updateMarker = markerModel

DispatchQueue.main.async { [weak self] in
DispatchQueue.main.sync { [weak self] in
self?.markers[index].marker.position = updateMarker.marker.position

self?.markers[index].marker.changeIcon(
Expand All @@ -86,7 +85,7 @@ final class MarkerModelCache: MarkerModelCacheProtocol {
}

private func adjustMarkerCoordinatesWhenOverlapping(for markerModel: MarkerModel) {
DispatchQueue.main.async { [weak self] in
DispatchQueue.main.sync { [weak self] in
guard let self = self else { return }

let samePositionMarkers = self.markers.filter { $0.marker.position == markerModel.marker.position }
Expand Down Expand Up @@ -114,7 +113,7 @@ final class MarkerModelCache: MarkerModelCacheProtocol {
// MARK: DeleteMarkerModel
/// update간 삭제된 마커데이터 삭제하기
func deleteMarkerModel(with placeId: String) {
DispatchQueue.main.async { [weak self] in
DispatchQueue.main.sync { [weak self] in
guard let markerModel = self?.markers.first(where: { $0.placeId == placeId }) else { return }

markerModel.marker.mapView = nil
Expand Down
4 changes: 1 addition & 3 deletions AVIRO/Scene/Base/AVIROTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ final class AVIROTabBarController: UIViewController, TabBarDelegate {

return view
}()

var selectedIndex: Int = 0 {
willSet {
previousIndex = selectedIndex
Expand Down Expand Up @@ -241,8 +241,6 @@ final class AVIROTabBarController: UIViewController, TabBarDelegate {
private func deleteView() {
let previousVC = viewControllers[previousIndex]

// selectedVCBottomUponViewBottom = nil
// selectedVCBottomUponTabViewConstraint = nil
previousVC.remove()
}

Expand Down
12 changes: 0 additions & 12 deletions AVIRO/Scene/Base/AVIROViewController.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ final class ChallengeInfoGreenView: UIView {
return label
}()

private lazy var subLabel: UILabel = {
let label = UILabel()

label.text = "* 시즌 한정 보상은 시즌 내에만 볼 수 있어요"
label.numberOfLines = 1
label.textColor = .gray2
label.font = .pretendard(size: 12, weight: .regular)
label.textAlignment = .left

return label
}()

override init(frame: CGRect) {
super.init(frame: frame)

Expand All @@ -55,8 +43,7 @@ final class ChallengeInfoGreenView: UIView {
private func setupLayout() {
[
explainImage,
explainLabel,
subLabel
explainLabel
].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
self.addSubview($0)
Expand All @@ -69,13 +56,9 @@ final class ChallengeInfoGreenView: UIView {
explainImage.widthAnchor.constraint(equalToConstant: 60),
explainImage.heightAnchor.constraint(equalToConstant: 60),

explainLabel.topAnchor.constraint(equalTo: self.topAnchor, constant: 11),
explainLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor),
explainLabel.leadingAnchor.constraint(equalTo: explainImage.trailingAnchor, constant: 10),
explainLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -10),

subLabel.topAnchor.constraint(equalTo: explainLabel.bottomAnchor, constant: 4),
subLabel.leadingAnchor.constraint(equalTo: explainLabel.leadingAnchor),
subLabel.trailingAnchor.constraint(equalTo: explainLabel.trailingAnchor)
explainLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -10)
])
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private enum Text: String {
case error = "에러"
}

final class EnrollPlaceViewController: UIViewController, AVIROViewController {
final class EnrollPlaceViewController: UIViewController {
weak var tabBarDelegate: TabBarDelegate?
weak var homeViewDelegate: AfterHomeViewControllerProtocol?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ final class EnrollPlacePresenter {
AVIROAPI.manager.createPlaceModel(with: veganModel) { [weak self] result in
switch result {
case .success(let resultModel):
print(resultModel)
if resultModel.statusCode == 200 {
self?.amplitude.uploadPlace(with: veganModel.title)

Expand All @@ -141,6 +142,7 @@ final class EnrollPlacePresenter {
self?.viewController?.pushAlertController()
}
case .failure(let error):
print(error)
if let error = error.errorDescription {
self?.viewController?.showErrorAlert(with: error, title: nil)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ final class ReviewWriteViewModel: ViewModel {
content: content
)

// TODO: 수정 업데이트
if let editCommentId = editCommentId {
model.commentId = editCommentId

Expand Down Expand Up @@ -166,13 +165,10 @@ final class ReviewWriteViewModel: ViewModel {
)
}

private var test = 0
private func updateReview(with reviewModel: AVIROEnrollReviewDTO) -> Single<(AfterWriteReviewModel, Bool)> {
test += 1
print(test)

return Single.create { single in
AVIROAPI.manager.createReview(with: reviewModel) { [weak self] result in
print(result)
switch result {
case .success(let model):
if model.statusCode == 200 {
Expand Down
Loading