Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] #265 - fastlane & 유저 QA 진행 #267

Merged
merged 8 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ Dependencies/
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots/**/*.png
**/fastlane/screenshots/
**/fastlane/BuildOutputs
**/fastlane/metadata
**/fastlane/Deliverfile


**/fastlane/.env.default

Expand Down
4 changes: 2 additions & 2 deletions Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1703,7 +1703,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2024.0319.2120;
CURRENT_PROJECT_VERSION = 2024.0402.1647;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8Q4H7X3Q58;
GENERATE_INFOPLIST_FILE = NO;
Expand Down Expand Up @@ -1747,7 +1747,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2024.0319.2120;
CURRENT_PROJECT_VERSION = 2024.0402.1647;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8Q4H7X3Q58;
GENERATE_INFOPLIST_FILE = NO;
Expand Down
57 changes: 34 additions & 23 deletions Runnect-iOS/Runnect-iOS/Global/Utils/Toast.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
// Toast.swift
// Runnect-iOS
//
// Created by sejin on 2022/12/31.
// Created by 이명진 on 2024/03/25.
//

import UIKit

import SnapKit
import Then

public extension UIViewController {
func showToast(message: String) {
Toast.show(message: message, view: self.view, safeAreaBottomInset: self.safeAreaBottomInset())
func showToast(message: String, heightOffset: CGFloat = 0) {
Toast.show(
message: message,
view: self.view,
safeAreaBottomInset: self.safeAreaBottomInset(),
heightOffset: heightOffset
)
}

func showNetworkFailureToast() {
Expand All @@ -20,34 +26,39 @@ public extension UIViewController {
}

public class Toast {
public static func show(message: String, view: UIView, safeAreaBottomInset: CGFloat = 0) {

let toastContainer = UIView()
let toastLabel = UILabel()

toastContainer.backgroundColor = UIColor.g2.withAlphaComponent(0.7)
toastContainer.alpha = 1.0
toastContainer.layer.cornerRadius = 15
toastContainer.clipsToBounds = true
toastContainer.isUserInteractionEnabled = false
public static func show(
message: String,
view: UIView,
safeAreaBottomInset: CGFloat = 0,
heightOffset: CGFloat = 0
) {
let toastContainer = UIView().then {
$0.backgroundColor = UIColor.g2.withAlphaComponent(0.7)
$0.alpha = 1.0
$0.layer.cornerRadius = 15
$0.clipsToBounds = true
$0.isUserInteractionEnabled = false
}

toastLabel.textColor = .m4
toastLabel.font = .b4
toastLabel.textAlignment = .center
toastLabel.text = message
toastLabel.clipsToBounds = true
toastLabel.numberOfLines = 0
toastLabel.sizeToFit()
let toastLabel = UILabel().then {
$0.textColor = .m4
$0.font = .b4
$0.textAlignment = .center
$0.text = message
$0.clipsToBounds = true
$0.numberOfLines = 0
$0.sizeToFit()
}

toastContainer.addSubview(toastLabel)
view.addSubview(toastContainer)

let toastConatinerWidth = toastLabel.intrinsicContentSize.width + 40.0
let toastContainerWidth = toastLabel.intrinsicContentSize.width + 40.0

toastContainer.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.bottom.equalToSuperview().inset(safeAreaBottomInset+160)
$0.width.equalTo(toastConatinerWidth)
$0.bottom.equalToSuperview().inset(safeAreaBottomInset + 160 + heightOffset)
$0.width.equalTo(toastContainerWidth)
$0.height.equalTo(31)
}

Expand Down
4 changes: 2 additions & 2 deletions Runnect-iOS/Runnect-iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>2.0.2</string>
<string>2.0.3</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -46,7 +46,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>2024.0319.2120</string>
<string>2024.0402.1647</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>kakaokompassauth</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CourseUploadVC: UIViewController {
}
private let distanceInfoView = CourseDetailInfoView(title: "거리", description: "0.0km")
private let departureInfoView = CourseDetailInfoView(title: "출발지", description: "")
private let placeholder = "코스에 대한 소개를 적어주세요.(난이도/풍경/지형)"
private let placeholder = "코스에 대한 소개를 적어주세요.(난이도/풍경/지형)\n(최대 150자)"

let activityTextView = UITextView().then {
$0.font = .b4
Expand All @@ -61,11 +61,10 @@ class CourseUploadVC: UIViewController {
setNavigationBar()
setUI()
setLayout()
setupTextView()
setDelegate()
setAddTarget()
setKeyboardNotification()
setTapGesture()
addKeyboardObserver()
setKeyboardObservers()
analyze(screenName: GAEvent.View.viewCourseUpload)
}

Expand Down Expand Up @@ -107,29 +106,21 @@ extension CourseUploadVC {
self.uploadButton.addTarget(self, action: #selector(uploadButtonDidTap), for: .touchUpInside)
}

// 키보드가 올라오면 scrollView 위치 조정
private func setKeyboardNotification() {
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillShow),
name: UIResponder.keyboardWillShowNotification,
object: nil)

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

// 화면 터치 시 키보드 내리기
private func setTapGesture() {
let tap = UITapGestureRecognizer(target: view, action: #selector(UIView.endEditing))
tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
}

private func addKeyboardObserver() {
// 업로드 버튼 상태 업데이트 메소드
private func updateUploadButtonState() {
let isTitleNotEmpty = !(courseTitleTextField.text?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ?? true)
let isContentNotEmptyAndNotPlaceholder = !(activityTextView.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || activityTextView.text == placeholder)
uploadButton.setEnabled(isTitleNotEmpty && isContentNotEmptyAndNotPlaceholder)
}
Comment on lines +117 to +121
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

업데이트 메소드 따로 빼둔거 확인했습니다~
textfield랑 textview 모두 개행 문자를 제거했을때 글자가 있고, 그 글자가 placeholder와 다른 경우 업로드 버튼 활성화로 이해했는데 맞을까요 ?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞아요!
코드를 조금 해석해보자면,

예를 들어 제목 같은 경우 text 가 nil 이면 !true를 리턴하여 최종적으로 false가 됩니다.
text가 있다면 텍스트 가 있기때문에 항상 !false 즉 최종적으로 true가 됩니다.

내용 같은 경우도 개행문자 제거했을 때 activityTextView가 비어있거나 || 플레이스 홀더 텍스트와 같은지 검사하여
필드가 비어있지 않고, 플레이스 홀더와 다를 경우 true 그렇지 않으면 false를 리턴합니다!


private func setKeyboardObservers() {
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardWillShow),
Expand All @@ -146,19 +137,7 @@ extension CourseUploadVC {

extension CourseUploadVC {
@objc private func textFieldTextDidChange() {
guard let text = courseTitleTextField.text else { return }

if text.count > courseTitleMaxLength {
let index = text.index(text.startIndex, offsetBy: courseTitleMaxLength)
let newString = text[text.startIndex..<index]
self.courseTitleTextField.text = String(newString)
}

if text.count == 0 && activityTextView.text != self.placeholder && activityTextView.text.count == 0 {
uploadButton.setEnabled(true)
} else {
uploadButton.setEnabled(false)
}
updateUploadButtonState()
}

@objc private func keyboardWillShow(_ notification: Notification) {
Expand All @@ -175,11 +154,12 @@ extension CourseUploadVC {
scrollView.contentInset = contentInset
scrollView.scrollIndicatorInsets = contentInset

if activityTextView.isFirstResponder {
// scrollView 높이 설정
if courseTitleTextField.isFirstResponder || activityTextView.isFirstResponder {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

textView 누를때도 position 조정하신거 좋네요 !!!

let contentViewHeight = scrollView.contentSize.height
let textViewHeight = activityTextView.frame.height
let textViewOffsetY = contentViewHeight - (contentInset.bottom + textViewHeight)
let position = CGPoint(x: 0, y: textViewOffsetY + 100)
let position = CGPoint(x: 0, y: textViewOffsetY + 50)
scrollView.setContentOffset(position, animated: true)
return
}
Expand All @@ -198,28 +178,29 @@ extension CourseUploadVC {
}
}

// MARK: - naviVar Layout

extension CourseUploadVC {

// MARK: - naviVar Layout

private func setNavigationBar() {
view.addSubview(navibar)
navibar.snp.makeConstraints {
$0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide)
$0.height.equalTo(48)
}
}
// MARK: - setUI
// MARK: - UI & Layout

private func setUI() {
view.backgroundColor = .w1
scrollView.backgroundColor = .clear
buttonContainerView.backgroundColor = .w1
mapImageView.backgroundColor = .systemGray4

activityTextView.text = placeholder
activityTextView.textColor = .g3
}

// MARK: - Layout Helpers

private func setLayout() {
view.addSubview(buttonContainerView)
view.bringSubviewToFront(uploadButton)
Expand All @@ -241,14 +222,15 @@ extension CourseUploadVC {

private func setScrollViewLayout() {
view.addSubview(scrollView)
[mapImageView,
courseTitleTextField,
dividerView,
distanceInfoView,
departureInfoView,
activityTextView].forEach {
scrollView.addSubview($0)
}

scrollView.addSubviews(
mapImageView,
courseTitleTextField,
dividerView,
distanceInfoView,
departureInfoView,
activityTextView
)

scrollView.snp.makeConstraints {
$0.top.equalTo(navibar.snp.bottom)
Expand Down Expand Up @@ -294,13 +276,14 @@ extension CourseUploadVC {
}
}

func setupTextView() {
func setDelegate() {
activityTextView.delegate = self
activityTextView.text = placeholder
activityTextView.textColor = .g3
courseTitleTextField.delegate = self
}
}

// MARK: - UITextViewDelegate

extension CourseUploadVC: UITextViewDelegate {
func textViewDidBeginEditing(_ textView: UITextView) {
if textView.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
Expand All @@ -314,16 +297,13 @@ extension CourseUploadVC: UITextViewDelegate {
}

func textViewDidChange(_ textView: UITextView) {
if !courseTitleTextField.isEmpty && !activityTextView.text.isEmpty {
uploadButton.setEnabled(true)
} else {
uploadButton.setEnabled(false)
}
updateUploadButtonState()

if activityTextView.text.count > 150 {
activityTextView.deleteBackward()
}
}

func textViewDidEndEditing(_ textView: UITextView) {
if textView.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || textView.text == placeholder {
activityTextView.textColor = .g3
Expand All @@ -332,6 +312,18 @@ extension CourseUploadVC: UITextViewDelegate {
}
}

// MARK: - UITextFieldDelegate

extension CourseUploadVC: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if textField == courseTitleTextField {
activityTextView.becomeFirstResponder()
return true
}
return false
}
}

// MARK: - Network

extension CourseUploadVC {
Expand Down
Loading