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

[Feat] #98 - 햄버거바 플로우 연결 및 제보하기 구현 #108

Merged
merged 8 commits into from
Jul 16, 2022
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
16 changes: 14 additions & 2 deletions HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
3BCC441E28745FD800661A12 /* SocialLoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BCC441D28745FD800661A12 /* SocialLoginVC.swift */; };
3BCC442028745FE500661A12 /* SocialLogin.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3BCC441F28745FE500661A12 /* SocialLogin.storyboard */; };
3BDE7F292882054200EE7F47 /* ReviewEmptyViewCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BDE7F282882054200EE7F47 /* ReviewEmptyViewCVC.swift */; };
4AEA5A7C121189B57DD6CE75 /* Pods_HealthFoodMe.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C321ED365502C47A4E65A10E /* Pods_HealthFoodMe.framework */; };
4F66D470143F608082F91FC7 /* Pods_HealthFoodMe.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 460E90FE1B4033E15246265B /* Pods_HealthFoodMe.framework */; };
69028BA62874673600373984 /* MenuCellCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69028BA52874673600373984 /* MenuCellCVC.swift */; };
69028BA82874675800373984 /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69028BA72874675800373984 /* MenuView.swift */; };
69028BAA287467F100373984 /* MenuDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69028BA9287467F100373984 /* MenuDetailView.swift */; };
Expand Down Expand Up @@ -73,7 +75,6 @@
A9E593C72874266200B0F8B5 /* SearchRecent.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E593C62874266200B0F8B5 /* SearchRecent.swift */; };
A9E593CF2876C26900B0F8B5 /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9E593CE2876C26900B0F8B5 /* Color.xcassets */; };
A9E593D1287818E900B0F8B5 /* SearchTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9E593D0287818E900B0F8B5 /* SearchTVC.swift */; };
B14648DE3F9E597D210E4A5D /* Pods_HealthFoodMe.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 460E90FE1B4033E15246265B /* Pods_HealthFoodMe.framework */; };
EB033E84287B5BE300C48FB9 /* StarRatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB033E83287B5BE300C48FB9 /* StarRatingView.swift */; };
EB6A44C7287366DF00749582 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = EB6A44C6287366DF00749582 /* .swiftlint.yml */; };
EB6A44D128737CC400749582 /* MainDetailUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB6A44CB28737CC400749582 /* MainDetailUseCase.swift */; };
Expand Down Expand Up @@ -262,6 +263,7 @@
A9E593C62874266200B0F8B5 /* SearchRecent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchRecent.swift; sourceTree = "<group>"; };
A9E593CE2876C26900B0F8B5 /* Color.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Color.xcassets; sourceTree = "<group>"; };
A9E593D0287818E900B0F8B5 /* SearchTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTVC.swift; sourceTree = "<group>"; };
C321ED365502C47A4E65A10E /* Pods_HealthFoodMe.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HealthFoodMe.framework; sourceTree = BUILT_PRODUCTS_DIR; };
EB033E83287B5BE300C48FB9 /* StarRatingView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = StarRatingView.swift; sourceTree = "<group>"; tabWidth = 4; };
EB085ED628716E1900361837 /* HealthFoodMe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HealthFoodMe.app; sourceTree = BUILT_PRODUCTS_DIR; };
EB085EE728716E1B00361837 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -388,7 +390,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B14648DE3F9E597D210E4A5D /* Pods_HealthFoodMe.framework in Frameworks */,
4AEA5A7C121189B57DD6CE75 /* Pods_HealthFoodMe.framework in Frameworks */,
4F66D470143F608082F91FC7 /* Pods_HealthFoodMe.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -672,6 +675,14 @@
path = Views;
sourceTree = "<group>";
};
A90CFDA5288328C90018AB94 /* Recovered References */ = {
isa = PBXGroup;
children = (
C321ED365502C47A4E65A10E /* Pods_HealthFoodMe.framework */,
);
name = "Recovered References";
sourceTree = "<group>";
};
A9325272287D24CD001EDF50 /* Search */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -847,6 +858,7 @@
EB085ED728716E1900361837 /* Products */,
E3F60CBC9B890A7FB4D4AAAF /* Pods */,
4B325ED2B321D62B4089A483 /* Frameworks */,
A90CFDA5288328C90018AB94 /* Recovered References */,
);
indentWidth = 4;
sourceTree = "<group>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}

