From 42e1e442ee86bee2284353646e0d9eea26058440 Mon Sep 17 00:00:00 2001 From: Nindi Gill Date: Tue, 15 Mar 2022 14:19:15 +1100 Subject: [PATCH] Fixed user + device based config profile lookup --- Low Profile.xcodeproj/project.pbxproj | 8 ++++---- Low Profile/Views/ContentView.swift | 22 +++++++++++----------- README.md | 4 ++++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Low Profile.xcodeproj/project.pbxproj b/Low Profile.xcodeproj/project.pbxproj index 25a50f0..e900979 100644 --- a/Low Profile.xcodeproj/project.pbxproj +++ b/Low Profile.xcodeproj/project.pbxproj @@ -530,7 +530,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 300; + CURRENT_PROJECT_VERSION = 301; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 7K3HVCLV7Z; ENABLE_HARDENED_RUNTIME = YES; @@ -541,7 +541,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 3.0; + MARKETING_VERSION = 3.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.ninxsoft.lowprofile; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -557,7 +557,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 300; + CURRENT_PROJECT_VERSION = 301; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 7K3HVCLV7Z; ENABLE_HARDENED_RUNTIME = YES; @@ -568,7 +568,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 12.0; - MARKETING_VERSION = 3.0; + MARKETING_VERSION = 3.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.ninxsoft.lowprofile; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Low Profile/Views/ContentView.swift b/Low Profile/Views/ContentView.swift index 7bcd51c..6b7673d 100644 --- a/Low Profile/Views/ContentView.swift +++ b/Low Profile/Views/ContentView.swift @@ -145,24 +145,24 @@ struct ContentView: View { let data: Data = try Data(contentsOf: url) var format: PropertyListSerialization.PropertyListFormat = .xml + var profiles: [Profile] = [] - guard let array: [[String: Any]] = try PropertyListSerialization.propertyList(from: data, options: [], format: &format) as? [[String: Any]], - !array.isEmpty, - let parentItems: [[String: Any]] = array[0]["_items"] as? [[String: Any]], - !parentItems.isEmpty, - let items: [[String: Any]] = parentItems[0]["_items"] as? [[String: Any]] else { + guard let array: [[String: Any]] = try PropertyListSerialization.propertyList(from: data, options: [], format: &format) as? [[String: Any]] else { return [] } - var profiles: [Profile] = [] - - for item in items { - - guard let profile: Profile = profile(for: item) else { + for dictionary in array { + guard let parentItems: [[String: Any]] = dictionary["_items"] as? [[String: Any]] else { continue } - profiles.append(profile) + for parentItem in parentItems { + guard let items: [[String: Any]] = parentItem["_items"] as? [[String: Any]] else { + continue + } + + profiles.append(contentsOf: items.compactMap { profile(for: $0) }) + } } return profiles.sorted { $0.name < $1.name } diff --git a/README.md b/README.md index 032b678..95f054a 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,10 @@ Grab the latest version of **Low Profile** from the [releases page](https://gith ## Version History +- 3.0.1 + + - Fixed a bug that asumed no User Configuration Profiles were installed (thanks [dhcav](https://github.com/dhcav) for discovering this!) + - 3.0 - Added support for installed configuration profiles (thanks [hkystar35](https://github.com/hkystar35) for the awesome suggestion!)