Skip to content

Commit

Permalink
Fixed user + device based config profile lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
ninxsoft committed Mar 15, 2022
1 parent f37eb81 commit 42e1e44
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Low Profile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = "";
Expand All @@ -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;
Expand All @@ -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 = "";
Expand Down
22 changes: 11 additions & 11 deletions Low Profile/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!)
Expand Down

0 comments on commit 42e1e44

Please sign in to comment.