Showing 4 changed files with 7 additions and 19 deletions
+3 -9
Documentation/CloudKit-Sync/MECHANISM.md
@@ -128,21 +128,15 @@
128 128
 ### Device Name Handling (AppData.myDeviceName)
129 129
 
130 130
 ```swift
131
-static let myDeviceName: String = Self.getDeviceName()
131
+static let myDeviceName: String = getDeviceName()
132 132
 
133
-private static func getDeviceName() -> String {
134
-    #if os(macOS)
135
-    // On macOS (Catalyst, iPad App on Mac), use hostname
133
+private func getDeviceName() -> String {
136 134
     let hostname = ProcessInfo.processInfo.hostName
137 135
     return hostname.trimmingCharacters(in: .whitespacesAndNewlines)
138
-    #else
139
-    // On iOS/iPadOS, use device name
140
-    return UIDevice.current.name.trimmingCharacters(in: .whitespacesAndNewlines)
141
-    #endif
142 136
 }
143 137
 ```
144 138
 
145
-**Why:** `UIDevice.current.name` returns "iPad" on macOS, which is wrong. Using `hostname` gives correct names like "MacBook-Pro.local" or "iMac.local".
139
+**Why:** Uses hostname on all platforms (iOS, iPadOS, macOS Catalyst, iPad on Mac). Examples: "iPhone-User", "MacBook-Pro.local". Avoids platform-specific names that are irrelevant ("iPad", "iPhone" without context).
146 140
 
147 141
 ### `persistentContainer` (AppDelegate.swift)
148 142
 
+3 -3
Documentation/CloudKit-Sync/SCHEMA.md
@@ -13,9 +13,9 @@ USB Meter utilizează `NSPersistentCloudKitContainer` pentru a sincroniza setăr
13 13
 Stocare centralizată a setărilor și metadatelor de conexiune pentru fiecare contor Bluetooth, cu sincronizare automată pe toate device-urile utilizatorului.
14 14
 
15 15
 ### Device Name Source
16
-- **iOS/iPadOS:** `UIDevice.current.name` (ex: "Bogdan's iPhone")
17
-- **macOS (Catalyst, iPad App on Mac):** `ProcessInfo.processInfo.hostName` (ex: "MacBook-Pro.local")
18
-  - Rationale: `UIDevice.current.name` returnează "iPad" pe macOS, care e incorect
16
+- **All platforms (iOS, iPadOS, macOS Catalyst, iPad on Mac):** `ProcessInfo.processInfo.hostName`
17
+  - Examples: "iPhone-User", "MacBook-Pro.local", "iPad-WiFi"
18
+  - Rationale: Platform-agnostic, avoids device model names ("iPad", "iPhone" are useless)
19 19
 
20 20
 ### Attributes
21 21
 
+1 -1
Documentation/CloudKit-Sync/TROUBLESHOOTING.md
@@ -253,7 +253,7 @@ struct CloudKitDebugView: View {
253 253
 
254 254
             DebugItem(label: "Account", value: appData.cloudKitAccountStatus)
255 255
             DebugItem(label: "Device ID", value: UIDevice.current.identifierForVendor?.uuidString ?? "?")
256
-            DebugItem(label: "Device Name", value: UIDevice.current.name)
256
+            DebugItem(label: "Device Name", value: AppData.myDeviceName)
257 257
             DebugItem(label: "Last Sync", value: formatDate(appData.lastSyncTime))
258 258
             DebugItem(label: "Records", value: "\(appData.deviceSettingsCount)")
259 259
             DebugItem(label: "Pending", value: "\(appData.pendingSyncCount)")
+0 -6
USB Meter/Model/AppData.swift
@@ -15,14 +15,8 @@ import Foundation
15 15
 
16 16
 // MARK: - Device Name Helper
17 17
 private func getDeviceName() -> String {
18
-    #if os(macOS)
19
-    // On macOS (Catalyst, iPad App on Mac), use hostname instead of UIDevice.current.name
20 18
     let hostname = ProcessInfo.processInfo.hostName
21 19
     return hostname.trimmingCharacters(in: .whitespacesAndNewlines)
22
-    #else
23
-    // On iOS/iPadOS, use device name
24
-    return UIDevice.current.name.trimmingCharacters(in: .whitespacesAndNewlines)
25
-    #endif
26 20
 }
27 21
 
28 22
 final class AppData : ObservableObject {