Skip to content

Commit

Permalink
Feat: 둘러보기 1차 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
iosdevSW committed Sep 3, 2023
1 parent e09cf0f commit 887d5ee
Show file tree
Hide file tree
Showing 31 changed files with 468 additions and 64 deletions.
26 changes: 25 additions & 1 deletion FitHub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
B50CB9B72A976DD500BA78B0 /* OnBoardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CB9B62A976DD500BA78B0 /* OnBoardingViewController.swift */; };
B50CB9BB2A97744000BA78B0 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CB9BA2A97744000BA78B0 /* OnboardingView.swift */; };
B50EE9C42A9E73BF002F1C02 /* FacilityCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50EE9C32A9E73BF002F1C02 /* FacilityCell.swift */; };
B50EE9CC2AA2D207002F1C02 /* FacilitySearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50EE9CB2AA2D207002F1C02 /* FacilitySearchViewController.swift */; };
B50EE9CE2AA2D228002F1C02 /* FacilitySearchViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50EE9CD2AA2D228002F1C02 /* FacilitySearchViewModel.swift */; };
B5705C772A866AC600408233 /* EditFitSiteModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5705C762A866AC600408233 /* EditFitSiteModel.swift */; };
B5705C792A86762D00408233 /* CreateFitSiteUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5705C782A86762D00408233 /* CreateFitSiteUseCase.swift */; };
B5705C7B2A86790100408233 /* CreateFitSiteRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5705C7A2A86790100408233 /* CreateFitSiteRepository.swift */; };
Expand Down Expand Up @@ -355,6 +357,8 @@
B50CB9B62A976DD500BA78B0 /* OnBoardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnBoardingViewController.swift; sourceTree = "<group>"; };
B50CB9BA2A97744000BA78B0 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
B50EE9C32A9E73BF002F1C02 /* FacilityCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacilityCell.swift; sourceTree = "<group>"; };
B50EE9CB2AA2D207002F1C02 /* FacilitySearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacilitySearchViewController.swift; sourceTree = "<group>"; };
B50EE9CD2AA2D228002F1C02 /* FacilitySearchViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacilitySearchViewModel.swift; sourceTree = "<group>"; };
B5705C762A866AC600408233 /* EditFitSiteModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditFitSiteModel.swift; sourceTree = "<group>"; };
B5705C782A86762D00408233 /* CreateFitSiteUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateFitSiteUseCase.swift; sourceTree = "<group>"; };
B5705C7A2A86790100408233 /* CreateFitSiteRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateFitSiteRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -723,6 +727,23 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
B50EE9CA2AA2D1F9002F1C02 /* Search */ = {
isa = PBXGroup;
children = (
B50EE9CB2AA2D207002F1C02 /* FacilitySearchViewController.swift */,
B50EE9CD2AA2D228002F1C02 /* FacilitySearchViewModel.swift */,
);
path = Search;
sourceTree = "<group>";
};
B50EE9CF2AA2D361002F1C02 /* LookUp */ = {
isa = PBXGroup;
children = (
B5AA9EEE2A9B842800D37E2C /* FacilitiesDTO.swift */,
);
path = LookUp;
sourceTree = "<group>";
};
B5705C812A87775B00408233 /* Detail */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1205,6 +1226,7 @@
DB002BB52A67C350001B5672 /* LookUp */ = {
isa = PBXGroup;
children = (
B50EE9CA2AA2D1F9002F1C02 /* Search */,
B5AA9EFA2A9DB88500D37E2C /* View */,
DB002BB72A67C36F001B5672 /* LookUpViewController.swift */,
B5AA9EF82A9B884600D37E2C /* LookUpViewModel.swift */,
Expand Down Expand Up @@ -1435,7 +1457,6 @@
B58D3C312A94EBFE008F06D2 /* TermsListDTO.swift */,
B58D3C382A94FC16008F06D2 /* NotiSettingDTO.swift */,
B58D3C4C2A95203D008F06D2 /* CheckRemainAlarmDTO.swift */,
B5AA9EEE2A9B842800D37E2C /* FacilitiesDTO.swift */,
);
path = Home;
sourceTree = "<group>";
Expand Down Expand Up @@ -1627,6 +1648,7 @@
DBF125EA2A5EA0DA004DA4B9 /* DTO */ = {
isa = PBXGroup;
children = (
B50EE9CF2AA2D361002F1C02 /* LookUp */,
B58D3C5E2A9539F7008F06D2 /* Alarm */,
B5ED12732A8E73AA002769BE /* MyPage */,
B5705CF32A8B86BD00408233 /* Search */,
Expand Down Expand Up @@ -2183,6 +2205,7 @@
B5ED133D2A91F173002769BE /* OtherFitSiteCell.swift in Sources */,
B5705D092A8C410C00408233 /* SearchTotalHeaderView.swift in Sources */,
B5705C922A87ABA200408233 /* CertificationDetailSectionModel.swift in Sources */,
B50EE9CC2AA2D207002F1C02 /* FacilitySearchViewController.swift in Sources */,
DB002BBB2A67C3C7001B5672 /* MyPageViewController.swift in Sources */,
B5ED130E2A8FE5A7002769BE /* PrivacyInfoSettingViewController.swift in Sources */,
DB5D22322A5470A800B32485 /* PasswordSettingViewModel.swift in Sources */,
Expand All @@ -2204,6 +2227,7 @@
B5705C832A87776800408233 /* CertificationDetailViewController.swift in Sources */,
B588B7DB2A83AD710031C723 /* ArticleService.swift in Sources */,
B5ED13492A923E68002769BE /* UserRepository.swift in Sources */,
B50EE9CE2AA2D228002F1C02 /* FacilitySearchViewModel.swift in Sources */,
DB7559E72A55062C00B88B96 /* SportsCell.swift in Sources */,
DB7559E12A548C6800B88B96 /* ProfileSettingViewModel.swift in Sources */,
DB97F8352A527BCF009C09A1 /* StandardNotificationAlertView.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion FitHub.xcodeproj/xcshareddata/xcschemes/FitHub.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand Down
1 change: 1 addition & 0 deletions FitHub/Common/Extension/NotificationName+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ extension Notification.Name {
static let dismissStandardAlert = Notification.Name("dismissStandardAlert")
static let presentAlert = Notification.Name("presentAlert")
static let tapChangeMainExercise = Notification.Name("tapChangeMainExercise")
static let tapLookupWithCategory = Notification.Name("tapLookupWithCategory")
}
15 changes: 13 additions & 2 deletions FitHub/Common/UI/CommentInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ final class CommentInputView: UIStackView {
private let placeholder = "댓글 남기기"

private let profileImageView = UIImageView(image: UIImage(named: "DefaultProfile")).then {
$0.contentMode = .scaleAspectFill
$0.layer.cornerRadius = 15
$0.layer.masksToBounds = true
}
Expand Down Expand Up @@ -64,6 +65,14 @@ final class CommentInputView: UIStackView {
}
}

func configureProfile(imageURL: String?) {
if let imageURL {
self.profileImageView.kf.setImage(with: URL(string: imageURL))
} else {
self.profileImageView.image = UIImage(named: "DefaultProfile")
}
}

private func layout() {
profileImageView.snp.makeConstraints {
$0.leading.equalToSuperview().offset(20)
Expand All @@ -80,11 +89,13 @@ final class CommentInputView: UIStackView {
commentInputView.snp.makeConstraints {
$0.leading.equalToSuperview().offset(15)
$0.top.bottom.equalToSuperview().inset(2)
$0.trailing.equalTo(registButton.snp.leading).offset(-14)
$0.trailing.equalTo(registButton.snp.leading).offset(-12)
}

registButton.setContentHuggingPriority(.required, for: .horizontal)
registButton.setContentCompressionResistancePriority(.required, for: .horizontal)
registButton.snp.makeConstraints {
$0.trailing.equalToSuperview().offset(-16)
$0.trailing.equalToSuperview().offset(-16).priority(.required)
$0.bottom.equalToSuperview().offset(-4)
}
}
Expand Down
1 change: 1 addition & 0 deletions FitHub/Common/UI/FitHubSearchBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class FitHubSearchBar: UISearchBar {
if let clearButton = self.searchTextField.value(forKeyPath: "_clearButton") as? UIButton {
clearButton.setImage(UIImage(named: "CancelIcon"), for: .normal)
}

let leftView = UIView(frame: CGRectMake(0, 0, 34, 24))
let imgView = UIImageView(image: UIImage(named: "searchIcon")?.withRenderingMode(.alwaysOriginal))
imgView.frame = .init(x: 10, y: 0, width: 24, height: 24)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@ struct FacilitiesDTO: Decodable {
let userY: String
}

struct FacilitiesKeywordDTO: Decodable {
let facilitiesList: [FacilityDTO]
let size: Int
let userX: String
let userY: String
}

class FacilityDTO: NSObject, Decodable {
let name: String
let address: String
let roadAddress: String
let imageUrl: String?
let phoneNumber: String?
let category: String
let categoryId: Int
let x: String
let y: String
let dist: String
Expand Down
6 changes: 3 additions & 3 deletions FitHub/Data/Network/AlarmService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AlarmService {
func fetchAlramList(page: Int)->Single<AlarmListDTO> {
guard let baseURL = Bundle.main.object(forInfoDictionaryKey: "BaseURL") as? String else { return Single.error(AuthError.invalidURL)}

var urlString = baseURL + "users/alarms"
let urlString = baseURL + "users/alarms"
let parameter: Parameters = ["pageIndex" : page]

return Single<AlarmListDTO>.create { emitter in
Expand All @@ -36,7 +36,7 @@ class AlarmService {
func confirmAlram(alarmId: Int)->Single<Bool> {
guard let baseURL = Bundle.main.object(forInfoDictionaryKey: "BaseURL") as? String else { return Single.error(AuthError.invalidURL)}

var urlString = baseURL + "users/alarms/\(alarmId)"
let urlString = baseURL + "users/alarms/\(alarmId)"

return Single<Bool>.create { emitter in

Expand All @@ -45,7 +45,7 @@ class AlarmService {
switch res.result {
case .success(let response):
if response.code == 2000 {
guard let result = response.result else { return }
// guard let result = response.result else { return }
emitter(.success(true))
} else {
emitter(.success(false))
Expand Down
2 changes: 1 addition & 1 deletion FitHub/Data/Network/ArticleService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class ArticleService {

func reportFitSite(articleId: Int)->Single<Int> {
guard let baseURL = Bundle.main.object(forInfoDictionaryKey: "BaseURL") as? String else { return Single.error(AuthError.invalidURL)}
var urlString = baseURL + "articles/\(articleId)/report"
let urlString = baseURL + "articles/\(articleId)/report"

return Single<Int>.create { observer in
AF.request(urlString, method: .post, interceptor: AuthManager())
Expand Down
60 changes: 59 additions & 1 deletion FitHub/Data/Network/HomeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class HomeService {
guard let baseURL = Bundle.main.object(forInfoDictionaryKey: "BaseURL") as? String
else { return Single.error(AuthError.invalidURL) }

let urlString = baseURL + "home/facilities/\(searchInfo.categoryId)"
let urlString = baseURL + "home/facilities/\(0)"
var parameter: Parameters = ["x" : searchInfo.x,
"y" : searchInfo.y,
"userX" : searchInfo.userX,
Expand All @@ -260,4 +260,62 @@ class HomeService {
return Disposables.create()
}
}

func fetchFacilitiesWithKeyword(searchInfo: FacilitySearch)-> Single<FacilitiesKeywordDTO> {
guard let baseURL = Bundle.main.object(forInfoDictionaryKey: "BaseURL") as? String
else { return Single.error(AuthError.invalidURL) }

let urlString = baseURL + "home/facilities/keyword/\(0)"
let parameter: Parameters = ["userX" : searchInfo.userX,
"userY" : searchInfo.userY,
"keyword" : searchInfo.keyword,
"categoryId" : 0]

return Single<FacilitiesKeywordDTO>.create { emitter in
AF.request(urlString, parameters: parameter, encoding: URLEncoding.queryString, interceptor: AuthManager())
.responseDecodable(of:BaseResponse<FacilitiesKeywordDTO>.self) { res in
switch res.result {
case .success(let response):
if response.code == 2000 {
guard let result = response.result else { return }
emitter(.success(result))
} else {
print(response.code)
print(response.message)
emitter(.failure(CertificationError.serverError))
}
case .failure(let error):
emitter(.failure(error))
}
}
return Disposables.create()
}
}

func fetchRecommendFacilites() -> Single<RecommendKeywordDTO> {
guard let baseURL = Bundle.main.object(forInfoDictionaryKey: "BaseURL") as? String
else { return Single.error(AuthError.invalidURL) }

let urlString = baseURL + "home/facilities/keywords"

return Single<RecommendKeywordDTO>.create { emitter in
AF.request(urlString, interceptor: AuthManager())
.responseDecodable(of:BaseResponse<RecommendKeywordDTO>.self) { res in
switch res.result {
case .success(let response):
if response.code == 2000 {
guard let result = response.result else { return }
emitter(.success(result))
} else {
print(response.code)
print(response.message)
emitter(.failure(CertificationError.serverError))
}
case .failure(let error):
emitter(.failure(error))
}
}
return Disposables.create()
}
}
}
10 changes: 10 additions & 0 deletions FitHub/Data/Repository/LookUp/LookUpRepositiory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import RxSwift
protocol LookUpRepositioryInterface {
func fetchCategory()->Single<[CategoryDTO]>
func fetchFacilities(searchInfo: FacilitySearch)->Single<FacilitiesDTO>
func fetchRecommendFacilites() -> Single<RecommendKeywordDTO>
func fetchFacilitiesWithKeyword(searchInfo: FacilitySearch)-> Single<FacilitiesKeywordDTO>
}

final class LookUpRepositiory: LookUpRepositioryInterface {
Expand All @@ -30,4 +32,12 @@ final class LookUpRepositiory: LookUpRepositioryInterface {
func fetchFacilities(searchInfo: FacilitySearch) -> Single<FacilitiesDTO> {
return homeService.fetchFacilities(searchInfo: searchInfo)
}

func fetchRecommendFacilites() -> Single<RecommendKeywordDTO> {
return homeService.fetchRecommendFacilites()
}

func fetchFacilitiesWithKeyword(searchInfo: FacilitySearch)-> Single<FacilitiesKeywordDTO> {
return homeService.fetchFacilitiesWithKeyword(searchInfo: searchInfo)
}
}
10 changes: 10 additions & 0 deletions FitHub/Domain/UseCase/LookUp/LookUpUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import RxSwift
protocol LookUpUseCaseProtocol {
func fetchCategory()->Single<[CategoryDTO]>
func fetchFacilities(searchInfo: FacilitySearch)->Single<FacilitiesDTO>
func fetchRecommendFacilites() -> Single<RecommendKeywordDTO>
func fetchFacilitiesWithKeyword(searchInfo: FacilitySearch)-> Single<FacilitiesKeywordDTO>
}

final class LookUpUseCase: LookUpUseCaseProtocol {
Expand All @@ -27,4 +29,12 @@ final class LookUpUseCase: LookUpUseCaseProtocol {
func fetchFacilities(searchInfo: FacilitySearch)->Single<FacilitiesDTO> {
return lookUpRepo.fetchFacilities(searchInfo: searchInfo)
}

func fetchRecommendFacilites() -> Single<RecommendKeywordDTO> {
return lookUpRepo.fetchRecommendFacilites()
}

func fetchFacilitiesWithKeyword(searchInfo: FacilitySearch)-> Single<FacilitiesKeywordDTO> {
return lookUpRepo.fetchFacilitiesWithKeyword(searchInfo: searchInfo)
}
}
2 changes: 0 additions & 2 deletions FitHub/Presenters/Auth/SignIn/PhoneAuthViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ final class PhoneAuthViewController: BaseViewController {
self.didNotFoundUserInfoAlert()
case .passwordFaild:
self.notiAlert("잘못된 비밀번호 입니다.")
default:
print("기타오류")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class SportsSelectingViewController: BaseViewController {
output.registPublisher
.bind(onNext: { [weak self] nickName in
guard let self else { return }
if let nickName {
if let _ = nickName {
let tabBar = self.setTapbar()
self.changeRootViewController(tabBar)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class CertificationDetailCell: UICollectionViewCell {
private let contentImageView = UIImageView().then {
$0.layer.masksToBounds = true
$0.backgroundColor = .bgSub01
$0.contentMode = .scaleAspectFill
$0.contentMode = .scaleToFill
}

private let contentLabel = UILabel().then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ final class CertificationDetailViewController: BaseViewController {
}
})
.disposed(by: disposeBag)

viewModel.userProfileImage
.bind(onNext: { [weak self] imageString in
self?.commentInputView.configureProfile(imageURL: imageString)
})
.disposed(by: disposeBag)
}

// MARK: - 화면 이동
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class CertificationDetailViewModel: ViewModelType {
let reportUserHandler = PublishSubject<Int>()
let deleteFeedHandler = PublishSubject<Bool>()
let updateHandler = PublishSubject<CertificationDetailDTO>()
let userProfileImage = PublishSubject<String>()

//MARK: - Input
let detailSource = PublishSubject<CertificationDetailDTO>()
Expand Down Expand Up @@ -191,6 +192,7 @@ extension CertificationDetailViewModel {
self?.ownerId = res.userInfo.ownerId
self?.detailSource.onNext(res)
self?.certificationModel = res
self?.userProfileImage.onNext(res.loginUserProfileUrl)
}, onFailure: { [weak self] error in
self?.errorHandler.onNext(error)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ final class FitSiteDetailViewController: BaseViewController {
}
})
.disposed(by: disposeBag)

viewModel.userProfileImage
.bind(onNext: { [weak self] imageString in
self?.commentInputView.configureProfile(imageURL: imageString)
})
.disposed(by: disposeBag)
}

override func configureNavigation() {
Expand Down
Loading

0 comments on commit 887d5ee

Please sign in to comment.