Skip to content

[Feat] EmptyView 및 LoadingView 추가 & 세부레이아웃 수정#116

Merged
Suyeon9911 merged 8 commits intodevelopfrom
feature/#97-home-refactor
Jan 15, 2023
Merged

[Feat] EmptyView 및 LoadingView 추가 & 세부레이아웃 수정#116
Suyeon9911 merged 8 commits intodevelopfrom
feature/#97-home-refactor

Conversation

@Suyeon9911
Copy link
Copy Markdown
Member

@Suyeon9911 Suyeon9911 commented Jan 11, 2023

👻 작업한 내용

  • 홈 뷰에 로딩뷰를 추가하였습니다
  • 홈 뷰에 기록이 없을 때 엠티뷰를 추가하였습니다.
  • 홈 뷰에 세부 레이아웃 설정을 하였습니다. kernalValue를 지정해주기 위해서는 글자가 들어온 이후에 처리해야줘야 적용이 되기 때문에 setData 메서드 안에 추가해주었는데, 그러다보니 자동으로 추가 글을 축약해서 ...으로 표시해주는 기능이 안되네요 ! 이 부분은 다른 방법을 시도 중입니다 ! ( 레이아웃을 다시 해줘야할 것 같습니다. )

QA 해결

  • 홈 뷰와 보관함 뷰 로고 크기가 다른 이슈를 해결했습니다.

이슈 해결

+) 세부 레이아웃을 수정하긴 했는데 제목 길이나 기록 길이에 따라 달라지는 부분이 있네요.. 이건 데이터가 패치된 상태를 옵저빙해서 레이아웃을 다시 잡아주는 방식을 생각했는데 괜찮을까요??

🎤 PR Point

📸 스크린샷

구현 내용 스크린샷

📮 관련 이슈

@Suyeon9911 Suyeon9911 added suvera 🥦 담당자 feat 구현·개선 사항에 관련된 내용입니다. labels Jan 11, 2023
@Suyeon9911 Suyeon9911 self-assigned this Jan 11, 2023
@Suyeon9911 Suyeon9911 changed the title [Feat] Home EmptyView 및 LoadingView 추가 & 세부레이아웃 수정 [Feat] EmptyView 및 LoadingView 추가 & 세부레이아웃 수정 Jan 11, 2023
Copy link
Copy Markdown
Contributor

@L-j-h-c L-j-h-c left a comment

Choose a reason for hiding this comment

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

수고하셨슴당!


