Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Fix Delete Button in production (#1195)
Browse files Browse the repository at this point in the history
* Delete subscription code was hidden behind edit feature flag, causing delete button not to work. Moved code outside of feature flag restrictions.
  • Loading branch information
kaylagalway authored Feb 13, 2020
1 parent d14e787 commit 72a8da0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lockbox-ios/Presenter/ItemDetailPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,12 @@ class ItemDetailPresenter {
if FeatureFlags.crudEdit {
setupEdit()
}
setupDelete()
setupCopy(itemObservable: itemObservable)
setupNavigation(itemObservable: itemObservable)
}

private func setupEdit() {
itemDetailStore.isEditing
.map { !$0 }
.subscribe(view!.deleteHidden)
.disposed(by: disposeBag)

itemDetailStore.isEditing
.subscribe(onNext: { editing in self.view?.enableLargeTitle(enabled: !editing) })
.disposed(by: disposeBag)


private func setupDelete() {
view?.deleteTapped
.subscribe(onNext: { (_) in
self.view?.displayAlertController(
Expand All @@ -173,6 +165,17 @@ class ItemDetailPresenter {
.disposed(by: disposeBag)
}

private func setupEdit() {
itemDetailStore.isEditing
.map { !$0 }
.subscribe(view!.deleteHidden)
.disposed(by: disposeBag)

itemDetailStore.isEditing
.subscribe(onNext: { editing in self.view?.enableLargeTitle(enabled: !editing) })
.disposed(by: disposeBag)
}

private func setupCopy(itemObservable: Observable<LoginRecord?>) {
// use the behaviorrelay to cache the most recent version of the LoginRecord
let itemDetailRelay = BehaviorRelay<LoginRecord?>(value: nil)
Expand Down

0 comments on commit 72a8da0

Please sign in to comment.