Change to remember last selected Folder when adding a Feed. Issue #1306

This commit is contained in:
Maurice Parker 2019-11-16 19:57:05 -06:00
parent 397d8e8ffa
commit 991ef26a1f
3 changed files with 27 additions and 12 deletions

View File

@ -27,7 +27,8 @@ struct AppDefaults {
static let openInBrowserInBackground = "openInBrowserInBackground"
static let mainWindowWidths = "mainWindowWidths"
static let refreshInterval = "refreshInterval"
static let addFeedAccountID = "addFeedAccountID"
static let addWebFeedAccountID = "addWebFeedAccountID"
static let addWebFeedFolderName = "addWebFeedFolderName"
static let addFolderAccountID = "addFolderAccountID"
static let importOPMLAccountID = "importOPMLAccountID"
static let exportOPMLAccountID = "exportOPMLAccountID"
@ -99,15 +100,24 @@ struct AppDefaults {
}
}
static var addFeedAccountID: String? {
static var addWebFeedAccountID: String? {
get {
return string(for: Key.addFeedAccountID)
return string(for: Key.addWebFeedAccountID)
}
set {
setString(for: Key.addFeedAccountID, newValue)
setString(for: Key.addWebFeedAccountID, newValue)
}
}
static var addWebFeedFolderName: String? {
get {
return string(for: Key.addWebFeedFolderName)
}
set {
setString(for: Key.addWebFeedFolderName, newValue)
}
}
static var addFolderAccountID: String? {
get {
return string(for: Key.addFolderAccountID)

View File

@ -69,11 +69,16 @@ class AddFeedWindowController : NSWindowController {
}
folderPopupButton.menu = FolderTreeMenu.createFolderPopupMenu(with: folderTreeController.rootNode)
if let account = initialAccount {
FolderTreeMenu.select(account: account, folder: initialFolder, in: folderPopupButton)
} else if let accountID = AppDefaults.addFeedAccountID {
if let account = AccountManager.shared.existingAccount(with: accountID) {
FolderTreeMenu.select(account: account, folder: nil, in: folderPopupButton)
} else if let container = AddWebFeedDefaultContainer.defaultContainer {
if let folder = container as? Folder, let account = folder.account {
FolderTreeMenu.select(account: account, folder: folder, in: folderPopupButton)
} else {
if let account = container as? Account {
FolderTreeMenu.select(account: account, folder: nil, in: folderPopupButton)
}
}
}
@ -100,11 +105,7 @@ class AddFeedWindowController : NSWindowController {
}
let container = selectedContainer()!
if let selectedAccount = container as? Account {
AppDefaults.addFeedAccountID = selectedAccount.accountID
} else if let selectedFolder = container as? Folder, let selectedAccount = selectedFolder.account {
AppDefaults.addFeedAccountID = selectedAccount.accountID
}
AddWebFeedDefaultContainer.saveDefaultContainer(container)
delegate?.addFeedWindowController(self, userEnteredURL: url, userEnteredTitle: userEnteredTitle, container: container)

View File

@ -136,6 +136,8 @@
51A9A5ED2380D6000033AADF /* AppAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51C45254226507D200C03939 /* AppAssets.swift */; };
51A9A5EE2380D6080033AADF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 84C9FC9B2262A1A900D921D6 /* Assets.xcassets */; };
51A9A5EF2380D63B0033AADF /* IconImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516AE9DE2372269A007DEEAA /* IconImage.swift */; };
51A9A5F22380DE520033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; };
51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; };
51B62E68233186730085F949 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B62E67233186730085F949 /* IconView.swift */; };
51BB7C272335A8E5008E8144 /* ArticleActivityItemSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51BB7C262335A8E5008E8144 /* ArticleActivityItemSource.swift */; };
51BB7C312335ACDE008E8144 /* page.html in Resources */ = {isa = PBXBuildFile; fileRef = 51BB7C302335ACDE008E8144 /* page.html */; };
@ -3853,6 +3855,7 @@
65ED4025235DEF6C0081F399 /* DetailWebView.swift in Sources */,
65ED4026235DEF6C0081F399 /* TimelineTableRowView.swift in Sources */,
65ED4027235DEF6C0081F399 /* UnreadIndicatorView.swift in Sources */,
51A9A5F22380DE520033AADF /* AddWebFeedDefaultContainer.swift in Sources */,
65ED4028235DEF6C0081F399 /* ExtractedArticle.swift in Sources */,
65ED4029235DEF6C0081F399 /* DeleteCommand.swift in Sources */,
65ED402A235DEF6C0081F399 /* AddFeedWindowController.swift in Sources */,
@ -4059,6 +4062,7 @@
D57BE6E0204CD35F00D11AAC /* NSScriptCommand+NetNewsWire.swift in Sources */,
D553738B20186C20006D8857 /* Article+Scriptability.swift in Sources */,
845EE7C11FC2488C00854A1F /* SmartFeed.swift in Sources */,
51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */,
84702AA41FA27AC0006B8943 /* MarkStatusCommand.swift in Sources */,
D5907D7F2004AC00005947E5 /* NSApplication+Scriptability.swift in Sources */,
8405DD9C22153BD7008CE1BF /* NSView-Extensions.swift in Sources */,