Skip to content

Commit

Permalink
Mod: self capturing in closure
Browse files Browse the repository at this point in the history
  • Loading branch information
ibcylon committed Jun 5, 2024
1 parent bbdb0c6 commit e4dcfae
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions Projects/Features/Falling/Src/Home/FallingHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ final class FallingHomeViewController: TFBaseViewController {
})

dataSource.supplementaryViewProvider = { (view, kind, index) in
return self.homeView.collectionView.dequeueConfiguredReusableSupplementary(
return view.dequeueConfiguredReusableSupplementary(
using: footerRegistration,
for: index
)
Expand Down Expand Up @@ -177,39 +177,37 @@ final class FallingHomeViewController: TFBaseViewController {
alertContentView.photoTheftButton.rx.tap.asDriver(),
alertContentView.profanityButton.rx.tap.asDriver(),
alertContentView.sharingIllegalFootageButton.rx.tap.asDriver())
.do { _ in
.drive(with: self, onNext: { owner, _ in
complaintsButtonTapTrigger.accept(())

self.homeView.makeToast("신고하기가 완료되었습니다. 해당 사용자와\n서로 차단되며, 신고 사유는 검토 후 처리됩니다.", duration: 3.0, position: .bottom)
owner.homeView.makeToast("신고하기가 완료되었습니다. 해당 사용자와\n서로 차단되며, 신고 사유는 검토 후 처리됩니다.", duration: 3.0, position: .bottom)

UIWindow.keyWindow?.rootViewController?.dismiss(animated: false)
}
.drive()
})
.disposed(by: disposeBag)

reportButtonTapTriggerObserver.asDriverOnErrorJustEmpty()
.do { _ in
self.showAlert(
.drive(with: self) { owner, _ in
owner.showAlert(
topActionTitle: "신고하기",
bottomActionTitle: "차단하기",
dimColor: DSKitAsset.Color.clear.color,
topActionCompletion: {
self.showAlert(
contentView: self.alertContentView,
owner.showAlert(
contentView: owner.alertContentView,
topActionTitle: nil,
dimColor: DSKitAsset.Color.clear.color,
bottomActionCompletion: { timerActiveRelay.accept(true) },
dimActionCompletion: { timerActiveRelay.accept(true) }
)
},
bottomActionCompletion: {
self.showAlert(
owner.showAlert(
action: .block,
dimColor: DSKitAsset.Color.clear.color,
topActionCompletion: {
blockButtonTapTrigger.accept(())

self.homeView.makeToast("차단하기가 완료되었습니다. 해당 사용자와\n서로 차단되며 설정에서 확인 가능합니다.", duration: 3.0, position: .bottom)
owner.homeView.makeToast("차단하기가 완료되었습니다. 해당 사용자와\n서로 차단되며 설정에서 확인 가능합니다.", duration: 3.0, position: .bottom)
},
bottomActionCompletion: { timerActiveRelay.accept(true) },
dimActionCompletion: { timerActiveRelay.accept(true) }
Expand All @@ -218,21 +216,19 @@ final class FallingHomeViewController: TFBaseViewController {
dimActionCompletion: { timerActiveRelay.accept(true) }
)
}
.drive()
.disposed(by: disposeBag)

Driver.merge(output.complaintsAction, output.blockAction)
.do { indexPath in
guard let _ = self.homeView.collectionView.cellForItem(at: indexPath) as? FallingUserCollectionViewCell else { return }
.drive(with: self, onNext: { owner, indexPath in
guard let _ = owner.homeView.collectionView.cellForItem(at: indexPath) as? FallingUserCollectionViewCell else { return }

self.deleteItems(indexPath)
owner.deleteItems(indexPath)

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
timeOverSubject.onNext(.delete)
timerActiveRelay.accept(true)
}
}
.drive()
})
.disposed(by: disposeBag)
}
}
Expand Down

0 comments on commit e4dcfae

Please sign in to comment.