Skip to content

Commit

Permalink
버그 수정 (#357)
Browse files Browse the repository at this point in the history
* delete: path 제거

* chore: textView 폰트 접근성 수정

* feat: 랜덤매칭시 잘못 들어오는 String을 Regex를 통해 파싱하는 기능 추가

* Update BackEnd_CD_PROD.yml

* style: 매직넘버및 디자인에 안맞는 버튼 크기 수정

* feat: ActionSheet 취소 버튼 추가

* fix: 카메라로 프로필이미지 선택 안되는 현상 개선

* fix: ProductionServer Response에서 isFirstLogined 안내려오는 현상 개선

* delete: defaults data 삭제

* fix: 토큰 설정하지 않아 서버에러가 발생한 것 수정

---------

Co-authored-by: MaraMincho <[email protected]>
Co-authored-by: Vardy <[email protected]>
Co-authored-by: JongPyoAhn <[email protected]>
  • Loading branch information
4 people authored Dec 11, 2023
1 parent 2cf3835 commit ac3fc98
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 63 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/BackEnd_CD_PROD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- release
paths:
- 'BackEnd/**'

jobs:
deploy:
Expand All @@ -17,7 +15,7 @@ jobs:

- uses: docker/login-action@v2
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY_PROD }}
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}

Expand All @@ -26,11 +24,11 @@ jobs:
context: .
file: ./BackEnd/Dockerfile
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY_PROD }}/my-app:latest
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/my-app:latest
platforms: linux/amd64

