// // AppMarketingLinks.swift // App for Indeed // import Foundation /// Mac App Store URLs for Settings → Share App / More Apps. /// Override via build settings: `INFOPLIST_KEY_AppStoreAppID` and `INFOPLIST_KEY_AppStoreDeveloperID`. enum AppMarketingLinks { /// Canonical app name; keep in sync with `INFOPLIST_KEY_CFBundleDisplayName` in the Xcode target. static let displayName = "App for Indeed" /// Indeed® brand mark — always Latin “Indeed”, never transliterated in UI. static let indeedBrandName = "Indeed" /// Numeric App Store app ID from App Store Connect (e.g. `1234567890`). static var macAppStoreURL: URL? { guard let appID = resolvedAppStoreAppID else { return nil } return URL(string: "https://apps.apple.com/app/id\(appID)") } /// Developer catalog on the App Store (other apps by the same publisher). static var developerAppsURL: URL? { guard let developerID = resolvedAppStoreDeveloperID else { return nil } return URL(string: "https://apps.apple.com/developer/-/id\(developerID)") } static var appDisplayName: String { if let display = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String, !display.isEmpty { return display } if let name = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String, !name.isEmpty { return name } return displayName } static var shareText: String { let name = appDisplayName if let url = macAppStoreURL { return "Check out \(name) on the Mac App Store:\n\(url.absoluteString)" } return "Check out \(name) on the Mac App Store." } static var shareEmailSubject: String { "Check out \(appDisplayName)" } /// Payload for `NSSharingServicePicker` (Mail, Messages, AirDrop, Notes, Copy Link, etc.). static var shareItems: [Any] { var items: [Any] = [shareText as NSString] if let url = macAppStoreURL { items.append(url) } return items } static var isConfigured: Bool { macAppStoreURL != nil } private static var resolvedAppStoreAppID: String? { normalizedID(from: Bundle.main.object(forInfoDictionaryKey: "AppStoreAppID")) } private static var resolvedAppStoreDeveloperID: String? { normalizedID(from: Bundle.main.object(forInfoDictionaryKey: "AppStoreDeveloperID")) } private static func normalizedID(from value: Any?) -> String? { guard let raw = value as? String else { return nil } let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines) guard !trimmed.isEmpty else { return nil } return trimmed } }