Skip to content

Commit

Permalink
Deployment week5
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffoio committed Nov 27, 2021
2 parents b933436 + 21994fc commit 3090559
Show file tree
Hide file tree
Showing 146 changed files with 6,092 additions and 1,494 deletions.
534 changes: 369 additions & 165 deletions Escaper/Escaper.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Escaper/Escaper/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }

// DataInjection.shared.run(storeRegion: .extra)
// DataInjection.shared.run(storeRegion: .sinlim)
let viewController = MainTabBarController()
window = UIWindow(frame: UIScreen.main.bounds)
window?.windowScene = windowScene
window?.rootViewController = viewController
window?.makeKeyAndVisible()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit
extension UISearchBar {
func setTextFieldColor(color: UIColor?) {
guard let textField = self.value(forKey: "searchField") as? UITextField else { return }
textField.font = UIFont.systemFont(ofSize: 14, weight: .regular)
switch self.searchBarStyle {
case .minimal:
textField.layer.backgroundColor = color?.cgColor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// UIView+ScaledSize.swift
// UIView+Extension.swift
// Escaper
//
// Created by TakHyun Jung on 2021/11/13.
Expand All @@ -14,4 +14,14 @@ extension UIView {
mask.path = path.cgPath
self.layer.mask = mask
}

func transformToImage() -> UIImage? {
UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.isOpaque, 0.0)
defer {
UIGraphicsEndImageContext()
}
guard let context = UIGraphicsGetCurrentContext() else { return nil }
self.layer.render(in: context)
return UIGraphicsGetImageFromCurrentImageContext()
}
}
49 changes: 41 additions & 8 deletions Escaper/Escaper/Common/Library/EDSKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ enum EDSKit {
label.font = UIFont.systemFont(ofSize: 10, weight: .regular)
return label
}

static func b01L(text: String = "", color: Color) -> UILabel {
let label = Label.makeLabel(text: text, color: color)
label.font = UIFont.systemFont(ofSize: 14, weight: .light)
return label
}

static func b02L(text: String = "", color: Color) -> UILabel {
let label = Label.makeLabel(text: text, color: color)
label.font = UIFont.systemFont(ofSize: 12, weight: .light)
return label
}

static func b03L(text: String = "", color: Color) -> UILabel {
let label = Label.makeLabel(text: text, color: color)
label.font = UIFont.systemFont(ofSize: 10, weight: .light)
return label
}
}