public struct Output {
var fetchedDetailData = BehaviorRelay<DreamDetailEntity?>(value: nil)
var loadingStatus = BehaviorRelay<Bool>(value: true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

비해비어 릴레이로 하신 이유가 있을까요??

Copy link
Copy Markdown
Member Author

@Suyeon9911 Suyeon9911 Jan 11, 2023

Choose a reason for hiding this comment

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

@L-j-h-c 처음에 초기값을 지정해주지 않으니 상세뷰 띄울때 로딩뷰가 잘 안떠서요..! PublishRelay로 해줘도 잘 되셨나용?? 그러면.. 이 문제가 아니엇던 것일까요,,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Suyeon9911 아뇨~! 다시 보니까 이 방법이 좋은 것 같습니다~ publishRelay로 하면 viewController에서는 output이 transform된 이후에 구독하는거라 로딩이 안 뜨는 것 같네요!

}

self.contentLabel.text = content
contentLabel.addLabelSpacing(kernValue: -0.14)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

아마 paragraphStyle이 다시 적용되고 있어서 그런 것 같은데, 이 메서드 내부에서 style.linebreakMode를 다시 적용하면 달라질 수도 있을 것 같네요~!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@L-j-h-c 아 그렇네요 !! 바로 적용했습니다 감사합니다 ~~


input.viewWillAppear.subscribe(onNext: { _ in
output.loadingStatus.accept(true)
self.useCase.fetchDreamRecord()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

retain Cycle 방지해주세요~

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

1차 QA 우선 반영을 위해 따로 이슈 파서 해결하도록 하겠습니다 !!

$0.isHidden = true
}

self.view.addSubview(emptyLabel)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

empty Records가 두번 들어오면 이 부분에서 emptyLabel도 두번 추가되는 경우가 생기겠네요. 여기서도 removeFormSuperView 이후에 추가한는 것이 좋아보입니다!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

1차 QA 우선 반영을 위해 따로 이슈 파서 해결하도록 하겠습니다 !!

Comment on lines +231 to +234
self.viewModel.fetchedDreamRecord = model
self.dreamCardCollectionViewAdapter = DreamCardCollectionViewAdapter(
collectionView: self.dreamCardCollectionView, adapterDataSource: self.viewModel)
self.setCollectionViewAdapter()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

전체적으로 fetchHomeData에서는 세가지 기능을 하고 있네요

  1. HomeEntity에서 홈 전체에 해당하는 data 바인딩 -> welcomeLabel의 텍스트
  2. 레이아웃 설정
  3. 받은 모델을 데이터소스에 넣고 컬렉션뷰 재설정

일단 기능별로 코드를 분리할 수도 있을 것 같아요!

그리고 slef.viewModel의 fetchedDreamRecord를 뷰컨에서 갱신해주고 있는데, 사실 HomeEntity를 먼저 받아오는 곳은 viewModel이기 때문에 뷰모델에서 이 작업을 수행할 수 있을 것 같습니다. 현재 구조는 뷰모델 -> 뷰컨 -> 뷰모델인데, 뷰모델에서 바로 처리할 수 있는 일이니까요!

그리고 dreamCardCollectionViewAdapter를 다시 생성해주고, setCollectionViewAdapter에서 구독을 다시 해주고 있습니다. dreamCardCollectionViewAdapter를 다시 만들어주는 것은 컬렉션뷰를 업데이트하기 위함이라 생각하는데, 어댑터는 뷰디드로드에서 처음에 인스턴스 생성만 해주고, reloadData만 호출해도 목표하는 바가 이루어질 것 같아요!
setCollectionViewAapater에서는 마찬가지로 중복 구독로 인한 메모리 낭비가 일어날 수 있습니다.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

덧붙이자면 ㅎㅎ 뷰모델의 Input 내에 fetch 순간에 사용할 Observable을 만들어 두고, 뷰 컨트롤러에서는 records 가 비어있지 않을 때 해당 Observable에 이벤트를 보내주는 식으로 바인드 해주어 흐름을 형성할 수도 있을 것 같습니다 !!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

1차 QA 우선 반영을 위해 따로 이슈 파서 해결하도록 하겠습니다 !!

Copy link
Copy Markdown
Member

@EunHee-Jeong EunHee-Jeong left a comment

Choose a reason for hiding this comment

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

수고베라 LGTM 👍

Comment on lines +15 to +16
public final class VoiceNoticeView: UIView {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

잘 쓸게욤 ㅎㅅㅎ

Comment on lines +231 to +234
self.viewModel.fetchedDreamRecord = model
self.dreamCardCollectionViewAdapter = DreamCardCollectionViewAdapter(
collectionView: self.dreamCardCollectionView, adapterDataSource: self.viewModel)
self.setCollectionViewAdapter()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

덧붙이자면 ㅎㅎ 뷰모델의 Input 내에 fetch 순간에 사용할 Observable을 만들어 두고, 뷰 컨트롤러에서는 records 가 비어있지 않을 때 해당 Observable에 이벤트를 보내주는 식으로 바인드 해주어 흐름을 형성할 수도 있을 것 같습니다 !!

@Suyeon9911 Suyeon9911 merged commit 8f8b780 into develop Jan 15, 2023
@Suyeon9911 Suyeon9911 deleted the feature/#97-home-refactor branch January 20, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 구현·개선 사항에 관련된 내용입니다. suvera 🥦 담당자

Projects

None yet

3 participants