diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index 347b5c3b1..2b4a9e2e9 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -205,14 +205,11 @@ - - - - - - - - + + + + + @@ -287,7 +284,6 @@ - diff --git a/iOS/Master/MasterPrimaryViewController.swift b/iOS/Master/MasterPrimaryViewController.swift index ad7d8d096..23b78396b 100644 --- a/iOS/Master/MasterPrimaryViewController.swift +++ b/iOS/Master/MasterPrimaryViewController.swift @@ -12,47 +12,6 @@ import RSCore import RSTree class MasterPrimaryViewController: MasterViewController { - - // MARK: Actions - - @IBAction func showOPMLImportExport(_ sender: UIBarButtonItem) { - - let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) - - let importOPML = UIAlertAction(title: "Import OPML", style: .default) { [unowned self] alertAction in - let docPicker = UIDocumentPickerViewController(documentTypes: ["public.xml", "org.opml.opml"], in: .import) - docPicker.delegate = self - docPicker.modalPresentationStyle = .formSheet - self.present(docPicker, animated: true) - } - optionMenu.addAction(importOPML) - - let exportOPML = UIAlertAction(title: "Export OPML", style: .default) { [unowned self] alertAction in - - let filename = "MySubscriptions.opml" - let tempFile = FileManager.default.temporaryDirectory.appendingPathComponent(filename) - let opmlString = OPMLExporter.OPMLString(with: AccountManager.shared.localAccount, title: filename) - do { - try opmlString.write(to: tempFile, atomically: true, encoding: String.Encoding.utf8) - } catch { - self.presentError(title: "OPML Export Error", message: error.localizedDescription) - } - - let docPicker = UIDocumentPickerViewController(url: tempFile, in: .exportToService) - docPicker.modalPresentationStyle = .formSheet - self.present(docPicker, animated: true) - - } - optionMenu.addAction(exportOPML) - optionMenu.addAction(UIAlertAction(title: "Cancel", style: .cancel)) - - if let popoverController = optionMenu.popoverPresentationController { - popoverController.barButtonItem = sender - } - - self.present(optionMenu, animated: true) - - } // MARK: - Table View @@ -103,19 +62,3 @@ class MasterPrimaryViewController: MasterViewController { } } - -extension MasterPrimaryViewController: UIDocumentPickerDelegate { - - func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { - - for url in urls { - do { - try OPMLImporter.parseAndImport(fileURL: url, account: AccountManager.shared.localAccount) - } catch { - presentError(title: "OPML Import Error", message: error.localizedDescription) - } - } - - } - -} diff --git a/iOS/Master/MasterViewController.swift b/iOS/Master/MasterViewController.swift index bc139c841..9cf81bb18 100644 --- a/iOS/Master/MasterViewController.swift +++ b/iOS/Master/MasterViewController.swift @@ -193,6 +193,56 @@ class MasterViewController: UITableViewController, UndoableCommandRunner { // MARK: Actions + @IBAction func showTools(_ sender: UIBarButtonItem) { + + let optionMenu = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) + + // Settings Button + let settingsTitle = NSLocalizedString("Settings", comment: "Settings") + let setting = UIAlertAction(title: settingsTitle, style: .default) { alertAction in + + } + optionMenu.addAction(setting) + + // Import Button + let importOPMLTitle = NSLocalizedString("Import OPML", comment: "Import OPML") + let importOPML = UIAlertAction(title: importOPMLTitle, style: .default) { [unowned self] alertAction in + let docPicker = UIDocumentPickerViewController(documentTypes: ["public.xml", "org.opml.opml"], in: .import) + docPicker.delegate = self + docPicker.modalPresentationStyle = .formSheet + self.present(docPicker, animated: true) + } + optionMenu.addAction(importOPML) + + // Export Button + let exportOPMLTitle = NSLocalizedString("Export OPML", comment: "Export OPML") + let exportOPML = UIAlertAction(title: exportOPMLTitle, style: .default) { [unowned self] alertAction in + + let filename = "MySubscriptions.opml" + let tempFile = FileManager.default.temporaryDirectory.appendingPathComponent(filename) + let opmlString = OPMLExporter.OPMLString(with: AccountManager.shared.localAccount, title: filename) + do { + try opmlString.write(to: tempFile, atomically: true, encoding: String.Encoding.utf8) + } catch { + self.presentError(title: "OPML Export Error", message: error.localizedDescription) + } + + let docPicker = UIDocumentPickerViewController(url: tempFile, in: .exportToService) + docPicker.modalPresentationStyle = .formSheet + self.present(docPicker, animated: true) + + } + optionMenu.addAction(exportOPML) + optionMenu.addAction(UIAlertAction(title: "Cancel", style: .cancel)) + + if let popoverController = optionMenu.popoverPresentationController { + popoverController.barButtonItem = sender + } + + self.present(optionMenu, animated: true) + + } + @IBAction func markAllAsRead(_ sender: Any) { let title = NSLocalizedString("Mark All Read", comment: "Mark All Read") @@ -323,6 +373,24 @@ class MasterViewController: UITableViewController, UndoableCommandRunner { } +// MARK: OPML Document Picker + +extension MasterViewController: UIDocumentPickerDelegate { + + func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { + + for url in urls { + do { + try OPMLImporter.parseAndImport(fileURL: url, account: AccountManager.shared.localAccount) + } catch { + presentError(title: "OPML Import Error", message: error.localizedDescription) + } + } + + } + +} + // MARK: Private private extension MasterViewController { diff --git a/iOS/Resources/Assets.xcassets/settingsImage.imageset/Contents.json b/iOS/Resources/Assets.xcassets/settingsImage.imageset/Contents.json index 228b81a81..424b5d41f 100644 --- a/iOS/Resources/Assets.xcassets/settingsImage.imageset/Contents.json +++ b/iOS/Resources/Assets.xcassets/settingsImage.imageset/Contents.json @@ -2,7 +2,7 @@ "images" : [ { "idiom" : "universal", - "filename" : "settings.pdf" + "filename" : "settings3.pdf" } ], "info" : { diff --git a/iOS/Resources/Assets.xcassets/settingsImage.imageset/settings.pdf b/iOS/Resources/Assets.xcassets/settingsImage.imageset/settings3.pdf similarity index 53% rename from iOS/Resources/Assets.xcassets/settingsImage.imageset/settings.pdf rename to iOS/Resources/Assets.xcassets/settingsImage.imageset/settings3.pdf index 87bba4b21..04f6b8737 100644 Binary files a/iOS/Resources/Assets.xcassets/settingsImage.imageset/settings.pdf and b/iOS/Resources/Assets.xcassets/settingsImage.imageset/settings3.pdf differ