From bd1b54507f3784501c9ecd927b6e8eb9fe8c5b43 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 1 Feb 2022 15:56:49 -0800 Subject: [PATCH] Add the pauseSyncing property to Folder --- Account/Sources/Account/Account.swift | 3 +++ Account/Sources/Account/Folder.swift | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index b2f0c2076..bd6730dc2 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -508,6 +508,9 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } else { if let title = item.titleFromAttributes, let folder = ensureFolder(with: title) { folder.externalID = item.attributes?["nnw_externalID"] as? String + if let nnwPauseSyncing = item.attributes?["nnw_pauseSyncing"] as? String, nnwPauseSyncing == "true" { + folder.pauseSyncing = true + } item.children?.forEach { itemChild in if let feedSpecifier = itemChild.feedSpecifier { folder.addWebFeed(newWebFeed(with: feedSpecifier)) diff --git a/Account/Sources/Account/Folder.swift b/Account/Sources/Account/Folder.swift index 1cff74267..ce2d08149 100644 --- a/Account/Sources/Account/Folder.swift +++ b/Account/Sources/Account/Folder.swift @@ -44,6 +44,7 @@ public final class Folder: Feed, Renamable, Container, Hashable { static let untitledName = NSLocalizedString("Untitled ƒ", comment: "Folder name") public let folderID: Int // not saved: per-run only + public var pauseSyncing = false public var externalID: String? = nil static var incrementingID = 0 @@ -183,8 +184,16 @@ extension Folder: OPMLRepresentable { } }() + let attrPauseSyncing: String = { + if allowCustomAttributes && pauseSyncing { + return " nnw_pauseSyncing=\"true\"" + } else { + return "" + } + }() + let escapedTitle = nameForDisplay.escapingSpecialXMLCharacters - var s = "\n" + var s = "\n" s = s.prepending(tabCount: indentLevel) var hasAtLeastOneChild = false