enum Color {
Expand All @@ -74,14 +92,15 @@ enum EDSKit {
case bloodyDarkBurgundy
case bloodyRed
case charcoal
case gloomyBrown
case gloomyLightBrown
case gloomyPink
case gloomyPurple
case gloomyRed
case gloomyBrown
case pumpkin
case skullGrey
case skullLightWhite
case skullWhite
case skullGrey
case zombiePurple

var value: UIColor? {
Expand All @@ -91,17 +110,31 @@ enum EDSKit {

enum Image {
case chevronDown
case recordCard
case plus
case loginPumpkin
case signupGhost
case comedyPreview
case crown
case distanceIcon
case emailIcon
case pwIcon
case eyeIcon
case fearPreview
case genreIcon
case keyMarker
case loginPumpkin
case mappin
case passwordIcon
case plus
case recordBook
case recordCard
case recordCandle
case romancePreview
case share
case signupGhost
case signupPlus
case signupSkull
case starfilled
case starunfilled

var value: UIImage? {
return UIImage(named: String(describing: self))
return self == .mappin ? UIImage(systemName: "mappin.and.ellipse") : UIImage(named: String(describing: self))
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions Escaper/Escaper/Common/Library/Error.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Error.swift
// Escaper
//
// Created by shinheeRo on 2021/11/24.
//

import Foundation

enum UserError: Error {
case networkUnconneted
case notExist
}
1 change: 0 additions & 1 deletion Escaper/Escaper/Common/Library/Observable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class Observable<T> {

func observe(on observer: AnyObject, observerBlock: @escaping (T) -> Void) {
self.observers.append(Observer(observer: observer, block: observerBlock))
observerBlock(self.value)
}

func remove(observer: AnyObject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

enum ViewType {
enum TextFieldType {
case email
case password
case passwordCheck
Expand Down
44 changes: 44 additions & 0 deletions Escaper/Escaper/Common/Library/Validator.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Validater.swift
// Escaper
//
// Created by shinheeRo on 2021/11/23.
//

import Foundation

enum Validator {
enum State: String {
case normal = ""
case numberOfDigitsError = "8์ž๋ฆฌ ์ด์ƒ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
case discordanceError = "๋น„๋ฐ€๋ฒˆํ˜ธ์™€ ์ผ์น˜ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."
case alreadyExistError = "์ด๋ฏธ ๋“ฑ๋ก๋œ ์ด๋ฉ”์ผ์ž…๋‹ˆ๋‹ค."
case notConfirmedError = "์•„์ด๋””์™€ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋‹ค์‹œ ํ™•์ธํ•ด์ฃผ์„ธ์š”."

var value: String {
return self.rawValue
}
}

static var notConfirmedErrorString: String {
return State.notConfirmedError.value
}

static var alreadyExistErrorString: String {
return State.alreadyExistError.value
}

static func checkNumberOfDigits(text: String) -> String {
if text.count < 8 {
return State.numberOfDigitsError.value
}
return State.normal.value
}

static func checkDiscordance(text1: String, text2: String) -> String {
if text1 != text2 {
return State.discordanceError.value
}
return State.normal.value
}
}
4 changes: 4 additions & 0 deletions Escaper/Escaper/DataInjection/DataInjection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class DataInjection {
genre: room.genre,
geoLocation: geoLocation,
district: district,
activity: room.activity,
description: room.description,
maxParty: room.maxParty,
timeLimit: room.timeLimit,
records: [])

FirebaseService.shared.addRoom(room: roomDTO)
Expand Down
4 changes: 2 additions & 2 deletions Escaper/Escaper/DataInjection/InjectionDTOs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ struct StoreInjectionDTO: Codable {
}

struct RoomInjectionDTO: Codable {
let title, genre: String
let difficulty: Int
let title, genre, activity, description: String
let difficulty, maxParty, timeLimit: Int
}
5 changes: 2 additions & 3 deletions Escaper/Escaper/Domain/Entities/RecordCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
struct RecordCard: Hashable {
var username: String
var createdTime: Date
var imageURLString: String
var recordImageURLString: String
var roomTitle: String
var storeName: String
var isSuccess: Bool
Expand All @@ -23,14 +23,13 @@ struct RecordCard: Hashable {
init(record: Record, room: Room) {
self.username = Helper.parseUsername(email: record.userEmail) ?? "Unknown"
self.createdTime = record.createdTime
self.imageURLString = record.imageURLString
self.recordImageURLString = record.imageURLString
self.roomTitle = room.title
self.storeName = room.storeName
self.isSuccess = record.isSuccess
self.satisfaction = record.satisfaction
self.difficulty = room.difficulty
self.numberOfTotalPlayers = room.records.count
// TODO: - ํ™•์ธํ•  ๊ฒƒ
self.rank = Helper.binarySearch(value: record.escapingTime, sortedValues: room.records.map({ $0.escapingTime }).sorted()) ?? room.records.count
self.time = record.escapingTime
}
Expand Down
6 changes: 5 additions & 1 deletion Escaper/Escaper/Domain/Entities/Room.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ struct Room: Hashable {
var genre: Genre
var geoLocation: CLLocation
var district: District
var activity: String
var description: String
var maxParty: Int
var timeLimit: Int
var records: [Record]
var distance: Double // TODO: - ์ด๋Ÿฌ๋‹ค ๋‹ค์ฃฝ์–ด
var distance: Double

func hash(into hasher: inout Hasher) {
hasher.combine(self.roomId)
Expand Down
7 changes: 6 additions & 1 deletion Escaper/Escaper/Domain/Entities/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import CoreLocation

struct Store {
struct Store: Hashable {
var name: String
var homePage: String
var telephone: String
Expand All @@ -17,4 +17,9 @@ struct Store {
var geoLocation: CLLocation
var district: District
var roomIds: [String]
var distance: Double

mutating func updateDistance(_ distance: Double) {
self.distance = distance
}
}
16 changes: 16 additions & 0 deletions Escaper/Escaper/Domain/Entities/Supplementary/Feedback.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Feedback.swift
// Escaper
//
// Created by ์ตœ์™„์‹ on 2021/11/26.
//

import Foundation

struct Feedback {
let content: String

func toDTO() -> FeedbackDTO {
return FeedbackDTO(content: self.content)
}
}
2 changes: 1 addition & 1 deletion Escaper/Escaper/Domain/Entities/Supplementary/Rating.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

enum Rating: Int {
static let maxRating: Int = 5

case zero = 0
case one = 1
case two = 2
Expand Down
13 changes: 12 additions & 1 deletion Escaper/Escaper/Domain/Entities/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,21 @@

import Foundation

struct User {
struct User: Decodable {
let email: String
let name: String
let password: String
let imageURL: String
let score: Int

func toDictionary() -> [String: Any] {
let dictionary: [String: Any] = [
"email": self.email,
"name": self.name,
"password": self.password,
"imageURL": self.imageURL,
"score": self.score
]
return dictionary
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// FeedbackRepositoryInterface.swift
// Escaper
//
// Created by ์ตœ์™„์‹ on 2021/11/26.
//

import Foundation

protocol FeedbackRepositoryInterface {
func addFeedback(feedback: Feedback)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// LeaderBoardRepositoryInterface.swift
// Escaper
//
// Created by ๋ฐ•์˜๊ด‘ on 2021/11/22.
//

import Foundation

protocol LeaderBoardRepositoryInterface {
func fetch(completion: @escaping (Result<[User], Error>) -> Void)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

protocol RoomListRepositroyInterface {
protocol RoomListRepositoryInterface {
func query(genre: Genre, district: District, completion: @escaping (Result<[Room], Error>) -> Void)
func fetch(roomId: String, completion: @escaping (Result<Room, Error>) -> Void)
func fetch(name: String, completion: @escaping (Result<[Room], Error>) -> Void)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// StoreRepositoryInterface.swift
// Escaper
//
// Created by TakHyun Jung on 2021/11/23.
//

import Foundation

protocol StoreRepositoryInterface {
func query(name: String, completion: @escaping (Result<[Store], Error>) -> Void)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// UserRepositoryInterface.swift
// Escaper
//
// Created by shinheeRo on 2021/11/22.
//

import Foundation

protocol UserRepositoryInterface {
func query(userEmail: String, completion: @escaping (Result<Bool, Error>) -> Void)
func confirm(userEmail: String, userPassword: String, completion: @escaping (Result<User, UserError>) -> Void)
func add(user: User)
}
Loading

0 comments on commit 3090559

Please sign in to comment.