diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index e36d30a8b..4fd5db8ff 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -5,6 +5,7 @@ // Created by Brent Simmons on 7/11/15. // Copyright © 2015 Ranchero Software, LLC. All rights reserved. // + import AppKit import UserNotifications import Articles @@ -62,7 +63,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, private var addFeedController: AddFeedController? private var addFolderWindowController: AddFolderWindowController? private var importOPMLController: ImportOPMLWindowController? - private var importNNW3Controller: ImportNNW3WindowController? private var exportOPMLController: ExportOPMLWindowController? private var keyboardShortcutsWindowController: WebViewWindowController? private var inspectorWindowController: InspectorWindowController? @@ -114,6 +114,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, } // MARK: - NSApplicationDelegate + func applicationWillFinishLaunching(_ notification: Notification) { installAppleEventHandlers() #if TEST @@ -136,9 +137,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, logDebugMessage("Is first run.") } let localAccount = AccountManager.shared.defaultAccount - NNW3FeedsImporter.importIfNeeded(isFirstRun, account: localAccount) - DefaultFeedsImporter.importIfNeeded(isFirstRun, account: localAccount) - + + if isFirstRun && !AccountManager.shared.anyAccountHasAtLeastOneFeed() { + // Import feeds. Either old NNW 3 feeds or the default feeds. + if !NNW3ImportController.importSubscriptionsIfFileExists(account: localAccount) { + DefaultFeedsImporter.importDefaultFeeds(account: localAccount) + } + } + let tempDirectory = NSTemporaryDirectory() let bundleIdentifier = (Bundle.main.infoDictionary!["CFBundleIdentifier"]! as! String) let cacheFolder = (tempDirectory as NSString).appendingPathComponent(bundleIdentifier) @@ -452,9 +458,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, if mainWindowController!.isDisplayingSheet { return } - - importNNW3Controller = ImportNNW3WindowController() - importNNW3Controller?.runSheetOnWindow(mainWindowController!.window!) + NNW3ImportController.askUserToImportNNW3Subscriptions(window: mainWindowController!.window!) } @IBAction func exportOPML(_ sender: Any?) { diff --git a/Mac/Base.lproj/Main.storyboard b/Mac/Base.lproj/Main.storyboard index 3e56dfe39..498fdd35f 100644 --- a/Mac/Base.lproj/Main.storyboard +++ b/Mac/Base.lproj/Main.storyboard @@ -92,7 +92,7 @@ - + diff --git a/Mac/MainWindow/NNW3/ImportNNW3Sheet.xib b/Mac/MainWindow/NNW3/ImportNNW3Sheet.xib deleted file mode 100644 index 522ead006..000000000 --- a/Mac/MainWindow/NNW3/ImportNNW3Sheet.xib +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mac/MainWindow/NNW3/ImportNNW3WindowController.swift b/Mac/MainWindow/NNW3/ImportNNW3WindowController.swift deleted file mode 100644 index 3488ecb03..000000000 --- a/Mac/MainWindow/NNW3/ImportNNW3WindowController.swift +++ /dev/null @@ -1,110 +0,0 @@ -// -// ImportNNW3WindowController.swift -// NetNewsWire -// -// Created by Maurice Parker on 10/14/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import AppKit -import Account - -class ImportNNW3WindowController: NSWindowController { - - @IBOutlet weak var accountPopUpButton: NSPopUpButton! - private weak var hostWindow: NSWindow? - - convenience init() { - self.init(windowNibName: NSNib.Name("ImportNNW3Sheet")) - } - - override func windowDidLoad() { - accountPopUpButton.removeAllItems() - - let menu = NSMenu() - accountPopUpButton.menu = menu - - for oneAccount in AccountManager.shared.sortedActiveAccounts { - - let oneMenuItem = NSMenuItem() - oneMenuItem.title = oneAccount.nameForDisplay - oneMenuItem.representedObject = oneAccount - menu.addItem(oneMenuItem) - - if oneAccount.accountID == AppDefaults.importOPMLAccountID { - accountPopUpButton.select(oneMenuItem) - } - - } - } - - // MARK: API - - func runSheetOnWindow(_ hostWindow: NSWindow) { - - self.hostWindow = hostWindow - - if AccountManager.shared.activeAccounts.count == 1 { - let account = AccountManager.shared.activeAccounts.first! - importNNW3(account: account) - } else { - hostWindow.beginSheet(window!) - } - - } - - // MARK: Actions - - @IBAction func cancel(_ sender: Any) { - hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.cancel) - } - - @IBAction func importNNW3(_ sender: Any) { - - guard let menuItem = accountPopUpButton.selectedItem else { - return - } - - let account = menuItem.representedObject as! Account - AppDefaults.importOPMLAccountID = account.accountID - hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK) - importNNW3(account: account) - - } - - func importNNW3(account: Account) { - - let panel = NSOpenPanel() - panel.canDownloadUbiquitousContents = true - panel.canResolveUbiquitousConflicts = true - panel.canChooseFiles = true - panel.allowsMultipleSelection = false - panel.canChooseDirectories = false - panel.resolvesAliases = true - panel.directoryURL = URL(fileURLWithPath: NNW3PlistConverter.defaultFilePath) - panel.allowedFileTypes = ["plist"] - panel.allowsOtherFileTypes = false - - panel.beginSheetModal(for: hostWindow!) { modalResult in - if modalResult == NSApplication.ModalResponse.OK, let url = panel.url { - - guard let opmlURL = NNW3PlistConverter.convertToOPML(url: url) else { - return - } - - account.importOPML(opmlURL) { result in - try? FileManager.default.removeItem(at: opmlURL) - switch result { - case .success: - break - case .failure(let error): - NSApplication.shared.presentError(error) - } - } - - } - } - - } - -} diff --git a/Mac/MainWindow/NNW3/NNW3Document.swift b/Mac/MainWindow/NNW3/NNW3Document.swift index d5738631f..536f5500d 100644 --- a/Mac/MainWindow/NNW3/NNW3Document.swift +++ b/Mac/MainWindow/NNW3/NNW3Document.swift @@ -7,47 +7,138 @@ // import Foundation +import RSCore -class NNW3Document: NNW3Entry { - - init(plist: [[String: Any]]) { - super.init(title: "NNW3") - - for child in plist { - if child["isContainer"] as? Bool ?? false { - entries.append(NNW3Entry(plist: child, parent: self)) - } else { - entries.append(NNW3Feed(plist: child, parent: self)) - } - } - +struct NNW3Document { + + private let children: [OPMLRepresentable]? + + private init(plist: [[String: AnyObject]]) { + self.children = NNW3Folder.itemsWithPlist(plist: plist) } - - override func makeXML(indentLevel: Int) -> String { - + + init?(subscriptionsPlistURL url: URL) { + guard let data = try? Data(contentsOf: url) else { + return nil + } + guard let plist = try? PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [[String: AnyObject]] else { + return nil + } + self.init(plist: plist) + } +} + +// MARK: OPMLRepresentable + +extension NNW3Document: OPMLRepresentable { + + func OPMLString(indentLevel: Int, strictConformance: Bool) -> String { var s = """ - \(title ?? "") + NetNewsWire 3 Subscriptions - + """ - - for entry in entries { - s += entry.makeXML(indentLevel: indentLevel + 1) + + if let children = children { + for child in children { + s += child.OPMLString(indentLevel: indentLevel + 1, strictConformance: true) + } } s += """ - - - """ - + + + """ + return s - } - } + +// MARK: - NNW3Folder + +private struct NNW3Folder { + + private let title: String? + private let children: [OPMLRepresentable]? + + init(plist: [String: Any]) { + self.title = plist["name"] as? String + guard let childrenArray = plist["childrenArray"] as? [[String: Any]] else { + self.children = nil + return + } + self.children = NNW3Folder.itemsWithPlist(plist: childrenArray) + } + + static func itemsWithPlist(plist: [[String: Any]]) -> [OPMLRepresentable]? { + // Also used by NNW3Document. + var items = [OPMLRepresentable]() + for child in plist { + if child["isContainer"] as? Bool ?? false { + items.append(NNW3Folder(plist: child)) + } else { + items.append(NNW3Feed(plist: child)) + } + } + return items.isEmpty ? nil : items + } +} + +// MARK: OPMLRepresentable + +extension NNW3Folder: OPMLRepresentable { + + func OPMLString(indentLevel: Int, strictConformance: Bool) -> String { + let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? "" + guard let children = children else { + // Empty folder. + return "\n".rs_string(byPrependingNumberOfTabs: indentLevel) + } + + var s = "\n".rs_string(byPrependingNumberOfTabs: indentLevel) + for child in children { + s += child.OPMLString(indentLevel: indentLevel + 1, strictConformance: true) + } + + s += "\n".rs_string(byPrependingNumberOfTabs: indentLevel) + return s + } +} + +// MARK: - NNW3Feed + +private struct NNW3Feed { + + private let title: String? + private let homePageURL: String? + private let feedURL: String? + + init(plist: [String: Any]) { + self.title = plist["name"] as? String + self.homePageURL = plist["home"] as? String + self.feedURL = plist["rss"] as? String + } +} + +// MARK: OPMLRepresentable + +extension NNW3Feed: OPMLRepresentable { + + func OPMLString(indentLevel: Int, strictConformance: Bool) -> String { + let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? "" + let p = homePageURL?.rs_stringByEscapingSpecialXMLCharacters() ?? "" + let f = feedURL?.rs_stringByEscapingSpecialXMLCharacters() ?? "" + + var s = "\n" + s = s.rs_string(byPrependingNumberOfTabs: indentLevel) + + return s + } +} + diff --git a/Mac/MainWindow/NNW3/NNW3Entry.swift b/Mac/MainWindow/NNW3/NNW3Entry.swift deleted file mode 100644 index 4cc19b911..000000000 --- a/Mac/MainWindow/NNW3/NNW3Entry.swift +++ /dev/null @@ -1,61 +0,0 @@ -// -// NNW3Entry.swift -// NetNewsWire -// -// Created by Maurice Parker on 10/14/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import Foundation -import RSCore - -class NNW3Entry { - - var title: String? - var entries = [NNW3Entry]() - - weak var parent: NNW3Entry? - - var isFolder: Bool { - return type(of: self) == NNW3Entry.self - } - - init(title: String?, parent: NNW3Entry? = nil) { - self.title = title - self.parent = parent - } - - convenience init(plist: [String: Any], parent: NNW3Entry? = nil) { - let title = plist["name"] as? String - self.init(title: title, parent: parent) - - guard let childrenArray = plist["childrenArray"] as? [[String: AnyObject]] else { - return - } - - for child in childrenArray { - if child["isContainer"] as? Bool ?? false { - entries.append(NNW3Entry(plist: child, parent: self)) - } else { - entries.append(NNW3Feed(plist: child, parent: self)) - } - } - - } - - func makeXML(indentLevel: Int) -> String { - - let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? "" - var s = "\n".rs_string(byPrependingNumberOfTabs: indentLevel) - - for entry in entries { - s += entry.makeXML(indentLevel: indentLevel + 1) - } - - s += "\n".rs_string(byPrependingNumberOfTabs: indentLevel) - - return s - - } - -} diff --git a/Mac/MainWindow/NNW3/NNW3Feed.swift b/Mac/MainWindow/NNW3/NNW3Feed.swift deleted file mode 100644 index f6d54a480..000000000 --- a/Mac/MainWindow/NNW3/NNW3Feed.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// NNW3Feed.swift -// NetNewsWire -// -// Created by Maurice Parker on 10/14/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import Foundation -import RSCore - -class NNW3Feed: NNW3Entry { - - var pageURL: String? - var feedURL: String? - - init(feedURL: String) { - super.init(title: nil) - self.feedURL = feedURL - } - - init(title: String?, pageURL: String?, feedURL: String?, parent: NNW3Entry? = nil) { - super.init(title: title, parent: parent) - self.pageURL = pageURL - self.feedURL = feedURL - } - - convenience init(plist: [String: Any], parent: NNW3Entry? = nil) { - let title = plist["name"] as? String - let pageURL = plist["home"] as? String - let feedURL = plist["rss"] as? String - self.init(title: title, pageURL: pageURL, feedURL: feedURL, parent: parent) - } - - override func makeXML(indentLevel: Int) -> String { - - let t = title?.rs_stringByEscapingSpecialXMLCharacters() ?? "" - let p = pageURL?.rs_stringByEscapingSpecialXMLCharacters() ?? "" - let f = feedURL?.rs_stringByEscapingSpecialXMLCharacters() ?? "" - - var s = "\n" - s = s.rs_string(byPrependingNumberOfTabs: indentLevel) - - return s - - } - -} diff --git a/Mac/MainWindow/NNW3/NNW3FeedsImporter.swift b/Mac/MainWindow/NNW3/NNW3FeedsImporter.swift deleted file mode 100644 index baaa14eba..000000000 --- a/Mac/MainWindow/NNW3/NNW3FeedsImporter.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// NNW3FeedsImporter.swift -// NetNewsWire -// -// Created by Maurice Parker on 10/14/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import Foundation -import Account -import RSCore - -struct NNW3FeedsImporter { - - static func importIfNeeded(_ isFirstRun: Bool, account: Account) { - guard shouldImportDefaultFeeds(isFirstRun) else { - return - } - - if !FileManager.default.fileExists(atPath: NNW3PlistConverter.defaultFilePath) { - return - } - - appDelegate.logDebugMessage("Importing NNW3 feeds.") - - let url = URL(fileURLWithPath: NNW3PlistConverter.defaultFilePath) - guard let opmlURL = NNW3PlistConverter.convertToOPML(url: url) else { - return - } - - account.importOPML(opmlURL) { result in - try? FileManager.default.removeItem(at: opmlURL) - switch result { - case .success: - appDelegate.logDebugMessage("Importing NNW3 feeds succeeded.") - case .failure(let error): - appDelegate.logDebugMessage("Importing NNW3 feeds failed. \(error.localizedDescription)") - } - } - - } - - private static func shouldImportDefaultFeeds(_ isFirstRun: Bool) -> Bool { - if !isFirstRun || AccountManager.shared.anyAccountHasAtLeastOneFeed() { - return false - } - return true - } - -} diff --git a/Mac/MainWindow/NNW3/NNW3ImportController.swift b/Mac/MainWindow/NNW3/NNW3ImportController.swift new file mode 100644 index 000000000..f3103e1e1 --- /dev/null +++ b/Mac/MainWindow/NNW3/NNW3ImportController.swift @@ -0,0 +1,108 @@ +// +// NNW3ImportController.swift +// NetNewsWire +// +// Created by Brent Simmons on 10/14/19. +// Copyright © 2019 Ranchero Software. All rights reserved. +// + +import AppKit +import Account + +struct NNW3ImportController { + + /// Import NNW3 subscriptions if they exist. + /// Return true if Subscriptions.plist was found and subscriptions were imported. + static func importSubscriptionsIfFileExists(account: Account) -> Bool { + guard let subscriptionsPlistURL = defaultFileURL else { + return false + } + if !FileManager.default.fileExists(atPath: subscriptionsPlistURL.path) { + return false + } + NNW3ImportController.importSubscriptionsPlist(subscriptionsPlistURL, into: account) + return true + } + + /// Run an NSOpenPanel and import subscriptions (if the user chooses to). + static func askUserToImportNNW3Subscriptions(window: NSWindow) { + chooseFile(window) + } +} + +private extension NNW3ImportController { + + /// URL to ~/Library/Application Support/NetNewsWire/Subscriptions.plist + static var defaultFileURL: URL? { + guard let applicationSupportURL = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first else { + return nil + } + let folderURL = applicationSupportURL.appendingPathComponent("NetNewsWire", isDirectory: true) + return folderURL.appendingPathComponent("Subscriptions.plist", isDirectory: false) + } + + /// Import Subscriptions.plist file. Convert to OPML and then import into specified Account. + static func importSubscriptionsPlist(_ subscriptionsPlistURL: URL, into account: Account) { + guard let opmlURL = convertToOPMLFile(subscriptionsPlistURL: subscriptionsPlistURL) else { + return + } + account.importOPML(opmlURL) { result in + try? FileManager.default.removeItem(at: opmlURL) + switch result { + case .success: + break + case .failure(let error): + NSApplication.shared.presentError(error) + } + } + } + + /// Run the NSOpenPanel. On success, import subscriptions to the selected account. + static func chooseFile(_ window: NSWindow) { + let accessoryViewController = NNW3OpenPanelAccessoryViewController() + + let panel = NSOpenPanel() + panel.canDownloadUbiquitousContents = true + panel.canResolveUbiquitousConflicts = true + panel.canChooseFiles = true + panel.allowsMultipleSelection = false + panel.canChooseDirectories = false + panel.resolvesAliases = true + panel.directoryURL = NNW3ImportController.defaultFileURL + panel.allowedFileTypes = ["plist"] + panel.allowsOtherFileTypes = false + panel.accessoryView = accessoryViewController.view + panel.isAccessoryViewDisclosed = true + panel.title = NSLocalizedString("Choose a Subscriptions.plist file:", comment: "NNW3 Import") + + panel.beginSheetModal(for: window) { modalResult in + guard modalResult == .OK, let subscriptionsPlistURL = panel.url else { + return + } + guard let account = accessoryViewController.selectedAccount else { + return + } + AppDefaults.importOPMLAccountID = account.accountID + + NNW3ImportController.importSubscriptionsPlist(subscriptionsPlistURL, into: account) + } + } + + /// Convert Subscriptions.plist on disk to a temporary OPML file. + static func convertToOPMLFile(subscriptionsPlistURL url: URL) -> URL? { + guard let document = NNW3Document(subscriptionsPlistURL: url) else { + return nil + } + let opml = document.OPMLString(indentLevel: 0, strictConformance: true) + + let opmlURL = FileManager.default.temporaryDirectory.appendingPathComponent("NNW3.opml") + do { + try opml.write(to: opmlURL, atomically: true, encoding: .utf8) + } catch let error as NSError { + NSApplication.shared.presentError(error) + return nil + } + + return opmlURL + } +} diff --git a/Mac/MainWindow/NNW3/NNW3OpenPanelAccessoryView.xib b/Mac/MainWindow/NNW3/NNW3OpenPanelAccessoryView.xib new file mode 100644 index 000000000..bfed3618b --- /dev/null +++ b/Mac/MainWindow/NNW3/NNW3OpenPanelAccessoryView.xib @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Choose a NetNewsWire 3 “Subscriptions.plist” file. + +Then choose the account to receive your imported subscriptions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mac/MainWindow/NNW3/NNW3OpenPanelAccessoryViewController.swift b/Mac/MainWindow/NNW3/NNW3OpenPanelAccessoryViewController.swift new file mode 100644 index 000000000..a7a05fc8f --- /dev/null +++ b/Mac/MainWindow/NNW3/NNW3OpenPanelAccessoryViewController.swift @@ -0,0 +1,47 @@ +// +// NNW3OpenPanelAccessoryViewController.swift +// NetNewsWire +// +// Created by Brent Simmons on 10/14/19. +// Copyright © 2019 Ranchero Software. All rights reserved. +// + +import AppKit +import Account + +final class NNW3OpenPanelAccessoryViewController: NSViewController { + + @IBOutlet weak var accountPopUpButton: NSPopUpButton! + + var selectedAccount: Account? { + accountPopUpButton.selectedItem?.representedObject as? Account + } + + init() { + super.init(nibName: "NNW3OpenPanelAccessoryView", bundle: nil) + } + + // MARK: - NSViewController + + required init?(coder: NSCoder) { + preconditionFailure("NNW3OpenPanelAccessoryViewController.init(coder) not implemented by design.") + } + + override func viewDidLoad() { + accountPopUpButton.removeAllItems() + + let menu = NSMenu() + accountPopUpButton.menu = menu + + for account in AccountManager.shared.sortedActiveAccounts { + let menuItem = NSMenuItem() + menuItem.title = account.nameForDisplay + menuItem.representedObject = account + menu.addItem(menuItem) + + if account.accountID == AppDefaults.importOPMLAccountID { + accountPopUpButton.select(menuItem) + } + } + } +} diff --git a/Mac/MainWindow/NNW3/NNW3PlistConverter.swift b/Mac/MainWindow/NNW3/NNW3PlistConverter.swift deleted file mode 100644 index 310a2d93d..000000000 --- a/Mac/MainWindow/NNW3/NNW3PlistConverter.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// NNW3Importer.swift -// NetNewsWire -// -// Created by Maurice Parker on 10/14/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -import Foundation - -class NNW3PlistConverter { - - static var defaultFilePath: String { - return ("~/Library/Application Support/NetNewsWire/Subscriptions.plist" as NSString).expandingTildeInPath - } - - static func convertToOPML(url: URL) -> URL? { - guard let data = try? Data(contentsOf: url) else { - return nil - } - - guard let nnw3plist = try? PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [[String: AnyObject]] else { - return nil - } - - let opmlURL = FileManager.default.temporaryDirectory.appendingPathComponent("NNW3.opml") - let doc = NNW3Document(plist: nnw3plist) - let opml = doc.makeXML(indentLevel: 0) - do { - try opml.write(to: opmlURL, atomically: true, encoding: .utf8) - } catch let error as NSError { - NSApplication.shared.presentError(error) - return nil - } - - return opmlURL - } - -} diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index c391ab627..adda18d22 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -3501,4 +3501,4 @@ /* End XCConfigurationList section */ }; rootObject = 849C64581ED37A5D003D8FC0 /* Project object */; -} +} \ No newline at end of file diff --git a/Shared/Importers/DefaultFeedsImporter.swift b/Shared/Importers/DefaultFeedsImporter.swift index 63ec5aa71..b86d39e36 100644 --- a/Shared/Importers/DefaultFeedsImporter.swift +++ b/Shared/Importers/DefaultFeedsImporter.swift @@ -12,21 +12,10 @@ import RSCore struct DefaultFeedsImporter { - static func importIfNeeded(_ isFirstRun: Bool, account: Account) { - guard shouldImportDefaultFeeds(isFirstRun) else { - return - } - + static func importDefaultFeeds(account: Account) { appDelegate.logDebugMessage("Importing default feeds.") let defaultFeedsURL = Bundle.main.url(forResource: "DefaultFeeds", withExtension: "opml")! AccountManager.shared.defaultAccount.importOPML(defaultFeedsURL) { result in } } - - private static func shouldImportDefaultFeeds(_ isFirstRun: Bool) -> Bool { - if !isFirstRun || AccountManager.shared.anyAccountHasAtLeastOneFeed() { - return false - } - return true - } }