Remove template list URL from application settings
Copy pull request #5890 but completely remove the old code in the master branch Signed-off-by: Patrick Luby <patrick.luby@collabora.com> Change-Id: I69d03bb3f10e756823ba2e32aae0c099c54928c5pull/5958/head
parent
74d6739f0d
commit
23d449b978
|
@ -244,42 +244,10 @@ static void updateTemplates(NSData *data, NSURLResponse *response)
|
|||
// documents to download. If set, start a task to download it, and then to download the listed
|
||||
// templates.
|
||||
|
||||
NSString *templateListURL = nil;
|
||||
|
||||
// First check managed configuration, if present
|
||||
NSDictionary *managedConfig = [[NSUserDefaults standardUserDefaults] dictionaryForKey:@"com.apple.configuration.managed"];
|
||||
if (managedConfig != nil) {
|
||||
templateListURL = managedConfig[@"templateListURL"];
|
||||
if (templateListURL != nil && ![templateListURL isKindOfClass:[NSString class]])
|
||||
templateListURL = nil;
|
||||
}
|
||||
|
||||
if (templateListURL == nil)
|
||||
templateListURL = [[NSUserDefaults standardUserDefaults] stringForKey:@"templateListURL"];
|
||||
|
||||
if (templateListURL != nil) {
|
||||
NSURL *url = [NSURL URLWithString:templateListURL];
|
||||
if (url != nil) {
|
||||
[[[NSURLSession sharedSession] dataTaskWithURL:url
|
||||
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
|
||||
if (error == nil && [response isKindOfClass:[NSHTTPURLResponse class]] && [(NSHTTPURLResponse*)response statusCode] == 200)
|
||||
updateTemplates(data, response);
|
||||
else if (error == nil && [response isKindOfClass:[NSHTTPURLResponse class]])
|
||||
LOG_ERR("Failed to download " <<
|
||||
[[url absoluteString] UTF8String] <<
|
||||
": response code " << [(NSHTTPURLResponse*)response statusCode]);
|
||||
else if (error != nil)
|
||||
LOG_ERR("Failed to download " <<
|
||||
[[url absoluteString] UTF8String] <<
|
||||
": " << [[error description] UTF8String]);
|
||||
else
|
||||
LOG_ERR("Failed to download " <<
|
||||
[[url absoluteString] UTF8String]);
|
||||
}] resume];
|
||||
}
|
||||
}
|
||||
|
||||
// Also look for managed configuration setting of the user name.
|
||||
// Look for managed configuration setting of the user name.
|
||||
|
||||
if (managedConfig != nil) {
|
||||
NSString *userName = managedConfig[@"userName"];
|
||||
|
|
|
@ -38,14 +38,6 @@
|
|||
<key>Title</key>
|
||||
<string>Settings</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Template list URL</string>
|
||||
<key>Key</key>
|
||||
<string>templateListURL</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
|
|
Loading…
Reference in New Issue