Normalize homePageURL in its setter. Fix #397.
This commit is contained in:
parent
5d2a3e9142
commit
fdb159a61b
|
@ -16,7 +16,22 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||||
public let accountID: String
|
public let accountID: String
|
||||||
public let url: String
|
public let url: String
|
||||||
public let feedID: String
|
public let feedID: String
|
||||||
public var homePageURL: String?
|
|
||||||
|
private var _homePageURL: String?
|
||||||
|
public var homePageURL: String? {
|
||||||
|
get {
|
||||||
|
return _homePageURL
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if let url = newValue {
|
||||||
|
_homePageURL = url.rs_normalizedURL()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_homePageURL = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var iconURL: String?
|
public var iconURL: String?
|
||||||
public var faviconURL: String?
|
public var faviconURL: String?
|
||||||
public var name: String?
|
public var name: String?
|
||||||
|
@ -86,9 +101,7 @@ public final class Feed: DisplayNameProvider, UnreadCountProvider, Hashable {
|
||||||
let feedID = dictionary[Key.feedID] as? String ?? url
|
let feedID = dictionary[Key.feedID] as? String ?? url
|
||||||
|
|
||||||
self.init(accountID: accountID, url: url, feedID: feedID)
|
self.init(accountID: accountID, url: url, feedID: feedID)
|
||||||
if let homePageURL = dictionary[Key.homePageURL] as? String {
|
self.homePageURL = dictionary[Key.homePageURL] as? String
|
||||||
self.homePageURL = homePageURL.rs_normalizedURL()
|
|
||||||
}
|
|
||||||
self.iconURL = dictionary[Key.iconURL] as? String
|
self.iconURL = dictionary[Key.iconURL] as? String
|
||||||
self.faviconURL = dictionary[Key.faviconURL] as? String
|
self.faviconURL = dictionary[Key.faviconURL] as? String
|
||||||
self.name = dictionary[Key.name] as? String
|
self.name = dictionary[Key.name] as? String
|
||||||
|
|
Loading…
Reference in New Issue