hex/ios/HEXMobile/HexLinks.swift
Ryan Vogel f99e18c797 iOS Privacy: Privacy policy and Support links, for App Review 5.1.1(i)
App Review requires a privacy policy link inside the app. The Privacy page
now has a card with two rows between Learn how I type and Advanced:
- Privacy policy opens https://dev.anoma.ly/hex/privacy.
- Support opens https://dev.anoma.ly/hex/iphone.

Both open in Safari inside Hex (SFSafariViewController, SafariSheet).

The URLs come from one base in HexLinks.swift (HexLinks.site). Moving to
https://anoma.ly/hex is a one-line change once the site's production deploy
serves those pages; https://anoma.ly/hex/privacy returns 404 today, while
both dev.anoma.ly pages return 200. README's Privacy page entry says so.

Verified: the build passes on an iPhone 18 Pro simulator (iOS 27.2). I looked
at the settings-privacy render. A temporary, uncommitted hook opened the
Privacy policy row's Safari sheet, which loaded the live dev.anoma.ly page.
2026-11-20 11:19:40 -05:00

27 lines
1.1 KiB
Swift

import SafariServices
import UIKit
/// Hex's web pages for the iPhone app, under one base so they can move to
/// `https://anoma.ly/hex` once the site's production deploy serves them (it 404s until then).
enum HexLinks {
static let site = URL(string: "https://dev.anoma.ly/hex")!
static let privacyPolicy = site.appending(path: "privacy")
static let support = site.appending(path: "iphone")
}
/// Opens a web page in Safari inside Hex (`SFSafariViewController`), over whatever is showing.
@MainActor
enum SafariSheet {
static func present(_ url: URL) {
let scene = UIApplication.shared.connectedScenes
.compactMap { $0 as? UIWindowScene }
.first { $0.activationState == .foregroundActive }
guard var top = scene?.keyWindow?.rootViewController else { return }
while let presented = top.presentedViewController, !presented.isBeingDismissed {
top = presented
}
let controller = SFSafariViewController(url: url)
controller.overrideUserInterfaceStyle = .dark
top.present(controller, animated: true)
}
}