guard let windowScene = (scene as? UIWindowScene) else { return }
let rootViewController = ModuleFactory.resolve().makeSplashVC()
let rootViewController = ModuleFactory.resolve().makeMainMapVC()
let navigation = UINavigationController(rootViewController: rootViewController)
let window = UIWindow(windowScene: windowScene)
window.rootViewController = navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ struct I18N {
static let scrapList = "스크랩한 식당"
static let buttonTitles = ["스크랩한 식당", "내가 쓴 리뷰", "가게 제보하기",
"수정사항 제보하기"]

static let reportStoreTitle = "가게 제보하기"
static let reportStoreContent = "제보할 가게를 적어주세요."
static let reportEditTitle = "수정 사항 제보"
static let reportEditContent = "몬의할 내용을 입력해주세요."
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@
import UIKit

import SnapKit
import MessageUI

enum HamburgerType {
case editName
case scrap
case myReview
case setting
}

protocol HamburgerbarVCDelegate: AnyObject {
func HamburgerbarVCDidTap(hamburgerType: HamburgerType)
}

class HamburgerBarVC: UIViewController {

// MARK: - Properties

weak var delegate: HamburgerbarVCDelegate?
var hambergurBarViewTranslation = CGPoint(x: 0, y: 0)
var hambergurBarViewVelocity = CGPoint(x: 0, y: 0)
var name: String? = "배부른 현우는 행복해요"
Expand Down Expand Up @@ -100,6 +113,7 @@ class HamburgerBarVC: UIViewController {
setUI()
setLayout()
addHamburgerBarGesture()
addButtonAction()
}

override func viewDidAppear(_ animated: Bool) {
Expand Down Expand Up @@ -247,6 +261,44 @@ extension HamburgerBarVC {
self.hamburgerBarView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(moveHamburgerBarWithGesture(_:))))
}

private func addButtonAction() {
editNameButton.press {
self.dismiss(animated: false)
self.delegate?.HamburgerbarVCDidTap(hamburgerType: .editName)
}

menuButtons[0].press {
self.dismiss(animated: false)
self.delegate?.HamburgerbarVCDidTap(hamburgerType: .scrap)
}

menuButtons[1].press {
self.dismiss(animated: false)
self.delegate?.HamburgerbarVCDidTap(hamburgerType: .myReview)
}

menuButtons[2].press {
self.presentReportMail(title: I18N.Map.HamburgerBar.reportStoreTitle, content: I18N.Map.HamburgerBar.reportStoreContent)
}

menuButtons[3].press {
self.presentReportMail(title: I18N.Map.HamburgerBar.reportEditTitle, content: I18N.Map.HamburgerBar.reportEditContent)
}

settingButton.press {
self.dismiss(animated: false)
self.delegate?.HamburgerbarVCDidTap(hamburgerType: .setting)
}

logoutButton.press {
self.makeAlert(alertType: .logoutAlert,
title: I18N.HelfmeAlert.logout,
subtitle: I18N.HelfmeAlert.logoutContent) {
self.makeAlert(title: "", message: "로그아웃 성공 ~ ~ !")
}
}
}

// MARK: - @objc Methods

@objc func moveHamburgerBarWithGesture(_ sender: UIPanGestureRecognizer) {
Expand Down Expand Up @@ -285,3 +337,23 @@ extension HamburgerBarVC {
}
}
}

extension HamburgerBarVC: MFMailComposeViewControllerDelegate {
private func presentReportMail(title: String, content: String) {
let mailComposeVC = MFMailComposeViewController()
if MFMailComposeViewController.canSendMail() {
mailComposeVC.mailComposeDelegate = self
mailComposeVC.setToRecipients(["0inn1220@gmail.com"])
mailComposeVC.setSubject(title)
mailComposeVC.setMessageBody(content, isHTML: false)
self.present(mailComposeVC, animated: true, completion: nil)
} else {
makeAlert(title: "메세지 전송 실패", message: "아이폰 이메일 설정을 확인하고 다시 시도해주세요.")
}
}

func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
dismiss(animated: true, completion: nil)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MainMapVC: UIViewController, NMFLocationManagerDelegate {
self.makeVibrate()
let nextVC = ModuleFactory.resolve().makeHamburgerBarVC()
nextVC.modalPresentationStyle = .overFullScreen
nextVC.delegate = self
self.present(nextVC, animated: false)
}), for: .touchUpInside)
bt.backgroundColor = .helfmeWhite
Expand Down Expand Up @@ -467,3 +468,18 @@ extension MainMapVC: UICollectionViewDataSource {
return cell
}
}

extension MainMapVC: HamburgerbarVCDelegate {
func HamburgerbarVCDidTap(hamburgerType: HamburgerType) {
switch hamburgerType {
case .editName:
navigationController?.pushViewController(ModuleFactory.resolve().makeNicknameChangeVC(), animated: true)
case .scrap:
navigationController?.pushViewController(ModuleFactory.resolve().makeScrapVC(), animated: true)
case .myReview:
navigationController?.pushViewController(ModuleFactory.resolve().makeScrapVC(), animated: true)
case .setting:
navigationController?.pushViewController(ModuleFactory.resolve().makeScrapVC(), animated: true)
}
}
}