- name: SSH to Internal Server and Deploy
run: |
sshpass -p ${{ secrets.BASTION_PASSWORD_PROD }} ssh -o StrictHostKeyChecking=no ${{ secrets.BASTION_USER_PROD }}@${{ secrets.BASTION_HOST_PROD }} -tt "
docker service update --force --image ${{ secrets.NCP_CONTAINER_REGISTRY_PROD }}/my-app:latest my-app --update-parallelism 1 --update-delay 10s
"
docker service update --force --image ${{ secrets.NCP_CONTAINER_REGISTRY }}/my-app:latest my-app --update-parallelism 1 --update-delay 10s
"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Foundation
/// 처음 로그인 하는 유저의 Response를 담을 Entity
public struct InitialUser {
/// 처음 로그인 하는지 아닌지
public let isFirstLogined: Bool
public let isFirstLogined: Bool?

///
public let mappedUserID: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ final class LoginViewController: UIViewController {
attributedString.addAttribute(.link, value: PrivacyLink.link, range: NSRange(location: 12, length: 18))

let textView = UITextView()
textView.backgroundColor = .clear
textView.translatesAutoresizingMaskIntoConstraints = false
textView.attributedText = attributedString
textView.isEditable = false
textView.isScrollEnabled = false
textView.attributedText = attributedString
textView.dataDetectorTypes = .link
textView.font = .systemFont(ofSize: 12, weight: .medium)
textView.textColor = DesignSystemColor.primaryText
textView.textColor = .white
textView.textAlignment = .center
return textView
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Combine
import CommonNetworkingKeyManager
import Foundation
import Trinet

Expand Down Expand Up @@ -48,7 +49,7 @@ public struct WorkoutSummaryRepository: WorkoutSummaryRepositoryRepresentable {
Future<Data, Error> { promise in
Task {
do {
let data = try await provider.request(.init(recordID: id))
let data = try await provider.request(.init(recordID: id), interceptor: TNKeychainInterceptor.shared)
promise(.success(data))
} catch {
promise(.failure(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import Foundation

// MARK: - WorkoutSessionElement

/// RandomMatching에서 WorkoutSession으로 화면전환 할 때 넘겨주는 데이터 입니다.
struct WorkoutSessionElement {
let startDate: Date
Expand All @@ -17,13 +19,15 @@ struct WorkoutSessionElement {
private let formatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:SS"
formatter.locale = .init(identifier: "ko_KR")
return formatter
}()

/// 스트링으로 데이터를 받았을 때 서버에서 내려준 값이
/// 현재 시간보다 과거거나, 서버에서 내려준 시간이 잘못되었을 경우
/// 현재시간 + 4 초 후에 운동을 시작하는 것으로 세팅했습니다.
init(startDateString: String, peers: [Peer], roomID: String) {
let parseString = startDateString.parseDateString() ?? ""
var date = formatter.date(from: startDateString) ?? .now + 4
if Date.now > date {
date = Date.now + 4
Expand All @@ -39,3 +43,15 @@ struct WorkoutSessionElement {
self.roomID = roomID
}
}

private extension String {
func parseDateString() -> String? {
let input = self
let pattern = /(?:\\)?(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(?:\\)?/

guard let match = input.firstMatch(of: pattern)?.output.1 else {
return nil
}
return .init(match)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ final class WorkoutSelectViewController: UIViewController {
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: makeCollectionViewLayout())
collectionView.register(WorkoutSelectTypeCell.self, forCellWithReuseIdentifier: WorkoutSelectTypeCell.identifier)
collectionView.backgroundColor = UIColor.clear
collectionView.isScrollEnabled = false

collectionView.translatesAutoresizingMaskIntoConstraints = false
return collectionView
Expand Down Expand Up @@ -70,8 +71,7 @@ private extension WorkoutSelectViewController {
trailing: Metrics.cellInsets
)

let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .fractionalWidth(0.55))
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(0.55))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])

let section = NSCollectionLayoutSection(group: group)
Expand All @@ -91,21 +91,22 @@ private extension WorkoutSelectViewController {

view.addSubview(workoutTypesCollectionView)
workoutTypesCollectionView.topAnchor
.constraint(equalTo: workoutSelectDescriptionLabel.bottomAnchor, constant: 12).isActive = true
.constraint(equalTo: workoutSelectDescriptionLabel.bottomAnchor, constant: Metrics.descriptionAndWorkoutCollectionViewSpacing).isActive = true
workoutTypesCollectionView.leadingAnchor
.constraint(equalTo: safeArea.leadingAnchor, constant: ConstraintsGuideLine.value).isActive = true
workoutTypesCollectionView.trailingAnchor
.constraint(equalTo: safeArea.trailingAnchor, constant: -ConstraintsGuideLine.value).isActive = true
workoutTypesCollectionView.bottomAnchor
.constraint(equalTo: view.bottomAnchor, constant: -15).isActive = true
.constraint(equalTo: view.bottomAnchor, constant: Metrics.workoutTypeCollectionViewBottomSpacing).isActive = true

view.addSubview(nextButton)
nextButton.leadingAnchor
.constraint(equalTo: safeArea.leadingAnchor, constant: ConstraintsGuideLine.value).isActive = true
nextButton.trailingAnchor
.constraint(equalTo: safeArea.trailingAnchor, constant: -ConstraintsGuideLine.value).isActive = true
nextButton.bottomAnchor
.constraint(equalTo: safeArea.bottomAnchor, constant: -28).isActive = true
.constraint(equalTo: safeArea.bottomAnchor, constant: Metrics.nextButtonAndBottomAnchorSpacing).isActive = true
nextButton.heightAnchor.constraint(equalToConstant: Metrics.nextButtonHeight).isActive = true
}

func bind() {
Expand All @@ -118,6 +119,13 @@ private extension WorkoutSelectViewController {

enum Metrics {
static let cellInsets: CGFloat = 5

static let descriptionAndWorkoutCollectionViewSpacing: CGFloat = 12

static let workoutTypeCollectionViewBottomSpacing: CGFloat = -15

static let nextButtonAndBottomAnchorSpacing: CGFloat = -28
static let nextButtonHeight: CGFloat = 44
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private extension SignUpProfileViewController {
private extension SignUpProfileViewController {
/// 버튼을 눌렀을 때, 카메라로 찍을지 앨범에서 고를지 선택하기 위한 얼럿
func showAlertSelect() {
let alertVC = UIAlertController(
let actionSheet = UIAlertController(
title: "프로필 이미지 설정",
message: "선택해주세요.",
preferredStyle: .actionSheet
Expand All @@ -271,9 +271,11 @@ private extension SignUpProfileViewController {
let albumAction = UIAlertAction(title: "앨범", style: .default) { [weak self] _ in
self?.albumAuth()
}
alertVC.addAction(cameraAction)
alertVC.addAction(albumAction)
present(alertVC, animated: true, completion: nil)
let cancelAction = UIAlertAction(title: "취소", style: .cancel)
actionSheet.addAction(cameraAction)
actionSheet.addAction(albumAction)
actionSheet.addAction(cancelAction)
present(actionSheet, animated: true, completion: nil)
}

/// 앨범 접근 권한 판별하는 함수
Expand Down Expand Up @@ -369,6 +371,7 @@ extension SignUpProfileViewController: UIImagePickerControllerDelegate {
didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]
) {
do {
// 앨범에서 사진 선택할 때
if let url = info[.imageURL] as? URL {
let imageData = try Data(contentsOf: url)
let image = try imageData.downsampling(size: profileImageButton.profileSize, scale: .x3)
Expand All @@ -377,9 +380,18 @@ extension SignUpProfileViewController: UIImagePickerControllerDelegate {
return
}
imageSetSubject.send(downsampledData)
} else {
// 카메라에서 사진 선택할 때
guard let image = info[.originalImage] as? UIImage else {
return
}
profileImageButton.image = try image.downsampling(size: profileImageButton.profileSize, scale: .x3)
guard let downsampledData = image.pngData() else {
return
}
imageSetSubject.send(downsampledData)
dismiss(animated: true)
}

dismiss(animated: true)
} catch {
Log.make().error("\(error)")
profileImageButton.image = UIImage(systemName: "person.fill")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import Foundation
public final class UserInformationManager {
public static let shared = UserInformationManager()

private init() {
setDefaultsData()
}
private init() {}

private let defaults = UserDefaults.standard
private let dateFormatter = {
Expand Down Expand Up @@ -77,43 +75,3 @@ public extension UserInformationManager {
defaults.setValue(data, forKey: UserInformation.userProfileImageURL.rawValue)
}
}

/// Defaults이미지를 저장합니다.
private extension UserInformationManager {
/// 만약 userDefaults에 값이 존재하지 않는다면 fakeData를 설정합니다.
func setDefaultsData() {
if
data(.userNickName) != nil ||
data(.birthDayDate) != nil ||
data(.userProfileImage) != nil ||
data(.userProfileImageURL) != nil {
return
}

let date = Date.now
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
let dateString = formatter.string(from: date)
let dateData = Data(dateString.utf8)
defaults.setValue(dateData, forKey: UserInformation.birthDayDate.rawValue)

let name = Data("슈퍼맨".utf8)
defaults.setValue(name, forKey: UserInformation.userNickName.rawValue)

let url = URL(string: "https://www.catster.com/wp-content/uploads/2017/08/Pixiebob-cat.jpg")
setUserProfileImageURLString(url: url)

guard
let path = Bundle(for: Self.self).path(forResource: DefaultsKey.imageKey, ofType: DefaultsKey.imageType),
let imageData = try? Data(contentsOf: URL(filePath: path))
else {
return
}
defaults.setValue(imageData, forKey: UserInformation.userProfileImage.rawValue)
}

private enum DefaultsKey {
static let imageKey = "DefaultsProfileImage"
static let imageType = "png"
}
}

0 comments on commit ac3fc98

Please sign in to comment.