From dfa124b5df39bf489f5c8e60149286a0c810220e Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sun, 7 Jan 2024 12:08:20 -0600 Subject: [PATCH] Gated and refactored code to get the Localization export to work correctly --- AppKitPlugin/AppKitDefaults.swift | 100 +++++++++++++++ AppKitPlugin/AppKitWrapper.swift | 2 +- AppKitPlugin/{ => Resources}/Info.plist | 0 AppKitPlugin/Resources/Localizable.xcstrings | 30 +++++ .../Sources/VinCloudKit/VCKModel.swift | 2 + .../Sources/VinOutlineKit/Account.swift | 6 + .../Sources/VinOutlineKit/AccountType.swift | 10 +- .../Sources/VinOutlineKit/AllDocuments.swift | 7 +- .../CloudKit/CloudKitManager.swift | 14 ++- .../CloudKit/CloudKitOutlineZone.swift | 7 +- .../VinOutlineKit/CursorCoordinates.swift | 6 + .../VinOutlineKit/DocumentContainer.swift | 6 + .../Sources/VinOutlineKit/Outline.swift | 6 + .../VinOutlineKit/OutlineElementChanges.swift | 2 + VinOutlineKit/Sources/VinOutlineKit/Row.swift | 11 ++ .../RowVisitors/PrintDocVisitor.swift | 8 ++ .../RowVisitors/PrintListVisitor.swift | 6 + .../Sources/VinOutlineKit/Search.swift | 7 ++ .../Sources/VinOutlineKit/TagDocuments.swift | 9 +- .../Utility/ImageTextAttachment.swift | 2 + .../Utility/MetadataTextAttachment.swift | 4 + .../Utility/MetadataViewManager.swift | 4 + VinUtility/Sources/VinUtility/Data+VU.swift | 6 +- .../VinUtility/NSAttributedString+VU.swift | 6 +- .../NSMutableAttributedString+.swift | 8 +- Zavala.xcodeproj/project.pbxproj | 54 +++++--- Zavala/About/AboutView.swift | 2 +- {Shared => Zavala}/AppDefaults.swift | 0 ...ImageAssets.swift => AppImageAssets.swift} | 2 +- {Shared => Zavala}/AppStringAssets.swift | 1 - .../CollectionsViewController.swift | 8 +- Zavala/CopyDocumentLinkActivity.swift | 2 +- .../Documents/DocumentsViewController.swift | 18 +-- .../DocumentsActivityItemsConfiguration.swift | 2 +- Zavala/Editor/EditorDisclosureButton.swift | 4 +- Zavala/Editor/EditorSearchBar.swift | 2 +- Zavala/Editor/EditorViewController.swift | 118 +++++++++--------- Zavala/Editor/Row/EditorRowContentView.swift | 6 +- Zavala/Editor/Tag/EditorTagContentView.swift | 2 +- Zavala/EditorContainerViewController.swift | 58 ++++----- Zavala/Image/ImageTransition.swift | 2 +- Zavala/MainSplitViewController.swift | 72 +++++------ ...acOpenQuicklyDocumentsViewController.swift | 2 +- .../OutlineFonts}/OutlineFontConfig.swift | 0 .../OutlineFonts}/OutlineFontDefaults.swift | 0 .../OutlineFonts}/OutlineFontField.swift | 0 Zavala/Utility/UIColor+.swift | 6 +- xcconfig/Zavala_appkitplugin_target.xcconfig | 2 +- 48 files changed, 444 insertions(+), 188 deletions(-) create mode 100644 AppKitPlugin/AppKitDefaults.swift rename AppKitPlugin/{ => Resources}/Info.plist (100%) create mode 100644 AppKitPlugin/Resources/Localizable.xcstrings rename {Shared => Zavala}/AppDefaults.swift (100%) rename Zavala/{ZavalaImageAssets.swift => AppImageAssets.swift} (99%) rename {Shared => Zavala}/AppStringAssets.swift (99%) rename {Shared => Zavala/OutlineFonts}/OutlineFontConfig.swift (100%) rename {Shared => Zavala/OutlineFonts}/OutlineFontDefaults.swift (100%) rename {Shared => Zavala/OutlineFonts}/OutlineFontField.swift (100%) diff --git a/AppKitPlugin/AppKitDefaults.swift b/AppKitPlugin/AppKitDefaults.swift new file mode 100644 index 00000000..d294b98f --- /dev/null +++ b/AppKitPlugin/AppKitDefaults.swift @@ -0,0 +1,100 @@ +// +// AppKitDefaults.swift +// AppKitPlugin +// +// Created by Maurice Parker on 1/6/24. +// + +import Foundation + +enum UserInterfaceColorPalette: Int, CustomStringConvertible, CaseIterable { + case automatic = 0 + case light = 1 + case dark = 2 + + var description: String { + switch self { + case .automatic: + return String(localized: "Automatic", comment: "Control Label: Automatic") + case .light: + return String(localized: "Light", comment: "Control Label: Light") + case .dark: + return String(localized: "Dark", comment: "Control Label: Dark") + } + } +} + +final class AppDefaults { + + static let shared = AppDefaults() + private init() {} + + static var store: UserDefaults = { + let appIdentifierPrefix = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String + let suiteName = "\(appIdentifierPrefix)group.\(Bundle.main.bundleIdentifier!)" + return UserDefaults.init(suiteName: suiteName)! + }() + + struct Key { + static let userInterfaceColorPalette = "userInterfaceColorPalette"; + } + + var userInterfaceColorPalette: UserInterfaceColorPalette { + get { + if let result = UserInterfaceColorPalette(rawValue: Self.int(for: Key.userInterfaceColorPalette)) { + return result + } + return .automatic + } + set { + Self.setInt(for: Key.userInterfaceColorPalette, newValue.rawValue) + } + } + +} + +// MARK: Helpers + +private extension AppDefaults { + + static func string(for key: String) -> String? { + return AppDefaults.store.string(forKey: key) + } + + static func setString(for key: String, _ value: String?) { + AppDefaults.store.set(value, forKey: key) + } + + static func bool(for key: String) -> Bool { + return AppDefaults.store.bool(forKey: key) + } + + static func setBool(for key: String, _ flag: Bool) { + AppDefaults.store.set(flag, forKey: key) + } + + static func int(for key: String) -> Int { + return AppDefaults.store.integer(forKey: key) + } + + static func setInt(for key: String, _ x: Int) { + AppDefaults.store.set(x, forKey: key) + } + + static func date(for key: String) -> Date? { + return AppDefaults.store.object(forKey: key) as? Date + } + + static func setDate(for key: String, _ date: Date?) { + AppDefaults.store.set(date, forKey: key) + } + + static func data(for key: String) -> Data? { + return AppDefaults.store.object(forKey: key) as? Data + } + + static func setData(for key: String, _ data: Data?) { + AppDefaults.store.set(data, forKey: key) + } + +} diff --git a/AppKitPlugin/AppKitWrapper.swift b/AppKitPlugin/AppKitWrapper.swift index c6115c2e..d570a7a7 100644 --- a/AppKitPlugin/AppKitWrapper.swift +++ b/AppKitPlugin/AppKitWrapper.swift @@ -46,7 +46,7 @@ import UniformTypeIdentifiers func configureOpenQuickly(_ window: NSObject?) { guard let nsWindow = window as? NSWindow else { return } - nsWindow.title = AppStringAssets.openQuicklyWindowTitle + nsWindow.title = String(localized: "Open Quickly", comment: "Window Title: Open Quickly") nsWindow.titlebarAppearsTransparent = true nsWindow.standardWindowButton(.zoomButton)?.isHidden = true nsWindow.standardWindowButton(.miniaturizeButton)?.isHidden = true diff --git a/AppKitPlugin/Info.plist b/AppKitPlugin/Resources/Info.plist similarity index 100% rename from AppKitPlugin/Info.plist rename to AppKitPlugin/Resources/Info.plist diff --git a/AppKitPlugin/Resources/Localizable.xcstrings b/AppKitPlugin/Resources/Localizable.xcstrings new file mode 100644 index 00000000..728724c9 --- /dev/null +++ b/AppKitPlugin/Resources/Localizable.xcstrings @@ -0,0 +1,30 @@ +{ + "sourceLanguage" : "en", + "strings" : { + "%@ was moved or renamed while open." : { + "comment" : "Message text for app moved while running alert" + }, + "Automatic" : { + "comment" : "Control Label: Automatic" + }, + "Dark" : { + "comment" : "Control Label: Dark" + }, + "Light" : { + "comment" : "Control Label: Light" + }, + "Moving an open application can cause unexpected behavior. Manually relaunch the application to continue." : { + "comment" : "Informative text for app moved while running alert" + }, + "Open Quickly" : { + "comment" : "Window Title: Open Quickly" + }, + "Terminate" : { + "comment" : "Relaunch Button" + }, + "This app" : { + "comment" : "Backup name if the app name cannot be deduced from the bundle" + } + }, + "version" : "1.0" +} \ No newline at end of file diff --git a/VinCloudKit/Sources/VinCloudKit/VCKModel.swift b/VinCloudKit/Sources/VinCloudKit/VCKModel.swift index c27b776d..5863aec4 100644 --- a/VinCloudKit/Sources/VinCloudKit/VCKModel.swift +++ b/VinCloudKit/Sources/VinCloudKit/VCKModel.swift @@ -59,6 +59,7 @@ public extension VCKModel { } } + #if canImport(UIKit) func merge(client: Data?, ancestor: Data?, server: Data?) -> Data? { switch VCKMergeScenario.evaluate(client: client, ancestor: ancestor, server: server) { case .clientWins: @@ -117,6 +118,7 @@ public extension VCKModel { } } } + #endif func merge(client: OrderedSet?, ancestor: OrderedSet?, server: OrderedSet?) -> OrderedSet where T:Equatable { let mergeClient = client != nil ? Array(client!) : nil diff --git a/VinOutlineKit/Sources/VinOutlineKit/Account.swift b/VinOutlineKit/Sources/VinOutlineKit/Account.swift index f60f8b04..c8f94b12 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Account.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Account.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 11/6/20. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif import CloudKit import VinXML import VinCloudKit @@ -121,9 +125,11 @@ public final class Account: NSObject, Identifiable, Codable { cloudKitManager?.userDidAcceptCloudKitShareWith(shareMetadata) } + #if canImport(UIKit) public func prepareCloudSharingController(document: Document, completion: @escaping (Result) -> Void) { cloudKitManager?.prepareCloudSharingController(document: document, completion: completion) } + #endif public func activate() { guard isActive == false else { return } diff --git a/VinOutlineKit/Sources/VinOutlineKit/AccountType.swift b/VinOutlineKit/Sources/VinOutlineKit/AccountType.swift index 2625e3fa..7ebc1a16 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/AccountType.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/AccountType.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 11/6/20. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif public enum AccountType: Int, Codable { case local = 0 @@ -14,6 +18,7 @@ public enum AccountType: Int, Codable { public var name: String { switch self { case .local: + #if canImport(UIKit) switch UIDevice.current.userInterfaceIdiom { case .mac: return VinOutlineKitStringAssets.accountOnMyMac @@ -24,11 +29,14 @@ public enum AccountType: Int, Codable { default: fatalError() } + #else + return VinOutlineKitStringAssets.accountOnMyMac + #endif case .cloudKit: return VinOutlineKitStringAssets.accountICloud } } - + var folderName: String { switch self { case .local: diff --git a/VinOutlineKit/Sources/VinOutlineKit/AllDocuments.swift b/VinOutlineKit/Sources/VinOutlineKit/AllDocuments.swift index fb97a3fa..cc885a4b 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/AllDocuments.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/AllDocuments.swift @@ -5,13 +5,18 @@ // Created by Maurice Parker on 1/27/21. // +#if canImport(UIKit) import UIKit - +#else +import Foundation +#endif public final class AllDocuments: Identifiable, DocumentContainer { public var id: EntityID public var name: String? = VinOutlineKitStringAssets.all + #if canImport(UIKit) public var image: UIImage? = UIImage(systemName: "tray")! + #endif public var itemCount: Int? { return account?.documents?.count diff --git a/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitManager.swift b/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitManager.swift index 3bc17a41..26932154 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitManager.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitManager.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 2/6/21. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif import OSLog import SystemConfiguration import CloudKit @@ -41,7 +45,9 @@ public class CloudKitManager { private weak var errorHandler: ErrorHandler? private weak var account: Account? + #if canImport(UIKit) private var sendChangesBackgroundTaskID = UIBackgroundTaskIdentifier.invalid + #endif private var debouncer = Debouncer(duration: 5) private var zones = [CKRecordZone.ID: CloudKitOutlineZone]() @@ -197,6 +203,7 @@ public class CloudKitManager { container.add(op) } + #if canImport(UIKit) func prepareCloudSharingController(document: Document, completion: @escaping (Result) -> Void) { guard let zoneID = document.zoneID else { completion(.failure(CloudKitOutlineZoneError.unknown)) @@ -210,7 +217,8 @@ public class CloudKitManager { zone.prepareNewCloudSharingController(document: document, completion: completion) } } - + #endif + func resume() { sync() } @@ -256,6 +264,7 @@ private extension CloudKitManager { func sendChanges(userInitiated: Bool, completion: @escaping (() -> Void)) { isSyncing = true + #if canImport(UIKit) let completeProcessing = { [unowned self] in self.isSyncing = false @@ -269,6 +278,7 @@ private extension CloudKitManager { completeProcessing() self?.logger.info("CloudKit sync processing terminated for running too long.") } + #endif let operation = CloudKitModifyOperation() @@ -281,7 +291,9 @@ private extension CloudKitManager { } } + #if canImport(UIKit) completeProcessing() + #endif } self.queue.add(operation) diff --git a/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitOutlineZone.swift b/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitOutlineZone.swift index f3215167..e88f953e 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitOutlineZone.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/CloudKit/CloudKitOutlineZone.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 2/6/21. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif import OSLog import CloudKit import VinCloudKit @@ -38,6 +42,7 @@ final class CloudKitOutlineZone: VCKZone { self.zoneID = zoneID } + #if canImport(UIKit) func prepareSharedCloudSharingController(document: Document, completion: @escaping (Result) -> Void) { guard let shareRecordID = document.shareRecordID else { fatalError() @@ -94,5 +99,5 @@ final class CloudKitOutlineZone: VCKZone { completion(.success(sharingController)) } - + #endif } diff --git a/VinOutlineKit/Sources/VinOutlineKit/CursorCoordinates.swift b/VinOutlineKit/Sources/VinOutlineKit/CursorCoordinates.swift index 70ad38ea..18c0f708 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/CursorCoordinates.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/CursorCoordinates.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 12/20/20. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif public protocol CursorCoordinatesProvider { var coordinates: CursorCoordinates? { get } @@ -27,9 +31,11 @@ public struct CursorCoordinates { @available(iOSApplicationExtension, unavailable) public static var currentCoordinates: CursorCoordinates? { + #if canImport(UIKit) if let provider = UIResponder.currentFirstResponder as? CursorCoordinatesProvider { return provider.coordinates } + #endif return nil } diff --git a/VinOutlineKit/Sources/VinOutlineKit/DocumentContainer.swift b/VinOutlineKit/Sources/VinOutlineKit/DocumentContainer.swift index 9d884a35..dc83b543 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/DocumentContainer.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/DocumentContainer.swift @@ -5,12 +5,18 @@ // Created by Maurice Parker on 11/9/20. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif public protocol DocumentContainer: DocumentProvider { var id: EntityID { get } var name: String? { get } + #if canImport(UIKit) var image: UIImage? { get } + #endif var itemCount: Int? { get } var account: Account? { get } } diff --git a/VinOutlineKit/Sources/VinOutlineKit/Outline.swift b/VinOutlineKit/Sources/VinOutlineKit/Outline.swift index 4d53fd14..06a662b5 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Outline.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Outline.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 11/6/20. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif import CloudKit import OrderedCollections import VinUtility @@ -3006,6 +3010,7 @@ private extension Outline { } func appendPrintTitle(attrString: NSMutableAttributedString) { + #if canImport(UIKit) if let title { let titleFont = UIFont.systemFont(ofSize: 18).with(traits: .traitBold) @@ -3023,6 +3028,7 @@ private extension Outline { attrString.append(printTitle) } + #endif } } diff --git a/VinOutlineKit/Sources/VinOutlineKit/OutlineElementChanges.swift b/VinOutlineKit/Sources/VinOutlineKit/OutlineElementChanges.swift index 790bcdf2..004952c3 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/OutlineElementChanges.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/OutlineElementChanges.swift @@ -37,6 +37,7 @@ public struct OutlineElementChanges { return (deletes?.isEmpty ?? true) && (inserts?.isEmpty ?? true) && (moves?.isEmpty ?? true) } + #if canImport(UIKit) public var deleteIndexPaths: [IndexPath]? { guard let deletes else { return nil } return deletes.map { IndexPath(row: $0, section: section.rawValue) } @@ -56,6 +57,7 @@ public struct OutlineElementChanges { guard let reloads else { return nil } return reloads.map { IndexPath(row: $0, section: section.rawValue) } } + #endif init(section: Outline.Section, deletes: Set? = nil, inserts: Set? = nil, moves: Set? = nil, reloads: Set? = nil) { self.section = section diff --git a/VinOutlineKit/Sources/VinOutlineKit/Row.swift b/VinOutlineKit/Sources/VinOutlineKit/Row.swift index 0970c660..bcd7794d 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Row.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Row.swift @@ -457,6 +457,8 @@ public final class Row: NSObject, NSCopying, RowContainer, Codable, Identifiable var matchedImages = [Image]() func importMarkdown(_ markdown: String?, isInNotes: Bool) -> NSAttributedString? { + + #if canImport(UIKit) if let markdown { let mangledMarkdown = markdown.replacingOccurrences(of: "![", with: "!]") let attrString = NSMutableAttributedString(markdownRepresentation: mangledMarkdown, attributes: [.font : UIFont.preferredFont(forTextStyle: .body)]) @@ -488,6 +490,7 @@ public final class Row: NSObject, NSCopying, RowContainer, Codable, Identifiable return attrString } + #endif return nil } @@ -714,6 +717,7 @@ private extension Row { let mutableAttrString = NSMutableAttributedString(attributedString: attrString) var images = [Image]() + #if canImport(UIKit) mutableAttrString.enumerateAttribute(.attachment, in: .init(location: 0, length: mutableAttrString.length), options: []) { (value, range, _) in if let imageTextAttachment = value as? ImageTextAttachment, let imageUUID = imageTextAttachment.imageUUID, let pngData = imageTextAttachment.image?.pngData() { let entityID = EntityID.image(outline.id.accountID, outline.id.documentUUID, id, imageUUID) @@ -722,6 +726,7 @@ private extension Row { } mutableAttrString.removeAttribute(.attachment, range: range) } + #endif return (mutableAttrString, images) } @@ -757,6 +762,7 @@ private extension Row { return nil } + #if canImport(UIKit) let mangledMarkdown = markdown.replacingOccurrences(of: "![", with: "!]") let result = NSMutableAttributedString(markdownRepresentation: mangledMarkdown, attributes: [.font : UIFont.preferredFont(forTextStyle: .body)]) let strippedString = result.string @@ -786,9 +792,13 @@ private extension Row { resolveAltLinks(attrString: result) return result + #else + return nil + #endif } func insertImageAttachment(attrString: NSMutableAttributedString, image: Image, offset: Int) { + #if canImport(UIKit) let attachment = ImageTextAttachment(data: image.data, ofType: UTType.png.identifier) attachment.imageUUID = image.id.imageUUID let imageAttrText = NSAttributedString(attachment: attachment) @@ -799,6 +809,7 @@ private extension Row { } else { attrString.insert(imageAttrText, at: attrString.length) } + #endif } @discardableResult diff --git a/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintDocVisitor.swift b/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintDocVisitor.swift index a562f553..ef604a75 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintDocVisitor.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintDocVisitor.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 9/24/21. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif class PrintDocVisitor { @@ -62,6 +66,7 @@ class PrintDocVisitor { private extension PrintDocVisitor { func printTopic(_ topic: NSAttributedString, row: Row) { + #if canImport(UIKit) print.append(NSAttributedString(string: "\n\n")) var attrs = [NSAttributedString.Key : Any]() if row.isComplete ?? false || row.isAnyParentComplete { @@ -89,9 +94,11 @@ private extension PrintDocVisitor { printTopic.replaceFont(with: topicFont) print.append(printTopic) + #endif } func printNote(_ note: NSAttributedString) { + #if canImport(UIKit) var attrs = [NSAttributedString.Key : Any]() attrs[.foregroundColor] = UIColor.darkGray @@ -112,6 +119,7 @@ private extension PrintDocVisitor { noteTopic.replaceFont(with: noteFont) print.append(noteTopic) + #endif } } diff --git a/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintListVisitor.swift b/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintListVisitor.swift index c2038c82..5215f3e9 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintListVisitor.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/RowVisitors/PrintListVisitor.swift @@ -5,7 +5,11 @@ // Created by Maurice Parker on 4/14/21. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif class PrintListVisitor { @@ -13,6 +17,7 @@ class PrintListVisitor { var print = NSMutableAttributedString() func visitor(_ visited: Row) { + #if canImport(UIKit) if let topic = visited.topic { print.append(NSAttributedString(string: "\n")) var attrs = [NSAttributedString.Key : Any]() @@ -72,6 +77,7 @@ class PrintListVisitor { print.append(noteTopic) } + #endif indentLevel = indentLevel + 1 visited.rows.forEach { diff --git a/VinOutlineKit/Sources/VinOutlineKit/Search.swift b/VinOutlineKit/Sources/VinOutlineKit/Search.swift index 4ae01353..03abba1f 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Search.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Search.swift @@ -5,14 +5,21 @@ // Created by Maurice Parker on 1/12/21. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif import CoreSpotlight public final class Search: Identifiable, DocumentContainer { public var id: EntityID public var name: String? = VinOutlineKitStringAssets.search + + #if canImport(UIKit) public var image: UIImage? + #endif public var account: Account? = nil public var itemCount: Int? { diff --git a/VinOutlineKit/Sources/VinOutlineKit/TagDocuments.swift b/VinOutlineKit/Sources/VinOutlineKit/TagDocuments.swift index 892fb6e3..262310d4 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/TagDocuments.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/TagDocuments.swift @@ -5,19 +5,25 @@ // Created by Maurice Parker on 2/2/21. // +#if canImport(UIKit) import UIKit +#else +import Foundation +#endif public final class TagDocuments: Identifiable, DocumentContainer { public var id: EntityID public var name: String? + #if canImport(UIKit) #if targetEnvironment(macCatalyst) public var image: UIImage? = UIImage(systemName: "capsule")!.applyingSymbolConfiguration(.init(pointSize: 12)) #else public var image: UIImage? = UIImage(systemName: "capsule")!.applyingSymbolConfiguration(.init(pointSize: 15)) #endif - + #endif + public var itemCount: Int? { guard let tag else { return nil } return account?.documents?.filter({ $0.hasTag(tag) }).count @@ -44,3 +50,4 @@ public final class TagDocuments: Identifiable, DocumentContainer { } } + diff --git a/VinOutlineKit/Sources/VinOutlineKit/Utility/ImageTextAttachment.swift b/VinOutlineKit/Sources/VinOutlineKit/Utility/ImageTextAttachment.swift index bafed4b1..bf2220c6 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Utility/ImageTextAttachment.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Utility/ImageTextAttachment.swift @@ -5,6 +5,7 @@ // Created by Maurice Parker on 4/6/21. // +#if canImport(UIKit) import UIKit public class ImageTextAttachment: NSTextAttachment { @@ -39,3 +40,4 @@ public class ImageTextAttachment: NSTextAttachment { } } +#endif diff --git a/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataTextAttachment.swift b/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataTextAttachment.swift index 2c527908..92de2dc8 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataTextAttachment.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataTextAttachment.swift @@ -5,6 +5,8 @@ // Created by Maurice Parker on 10/27/21. // +#if canImport(UIKit) + import UIKit public class MetadataTextAttachment: NSTextAttachment { @@ -33,3 +35,5 @@ public class MetadataTextAttachment: NSTextAttachment { } } + +#endif diff --git a/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataViewManager.swift b/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataViewManager.swift index 3ed4368c..27c9e074 100644 --- a/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataViewManager.swift +++ b/VinOutlineKit/Sources/VinOutlineKit/Utility/MetadataViewManager.swift @@ -5,6 +5,8 @@ // Created by Maurice Parker on 10/28/21. // +#if canImport(UIKit) + import UIKit public protocol MetadataViewProviding { @@ -14,3 +16,5 @@ public protocol MetadataViewProviding { public class MetadataViewManager { public static var provider: MetadataViewProviding! } + +#endif diff --git a/VinUtility/Sources/VinUtility/Data+VU.swift b/VinUtility/Sources/VinUtility/Data+VU.swift index 4f414cd5..c4447c82 100644 --- a/VinUtility/Sources/VinUtility/Data+VU.swift +++ b/VinUtility/Sources/VinUtility/Data+VU.swift @@ -6,12 +6,14 @@ import Foundation public extension Data { - #if canImport(UIKit) func toAttributedString() -> NSAttributedString? { + #if canImport(UIKit) return try? NSAttributedString(data: self, options: [.documentType: NSAttributedString.DocumentType.rtf, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil) + #else + return nil + #endif } - #endif } diff --git a/VinUtility/Sources/VinUtility/NSAttributedString+VU.swift b/VinUtility/Sources/VinUtility/NSAttributedString+VU.swift index 3814e1c7..e70b9246 100644 --- a/VinUtility/Sources/VinUtility/NSAttributedString+VU.swift +++ b/VinUtility/Sources/VinUtility/NSAttributedString+VU.swift @@ -34,10 +34,12 @@ public extension NSAttributedString { return NSAttributedString(attributedString: modifiedString) } - #if canImport(UIKit) func toData() -> Data? { + #if canImport(UIKit) return try? self.data(from: .init(location: 0, length: self.length), documentAttributes: [.documentType: NSAttributedString.DocumentType.rtf]) + #else + return nil + #endif } - #endif } diff --git a/VinUtility/Sources/VinUtility/NSMutableAttributedString+.swift b/VinUtility/Sources/VinUtility/NSMutableAttributedString+.swift index 1d3c87a9..60775578 100644 --- a/VinUtility/Sources/VinUtility/NSMutableAttributedString+.swift +++ b/VinUtility/Sources/VinUtility/NSMutableAttributedString+.swift @@ -11,7 +11,6 @@ import Foundation extension NSMutableAttributedString { - #if canImport(UIKit) @discardableResult public func detectData() -> Bool { let text = string @@ -19,6 +18,7 @@ extension NSMutableAttributedString { var changeWasMade = false + #if canImport(UIKit) let detector = NSDataDetector(dataTypes: DataDetectorType.allCases) detector.enumerateMatches(in: text) { result in let originalString = attributedSubstring(from: result.range) @@ -32,10 +32,12 @@ extension NSMutableAttributedString { changeWasMade = true } } + #endif return changeWasMade } + #if canImport(UIKit) public func replaceFont(with font: UIFont) { beginEditing() self.enumerateAttribute(.font, in: NSRange(location: 0, length: self.length)) { (value, range, stop) in @@ -48,8 +50,8 @@ extension NSMutableAttributedString { } endEditing() } - #endif - + #endif + public func addAttributes(_ attrs: [NSAttributedString.Key : Any] = [:]) { addAttributes(attrs, range: NSRange(location: 0, length: length)) } diff --git a/Zavala.xcodeproj/project.pbxproj b/Zavala.xcodeproj/project.pbxproj index aa1af2e8..79902f52 100644 --- a/Zavala.xcodeproj/project.pbxproj +++ b/Zavala.xcodeproj/project.pbxproj @@ -34,11 +34,6 @@ 511EC2C52B3F8F29002D89A5 /* SettingsAdvancedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 511EC2C42B3F8F29002D89A5 /* SettingsAdvancedView.swift */; }; 511EC2C72B409A5B002D89A5 /* ValueStepper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 511EC2C62B409A5B002D89A5 /* ValueStepper.swift */; }; 511EC2C82B422B22002D89A5 /* DocumentIndexer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5167606325F95E4600AC0EBD /* DocumentIndexer.swift */; }; - 511EC2CA2B422B4B002D89A5 /* AppDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 517AF69B25E0862E0044DBAB /* AppDefaults.swift */; }; - 511EC2CB2B422B4B002D89A5 /* AppStringAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5162AFF528EFB4A90002A61C /* AppStringAssets.swift */; }; - 511EC2CC2B422B7B002D89A5 /* OutlineFontField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519A2323260A9B900056051E /* OutlineFontField.swift */; }; - 511EC2CD2B422B7B002D89A5 /* OutlineFontConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5142C294260AC78C0094571F /* OutlineFontConfig.swift */; }; - 511EC2CE2B422B7B002D89A5 /* OutlineFontDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 516F5372260829060038BAF8 /* OutlineFontDefaults.swift */; }; 512229682563507E008041AF /* EditorRowViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512229672563507E008041AF /* EditorRowViewCell.swift */; }; 5125D01A26BE181500703DA4 /* SpotlightIndexExtension.appex in Embed PlugIns */ = {isa = PBXBuildFile; fileRef = 515D452026BB553600228229 /* SpotlightIndexExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 5126E7572AEF484000015491 /* VinOutlineKit in Frameworks */ = {isa = PBXBuildFile; productRef = 5126E7562AEF484000015491 /* VinOutlineKit */; }; @@ -163,10 +158,12 @@ 51E508E12B49F3450041B826 /* ApplyDiffOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E508E02B49F3450041B826 /* ApplyDiffOperation.swift */; }; 51E508E32B49F5B20041B826 /* ScrollToIndexPathOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E508E22B49F5B20041B826 /* ScrollToIndexPathOperation.swift */; }; 51E508E52B49F83A0041B826 /* ReconfigureIndexPathsOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E508E42B49F83A0041B826 /* ReconfigureIndexPathsOperation.swift */; }; + 51E508EA2B4A1E3B0041B826 /* AppKitDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E508E92B4A1E3B0041B826 /* AppKitDefaults.swift */; }; + 51E508ED2B4B1F490041B826 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 51E508EC2B4B1F490041B826 /* Localizable.xcstrings */; }; 51E5C48F27221F6200A38983 /* IntentOutline+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E5C48E27221F6200A38983 /* IntentOutline+.swift */; }; 51E5C49127221F6F00A38983 /* IntentRow+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51E5C49027221F6F00A38983 /* IntentRow+.swift */; }; 51EB162F270F46780079F40C /* ZavalaIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51EB162E270F46780079F40C /* ZavalaIntentHandler.swift */; }; - 51F13EFE255E13A9004B85CA /* ZavalaImageAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F13EFD255E13A9004B85CA /* ZavalaImageAssets.swift */; }; + 51F13EFE255E13A9004B85CA /* AppImageAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F13EFD255E13A9004B85CA /* AppImageAssets.swift */; }; 51F2859425AD11100019C573 /* CollectionsSearchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F2859325AD11100019C573 /* CollectionsSearchCell.swift */; }; 51F2859725AD11DB0019C573 /* CollectionsSearchContentConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F2859625AD11DB0019C573 /* CollectionsSearchContentConfiguration.swift */; }; 51F2859B25AD12800019C573 /* CollectionsSearchContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51F2859A25AD12800019C573 /* CollectionsSearchContentView.swift */; }; @@ -395,10 +392,12 @@ 51E508E02B49F3450041B826 /* ApplyDiffOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplyDiffOperation.swift; sourceTree = ""; }; 51E508E22B49F5B20041B826 /* ScrollToIndexPathOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollToIndexPathOperation.swift; sourceTree = ""; }; 51E508E42B49F83A0041B826 /* ReconfigureIndexPathsOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReconfigureIndexPathsOperation.swift; sourceTree = ""; }; + 51E508E92B4A1E3B0041B826 /* AppKitDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppKitDefaults.swift; sourceTree = ""; }; + 51E508EC2B4B1F490041B826 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; 51E5C48E27221F6200A38983 /* IntentOutline+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntentOutline+.swift"; sourceTree = ""; }; 51E5C49027221F6F00A38983 /* IntentRow+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntentRow+.swift"; sourceTree = ""; }; 51EB162E270F46780079F40C /* ZavalaIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZavalaIntentHandler.swift; sourceTree = ""; }; - 51F13EFD255E13A9004B85CA /* ZavalaImageAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZavalaImageAssets.swift; sourceTree = ""; }; + 51F13EFD255E13A9004B85CA /* AppImageAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppImageAssets.swift; sourceTree = ""; }; 51F2859325AD11100019C573 /* CollectionsSearchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionsSearchCell.swift; sourceTree = ""; }; 51F2859625AD11DB0019C573 /* CollectionsSearchContentConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionsSearchContentConfiguration.swift; sourceTree = ""; }; 51F2859A25AD12800019C573 /* CollectionsSearchContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionsSearchContentView.swift; sourceTree = ""; }; @@ -524,12 +523,7 @@ 5167606225F95E0400AC0EBD /* Shared */ = { isa = PBXGroup; children = ( - 517AF69B25E0862E0044DBAB /* AppDefaults.swift */, - 5162AFF528EFB4A90002A61C /* AppStringAssets.swift */, 5167606325F95E4600AC0EBD /* DocumentIndexer.swift */, - 5142C294260AC78C0094571F /* OutlineFontConfig.swift */, - 516F5372260829060038BAF8 /* OutlineFontDefaults.swift */, - 519A2323260A9B900056051E /* OutlineFontField.swift */, ); path = Shared; sourceTree = ""; @@ -612,7 +606,9 @@ 5181A9422554D92100C153E8 /* LaunchScreen.storyboard */, 5181A93D2554D92000C153E8 /* Main.storyboard */, 5188FAA82602A9CE0020B7DA /* OutlineEditor.storyboard */, - 51F13EFD255E13A9004B85CA /* ZavalaImageAssets.swift */, + 517AF69B25E0862E0044DBAB /* AppDefaults.swift */, + 5162AFF528EFB4A90002A61C /* AppStringAssets.swift */, + 51F13EFD255E13A9004B85CA /* AppImageAssets.swift */, 51E14F22255F2D7F00320EDB /* ActivityManager.swift */, 5181A9372554D92000C153E8 /* AppDelegate.swift */, 511B2AC726028EE700C04239 /* MainCoordinator.swift */, @@ -630,6 +626,7 @@ 517A9E31260512DC00EF346A /* OpenQuickly */, 517AF69E25E08A350044DBAB /* Settings */, 51C71C70273F22A500F6C779 /* Image */, + 51E508E82B4A1DBE0041B826 /* OutlineFonts */, 514BB9D5255B595300C8DBDF /* Utility */, 51AEEC8B2703E6B500354C59 /* Intents */, 515F163B255C536600FD98B8 /* Resources */, @@ -768,10 +765,11 @@ children = ( 51E060F325A4C13B00194066 /* AppKitPlugin.h */, 51E060F225A4C13B00194066 /* BridgingHeader.h */, + 51E508E92B4A1E3B0041B826 /* AppKitDefaults.swift */, 5162AFF928EFB5C00002A61C /* AppKitImageAssets.swift */, 51E060ED25A4B5E600194066 /* AppKitWrapper.swift */, 519965DB2624EEE500D8468B /* RSAppMovementMonitor.swift */, - 51E060B125A4547400194066 /* Info.plist */, + 51E508EB2B4B1F180041B826 /* Resources */, ); path = AppKitPlugin; sourceTree = ""; @@ -843,6 +841,25 @@ path = Operations; sourceTree = ""; }; + 51E508E82B4A1DBE0041B826 /* OutlineFonts */ = { + isa = PBXGroup; + children = ( + 5142C294260AC78C0094571F /* OutlineFontConfig.swift */, + 516F5372260829060038BAF8 /* OutlineFontDefaults.swift */, + 519A2323260A9B900056051E /* OutlineFontField.swift */, + ); + path = OutlineFonts; + sourceTree = ""; + }; + 51E508EB2B4B1F180041B826 /* Resources */ = { + isa = PBXGroup; + children = ( + 51E060B125A4547400194066 /* Info.plist */, + 51E508EC2B4B1F490041B826 /* Localizable.xcstrings */, + ); + path = Resources; + sourceTree = ""; + }; 51F13F01255E13D1004B85CA /* Dialogs */ = { isa = PBXGroup; children = ( @@ -1009,6 +1026,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 51E508ED2B4B1F490041B826 /* Localizable.xcstrings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1095,7 +1113,7 @@ 51F2859B25AD12800019C573 /* CollectionsSearchContentView.swift in Sources */, 51FA27462B3B9337008B665E /* SettingsHelpView.swift in Sources */, 51C030B8257E198B00609262 /* EditorTitleTextView.swift in Sources */, - 51F13EFE255E13A9004B85CA /* ZavalaImageAssets.swift in Sources */, + 51F13EFE255E13A9004B85CA /* AppImageAssets.swift in Sources */, 510471BD2719AEFA001DEFD5 /* RemoveRowsIntentHandler.swift in Sources */, 51E508E32B49F5B20041B826 /* ScrollToIndexPathOperation.swift in Sources */, 5109BC50292579A30022E90B /* CopyDocumentLinkActivity.swift in Sources */, @@ -1222,12 +1240,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 511EC2CC2B422B7B002D89A5 /* OutlineFontField.swift in Sources */, 51E2BCBD290EFB15002BA7B2 /* AppKitImageAssets.swift in Sources */, - 511EC2CA2B422B4B002D89A5 /* AppDefaults.swift in Sources */, - 511EC2CE2B422B7B002D89A5 /* OutlineFontDefaults.swift in Sources */, - 511EC2CD2B422B7B002D89A5 /* OutlineFontConfig.swift in Sources */, - 511EC2CB2B422B4B002D89A5 /* AppStringAssets.swift in Sources */, + 51E508EA2B4A1E3B0041B826 /* AppKitDefaults.swift in Sources */, 519965DC2624EEE500D8468B /* RSAppMovementMonitor.swift in Sources */, 51E060EE25A4B5E600194066 /* AppKitWrapper.swift in Sources */, ); diff --git a/Zavala/About/AboutView.swift b/Zavala/About/AboutView.swift index c9c41a03..602b68ad 100644 --- a/Zavala/About/AboutView.swift +++ b/Zavala/About/AboutView.swift @@ -20,7 +20,7 @@ struct AboutView: View { var body: some View { ZStack { if UIDevice.current.userInterfaceIdiom == .mac { - ZavalaImageAssets.aboutBackgroundColor.ignoresSafeArea() + AppImageAssets.aboutBackgroundColor.ignoresSafeArea() } else { VStack() { Capsule() diff --git a/Shared/AppDefaults.swift b/Zavala/AppDefaults.swift similarity index 100% rename from Shared/AppDefaults.swift rename to Zavala/AppDefaults.swift diff --git a/Zavala/ZavalaImageAssets.swift b/Zavala/AppImageAssets.swift similarity index 99% rename from Zavala/ZavalaImageAssets.swift rename to Zavala/AppImageAssets.swift index 4f6436b5..f9ca1afa 100644 --- a/Zavala/ZavalaImageAssets.swift +++ b/Zavala/AppImageAssets.swift @@ -8,7 +8,7 @@ import UIKit import SwiftUI -struct ZavalaImageAssets { +struct AppImageAssets { static var aboutBackgroundColor = Color("AboutBackgroundColor") static var accentColor = UIColor(named: "AccentColor")! diff --git a/Shared/AppStringAssets.swift b/Zavala/AppStringAssets.swift similarity index 99% rename from Shared/AppStringAssets.swift rename to Zavala/AppStringAssets.swift index 8750b783..77cb5f6b 100644 --- a/Shared/AppStringAssets.swift +++ b/Zavala/AppStringAssets.swift @@ -170,7 +170,6 @@ struct AppStringAssets { static var openQuicklyEllipsisControlLabel = String(localized: "Open Quickly…", comment: "Control Label: Open Quickly…") static var openQuicklySearchPlaceholder = String(localized: "Open Quickly", comment: "Search Field Placeholder: Open Quickly") - static var openQuicklyWindowTitle = String(localized: "Open Quickly", comment: "Window Title: Open Quickly") static var outlineControlLabel = String(localized: "Outline", comment: "Control Label: Outline") static var outlineOwnerControlLabel = String(localized: "Outline Owner", comment: "Control Label: Outline Owner") static var outlineDefaultsControlLabel = String(localized: "Outline Defaults", comment: "Control Label: Outline Defaults") diff --git a/Zavala/Collections/CollectionsViewController.swift b/Zavala/Collections/CollectionsViewController.swift index a6bb3d2f..86f34bd0 100644 --- a/Zavala/Collections/CollectionsViewController.swift +++ b/Zavala/Collections/CollectionsViewController.swift @@ -76,8 +76,8 @@ class CollectionsViewController: UICollectionViewController, MainControllerIdent navigationItem.rightBarButtonItem = selectBarButtonItem } else { let navButtonGroup = ButtonGroup(hostController: self, containerType: .standard, alignment: .right) - addButton = navButtonGroup.addButton(label: AppStringAssets.addControlLabel, image: ZavalaImageAssets.createEntity, selector: "createOutline:") - importButton = navButtonGroup.addButton(label: AppStringAssets.importOPMLControlLabel, image: ZavalaImageAssets.importDocument, selector: "importOPML:") + addButton = navButtonGroup.addButton(label: AppStringAssets.addControlLabel, image: AppImageAssets.createEntity, selector: "createOutline:") + importButton = navButtonGroup.addButton(label: AppStringAssets.importOPMLControlLabel, image: AppImageAssets.importDocument, selector: "importOPML:") let navButtonsBarButtonItem = navButtonGroup.buildBarButtonItem() navigationItem.rightBarButtonItem = navButtonsBarButtonItem @@ -520,7 +520,7 @@ private extension CollectionsViewController { func renameTagAction(containers: [DocumentContainer]) -> UIAction? { guard containers.count == 1, let container = containers.first, let tagDocuments = container as? TagDocuments else { return nil } - let action = UIAction(title: AppStringAssets.renameControlLabel, image: ZavalaImageAssets.rename) { [weak self] action in + let action = UIAction(title: AppStringAssets.renameControlLabel, image: AppImageAssets.rename) { [weak self] action in guard let self else { return } if self.traitCollection.userInterfaceIdiom == .mac { @@ -545,7 +545,7 @@ private extension CollectionsViewController { let tagDocuments = containers.compactMap { $0 as? TagDocuments } guard tagDocuments.count == containers.count else { return nil} - let action = UIAction(title: AppStringAssets.deleteControlLabel, image: ZavalaImageAssets.delete, attributes: .destructive) { [weak self] action in + let action = UIAction(title: AppStringAssets.deleteControlLabel, image: AppImageAssets.delete, attributes: .destructive) { [weak self] action in let deleteAction = UIAlertAction(title: AppStringAssets.deleteControlLabel, style: .destructive) { _ in for tagDocument in tagDocuments { if let tag = tagDocument.tag { diff --git a/Zavala/CopyDocumentLinkActivity.swift b/Zavala/CopyDocumentLinkActivity.swift index b01b6228..2416acae 100644 --- a/Zavala/CopyDocumentLinkActivity.swift +++ b/Zavala/CopyDocumentLinkActivity.swift @@ -29,7 +29,7 @@ class CopyDocumentLinkActivity: UIActivity { } override var activityImage: UIImage? { - ZavalaImageAssets.link + AppImageAssets.link } override class var activityCategory: UIActivity.Category { diff --git a/Zavala/Documents/DocumentsViewController.swift b/Zavala/Documents/DocumentsViewController.swift index d3ddd81f..74fa8c5f 100644 --- a/Zavala/Documents/DocumentsViewController.swift +++ b/Zavala/Documents/DocumentsViewController.swift @@ -72,8 +72,8 @@ class DocumentsViewController: UICollectionViewController, MainControllerIdentif collectionView.contentInset = UIEdgeInsets(top: 7, left: 0, bottom: 7, right: 0) } else { let navButtonGroup = ButtonGroup(hostController: self, containerType: .standard, alignment: .right) - addButton = navButtonGroup.addButton(label: AppStringAssets.addControlLabel, image: ZavalaImageAssets.createEntity, selector: "createOutline") - importButton = navButtonGroup.addButton(label: AppStringAssets.importOPMLControlLabel, image: ZavalaImageAssets.importDocument, selector: "importOPML") + addButton = navButtonGroup.addButton(label: AppStringAssets.addControlLabel, image: AppImageAssets.createEntity, selector: "createOutline") + importButton = navButtonGroup.addButton(label: AppStringAssets.importOPMLControlLabel, image: AppImageAssets.importDocument, selector: "importOPML") navButtonsBarButtonItem = navButtonGroup.buildBarButtonItem() searchController.delegate = self @@ -105,7 +105,7 @@ class DocumentsViewController: UICollectionViewController, MainControllerIdentif var contentConfiguration = UIListContentConfiguration.subtitleCell() if document.isCollaborating { let attrText = NSMutableAttributedString(string: "\(title) ") - let shareAttachement = NSTextAttachment(image: ZavalaImageAssets.collaborating) + let shareAttachement = NSTextAttachment(image: AppImageAssets.collaborating) attrText.append(NSAttributedString(attachment: shareAttachement)) contentConfiguration.attributedText = attrText } else { @@ -564,7 +564,7 @@ private extension DocumentsViewController { var printActions = [UIAction]() printActions.append(self.printDocsAction(outlines: outlines)) printActions.append(self.printListsAction(outlines: outlines)) - let printMenu = UIMenu(title: AppStringAssets.printControlLabel, image: ZavalaImageAssets.printDoc, children: printActions) + let printMenu = UIMenu(title: AppStringAssets.printControlLabel, image: AppImageAssets.printDoc, children: printActions) shareMenuItems.append(printMenu) var exportActions = [UIAction]() @@ -573,7 +573,7 @@ private extension DocumentsViewController { exportActions.append(self.exportMarkdownDocsOutlineAction(outlines: outlines)) exportActions.append(self.exportMarkdownListsOutlineAction(outlines: outlines)) exportActions.append(self.exportOPMLsAction(outlines: outlines)) - let exportMenu = UIMenu(title: AppStringAssets.exportControlLabel, image: ZavalaImageAssets.export, children: exportActions) + let exportMenu = UIMenu(title: AppStringAssets.exportControlLabel, image: AppImageAssets.export, children: exportActions) shareMenuItems.append(exportMenu) menuItems.append(UIMenu(title: "", options: .displayInline, children: shareMenuItems)) @@ -585,7 +585,7 @@ private extension DocumentsViewController { } func showGetInfoAction(document: Document) -> UIAction { - let action = UIAction(title: AppStringAssets.getInfoControlLabel, image: ZavalaImageAssets.getInfo) { [weak self] action in + let action = UIAction(title: AppStringAssets.getInfoControlLabel, image: AppImageAssets.getInfo) { [weak self] action in guard let self = self, let outline = document.outline else { return } self.delegate?.showGetInfo(self, outline: outline) } @@ -593,7 +593,7 @@ private extension DocumentsViewController { } func duplicateAction(documents: [Document]) -> UIAction { - let action = UIAction(title: AppStringAssets.duplicateControlLabel, image: ZavalaImageAssets.duplicate) { action in + let action = UIAction(title: AppStringAssets.duplicateControlLabel, image: AppImageAssets.duplicate) { action in for document in documents { document.load() let newDocument = document.duplicate() @@ -607,7 +607,7 @@ private extension DocumentsViewController { } func shareAction(documents: [Document], sourceView: UIView) -> UIAction { - let action = UIAction(title: AppStringAssets.shareEllipsisControlLabel, image: ZavalaImageAssets.share) { action in + let action = UIAction(title: AppStringAssets.shareEllipsisControlLabel, image: AppImageAssets.share) { action in let controller = UIActivityViewController(activityItemsConfiguration: DocumentsActivityItemsConfiguration(selectedDocuments: documents)) controller.popoverPresentationController?.sourceView = sourceView self.present(controller, animated: true) @@ -680,7 +680,7 @@ private extension DocumentsViewController { } func deleteDocumentsAction(documents: [Document]) -> UIAction { - let action = UIAction(title: AppStringAssets.deleteControlLabel, image: ZavalaImageAssets.delete, attributes: .destructive) { [weak self] action in + let action = UIAction(title: AppStringAssets.deleteControlLabel, image: AppImageAssets.delete, attributes: .destructive) { [weak self] action in self?.deleteDocuments(documents) } diff --git a/Zavala/DocumentsActivityItemsConfiguration.swift b/Zavala/DocumentsActivityItemsConfiguration.swift index 8495833c..8bc8c335 100644 --- a/Zavala/DocumentsActivityItemsConfiguration.swift +++ b/Zavala/DocumentsActivityItemsConfiguration.swift @@ -78,7 +78,7 @@ extension DocumentsActivityItemsConfiguration: UIActivityItemsConfigurationReadi case .title: return selectedDocuments[at].title case .linkPresentationMetadata: - let iconView = UIImageView(image: ZavalaImageAssets.outline) + let iconView = UIImageView(image: AppImageAssets.outline) iconView.backgroundColor = .accentColor iconView.tintColor = .label iconView.contentMode = .scaleAspectFit diff --git a/Zavala/Editor/EditorDisclosureButton.swift b/Zavala/Editor/EditorDisclosureButton.swift index 04b919df..0c309713 100644 --- a/Zavala/Editor/EditorDisclosureButton.swift +++ b/Zavala/Editor/EditorDisclosureButton.swift @@ -19,8 +19,8 @@ class EditorDisclosureButton: UIButton { private let pointerInteractionDelegate = EditorDisclosureButtonInteractionDelegate() func configure() { - self.configuration?.image = ZavalaImageAssets.disclosure - self.tintColor = ZavalaImageAssets.accessoryColor + self.configuration?.image = AppImageAssets.disclosure + self.tintColor = AppImageAssets.accessoryColor self.translatesAutoresizingMaskIntoConstraints = false self.addInteraction(UIPointerInteraction(delegate: pointerInteractionDelegate)) diff --git a/Zavala/Editor/EditorSearchBar.swift b/Zavala/Editor/EditorSearchBar.swift index 54e24d52..0bc9e169 100644 --- a/Zavala/Editor/EditorSearchBar.swift +++ b/Zavala/Editor/EditorSearchBar.swift @@ -56,7 +56,7 @@ import VinUtility override func didMoveToSuperview() { super.didMoveToSuperview() - layer.backgroundColor = ZavalaImageAssets.barBackgroundColor.cgColor + layer.backgroundColor = AppImageAssets.barBackgroundColor.cgColor isOpaque = true NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_:)), name: UITextField.textDidChangeNotification, object: searchField) } diff --git a/Zavala/Editor/EditorViewController.swift b/Zavala/Editor/EditorViewController.swift index b78439f0..1fbf8dc0 100644 --- a/Zavala/Editor/EditorViewController.swift +++ b/Zavala/Editor/EditorViewController.swift @@ -943,7 +943,7 @@ class EditorViewController: UIViewController, DocumentsActivityItemsConfiguratio if isFocusOutUnavailable { focusButton.accessibilityLabel = AppStringAssets.focusInControlLabel - focusButton.setImage(ZavalaImageAssets.focusInactive, for: .normal) + focusButton.setImage(AppImageAssets.focusInactive, for: .normal) if currentRows?.count ?? 0 == 1 { focusButton.isEnabled = true } else { @@ -951,16 +951,16 @@ class EditorViewController: UIViewController, DocumentsActivityItemsConfiguratio } } else { focusButton.accessibilityLabel = AppStringAssets.focusOutControlLabel - focusButton.setImage(ZavalaImageAssets.focusActive, for: .normal) + focusButton.setImage(AppImageAssets.focusActive, for: .normal) focusButton.isEnabled = true } if isFilterOn { filterButton.accessibilityLabel = AppStringAssets.turnFilterOffControlLabel - filterButton.setImage(ZavalaImageAssets.filterActive, for: .normal) + filterButton.setImage(AppImageAssets.filterActive, for: .normal) } else { filterButton.accessibilityLabel = AppStringAssets.turnFilterOnControlLabel - filterButton.setImage(ZavalaImageAssets.filterInactive, for: .normal) + filterButton.setImage(AppImageAssets.filterInactive, for: .normal) } filterButton.menu = buildFilterMenu() @@ -997,15 +997,15 @@ class EditorViewController: UIViewController, DocumentsActivityItemsConfiguratio // or it doesn't. if !isCreateRowNotesUnavailable { noteButton.isEnabled = true - noteButton.setImage(ZavalaImageAssets.noteAdd, for: .normal) + noteButton.setImage(AppImageAssets.noteAdd, for: .normal) noteButton.accessibilityLabel = AppStringAssets.addNoteControlLabel } else if !isDeleteRowNotesUnavailable { noteButton.isEnabled = true - noteButton.setImage(ZavalaImageAssets.noteDelete, for: .normal) + noteButton.setImage(AppImageAssets.noteDelete, for: .normal) noteButton.accessibilityLabel = AppStringAssets.deleteNoteControlLabel } else { noteButton.isEnabled = false - noteButton.setImage(ZavalaImageAssets.noteAdd, for: .normal) + noteButton.setImage(AppImageAssets.noteAdd, for: .normal) noteButton.accessibilityLabel = AppStringAssets.addNoteControlLabel } @@ -1431,9 +1431,9 @@ extension EditorViewController: UICollectionViewDelegate, UICollectionViewDataSo let action = UIContextualAction(style: .normal, title: AppStringAssets.uncompleteControlLabel, handler: actionHandler) if self.traitCollection.userInterfaceIdiom == .mac { - action.image = ZavalaImageAssets.uncompleteRow.symbolSizedForCatalyst(color: .white) + action.image = AppImageAssets.uncompleteRow.symbolSizedForCatalyst(color: .white) } else { - action.image = ZavalaImageAssets.uncompleteRow + action.image = AppImageAssets.uncompleteRow } action.backgroundColor = UIColor.accentColor @@ -1446,9 +1446,9 @@ extension EditorViewController: UICollectionViewDelegate, UICollectionViewDataSo let action = UIContextualAction(style: .normal, title: AppStringAssets.completeControlLabel, handler: actionHandler) if self.traitCollection.userInterfaceIdiom == .mac { - action.image = ZavalaImageAssets.completeRow.symbolSizedForCatalyst(color: .white) + action.image = AppImageAssets.completeRow.symbolSizedForCatalyst(color: .white) } else { - action.image = ZavalaImageAssets.completeRow + action.image = AppImageAssets.completeRow } action.backgroundColor = UIColor.accentColor @@ -1466,9 +1466,9 @@ extension EditorViewController: UICollectionViewDelegate, UICollectionViewDataSo let action = UIContextualAction(style: .destructive, title: AppStringAssets.deleteControlLabel, handler: actionHandler) if self.traitCollection.userInterfaceIdiom == .mac { - action.image = ZavalaImageAssets.delete.symbolSizedForCatalyst(color: .white) + action.image = AppImageAssets.delete.symbolSizedForCatalyst(color: .white) } else { - action.image = ZavalaImageAssets.delete + action.image = AppImageAssets.delete } return UISwipeActionsConfiguration(actions: [action]) @@ -1958,7 +1958,7 @@ extension EditorViewController: ImageTransitionDelegate { guard let splitView = splitViewController?.view else { return } let convertedFrame = splitView.convert(frame, to: collectionView) imageBlocker = UIView(frame: convertedFrame) - imageBlocker!.backgroundColor = ZavalaImageAssets.fullScreenBackgroundColor + imageBlocker!.backgroundColor = AppImageAssets.fullScreenBackgroundColor collectionView.addSubview(imageBlocker!) } @@ -1975,42 +1975,42 @@ private extension EditorViewController { func configureButtonBars() { undoMenuButtonGroup = ButtonGroup(hostController: self, containerType: .standard, alignment: .none) - undoButton = undoMenuButtonGroup.addButton(label: AppStringAssets.undoControlLabel, image: ZavalaImageAssets.undo, selector: "undo") - cutButton = undoMenuButtonGroup.addButton(label: AppStringAssets.cutControlLabel, image: ZavalaImageAssets.cut, selector: "cut:") - copyButton = undoMenuButtonGroup.addButton(label: AppStringAssets.copyControlLabel, image: ZavalaImageAssets.copy, selector: "copy:") - pasteButton = undoMenuButtonGroup.addButton(label: AppStringAssets.pasteControlLabel, image: ZavalaImageAssets.paste, selector: "paste:") - redoButton = undoMenuButtonGroup.addButton(label: AppStringAssets.redoControlLabel, image: ZavalaImageAssets.redo, selector: "redo") + undoButton = undoMenuButtonGroup.addButton(label: AppStringAssets.undoControlLabel, image: AppImageAssets.undo, selector: "undo") + cutButton = undoMenuButtonGroup.addButton(label: AppStringAssets.cutControlLabel, image: AppImageAssets.cut, selector: "cut:") + copyButton = undoMenuButtonGroup.addButton(label: AppStringAssets.copyControlLabel, image: AppImageAssets.copy, selector: "copy:") + pasteButton = undoMenuButtonGroup.addButton(label: AppStringAssets.pasteControlLabel, image: AppImageAssets.paste, selector: "paste:") + redoButton = undoMenuButtonGroup.addButton(label: AppStringAssets.redoControlLabel, image: AppImageAssets.redo, selector: "redo") navButtonGroup = ButtonGroup(hostController: self, containerType: .compactable, alignment: .right) - goBackwardButton = navButtonGroup.addButton(label: AppStringAssets.goBackwardControlLabel, image: ZavalaImageAssets.goBackward, selector: "goBackwardOne") - goForwardButton = navButtonGroup.addButton(label: AppStringAssets.goForwardControlLabel, image: ZavalaImageAssets.goForward, selector: "goForwardOne") - undoMenuButton = navButtonGroup.addButton(label: AppStringAssets.undoMenuControlLabel, image: ZavalaImageAssets.undoMenu, selector: "showUndoMenu") + goBackwardButton = navButtonGroup.addButton(label: AppStringAssets.goBackwardControlLabel, image: AppImageAssets.goBackward, selector: "goBackwardOne") + goForwardButton = navButtonGroup.addButton(label: AppStringAssets.goForwardControlLabel, image: AppImageAssets.goForward, selector: "goForwardOne") + undoMenuButton = navButtonGroup.addButton(label: AppStringAssets.undoMenuControlLabel, image: AppImageAssets.undoMenu, selector: "showUndoMenu") undoMenuButton.popoverButtonGroup = undoMenuButtonGroup - moreMenuButton = navButtonGroup.addButton(label: AppStringAssets.moreControlLabel, image: ZavalaImageAssets.ellipsis, showMenu: true) - focusButton = navButtonGroup.addButton(label: AppStringAssets.focusInControlLabel, image: ZavalaImageAssets.focusInactive, selector: "toggleFocus") - filterButton = navButtonGroup.addButton(label: AppStringAssets.filterControlLabel, image: ZavalaImageAssets.filterInactive, showMenu: true) + moreMenuButton = navButtonGroup.addButton(label: AppStringAssets.moreControlLabel, image: AppImageAssets.ellipsis, showMenu: true) + focusButton = navButtonGroup.addButton(label: AppStringAssets.focusInControlLabel, image: AppImageAssets.focusInactive, selector: "toggleFocus") + filterButton = navButtonGroup.addButton(label: AppStringAssets.filterControlLabel, image: AppImageAssets.filterInactive, showMenu: true) let navButtonsBarButtonItem = navButtonGroup.buildBarButtonItem() leftToolbarButtonGroup = ButtonGroup(hostController: self, containerType: .compactable, alignment: .left) - moveLeftButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveLeftControlLabel, image: ZavalaImageAssets.moveLeft, selector: "moveCurrentRowsLeft") - moveRightButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveRightControlLabel, image: ZavalaImageAssets.moveRight, selector: "moveCurrentRowsRight") - moveUpButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveUpControlLabel, image: ZavalaImageAssets.moveUp, selector: "moveCurrentRowsUp") - moveDownButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveDownControlLabel, image: ZavalaImageAssets.moveDown, selector: "moveCurrentRowsDown") + moveLeftButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveLeftControlLabel, image: AppImageAssets.moveLeft, selector: "moveCurrentRowsLeft") + moveRightButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveRightControlLabel, image: AppImageAssets.moveRight, selector: "moveCurrentRowsRight") + moveUpButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveUpControlLabel, image: AppImageAssets.moveUp, selector: "moveCurrentRowsUp") + moveDownButton = leftToolbarButtonGroup.addButton(label: AppStringAssets.moveDownControlLabel, image: AppImageAssets.moveDown, selector: "moveCurrentRowsDown") let moveButtonsBarButtonItem = leftToolbarButtonGroup.buildBarButtonItem() formatMenuButtonGroup = ButtonGroup(hostController: self, containerType: .standard, alignment: .none) - linkButton = formatMenuButtonGroup.addButton(label: AppStringAssets.linkControlLabel, image: ZavalaImageAssets.link, selector: "link") - let boldImage = ZavalaImageAssets.bold.applyingSymbolConfiguration(.init(pointSize: 25, weight: .regular, scale: .medium))! + linkButton = formatMenuButtonGroup.addButton(label: AppStringAssets.linkControlLabel, image: AppImageAssets.link, selector: "link") + let boldImage = AppImageAssets.bold.applyingSymbolConfiguration(.init(pointSize: 25, weight: .regular, scale: .medium))! boldButton = formatMenuButtonGroup.addButton(label: AppStringAssets.boldControlLabel, image: boldImage, selector: "outlineToggleBoldface:") - let italicImage = ZavalaImageAssets.italic.applyingSymbolConfiguration(.init(pointSize: 25, weight: .regular, scale: .medium))! + let italicImage = AppImageAssets.italic.applyingSymbolConfiguration(.init(pointSize: 25, weight: .regular, scale: .medium))! italicButton = formatMenuButtonGroup.addButton(label: AppStringAssets.italicControlLabel, image: italicImage, selector: "outlineToggleItalics:") rightToolbarButtonGroup = ButtonGroup(hostController: self, containerType: .compactable, alignment: .right) - insertImageButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.insertImageControlLabel, image: ZavalaImageAssets.insertImage, selector: "insertImage") - formatMenuButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.formatControlLabel, image: ZavalaImageAssets.format, selector: "showFormatMenu") + insertImageButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.insertImageControlLabel, image: AppImageAssets.insertImage, selector: "insertImage") + formatMenuButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.formatControlLabel, image: AppImageAssets.format, selector: "showFormatMenu") formatMenuButton.popoverButtonGroup = formatMenuButtonGroup - noteButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.addNoteControlLabel, image: ZavalaImageAssets.noteAdd, selector: "createOrDeleteNotes") - insertNewlineButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.newOutlineControlLabel, image: ZavalaImageAssets.newline, selector: "insertNewline") + noteButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.addNoteControlLabel, image: AppImageAssets.noteAdd, selector: "createOrDeleteNotes") + insertNewlineButton = rightToolbarButtonGroup.addButton(label: AppStringAssets.newOutlineControlLabel, image: AppImageAssets.newline, selector: "insertNewline") let insertButtonsBarButtonItem = rightToolbarButtonGroup.buildBarButtonItem() if traitCollection.userInterfaceIdiom != .mac { @@ -2020,7 +2020,7 @@ private extension EditorViewController { if traitCollection.userInterfaceIdiom == .pad { keyboardToolBar.items = [moveButtonsBarButtonItem, flexibleSpace, insertButtonsBarButtonItem] } else { - let hideKeyboardBarButtonItem = UIBarButtonItem(image: ZavalaImageAssets.hideKeyboard, style: .plain, target: self, action: #selector(hideKeyboard)) + let hideKeyboardBarButtonItem = UIBarButtonItem(image: AppImageAssets.hideKeyboard, style: .plain, target: self, action: #selector(hideKeyboard)) hideKeyboardBarButtonItem.accessibilityLabel = AppStringAssets.hideKeyboardControlLabel keyboardToolBar.items = [moveButtonsBarButtonItem, flexibleSpace, hideKeyboardBarButtonItem, flexibleSpace, insertButtonsBarButtonItem] } @@ -2053,22 +2053,22 @@ private extension EditorViewController { func buildEllipsisMenu() -> UIMenu { var outlineActions = [UIMenuElement]() - let getInfoAction = UIAction(title: AppStringAssets.getInfoControlLabel, image: ZavalaImageAssets.getInfo) { [weak self] _ in + let getInfoAction = UIAction(title: AppStringAssets.getInfoControlLabel, image: AppImageAssets.getInfo) { [weak self] _ in self?.showOutlineGetInfo() } outlineActions.append(getInfoAction) - let findAction = UIAction(title: AppStringAssets.findEllipsisControlLabel, image: ZavalaImageAssets.find) { [weak self] _ in + let findAction = UIAction(title: AppStringAssets.findEllipsisControlLabel, image: AppImageAssets.find) { [weak self] _ in self?.beginInDocumentSearch() } outlineActions.append(findAction) - let expandAllInOutlineAction = UIAction(title: AppStringAssets.expandAllInOutlineControlLabel, image: ZavalaImageAssets.expandAll) { [weak self] _ in + let expandAllInOutlineAction = UIAction(title: AppStringAssets.expandAllInOutlineControlLabel, image: AppImageAssets.expandAll) { [weak self] _ in self?.expandAllInOutline() } outlineActions.append(expandAllInOutlineAction) - let collapseAllInOutlineAction = UIAction(title: AppStringAssets.collapseAllInOutlineControlLabel, image: ZavalaImageAssets.collapseAll) { [weak self] _ in + let collapseAllInOutlineAction = UIAction(title: AppStringAssets.collapseAllInOutlineControlLabel, image: AppImageAssets.collapseAll) { [weak self] _ in self?.collapseAllInOutline() } outlineActions.append(collapseAllInOutlineAction) @@ -2076,13 +2076,13 @@ private extension EditorViewController { var shareActions = [UIMenuElement]() if !isCollaborateUnavailable { - let collaborateAction = UIAction(title: AppStringAssets.collaborateEllipsisControlLabel, image: ZavalaImageAssets.statelessCollaborate) { [weak self] _ in + let collaborateAction = UIAction(title: AppStringAssets.collaborateEllipsisControlLabel, image: AppImageAssets.statelessCollaborate) { [weak self] _ in self?.collaborate(self?.moreMenuButton) } shareActions.append(collaborateAction) } - let shareAction = UIAction(title: AppStringAssets.shareEllipsisControlLabel, image: ZavalaImageAssets.share) { [weak self] _ in + let shareAction = UIAction(title: AppStringAssets.shareEllipsisControlLabel, image: AppImageAssets.share) { [weak self] _ in self?.share(self?.moreMenuButton) } shareActions.append(shareAction) @@ -2093,7 +2093,7 @@ private extension EditorViewController { let printListAction = UIAction(title: AppStringAssets.printListControlEllipsisLabel) { [weak self] _ in self?.printList() } - shareActions.append(UIMenu(title: AppStringAssets.printControlLabel, image: ZavalaImageAssets.printDoc, children: [printDocAction, printListAction])) + shareActions.append(UIMenu(title: AppStringAssets.printControlLabel, image: AppImageAssets.printDoc, children: [printDocAction, printListAction])) let exportPDFDoc = UIAction(title: AppStringAssets.exportPDFDocEllipsisControlLabel) { [weak self] _ in guard let self = self, let outline = self.outline else { return } @@ -2116,10 +2116,10 @@ private extension EditorViewController { self.delegate?.exportOPML(self, outline: outline) } let exportActions = [exportPDFDoc, exportPDFList, exportMarkdownDoc, exportMarkdownList, exportOPML] - shareActions.append(UIMenu(title: AppStringAssets.exportControlLabel, image: ZavalaImageAssets.export, children: exportActions)) + shareActions.append(UIMenu(title: AppStringAssets.exportControlLabel, image: AppImageAssets.export, children: exportActions)) let deleteCompletedRowsAction = UIAction(title: AppStringAssets.deleteCompletedRowsControlLabel, - image: ZavalaImageAssets.delete, + image: AppImageAssets.delete, attributes: .destructive) { [weak self] _ in self?.deleteCompletedRows() } @@ -2536,7 +2536,7 @@ private extension EditorViewController { } func cutAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.cutControlLabel, image: ZavalaImageAssets.cut) { [weak self] action in + return UIAction(title: AppStringAssets.cutControlLabel, image: AppImageAssets.cut) { [weak self] action in guard let self else { return } self.cutRows(rows) self.delegate?.validateToolbar(self) @@ -2544,13 +2544,13 @@ private extension EditorViewController { } func copyAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.copyControlLabel, image: ZavalaImageAssets.copy) { [weak self] action in + return UIAction(title: AppStringAssets.copyControlLabel, image: AppImageAssets.copy) { [weak self] action in self?.copyRows(rows) } } func pasteAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.pasteControlLabel, image: ZavalaImageAssets.paste) { [weak self] action in + return UIAction(title: AppStringAssets.pasteControlLabel, image: AppImageAssets.paste) { [weak self] action in guard let self else { return } self.pasteRows(afterRows: rows) self.delegate?.validateToolbar(self) @@ -2558,7 +2558,7 @@ private extension EditorViewController { } func addAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.addRowControlLabel, image: ZavalaImageAssets.add) { [weak self] action in + return UIAction(title: AppStringAssets.addRowControlLabel, image: AppImageAssets.add) { [weak self] action in // Have to let the text field get the first responder by getting it away from this // action which appears to be holding on to it. DispatchQueue.main.async { @@ -2568,25 +2568,25 @@ private extension EditorViewController { } func duplicateAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.duplicateControlLabel, image: ZavalaImageAssets.duplicate) { [weak self] action in + return UIAction(title: AppStringAssets.duplicateControlLabel, image: AppImageAssets.duplicate) { [weak self] action in self?.duplicateRows(rows) } } func expandAllAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.expandAllControlLabel, image: ZavalaImageAssets.expandAll) { [weak self] action in + return UIAction(title: AppStringAssets.expandAllControlLabel, image: AppImageAssets.expandAll) { [weak self] action in self?.expandAll(containers: rows) } } func collapseAllAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.collapseAllControlLabel, image: ZavalaImageAssets.collapseAll) { [weak self] action in + return UIAction(title: AppStringAssets.collapseAllControlLabel, image: AppImageAssets.collapseAll) { [weak self] action in self?.collapseAll(containers: rows) } } func focusInAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.focusInControlLabel, image: ZavalaImageAssets.focusActive) { [weak self] action in + return UIAction(title: AppStringAssets.focusInControlLabel, image: AppImageAssets.focusActive) { [weak self] action in guard let self else { return } self.outline?.focusIn(rows.first!) self.delegate?.validateToolbar(self) @@ -2594,32 +2594,32 @@ private extension EditorViewController { } func completeAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.completeControlLabel, image: ZavalaImageAssets.completeRow) { [weak self] action in + return UIAction(title: AppStringAssets.completeControlLabel, image: AppImageAssets.completeRow) { [weak self] action in self?.completeRows(rows) } } func uncompleteAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.uncompleteControlLabel, image: ZavalaImageAssets.uncompleteRow) { [weak self] action in + return UIAction(title: AppStringAssets.uncompleteControlLabel, image: AppImageAssets.uncompleteRow) { [weak self] action in self?.uncompleteRows(rows) } } func createNoteAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.addNoteControlLabel, image: ZavalaImageAssets.noteAdd) { [weak self] action in + return UIAction(title: AppStringAssets.addNoteControlLabel, image: AppImageAssets.noteAdd) { [weak self] action in self?.createRowNotes(rows) } } func deleteNoteAction(rows: [Row]) -> UIAction { - return UIAction(title: AppStringAssets.deleteNoteControlLabel, image: ZavalaImageAssets.delete, attributes: .destructive) { [weak self] action in + return UIAction(title: AppStringAssets.deleteNoteControlLabel, image: AppImageAssets.delete, attributes: .destructive) { [weak self] action in self?.deleteRowNotes(rows) } } func deleteAction(rows: [Row]) -> UIAction { let title = rows.count == 1 ? AppStringAssets.deleteRowControlLabel : AppStringAssets.deleteRowsControlLabel - return UIAction(title: title, image: ZavalaImageAssets.delete, attributes: .destructive) { [weak self] action in + return UIAction(title: title, image: AppImageAssets.delete, attributes: .destructive) { [weak self] action in guard let self else { return } self.deleteRows(rows) self.delegate?.validateToolbar(self) diff --git a/Zavala/Editor/Row/EditorRowContentView.swift b/Zavala/Editor/Row/EditorRowContentView.swift index 282760d6..8aedd94e 100644 --- a/Zavala/Editor/Row/EditorRowContentView.swift +++ b/Zavala/Editor/Row/EditorRowContentView.swift @@ -40,14 +40,14 @@ class EditorRowContentView: UIView, UIContentView { }() private lazy var bullet: UIView = { - let bulletView = UIImageView(image: ZavalaImageAssets.bullet) + let bulletView = UIImageView(image: AppImageAssets.bullet) NSLayoutConstraint.activate([ bulletView.widthAnchor.constraint(equalToConstant: 4), bulletView.heightAnchor.constraint(equalToConstant: 4) ]) - bulletView.tintColor = ZavalaImageAssets.accessoryColor + bulletView.tintColor = AppImageAssets.accessoryColor bulletView.translatesAutoresizingMaskIntoConstraints = false return bulletView @@ -416,7 +416,7 @@ private extension EditorRowContentView { let x = (CGFloat(indentLevel) * indentationWidth) let bar = CGRect(x: x, y: 0, width: 2, height: bounds.size.height) - ZavalaImageAssets.verticalBarColor.setFill() + AppImageAssets.verticalBarColor.setFill() let context = UIGraphicsGetCurrentContext(); context?.addRect(bar) context?.fill(bar) diff --git a/Zavala/Editor/Tag/EditorTagContentView.swift b/Zavala/Editor/Tag/EditorTagContentView.swift index 9f08dc0a..e49e515e 100644 --- a/Zavala/Editor/Tag/EditorTagContentView.swift +++ b/Zavala/Editor/Tag/EditorTagContentView.swift @@ -27,7 +27,7 @@ class EditorTagContentView: UIView, UIContentView { button.contentEdgeInsets = UIEdgeInsets(top: 4, left: 8, bottom: 4, right: 8) button.layer.cornerRadius = button.intrinsicContentSize.height / 2 - let deleteAction = UIAction(title: AppStringAssets.removeTagControlLabel, image: ZavalaImageAssets.delete, attributes: .destructive) { [weak self] _ in + let deleteAction = UIAction(title: AppStringAssets.removeTagControlLabel, image: AppImageAssets.delete, attributes: .destructive) { [weak self] _ in guard let self = self, let name = self.button.currentTitle else { return } self.delegate?.editorTagDeleteTag(name: name) } diff --git a/Zavala/EditorContainerViewController.swift b/Zavala/EditorContainerViewController.swift index 83fb3a0e..a64d5e6f 100644 --- a/Zavala/EditorContainerViewController.swift +++ b/Zavala/EditorContainerViewController.swift @@ -335,7 +335,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { _ in return false } - item.image = ZavalaImageAssets.delete.symbolSizedForCatalyst() + item.image = AppImageAssets.delete.symbolSizedForCatalyst() item.label = AppStringAssets.deleteOutlineControlLabel item.toolTip = AppStringAssets.deleteOutlineControlLabel item.isBordered = true @@ -347,7 +347,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { _ in return !AccountManager.shared.isSyncAvailable } - item.image = ZavalaImageAssets.sync.symbolSizedForCatalyst() + item.image = AppImageAssets.sync.symbolSizedForCatalyst() item.label = AppStringAssets.syncControlLabel item.toolTip = AppStringAssets.syncControlLabel item.isBordered = true @@ -359,7 +359,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isInsertImageUnavailable ?? true } - item.image = ZavalaImageAssets.insertImage.symbolSizedForCatalyst() + item.image = AppImageAssets.insertImage.symbolSizedForCatalyst() item.label = AppStringAssets.insertImageControlLabel item.toolTip = AppStringAssets.insertImageControlLabel item.isBordered = true @@ -371,7 +371,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isLinkUnavailable ?? true } - item.image = ZavalaImageAssets.link.symbolSizedForCatalyst() + item.image = AppImageAssets.link.symbolSizedForCatalyst() item.label = AppStringAssets.linkControlLabel item.toolTip = AppStringAssets.linkControlLabel item.isBordered = true @@ -382,13 +382,13 @@ extension EditorContainerViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isBoldToggledOn ?? false { - item.image = ZavalaImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) + item.image = AppImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) } else { - item.image = ZavalaImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) } return self?.editorViewController?.isFormatUnavailable ?? true } - item.image = ZavalaImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) item.label = AppStringAssets.boldControlLabel item.toolTip = AppStringAssets.boldControlLabel item.isBordered = true @@ -399,13 +399,13 @@ extension EditorContainerViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isItalicToggledOn ?? false { - item.image = ZavalaImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) + item.image = AppImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) } else { - item.image = ZavalaImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) } return self?.editorViewController?.isFormatUnavailable ?? true } - item.image = ZavalaImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) item.label = AppStringAssets.italicControlLabel item.toolTip = AppStringAssets.italicControlLabel item.isBordered = true @@ -417,7 +417,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isExpandAllInOutlineUnavailable ?? true } - item.image = ZavalaImageAssets.expandAll.symbolSizedForCatalyst() + item.image = AppImageAssets.expandAll.symbolSizedForCatalyst() item.label = AppStringAssets.expandControlLabel item.toolTip = AppStringAssets.expandAllInOutlineControlLabel item.isBordered = true @@ -429,7 +429,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isCollapseAllInOutlineUnavailable ?? true } - item.image = ZavalaImageAssets.collapseAll.symbolSizedForCatalyst() + item.image = AppImageAssets.collapseAll.symbolSizedForCatalyst() item.label = AppStringAssets.collapseControlLabel item.toolTip = AppStringAssets.collapseAllInOutlineControlLabel item.isBordered = true @@ -441,7 +441,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsRightUnavailable ?? true } - item.image = ZavalaImageAssets.moveRight.symbolSizedForCatalyst() + item.image = AppImageAssets.moveRight.symbolSizedForCatalyst() item.label = AppStringAssets.moveRightControlLabel item.toolTip = AppStringAssets.moveRightControlLabel item.isBordered = true @@ -453,7 +453,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsLeftUnavailable ?? true } - item.image = ZavalaImageAssets.moveLeft.symbolSizedForCatalyst() + item.image = AppImageAssets.moveLeft.symbolSizedForCatalyst() item.label = AppStringAssets.moveLeftControlLabel item.toolTip = AppStringAssets.moveLeftControlLabel item.isBordered = true @@ -465,7 +465,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsUpUnavailable ?? true } - item.image = ZavalaImageAssets.moveUp.symbolSizedForCatalyst() + item.image = AppImageAssets.moveUp.symbolSizedForCatalyst() item.label = AppStringAssets.moveUpControlLabel item.toolTip = AppStringAssets.moveUpControlLabel item.isBordered = true @@ -477,7 +477,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsDownUnavailable ?? true } - item.image = ZavalaImageAssets.moveDown.symbolSizedForCatalyst() + item.image = AppImageAssets.moveDown.symbolSizedForCatalyst() item.label = AppStringAssets.moveDownControlLabel item.toolTip = AppStringAssets.moveDownControlLabel item.isBordered = true @@ -488,17 +488,17 @@ extension EditorContainerViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isFocusOutUnavailable ?? true { - item.image = ZavalaImageAssets.focusInactive.symbolSizedForCatalyst(pointSize: 17) + item.image = AppImageAssets.focusInactive.symbolSizedForCatalyst(pointSize: 17) item.label = AppStringAssets.focusInControlLabel item.toolTip = AppStringAssets.focusInControlLabel } else { - item.image = ZavalaImageAssets.focusActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) + item.image = AppImageAssets.focusActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) item.label = AppStringAssets.focusOutControlLabel item.toolTip = AppStringAssets.focusOutControlLabel } return self?.editorViewController?.isFocusInUnavailable ?? true && self?.editorViewController?.isFocusOutUnavailable ?? true } - item.image = ZavalaImageAssets.focusInactive.symbolSizedForCatalyst() + item.image = AppImageAssets.focusInactive.symbolSizedForCatalyst() item.label = AppStringAssets.focusInControlLabel item.toolTip = AppStringAssets.focusInControlLabel item.isBordered = true @@ -511,9 +511,9 @@ extension EditorContainerViewController: NSToolbarDelegate { guard let self else { return false } if self.editorViewController?.isFilterOn ?? false { - item.image = ZavalaImageAssets.filterActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) + item.image = AppImageAssets.filterActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) } else { - item.image = ZavalaImageAssets.filterInactive.symbolSizedForCatalyst(pointSize: 17) + item.image = AppImageAssets.filterInactive.symbolSizedForCatalyst(pointSize: 17) } let turnFilterOnAction = UIAction() { [weak self] _ in @@ -548,7 +548,7 @@ extension EditorContainerViewController: NSToolbarDelegate { return self.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.filterInactive.symbolSizedForCatalyst() + item.image = AppImageAssets.filterInactive.symbolSizedForCatalyst() item.label = AppStringAssets.filterControlLabel item.toolTip = AppStringAssets.filterControlLabel item.isBordered = true @@ -560,7 +560,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.printDoc.symbolSizedForCatalyst() + item.image = AppImageAssets.printDoc.symbolSizedForCatalyst() item.label = AppStringAssets.printDocControlLabel item.toolTip = AppStringAssets.printDocControlLabel item.isBordered = true @@ -572,7 +572,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.printList.symbolSizedForCatalyst() + item.image = AppImageAssets.printList.symbolSizedForCatalyst() item.label = AppStringAssets.printListControlLabel item.toolTip = AppStringAssets.printListControlLabel item.isBordered = true @@ -583,15 +583,15 @@ extension EditorContainerViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isDocumentCollaborating ?? false { - item.image = ZavalaImageAssets.collaborating.symbolSizedForCatalyst() + item.image = AppImageAssets.collaborating.symbolSizedForCatalyst() } else if self?.editorViewController?.isCollaborateUnavailable ?? true { - item.image = ZavalaImageAssets.statelessCollaborate.symbolSizedForCatalyst() + item.image = AppImageAssets.statelessCollaborate.symbolSizedForCatalyst() } else { - item.image = ZavalaImageAssets.collaborate.symbolSizedForCatalyst() + item.image = AppImageAssets.collaborate.symbolSizedForCatalyst() } return self?.editorViewController?.isCollaborateUnavailable ?? true } - item.image = ZavalaImageAssets.collaborate.symbolSizedForCatalyst() + item.image = AppImageAssets.collaborate.symbolSizedForCatalyst() item.label = AppStringAssets.collaborateControlLabel item.toolTip = AppStringAssets.collaborateControlLabel item.isBordered = true @@ -609,7 +609,7 @@ extension EditorContainerViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.getInfo.symbolSizedForCatalyst() + item.image = AppImageAssets.getInfo.symbolSizedForCatalyst() item.label = AppStringAssets.getInfoControlLabel item.toolTip = AppStringAssets.getInfoControlLabel item.isBordered = true diff --git a/Zavala/Image/ImageTransition.swift b/Zavala/Image/ImageTransition.swift index 95b10d50..c98a5d50 100644 --- a/Zavala/Image/ImageTransition.swift +++ b/Zavala/Image/ImageTransition.swift @@ -52,7 +52,7 @@ private extension ImageTransition { let fromView = transitionContext.view(forKey: .from)! fromView.removeFromSuperview() - transitionContext.containerView.backgroundColor = ZavalaImageAssets.fullScreenBackgroundColor + transitionContext.containerView.backgroundColor = AppImageAssets.fullScreenBackgroundColor transitionContext.containerView.addSubview(imageView) delegate?.hideImage(self, frame: originFrame) diff --git a/Zavala/MainSplitViewController.swift b/Zavala/MainSplitViewController.swift index 7a2b807a..470a5d8c 100644 --- a/Zavala/MainSplitViewController.swift +++ b/Zavala/MainSplitViewController.swift @@ -905,7 +905,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { _ in return !AccountManager.shared.isSyncAvailable } - item.image = ZavalaImageAssets.sync.symbolSizedForCatalyst() + item.image = AppImageAssets.sync.symbolSizedForCatalyst() item.label = AppStringAssets.syncControlLabel item.toolTip = AppStringAssets.syncControlLabel item.isBordered = true @@ -917,7 +917,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { _ in return false } - item.image = ZavalaImageAssets.importDocument.symbolSizedForCatalyst() + item.image = AppImageAssets.importDocument.symbolSizedForCatalyst() item.label = AppStringAssets.importOPMLControlLabel item.toolTip = AppStringAssets.importOPMLControlLabel item.isBordered = true @@ -929,7 +929,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { _ in return false } - item.image = ZavalaImageAssets.createEntity.symbolSizedForCatalyst() + item.image = AppImageAssets.createEntity.symbolSizedForCatalyst() item.label = AppStringAssets.newOutlineControlLabel item.toolTip = AppStringAssets.newOutlineControlLabel item.isBordered = true @@ -941,7 +941,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isInsertImageUnavailable ?? true } - item.image = ZavalaImageAssets.insertImage.symbolSizedForCatalyst() + item.image = AppImageAssets.insertImage.symbolSizedForCatalyst() item.label = AppStringAssets.insertImageControlLabel item.toolTip = AppStringAssets.insertImageControlLabel item.isBordered = true @@ -971,7 +971,7 @@ extension MainSplitViewController: NSToolbarDelegate { return self.isGoBackwardOneUnavailable } - goBackwardItem.image = ZavalaImageAssets.goBackward.symbolSizedForCatalyst() + goBackwardItem.image = AppImageAssets.goBackward.symbolSizedForCatalyst() goBackwardItem.label = AppStringAssets.goBackwardControlLabel goBackwardItem.toolTip = AppStringAssets.goBackwardControlLabel goBackwardItem.isBordered = true @@ -996,7 +996,7 @@ extension MainSplitViewController: NSToolbarDelegate { return self.isGoForwardOneUnavailable } - goForwardItem.image = ZavalaImageAssets.goForward.symbolSizedForCatalyst() + goForwardItem.image = AppImageAssets.goForward.symbolSizedForCatalyst() goForwardItem.label = AppStringAssets.goForwardControlLabel goForwardItem.toolTip = AppStringAssets.goForwardControlLabel goForwardItem.isBordered = true @@ -1012,7 +1012,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isLinkUnavailable ?? true } - item.image = ZavalaImageAssets.link.symbolSizedForCatalyst() + item.image = AppImageAssets.link.symbolSizedForCatalyst() item.label = AppStringAssets.linkControlLabel item.toolTip = AppStringAssets.linkControlLabel item.isBordered = true @@ -1023,23 +1023,23 @@ extension MainSplitViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if !(self?.editorViewController?.isCreateRowNotesUnavailable ?? true) { - item.image = ZavalaImageAssets.noteAdd.symbolSizedForCatalyst() + item.image = AppImageAssets.noteAdd.symbolSizedForCatalyst() item.label = AppStringAssets.addNoteControlLabel item.toolTip = AppStringAssets.addNoteControlLabel return false } else if !(self?.editorViewController?.isDeleteRowNotesUnavailable ?? true) { - item.image = ZavalaImageAssets.noteDelete.symbolSizedForCatalyst() + item.image = AppImageAssets.noteDelete.symbolSizedForCatalyst() item.label = AppStringAssets.deleteNoteControlLabel item.toolTip = AppStringAssets.deleteNoteControlLabel return false } else { - item.image = ZavalaImageAssets.noteAdd.symbolSizedForCatalyst() + item.image = AppImageAssets.noteAdd.symbolSizedForCatalyst() item.label = AppStringAssets.addNoteControlLabel item.toolTip = AppStringAssets.addNoteControlLabel return true } } - item.image = ZavalaImageAssets.noteAdd.symbolSizedForCatalyst() + item.image = AppImageAssets.noteAdd.symbolSizedForCatalyst() item.label = AppStringAssets.addNoteControlLabel item.toolTip = AppStringAssets.addNoteControlLabel item.isBordered = true @@ -1050,13 +1050,13 @@ extension MainSplitViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isBoldToggledOn ?? false { - item.image = ZavalaImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) + item.image = AppImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) } else { - item.image = ZavalaImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) } return self?.editorViewController?.isFormatUnavailable ?? true } - item.image = ZavalaImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.bold.symbolSizedForCatalyst(pointSize: 18.0) item.label = AppStringAssets.boldControlLabel item.toolTip = AppStringAssets.boldControlLabel item.isBordered = true @@ -1067,13 +1067,13 @@ extension MainSplitViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isItalicToggledOn ?? false { - item.image = ZavalaImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) + item.image = AppImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0, color: .systemBlue) } else { - item.image = ZavalaImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) } return self?.editorViewController?.isFormatUnavailable ?? true } - item.image = ZavalaImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) + item.image = AppImageAssets.italic.symbolSizedForCatalyst(pointSize: 18.0) item.label = AppStringAssets.italicControlLabel item.toolTip = AppStringAssets.italicControlLabel item.isBordered = true @@ -1085,7 +1085,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isExpandAllInOutlineUnavailable ?? true } - item.image = ZavalaImageAssets.expandAll.symbolSizedForCatalyst() + item.image = AppImageAssets.expandAll.symbolSizedForCatalyst() item.label = AppStringAssets.expandControlLabel item.toolTip = AppStringAssets.expandAllInOutlineControlLabel item.isBordered = true @@ -1097,7 +1097,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isCollapseAllInOutlineUnavailable ?? true } - item.image = ZavalaImageAssets.collapseAll.symbolSizedForCatalyst() + item.image = AppImageAssets.collapseAll.symbolSizedForCatalyst() item.label = AppStringAssets.collapseControlLabel item.toolTip = AppStringAssets.collapseAllInOutlineControlLabel item.isBordered = true @@ -1109,7 +1109,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsRightUnavailable ?? true } - item.image = ZavalaImageAssets.moveRight.symbolSizedForCatalyst() + item.image = AppImageAssets.moveRight.symbolSizedForCatalyst() item.label = AppStringAssets.moveRightControlLabel item.toolTip = AppStringAssets.moveRightControlLabel item.isBordered = true @@ -1121,7 +1121,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsLeftUnavailable ?? true } - item.image = ZavalaImageAssets.moveLeft.symbolSizedForCatalyst() + item.image = AppImageAssets.moveLeft.symbolSizedForCatalyst() item.label = AppStringAssets.moveLeftControlLabel item.toolTip = AppStringAssets.moveLeftControlLabel item.isBordered = true @@ -1133,7 +1133,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsUpUnavailable ?? true } - item.image = ZavalaImageAssets.moveUp.symbolSizedForCatalyst() + item.image = AppImageAssets.moveUp.symbolSizedForCatalyst() item.label = AppStringAssets.moveUpControlLabel item.toolTip = AppStringAssets.moveUpControlLabel item.isBordered = true @@ -1145,7 +1145,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isMoveRowsDownUnavailable ?? true } - item.image = ZavalaImageAssets.moveDown.symbolSizedForCatalyst() + item.image = AppImageAssets.moveDown.symbolSizedForCatalyst() item.label = AppStringAssets.moveDownControlLabel item.toolTip = AppStringAssets.moveDownControlLabel item.isBordered = true @@ -1156,17 +1156,17 @@ extension MainSplitViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isFocusOutUnavailable ?? true { - item.image = ZavalaImageAssets.focusInactive.symbolSizedForCatalyst(pointSize: 17) + item.image = AppImageAssets.focusInactive.symbolSizedForCatalyst(pointSize: 17) item.label = AppStringAssets.focusInControlLabel item.toolTip = AppStringAssets.focusInControlLabel } else { - item.image = ZavalaImageAssets.focusActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) + item.image = AppImageAssets.focusActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) item.label = AppStringAssets.focusOutControlLabel item.toolTip = AppStringAssets.focusOutControlLabel } return self?.editorViewController?.isFocusInUnavailable ?? true && self?.editorViewController?.isFocusOutUnavailable ?? true } - item.image = ZavalaImageAssets.focusInactive.symbolSizedForCatalyst() + item.image = AppImageAssets.focusInactive.symbolSizedForCatalyst() item.label = AppStringAssets.focusInControlLabel item.toolTip = AppStringAssets.focusInControlLabel item.isBordered = true @@ -1179,9 +1179,9 @@ extension MainSplitViewController: NSToolbarDelegate { guard let self else { return false } if self.editorViewController?.isFilterOn ?? false { - item.image = ZavalaImageAssets.filterActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) + item.image = AppImageAssets.filterActive.symbolSizedForCatalyst(pointSize: 17, color: .accentColor) } else { - item.image = ZavalaImageAssets.filterInactive.symbolSizedForCatalyst(pointSize: 17) + item.image = AppImageAssets.filterInactive.symbolSizedForCatalyst(pointSize: 17) } let turnFilterOnAction = UIAction() { [weak self] _ in @@ -1216,7 +1216,7 @@ extension MainSplitViewController: NSToolbarDelegate { return self.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.filterInactive.symbolSizedForCatalyst() + item.image = AppImageAssets.filterInactive.symbolSizedForCatalyst() item.label = AppStringAssets.filterControlLabel item.toolTip = AppStringAssets.filterControlLabel item.isBordered = true @@ -1228,7 +1228,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.printDoc.symbolSizedForCatalyst() + item.image = AppImageAssets.printDoc.symbolSizedForCatalyst() item.label = AppStringAssets.printDocControlLabel item.toolTip = AppStringAssets.printDocControlLabel item.isBordered = true @@ -1240,7 +1240,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.printList.symbolSizedForCatalyst() + item.image = AppImageAssets.printList.symbolSizedForCatalyst() item.label = AppStringAssets.printListControlLabel item.toolTip = AppStringAssets.printListControlLabel item.isBordered = true @@ -1251,15 +1251,15 @@ extension MainSplitViewController: NSToolbarDelegate { let item = ValidatingToolbarItem(itemIdentifier: itemIdentifier) item.checkForUnavailable = { [weak self] _ in if self?.editorViewController?.isDocumentCollaborating ?? false { - item.image = ZavalaImageAssets.collaborating.symbolSizedForCatalyst() + item.image = AppImageAssets.collaborating.symbolSizedForCatalyst() } else if self?.editorViewController?.isCollaborateUnavailable ?? true { - item.image = ZavalaImageAssets.statelessCollaborate.symbolSizedForCatalyst() + item.image = AppImageAssets.statelessCollaborate.symbolSizedForCatalyst() } else { - item.image = ZavalaImageAssets.collaborate.symbolSizedForCatalyst() + item.image = AppImageAssets.collaborate.symbolSizedForCatalyst() } return self?.editorViewController?.isCollaborateUnavailable ?? true } - item.image = ZavalaImageAssets.collaborate.symbolSizedForCatalyst() + item.image = AppImageAssets.collaborate.symbolSizedForCatalyst() item.label = AppStringAssets.collaborateControlLabel item.toolTip = AppStringAssets.collaborateControlLabel item.isBordered = true @@ -1277,7 +1277,7 @@ extension MainSplitViewController: NSToolbarDelegate { item.checkForUnavailable = { [weak self] _ in return self?.editorViewController?.isOutlineFunctionsUnavailable ?? true } - item.image = ZavalaImageAssets.getInfo.symbolSizedForCatalyst() + item.image = AppImageAssets.getInfo.symbolSizedForCatalyst() item.label = AppStringAssets.getInfoControlLabel item.toolTip = AppStringAssets.getInfoControlLabel item.isBordered = true diff --git a/Zavala/OpenQuickly/MacOpenQuicklyDocumentsViewController.swift b/Zavala/OpenQuickly/MacOpenQuicklyDocumentsViewController.swift index 2a2bceed..25f67d13 100644 --- a/Zavala/OpenQuickly/MacOpenQuicklyDocumentsViewController.swift +++ b/Zavala/OpenQuickly/MacOpenQuicklyDocumentsViewController.swift @@ -92,7 +92,7 @@ class MacOpenQuicklyDocumentsViewController: UICollectionViewController { if document.isCollaborating { let attrText = NSMutableAttributedString(string: "\(title) ") - let shareAttachement = NSTextAttachment(image: ZavalaImageAssets.collaborating) + let shareAttachement = NSTextAttachment(image: AppImageAssets.collaborating) attrText.append(NSAttributedString(attachment: shareAttachement)) contentConfiguration.attributedText = attrText } else { diff --git a/Shared/OutlineFontConfig.swift b/Zavala/OutlineFonts/OutlineFontConfig.swift similarity index 100% rename from Shared/OutlineFontConfig.swift rename to Zavala/OutlineFonts/OutlineFontConfig.swift diff --git a/Shared/OutlineFontDefaults.swift b/Zavala/OutlineFonts/OutlineFontDefaults.swift similarity index 100% rename from Shared/OutlineFontDefaults.swift rename to Zavala/OutlineFonts/OutlineFontDefaults.swift diff --git a/Shared/OutlineFontField.swift b/Zavala/OutlineFonts/OutlineFontField.swift similarity index 100% rename from Shared/OutlineFontField.swift rename to Zavala/OutlineFonts/OutlineFontField.swift diff --git a/Zavala/Utility/UIColor+.swift b/Zavala/Utility/UIColor+.swift index 71409339..5dd592f2 100644 --- a/Zavala/Utility/UIColor+.swift +++ b/Zavala/Utility/UIColor+.swift @@ -11,13 +11,13 @@ extension UIColor { static var accentColor: UIColor { guard let systemHighlightColor = UserDefaults.standard.string(forKey: "AppleHighlightColor"), - let colorName = systemHighlightColor.components(separatedBy: " ").last else { return ZavalaImageAssets.accentColor } + let colorName = systemHighlightColor.components(separatedBy: " ").last else { return AppImageAssets.accentColor } guard colorName != "Graphite" else { return UIColor.systemGray } let selector = NSSelectorFromString(NSString.localizedStringWithFormat("system%@Color", colorName) as String) - guard UIColor.responds(to: selector) else { return ZavalaImageAssets.accentColor } - return UIColor.perform(selector).takeUnretainedValue() as? UIColor ?? ZavalaImageAssets.accentColor + guard UIColor.responds(to: selector) else { return AppImageAssets.accentColor } + return UIColor.perform(selector).takeUnretainedValue() as? UIColor ?? AppImageAssets.accentColor } func asImage() -> UIImage { diff --git a/xcconfig/Zavala_appkitplugin_target.xcconfig b/xcconfig/Zavala_appkitplugin_target.xcconfig index 017893a7..25a67798 100644 --- a/xcconfig/Zavala_appkitplugin_target.xcconfig +++ b/xcconfig/Zavala_appkitplugin_target.xcconfig @@ -9,7 +9,7 @@ PROVISIONING_PROFILE_SPECIFIER = #include "./Zavala_macos_target_common.xcconfig" LD_RUNPATH_SEARCH_PATHS = $(inherited) @loader_path/../Frameworks -INFOPLIST_FILE = AppKitPlugin/Info.plist +INFOPLIST_FILE = AppKitPlugin/Resources/Info.plist PRODUCT_BUNDLE_IDENTIFIER = $(ORGANIZATION_IDENTIFIER).AppKitPlugin PRODUCT_NAME = AppKitPlugin