Skip to content

Commit

Permalink
Merge branch 'main' into deployment-target-macOS-13
Browse files Browse the repository at this point in the history
  • Loading branch information
F1248 committed Aug 29, 2024
2 parents db97a4d + 2fac5b5 commit eb7cd3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/Trigger-Deploy-to-Pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
Trigger-Deploy-to-Pages:
name: Trigger Deploy to Pages
runs-on: macos-latest

steps:

- name: Trigger Deploy to Pages
Expand Down
16 changes: 9 additions & 7 deletions Genius/Extensions/Swift/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@ import SwiftUI
extension String {

var localized: String {
NSLocalizedString(self, comment: "")
if #available(macOS 12, *) {
String(localized: LocalizationValue(self))
} else {
NSLocalizedString(self, comment: "")
}
}

init?(_ string: (any StringProtocol)?) {
guard let string else { return nil }
self.init(string)
}

init(_ localizedStringKey: LocalizedStringKey) {
self = (
Mirror(reflecting: localizedStringKey).children.first { $0.label == "key" }?.value as? String ?? "Unknown"
).localized
}

init?(_ data: Data?) {
guard let data else { return nil }
self.init(decoding: data, as: UTF8.self)
}

init?(_ versionNumber: VersionNumber?) {
self.init(versionNumber?.versions.map(String.init).joined(separator: "."))
}

func contains(any strings: [any StringProtocol]) -> Bool {
strings.contains { contains($0) }
}
Expand Down
15 changes: 0 additions & 15 deletions Genius/Extensions/SwiftUI/LocalizedStringKey.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Genius/Types/SystemInformation/Hardware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extension SystemInformation {
case _ where name.hasPrefix("Apple Virtual Machine"): "macwindow"
default: if #available(macOS 15, *) { "desktopcomputer.and.macbook" } else { "desktopcomputer" }
}
nonisolated(unsafe) static let marketingName: LocalizedStringKey? = {
static let marketingName: String? = {
guard let serialNumber = Machine.serialNumber, [11, 12].contains(serialNumber.count) else { return nil }
// swiftlint:disable:next explicit_type_interface
let url = """
Expand All @@ -54,7 +54,7 @@ extension SystemInformation {
guard
let marketingName = Network.transferURL(url)?.between(start: "<configCode>", end: "</configCode>")
else { return nil }
return LocalizedStringKey(marketingName)
return marketingName
}()
}

Expand Down

0 comments on commit eb7cd3e

Please sign in to comment.