Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/Dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
SOOHYUNLEE08 committed Aug 20, 2024
2 parents 71c178e + 413d746 commit 26492e9
Show file tree
Hide file tree
Showing 77 changed files with 3,374 additions and 716 deletions.
Binary file modified .DS_Store
Binary file not shown.
232 changes: 168 additions & 64 deletions Drink-EG/Drink-EG.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions Drink-EG/Drink-EG/Resources/APIs/LoginAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Moya
enum LoginAPI {
case postLogin(data: JoinNLoginRequest)
case postRegister(data : JoinNLoginRequest)
case postAppleLogin(identityTokenString: String)
}

extension LoginAPI: TargetType {
Expand All @@ -27,6 +28,8 @@ extension LoginAPI: TargetType {
return "/login"
case .postRegister:
return "/join"
case .postAppleLogin:
return"/login/apple"
}
}

Expand All @@ -37,24 +40,25 @@ extension LoginAPI: TargetType {
return .post
case .postRegister:
return .post
case .postAppleLogin:
return .post
}
}

var task: Task {
switch self {
case .postLogin(let data), .postRegister(let data) :
return .requestJSONEncodable(data)
case .postAppleLogin(let identityTokenString) :
return .requestParameters(parameters: ["identityToken" : identityTokenString], encoding: JSONEncoding.default)
}
}

// API 호출 시, header에 token 넣어서 전달
var headers: [String : String]? {
switch self {
case .postLogin, .postRegister:
return [
"Content-type": "application/json"
]
}
return [
"Content-type": "application/json"
]
}

