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

[#282] 내정보-설정 플로우 디자인 1차 QA 반영 #363

Closed
wants to merge 11 commits into from
Closed
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ final class EditNicknameViewController: UIViewController, EditNicknameProtocol {
var nickname: String?
let editNicknameManager: AccountServiceable = AccountManager(apiService: APIManager(), environment: .development)

private var isNickNameRight: Bool = false
private var isNickNameRight: Bool = true

private var isDuplicationChecked: Bool = false

private var isKeyboardOn: Bool = false
Expand Down Expand Up @@ -45,19 +46,25 @@ final class EditNicknameViewController: UIViewController, EditNicknameProtocol {

// MARK: Functions
private func addTargetToTextField() {
nickNameTextField.addTarget(self, action: #selector(self.activateTextField), for: .editingChanged)
nickNameTextField.addTarget(self, action: #selector(self.activateTextField), for: .editingDidBegin)
nickNameTextField.addTarget(self, action: #selector(self.changeTextFieldWhileEditing), for: .editingChanged)
nickNameTextField.addTarget(self, action: #selector(self.inactivateTextField), for: .editingDidEnd)
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
}

// MARK: 텍스트필드 관련
@objc private func activateTextField() {
changeTextFieldBorder()
}
@objc private func changeTextFieldWhileEditing() {
initializeDuplicationCheck()
limitNicknameText()
checkIsNicknameRight()
changeTextFieldBorder()
showWarning()
enableDuplicationCheckButton()
enableConfirmButton()
}
private func initializeDuplicationCheck() {
isDuplicationChecked = false
Expand All @@ -67,29 +74,35 @@ final class EditNicknameViewController: UIViewController, EditNicknameProtocol {
nickNameTextField.deleteBackward()
}
}
private func changeTextFieldBorder() {
nickNameTextFieldView.layer.borderColor = isNickNameRight || !nickNameTextField.hasText ? Color.gray600.cgColor : Color.pillColorRed.cgColor
}

private func checkIsNicknameRight() {
isNickNameRight = checkNicknameRegularExpression(input: nickNameTextField.text ?? "")
}
private func checkNicknameRegularExpression (input: String) -> Bool {
// 닉네임 조건 : [영문, 한글, 공백, 숫자] 2~10글자
let validNickName = "[가-힣0-9a-zA-Z ]{2,10}"
// 닉네임 조건 : [영문, 한글, 숫자] 2~10글자
let validNickName = "[가-힣0-9a-zA-Z]{2,10}"
let nickNameTest = NSPredicate(format: "SELF MATCHES %@", validNickName)
return nickNameTest.evaluate(with: input)
}
private func showWarning() {
warningTextLabel.isHidden = isNickNameRight || !nickNameTextField.hasText
nickNameTextFieldView.layer.borderColor = isNickNameRight || !nickNameTextField.hasText ? Color.gray600.cgColor : Color.pillColorRed.cgColor
}

@objc private func inactivateTextField() {
nickNameTextFieldView.makeRoundedWithBorder(radius: 12, color: Color.gray300.cgColor)
nickNameTextFieldView.layer.borderColor = isNickNameRight || !nickNameTextField.hasText ? Color.gray300.cgColor : Color.pillColorRed.cgColor
}

// MARK: 버튼 활성화 관련
private func enableDuplicationCheckButton() {
checkDuplicationButton.isEnabled = isNickNameRight
checkDuplicationButtonBottomLine.backgroundColor = isNickNameRight ? UIColor(cgColor: Color.darkMint.cgColor) : UIColor(cgColor: Color.gray400.cgColor)
}
private func enableConfirmButton() {
confirmButton.isEnabled = isNickNameRight
}

// MARK: 토스트메세지 관련
private func showToast(message: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<action selector="touchUpToDIsmiss:" destination="-1" eventType="touchUpInside" id="qYd-VR-wwf"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PIT-Sg-ahT">
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PIT-Sg-ahT">
<rect key="frame" x="355.5" y="23.5" width="48.5" height="31"/>
<color key="tintColor" name="mint_main"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
Expand Down Expand Up @@ -114,7 +114,7 @@
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1U0-6a-I2c" userLabel="밑줄">
<rect key="frame" x="342" y="244" width="52" height="1"/>
<color key="backgroundColor" name="gray500_sub"/>
<color key="backgroundColor" name="gray400_sub"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Mn6-PL-41z"/>
</constraints>
Expand Down Expand Up @@ -149,8 +149,8 @@
<namedColor name="dark_mint_main">
<color red="0.0" green="0.6705882352941176" blue="0.71372549019607845" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="gray500_sub">
<color red="0.63137254901960782" green="0.66274509803921566" blue="0.68235294117647061" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<namedColor name="gray400_sub">
<color red="0.76078431372549016" green="0.78823529411764703" blue="0.80784313725490198" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="gray900_sub">
<color red="0.20000000000000001" green="0.21568627450980393" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<color key="textColor" name="black_sub"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icMoreBlack48" translatesAutoresizingMaskIntoConstraints="NO" id="gYA-cZ-Evs">
<rect key="frame" x="338" y="0.0" width="48" height="48"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_more_48_gray500" translatesAutoresizingMaskIntoConstraints="NO" id="gYA-cZ-Evs">
<rect key="frame" x="337.5" y="0.0" width="48.5" height="48"/>
<color key="tintColor" name="gray500_sub"/>
</imageView>
</subviews>
Expand Down Expand Up @@ -106,8 +106,8 @@
<color key="textColor" name="black_sub"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icMoreBlack48" translatesAutoresizingMaskIntoConstraints="NO" id="MlR-lQ-UGR">
<rect key="frame" x="338" y="0.0" width="48" height="48"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_more_48_gray500" translatesAutoresizingMaskIntoConstraints="NO" id="MlR-lQ-UGR">
<rect key="frame" x="337.5" y="0.0" width="48.5" height="48"/>
<color key="tintColor" name="gray500_sub"/>
</imageView>
</subviews>
Expand Down Expand Up @@ -141,8 +141,8 @@
<color key="textColor" name="black_sub"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icMoreBlack48" translatesAutoresizingMaskIntoConstraints="NO" id="sSx-g7-Kzg">
<rect key="frame" x="338" y="0.0" width="48" height="48"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_more_48_gray500" translatesAutoresizingMaskIntoConstraints="NO" id="sSx-g7-Kzg">
<rect key="frame" x="337.5" y="0.0" width="48.5" height="48"/>
<color key="tintColor" name="gray500_sub"/>
</imageView>
</subviews>
Expand Down Expand Up @@ -174,7 +174,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ad6-yu-mXo">
<rect key="frame" x="21" y="325" width="82" height="31"/>
<rect key="frame" x="21" y="317" width="82" height="31"/>
<fontDescription key="fontDescription" name="Pretendard-Medium" family="Pretendard" pointSize="15"/>
<color key="tintColor" name="gray500_sub"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
Expand All @@ -194,7 +194,7 @@
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="nwT-CY-jb6" secondAttribute="trailing" id="Ger-6a-gtj"/>
<constraint firstItem="1K1-9Y-4xX" firstAttribute="leading" secondItem="2Rh-si-K2R" secondAttribute="leading" id="bbu-Vq-K0i"/>
<constraint firstItem="ad6-yu-mXo" firstAttribute="leading" secondItem="2Rh-si-K2R" secondAttribute="leading" id="fuj-Lr-K4R"/>
<constraint firstItem="ad6-yu-mXo" firstAttribute="top" secondItem="1K1-9Y-4xX" secondAttribute="bottom" constant="8" id="i27-vp-y67"/>
<constraint firstItem="ad6-yu-mXo" firstAttribute="top" secondItem="1K1-9Y-4xX" secondAttribute="bottom" id="i27-vp-y67"/>
<constraint firstItem="1K1-9Y-4xX" firstAttribute="top" secondItem="2Rh-si-K2R" secondAttribute="bottom" constant="16" id="kKn-Sk-9I0"/>
<constraint firstItem="2Rh-si-K2R" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="20.809999999999999" id="lyC-0I-S3d"/>
<constraint firstItem="2Rh-si-K2R" firstAttribute="top" secondItem="nwT-CY-jb6" secondAttribute="bottom" constant="8" id="mvs-Fj-Tzn"/>
Expand All @@ -205,7 +205,7 @@
</objects>
<resources>
<image name="icBack48" width="48" height="48"/>
<image name="icMoreBlack48" width="48" height="48"/>
<image name="ic_more_48_gray500" width="48.5" height="48"/>
<namedColor name="black_sub">
<color red="0.12156862745098039" green="0.12549019607843137" blue="0.13333333333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icMoreBlack48" translatesAutoresizingMaskIntoConstraints="NO" id="7m7-yg-Svd">
<rect key="frame" x="338" y="0.0" width="48" height="48"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_more_48_gray500" translatesAutoresizingMaskIntoConstraints="NO" id="7m7-yg-Svd">
<rect key="frame" x="337.5" y="0.0" width="48.5" height="48"/>
<color key="tintColor" name="gray500_sub"/>
</imageView>
</subviews>
Expand Down Expand Up @@ -102,8 +102,8 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icMoreBlack48" translatesAutoresizingMaskIntoConstraints="NO" id="d94-ra-Ddv">
<rect key="frame" x="338" y="0.0" width="48" height="48"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_more_48_gray500" translatesAutoresizingMaskIntoConstraints="NO" id="d94-ra-Ddv">
<rect key="frame" x="337.5" y="0.0" width="48.5" height="48"/>
<color key="tintColor" name="gray500_sub"/>
</imageView>
</subviews>
Expand Down Expand Up @@ -138,7 +138,7 @@
</objects>
<resources>
<image name="icBack48" width="48" height="48"/>
<image name="icMoreBlack48" width="48" height="48"/>
<image name="ic_more_48_gray500" width="48.5" height="48"/>
<namedColor name="gray500_sub">
<color red="0.63137254901960782" green="0.66274509803921566" blue="0.68235294117647061" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

import UIKit

import Then
import SnapKit

protocol WitrhdrawalProtocol: StyleProtocol, DelegationProtocol {}

final class WithdrawalViewController: UIViewController, WitrhdrawalProtocol {
Copy link
Member

Choose a reason for hiding this comment

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

방금 제가 머지하고 지금 여기서 컨플릭트가 났는데...!

WithdrawViewController 에 탈퇴, 카운팅 관련 코드만 추가했고 xib 파일은 안 건드려서...

컨플릭트 반영할 때 QA 디자인 반영하신 xib만 넣으면 될 것 같아요 !!

Copy link
Member

Choose a reason for hiding this comment

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

TermsAndPolicesVC도 마찬가지!!

Copy link
Member

Choose a reason for hiding this comment

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

@seondal 이 부분 확인부탁드려요


@IBOutlet weak var reasonTextLabel: UILabel!
@IBOutlet weak var reasonView: UIView!
@IBOutlet weak var reasonTextView: UITextView!
@IBOutlet weak var reasonTextCounter: UILabel!
Expand All @@ -24,12 +29,18 @@ final class WithdrawalViewController: UIViewController, WitrhdrawalProtocol {
func style () {
reasonView.makeRoundedWithBorder(radius: 12, color: Color.gray300.cgColor)
witrhdrawButton.makeRounded(radius: 12)

let attrString = NSMutableAttributedString(string: reasonTextLabel.text!)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = 21
attrString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSMakeRange(0, attrString.length))
reasonTextLabel.attributedText = attrString
}

func assignDelegation() {
reasonTextView.delegate = self
}

@IBAction func backToSettingVC(_ sender: UIButton) {
navigationController?.popViewController(animated: true)
}
Expand All @@ -46,7 +57,9 @@ extension WithdrawalViewController: UITextViewDelegate {
textView.textColor = UIColor(cgColor: Color.black.cgColor)
}
}

func textViewDidChange(_ textView: UITextView) {
reasonTextCounter.text = "\(reasonTextView.text.count)/2000"
}
func textViewDidEndEditing(_ textView: UITextView) {
if textView.text.isEmpty {
textView.text = "적어주시는 여러분의 소중한 의견은 서비스 개선에 큰 도움이 되어요:)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WithdrawalViewController" customModule="SobokSobok" customModuleProvider="target">
<connections>
<outlet property="reasonTextCounter" destination="kxu-mc-H2w" id="AeQ-3W-WDm"/>
<outlet property="reasonTextLabel" destination="LwO-Pg-q1O" id="n6I-po-q0X"/>
<outlet property="reasonTextView" destination="xPA-5g-0pS" id="iIL-nX-Lie"/>
<outlet property="reasonView" destination="K07-88-GBF" id="Alc-kH-Nfy"/>
<outlet property="reasonView" destination="K07-88-GBF" id="aXc-XI-Ori"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
<outlet property="witrhdrawButton" destination="Xmm-of-TIK" id="C75-Od-Qts"/>
</connections>
Expand Down Expand Up @@ -64,7 +65,7 @@
<color key="textColor" name="black_sub"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="탈퇴하면 그 동안의 복약기록와 
받은 스티커를 포함한 모든 정보가 사라져요 " lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LwO-Pg-q1O">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="탈퇴하면 그 동안의 복약기록과
받은 스티커를 포함한 모든 정보가 사라져요 " lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LwO-Pg-q1O" userLabel="탈퇴하면 그 동안의 복약기록과 받은 스티커를 포함한 모든 정보가 사라져요">
<rect key="frame" x="20" y="144" width="252" height="36.5"/>
<fontDescription key="fontDescription" name="Pretendard-Medium" family="Pretendard" pointSize="15"/>
<color key="textColor" name="gray500_sub"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ final class SetNickNameVIewController: UIViewController, SetNicknameProtocol {
isNickNameRight = checkNicknameRegularExpression(input: nickNameTextField.text ?? "")
}
private func checkNicknameRegularExpression (input: String) -> Bool {
// 닉네임 조건 : [영문, 한글, 공백, 숫자] 2~10글자
let validNickName = "[가-힣0-9a-zA-Z ]{2,10}"
// 닉네임 조건 : [영문, 한글, 숫자] 2~10글자
let validNickName = "[가-힣0-9a-zA-Z]{2,10}"
let nickNameTest = NSPredicate(format: "SELF MATCHES %@", validNickName)
return nickNameTest.evaluate(with: input)
}
Expand All @@ -119,7 +119,6 @@ final class SetNickNameVIewController: UIViewController, SetNicknameProtocol {
}

@objc private func inactivateTextField() {
warningTextLabel.isHidden = isNickNameRight || !nickNameTextField.hasText
nickNameTextFieldView.layer.borderColor = isNickNameRight || !nickNameTextField.hasText ? Color.gray300.cgColor : Color.pillColorRed.cgColor
}

Expand Down
Loading