eleven / messenger Public

ios: name the run target in device copy — iPhone / iPad / Mac (#549)

The iOS binary runs on three surfaces (iPhone, iPad, and "Designed for
iPad" on Apple Silicon Macs), but the sign-out confirmation and the
iOS-version gate hard-coded "iPhone" — so an iPad said "removed from this
iPhone", and running on a Mac (where the bug was hit) said it too.

Add DeviceName.current, resolving the surface at runtime:
isiOSAppOnMac → "Mac", the .pad idiom → "iPad", else "iPhone". Wire it
into both sign-out strings (InstanceSidebar) and the "Update your …"
gate (LChatApp). The standalone native LChatMac app is unaffected — it
has its own "this Mac" copy.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Dermot Daly 72fc9a6933f968862d66bf2f57de81206d30342b parent 72439e7
2 files changed, +17 −3
  • ios/LChat/DeviceName.swift +14 −0
  • ios/LChat/LChatApp.swift +3 −3
diff --git a/ios/LChat/DeviceName.swift b/ios/LChat/DeviceName.swift
new file mode 100644
index 0000000..914727b
--- /dev/null
+++ b/ios/LChat/DeviceName.swift
@@ -0,0 +1,14 @@
+import UIKit
+
+// Device-naming copy — "removed from this iPhone" — must follow the run target
+// rather than hard-code one. This iOS binary runs on three surfaces: iPhone,
+// iPad, and (via "Designed for iPad" on Apple Silicon) a Mac. `isiOSAppOnMac`
+// catches that last case, which otherwise reports the `.pad` idiom and would
+// mislabel a Mac as an iPad. (The genuinely-native macOS app is a separate
+// target with its own copy; this covers the iOS app running on a Mac.)
+enum DeviceName {
+ static var current: String {
+ if ProcessInfo.processInfo.isiOSAppOnMac { return "Mac" }
+ return UIDevice.current.userInterfaceIdiom == .pad ? "iPad" : "iPhone"
+ }
+}
diff --git a/ios/LChat/LChatApp.swift b/ios/LChat/LChatApp.swift
index 3c851df..64cdb83 100644
--- a/ios/LChat/LChatApp.swift
+++ b/ios/LChat/LChatApp.swift
@@ -330,10 +330,10 @@ struct RootView: View {
}
}
.confirmationDialog(
- "Sign out? Your spaces, messages and keys are removed from this iPhone. Sign back in to get them back.",
+ "Sign out? Your spaces, messages and keys are removed from this \(DeviceName.current). Sign back in to get them back.",
isPresented: $confirmSignOut, titleVisibility: .visible
) {
- Button("Sign Out & Clear This iPhone", role: .destructive, action: signOut)
+ Button("Sign Out & Clear This \(DeviceName.current)", role: .destructive, action: signOut)
}
// Load server photos once at launch (and when the server set changes) so both
// the toolbar space button and the switcher show them without opening anything.
@@ -557,7 +557,7 @@ struct RootView: View {
Image(systemName: "person.badge.key")
.font(.system(size: 44)).foregroundStyle(.secondary)
Text("Sign in needs iOS 18").font(.headline)
- Text("Update your iPhone to sign in to Eleven — or use your space in the browser meanwhile.")
+ Text("Update your \(DeviceName.current) to sign in to Eleven — or use your space in the browser meanwhile.")
.font(.callout).foregroundStyle(.secondary).multilineTextAlignment(.center)
}
.padding()