var validationType: ValidationType {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"scale" : "1x"
},
{
"filename" : "Rectangle 112 (1).png",
"filename" : "Rectangle 112@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Rectangle 112 (2).png",
"filename" : "Rectangle 112@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Vector.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
16 changes: 16 additions & 0 deletions Drink-EG/Drink-EG/Resources/Extensions/String.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// String.swift
// Drink-EG
//
// Created by 김도연 on 8/20/24.
//

import UIKit

extension String {
var unescapedString: String {
let mutableString = NSMutableString(string: self)
CFStringTransform(mutableString, nil, "Any-Hex/Java" as NSString, true)
return mutableString as String
}
}
37 changes: 37 additions & 0 deletions Drink-EG/Drink-EG/Resources/Extensions/UIView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// UIView.swift
// Drink-EG
//
// Created by 김도연 on 8/20/24.
//

import UIKit

extension UIView {

func applyTopShadow(shadowColor: UIColor = .black, shadowOpacity: Float = 0.25, shadowRadius: CGFloat = 5, shadowOffset: CGSize = CGSize(width: 0, height: -3)) {
// 그림자 색상
self.layer.shadowColor = shadowColor.cgColor

// 그림자 투명도
self.layer.shadowOpacity = shadowOpacity

// 그림자 퍼짐 정도
self.layer.shadowRadius = shadowRadius

// 그림자 오프셋 (상단에만 그림자가 보이도록 설정)
self.layer.shadowOffset = shadowOffset

// 레이아웃이 완료된 후에 shadowPath 설정
DispatchQueue.main.async {
let shadowPath = UIBezierPath()
shadowPath.move(to: CGPoint(x: 0, y: 0))
shadowPath.addLine(to: CGPoint(x: self.bounds.width, y: 0))
shadowPath.addLine(to: CGPoint(x: self.bounds.width, y: self.bounds.height / 4))
shadowPath.addLine(to: CGPoint(x: 0, y: self.bounds.height / 4))
shadowPath.close()

self.layer.shadowPath = shadowPath.cgPath
}
}
}
28 changes: 28 additions & 0 deletions Drink-EG/Drink-EG/Resources/Extensions/UserDefaults.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// UserDefaults.swift
// Drink-EG
//
// Created by 김도연 on 8/20/24.
//

import UIKit

extension UserDefaults {
private enum Keys {
static let comments = "comments"
}

func saveComments(_ comments: [Comment]) {
if let encoded = try? JSONEncoder().encode(comments) {
self.set(encoded, forKey: Keys.comments)
}
}

func loadComments() -> [Comment] {
if let savedData = self.data(forKey: Keys.comments),
let savedComments = try? JSONDecoder().decode([Comment].self, from: savedData) {
return savedComments
}
return []
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

class CustomCommentsCollectionView: UITableViewCell {
class CustomCommentsCollectionViewCell: UITableViewCell {
let profileImageView = UIImageView()
let nameLabel = UILabel()
let dateLabel = UILabel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,49 @@

import UIKit
import SnapKit
import SDWebImage

protocol CartListCollectionViewCellDelegate: AnyObject {
func checkButtonTapped(on cell: CartListCollectionViewCell, isSelected: Bool)
func deleteButtonTapped(on cell: CartListCollectionViewCell)
func quantityChanged(in cell: CartListCollectionViewCell)
func didTapChangeStoreButton(on cell: CartListCollectionViewCell)
}

class CartListCollectionViewCell: UICollectionViewCell {

weak var delegate: CartListCollectionViewCellDelegate?
var changeMarketButtonAction : (() -> Void) = {}

var quantity: Int = 1 {
didSet {
updateNumLabel()
configureMarketNPlace(self.shop, self.price, self.quantity)
}
}
//이전 수량을 저장
var previousQuantity: Int = 1

private let CheckImage = UIImage(named: "icon_cartCheck_fill")
private let nCheckImage = UIImage(named: "icon_cartCheck_nfill")
let CheckButton = UIButton(type: .custom)
var shop = "PODO"
var price = 0
var wineImage: String?

private let imageView: UIImageView = {
let iv = UIImageView()
iv.image = UIImage(named: "Loxton")
iv.layer.cornerRadius = 10
iv.layer.masksToBounds = true
return iv
}()

private let name: UILabel = {
let name: UILabel = {
let l1 = UILabel()
l1.text = "Loxton"
l1.font = .boldSystemFont(ofSize: 18)
l1.textColor = .black
l1.numberOfLines = 0
l1.numberOfLines = 2
l1.lineBreakMode = .byTruncatingTail // 생략 부호(...)가 꼬리에 위치하도록 설정
return l1
}()

Expand All @@ -62,7 +69,7 @@ class CartListCollectionViewCell: UICollectionViewCell {
}()

@objc private func changeMarketButtonTapped() {
changeMarketButtonAction()
delegate?.didTapChangeStoreButton(on: self)
}

private let changeNumButton: UIButton = {
Expand All @@ -86,6 +93,7 @@ class CartListCollectionViewCell: UICollectionViewCell {
private func updateNumLabel() {
let label = "\(quantity)"
NumLabel.text = label
delegate?.quantityChanged(in: self) // 수량 변경 시 delegate 호출
}

@objc func changeNumButtonTapped(_ sender: UIButton, forEvent event: UIEvent) {
Expand All @@ -105,10 +113,12 @@ class CartListCollectionViewCell: UICollectionViewCell {
}

private func decreaseQuantity() {
previousQuantity = quantity
quantity = max(quantity - 1, 1)
}

private func increaseQuantity() {
previousQuantity = quantity
quantity += 1
}

Expand All @@ -120,9 +130,14 @@ class CartListCollectionViewCell: UICollectionViewCell {
b.setImage(image, for: .normal)
b.tintColor = UIColor(hex: "999999")
b.backgroundColor = .clear
b.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside)
return b
}()

@objc private func deleteButtonTapped() {
delegate?.deleteButtonTapped(on: self) // 델리게이트 호출
}

func configureCheckButton() {
CheckButton.setImage(nCheckImage?.withRenderingMode(.alwaysOriginal), for: .normal)
CheckButton.backgroundColor = .clear
Expand All @@ -147,7 +162,7 @@ class CartListCollectionViewCell: UICollectionViewCell {
delegate?.checkButtonTapped(on: self, isSelected: sender.isSelected)
}

private func configureMarketNPlace(_ shopName: String, _ priceInt: Int, _ count: Int) {
func configureMarketNPlace(_ shopName: String, _ priceInt: Int, _ count: Int) {
let firstImageAttachment = NSTextAttachment()
firstImageAttachment.image = UIImage(named: "icon_market")

Expand Down Expand Up @@ -222,43 +237,48 @@ class CartListCollectionViewCell: UICollectionViewCell {
}

name.snp.makeConstraints { make in
make.top.equalTo(imageView)
make.leading.equalTo(imageView.snp.trailing).offset(15)
make.top.equalToSuperview().offset(13)
make.leading.equalTo(imageView.snp.trailing).offset(13)
if UIDevice.current.userInterfaceIdiom == .phone {
make.width.lessThanOrEqualTo(180) //185
}
make.height.lessThanOrEqualTo(45)
}

marketNprice.snp.makeConstraints { make in
make.top.equalTo(name.snp.bottom).offset(7)
make.top.equalTo(name.snp.bottom).offset(3)
make.leading.equalTo(name)
}

changeMarketButton.snp.makeConstraints { make in
make.bottom.equalToSuperview().inset(14)
make.leading.equalToSuperview().offset(213)
make.width.greaterThanOrEqualTo(67)
make.height.greaterThanOrEqualTo(24)
}

changeNumButton.snp.makeConstraints { make in
make.top.equalTo(changeMarketButton)
make.leading.equalTo(changeMarketButton.snp.trailing).offset(6)
make.bottom.equalToSuperview().inset(10)
make.trailing.equalToSuperview().inset(12)
make.width.greaterThanOrEqualTo(63)
make.height.greaterThanOrEqualTo(26)
}

changeMarketButton.snp.makeConstraints { make in
make.top.equalTo(changeNumButton)
make.trailing.equalTo(changeNumButton.snp.leading).offset(-6)
make.width.greaterThanOrEqualTo(67)
make.height.greaterThanOrEqualTo(20)
}

NumLabel.snp.makeConstraints { make in
make.centerX.centerY.equalToSuperview()
}

deleteButton.snp.makeConstraints { make in
make.top.equalToSuperview().offset(20)
make.trailing.equalToSuperview().inset(14)
make.width.height.equalTo(15)
}
}

func configure1(imageName: String, wineName: String, price: Int, count: Int, shopName: String) {
if let image = UIImage(named: imageName) {
imageView.image = image
func configure1(imageName: String?, wineName: String, price: Int, count: Int, shopName: String) {
if let imageUrl = imageName, let url = URL(string: imageUrl) {
self.imageView.sd_setImage(with: url, placeholderImage: UIImage(named: "Loxton"))
} else {
self.imageView.image = UIImage(named: "Loxton")
}

self.name.text = wineName
Expand All @@ -273,4 +293,3 @@ class CartListCollectionViewCell: UICollectionViewCell {
CheckButton.isSelected = isSelected
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import SDWebImage
class RecomCollectionViewCell: UICollectionViewCell {

private let imageView: UIImageView = {
let iv = UIImageView()
return iv
let iv = UIImageView()
return iv
}()

private let label1: UILabel = {
let l1 = UILabel()
l1.font = .systemFont(ofSize: 14, weight: .bold)
l1.font = .systemFont(ofSize: 13, weight: .bold)
l1.textColor = .black
l1.numberOfLines = 0
l1.adjustsFontSizeToFitWidth = true
l1.minimumScaleFactor = 0.7
l1.numberOfLines = 2
//l1.adjustsFontSizeToFitWidth = true
l1.lineBreakMode = .byTruncatingTail // 생략 부호(...)가 꼬리에 위치하도록 설정
return l1
}()

Expand Down Expand Up @@ -64,10 +64,10 @@ class RecomCollectionViewCell: UICollectionViewCell {
}

label1.snp.makeConstraints { make in
make.leading.equalTo(imageView.snp.leading).offset(9)
make.leading.trailing.equalToSuperview().inset(15)
make.top.equalTo(view.snp.top).offset(10)
make.width.lessThanOrEqualToSuperview().inset(10)
make.height.lessThanOrEqualTo(30)
// make.width.lessThanOrEqualToSuperview().inset(15)
make.height.lessThanOrEqualTo(35)
}

view.snp.makeConstraints { make in
Expand Down
Loading

0 comments on commit 26492e9

Please sign in to comment.