From 97e00dcc82b5b34bac9199c75c643939e54e94a1 Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 28 Sep 2024 19:58:42 +0200 Subject: [PATCH] fix: changed App Group name to fit the requirements. It fixes widgets in macOS 15 but could break macOS 14. Since in the macOS 14 it was not working properly with the team ID prefix (#2115) --- Kit/module/module.swift | 2 +- Modules/CPU/Info.plist | 2 ++ Modules/CPU/widget.swift | 2 +- Modules/Disk/widget.swift | 2 +- Modules/GPU/widget.swift | 2 +- Modules/Net/widget.swift | 2 +- Modules/RAM/widget.swift | 2 +- Stats/Supporting Files/Info.plist | 4 +++- Stats/Supporting Files/Stats.entitlements | 8 ++++---- Widgets/Supporting Files/Info.plist | 2 ++ Widgets/Supporting Files/Widgets.entitlements | 2 +- 11 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Kit/module/module.swift b/Kit/module/module.swift index fb4995ff..284ce703 100644 --- a/Kit/module/module.swift +++ b/Kit/module/module.swift @@ -80,7 +80,7 @@ open class Module { get { Store.shared.int(key: "\(self.name)_position", defaultValue: 0) } set { Store.shared.set(key: "\(self.name)_position", value: newValue) } } - public var userDefaults: UserDefaults? = UserDefaults(suiteName: "eu.exelban.Stats.widgets") + public var userDefaults: UserDefaults? = UserDefaults(suiteName: "\(Bundle.main.object(forInfoDictionaryKey: "TeamId") as! String).eu.exelban.Stats.widgets") private var settingsView: Settings_v? = nil private var popup: PopupWindow? = nil diff --git a/Modules/CPU/Info.plist b/Modules/CPU/Info.plist index 20202aa7..85e5c52d 100644 --- a/Modules/CPU/Info.plist +++ b/Modules/CPU/Info.plist @@ -20,5 +20,7 @@ $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved. + TeamId + RP2S87B72W diff --git a/Modules/CPU/widget.swift b/Modules/CPU/widget.swift index 9fc2a7f5..63a543f1 100644 --- a/Modules/CPU/widget.swift +++ b/Modules/CPU/widget.swift @@ -28,7 +28,7 @@ public struct CPU_entry: TimelineEntry { public struct Provider: TimelineProvider { public typealias Entry = CPU_entry - private let userDefaults: UserDefaults? = UserDefaults(suiteName: "eu.exelban.Stats.widgets") + private let userDefaults: UserDefaults? = UserDefaults(suiteName: "\(Bundle.main.object(forInfoDictionaryKey: "TeamId") as! String).eu.exelban.Stats.widgets") public func placeholder(in context: Context) -> CPU_entry { CPU_entry() diff --git a/Modules/Disk/widget.swift b/Modules/Disk/widget.swift index 3d98709a..f3ae27e7 100644 --- a/Modules/Disk/widget.swift +++ b/Modules/Disk/widget.swift @@ -28,7 +28,7 @@ public struct Disk_entry: TimelineEntry { public struct Provider: TimelineProvider { public typealias Entry = Disk_entry - private let userDefaults: UserDefaults? = UserDefaults(suiteName: "eu.exelban.Stats.widgets") + private let userDefaults: UserDefaults? = UserDefaults(suiteName: "\(Bundle.main.object(forInfoDictionaryKey: "TeamId") as! String).eu.exelban.Stats.widgets") public func placeholder(in context: Context) -> Disk_entry { Disk_entry() diff --git a/Modules/GPU/widget.swift b/Modules/GPU/widget.swift index aab07fa0..2b2dc91f 100644 --- a/Modules/GPU/widget.swift +++ b/Modules/GPU/widget.swift @@ -28,7 +28,7 @@ public struct GPU_entry: TimelineEntry { public struct Provider: TimelineProvider { public typealias Entry = GPU_entry - private let userDefaults: UserDefaults? = UserDefaults(suiteName: "eu.exelban.Stats.widgets") + private let userDefaults: UserDefaults? = UserDefaults(suiteName: "\(Bundle.main.object(forInfoDictionaryKey: "TeamId") as! String).eu.exelban.Stats.widgets") public func placeholder(in context: Context) -> GPU_entry { GPU_entry() diff --git a/Modules/Net/widget.swift b/Modules/Net/widget.swift index a5791ebe..4919b97d 100644 --- a/Modules/Net/widget.swift +++ b/Modules/Net/widget.swift @@ -28,7 +28,7 @@ public struct Network_entry: TimelineEntry { public struct Provider: TimelineProvider { public typealias Entry = Network_entry - private let userDefaults: UserDefaults? = UserDefaults(suiteName: "eu.exelban.Stats.widgets") + private let userDefaults: UserDefaults? = UserDefaults(suiteName: "\(Bundle.main.object(forInfoDictionaryKey: "TeamId") as! String).eu.exelban.Stats.widgets") public func placeholder(in context: Context) -> Network_entry { Network_entry() diff --git a/Modules/RAM/widget.swift b/Modules/RAM/widget.swift index b254248b..55a066de 100644 --- a/Modules/RAM/widget.swift +++ b/Modules/RAM/widget.swift @@ -43,7 +43,7 @@ public struct RAM_entry: TimelineEntry { public struct Provider: TimelineProvider { public typealias Entry = RAM_entry - private let userDefaults: UserDefaults? = UserDefaults(suiteName: "eu.exelban.Stats.widgets") + private let userDefaults: UserDefaults? = UserDefaults(suiteName: "\(Bundle.main.object(forInfoDictionaryKey: "TeamId") as! String).eu.exelban.Stats.widgets") public func placeholder(in context: Context) -> RAM_entry { RAM_entry() diff --git a/Stats/Supporting Files/Info.plist b/Stats/Supporting Files/Info.plist index 37c3f4c2..7c417364 100755 --- a/Stats/Supporting Files/Info.plist +++ b/Stats/Supporting Files/Info.plist @@ -42,7 +42,9 @@ SMPrivilegedExecutables eu.exelban.Stats.SMC.Helper - anchor apple generic and identifier "eu.exelban.Stats.SMC.Helper" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = RP2S87B72W) + anchor apple generic and identifier "eu.exelban.Stats.SMC.Helper" and (certificate leaf[field.1.2.840.113635.100.6.1.9] /* exists */ or certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = RP2S87B72W) + TeamId + RP2S87B72W diff --git a/Stats/Supporting Files/Stats.entitlements b/Stats/Supporting Files/Stats.entitlements index d2233b35..42f052be 100644 --- a/Stats/Supporting Files/Stats.entitlements +++ b/Stats/Supporting Files/Stats.entitlements @@ -2,11 +2,11 @@ - com.apple.security.application-groups - - eu.exelban.Stats.widgets - com.apple.security.cs.disable-library-validation + com.apple.security.application-groups + + $(TeamIdentifierPrefix)eu.exelban.Stats.widgets + diff --git a/Widgets/Supporting Files/Info.plist b/Widgets/Supporting Files/Info.plist index 5e1da200..e407ca8f 100644 --- a/Widgets/Supporting Files/Info.plist +++ b/Widgets/Supporting Files/Info.plist @@ -21,5 +21,7 @@ NSHumanReadableCopyright Copyright © 2024 Serhiy Mytrovtsiy. All rights reserved. + TeamId + RP2S87B72W diff --git a/Widgets/Supporting Files/Widgets.entitlements b/Widgets/Supporting Files/Widgets.entitlements index 8a9a0511..2ed3f7ff 100644 --- a/Widgets/Supporting Files/Widgets.entitlements +++ b/Widgets/Supporting Files/Widgets.entitlements @@ -6,7 +6,7 @@ com.apple.security.application-groups - eu.exelban.Stats.widgets + $(TeamIdentifierPrefix)eu.exelban.Stats.widgets