Skip to content

[IDLE-000] relase1.0.1 배포심사 과정에서의 수정사항을 develop에 반영 #76

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

Merged
merged 6 commits into from
Sep 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public enum IdleInfoPlist {

"CFBundleDisplayName": "$(BUNDLE_DISPLAY_NAME)",

"CFBundleShortVersionString" : "0.0.4",
"CFBundleShortVersionString" : "1.0.1",

"NSAppTransportSecurity" : [
"NSAllowsArbitraryLoads" : true
Expand Down
1 change: 0 additions & 1 deletion project/Projects/App/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extension RcruitmentPostAPI: BaseAPI {
case .addFavoritePost(let id, _):
"/\(id)/favorites"
case .removeFavoritePost(let id):
"/\(id)/favorites"
"/\(id)/remove-favorites"
}
}

Expand Down
17 changes: 6 additions & 11 deletions project/Projects/Presentation/DSKit/Sources/CommonUI/IFType2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public class IFType2: UIStackView {
public var eventPublisher: Observable<String> { self.idleTextField.eventPublisher }

// View
public private(set) lazy var titleLabel: ResizableUILabel = {
let label = ResizableUILabel()
label.text = self.titleLabelText
label.font = DSKitFontFamily.Pretendard.bold.font(size: 14)
label.textColor = DSKitAsset.Colors.gray500.color
public private(set) lazy var titleLabel: IdleLabel = {
let label = IdleLabel(typography: .Subtitle4)
label.textString = self.titleLabelText
label.attrTextColor = DSKitAsset.Colors.gray500.color
label.textAlignment = .left
return label
}()

Expand Down Expand Up @@ -66,7 +66,7 @@ public class IFType2: UIStackView {

func setStack() {

self.alignment = .leading
self.alignment = .fill
self.axis = .vertical
self.spacing = 6.0
}
Expand All @@ -79,11 +79,6 @@ public class IFType2: UIStackView {
].forEach {
self.addArrangedSubview($0)
}

NSLayoutConstraint.activate([
idleTextField.leftAnchor.constraint(equalTo: self.leftAnchor),
idleTextField.rightAnchor.constraint(equalTo: self.rightAnchor),
])
}

public override func resignFirstResponder() -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class TextFieldWithDegree: UIView {
}()
public lazy var textField: IdleTextField = {
let field = IdleTextField(typography: .Body2)
field.textFieldInsets = .zero
field.textString = initialText
return field
}()
Expand Down Expand Up @@ -63,23 +62,33 @@ public class TextFieldWithDegree: UIView {
self.layer.borderColor = DSKitAsset.Colors.gray100.color.cgColor
self.layer.borderWidth = 1.0
self.layer.cornerRadius = 6.0
self.layoutMargins = .init(top: 10, left: 16, bottom: 10, right: 16)
}

private func setLayout() {

let textFieldWrapper = UIView()
textFieldWrapper.addSubview(textField)
textField.translatesAutoresizingMaskIntoConstraints = false

let stack = HStack(
[
textField,
degreeLabel
textFieldWrapper,
degreeLabel,
],
spacing: 6,
alignment: .center,
distribution: .fill
)
textField.setContentHuggingPriority(.defaultLow, for: .horizontal)

textFieldWrapper.setContentHuggingPriority(.defaultLow, for: .horizontal)
textFieldWrapper.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)

textField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)

degreeLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
degreeLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)


[
stack
].forEach {
Expand All @@ -88,10 +97,16 @@ public class TextFieldWithDegree: UIView {
}

NSLayoutConstraint.activate([
stack.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor),
stack.leadingAnchor.constraint(equalTo: self.layoutMarginsGuide.leadingAnchor),
stack.trailingAnchor.constraint(equalTo: self.layoutMarginsGuide.trailingAnchor),
stack.bottomAnchor.constraint(equalTo: self.layoutMarginsGuide.bottomAnchor),

textFieldWrapper.heightAnchor.constraint(equalToConstant: 44),
textField.centerYAnchor.constraint(equalTo: textFieldWrapper.centerYAnchor),
textField.leftAnchor.constraint(equalTo: textFieldWrapper.leftAnchor),
textField.rightAnchor.constraint(equalTo: textFieldWrapper.rightAnchor),

stack.topAnchor.constraint(equalTo: self.topAnchor),
stack.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 16),
stack.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -16),
stack.bottomAnchor.constraint(equalTo: self.bottomAnchor),
])

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ public class IdleOneLineInputField: UIView {
self.addSubview($0)
}

