Read the iPhone's own name for its host and tailnet node
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# Bugs
|
||||
- Enable the iPhone device-name entitlement
|
||||
Once Apple grants User Assigned Device Name to the App ID `run.fc.byre.ios` (Certificates, Identifiers & Profiles, Capability Requests), turn it on there and add `com.apple.developer.device-information.user-assigned-device-name` to `mac/phone/byre.entitlements`. Until then `UIDevice.current.name` returns `iPhone` on a real phone. Check on a TestFlight build that the Status tab lists the phone by its own name.
|
||||
|
||||
# M1 — One agent end to end
|
||||
|
||||
|
||||
+1
-1
@@ -17,5 +17,5 @@ The simulator's window (Xcode's Device Hub) lists the app's own accessibility el
|
||||
## Platform facts
|
||||
|
||||
- CloudKit on iOS requires the `remote-notification` background mode in `Info.plist`, even though the app sets up no push of its own.
|
||||
- `ProcessInfo.hostName` is the Mac's name in the simulator and meaningless on a phone, so the phone's tailnet node and `Byre-Host` are named `iPhone`.
|
||||
- The phone's tailnet node and `Byre-Host` take its name from `UIDevice.current.name`, which iOS reads only on the main actor (so the app delegate reads it first) and returns as just `iPhone` unless the app has the `com.apple.developer.device-information.user-assigned-device-name` entitlement. Apple grants that entitlement on request (developer.apple.com/contact/request/user-assigned-device-name); it then has to be enabled on the App ID and added to `mac/phone/byre.entitlements`. The simulator returns the simulator device's own name without it.
|
||||
- SwiftTerm's iOS `TerminalViewDelegate` requires `requestOpenLink`, which its macOS one provides a default for.
|
||||
|
||||
@@ -4,6 +4,9 @@ import HTTPTypes
|
||||
import OpenAPIRuntime
|
||||
import OpenAPIURLSession
|
||||
import os
|
||||
#if os(iOS)
|
||||
import UIKit
|
||||
#endif
|
||||
|
||||
let log = Logger(subsystem: "run.fc.byre.mac", category: "byre")
|
||||
|
||||
@@ -104,7 +107,7 @@ private let clientID = newID("cli")
|
||||
#if os(macOS)
|
||||
let deviceName = Host.current().localizedName ?? ProcessInfo.processInfo.hostName
|
||||
#else
|
||||
let deviceName = deviceKind
|
||||
let deviceName = MainActor.assumeIsolated { UIDevice.current.name }
|
||||
#endif
|
||||
|
||||
final class API: Sendable {
|
||||
|
||||
@@ -3,6 +3,8 @@ import SwiftUI
|
||||
|
||||
final class PhoneDelegate: NSObject, UIApplicationDelegate {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
// deviceName reads UIDevice, which is main-actor only, so it must first be read here.
|
||||
_ = deviceName
|
||||
Notifier.shared.install()
|
||||
UITextView.appearance().textContainerInset = .zero
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user