Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/#15-on-view
Browse files Browse the repository at this point in the history
  • Loading branch information
yeahzxnn committed Feb 16, 2024
2 parents feee1f0 + 9009a45 commit 44cab5d
Show file tree
Hide file tree
Showing 88 changed files with 6,171 additions and 615 deletions.
Binary file removed .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@ iOSInjectionProject/
# End of https://www.toptal.com/developers/gitignore/api/swift,xcode

On_off_iOS/.DS_Store

*/.DS_Store
On_off_iOS/On_off_iOS/Config.xcconfig

.DS_Store
266 changes: 245 additions & 21 deletions On_off_iOS/On_off_iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
"version" : "4.3.4"
}
},
{
"identity" : "mantis",
"kind" : "remoteSourceControl",
"location" : "https://github.com/guoyingtao/Mantis.git",
"state" : {
"revision" : "d6880eb97267248f89e6cef2dd52785d50627639",
"version" : "1.9.0"
}
},
{
"identity" : "ohhttpstubs",
"kind" : "remoteSourceControl",
Expand Down
31 changes: 30 additions & 1 deletion On_off_iOS/On_off_iOS/Constants/API/EndPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum LoginPath: String {
case checkValidation = "/token/validate"
case kakaoLogin = "/oauth2/kakao/token/validate"
case appleLogin = "/oauth2/apple/token/validate"
case nicknameDuplicate = "/users/nickname"

/// 직업
case job = "/enums/field-of-works"
Expand All @@ -22,8 +23,36 @@ enum LoginPath: String {

/// 회고록
enum MemoirsPath: String {
case memoirsSave = "/Memoirs"
case memoirsSave = "/memoirs" //회고록 저장,보기
case memoirsRevise = "/memoirs/MEMOIRID" // 회고록 수정
case bookMark = "/memoirs/MEMOIRID/bookmark" // 북마크 체크
case getEmoticon = "/emoticons"
case preview = "/memoirs/previews"
}

enum FeedPath: String {
case feedImage = "/feed-images"
case workLifeBalacne = "/feeds"
case checkWLB = "/feeds/FEEDID/check"
case delayTomorrow = "/feeds/FEEDID/delay"
case delete = "/feeds/FEEDID"
}

enum WeekDayPath: String {
case weekdayInit = "/weekdays/init"
case prevWeek = "/weekdays/prev"
case nextWeek = "/weekdays/next"
}

enum MyPage: String {
case myInfo = "/users/information"
}

enum StatisticsPath: String {
case week = "/stats/week"
case month = "/stats/month"
case prevMonth = "/stats/month/prev"
case nextMonth = "/stats/month/next"
}

enum WorklogPath: String {
Expand Down
8 changes: 6 additions & 2 deletions On_off_iOS/On_off_iOS/Constants/CellIdentifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ enum CellIdentifier: String {
case BookmarkTableViewCell
case ModalSelectProfileTableViewCell // 프로필 설정

// MARK: WorklogViewCell
case WorkLogTableViewCell
// MARK: - Off UIView
case ImageCollectionView
case WorkLifeBalanceTableViewCell

// MARK: - Calendar
case CalendarCell
}
37 changes: 37 additions & 0 deletions On_off_iOS/On_off_iOS/Extension/Ext + Date.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Ext + Date.swift
// On_off_iOS
//
// Created by 정호진 on 2/13/24.
//

import Foundation

extension Date {

/**
# dateCompare
- Parameters:
- fromDate: 비교 대상 Date
- Note: 두 날짜간 비교해서 과거(Future)/현재(Same)/미래(Past) 반환
*/
public func dateCompare(fromDate: Date) -> String {
var strDateMessage:String = ""
let result: ComparisonResult = self.compare(fromDate)
switch result {
case .orderedAscending:
strDateMessage = "Future"
break
case .orderedDescending:
strDateMessage = "Past"
break
case .orderedSame:
strDateMessage = "Same"
break
default:
strDateMessage = "Error"
break
}
return strDateMessage
}
}
7 changes: 4 additions & 3 deletions On_off_iOS/On_off_iOS/Extension/Ext + UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ extension UIColor {
static let OnOffMain = UIColor(hex: "7D4BFF") // OnOff 메인컬러
static let OnOffYellow = UIColor(hex: "#FFD572")
static let OnOffLightMain = UIColor(hex: "#FCF8FF")



//StatisticsView 그래프 컬러
static let OnOffPurple = UIColor(hex: "#7D4BFF")
static let backGround = UIColor(hex: "#F8F5FF")
static let gradient1 = UIColor(hex: "#B297FE")
static var OnOffLightPurple: UIColor { //날짜 선택 안되었을 때의 컬러
return OnOffPurple.withAlphaComponent(0.3)
return OnOffPurple.withAlphaComponent(0.1)
}
}
47 changes: 19 additions & 28 deletions On_off_iOS/On_off_iOS/Extension/Ext + UIImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,6 @@ extension UIImage {
return renderImage
}

// /// MARK: 이미지 회전하는 함수
// func rotate(degrees: CGFloat) -> UIImage {
// /// context에 그려질 크기를 구하기 위해서 최종 회전되었을때의 전체 크기 획득
// let rotatedViewBox: UIView = UIView(frame: CGRect(x: 0, y: 0, width: size.width, height: size.height))
// let affineTransform: CGAffineTransform = CGAffineTransform(rotationAngle: degrees * CGFloat.pi / 180)
// rotatedViewBox.transform = affineTransform
//
// /// 회전된 크기
// let rotatedSize: CGSize = rotatedViewBox.frame.size
//
// /// 회전한 만큼의 크기가 있을때, 필요없는 여백 부분을 제거하는 작업
// UIGraphicsBeginImageContext(rotatedSize)
// let bitmap: CGContext = UIGraphicsGetCurrentContext()!
// /// 원점을 이미지의 가운데로 평행 이동
// bitmap.translateBy(x: rotatedSize.width / 2, y: rotatedSize.height / 2)
// /// 회전
// bitmap.rotate(by: (degrees * CGFloat.pi / 180))
// /// 상하 대칭 변환 후 context에 원본 이미지 그림 그리는 작업
// bitmap.scaleBy(x: 1.0, y: -1.0)
// bitmap.draw(cgImage!, in: CGRect(x: -size.width / 2, y: -size.height / 2, width: size.width, height: size.height))
//
// /// 그려진 context로 부터 이미지 획득
// guard let newImage: UIImage = UIGraphicsGetImageFromCurrentImageContext() else { return UIImage() }
// UIGraphicsEndImageContext()
//
// return newImage
// }

/// 이미지 90도 회전
/// - Parameter radians: radians
/// - Returns: rotatedImage
Expand All @@ -86,4 +58,23 @@ extension UIImage {

return rotatedImage
}

convenience init?(bounds: CGRect, colors: [UIColor]) {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds
gradientLayer.cornerRadius = 15
gradientLayer.colors = colors.map({ $0.cgColor })

gradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5);
gradientLayer.endPoint = CGPoint(x: 1.0, y: 0.5);

UIGraphicsBeginImageContext(gradientLayer.bounds.size)
gradientLayer.render(in: UIGraphicsGetCurrentContext()!)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

guard let cgImage = image?.cgImage else { return nil }
self.init(cgImage: cgImage)
}

}
3 changes: 3 additions & 0 deletions On_off_iOS/On_off_iOS/Home/Base/Model/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import Foundation

struct DayInfo {
/// 전체 날짜
let totalDate: String?

/// 일, 숫자
let date: String?

Expand Down
18 changes: 18 additions & 0 deletions On_off_iOS/On_off_iOS/Home/Base/Model/WeekDay.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// WeekDay.swift
// On_off_iOS
//
// Created by 정호진 on 2/13/24.
//

import Foundation

struct WeekDay: Codable {
let monday: String?
let tuesday: String?
let wednesday: String?
let thursday: String?
let friday: String?
let saturday: String?
let sunday: String?
}
122 changes: 122 additions & 0 deletions On_off_iOS/On_off_iOS/Home/Base/Service/HomeViewService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// HomeViewService.swift
// On_off_iOS
//
// Created by 정호진 on 2/13/24.
//

import Foundation
import Alamofire
import RxSwift

final class HomeViewService {
private let disposeBag = DisposeBag()

/// 일주일 날짜 초기 가져오기
/// - Returns: Week Day
func weekDayInit() -> Observable<WeekDay> {
let url = Domain.RESTAPI + WeekDayPath.weekdayInit.rawValue
let header = Header.header.getHeader()
return Observable.create { observer in
AF.request(url,
method: .get,
headers: header)
.validate(statusCode: 200..<201)
.responseDecodable(of: Response<WeekDay>.self) { response in
print(#function, response)
switch response.result {
case .success(let data):
observer.onNext(data.result)
case .failure(let error):
observer.onError(error)
}
}

return Disposables.create()
}
}

/// Get My Information
/// - Returns: My Information
func getMyNickName() -> Observable<String> {
let url = Domain.RESTAPI + MyPage.myInfo.rawValue
let header = Header.header.getHeader()

return Observable.create { observer in
AF.request(url,
method: .get,
headers: header)
.validate(statusCode: 200..<201)
.responseDecodable(of: Response<MyInfo>.self) { response in
print(#function, response)
switch response.result {
case .success(let data):
observer.onNext(data.result.nickname ?? "")
case .failure(let error):
observer.onError(error)
}
}

return Disposables.create()
}
}

/// 이전 일주일 날짜 가져오기
/// - Returns: Week Day
/// - Parameter date: 선택한 날짜
func movePrevWeek(date: String) -> Observable<WeekDay> {
let url = Domain.RESTAPI + WeekDayPath.prevWeek.rawValue
let parameters: Parameters = ["date": date]
let header = Header.header.getHeader()
print(url, #function)
return Observable.create { observer in
AF.request(url,
method: .get,
parameters: parameters,
encoding: URLEncoding.default,
headers: header)
.validate(statusCode: 200..<201)
.responseDecodable(of: Response<WeekDay>.self) { response in
print(#function, response)
switch response.result {
case .success(let data):
observer.onNext(data.result)
case .failure(let error):
observer.onError(error)
}
}

return Disposables.create()
}
}

/// 다음 일주일 날짜 가져오기
/// - Returns: Week Day
/// - Parameter date: 선택한 날짜
func moveNextWeek(date: String) -> Observable<WeekDay> {
let url = Domain.RESTAPI + WeekDayPath.nextWeek.rawValue
let parameters: Parameters = ["date": date]
let header = Header.header.getHeader()
print(url, #function)
return Observable.create { observer in
AF.request(url,
method: .get,
parameters: parameters,
encoding: URLEncoding.default,
headers: header)
.validate(statusCode: 200..<201)
.responseDecodable(of: Response<WeekDay>.self) { response in
print(#function, response)
switch response.result {
case .success(let data):
observer.onNext(data.result)
case .failure(let error):
observer.onError(error)
}
}

return Disposables.create()
}
}

}
15 changes: 14 additions & 1 deletion On_off_iOS/On_off_iOS/Home/Base/View/DayCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,22 @@ final class DayCollectionViewCell: UICollectionViewCell {
/// Input Data About Day, Date
/// - Parameter info: DayInfo
/// - Parameter color: BackGround Color
func inputData(info: DayInfo, color: UIColor) {
/// - Parameter textColor: TextColor
func inputData(info: DayInfo, color: UIColor, textColor: UIColor) {
dayLabel.text = info.day ?? ""
dayLabel.textColor = textColor
dateLabel.text = info.date ?? ""
dateLabel.textColor = textColor
cornerUIView.backgroundColor = color
}

/// 선택됐을때 효과
/// - Parameters:
/// - color: BackGround Color
/// - textColor: Text Color
func selectedEffect(color: UIColor, textColor: UIColor) {
cornerUIView.backgroundColor = color
dayLabel.textColor = textColor
dateLabel.textColor = textColor
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// DimmedViewController.swift
// On_off_iOS
//
// Created by 신예진 on 2/13/24.
// Created by 정호진 on 2/11/24.
//

import Foundation
Expand Down
Loading

0 comments on commit 44cab5d

Please sign in to comment.