diff --git a/Zatch.xcodeproj/project.pbxproj b/Zatch.xcodeproj/project.pbxproj index ec191fbf..7b8de5e3 100644 --- a/Zatch.xcodeproj/project.pbxproj +++ b/Zatch.xcodeproj/project.pbxproj @@ -149,7 +149,7 @@ 576B374B28D6D67700EF36E6 /* KakaoMapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B374A28D6D67700EF36E6 /* KakaoMapViewController.swift */; }; 576B374E28D6D71A00EF36E6 /* KakaoMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B374D28D6D71A00EF36E6 /* KakaoMapView.swift */; }; 576B375428D6D82200EF36E6 /* MapMeetingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B375328D6D82200EF36E6 /* MapMeetingViewController.swift */; }; - 576B375628D6FAFE00EF36E6 /* KakaoLocalMeetingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B375528D6FAFE00EF36E6 /* KakaoLocalMeetingModel.swift */; }; + 576B375628D6FAFE00EF36E6 /* MeetingLoactionResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B375528D6FAFE00EF36E6 /* MeetingLoactionResponseModel.swift */; }; 576B375B28D82E9A00EF36E6 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B375A28D82E9A00EF36E6 /* SettingViewController.swift */; }; 576B375F28D82F6400EF36E6 /* UserLeaveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B375E28D82F6400EF36E6 /* UserLeaveViewController.swift */; }; 576B376128D82F7300EF36E6 /* UserLeaveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576B376028D82F7300EF36E6 /* UserLeaveView.swift */; }; @@ -213,7 +213,7 @@ 57A28CE228CF23FF00263079 /* MyTownTagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A28CE128CF23FF00263079 /* MyTownTagCollectionViewCell.swift */; }; 57A28D0E28D03FAE00263079 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A28D0D28D03FAE00263079 /* String.swift */; }; 57A28D1028D041F800263079 /* MapAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A28D0F28D041F800263079 /* MapAlertViewController.swift */; }; - 57A28D5628D1A0BB00263079 /* KakaoLocationAddressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A28D5528D1A0BB00263079 /* KakaoLocationAddressModel.swift */; }; + 57A28D5628D1A0BB00263079 /* GetTownResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A28D5528D1A0BB00263079 /* GetTownResponseModel.swift */; }; 57B32C2C291F49CF0018C0CB /* ZatchRegisterFirstView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B32C2B291F49CF0018C0CB /* ZatchRegisterFirstView.swift */; }; 57B32C2E291F49DC0018C0CB /* ZatchRegisterSecondView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B32C2D291F49DC0018C0CB /* ZatchRegisterSecondView.swift */; }; 57B32C31291F56120018C0CB /* ZatchRegisterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B32C30291F56120018C0CB /* ZatchRegisterModel.swift */; }; @@ -239,7 +239,7 @@ 57D6D79B28CDBD6600F805B7 /* MakeMeetingSheetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57D6D79A28CDBD6600F805B7 /* MakeMeetingSheetViewModel.swift */; }; 57D6D79D28CDBD7A00F805B7 /* ModifyMeetingSheetViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57D6D79C28CDBD7A00F805B7 /* ModifyMeetingSheetViewModel.swift */; }; 57D6D79F28CDC02600F805B7 /* ModifyMeetingSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57D6D79E28CDC02600F805B7 /* ModifyMeetingSheetViewController.swift */; }; - 57D6D7A328CDC32200F805B7 /* KakaoLocalTownModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57D6D7A228CDC32200F805B7 /* KakaoLocalTownModel.swift */; }; + 57D6D7A328CDC32200F805B7 /* PlaceSearchRepsonseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57D6D7A228CDC32200F805B7 /* PlaceSearchRepsonseModel.swift */; }; 57D6D7A628CDC34800F805B7 /* KakaoLocalDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57D6D7A528CDC34800F805B7 /* KakaoLocalDataManager.swift */; }; 57E75EBF28E3C32800AC24B2 /* ZatchDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E75EBE28E3C32800AC24B2 /* ZatchDetailView.swift */; }; 57E75EC528E3C4CE00AC24B2 /* ShareDetailTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57E75EC428E3C4CE00AC24B2 /* ShareDetailTableViewCell.swift */; }; @@ -284,6 +284,18 @@ EE41019329854DED0083B7E0 /* LeftNavigationTitleHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE41019229854DED0083B7E0 /* LeftNavigationTitleHeaderView.swift */; }; EE41019529854EE60083B7E0 /* LeftNavigationEtcButtonHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE41019429854EE60083B7E0 /* LeftNavigationEtcButtonHeaderView.swift */; }; EE410197298557440083B7E0 /* ImageDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE410196298557440083B7E0 /* ImageDetailView.swift */; }; + EE4D887329CFF127003B6383 /* MapRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D887229CFF127003B6383 /* MapRepository.swift */; }; + EE4D887529CFF13B003B6383 /* MapRepositoryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D887429CFF13B003B6383 /* MapRepositoryInterface.swift */; }; + EE4D887A29CFF3B4003B6383 /* MapRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D887929CFF3B4003B6383 /* MapRouter.swift */; }; + EE4D887F29CFFA8B003B6383 /* MapService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D887E29CFFA8B003B6383 /* MapService.swift */; }; + EE4D888129D000E7003B6383 /* PlaceSearchUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888029D000E7003B6383 /* PlaceSearchUseCase.swift */; }; + EE4D888329D00102003B6383 /* GetTownLocationUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888229D00102003B6383 /* GetTownLocationUseCase.swift */; }; + EE4D888529D0010F003B6383 /* GetMeetingLocationUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888429D0010F003B6383 /* GetMeetingLocationUseCase.swift */; }; + EE4D888729D00191003B6383 /* LocationCoordinateRequestValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888629D00191003B6383 /* LocationCoordinateRequestValue.swift */; }; + EE4D888929D01379003B6383 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888829D01379003B6383 /* MapViewController.swift */; }; + EE4D888B29D013CC003B6383 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888A29D013CC003B6383 /* Map.swift */; }; + EE4D888E29D01987003B6383 /* TownRegisterMapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D888D29D01987003B6383 /* TownRegisterMapViewController.swift */; }; + EE4D889129D01E57003B6383 /* TownRegisterMapViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4D889029D01E57003B6383 /* TownRegisterMapViewModel.swift */; }; EE532957299BD03A00C79CF2 /* ZatchTableViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE532956299BD03A00C79CF2 /* ZatchTableViewCellViewModel.swift */; }; EE541C1329B44C8500DD0F20 /* HTTPMethodURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE541C1229B44C8500DD0F20 /* HTTPMethodURL.swift */; }; EE541C1529B44CF700DD0F20 /* BaseRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE541C1429B44CF700DD0F20 /* BaseRouter.swift */; }; @@ -303,6 +315,7 @@ EE73C51E299610F80000F8AC /* ProductQuantityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE73C51D299610F80000F8AC /* ProductQuantityTableViewCell.swift */; }; EE73C520299611350000F8AC /* ProductIsOpenTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE73C51F299611350000F8AC /* ProductIsOpenTableViewCell.swift */; }; EE73C52229961BF30000F8AC /* RadioButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE73C52129961BF30000F8AC /* RadioButtonView.swift */; }; + EE7AFF5729D16652007872B9 /* MeetingLocationRegisterMapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7AFF5629D16652007872B9 /* MeetingLocationRegisterMapViewController.swift */; }; EE7B76AD29C5D3ED00942798 /* BaseBottomSheetTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7B76AC29C5D3ED00942798 /* BaseBottomSheetTableViewCell.swift */; }; EE7B76C129C5E36D00942798 /* ZatchRepositoryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7B76BF29C5E36D00942798 /* ZatchRepositoryInterface.swift */; }; EE7B76C229C5E36D00942798 /* UserRepositoryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7B76C029C5E36D00942798 /* UserRepositoryInterface.swift */; }; @@ -523,7 +536,7 @@ 576B374A28D6D67700EF36E6 /* KakaoMapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoMapViewController.swift; sourceTree = ""; }; 576B374D28D6D71A00EF36E6 /* KakaoMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoMapView.swift; sourceTree = ""; }; 576B375328D6D82200EF36E6 /* MapMeetingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapMeetingViewController.swift; sourceTree = ""; }; - 576B375528D6FAFE00EF36E6 /* KakaoLocalMeetingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoLocalMeetingModel.swift; sourceTree = ""; }; + 576B375528D6FAFE00EF36E6 /* MeetingLoactionResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingLoactionResponseModel.swift; sourceTree = ""; }; 576B375A28D82E9A00EF36E6 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; 576B375E28D82F6400EF36E6 /* UserLeaveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserLeaveViewController.swift; sourceTree = ""; }; 576B376028D82F7300EF36E6 /* UserLeaveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserLeaveView.swift; sourceTree = ""; }; @@ -594,7 +607,7 @@ 57A28CE128CF23FF00263079 /* MyTownTagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyTownTagCollectionViewCell.swift; sourceTree = ""; }; 57A28D0D28D03FAE00263079 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = ""; }; 57A28D0F28D041F800263079 /* MapAlertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapAlertViewController.swift; sourceTree = ""; }; - 57A28D5528D1A0BB00263079 /* KakaoLocationAddressModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoLocationAddressModel.swift; sourceTree = ""; }; + 57A28D5528D1A0BB00263079 /* GetTownResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetTownResponseModel.swift; sourceTree = ""; }; 57B14B93184043F3CBF58093 /* Pods-Zatch.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Zatch.release.xcconfig"; path = "Target Support Files/Pods-Zatch/Pods-Zatch.release.xcconfig"; sourceTree = ""; }; 57B32C2B291F49CF0018C0CB /* ZatchRegisterFirstView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZatchRegisterFirstView.swift; sourceTree = ""; }; 57B32C2D291F49DC0018C0CB /* ZatchRegisterSecondView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZatchRegisterSecondView.swift; sourceTree = ""; }; @@ -622,7 +635,7 @@ 57D6D79A28CDBD6600F805B7 /* MakeMeetingSheetViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingSheetViewModel.swift; sourceTree = ""; }; 57D6D79C28CDBD7A00F805B7 /* ModifyMeetingSheetViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModifyMeetingSheetViewModel.swift; sourceTree = ""; }; 57D6D79E28CDC02600F805B7 /* ModifyMeetingSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModifyMeetingSheetViewController.swift; sourceTree = ""; }; - 57D6D7A228CDC32200F805B7 /* KakaoLocalTownModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoLocalTownModel.swift; sourceTree = ""; }; + 57D6D7A228CDC32200F805B7 /* PlaceSearchRepsonseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceSearchRepsonseModel.swift; sourceTree = ""; }; 57D6D7A528CDC34800F805B7 /* KakaoLocalDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KakaoLocalDataManager.swift; sourceTree = ""; }; 57E75EBE28E3C32800AC24B2 /* ZatchDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZatchDetailView.swift; sourceTree = ""; }; 57E75EC428E3C4CE00AC24B2 /* ShareDetailTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareDetailTableViewCell.swift; sourceTree = ""; }; @@ -669,6 +682,18 @@ EE41019229854DED0083B7E0 /* LeftNavigationTitleHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftNavigationTitleHeaderView.swift; sourceTree = ""; }; EE41019429854EE60083B7E0 /* LeftNavigationEtcButtonHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftNavigationEtcButtonHeaderView.swift; sourceTree = ""; }; EE410196298557440083B7E0 /* ImageDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageDetailView.swift; sourceTree = ""; }; + EE4D887229CFF127003B6383 /* MapRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapRepository.swift; sourceTree = ""; }; + EE4D887429CFF13B003B6383 /* MapRepositoryInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapRepositoryInterface.swift; sourceTree = ""; }; + EE4D887929CFF3B4003B6383 /* MapRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapRouter.swift; sourceTree = ""; }; + EE4D887E29CFFA8B003B6383 /* MapService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapService.swift; sourceTree = ""; }; + EE4D888029D000E7003B6383 /* PlaceSearchUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceSearchUseCase.swift; sourceTree = ""; }; + EE4D888229D00102003B6383 /* GetTownLocationUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetTownLocationUseCase.swift; sourceTree = ""; }; + EE4D888429D0010F003B6383 /* GetMeetingLocationUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetMeetingLocationUseCase.swift; sourceTree = ""; }; + EE4D888629D00191003B6383 /* LocationCoordinateRequestValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationCoordinateRequestValue.swift; sourceTree = ""; }; + EE4D888829D01379003B6383 /* MapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = ""; }; + EE4D888A29D013CC003B6383 /* Map.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Map.swift; sourceTree = ""; }; + EE4D888D29D01987003B6383 /* TownRegisterMapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TownRegisterMapViewController.swift; sourceTree = ""; }; + EE4D889029D01E57003B6383 /* TownRegisterMapViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TownRegisterMapViewModel.swift; sourceTree = ""; }; EE532956299BD03A00C79CF2 /* ZatchTableViewCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZatchTableViewCellViewModel.swift; sourceTree = ""; }; EE541C1229B44C8500DD0F20 /* HTTPMethodURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPMethodURL.swift; sourceTree = ""; }; EE541C1429B44CF700DD0F20 /* BaseRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseRouter.swift; sourceTree = ""; }; @@ -688,6 +713,7 @@ EE73C51D299610F80000F8AC /* ProductQuantityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductQuantityTableViewCell.swift; sourceTree = ""; }; EE73C51F299611350000F8AC /* ProductIsOpenTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductIsOpenTableViewCell.swift; sourceTree = ""; }; EE73C52129961BF30000F8AC /* RadioButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonView.swift; sourceTree = ""; }; + EE7AFF5629D16652007872B9 /* MeetingLocationRegisterMapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingLocationRegisterMapViewController.swift; sourceTree = ""; }; EE7B76AC29C5D3ED00942798 /* BaseBottomSheetTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseBottomSheetTableViewCell.swift; sourceTree = ""; }; EE7B76BF29C5E36D00942798 /* ZatchRepositoryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZatchRepositoryInterface.swift; sourceTree = ""; }; EE7B76C029C5E36D00942798 /* UserRepositoryInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserRepositoryInterface.swift; sourceTree = ""; }; @@ -966,7 +992,7 @@ EE541C1C29B44EE400DD0F20 /* BaseResponseModel.swift */, EE541C1E29B44F1200DD0F20 /* StatusResponseModel.swift */, 57B32C2F291F55F20018C0CB /* RegisterModels */, - 57A28D5428D1A07000263079 /* TownModels */, + 57A28D5428D1A07000263079 /* Map */, 57D6D7A128CDC30C00F805B7 /* ChattingModels */, ); path = Models; @@ -976,6 +1002,7 @@ isa = PBXGroup; children = ( EE532955299BD00400C79CF2 /* Util */, + EE4D888F29D01E3E003B6383 /* Town */, EEE326AE2998C6CC0017DF46 /* Search */, EE642C5B298FAE1D00E15869 /* Register */, 23CB3CF828C7D85500C42858 /* Main */, @@ -1007,11 +1034,11 @@ 23C9030E28C5CE2E00FB6D3D /* Repository */ = { isa = PBXGroup; children = ( - EE541C1129B44C7B00DD0F20 /* Foundation */, 57A28D5328D19D3700263079 /* KakaoDataManager */, EE813FFA29C585370091F16E /* ZatchRepository.swift */, EE813FFC29C585400091F16E /* UserRepository.swift */, EE27C54B29C8286B00285CC5 /* SearchRepository.swift */, + EE4D887229CFF127003B6383 /* MapRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1575,6 +1602,7 @@ 5722460B28BF79D1009B7C78 /* MakeMeetingSheetViewController.swift */, 57D6D79E28CDC02600F805B7 /* ModifyMeetingSheetViewController.swift */, 576B375328D6D82200EF36E6 /* MapMeetingViewController.swift */, + EE7AFF5629D16652007872B9 /* MeetingLocationRegisterMapViewController.swift */, ); path = Appointment; sourceTree = ""; @@ -1619,6 +1647,7 @@ 57A28B3A28CED8DF00263079 /* SplashTownViewController.swift */, 57A28B3E28CED94B00263079 /* SearchTownViewController.swift */, 57A28B3C28CED93700263079 /* MapTownViewController.swift */, + EE4D888D29D01987003B6383 /* TownRegisterMapViewController.swift */, ); path = Town; sourceTree = ""; @@ -1715,12 +1744,13 @@ path = KakaoDataManager; sourceTree = ""; }; - 57A28D5428D1A07000263079 /* TownModels */ = { + 57A28D5428D1A07000263079 /* Map */ = { isa = PBXGroup; children = ( - 57A28D5528D1A0BB00263079 /* KakaoLocationAddressModel.swift */, + 57A28D5528D1A0BB00263079 /* GetTownResponseModel.swift */, + 57D6D7A228CDC32200F805B7 /* PlaceSearchRepsonseModel.swift */, ); - path = TownModels; + path = Map; sourceTree = ""; }; 57B32C27291E8FB80018C0CB /* Base */ = { @@ -1795,8 +1825,7 @@ 57D6D7A128CDC30C00F805B7 /* ChattingModels */ = { isa = PBXGroup; children = ( - 57D6D7A228CDC32200F805B7 /* KakaoLocalTownModel.swift */, - 576B375528D6FAFE00EF36E6 /* KakaoLocalMeetingModel.swift */, + 576B375528D6FAFE00EF36E6 /* MeetingLoactionResponseModel.swift */, ); path = ChattingModels; sourceTree = ""; @@ -1847,8 +1876,10 @@ 57FEFA84297A5B6E008A78B0 /* Data */ = { isa = PBXGroup; children = ( + EE541C1129B44C7B00DD0F20 /* Foundation */, 23C9030B28C5CE2100FB6D3D /* Models */, 23C9030E28C5CE2E00FB6D3D /* Repository */, + EE4D887D29CFFA69003B6383 /* MoyaService */, ); path = Data; sourceTree = ""; @@ -1950,12 +1981,58 @@ EE4D887129CF0D91003B6383 /* Map */ = { isa = PBXGroup; children = ( + EE4D888A29D013CC003B6383 /* Map.swift */, + EE4D888829D01379003B6383 /* MapViewController.swift */, 576B374A28D6D67700EF36E6 /* KakaoMapViewController.swift */, 576B374D28D6D71A00EF36E6 /* KakaoMapView.swift */, ); path = Map; sourceTree = ""; }; + EE4D887629CFF142003B6383 /* Map */ = { + isa = PBXGroup; + children = ( + EE4D888629D00191003B6383 /* LocationCoordinateRequestValue.swift */, + EE4D888029D000E7003B6383 /* PlaceSearchUseCase.swift */, + EE4D888229D00102003B6383 /* GetTownLocationUseCase.swift */, + EE4D888429D0010F003B6383 /* GetMeetingLocationUseCase.swift */, + ); + path = Map; + sourceTree = ""; + }; + EE4D887729CFF399003B6383 /* Zatch */ = { + isa = PBXGroup; + children = ( + ); + path = Zatch; + sourceTree = ""; + }; + EE4D887829CFF3AA003B6383 /* Map */ = { + isa = PBXGroup; + children = ( + EE4D887929CFF3B4003B6383 /* MapRouter.swift */, + EE4D887E29CFFA8B003B6383 /* MapService.swift */, + ); + path = Map; + sourceTree = ""; + }; + EE4D887D29CFFA69003B6383 /* MoyaService */ = { + isa = PBXGroup; + children = ( + EE4D887729CFF399003B6383 /* Zatch */, + EE4D887829CFF3AA003B6383 /* Map */, + ); + path = MoyaService; + sourceTree = ""; + }; + EE4D888F29D01E3E003B6383 /* Town */ = { + isa = PBXGroup; + children = ( + EE4D889029D01E57003B6383 /* TownRegisterMapViewModel.swift */, + ); + path = Town; + sourceTree = ""; + }; EE532954299BCFEF00C79CF2 /* Util */ = { isa = PBXGroup; children = ( @@ -2046,6 +2123,7 @@ EE7B76BF29C5E36D00942798 /* ZatchRepositoryInterface.swift */, EE7B76C029C5E36D00942798 /* UserRepositoryInterface.swift */, EE27C54429C826E000285CC5 /* SearchRepositotyInterface.swift */, + EE4D887429CFF13B003B6383 /* MapRepositoryInterface.swift */, ); path = RepositoryInterface; sourceTree = ""; @@ -2060,6 +2138,7 @@ EE7B76CF29C5F61C00942798 /* UseCase */ = { isa = PBXGroup; children = ( + EE4D887629CFF142003B6383 /* Map */, EE27C54829C827EF00285CC5 /* Search */, EE7B76D029C5F61C00942798 /* Zatch */, EE7B76D429C5F61C00942798 /* User */, @@ -2550,7 +2629,7 @@ 234E5DBC28C762810079640F /* TabBarViewController.swift in Sources */, 23CB3CF728C7D38F00C42858 /* MyZatchTabViewController.swift in Sources */, 57D6D79B28CDBD6600F805B7 /* MakeMeetingSheetViewModel.swift in Sources */, - 576B375628D6FAFE00EF36E6 /* KakaoLocalMeetingModel.swift in Sources */, + 576B375628D6FAFE00EF36E6 /* MeetingLoactionResponseModel.swift in Sources */, 576B376828D8306800EF36E6 /* DefaultSettingTableViewCell.swift in Sources */, 5722461B28C6C89A009B7C78 /* SearchAddressView.swift in Sources */, 57B9F70C28D94B7800ACEC94 /* Delegate.swift in Sources */, @@ -2562,6 +2641,7 @@ 57B32C362920C5320018C0CB /* CategoryInfo.swift in Sources */, 57E75EBF28E3C32800AC24B2 /* ZatchDetailView.swift in Sources */, EEE7F2B3299BD83100C674B9 /* ZatchShareTableViewCell.swift in Sources */, + EE4D887F29CFFA8B003B6383 /* MapService.swift in Sources */, 232DD0A628ECDBC900BC6E91 /* ReviewViewController.swift in Sources */, 578B7A9C28AC892800E7B4F4 /* ChatInputView.swift in Sources */, 5767D7732868248E0075DB28 /* ZatchDetailViewController.swift in Sources */, @@ -2569,10 +2649,11 @@ 5722462928C77D64009B7C78 /* SearchAddressResultBottomSheet.swift in Sources */, 235613FD28D09DCD00D44E97 /* ZatchTableViewCell.swift in Sources */, 23B051CA28E21BAD005D08EA /* MyQuestionTableViewCell.swift in Sources */, - 57A28D5628D1A0BB00263079 /* KakaoLocationAddressModel.swift in Sources */, + 57A28D5628D1A0BB00263079 /* GetTownResponseModel.swift in Sources */, 57713944281F596C0066DEEB /* TopTitleView.swift in Sources */, EE7B76C229C5E36D00942798 /* UserRepositoryInterface.swift in Sources */, 57067864281C143A00F48342 /* Color.swift in Sources */, + EE4D888929D01379003B6383 /* MapViewController.swift in Sources */, EE73C51E299610F80000F8AC /* ProductQuantityTableViewCell.swift in Sources */, 5722461628C2F827009B7C78 /* AlertViewController.swift in Sources */, EE2BC3512982B881002B5C60 /* MainHeaderView.swift in Sources */, @@ -2607,6 +2688,7 @@ 57067866281C167100F48342 /* UIFont.swift in Sources */, EEE326AD2998C60E0017DF46 /* ZatchSearchRequestManager.swift in Sources */, 57600C0F296307F600A7F27B /* GatchDetailBottomFixView.swift in Sources */, + EE4D887329CFF127003B6383 /* MapRepository.swift in Sources */, 571AD7132828D9EB00390AAD /* CategoryCollectionViewCell.swift in Sources */, EE642C5A298FA9A000E15869 /* ZatchRegisterRequestManager.swift in Sources */, 57468A9828A000F900056691 /* SearchWantZatchByRegisterCollectionViewCell.swift in Sources */, @@ -2614,10 +2696,14 @@ 23E764D228E9EF80002F234C /* AccountViewController.swift in Sources */, 23A767F1290851A3003E46AB /* NoticeViewController.swift in Sources */, 57B32C3A292261D30018C0CB /* AlertInfo.swift in Sources */, + EE4D888B29D013CC003B6383 /* Map.swift in Sources */, + EE4D888329D00102003B6383 /* GetTownLocationUseCase.swift in Sources */, 5722461D28C6C8CA009B7C78 /* SearchAddressViewModel.swift in Sources */, + EE4D888529D0010F003B6383 /* GetMeetingLocationUseCase.swift in Sources */, 57468A76289D077200056691 /* PurpleButton.swift in Sources */, 5722460628BCCFE8009B7C78 /* Const.swift in Sources */, EE813FFB29C585370091F16E /* ZatchRepository.swift in Sources */, + EE4D887A29CFF3B4003B6383 /* MapRouter.swift in Sources */, 23C9031E28C5CF7900FB6D3D /* MainViewController.swift in Sources */, EE642C5D298FAE2C00E15869 /* ZatchRegisterFirstViewModel.swift in Sources */, 23CB3CFF28C7EB4200C42858 /* ChangeLocationSheetViewController.swift in Sources */, @@ -2640,11 +2726,14 @@ 576B376128D82F7300EF36E6 /* UserLeaveView.swift in Sources */, EEE326B02998C6DF0017DF46 /* ExchangeMyZatchSearchViewModel.swift in Sources */, EEB13B94297FCD0A001A8DD9 /* LifeCycle+Rx.swift in Sources */, + EE4D888729D00191003B6383 /* LocationCoordinateRequestValue.swift in Sources */, 576B375F28D82F6400EF36E6 /* UserLeaveViewController.swift in Sources */, EE27C54C29C8286B00285CC5 /* SearchRepository.swift in Sources */, 57D6D79928CDBC6000F805B7 /* ModifyMeetingSheetView.swift in Sources */, 57B32C2C291F49CF0018C0CB /* ZatchRegisterFirstView.swift in Sources */, + EE4D888E29D01987003B6383 /* TownRegisterMapViewController.swift in Sources */, EE27C54729C8273C00285CC5 /* FindWantZatchSearchViewModel.swift in Sources */, + EE4D887529CFF13B003B6383 /* MapRepositoryInterface.swift in Sources */, EE938DA129CD8936003A5BF6 /* UIColor.swift in Sources */, 579F5E58281E574200D3F0D5 /* FindWantZatchSearchViewController.swift in Sources */, 57E75EC528E3C4CE00AC24B2 /* ShareDetailTableViewCell.swift in Sources */, @@ -2655,6 +2744,7 @@ 571DADC2297BA41B0079CCD3 /* BaseHeaderView.swift in Sources */, 57EBCE4228A8C67B00212D20 /* DatePickerAlertViewController.swift in Sources */, 576341A728D29CC70067D2C5 /* BlockUserViewController.swift in Sources */, + EE7AFF5729D16652007872B9 /* MeetingLocationRegisterMapViewController.swift in Sources */, 574EC1ED282E62A000E3CE4B /* RegisterCategorySelectTableViewCell.swift in Sources */, 57FFEDC528DD2F0D0041719B /* CheckShareRegisterViewController.swift in Sources */, 576341AB28D29D120067D2C5 /* BlockUserTableViewCell.swift in Sources */, @@ -2704,6 +2794,7 @@ 575BF6FF27E0CBC6008D5B3C /* SceneDelegate.swift in Sources */, EE541C1929B44E7D00DD0F20 /* NetworkResult.swift in Sources */, EE73C52229961BF30000F8AC /* RadioButtonView.swift in Sources */, + EE4D888129D000E7003B6383 /* PlaceSearchUseCase.swift in Sources */, EE7C9FF6298A72CE00D2F238 /* ChattingRoomView.swift in Sources */, EEB13B87297FB81B001A8DD9 /* MainViewModel.swift in Sources */, EEE1153829A713ED003FD4E3 /* SectionDivider.swift in Sources */, @@ -2750,6 +2841,7 @@ EE73C51A2995FB170000F8AC /* ProductDateChoiceTableViewCell.swift in Sources */, 576B375428D6D82200EF36E6 /* MapMeetingViewController.swift in Sources */, 57EBCE3B28A87BFD00212D20 /* ImageAddBtnCollectionViewCell.swift in Sources */, + EE4D889129D01E57003B6383 /* TownRegisterMapViewModel.swift in Sources */, 57468A8B289FEB2000056691 /* BaseBottomSheetViewController.swift in Sources */, 576341C628D40A3A0067D2C5 /* MeetingMapAlertViewController.swift in Sources */, 23E764D028E9EF7A002F234C /* PolicyViewController.swift in Sources */, @@ -2760,7 +2852,7 @@ 23B051BF28E20622005D08EA /* QnAViewController.swift in Sources */, EE7B76D929C5F61C00942798 /* GetMyTownUseCase.swift in Sources */, 57D6D79528CDBC3A00F805B7 /* MeetingSheetView.swift in Sources */, - 57D6D7A328CDC32200F805B7 /* KakaoLocalTownModel.swift in Sources */, + 57D6D7A328CDC32200F805B7 /* PlaceSearchRepsonseModel.swift in Sources */, 57F68BAA29652ED300DB1471 /* DetailEtcBottomSheetView.swift in Sources */, EE7B76C129C5E36D00942798 /* ZatchRepositoryInterface.swift in Sources */, 57468A8E289FEF1800056691 /* SearchWantRegisterZatchSheetViewController.swift in Sources */, diff --git a/Zatch/AppDelegate/SceneDelegate.swift b/Zatch/AppDelegate/SceneDelegate.swift index 4c9050b0..c41a0344 100644 --- a/Zatch/AppDelegate/SceneDelegate.swift +++ b/Zatch/AppDelegate/SceneDelegate.swift @@ -27,7 +27,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // var startViewController: UIViewController // startViewController = UserManager.token == nil ? UINavigationController(rootViewController: OnboardingViewController()) : TabBarController() - window?.rootViewController = UINavigationController(rootViewController: MapTownViewController()) + window?.rootViewController = UINavigationController(rootViewController: TownRegisterMapViewController()) // window?.rootViewController = TabBarController() window?.makeKeyAndVisible() } diff --git a/Zatch/Data/Repository/Foundation/BaseRouter.swift b/Zatch/Data/Foundation/BaseRouter.swift similarity index 100% rename from Zatch/Data/Repository/Foundation/BaseRouter.swift rename to Zatch/Data/Foundation/BaseRouter.swift diff --git a/Zatch/Data/Repository/Foundation/BaseService.swift b/Zatch/Data/Foundation/BaseService.swift similarity index 84% rename from Zatch/Data/Repository/Foundation/BaseService.swift rename to Zatch/Data/Foundation/BaseService.swift index 5e43deec..0692a675 100644 --- a/Zatch/Data/Repository/Foundation/BaseService.swift +++ b/Zatch/Data/Foundation/BaseService.swift @@ -12,7 +12,26 @@ class BaseService: MoyaProvider { var request: Cancellable? - func requestDecoded(_ target: T, animate: Bool, completion: @escaping ((NetworkResult) -> Void)) { + func requestDecoded(_ target: T, + completion: @escaping (Result) -> Void){ + addObserver() + request(MultiTarget(target)) { result in + switch result { + case .success(let response): + do { + let body = try JSONDecoder().decode(L.self, from: response.data) + completion(.success(body)) + } catch let error { + completion(.failure(error)) + } + case .failure(let error): + completion(.failure(error)) + } + } + } + + + func requestDecoded(_ target: T, animate: Bool = true, completion: @escaping ((NetworkResult) -> Void)) { addObserver() if(animate){ // LoadingView.show() @@ -46,7 +65,7 @@ class BaseService: MoyaProvider { } func requestNoResultAPI(_ target: T, - animate: Bool, + animate: Bool = true, completion: @escaping (NetworkResult) -> Void) { addObserver() if(animate){ diff --git a/Zatch/Data/Repository/Foundation/HTTPMethodURL.swift b/Zatch/Data/Foundation/HTTPMethodURL.swift similarity index 50% rename from Zatch/Data/Repository/Foundation/HTTPMethodURL.swift rename to Zatch/Data/Foundation/HTTPMethodURL.swift index 2524023a..d574de8c 100644 --- a/Zatch/Data/Repository/Foundation/HTTPMethodURL.swift +++ b/Zatch/Data/Foundation/HTTPMethodURL.swift @@ -10,8 +10,13 @@ import Foundation enum HTTPMethodURL { static let user = "/users" + static let kakaoLocal = "/v2/local" struct GET { + //KAKAO LOCAL + static let placeSearch = kakaoLocal + "/search/keyword.json" + static let townLocation = kakaoLocal + "/geo/coord2regioncode.json" + static let meetingLocation = kakaoLocal + "/geo/coord2address.json" } struct POST { diff --git a/Zatch/Data/Repository/Foundation/MoyaLoggerPlugin.swift b/Zatch/Data/Foundation/MoyaLoggerPlugin.swift similarity index 100% rename from Zatch/Data/Repository/Foundation/MoyaLoggerPlugin.swift rename to Zatch/Data/Foundation/MoyaLoggerPlugin.swift diff --git a/Zatch/Data/Repository/Foundation/NetworkResult.swift b/Zatch/Data/Foundation/NetworkResult.swift similarity index 100% rename from Zatch/Data/Repository/Foundation/NetworkResult.swift rename to Zatch/Data/Foundation/NetworkResult.swift diff --git a/Zatch/Data/Models/ChattingModels/KakaoLocalMeetingModel.swift b/Zatch/Data/Models/ChattingModels/KakaoLocalMeetingModel.swift deleted file mode 100644 index 1a04eb6f..00000000 --- a/Zatch/Data/Models/ChattingModels/KakaoLocalMeetingModel.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// KakaoLocalMeetingModel.swift -// Zatch -// -// Created by 박지윤 on 2022/09/18. -// - -import Foundation - -struct KakaoLocalMeetingModel: Decodable{ - let documents: [LocalMeetingResult] -} - -struct LocalMeetingResult: Decodable{ - let road_address: MeetingRoadAddressResult -} - -struct MeetingRoadAddressResult: Decodable{ - let address_name: String - let building_name: String -} diff --git a/Zatch/Data/Models/ChattingModels/MeetingLoactionResponseModel.swift b/Zatch/Data/Models/ChattingModels/MeetingLoactionResponseModel.swift new file mode 100644 index 00000000..d3615660 --- /dev/null +++ b/Zatch/Data/Models/ChattingModels/MeetingLoactionResponseModel.swift @@ -0,0 +1,21 @@ +// +// MeetingLoactionResponseModel.swift +// Zatch +// +// Created by 박지윤 on 2022/09/18. +// + +import Foundation + +struct MeetingLoactionResponseModel: Decodable{ + let documents: [MeetingLocationModel] +} + +struct MeetingLocationModel: Decodable{ + let road_address: RoadAddressModel +} + +struct RoadAddressModel: Decodable{ + let address_name: String + let building_name: String +} diff --git a/Zatch/Data/Models/TownModels/KakaoLocationAddressModel.swift b/Zatch/Data/Models/Map/GetTownResponseModel.swift similarity index 58% rename from Zatch/Data/Models/TownModels/KakaoLocationAddressModel.swift rename to Zatch/Data/Models/Map/GetTownResponseModel.swift index 6617dae6..1fe5debc 100644 --- a/Zatch/Data/Models/TownModels/KakaoLocationAddressModel.swift +++ b/Zatch/Data/Models/Map/GetTownResponseModel.swift @@ -1,5 +1,5 @@ // -// KakaoLocationAddressModel.swift +// GetTownResponseModel.swift // Zatch // // Created by 박지윤 on 2022/09/14. @@ -7,11 +7,11 @@ import Foundation -struct KakaoLocationAddressModel: Decodable{ - let documents:[KakaoLocationAddressResult] +struct GetTownResponseModel: Decodable{ + let documents:[TownResponeModel] } -struct KakaoLocationAddressResult: Decodable{ +struct TownResponeModel: Decodable{ let region_type: String let address_name: String let region_1depth_name: String diff --git a/Zatch/Data/Models/ChattingModels/KakaoLocalTownModel.swift b/Zatch/Data/Models/Map/PlaceSearchRepsonseModel.swift similarity index 57% rename from Zatch/Data/Models/ChattingModels/KakaoLocalTownModel.swift rename to Zatch/Data/Models/Map/PlaceSearchRepsonseModel.swift index 41cc3da4..9978a06e 100644 --- a/Zatch/Data/Models/ChattingModels/KakaoLocalTownModel.swift +++ b/Zatch/Data/Models/Map/PlaceSearchRepsonseModel.swift @@ -1,5 +1,5 @@ // -// KakaoLocalModel.swift +// PlaceSearchRepsonseModel.swift // Zatch // // Created by 박지윤 on 2022/09/10. @@ -7,11 +7,11 @@ import Foundation -struct KakaoLocalTownModel: Decodable{ - let documents: [LocalTownResult]? +struct PlaceSearchRepsonseModel: Decodable{ + let documents: [PlaceSearchModel]? } -struct LocalTownResult: Decodable{ +struct PlaceSearchModel: Decodable{ let place_name: String let address_name: String let road_address_name: String diff --git a/Zatch/Data/MoyaService/Map/MapRouter.swift b/Zatch/Data/MoyaService/Map/MapRouter.swift new file mode 100644 index 00000000..5ddc8f43 --- /dev/null +++ b/Zatch/Data/MoyaService/Map/MapRouter.swift @@ -0,0 +1,60 @@ +// +// MapRouter.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation +import Moya + +enum MapRouter: BaseRouter{ + case placeSearch(query: PlaceSearchRequestValue) + case getTownLocation(coordinate: LocationCoordinateRequestValue) + case getMeetingLocation +} + +extension MapRouter{ + + var baseURL: URL { + return URL(string: "https://dapi.kakao.com")! + } + + var headers: [String: String]? { + let header = [ + "Authorization": "KakaoAK \(Const.KakaoAPI.KAKAO_REST_API_KEY)"] + return header + } + + var path: String { + switch self { + case .placeSearch: + return HTTPMethodURL.GET.placeSearch + case .getTownLocation: + return HTTPMethodURL.GET.townLocation + case .getMeetingLocation: + return HTTPMethodURL.GET.meetingLocation + } + } + + var method: Moya.Method { + switch self { + default: return .get + } + } + + var task: Task { + switch self { + case .placeSearch(let request): + return .requestParameters(parameters: ["query" : request.place], + encoding: URLEncoding.queryString) + case .getTownLocation(let request): + return .requestParameters(parameters: ["x": request.x, + "y": request.y], + encoding: URLEncoding.queryString) + default: return .requestPlain + } + } +} + + diff --git a/Zatch/Data/MoyaService/Map/MapService.swift b/Zatch/Data/MoyaService/Map/MapService.swift new file mode 100644 index 00000000..5d7f4fd6 --- /dev/null +++ b/Zatch/Data/MoyaService/Map/MapService.swift @@ -0,0 +1,34 @@ +// +// MapService.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation + +public class MapService { + + static let shared = MapService() + let provider = BaseService(plugins: [MoyaLoggerPlugin()]) + + private init() { } + + func getPlaceSearchResult(place: PlaceSearchRequestValue, completion: @escaping (Result) -> Void){ + provider.requestDecoded(MapRouter.placeSearch(query: place)){ response in + completion(response) + } + } + + func getTownLoacation(coordinate: LocationCoordinateRequestValue, completion: @escaping (Result) -> Void){ + provider.requestDecoded(MapRouter.getTownLocation(coordinate: coordinate)){ response in + completion(response) + } + } + + func getMeetingLocation(completion: @escaping (Result) -> Void){ + provider.requestDecoded(MapRouter.getMeetingLocation){ response in + completion(response) + } + } +} diff --git a/Zatch/Data/Repository/KakaoDataManager/KakaoLocalDataManager.swift b/Zatch/Data/Repository/KakaoDataManager/KakaoLocalDataManager.swift index 75a8ad23..3e614fb5 100644 --- a/Zatch/Data/Repository/KakaoDataManager/KakaoLocalDataManager.swift +++ b/Zatch/Data/Repository/KakaoDataManager/KakaoLocalDataManager.swift @@ -12,39 +12,28 @@ class KakaoLocalDataManager{ let headers : HTTPHeaders = [.authorization("KakaoAK \(Const.KakaoAPI.KAKAO_REST_API_KEY)")] - func getPlaceSearch(query: String, viewController: SearchAddressResultSheetViewController){ - - AF.request("https://dapi.kakao.com/v2/local/search/keyword.json", method: .get, parameters: ["query":query], encoding: URLEncoding.queryString, headers: self.headers).validate().responseDecodable(of: KakaoLocalTownModel.self) { response in - switch response.result { - case .success(let result): - viewController.successSearchAddressResult(result: result.documents ?? []) - case .failure(let error): - print(error.localizedDescription) - } - } - } - - func getsTownLocation(x: String, y: String, viewController: MapTownViewController){ - - AF.request("https://dapi.kakao.com/v2/local/geo/coord2regioncode.json", method: .get, parameters: ["x": x, "y": y], encoding: URLEncoding.queryString, headers: self.headers).validate().responseDecodable(of: KakaoLocationAddressModel.self) { response in - switch response.result { - case .success(let result): - viewController.successGetLocationAddress(result: result) - case .failure(let error): - print(error.localizedDescription) - } - } - } - - func getsMeetingLocation(x: String, y: String, viewController: MapMeetingViewController){ - - AF.request("https://dapi.kakao.com/v2/local/geo/coord2address.json", method: .get, parameters: ["x": x, "y": y], encoding: URLEncoding.queryString, headers: self.headers).validate().responseDecodable(of: KakaoLocalMeetingModel.self) { response in - switch response.result { - case .success(let result): - viewController.successGetLocationAddress(result: result.documents[0].road_address) - case .failure(let error): - print(error.localizedDescription) - } - } - } +// func getPlaceSearch(query: String, viewController: SearchAddressResultSheetViewController){ +// +// AF.request("https://dapi.kakao.com/v2/local/search/keyword.json", method: .get, parameters: ["query":query], encoding: URLEncoding.queryString, headers: self.headers).validate().responseDecodable(of: PlaceSearchRepsonseModel.self) { response in +// switch response.result { +// case .success(let result): +// viewController.successSearchAddressResult(result: result.documents ?? []) +// case .failure(let error): +// print(error.localizedDescription) +// } +// } +// } +// +// +// func getsMeetingLocation(x: String, y: String, viewController: MapMeetingViewController){ +// +// AF.request("https://dapi.kakao.com/v2/local/geo/coord2address.json", method: .get, parameters: ["x": x, "y": y], encoding: URLEncoding.queryString, headers: self.headers).validate().responseDecodable(of: KakaoLocalMeetingModel.self) { response in +// switch response.result { +// case .success(let result): +// viewController.successGetLocationAddress(result: result.documents[0].road_address) +// case .failure(let error): +// print(error.localizedDescription) +// } +// } +// } } diff --git a/Zatch/Data/Repository/MapRepository.swift b/Zatch/Data/Repository/MapRepository.swift new file mode 100644 index 00000000..1103e361 --- /dev/null +++ b/Zatch/Data/Repository/MapRepository.swift @@ -0,0 +1,51 @@ +// +// MapRepository.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation +import RxSwift + +class MapRepository: MapRepositoryInterface{ + + func placeSearch(query: PlaceSearchRequestValue) { + + } + + func getTownLocation(coordinate: LocationCoordinateRequestValue) -> Observable { + let observable = Observable.create { observer -> Disposable in + let requestReference: () = MapService.shared.getTownLoacation(coordinate: coordinate){ response in + switch response { + case .success(let data): + observer.onNext(data) + case .failure(let err): + print(err) + } + } + return Disposables.create(with: { requestReference }) + } + return observable + } + + func getMeetingLocation(coordinate: LocationCoordinateRequestValue) +// -> Observable + { +// let observable = Observable.create { observer -> Disposable in +// let requestReference: () = MapService.shared.getMeetingLocation(coordinate: coordinate){ response in +// switch response { +// case .success(let data): +//// if let data = data { +// observer.onNext(data) +//// } +// case .failure(let err): +// print(err) +// } +// } +// return Disposables.create(with: { requestReference }) +// } +// return observable + + } +} diff --git a/Zatch/Domain/RepositoryInterface/MapRepositoryInterface.swift b/Zatch/Domain/RepositoryInterface/MapRepositoryInterface.swift new file mode 100644 index 00000000..6abed020 --- /dev/null +++ b/Zatch/Domain/RepositoryInterface/MapRepositoryInterface.swift @@ -0,0 +1,16 @@ +// +// MapRepositoryInterface.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation +import RxSwift + +protocol MapRepositoryInterface{ + func placeSearch(query: PlaceSearchRequestValue) + func getTownLocation(coordinate: LocationCoordinateRequestValue) -> Observable + func getMeetingLocation(coordinate: LocationCoordinateRequestValue) +// -> Observable +} diff --git a/Zatch/Domain/UseCase/Map/GetMeetingLocationUseCase.swift b/Zatch/Domain/UseCase/Map/GetMeetingLocationUseCase.swift new file mode 100644 index 00000000..00c8f3a7 --- /dev/null +++ b/Zatch/Domain/UseCase/Map/GetMeetingLocationUseCase.swift @@ -0,0 +1,29 @@ +// +// GetMeetingLocationUseCase.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation +import RxSwift + +protocol GetMeetingLocationInterface { + func execute(requestValue: LocationCoordinateRequestValue) +// -> Observable +} + +final class GetMeetingLocationUseCase: GetMeetingLocationInterface { + + private let mapRepository: MapRepositoryInterface + + init(mapRepository: MapRepositoryInterface = MapRepository()) { + self.mapRepository = mapRepository + } + + func execute(requestValue: LocationCoordinateRequestValue) +// -> Observable + { +// return mapRepository.getMeetingLocation(coordinate: requestValue) + } +} diff --git a/Zatch/Domain/UseCase/Map/GetTownLocationUseCase.swift b/Zatch/Domain/UseCase/Map/GetTownLocationUseCase.swift new file mode 100644 index 00000000..aa6b0ae1 --- /dev/null +++ b/Zatch/Domain/UseCase/Map/GetTownLocationUseCase.swift @@ -0,0 +1,26 @@ +// +// GetTownLocationUseCase.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation +import RxSwift + +protocol GetTownLocationUseCaseInterface { + func execute(requestValue: LocationCoordinateRequestValue) -> Observable +} + +final class GetTownLocationUseCase: GetTownLocationUseCaseInterface { + + private let mapRepository: MapRepositoryInterface + + init(mapRepository: MapRepositoryInterface = MapRepository()) { + self.mapRepository = mapRepository + } + + func execute(requestValue: LocationCoordinateRequestValue) -> Observable { + return mapRepository.getTownLocation(coordinate: requestValue) + } +} diff --git a/Zatch/Domain/UseCase/Map/LocationCoordinateRequestValue.swift b/Zatch/Domain/UseCase/Map/LocationCoordinateRequestValue.swift new file mode 100644 index 00000000..328b57a4 --- /dev/null +++ b/Zatch/Domain/UseCase/Map/LocationCoordinateRequestValue.swift @@ -0,0 +1,13 @@ +// +// LocationCoordinateRequestValue.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation + +struct LocationCoordinateRequestValue { + let x: String + let y: String +} diff --git a/Zatch/Domain/UseCase/Map/PlaceSearchUseCase.swift b/Zatch/Domain/UseCase/Map/PlaceSearchUseCase.swift new file mode 100644 index 00000000..03b29e90 --- /dev/null +++ b/Zatch/Domain/UseCase/Map/PlaceSearchUseCase.swift @@ -0,0 +1,29 @@ +// +// PlaceSearchUseCase.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation + +struct PlaceSearchRequestValue { + let place: String +} + +protocol PlaceSearchUseCaseInterface { + func execute(requestValue: PlaceSearchRequestValue) async throws +} + +final class PlaceSearchUseCase: PlaceSearchUseCaseInterface { + + private let mapRepository: MapRepositoryInterface + + init(mapRepository: MapRepositoryInterface = MapRepository()) { + self.mapRepository = mapRepository + } + + func execute(requestValue: PlaceSearchRequestValue) async throws { + return try await mapRepository.placeSearch(query: requestValue) + } +} diff --git a/Zatch/Global/Source/Alert/AlertViewController.swift b/Zatch/Global/Source/Alert/AlertViewController.swift index f9c0b94c..46429f8e 100644 --- a/Zatch/Global/Source/Alert/AlertViewController.swift +++ b/Zatch/Global/Source/Alert/AlertViewController.swift @@ -128,6 +128,7 @@ class AlertViewController: UIViewController { } } + @discardableResult func show(in viewController: UIViewController) -> Self{ self.modalPresentationStyle = .overFullScreen viewController.present(self, animated: false, completion: nil) diff --git a/Zatch/Global/Source/Alert/Message/InfoAlertViewController.swift b/Zatch/Global/Source/Alert/Message/InfoAlertViewController.swift index df3fa8af..006af5db 100644 --- a/Zatch/Global/Source/Alert/Message/InfoAlertViewController.swift +++ b/Zatch/Global/Source/Alert/Message/InfoAlertViewController.swift @@ -28,6 +28,7 @@ class InfoAlertViewController: MessageAlertViewController { } btnStackView.snp.remakeConstraints{ make in + make.top.equalTo(messageLabel.snp.bottom).offset(12) make.trailing.equalToSuperview().offset(-30) make.bottom.equalToSuperview().offset(-10) } diff --git a/Zatch/Presentation/Utils/Map/KakaoMapViewController.swift b/Zatch/Presentation/Utils/Map/KakaoMapViewController.swift index 3546d555..92b83acd 100644 --- a/Zatch/Presentation/Utils/Map/KakaoMapViewController.swift +++ b/Zatch/Presentation/Utils/Map/KakaoMapViewController.swift @@ -23,58 +23,58 @@ class KakaoMapViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.isNavigationBarHidden = true +// self.navigationController?.isNavigationBarHidden = true - setUpView() +// setUpView() //TODO: - Authorization Status에 따라 권한 요청 진행하기 (CLAuthorizationStatus) - locationManager = CLLocationManager() - locationManager.delegate = self - - switch (locationManager.authorizationStatus){ - - case .authorizedAlways, .authorizedWhenInUse: - print("이미 허용됨?") - //따로 안내할 내용 없으니까 건너뛰어도 될 듯 - locationManager.startUpdatingLocation() - settingAuthorizedState() - break - case .notDetermined: - print("아직 결정안됨?") - locationManager.requestWhenInUseAuthorization() - break - default: - print("이외?") - } +// locationManager = CLLocationManager() +// locationManager.delegate = self +// +// switch (locationManager.authorizationStatus){ +// +// case .authorizedAlways, .authorizedWhenInUse: +// print("이미 허용됨?") +// //따로 안내할 내용 없으니까 건너뛰어도 될 듯 +// locationManager.startUpdatingLocation() +// settingAuthorizedState() +// break +// case .notDetermined: +// print("아직 결정안됨?") +// locationManager.requestWhenInUseAuthorization() +// break +// default: +// print("이외?") +// } } - override func viewDidAppear(_ animated: Bool) { - - super.viewDidAppear(true) - - if(locationManager.authorizationStatus == .restricted || locationManager.authorizationStatus == .denied ){ - - let alert = Alert.LocationAuthority.generateAlert().show(in: self) - alert.completion = { - self.navigationController?.popViewController(animated: true) - } - } - } +// override func viewDidAppear(_ animated: Bool) { +// +// super.viewDidAppear(true) +// +// if(locationManager.authorizationStatus == .restricted || locationManager.authorizationStatus == .denied ){ +// +// let alert = Alert.LocationAuthority.generateAlert().show(in: self) +// alert.completion = { +// self.navigationController?.popViewController(animated: true) +// } +// } +// } - func setUpView(){ - self.view.addSubview(mainView) - - mainView.snp.makeConstraints{ - $0.top.bottom.leading.trailing.equalToSuperview() - } - - mainView.mapView.delegate = self - mainView.mapView.currentLocationTrackingMode = .onWithoutHeading // 현 위치 트래킹 모드 on - mainView.mapView.setZoomLevel(0, animated: true) +// func setUpView(){ +// self.view.addSubview(mainView) +// +// mainView.snp.makeConstraints{ +// $0.top.bottom.leading.trailing.equalToSuperview() +// } +// +// mainView.mapView.delegate = self +// mainView.mapView.currentLocationTrackingMode = .onWithoutHeading // 현 위치 트래킹 모드 on +// mainView.mapView.setZoomLevel(0, animated: true) - } +// } @objc func backBtnDidClicked(){ self.navigationController?.popViewController(animated: true) diff --git a/Zatch/Presentation/Utils/Map/Map.swift b/Zatch/Presentation/Utils/Map/Map.swift new file mode 100644 index 00000000..202c8bce --- /dev/null +++ b/Zatch/Presentation/Utils/Map/Map.swift @@ -0,0 +1,13 @@ +// +// Map.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation + +protocol Map{ + func willMovePreviousViewController() + func showAlertAboutLocation(location: String) +} diff --git a/Zatch/Presentation/Utils/Map/MapViewController.swift b/Zatch/Presentation/Utils/Map/MapViewController.swift new file mode 100644 index 00000000..fa449f61 --- /dev/null +++ b/Zatch/Presentation/Utils/Map/MapViewController.swift @@ -0,0 +1,119 @@ +// +// MapViewController.swift +// Zatch +// +// Created by 박소윤 on 2023/03/26. +// + +import Foundation +import CoreLocation +import RxSwift + +class MapViewController: UIViewController{ + + class CustomMapMarker: MTMapPOIItem{ + override init(){ + super.init() + style() + } + + private func style(){ + showAnimationType = .springFromGround + markerType = .customImage + customImage = Image.mapMarker + } + } + + var locationMarker = CustomMapMarker() + var locationManager = CLLocationManager() + let mainView: KakaoMapView + let viewModel: MapLocationSelectable + let disposeBag = DisposeBag() + + init(mapService: KakaoMapView.ServiceType, viewModel: MapLocationSelectable){ + mainView = KakaoMapView(type: mapService) + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func viewDidLoad() { + super.viewDidLoad() + style() + layout() + initialize() + bind() + } + + override func viewDidAppear(_ animated: Bool) { + + super.viewDidAppear(animated) + + if(locationManager.authorizationStatus == .restricted || locationManager.authorizationStatus == .denied ){ + willShowRestrictedServiceAlert() + } + } + + private func style(){ + navigationController?.isNavigationBarHidden = true + } + + private func layout(){ + view.addSubview(mainView) + mainView.snp.makeConstraints{ + $0.top.bottom.leading.trailing.equalToSuperview() + } + } + + func initialize(){ +// locationManager.delegate = self + checkLocationAuthorizationStatus() + + mainView.mapView.delegate = self + mainView.mapView.currentLocationTrackingMode = .onWithoutHeading // 현 위치 트래킹 모드 on + mainView.mapView.setZoomLevel(0, animated: true) + } + + func bind(){ + + } + + private func checkLocationAuthorizationStatus(){ + switch (locationManager.authorizationStatus){ + case .authorizedAlways, .authorizedWhenInUse: + print("이미 허용됨?") + //따로 안내할 내용 없으니까 건너뛰어도 될 듯 + locationManager.startUpdatingLocation() + break + case .notDetermined: + print("아직 결정안됨?") + locationManager.requestWhenInUseAuthorization() + break + default: + print("이외?") + } + } + + private func willShowRestrictedServiceAlert(){ + Alert.LocationAuthority.generateAlert().show(in: self).then{ + $0.completion = { [weak self] in + self?.navigationController?.popViewController(animated: true) + } + } + } + +} + +extension MapViewController: MTMapViewDelegate{ + func mapView(_ mapView: MTMapView!, singleTapOn mapPoint: MTMapPoint!) { + //map marker 지도에 한 개만 표시되도록 기존 마커 제거 후 새로 추가 + locationMarker.mapPoint = mapPoint + mapView.remove(locationMarker) + mapView.addPOIItems([locationMarker]) + viewModel.changeLocationMarker(x: mapPoint.mapPointGeo().longitude, + y: mapPoint.mapPointGeo().latitude) + } +} diff --git a/Zatch/Presentation/ViewControllers/Chatting/Appointment/MapMeetingViewController.swift b/Zatch/Presentation/ViewControllers/Chatting/Appointment/MapMeetingViewController.swift index b50efaef..afeaa2dd 100644 --- a/Zatch/Presentation/ViewControllers/Chatting/Appointment/MapMeetingViewController.swift +++ b/Zatch/Presentation/ViewControllers/Chatting/Appointment/MapMeetingViewController.swift @@ -7,6 +7,7 @@ import UIKit +//TODO: WILL DELETE class MapMeetingViewController: KakaoMapViewController{ //MARK: - Properties @@ -27,9 +28,9 @@ class MapMeetingViewController: KakaoMapViewController{ return } - KakaoLocalDataManager().getsMeetingLocation(x: String( mapPoint.mapPointGeo().longitude), - y: String(mapPoint.mapPointGeo().latitude), - viewController: self) +// KakaoLocalDataManager().getsMeetingLocation(x: String( mapPoint.mapPointGeo().longitude), +// y: String(mapPoint.mapPointGeo().latitude), +// viewController: self) } override func backBtnDidClicked() { @@ -38,37 +39,37 @@ class MapMeetingViewController: KakaoMapViewController{ //MARK: - API - func successGetLocationAddress(result: MeetingRoadAddressResult){ - - let alert = MeetingMapAlertViewController() - - let locationString: String! - let labelString: String! - - if(result.building_name != ""){ - locationString = "'\(result.building_name)'" - labelString = result.building_name - }else{ - locationString = "\n'\(result.address_name)'" - labelString = result.address_name - } - - alert.addressName = locationString - - alert.completion = { - print("ok 눌림") - - let popViewController = self.navigation.viewControllers[0] as! MakeMeetingSheetViewController - print(self.navigation?.viewControllers) - - self.dismiss(animated: false, completion: { - self.navigation.popToViewController(viewController: popViewController, completion:{ - popViewController.mainView.locationLabel.text = labelString - }) - }) - } - alert.modalPresentationStyle = .overFullScreen - - self.present(alert, animated: false, completion: nil) - } +// func successGetLocationAddress(result: MeetingRoadAddressResult){ +// +// let alert = MeetingMapAlertViewController() +// +// let locationString: String! +// let labelString: String! +// +// if(result.building_name != ""){ +// locationString = "'\(result.building_name)'" +// labelString = result.building_name +// }else{ +// locationString = "\n'\(result.address_name)'" +// labelString = result.address_name +// } +// +// alert.addressName = locationString +// +// alert.completion = { +// print("ok 눌림") +// +// let popViewController = self.navigation.viewControllers[0] as! MakeMeetingSheetViewController +// print(self.navigation?.viewControllers) +// +// self.dismiss(animated: false, completion: { +// self.navigation.popToViewController(viewController: popViewController, completion:{ +// popViewController.mainView.locationLabel.text = labelString +// }) +// }) +// } +// alert.modalPresentationStyle = .overFullScreen +// +// self.present(alert, animated: false, completion: nil) +// } } diff --git a/Zatch/Presentation/ViewControllers/Chatting/Appointment/MeetingLocationRegisterMapViewController.swift b/Zatch/Presentation/ViewControllers/Chatting/Appointment/MeetingLocationRegisterMapViewController.swift new file mode 100644 index 00000000..b64c6d13 --- /dev/null +++ b/Zatch/Presentation/ViewControllers/Chatting/Appointment/MeetingLocationRegisterMapViewController.swift @@ -0,0 +1,27 @@ +// +// MeetingLocationRegisterMapViewController.swift +// Zatch +// +// Created by 박소윤 on 2023/03/27. +// + +import Foundation + +class MeetingLocationRegisterMapViewController: MapViewController, Map{ + + init(){ + super.init(mapService: .meeting, viewModel: TownRegisterMapViewModel()) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func willMovePreviousViewController() { + + } + + func showAlertAboutLocation(location: String) { + + } +} diff --git a/Zatch/Presentation/ViewControllers/Chatting/Appointment/SearchAddressResultBottomSheet.swift b/Zatch/Presentation/ViewControllers/Chatting/Appointment/SearchAddressResultBottomSheet.swift index 34202270..ae7c5d35 100644 --- a/Zatch/Presentation/ViewControllers/Chatting/Appointment/SearchAddressResultBottomSheet.swift +++ b/Zatch/Presentation/ViewControllers/Chatting/Appointment/SearchAddressResultBottomSheet.swift @@ -8,14 +8,16 @@ import UIKit import Alamofire +//TODO: WILL DELETE class SearchAddressResultSheetViewController: BaseBottomSheetViewController { //MARK: - Properties - var addressResult: [LocalTownResult] = []{ - didSet{ - self.mainView.tableView.reloadData() - } - } + var addressResult = [String]() +// var addressResult: [LocalTownResult] = []{ +// didSet{ +// self.mainView.tableView.reloadData() +// } +// } let mainView = SearchAddressResultView() @@ -54,12 +56,12 @@ class SearchAddressResultSheetViewController: BaseBottomSheetViewController() + private let currentLocationSubject = PublishSubject() + private var townLocation: Coordinate! + private var townResponseValue: Driver! + private var currentLocation: String! + + + private let getTownLocationUseCase: GetTownLocationUseCaseInterface + + init(getTownLocationUseCase: GetTownLocationUseCaseInterface = GetTownLocationUseCase()){ + self.getTownLocationUseCase = getTownLocationUseCase + } + + struct Input{ + let locationManager: CLLocationManager + let registerButtonControlEvent: ControlEvent + } + + struct Output{ + let selectTown: Driver + let isValidLocation: Observable + } + + func transform(_ input: Input) -> Output{ + + input.registerButtonControlEvent + .subscribe(onNext: { [weak self] in + if let townLocation = self?.townLocation, let location = input.locationManager.location?.coordinate{ + self?.townLocationSubject.onNext(townLocation) + self?.currentLocationSubject.onNext((x: location.longitude, y:location.latitude)) + } + }).disposed(by: disposeBag) + + let currentLocationResponeValue = currentLocationSubject + .map{ + LocationCoordinateRequestValue(x: String(abs($0.x)), y: String(abs($0.y))) + }.flatMap{ + self.getTownLocationUseCase.execute(requestValue: $0) + }.map{ + $0.documents[1].region_3depth_name + }.share() + + let selectTownResponseValue = townLocationSubject + .map{ + LocationCoordinateRequestValue(x: String($0.x), y: String($0.y)) + }.flatMap{ + self.getTownLocationUseCase.execute(requestValue: $0) + }.map{ + $0.documents[1].region_3depth_name + }.share() + + var isValid = Observable.zip(currentLocationResponeValue, selectTownResponseValue) + .map{ + $0.0 == $0.1 + } + + let town = Observable.zip(isValid, selectTownResponseValue) + .filter{ + $0.0 + }.map{ + $0.1 + }.asDriver(onErrorJustReturn: "") + + isValid = isValid + .filter{ + !$0 + }.asObservable() + + return Output(selectTown: town, + isValidLocation: isValid) + } + +} + +extension TownRegisterMapViewModel: MapLocationSelectable{ + func changeLocationMarker(x: Double, y: Double) { + townLocation = (x: x, y: y) + } +}