From e8c08e60f855493fa7822df9aae107a77e0f52ca Mon Sep 17 00:00:00 2001 From: Michal Rentka Date: Fri, 20 Oct 2023 13:09:23 +0200 Subject: [PATCH] Fixed missing dispose bag (#787) --- .../Detail/PDF/Views/Annotation View/AnnotationView.swift | 2 +- Zotero/Scenes/Detail/PDF/Views/AnnotationCell.swift | 4 ++-- .../Scenes/Detail/PDF/Views/AnnotationsViewController.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Zotero/Scenes/Detail/PDF/Views/Annotation View/AnnotationView.swift b/Zotero/Scenes/Detail/PDF/Views/Annotation View/AnnotationView.swift index dfb60553d..50ce691fd 100644 --- a/Zotero/Scenes/Detail/PDF/Views/Annotation View/AnnotationView.swift +++ b/Zotero/Scenes/Detail/PDF/Views/Annotation View/AnnotationView.swift @@ -47,7 +47,7 @@ final class AnnotationView: UIView { private var tags: AnnotationViewText! private var scrollView: UIScrollView? private var scrollViewContent: UIView? - private(set) var disposeBag: CompositeDisposable! + private(set) var disposeBag: CompositeDisposable? var tagString: String? { return self.tags.textLabel.text diff --git a/Zotero/Scenes/Detail/PDF/Views/AnnotationCell.swift b/Zotero/Scenes/Detail/PDF/Views/AnnotationCell.swift index fb5dbc6bf..b37b7ec92 100644 --- a/Zotero/Scenes/Detail/PDF/Views/AnnotationCell.swift +++ b/Zotero/Scenes/Detail/PDF/Views/AnnotationCell.swift @@ -18,7 +18,7 @@ final class AnnotationCell: UITableViewCell { var actionPublisher: PublishSubject { return self.annotationView.actionPublisher } - var disposeBag: CompositeDisposable { + var disposeBag: CompositeDisposable? { return self.annotationView.disposeBag } @@ -37,7 +37,7 @@ final class AnnotationCell: UITableViewCell { override func prepareForReuse() { super.prepareForReuse() self.key = "" - disposeBag.dispose() + disposeBag?.dispose() } // MARK: - Actions diff --git a/Zotero/Scenes/Detail/PDF/Views/AnnotationsViewController.swift b/Zotero/Scenes/Detail/PDF/Views/AnnotationsViewController.swift index f8fb12a2a..acc4877db 100644 --- a/Zotero/Scenes/Detail/PDF/Views/AnnotationsViewController.swift +++ b/Zotero/Scenes/Detail/PDF/Views/AnnotationsViewController.swift @@ -321,7 +321,7 @@ final class AnnotationsViewController: UIViewController { let actionSubscription = cell.actionPublisher.subscribe(onNext: { [weak self] action in self?.perform(action: action, annotation: annotation) }) - _ = cell.disposeBag.insert(actionSubscription) + _ = cell.disposeBag?.insert(actionSubscription) } private func loadAttributedComment(for annotation: Annotation) -> NSAttributedString? {