Skip to content

Commit

Permalink
[refactor] #12 MateListViewController에서 카운터 변수 제거
Browse files Browse the repository at this point in the history
- 기존에 연결 종료 기준을 담당하는 Counter 변수를 제거했습니다.

Co-Authored-By: YOON JI SEONG <[email protected]>
  • Loading branch information
Kelly-Chui and green-yoon87 committed Jan 14, 2025
1 parent 006d5f9 commit 771fb63
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ final class MateListViewController: BaseViewController, MateListViewable {
private let addMateButton = AddMateButton(title: "새 메이트를 연결하세요")
private var mpcManager: MPCManager?
private var niManager: NIManager?
private var count: Int = 0
var dogProfile: DogProfileDTO?

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -101,25 +100,10 @@ final class MateListViewController: BaseViewController, MateListViewable {
latest: false)
.sink { [weak self] _ in
self?.mpcManager?.isAvailableToBeConnected = true
self?.count = 1
self?.addMateButton.buttonState = .connecting
}
.store(in: &cancellables)

mpcManager?.$paired
.receive(on: RunLoop.main)
.sink { [weak self] isPaired in
if 1...3 ~= self?.count ?? 0 {
if !isPaired {
self?.addMateButton.buttonState = .failure
self?.presenter?.showAlertDisconnected()
}
self?.addMateButton.buttonState = .connecting
}
self?.count += 1
}
.store(in: &cancellables)

mpcManager?.receivedDataPublisher
.receive(on: RunLoop.main)
.sink { [weak self] profile in
Expand Down

0 comments on commit 771fb63

Please sign in to comment.