Skip to content

Commit

Permalink
#297: Share Extension의 재검색 화면 백버튼 동작 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph704 committed Aug 20, 2024
1 parent 506b890 commit 581983a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ final class ReSearchingMusicForSharingView: UIView {
var exitButtonEvent: Observable<Void> {
exitButtonEventRelay.asObservable()
}
private let backbuttonEventRelay: PublishRelay<Void> = .init()
var backbuttonEvent: Observable<Void> {
backbuttonEventRelay.asObservable()
}

// ViewController -> View
let settingMusicDataRelay: PublishRelay<[Music]> = .init()
Expand Down Expand Up @@ -145,6 +149,14 @@ private extension ReSearchingMusicForSharingView {
exitButton.rx.tap
.bind(to: exitButtonEventRelay)
.disposed(by: disposeBag)

backbutton.rx.tap
.do(onNext: { [weak self] _ in
self?.searchTextField.text = nil
self?.endEditing(true)
})
.bind(to: backbuttonEventRelay)
.disposed(by: disposeBag)
}

func bindData() {
Expand Down
11 changes: 11 additions & 0 deletions StreetDrop/ShareExtension/View/ShareViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@ private extension ShareViewController {
)
.bind(to: dropButtonClickEvent)
.disposed(by: disposeBag)

reSearchingMusicForSharingView.backbuttonEvent
.bind(with: self) { owner, _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: { [weak self] in
guard let self = self else { return }
containerView.isHidden = false
reSearchingMusicForSharingView.isHidden = true
view.layoutIfNeeded()
})
}
.disposed(by: disposeBag)
}

func bindViewModel() {
Expand Down

0 comments on commit 581983a

Please sign in to comment.