From 83aba56d12e39c25928ccf9712dc2c0a4eadf5d3 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:26:01 +0000 Subject: [PATCH] Update DeviceKit and tweak user agent string on mac. (#2496) --- ElementX.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- ElementX/Sources/Other/UserAgentBuilder.swift | 23 +++++++++++++------ changelog.d/pr-2496.change | 1 + project.yml | 2 +- 5 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 changelog.d/pr-2496.change diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index ad0bcf72e..aea354c17 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -6971,7 +6971,7 @@ repositoryURL = "https://github.com/devicekit/DeviceKit"; requirement = { kind = upToNextMinorVersion; - minimumVersion = 5.0.0; + minimumVersion = 5.2.2; }; }; E025F19D013D9BA6C58B37F4 /* XCRemoteSwiftPackageReference "swift-algorithms" */ = { diff --git a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3f45551ff..8a306a493 100644 --- a/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ElementX.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -22,8 +22,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/devicekit/DeviceKit", "state" : { - "revision" : "691fe8112cca20ebf0020a1709d4e0205400311c", - "version" : "5.0.0" + "revision" : "fe41d18eccd92a115cffaa35dfff03018c67e635", + "version" : "5.2.2" } }, { diff --git a/ElementX/Sources/Other/UserAgentBuilder.swift b/ElementX/Sources/Other/UserAgentBuilder.swift index aacf7ed39..637206fe4 100644 --- a/ElementX/Sources/Other/UserAgentBuilder.swift +++ b/ElementX/Sources/Other/UserAgentBuilder.swift @@ -31,12 +31,21 @@ final class UserAgentBuilder { let clientVersion = InfoPlistReader.app.bundleShortVersionString #if os(iOS) - return String(format: "%@/%@ (%@; iOS %@; Scale/%0.2f)", - clientName, - clientVersion, - Device.current.safeDescription, - UIDevice.current.systemVersion, - UIScreen.main.scale) + let scale = UIScreen.main.scale + return if ProcessInfo.processInfo.isiOSAppOnMac { + String(format: "%@/%@ (Mac; macOS %@; Scale/%0.2f)", + clientName, + clientVersion, + ProcessInfo.processInfo.operatingSystemVersionString, + scale) + } else { + String(format: "%@/%@ (%@; iOS %@; Scale/%0.2f)", + clientName, + clientVersion, + Device.current.safeDescription, + UIDevice.current.systemVersion, + scale) + } #elseif os(tvOS) return String(format: "%@/%@ (%@; tvOS %@; Scale/%0.2f)", clientName, @@ -52,7 +61,7 @@ final class UserAgentBuilder { WKInterfaceDevice.current.systemVersion, WKInterfaceDevice.currentDevice.screenScale) #elseif os(OSX) - return String(format: "%@/%@ (Mac; Mac OS X %@)", + return String(format: "%@/%@ (Mac; macOS %@)", clientName, clientVersion, NSProcessInfo.processInfo.operatingSystemVersionString) diff --git a/changelog.d/pr-2496.change b/changelog.d/pr-2496.change new file mode 100644 index 000000000..fe39b204b --- /dev/null +++ b/changelog.d/pr-2496.change @@ -0,0 +1 @@ +Add support for latest iPhones in the User Agent. Also correctly identify when running on a Mac. \ No newline at end of file diff --git a/project.yml b/project.yml index 90df8ed80..ce548c159 100644 --- a/project.yml +++ b/project.yml @@ -78,7 +78,7 @@ packages: minorVersion: 1.0.0 DeviceKit: url: https://github.com/devicekit/DeviceKit - minorVersion: 5.0.0 + minorVersion: 5.2.2 DSWaveformImage: url: https://github.com/dmrschmidt/DSWaveformImage exactVersion: 14.1.1