let textFieldWrapper = UIView()
textFieldWrapper.addSubview(textField)
textField.translatesAutoresizingMaskIntoConstraints = false

[
textField,
textFieldWrapper,
clearButton,
completeImage,
].forEach {
Expand All @@ -147,6 +151,10 @@ public class IdleOneLineInputField: UIView {
completeImage.setContentCompressionResistancePriority(.init(751), for: .horizontal)

NSLayoutConstraint.activate([
textFieldWrapper.heightAnchor.constraint(equalToConstant: 44),
textField.centerYAnchor.constraint(equalTo: textFieldWrapper.centerYAnchor),
textField.leftAnchor.constraint(equalTo: textFieldWrapper.leftAnchor, constant: 16),
textField.rightAnchor.constraint(equalTo: textFieldWrapper.rightAnchor, constant: -24),

stack.topAnchor.constraint(equalTo: self.layoutMarginsGuide.topAnchor),
stack.leadingAnchor.constraint(equalTo: self.layoutMarginsGuide.leadingAnchor),
Expand Down Expand Up @@ -315,7 +323,7 @@ public extension IdleOneLineInputField {
timerLabel.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
timerLabel.heightAnchor.constraint(equalTo: textField.heightAnchor),
timerLabel.centerYAnchor.constraint(equalTo: textField.centerYAnchor),
])

self.timerLabel = timerLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@ import PresentationCore
/// 기본이 되는 텍스트 필드입니다.
public class IdleTextField: UITextField {

private var currentTypography: Typography
private var currentTypography: Typography!
private var currentText: String = ""
private var currentTextFieldInsets: UIEdgeInsets = .init(
top: 10,
left: 16,
bottom: 10,
right: 24
)
public var textString: String {
get {
return currentText
Expand All @@ -32,11 +26,9 @@ public class IdleTextField: UITextField {

public init(typography: Typography) {

self.currentTypography = typography

super.init(frame: .zero)

self.defaultTextAttributes = typography.attributes
self.typography = typography

self.autocorrectionType = .no
// 첫 글자 자동 대문자화 끄기
Expand All @@ -47,6 +39,14 @@ public class IdleTextField: UITextField {
addToolbar()
}

// public override var intrinsicContentSize: CGSize {
//
// return .init(
// width: super.intrinsicContentSize.width,
// height: typography.lineHeight ?? super.intrinsicContentSize.height
// )
// }

public required init?(coder: NSCoder) { fatalError() }

public func addToolbar() {
Expand Down Expand Up @@ -84,58 +84,24 @@ public class IdleTextField: UITextField {
}
set {
currentTypography = newValue
defaultTextAttributes = currentTypography.attributes
defaultTextAttributes = currentTypography.attributesWithoutLineHeightInset
self.updateText()
}
}

public var textFieldInsets: UIEdgeInsets {

get {
currentTextFieldInsets
}
set {
currentTextFieldInsets = newValue
self.setNeedsLayout()
}
}

public var attrPlaceholder: String {

get {
attributedPlaceholder?.string ?? ""
}
set {
attributedPlaceholder = currentTypography.attributes.toString(
attributedPlaceholder = currentTypography.attributesWithoutLineHeightInset.toString(
newValue,
with: DSKitAsset.Colors.gray200.color
)
}
}
private func updateText() {
self.rx.attributedText.onNext(NSAttributedString(string: textString, attributes: currentTypography.attributes))
}
}


public extension IdleTextField {

// 텍스트 영역의 프레임을 반환
override func textRect(forBounds bounds: CGRect) -> CGRect {
setInset(bounds: bounds)
}

// 편집 중일 때 텍스트 영역의 프레임을 반환
override func editingRect(forBounds bounds: CGRect) -> CGRect {
setInset(bounds: bounds)
}

// 플레이스홀더 텍스트 영역의 프레임을 반환
override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
setInset(bounds: bounds)
}

private func setInset(bounds: CGRect) -> CGRect {
bounds.inset(by: currentTextFieldInsets)
self.rx.attributedText.onNext(NSAttributedString(string: textString, attributes: currentTypography.attributesWithoutLineHeightInset))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ public enum Typography {
}
}

public var attributesWithoutLineHeightInset: Attrubutes {
var attrs = attributes
(attrs[.paragraphStyle] as? NSMutableParagraphStyle)?.minimumLineHeight = 0
(attrs[.paragraphStyle] as? NSMutableParagraphStyle)?.maximumLineHeight = 0
attrs[.baselineOffset] = 0
return attrs
}

public var attributes: Attrubutes {

switch self {
Expand Down
Loading