summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-03-24 10:37:59 -0500
committerBrad Leege <bleege@gmail.com>2015-03-24 10:37:59 -0500
commit5acf518ea6c7fe1c52e63922619ede5ba3f2404f (patch)
tree3d32e161e38424c7de01d99b3b107faf6faf0185
parent81f6c5cab28e62900b1e291dd3ae0094cc70c105 (diff)
downloadqtlocation-mapboxgl-5acf518ea6c7fe1c52e63922619ede5ba3f2404f.tar.gz
#1033 - Adding blank Settings.bundle infrastructure and ensuring it's loaded into memory
-rw-r--r--ios/app/Settings.bundle/Root.plist61
-rw-r--r--ios/app/Settings.bundle/en.lproj/Root.stringsbin0 -> 546 bytes
-rw-r--r--platform/ios/MGLMapboxEvents.m18
3 files changed, 79 insertions, 0 deletions
diff --git a/ios/app/Settings.bundle/Root.plist b/ios/app/Settings.bundle/Root.plist
new file mode 100644
index 0000000000..fa9830605b
--- /dev/null
+++ b/ios/app/Settings.bundle/Root.plist
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>PreferenceSpecifiers</key>
+ <array>
+ <dict>
+ <key>Title</key>
+ <string>Group</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>AutocapitalizationType</key>
+ <string>None</string>
+ <key>AutocorrectionType</key>
+ <string>No</string>
+ <key>DefaultValue</key>
+ <string></string>
+ <key>IsSecure</key>
+ <false/>
+ <key>Key</key>
+ <string>name_preference</string>
+ <key>KeyboardType</key>
+ <string>Alphabet</string>
+ <key>Title</key>
+ <string>Name</string>
+ <key>Type</key>
+ <string>PSTextFieldSpecifier</string>
+ </dict>
+ <dict>
+ <key>DefaultValue</key>
+ <true/>
+ <key>Key</key>
+ <string>enabled_preference</string>
+ <key>Title</key>
+ <string>Enabled</string>
+ <key>Type</key>
+ <string>PSToggleSwitchSpecifier</string>
+ </dict>
+ <dict>
+ <key>DefaultValue</key>
+ <real>0.5</real>
+ <key>Key</key>
+ <string>slider_preference</string>
+ <key>MaximumValue</key>
+ <integer>1</integer>
+ <key>MaximumValueImage</key>
+ <string></string>
+ <key>MinimumValue</key>
+ <integer>0</integer>
+ <key>MinimumValueImage</key>
+ <string></string>
+ <key>Type</key>
+ <string>PSSliderSpecifier</string>
+ </dict>
+ </array>
+ <key>StringsTable</key>
+ <string>Root</string>
+</dict>
+</plist>
diff --git a/ios/app/Settings.bundle/en.lproj/Root.strings b/ios/app/Settings.bundle/en.lproj/Root.strings
new file mode 100644
index 0000000000..8cd87b9d6b
--- /dev/null
+++ b/ios/app/Settings.bundle/en.lproj/Root.strings
Binary files differ
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index 52a6f464c7..3178a460d4 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -40,6 +40,24 @@ NSNumber *scale;
self = [super init];
if (self) {
+ // Put Settings bundle into memory
+ NSString *settingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
+ if(!settingsBundle) {
+ NSLog(@"Could not find Settings.bundle");
+ } else {
+ NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[settingsBundle stringByAppendingPathComponent:@"Root.plist"]];
+ NSArray *preferences = [settings objectForKey:@"PreferenceSpecifiers"];
+ NSMutableDictionary *defaultsToRegister = [[NSMutableDictionary alloc] initWithCapacity:[preferences count]];
+ for(NSDictionary *prefSpecification in preferences) {
+ NSString *key = [prefSpecification objectForKey:@"Key"];
+ if(key && [[prefSpecification allKeys] containsObject:@"DefaultValue"]) {
+ [defaultsToRegister setObject:[prefSpecification objectForKey:@"DefaultValue"] forKey:key];
+ }
+ }
+
+ [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsToRegister];
+ }
+
// Configure Events Infrastructure
_queue = [[NSMutableArray alloc] init];
_flushAt = 20;