summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;