Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leaks in ReaderStreamViewController #21015

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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