Нема описа

AppLegalURLs.swift 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // AppLegalURLs.swift
  3. // App for Indeed
  4. //
  5. import AppKit
  6. import Foundation
  7. /// Legal, support, and marketing pages hosted on Google Sites.
  8. enum AppLegalURLs {
  9. private static let siteRoot = "https://sites.google.com/view/app-for-indeed"
  10. static let marketingHome = URL(string: "\(siteRoot)/home")!
  11. static let privacyPolicy = URL(string: "\(siteRoot)/privacy-policy")!
  12. /// Google Sites page slug: `terms-of-services` (matches published site navigation).
  13. static let termsOfUse = URL(string: "\(siteRoot)/terms-of-services")!
  14. static let support = URL(string: "\(siteRoot)/support")!
  15. /// Opens the URL in Safari when available; otherwise uses the system default browser.
  16. static func openInSafari(_ url: URL) {
  17. let safariApp = URL(fileURLWithPath: "/Applications/Safari.app")
  18. guard FileManager.default.fileExists(atPath: safariApp.path) else {
  19. NSWorkspace.shared.open(url)
  20. return
  21. }
  22. NSWorkspace.shared.open(
  23. [url],
  24. withApplicationAt: safariApp,
  25. configuration: NSWorkspace.OpenConfiguration()
  26. ) { _, error in
  27. if error != nil {
  28. NSWorkspace.shared.open(url)
  29. }
  30. }
  31. }
  32. }