Skip to content

Commit

Permalink
🔀 Merge pull request #107 from teamCA-PIN/feature/#105
Browse files Browse the repository at this point in the history
Feature/#105
  • Loading branch information
hansolnoh95 authored Jul 21, 2021
2 parents 9dcc50b + 9a8da75 commit 74ac4f8
Show file tree
Hide file tree
Showing 21 changed files with 177 additions and 154 deletions.
4 changes: 4 additions & 0 deletions CA-PIN_IOS/CA-PIN_IOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
CCB6C668268F083A00941E92 /* PinPopupTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCB6C667268F083A00941E92 /* PinPopupTableViewCell.swift */; };
CCB6C66C268F41E800941E92 /* CreateCategoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCB6C66B268F41E800941E92 /* CreateCategoryViewController.swift */; };
CCB6C66E268F498B00941E92 /* CategoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCB6C66D268F498B00941E92 /* CategoryCollectionViewCell.swift */; };
CCE7B03C26A8377600F6D9D6 /* MapResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCE7B03B26A8377600F6D9D6 /* MapResponse.swift */; };
CCF78427268B0774005FDF1D /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = CCF78426268B0774005FDF1D /* Then */; };
CCF7842A268B0781005FDF1D /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = CCF78429268B0781005FDF1D /* SnapKit */; };
CCF7842D268B0797005FDF1D /* CGFloatLiteral in Frameworks */ = {isa = PBXBuildFile; productRef = CCF7842C268B0797005FDF1D /* CGFloatLiteral */; };
Expand Down Expand Up @@ -258,6 +259,7 @@
CCB6C667268F083A00941E92 /* PinPopupTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinPopupTableViewCell.swift; sourceTree = "<group>"; };
CCB6C66B268F41E800941E92 /* CreateCategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateCategoryViewController.swift; sourceTree = "<group>"; };
CCB6C66D268F498B00941E92 /* CategoryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryCollectionViewCell.swift; sourceTree = "<group>"; };
CCE7B03B26A8377600F6D9D6 /* MapResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapResponse.swift; sourceTree = "<group>"; };
CCF78442268B197A005FDF1D /* UITextField+.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UITextField+.swift"; sourceTree = "<group>"; };
CCF78444268B197A005FDF1D /* UILabel+.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+.swift"; sourceTree = "<group>"; };
CCF78449268B71CD005FDF1D /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -612,6 +614,7 @@
children = (
CC9C855226A051B3002A3321 /* MyMapListModel.swift */,
CC841FD426A09C1A00F7CE93 /* MapCoordinates.swift */,
CCE7B03B26A8377600F6D9D6 /* MapResponse.swift */,
);
path = Map;
sourceTree = "<group>";
Expand Down Expand Up @@ -1214,6 +1217,7 @@
CCA85B572688F29700C9A32C /* UITableView+.swift in Sources */,
CCA85B4A2688F1E700C9A32C /* CALayer+.swift in Sources */,
9253708F269D8F3800E2E5EA /* SignupModel.swift in Sources */,
CCE7B03C26A8377600F6D9D6 /* MapResponse.swift in Sources */,
925370792698F4DD00E2E5EA /* MyEmptyCategoryTableViewCell.swift in Sources */,
9292FFC82696352600BCD791 /* CategoryCafeListTableViewCell.swift in Sources */,
CC9C854D269EBFA1002A3321 /* MyInfoModel.swift in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions CA-PIN_IOS/CA-PIN_IOS/Configuration/KeyChainStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ enum KeychainStorage {
static var accessToken: String {
return "accessToken"
}
static var userCafeTI: String {
return "userCafeTI"
}
}
4 changes: 2 additions & 2 deletions CA-PIN_IOS/CA-PIN_IOS/Global/Extensions/UIButton+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ extension UIButton {
}

func addTextSpacing(spacing: CGFloat){
let attributedString = NSMutableAttributedString(string: (self.titleLabel?.text!)!)
attributedString.addAttribute(NSAttributedString.Key.kern, value: spacing, range: NSRange(location: 0, length: (self.titleLabel?.text!.count)!))
let attributedString = NSMutableAttributedString(string: (self.titleLabel?.text) ?? "")
attributedString.addAttribute(NSAttributedString.Key.kern, value: spacing, range: NSRange(location: 0, length: (self.titleLabel?.text?.count) ?? 0))
self.setAttributedTitle(attributedString, for: .normal)
}

Expand Down
27 changes: 27 additions & 0 deletions CA-PIN_IOS/CA-PIN_IOS/Global/Models/Map/MapResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// MapResponse.swift
// CA-PIN_IOS
//
// Created by 노한솔 on 2021/07/21.
//

import Foundation

struct MapListResponseArrayType<T: Codable>: Codable {
var status: Int?
var success: Bool?
var message: String?
var cafeLocations: [T]?
}

struct CafeDetailResponseType<T: Codable>: Codable {
var status: Int?
var success: Bool?
var message: String?
var cafeDetail: T?
}

struct MyMapListResponseType<T: Codable>: Codable {
var message: String?
var myMapLocations: [T]?
}
1 change: 1 addition & 0 deletions CA-PIN_IOS/CA-PIN_IOS/Network/Services/CafeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extension CafeService: TargetType {
switch self {
case .cafeDetail, .cafeMenu:
return .requestPlain
/// ?tags={tagIdx1}&tags={tagsIdx2}
case .cafeList(tags: let tags), .cafeListMymap(tags: let tags):
return .requestParameters(parameters: ["tags": tags], encoding: URLEncoding(destination: .queryString, arrayEncoding: .noBrackets))
}
Expand Down
11 changes: 10 additions & 1 deletion CA-PIN_IOS/CA-PIN_IOS/Network/Services/ReviewService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,20 @@ extension ReviewService: TargetType {
return .requestParameters(parameters: ["cafe": cafeId], encoding: URLEncoding(destination: .queryString, arrayEncoding: .noBrackets))

case .writeReview(_, recommend: let recommend, content: let content, rating: let rating, images: let images):
var multiPartFormData: [MultipartFormData] = []
var multiPartFormData: [MultipartFormData] = [] /// multipart form data 빈 배열 만들기
/// recommend 분기처리 -> dictionary 형태로
if recommend == [] {
let review = [
"content": content,
"rating": rating
] as [String: Any]
/// dictionary를 JSONData로 변환
let data = try! JSONSerialization.data(withJSONObject: review, options: .prettyPrinted)
/// JSONData를 JSONString으로 변환
let jsonString = String(data: data, encoding: .utf8)!
/// JSONString을 MultipartformData로 변환
let stringData = MultipartFormData(provider: .data(jsonString.data(using: String.Encoding.utf8)!), name: "review")
/// 최종으로 보낼 객체에 append
multiPartFormData.append(stringData)
}
else {
Expand All @@ -93,15 +98,19 @@ extension ReviewService: TargetType {
let stringData = MultipartFormData(provider: .data(jsonString.data(using: String.Encoding.utf8)!), name: "review")
multiPartFormData.append(stringData)
}
/// image 파일
if images != nil {
for image in images! {
/// UIImage를 jpegImageData로 변환
let imageData = image.jpegData(compressionQuality: 1.0)
/// jpegData를 MultipartformData로 변환
let imgData = MultipartFormData(provider: .data(imageData!), name: "imgs", fileName: "image", mimeType: "image/jpeg")
multiPartFormData.append(imgData)

}
}
return .uploadMultipart(multiPartFormData)

case .editReview(_, recommend: let recommend, content: let content, rating: let rating, isAllDeleted: let isAllDeleted, images: let images):
var multiPartFormData: [MultipartFormData] = []
if recommend == [] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import UIKit

import SwiftKeychainWrapper
import SnapKit
import Moya
import RxMoya
Expand Down Expand Up @@ -300,6 +301,7 @@ extension CAFETITest4ViewController {
resultVC.resultData = self.resultData

/// 서현코드
KeychainWrapper.standard.set(data.type, forKey: "userCafeTI")
UserDefaults.standard.set(data.type, forKey: "userCafeTI")
self.navigationController?.pushViewController(resultVC
, animated: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class CafeTITest1ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
view.backgroundColor = .white
addButtons()
layout()
self.navigationController?.navigationBar.isHidden = true
navigationController?.navigationBar.isHidden = true
}
}

Expand Down Expand Up @@ -220,7 +220,7 @@ extension CafeTITest1ViewController {
@objc func nextButtonClicked() {
if self.pagingnum == 1 {
if self.selectedIndex == 0 {
// resultanswers 배열에 0 추가
/// resultanswers 배열에 0 추가
let CAFETITest21ViewController = CAFETITest21ViewController()
self.resultAnswer.append(selectedIndex)
CAFETITest21ViewController.resultAnswer = self.resultAnswer
Expand All @@ -230,7 +230,7 @@ extension CafeTITest1ViewController {

}
else {
// resultanswers 배열에 1 추가
/// resultanswers 배열에 1 추가
let CAFETITest22ViewController = CAFETITest22ViewController()
self.resultAnswer.append(selectedIndex)
CAFETITest22ViewController.resultAnswer = self.resultAnswer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class CafeTIViewController: UIViewController {

// MARK: - Components

let backButton = UIButton()
let cafetititleLabel = UILabel()
let questionImageView = UIImageView()
private let backButton = UIButton()
private let cafetititleLabel = UILabel()
private let questionImageView = UIImageView()
let titleLabel = UILabel()
let subtitleLabel = UILabel()
let startButton = UIButton()
Expand All @@ -27,9 +27,9 @@ class CafeTIViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white
view.backgroundColor = .white
layout()
self.navigationController?.navigationBar.isHidden = true
navigationController?.navigationBar.isHidden = true
}
}

Expand All @@ -46,11 +46,9 @@ extension CafeTIViewController {
layoutTitleLabel()
layoutSubTitleLabel()
layoutStartButton()


}
func layoutBackButton() {
self.view.add(self.backButton) {
view.add(backButton) {
$0.setImage(UIImage(named: "iconBackBlack"), for: .normal)
$0.snp.makeConstraints {
$0.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(7)
Expand All @@ -62,7 +60,7 @@ extension CafeTIViewController {

}
func layoutCafeTITitleLabel() {
self.view.add(self.cafetititleLabel) {
view.add(cafetititleLabel) {
$0.setupLabel(text: "CAFETI 검사", color: .black, font: UIFont.notoSansKRMediumFont(fontSize: 20))
$0.letterSpacing = -1.0
$0.snp.makeConstraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ extension LoginViewController {
layoutSignupButton()
}
func keyboardObserver(){
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillShow(_:)),
name: UIResponder.keyboardWillShowNotification,
object: nil)

NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillDisappear(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillDisappear(_:)),
name: UIResponder.keyboardWillHideNotification,
object: nil)
}

/// 로그인 서버 연결
Expand All @@ -95,19 +101,20 @@ extension LoginViewController {
KeychainWrapper.standard.set(passwordText, forKey: "loginPassword")
KeychainWrapper.standard.set(data.loginData!.token, forKey: "accessToken")

let cafeTI = KeychainWrapper.standard.string(forKey: "userCafeTI")
// let cafeTI = UserDefaults.standard.string(forKey: "userCafeTI")
// if (cafeTI != nil) == true {
// let mapVC = MapViewController()
// self.navigationController?.pushViewController(mapVC, animated: false)
// }
// else {
// let myPageVC = CafeTIViewController()
// self.navigationController?.pushViewController(myPageVC, animated: false)
// }
if cafeTI != nil {
let mapVC = MapViewController()
self.navigationController?.pushViewController(mapVC, animated: false)
}
else {
let cafeTIVC = CafeTIViewController()
self.navigationController?.pushViewController(cafeTIVC, animated: false)
}

// 지수코드
let myPageVC = CafeTIViewController()
self.navigationController?.pushViewController(myPageVC, animated: false)
// let myPageVC = CafeTIViewController()
// self.navigationController?.pushViewController(myPageVC, animated: false)

} catch {
print(error)
Expand Down Expand Up @@ -165,7 +172,9 @@ extension LoginViewController {
}
func layoutEmailLabel() {
self.view.add(self.emailLabel) {
$0.setupLabel(text: "이메일 아이디", color: .maincolor1, font: UIFont.notoSansKRMediumFont(fontSize: 16))
$0.setupLabel(text: "이메일 아이디",
color: .maincolor1,
font: UIFont.notoSansKRMediumFont(fontSize: 16))
$0.letterSpacing = -0.8
$0.snp.makeConstraints {
$0.top.equalTo(self.logoImageView.snp.bottom).offset(84)
Expand All @@ -175,7 +184,9 @@ extension LoginViewController {
}
func layoutEmailTextField() {
self.view.add(self.emailTextField) {
$0.attributedPlaceholder = NSAttributedString(string: "[email protected]", attributes: [NSAttributedString.Key.foregroundColor: UIColor.gray3])
$0.attributedPlaceholder = NSAttributedString(
string: "[email protected]",
attributes: [NSAttributedString.Key.foregroundColor: UIColor.gray3])
$0.textColor = .black
$0.font = UIFont.notoSansKRRegularFont(fontSize: 16)
$0.snp.makeConstraints {
Expand Down Expand Up @@ -209,7 +220,9 @@ extension LoginViewController {
}
func layoutPasswordTextField() {
self.view.add(self.passwordTextField) {
$0.attributedPlaceholder = NSAttributedString(string: "yourpassword", attributes: [NSAttributedString.Key.foregroundColor: UIColor.gray3])
$0.attributedPlaceholder = NSAttributedString(
string: "yourpassword",
attributes: [NSAttributedString.Key.foregroundColor: UIColor.gray3])
$0.font = UIFont.notoSansKRRegularFont(fontSize: 16)
$0.isSecureTextEntry = true
$0.snp.makeConstraints {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class PinPopupTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
self.backgroundColor = .clear
self.selectionStyle = .none
layout()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,16 @@ extension CreateCategoryViewController {
let decoder = JSONDecoder()
let data = try decoder.decode(ResponseType<ServerReview>.self,
from: response.data)
<<<<<<< HEAD

if let myPageVC = self.navigationController?.children[0] as? MypageViewController {
self.navigationController?.popToViewController(myPageVC, animated: false)
myPageVC.showGreenToast(message: "카테고리가 추가되었습니다.")
}
if let pinVC = self.navigationController?.children[0] as? PinPopupViewController {
self.navigationController?.popToViewController(pinVC, animated: false)
pinVC.categoryTableView.reloadData()
pinVC.showGreenToast(message: "카테고리가 추가되었습니다.")
}

=======

// print("~~~")
// self.navigationController?.popToRootViewController(animated: false)
// print(self.navigationController?.children)
// print(self.navigationController?.presentingViewController)
// print(self.navigationController?.presentedViewController)
// print(self.presentingViewController)
// print(self.presentedViewController)
let myPageVC = self.navigationController?.children[0] as? MypageViewController
self.navigationController?.popToViewController(myPageVC!, animated: false)
myPageVC?.showGreenToast(message: "카테고리가 추가되었습니다.")
>>>>>>> 402bd98a1b548ea05370e121f33d0d6b33fdd5e4
} catch {
print(error)
}
Expand Down
Loading

0 comments on commit 74ac4f8

Please sign in to comment.