mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Reimplement Import and Export OPML
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519B8D322143397200FA689C /* SharingServiceDelegate.swift */; };
|
||||
519D73FB2323FF35008BB345 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F35D0822AFD4760003CE1B /* SettingsView.swift */; };
|
||||
519D740623243CC0008BB345 /* RefreshInterval-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519D740523243CC0008BB345 /* RefreshInterval-Extensions.swift */; };
|
||||
519D740723243FE7008BB345 /* SettingsSubscriptionsExportDocumentPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5194B5F122B69FCC00144881 /* SettingsSubscriptionsExportDocumentPickerView.swift */; };
|
||||
519D740823243FEA008BB345 /* SettingsSubscriptionsImportDocumentPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5194B5ED22B6965300144881 /* SettingsSubscriptionsImportDocumentPickerView.swift */; };
|
||||
519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519E743422C663F900A78E47 /* SceneDelegate.swift */; };
|
||||
51C451A9226377C200C03939 /* ArticlesDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8407167F2262A61100344432 /* ArticlesDatabase.framework */; };
|
||||
51C451AA226377C200C03939 /* ArticlesDatabase.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8407167F2262A61100344432 /* ArticlesDatabase.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
@@ -2464,9 +2466,11 @@
|
||||
51EF0F77227716200050506E /* FaviconGenerator.swift in Sources */,
|
||||
51938DF3231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift in Sources */,
|
||||
51C4525A226508D600C03939 /* UIStoryboard-Extensions.swift in Sources */,
|
||||
519D740823243FEA008BB345 /* SettingsSubscriptionsImportDocumentPickerView.swift in Sources */,
|
||||
5183CCEF227125970010922C /* SettingsViewController.swift in Sources */,
|
||||
51F85BE5227217D000C787DC /* RefreshIntervalViewController.swift in Sources */,
|
||||
51F85BF52273625800C787DC /* Bundle-Extensions.swift in Sources */,
|
||||
519D740723243FE7008BB345 /* SettingsSubscriptionsExportDocumentPickerView.swift in Sources */,
|
||||
51C452A622650A3500C03939 /* Node-Extensions.swift in Sources */,
|
||||
5183CCDF226F1FCC0010922C /* UINavigationController+Progress.swift in Sources */,
|
||||
51C45294226509C800C03939 /* SearchFeedDelegate.swift in Sources */,
|
||||
|
||||
@@ -16,6 +16,12 @@ struct SettingsView : View {
|
||||
|
||||
@State var isWebsitePresented: Bool = false
|
||||
@State var website: String? = nil
|
||||
|
||||
@State var isOPMLImportPresented: Bool = false
|
||||
@State var isOPMLImportDocPickerPresented: Bool = false
|
||||
@State var isOPMLExportPresented: Bool = false
|
||||
@State var isOPMLExportDocPickerPresented: Bool = false
|
||||
@State var opmlAccount: Account? = nil
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
@@ -47,20 +53,26 @@ struct SettingsView : View {
|
||||
Text(interval.description()).tag(interval)
|
||||
}
|
||||
}
|
||||
// Button(action: {
|
||||
// self.subscriptionsImportAccounts = self.createSubscriptionsImportAccounts
|
||||
// }) {
|
||||
// Text("Import Subscriptions...")
|
||||
// }
|
||||
// .presentation(subscriptionsImportAccounts)
|
||||
// .presentation(subscriptionsImportDocumentPicker)
|
||||
// Button(action: {
|
||||
// self.subscriptionsExportAccounts = self.createSubscriptionsExportAccounts
|
||||
// }) {
|
||||
// Text("Export Subscriptions...")
|
||||
// }
|
||||
// .presentation(subscriptionsExportAccounts)
|
||||
// .presentation(subscriptionsExportDocumentPicker)
|
||||
|
||||
VStack {
|
||||
Button("Import Subscriptions...") {
|
||||
self.isOPMLImportPresented = true
|
||||
}
|
||||
}.actionSheet(isPresented: $isOPMLImportPresented) {
|
||||
createSubscriptionsImportAccounts
|
||||
}.sheet(isPresented: $isOPMLImportDocPickerPresented) {
|
||||
SettingsSubscriptionsImportDocumentPickerView(account: self.opmlAccount!)
|
||||
}
|
||||
|
||||
VStack {
|
||||
Button("Export Subscriptions...") {
|
||||
self.isOPMLExportPresented = true
|
||||
}
|
||||
}.actionSheet(isPresented: $isOPMLExportPresented) {
|
||||
createSubscriptionsExportAccounts
|
||||
}.sheet(isPresented: $isOPMLExportDocPickerPresented) {
|
||||
SettingsSubscriptionsExportDocumentPickerView(account: self.opmlAccount!)
|
||||
}
|
||||
}
|
||||
.foregroundColor(.primary)
|
||||
|
||||
@@ -114,40 +126,40 @@ struct SettingsView : View {
|
||||
}
|
||||
}
|
||||
|
||||
// var createSubscriptionsImportAccounts: ActionSheet {
|
||||
// var buttons = [ActionSheet.Button]()
|
||||
//
|
||||
// for account in viewModel.activeAccounts {
|
||||
// if !account.isOPMLImportSupported {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// let button = ActionSheet.Button.default(Text(verbatim: account.nameForDisplay)) {
|
||||
// self.subscriptionsImportAccounts = nil
|
||||
// self.subscriptionsImportDocumentPicker = Modal(SettingsSubscriptionsImportDocumentPickerView(account: account))
|
||||
// }
|
||||
//
|
||||
// buttons.append(button)
|
||||
// }
|
||||
//
|
||||
// buttons.append(.cancel { self.subscriptionsImportAccounts = nil })
|
||||
// return ActionSheet(title: Text("Import Subscriptions..."), message: Text("Select the account to import your OPML file into."), buttons: buttons)
|
||||
// }
|
||||
//
|
||||
// var createSubscriptionsExportAccounts: ActionSheet {
|
||||
// var buttons = [ActionSheet.Button]()
|
||||
//
|
||||
// for account in viewModel.accounts {
|
||||
// let button = ActionSheet.Button.default(Text(verbatim: account.nameForDisplay)) {
|
||||
// self.subscriptionsExportAccounts = nil
|
||||
// self.subscriptionsExportDocumentPicker = Modal(SettingsSubscriptionsExportDocumentPickerView(account: account))
|
||||
// }
|
||||
// buttons.append(button)
|
||||
// }
|
||||
//
|
||||
// buttons.append(.cancel { self.subscriptionsExportAccounts = nil })
|
||||
// return ActionSheet(title: Text("Export Subscriptions..."), message: Text("Select the account to export out of."), buttons: buttons)
|
||||
// }
|
||||
var createSubscriptionsImportAccounts: ActionSheet {
|
||||
var buttons = [ActionSheet.Button]()
|
||||
|
||||
for account in viewModel.activeAccounts {
|
||||
if !account.isOPMLImportSupported {
|
||||
continue
|
||||
}
|
||||
|
||||
let button = ActionSheet.Button.default(Text(verbatim: account.nameForDisplay)) {
|
||||
self.opmlAccount = account
|
||||
self.isOPMLImportDocPickerPresented = true
|
||||
}
|
||||
|
||||
buttons.append(button)
|
||||
}
|
||||
|
||||
buttons.append(.cancel())
|
||||
return ActionSheet(title: Text("Import Subscriptions..."), message: Text("Select the account to import your OPML file into."), buttons: buttons)
|
||||
}
|
||||
|
||||
var createSubscriptionsExportAccounts: ActionSheet {
|
||||
var buttons = [ActionSheet.Button]()
|
||||
|
||||
for account in viewModel.accounts {
|
||||
let button = ActionSheet.Button.default(Text(verbatim: account.nameForDisplay)) {
|
||||
self.opmlAccount = account
|
||||
self.isOPMLExportDocPickerPresented = true
|
||||
}
|
||||
buttons.append(button)
|
||||
}
|
||||
|
||||
buttons.append(.cancel())
|
||||
return ActionSheet(title: Text("Export Subscriptions..."), message: Text("Select the account to export out of."), buttons: buttons)
|
||||
}
|
||||
|
||||
var buildFooter: some View {
|
||||
return Text(verbatim: "\(Bundle.main.appName) v \(Bundle.main.versionNumber) (Build \(Bundle.main.buildNumber))")
|
||||
|
||||
Reference in New Issue
Block a user