-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move targetedOSVersion to targetedOSVersionRule - second attempt at version rules #225
Conversation
- targetedOSVersionRule is a simple string with targetedOSVersion fully removed - If nudge finds a full match (device running 11.5.2, rule is 11.5.2), it will use the full match rules - if nudge finds a partial match (device running 11.5.2, rule is 11), it will use the partial match - if neither are found and there is a dictionary missing the targetedOSVersionsRule key, or the key has a value of "default", it will use them. This allows forward/backward compatibility with v1.0
If someone needed forward and backward compatibility they could do something like During the transition, order would matter, but only for v1.0.0 clients. You would want your "default" rule at the first item of the array. {
"osVersionRequirements": [
{
"aboutUpdateURL": "https://apple.com",
"requiredInstallationDate": "2021-07-30T00:00:00Z",
"requiredMinimumOSVersion": "11.5.2",
"targetedOSVersions": [
"11.0",
"11.0.1",
"11.1",
"11.2",
"11.2.1",
"11.2.2",
"11.2.3",
"11.3",
"11.3.1",
"11.4",
"11.5",
"11.5.1"
],
"targetedOSVersionsRule": "default"
},
{
"aboutUpdateURL": "https://apple.com",
"requiredInstallationDate": "2021-07-30T00:00:00Z",
"requiredMinimumOSVersion": "11.5.3",
"targetedOSVersionsRule": "11.5.2"
},
{
"aboutUpdateURL": "https://apple.com",
"requiredInstallationDate": "2021-07-30T00:00:00Z",
"requiredMinimumOSVersion": "11.5.4",
"targetedOSVersionsRule": "11"
}
]
} |
@natewalck brought up a good point
If you look at the last two items
|
@@ -53,6 +53,9 @@ func getOptionalFeaturesJSON() -> OptionalFeatures? { | |||
// Mutate the profile into our required construct and then compare currentOS against targetedOSVersions | |||
// Even if profile/JSON is installed, return nil if in demo-mode | |||
func getOSVersionRequirementsProfile() -> OSVersionRequirement? { | |||
var fullMatch = OSVersionRequirement() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: you could create an enum with these three cases instead of having three variables. That would result in code that's simpler to read, with a switch case instead of multiple conditionals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I fully understand how to do this, but would like to know more.
I don't know what the admin is passing as it could be 0-> infinite arrays and the keys are optional. If I could get a code example, would help me out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try to submit a PR after you merge the final version of this change in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
Going to merge this. @groob said he will try and turn it into an |
fully addresses: #157
Example JSON:
or you could do
The main benefit of this approach, is we do not have to repeat any of the key structure compared to #224.
I also anticipated that we would have to clone all keys from OSVersionRequirements as people may want custom
aboutUpdateURL
oraboutUpdateURLs
and this would be a constantly moving target