From 72a8da0317091685dff7396285964462ba12937c Mon Sep 17 00:00:00 2001 From: Kayla Galway Date: Thu, 13 Feb 2020 13:25:04 -0700 Subject: [PATCH] Fix Delete Button in production (#1195) * Delete subscription code was hidden behind edit feature flag, causing delete button not to work. Moved code outside of feature flag restrictions. --- .../Presenter/ItemDetailPresenter.swift | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lockbox-ios/Presenter/ItemDetailPresenter.swift b/lockbox-ios/Presenter/ItemDetailPresenter.swift index aea82ebf7..b286422a9 100644 --- a/lockbox-ios/Presenter/ItemDetailPresenter.swift +++ b/lockbox-ios/Presenter/ItemDetailPresenter.swift @@ -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( @@ -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) { // use the behaviorrelay to cache the most recent version of the LoginRecord let itemDetailRelay = BehaviorRelay(value: nil)