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

[refactor] 쪽지 작성 기능 리팩토링 #299 #301

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
32 changes: 20 additions & 12 deletions Happiggy-bank/Happiggy-bank.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class CustomNavigationController: UINavigationController {

private func subscribeToFontPublisher() {
self.cancellable = fontManager.fontPublisher
.receive(on: DispatchQueue.main)
// .receive(on: DispatchQueue.main)
.sink { [weak self] in self?.updateFont(to: $0) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ final class CustomTabBarController: UITabBarController {

private func subscribeToFontPublisher() {
self.cancellable = fontManager.fontPublisher
.receive(on: DispatchQueue.main)
// .receive(on: DispatchQueue.main)
.sink { [weak self] in self?.updateFont(to: $0) }
}

Expand Down
2 changes: 1 addition & 1 deletion Happiggy-bank/Happiggy-bank/Base/UI/View/BaseButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class BaseButton: UIButton {

private func subscribeToFontPublisher() {
self.cancellable = fontManager.fontPublisher
.receive(on: DispatchQueue.main)
// .receive(on: DispatchQueue.main)
.sink { [weak self] in
self?.updateFont(to: $0, isBold: self?.titleLabel?.font.isBold == true)
}
Expand Down
2 changes: 1 addition & 1 deletion Happiggy-bank/Happiggy-bank/Base/UI/View/BaseLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class BaseLabel: UILabel {

private func subscribeToFontPublisher() {
self.cancellable = fontManager.fontPublisher
.receive(on: DispatchQueue.main)
// .receive(on: DispatchQueue.main)
.sink { [weak self] in self?.updateFont(to: $0, isBold: self?.font.isBold == true) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class BaseTextField: UITextField {

private func subscribeToFontPublisher() {
self.cancellable = fontManager.fontPublisher
.receive(on: DispatchQueue.main)
// .receive(on: DispatchQueue.main)
.sink { [weak self] in self?.updateFont(to: $0, isBold: self?.font?.isBold == true) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class BaseTextView: UITextView {

private func subscribeToFontPublisher() {
self.cancellable = fontManager.fontPublisher
.receive(on: DispatchQueue.main)
// .receive(on: DispatchQueue.main)
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 updateFont(to:isBold:) 함수에서 UIFont(name: .system)이 없는건 아닐까요?
아니면 fontManager가 싱글턴이니까 상위 뷰에서 먼저 설정되어야 하는 부분을 건너뛰어서 여기서 크래시가 나는 것은 아닌가 합니다!
만약 저 객체 자체가 뭔가 이니셜라이징이 제대로 안 되어있으면 전체 뷰에서 문제가 날 수도 있겠다는 생각이 듭니당

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 한번 확인해보고 말씀드릴게요!

.sink { [weak self] in self?.updateFont(to: $0, isBold: self?.font?.isBold == true) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ final class HomeTabViewController: UIViewController {
}

if bottle.isEmtpyToday {
// NewNoteTextViewController
// NewNoteInputViewController
let viewModel = NewNoteInputViewModel(date: Date(), bottle: bottle)
self.navigationController?.pushViewControllerWithFade(
to: UIViewController().then { $0.view.backgroundColor = .gray }
to: NewNoteInputViewController(viewModel: viewModel)
)
} else {
// NewNoteDatePickerViewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,7 @@ final class HomeViewController: UIViewController {
let viewModel = NewNoteDatePickerViewModel(initialDate: Date(), bottle: bottle)
dateViewController.viewModel = viewModel
}
if segue.identifier == SegueIdentifier.presentNewNoteTextView {
guard let textViewController = segue.destination as? NewNoteTextViewController,
let bottle = self.viewModel.bottle
else { return }

let viewModel = NewNoteTextViewModel(date: Date(), bottle: bottle)
textViewController.viewModel = viewModel
}

if segue.identifier == SegueIdentifier.presentBottleMessageView {
guard let bottleMessageController = segue.destination as? BottleMessageViewController,
let (fakeBackground, bottle) = sender as? (UIView, Bottle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ final class NewNoteDatePickerViewController: UIViewController {

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == SegueIdentifier.presentNewNoteTextViewFromDatePicker {

guard let textViewController = segue.destination as? NewNoteTextViewController
else { return }

let viewModel = NewNoteTextViewModel(date: self.viewModel.selectedDate, bottle: self.viewModel.bottle)
textViewController.viewModel = viewModel
//
// guard let textViewController = segue.destination as? NewNoteTextViewController
// else { return }
//
// let viewModel = NewNoteTextViewModel(date: self.viewModel.selectedDate, bottle: self.viewModel.bottle)
// textViewController.viewModel = viewModel
}
}
}
Expand Down
Loading