Skip to content

Commit

Permalink
Prevent memory leaks on ReaderStreamViewController dismiss (#21015)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Jul 7, 2023
2 parents 4477598 + 19c7682 commit 2379ae1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import WordPressShared.WPStyleGuide
@IBOutlet fileprivate weak var detailLabel: UILabel!

// Required by ReaderStreamHeader protocol.
open var delegate: ReaderStreamHeaderDelegate?
open weak var delegate: ReaderStreamHeaderDelegate?


// MARK: - Lifecycle Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ReaderRecommendedSiteCardCell: UITableViewCell {
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var infoTrailingConstraint: NSLayoutConstraint!

var delegate: ReaderRecommendedSitesCardCellDelegate?
weak var delegate: ReaderRecommendedSitesCardCellDelegate?

override func awakeFromNib() {
super.awakeFromNib()
Expand Down Expand Up @@ -110,6 +110,6 @@ class ReaderRecommendedSiteCardCell: UITableViewCell {
}
}

protocol ReaderRecommendedSitesCardCellDelegate {
protocol ReaderRecommendedSitesCardCellDelegate: AnyObject {
func handleFollowActionForCell(_ cell: ReaderRecommendedSiteCardCell)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import WordPressShared
/// Defines methods that a delegate should implement for clearing suggestions
/// and for responding to a selected suggestion.
///
protocol ReaderSearchSuggestionsDelegate {
protocol ReaderSearchSuggestionsDelegate: AnyObject {
func searchSuggestionsController(_ controller: ReaderSearchSuggestionsViewController, selectedItem: String)
}

Expand All @@ -28,7 +28,7 @@ class ReaderSearchSuggestionsViewController: UIViewController {
}

@objc var tableViewHandler: WPTableViewHandler!
var delegate: ReaderSearchSuggestionsDelegate?
weak var delegate: ReaderSearchSuggestionsDelegate?
@objc let cellIdentifier = "CellIdentifier"
@objc let rowAndButtonHeight = CGFloat(44.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fileprivate func > <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
@IBOutlet fileprivate weak var descriptionLabel: UILabel!
@IBOutlet fileprivate weak var descriptionLabelTopConstraint: NSLayoutConstraint!

open var delegate: ReaderStreamHeaderDelegate?
open weak var delegate: ReaderStreamHeaderDelegate?
fileprivate var defaultBlavatar = "blavatar-default"

// MARK: - Lifecycle Methods
Expand Down
6 changes: 3 additions & 3 deletions WordPress/Classes/ViewRelated/Reader/ReaderStreamHeader.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Foundation

public protocol ReaderStreamHeaderDelegate: NSObjectProtocol {
@objc public protocol ReaderStreamHeaderDelegate {
func handleFollowActionForHeader(_ header: ReaderStreamHeader, completion: @escaping () -> Void)
}

public protocol ReaderStreamHeader: NSObjectProtocol {
var delegate: ReaderStreamHeaderDelegate? {get set}
@objc public protocol ReaderStreamHeader {
weak var delegate: ReaderStreamHeaderDelegate? {get set}
func enableLoggedInFeatures(_ enable: Bool)
func configureHeader(_ topic: ReaderAbstractTopic)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import WordPressShared
@IBOutlet fileprivate weak var titleLabel: UILabel!
@IBOutlet fileprivate weak var followButton: UIButton!

open var delegate: ReaderStreamHeaderDelegate?
open weak var delegate: ReaderStreamHeaderDelegate?

// MARK: - Lifecycle Methods
open override func awakeFromNib() {
Expand Down

0 comments on commit 2379ae1

Please sign in to comment.