diff options
Diffstat (limited to 'ios/iosremote/InAppSettingsKit/Models')
10 files changed, 0 insertions, 988 deletions
diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsReader.h b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsReader.h deleted file mode 100755 index 2af1fc9e8ad7..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsReader.h +++ /dev/null @@ -1,144 +0,0 @@ -// -// IASKSettingsReader.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2009: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import <Foundation/Foundation.h> - -#define kIASKPreferenceSpecifiers @"PreferenceSpecifiers" -#define kIASKType @"Type" -#define kIASKTitle @"Title" -#define kIASKFooterText @"FooterText" -#define kIASKKey @"Key" -#define kIASKFile @"File" -#define kIASKDefaultValue @"DefaultValue" -#define kIASKMinimumValue @"MinimumValue" -#define kIASKMaximumValue @"MaximumValue" -#define kIASKTrueValue @"TrueValue" -#define kIASKFalseValue @"FalseValue" -#define kIASKIsSecure @"IsSecure" -#define KIASKKeyboardType @"KeyboardType" -#define kIASKAutocapitalizationType @"AutocapitalizationType" -#define kIASKAutoCorrectionType @"AutocorrectionType" -#define kIASKValues @"Values" -#define kIASKTitles @"Titles" -#define kIASKViewControllerClass @"IASKViewControllerClass" -#define kIASKViewControllerSelector @"IASKViewControllerSelector" -#define kIASKButtonClass @"IASKButtonClass" -#define kIASKButtonAction @"IASKButtonAction" -#define kIASKMailComposeToRecipents @"IASKMailComposeToRecipents" -#define kIASKMailComposeCcRecipents @"IASKMailComposeCcRecipents" -#define kIASKMailComposeBccRecipents @"IASKMailComposeBccRecipents" -#define kIASKMailComposeSubject @"IASKMailComposeSubject" -#define kIASKMailComposeBody @"IASKMailComposeBody" -#define kIASKMailComposeBodyIsHTML @"IASKMailComposeBodyIsHTML" -#define kIASKKeyboardAlphabet @"Alphabet" -#define kIASKKeyboardNumbersAndPunctuation @"NumbersAndPunctuation" -#define kIASKKeyboardNumberPad @"NumberPad" -#define kIASKKeyboardDecimalPad @"DecimalPad" - -#define KIASKKeyboardURL @"URL" -#define kIASKKeyboardEmailAddress @"EmailAddress" -#define kIASKAutoCapNone @"None" -#define kIASKAutoCapSentences @"Sentences" -#define kIASKAutoCapWords @"Words" -#define kIASKAutoCapAllCharacters @"AllCharacters" -#define kIASKAutoCorrDefault @"Default" -#define kIASKAutoCorrNo @"No" -#define kIASKAutoCorrYes @"Yes" -#define kIASKMinimumValueImage @"MinimumValueImage" -#define kIASKMaximumValueImage @"MaximumValueImage" - -#define kIASKPSGroupSpecifier @"PSGroupSpecifier" -#define kIASKPSToggleSwitchSpecifier @"PSToggleSwitchSpecifier" -#define kIASKPSMultiValueSpecifier @"PSMultiValueSpecifier" -#define kIASKPSSliderSpecifier @"PSSliderSpecifier" -#define kIASKPSTitleValueSpecifier @"PSTitleValueSpecifier" -#define kIASKPSTextFieldSpecifier @"PSTextFieldSpecifier" -#define kIASKPSChildPaneSpecifier @"PSChildPaneSpecifier" -#define kIASKOpenURLSpecifier @"IASKOpenURLSpecifier" -#define kIASKButtonSpecifier @"IASKButtonSpecifier" -#define kIASKMailComposeSpecifier @"IASKMailComposeSpecifier" -#define kIASKCustomViewSpecifier @"IASKCustomViewSpecifier" - -#define kIASKBundleFolder @"Settings.bundle" -#define kIASKBundleFolderAlt @"InAppSettings.bundle" -#define kIASKBundleFilename @"Root.plist" -#define KIASKBundleLocaleFolderExtension @".lproj" - -#define kIASKAppSettingChanged @"kAppSettingChanged" - -#define kIASKSectionHeaderIndex 0 - -#define kIASKSliderNoImagesPadding 11 -#define kIASKSliderImagesPadding 43 - - -#define kIASKTableWidth 320 -#define kIASKSpacing 5 -#define kIASKMinLabelWidth 97 -#define kIASKMinValueWidth 35 -#define kIASKPaddingLeft 9 -#define kIASKPaddingRight 10 -#define kIASKHorizontalPaddingGroupTitles 19 -#define kIASKVerticalPaddingGroupTitles 15 - -#define kIASKLabelFontSize 17 -#define kIASKgrayBlueColor [UIColor colorWithRed:0.318 green:0.4 blue:0.569 alpha:1.0] - -#ifndef kCFCoreFoundationVersionNumber_iPhoneOS_4_0 -#define kCFCoreFoundationVersionNumber_iPhoneOS_4_0 550.32 -#endif - -#ifndef kCFCoreFoundationVersionNumber_iPhoneOS_4_1 -#define kCFCoreFoundationVersionNumber_iPhoneOS_4_1 550.38 -#endif - - -#define IASK_IF_IOS4_OR_GREATER(...) \ -if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_4_0) \ -{ \ -__VA_ARGS__ \ -} - -@class IASKSpecifier; - -@interface IASKSettingsReader : NSObject { - NSString *_path; - NSString *_localizationTable; - NSString *_bundlePath; - NSDictionary *_settingsBundle; - NSArray *_dataSource; - NSBundle *_bundle; -} - -- (id)initWithFile:(NSString*)file; -- (NSInteger)numberOfSections; -- (NSInteger)numberOfRowsForSection:(NSInteger)section; -- (IASKSpecifier*)specifierForIndexPath:(NSIndexPath*)indexPath; -- (NSIndexPath*)indexPathForKey:(NSString*)key; -- (IASKSpecifier*)specifierForKey:(NSString*)key; -- (NSString*)titleForSection:(NSInteger)section; -- (NSString*)keyForSection:(NSInteger)section; -- (NSString*)footerTextForSection:(NSInteger)section; -- (NSString*)titleForStringId:(NSString*)stringId; -- (NSString*)pathForImageNamed:(NSString*)image; - -@property (nonatomic, strong) NSString *path; -@property (nonatomic, strong) NSString *localizationTable; -@property (nonatomic, strong) NSString *bundlePath; -@property (nonatomic, strong) NSDictionary *settingsBundle; -@property (nonatomic, strong) NSArray *dataSource; - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsReader.m b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsReader.m deleted file mode 100755 index 3f730919a702..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsReader.m +++ /dev/null @@ -1,266 +0,0 @@ -// -// IASKSettingsReader.m -// http://www.inappsettingskit.com -// -// Copyright (c) 2009: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import "IASKSettingsReader.h" -#import "IASKSpecifier.h" - -@interface IASKSettingsReader (private) -- (void)_reinterpretBundle:(NSDictionary*)settingsBundle; -- (BOOL)_sectionHasHeading:(NSInteger)section; -- (NSString *)platformSuffix; -- (NSString *)locateSettingsFile:(NSString *)file; - -@end - -@implementation IASKSettingsReader - -@synthesize path=_path, -localizationTable=_localizationTable, -bundlePath=_bundlePath, -settingsBundle=_settingsBundle, -dataSource=_dataSource; - -- (id)init { - return [self initWithFile:@"Root"]; -} - -- (id)initWithFile:(NSString*)file { - if ((self=[super init])) { - - - self.path = [self locateSettingsFile: file]; - [self setSettingsBundle:[NSDictionary dictionaryWithContentsOfFile:self.path]]; - self.bundlePath = [self.path stringByDeletingLastPathComponent]; - _bundle = [NSBundle bundleWithPath:[self bundlePath]]; - - // Look for localization file - self.localizationTable = [self.settingsBundle objectForKey:@"StringsTable"]; - if (!self.localizationTable) - { - // Look for localization file using filename - self.localizationTable = [[[[self.path stringByDeletingPathExtension] // removes '.plist' - stringByDeletingPathExtension] // removes potential '.inApp' - lastPathComponent] // strip absolute path - stringByReplacingOccurrencesOfString:[self platformSuffix] withString:@""]; // removes potential '~device' (~ipad, ~iphone) - if([_bundle pathForResource:self.localizationTable ofType:@"strings"] == nil){ - // Could not find the specified localization: use default - self.localizationTable = @"Root"; - } - } - - if (_settingsBundle) { - [self _reinterpretBundle:_settingsBundle]; - } - } - return self; -} - -- (void)dealloc { - _path = nil; - _localizationTable = nil; - _bundlePath = nil; - _settingsBundle = nil; - _dataSource = nil; - _bundle = nil; - -} - -- (void)_reinterpretBundle:(NSDictionary*)settingsBundle { - NSArray *preferenceSpecifiers = [settingsBundle objectForKey:kIASKPreferenceSpecifiers]; - NSInteger sectionCount = -1; - NSMutableArray *dataSource = [[NSMutableArray alloc] init]; - - for (NSDictionary *specifier in preferenceSpecifiers) { - if ([(NSString*)[specifier objectForKey:kIASKType] isEqualToString:kIASKPSGroupSpecifier]) { - NSMutableArray *newArray = [[NSMutableArray alloc] init]; - - [newArray addObject:specifier]; - [dataSource addObject:newArray]; - sectionCount++; - } - else { - if (sectionCount == -1) { - NSMutableArray *newArray = [[NSMutableArray alloc] init]; - [dataSource addObject:newArray]; - sectionCount++; - } - - IASKSpecifier *newSpecifier = [[IASKSpecifier alloc] initWithSpecifier:specifier]; - [(NSMutableArray*)[dataSource objectAtIndex:sectionCount] addObject:newSpecifier]; - } - } - [self setDataSource:dataSource]; -} - -- (BOOL)_sectionHasHeading:(NSInteger)section { - return [[[[self dataSource] objectAtIndex:section] objectAtIndex:0] isKindOfClass:[NSDictionary class]]; -} - -- (NSInteger)numberOfSections { - return [[self dataSource] count]; -} - -- (NSInteger)numberOfRowsForSection:(NSInteger)section { - int headingCorrection = [self _sectionHasHeading:section] ? 1 : 0; - return [(NSArray*)[[self dataSource] objectAtIndex:section] count] - headingCorrection; -} - -- (IASKSpecifier*)specifierForIndexPath:(NSIndexPath*)indexPath { - int headingCorrection = [self _sectionHasHeading:indexPath.section] ? 1 : 0; - - IASKSpecifier *specifier = [[[self dataSource] objectAtIndex:indexPath.section] objectAtIndex:(indexPath.row+headingCorrection)]; - specifier.settingsReader = self; - return specifier; -} - -- (NSIndexPath*)indexPathForKey:(NSString *)key { - for (NSUInteger sectionIndex = 0; sectionIndex < self.dataSource.count; sectionIndex++) { - NSArray *section = [self.dataSource objectAtIndex:sectionIndex]; - for (NSUInteger rowIndex = 0; rowIndex < section.count; rowIndex++) { - IASKSpecifier *specifier = (IASKSpecifier*)[section objectAtIndex:rowIndex]; - if ([specifier isKindOfClass:[IASKSpecifier class]] && [specifier.key isEqualToString:key]) { - NSUInteger correctedRowIndex = rowIndex - [self _sectionHasHeading:sectionIndex]; - return [NSIndexPath indexPathForRow:correctedRowIndex inSection:sectionIndex]; - } - } - } - return nil; -} - -- (IASKSpecifier*)specifierForKey:(NSString*)key { - for (NSArray *specifiers in _dataSource) { - for (id sp in specifiers) { - if ([sp isKindOfClass:[IASKSpecifier class]]) { - if ([[sp key] isEqualToString:key]) { - return sp; - } - } - } - } - return nil; -} - -- (NSString*)titleForSection:(NSInteger)section { - if ([self _sectionHasHeading:section]) { - NSDictionary *dict = [[[self dataSource] objectAtIndex:section] objectAtIndex:kIASKSectionHeaderIndex]; - return [self titleForStringId:[dict objectForKey:kIASKTitle]]; - } - return nil; -} - -- (NSString*)keyForSection:(NSInteger)section { - if ([self _sectionHasHeading:section]) { - return [[[[self dataSource] objectAtIndex:section] objectAtIndex:kIASKSectionHeaderIndex] objectForKey:kIASKKey]; - } - return nil; -} - -- (NSString*)footerTextForSection:(NSInteger)section { - if ([self _sectionHasHeading:section]) { - NSDictionary *dict = [[[self dataSource] objectAtIndex:section] objectAtIndex:kIASKSectionHeaderIndex]; - return [self titleForStringId:[dict objectForKey:kIASKFooterText]]; - } - return nil; -} - -- (NSString*)titleForStringId:(NSString*)stringId { - return [_bundle localizedStringForKey:stringId value:stringId table:self.localizationTable]; -} - -- (NSString*)pathForImageNamed:(NSString*)image { - return [[self bundlePath] stringByAppendingPathComponent:image]; -} - -- (NSString *)platformSuffix { - BOOL isPad = NO; -#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200) - isPad = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad; -#endif - return isPad ? @"~ipad" : @"~iphone"; -} - -- (NSString *)file:(NSString *)file - withBundle:(NSString *)bundle - suffix:(NSString *)suffix - extension:(NSString *)extension { - - NSString *appBundle = [[NSBundle mainBundle] bundlePath]; - bundle = [appBundle stringByAppendingPathComponent:bundle]; - file = [file stringByAppendingFormat:@"%@%@", suffix, extension]; - return [bundle stringByAppendingPathComponent:file]; - -} - -- (NSString *)locateSettingsFile: (NSString *)file { - - // The file is searched in the following order: - // - // InAppSettings.bundle/FILE~DEVICE.inApp.plist - // InAppSettings.bundle/FILE.inApp.plist - // InAppSettings.bundle/FILE~DEVICE.plist - // InAppSettings.bundle/FILE.plist - // Settings.bundle/FILE~DEVICE.inApp.plist - // Settings.bundle/FILE.inApp.plist - // Settings.bundle/FILE~DEVICE.plist - // Settings.bundle/FILE.plist - // - // where DEVICE is either "iphone" or "ipad" depending on the current - // interface idiom. - // - // Settings.app uses the ~DEVICE suffixes since iOS 4.0. There are some - // differences from this implementation: - // - For an iPhone-only app running on iPad, Settings.app will not use the - // ~iphone suffix. There is no point in using these suffixes outside - // of universal apps anyway. - // - This implementation uses the device suffixes on iOS 3.x as well. - // - also check current locale (short only) - - NSArray *bundles = - [NSArray arrayWithObjects:kIASKBundleFolderAlt, kIASKBundleFolder, nil]; - - NSArray *extensions = - [NSArray arrayWithObjects:@".inApp.plist", @".plist", nil]; - - NSArray *suffixes = - [NSArray arrayWithObjects:[self platformSuffix], @"", nil]; - - NSArray *languages = - [NSArray arrayWithObjects:[[[NSLocale preferredLanguages] objectAtIndex:0] stringByAppendingString:KIASKBundleLocaleFolderExtension], @"", nil]; - - NSString *path = nil; - NSFileManager *fileManager = [NSFileManager defaultManager]; - - for (NSString *bundle in bundles) { - for (NSString *extension in extensions) { - for (NSString *suffix in suffixes) { - for (NSString *language in languages) { - path = [self file:file - withBundle:[bundle stringByAppendingPathComponent:language] - suffix:suffix - extension:extension]; - if ([fileManager fileExistsAtPath:path]) { - goto exitFromNestedLoop; - } - } - } - } - } - -exitFromNestedLoop: - return path; -} - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStore.h b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStore.h deleted file mode 100755 index 79639acbe252..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStore.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// IASKSettingsStore.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// Marc-Etienne M.Léveillé, Edovia Inc., http://www.edovia.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import <Foundation/Foundation.h> - -@protocol IASKSettingsStore <NSObject> -@required -- (void)setBool:(BOOL)value forKey:(NSString*)key; -- (void)setFloat:(float)value forKey:(NSString*)key; -- (void)setDouble:(double)value forKey:(NSString*)key; -- (void)setInteger:(int)value forKey:(NSString*)key; -- (void)setObject:(id)value forKey:(NSString*)key; -- (BOOL)boolForKey:(NSString*)key; -- (float)floatForKey:(NSString*)key; -- (double)doubleForKey:(NSString*)key; -- (int)integerForKey:(NSString*)key; -- (id)objectForKey:(NSString*)key; -- (BOOL)synchronize; // Write settings to a permanant storage. Returns YES on success, NO otherwise -@end - - -@interface IASKAbstractSettingsStore : NSObject <IASKSettingsStore> { -} - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStore.m b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStore.m deleted file mode 100755 index 89484591f8cf..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStore.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// IASKSettingsStore.m -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// Marc-Etienne M.Léveillé, Edovia Inc., http://www.edovia.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import "IASKSettingsStore.h" - -@implementation IASKAbstractSettingsStore - -- (void)setObject:(id)value forKey:(NSString*)key { - [NSException raise:@"Unimplemented" - format:@"setObject:forKey: must be implemented in subclasses of IASKAbstractSettingsStore"]; -} - -- (id)objectForKey:(NSString*)key { - [NSException raise:@"Unimplemented" - format:@"objectForKey: must be implemented in subclasses of IASKAbstractSettingsStore"]; - return nil; -} - -- (void)setBool:(BOOL)value forKey:(NSString*)key { - [self setObject:[NSNumber numberWithBool:value] forKey:key]; -} - -- (void)setFloat:(float)value forKey:(NSString*)key { - [self setObject:[NSNumber numberWithFloat:value] forKey:key]; -} - -- (void)setInteger:(int)value forKey:(NSString*)key { - [self setObject:[NSNumber numberWithInt:value] forKey:key]; -} - -- (void)setDouble:(double)value forKey:(NSString*)key { - [self setObject:[NSNumber numberWithDouble:value] forKey:key]; -} - -- (BOOL)boolForKey:(NSString*)key { - return [[self objectForKey:key] boolValue]; -} - -- (float)floatForKey:(NSString*)key { - return [[self objectForKey:key] floatValue]; -} -- (int)integerForKey:(NSString*)key { - return [[self objectForKey:key] intValue]; -} - -- (double)doubleForKey:(NSString*)key { - return [[self objectForKey:key] doubleValue]; -} - -- (BOOL)synchronize { - return NO; -} - -@end
\ No newline at end of file diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreFile.h b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreFile.h deleted file mode 100755 index 54331ed979ca..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreFile.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// IASKSettingsStoreFile.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// Marc-Etienne M.Léveillé, Edovia Inc., http://www.edovia.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import <Foundation/Foundation.h> -#import "IASKSettingsStore.h" - -@interface IASKSettingsStoreFile : IASKAbstractSettingsStore { - NSString * _filePath; - NSMutableDictionary * _dict; -} - -- (id)initWithPath:(NSString*)path; - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreFile.m b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreFile.m deleted file mode 100755 index 3192650f3aae..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreFile.m +++ /dev/null @@ -1,53 +0,0 @@ -// -// IASKSettingsStoreFile.m -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// Marc-Etienne M.Léveillé, Edovia Inc., http://www.edovia.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import "IASKSettingsStoreFile.h" - - -@implementation IASKSettingsStoreFile - -- (id)initWithPath:(NSString*)path { - if((self = [super init])) { - _filePath = path; - _dict = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; - if(_dict == nil) { - _dict = [[NSMutableDictionary alloc] init]; - } - } - return self; -} - -- (void)dealloc { - _dict = nil; - _filePath = nil; - -} - - -- (void)setObject:(id)value forKey:(NSString *)key { - [_dict setObject:value forKey:key]; -} - -- (id)objectForKey:(NSString *)key { - return [_dict objectForKey:key]; -} - -- (BOOL)synchronize { - return [_dict writeToFile:_filePath atomically:YES]; -} - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreUserDefaults.h b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreUserDefaults.h deleted file mode 100755 index c1d2fce3cf1c..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreUserDefaults.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// IASKSettingsStoreUserDefaults.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// Marc-Etienne M.Léveillé, Edovia Inc., http://www.edovia.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import <Foundation/Foundation.h> -#import "IASKSettingsStore.h" - -@interface IASKSettingsStoreUserDefaults : IASKAbstractSettingsStore { - -} - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreUserDefaults.m b/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreUserDefaults.m deleted file mode 100755 index c5979f80b356..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSettingsStoreUserDefaults.m +++ /dev/null @@ -1,67 +0,0 @@ -// -// IASKSettingsStoreUserDefaults.m -// http://www.inappsettingskit.com -// -// Copyright (c) 2010: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// Marc-Etienne M.Léveillé, Edovia Inc., http://www.edovia.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import "IASKSettingsStoreUserDefaults.h" - - -@implementation IASKSettingsStoreUserDefaults - -- (void)setBool:(BOOL)value forKey:(NSString*)key { - [[NSUserDefaults standardUserDefaults] setBool:value forKey:key]; -} - -- (void)setFloat:(float)value forKey:(NSString*)key { - [[NSUserDefaults standardUserDefaults] setFloat:value forKey:key]; -} - -- (void)setDouble:(double)value forKey:(NSString*)key { - [[NSUserDefaults standardUserDefaults] setDouble:value forKey:key]; -} - -- (void)setInteger:(int)value forKey:(NSString*)key { - [[NSUserDefaults standardUserDefaults] setInteger:value forKey:key]; -} - -- (void)setObject:(id)value forKey:(NSString*)key { - [[NSUserDefaults standardUserDefaults] setObject:value forKey:key]; -} - -- (BOOL)boolForKey:(NSString*)key { - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} - -- (float)floatForKey:(NSString*)key { - return [[NSUserDefaults standardUserDefaults] floatForKey:key]; -} - -- (double)doubleForKey:(NSString*)key { - return [[NSUserDefaults standardUserDefaults] doubleForKey:key]; -} - -- (int)integerForKey:(NSString*)key { - return [[NSUserDefaults standardUserDefaults] integerForKey:key]; -} - -- (id)objectForKey:(NSString*)key { - return [[NSUserDefaults standardUserDefaults] objectForKey:key]; -} - -- (BOOL)synchronize { - return [[NSUserDefaults standardUserDefaults] synchronize]; -} - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSpecifier.h b/ios/iosremote/InAppSettingsKit/Models/IASKSpecifier.h deleted file mode 100755 index 5053c4052d0c..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSpecifier.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// IASKSpecifier.h -// http://www.inappsettingskit.com -// -// Copyright (c) 2009: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import <Foundation/Foundation.h> -#import <UIKit/UIKit.h> - -@class IASKSettingsReader; - -@interface IASKSpecifier : NSObject { - NSDictionary *_specifierDict; - NSDictionary *_multipleValuesDict; - IASKSettingsReader *__unsafe_unretained _settingsReader; -} -@property (nonatomic, strong) NSDictionary *specifierDict; -@property (nonatomic, unsafe_unretained) IASKSettingsReader *settingsReader; - -- (id)initWithSpecifier:(NSDictionary*)specifier; -- (NSString*)localizedObjectForKey:(NSString*)key; -- (NSString*)title; -- (NSString*)key; -- (NSString*)type; -- (NSString*)titleForCurrentValue:(id)currentValue; -- (NSInteger)multipleValuesCount; -- (NSArray*)multipleValues; -- (NSArray*)multipleTitles; -- (NSString*)file; -- (id)defaultValue; -- (id)defaultStringValue; -- (BOOL)defaultBoolValue; -- (id)trueValue; -- (id)falseValue; -- (float)minimumValue; -- (float)maximumValue; -- (NSString*)minimumValueImage; -- (NSString*)maximumValueImage; -- (BOOL)isSecure; -- (UIKeyboardType)keyboardType; -- (UITextAutocapitalizationType)autocapitalizationType; -- (UITextAutocorrectionType)autoCorrectionType; -- (NSString*)footerText; -- (Class)viewControllerClass; -- (SEL)viewControllerSelector; --(Class)buttonClass; --(SEL)buttonAction; - -@end diff --git a/ios/iosremote/InAppSettingsKit/Models/IASKSpecifier.m b/ios/iosremote/InAppSettingsKit/Models/IASKSpecifier.m deleted file mode 100755 index 2ca65b2816e3..000000000000 --- a/ios/iosremote/InAppSettingsKit/Models/IASKSpecifier.m +++ /dev/null @@ -1,239 +0,0 @@ -// -// IASKSpecifier.m -// http://www.inappsettingskit.com -// -// Copyright (c) 2009: -// Luc Vandal, Edovia Inc., http://www.edovia.com -// Ortwin Gentz, FutureTap GmbH, http://www.futuretap.com -// All rights reserved. -// -// It is appreciated but not required that you give credit to Luc Vandal and Ortwin Gentz, -// as the original authors of this code. You can give credit in a blog post, a tweet or on -// a info page of your app. Also, the original authors appreciate letting them know if you use this code. -// -// This code is licensed under the BSD license that is available at: http://www.opensource.org/licenses/bsd-license.php -// - -#import "IASKSpecifier.h" -#import "IASKSettingsReader.h" - -@interface IASKSpecifier () -@property (nonatomic, strong) NSDictionary *multipleValuesDict; -- (void)_reinterpretValues:(NSDictionary*)specifierDict; -@end - -@implementation IASKSpecifier - -@synthesize specifierDict=_specifierDict; -@synthesize multipleValuesDict=_multipleValuesDict; -@synthesize settingsReader = _settingsReader; - -- (id)initWithSpecifier:(NSDictionary*)specifier { - if ((self = [super init])) { - [self setSpecifierDict:specifier]; - - if ([[self type] isEqualToString:kIASKPSMultiValueSpecifier] || - [[self type] isEqualToString:kIASKPSTitleValueSpecifier]) { - [self _reinterpretValues:[self specifierDict]]; - } - } - return self; -} - -- (void)dealloc { - _specifierDict = nil; - _multipleValuesDict = nil; - - _settingsReader = nil; - -} - -- (void)_reinterpretValues:(NSDictionary*)specifierDict { - NSArray *values = [_specifierDict objectForKey:kIASKValues]; - NSArray *titles = [_specifierDict objectForKey:kIASKTitles]; - - NSMutableDictionary *multipleValuesDict = [[NSMutableDictionary alloc] init]; - - if (values) { - [multipleValuesDict setObject:values forKey:kIASKValues]; - } - - if (titles) { - [multipleValuesDict setObject:titles forKey:kIASKTitles]; - } - - [self setMultipleValuesDict:multipleValuesDict]; -} -- (NSString*)localizedObjectForKey:(NSString*)key { - return [self.settingsReader titleForStringId:[_specifierDict objectForKey:key]]; -} - -- (NSString*)title { - return [self localizedObjectForKey:kIASKTitle]; -} - -- (NSString*)footerText { - return [self localizedObjectForKey:kIASKFooterText]; -} - --(Class) viewControllerClass { - return NSClassFromString([_specifierDict objectForKey:kIASKViewControllerClass]); -} - --(SEL) viewControllerSelector { - return NSSelectorFromString([_specifierDict objectForKey:kIASKViewControllerSelector]); -} - --(Class)buttonClass { - return NSClassFromString([_specifierDict objectForKey:kIASKButtonClass]); -} - --(SEL)buttonAction { - return NSSelectorFromString([_specifierDict objectForKey:kIASKButtonAction]); -} - -- (NSString*)key { - return [_specifierDict objectForKey:kIASKKey]; -} - -- (NSString*)type { - return [_specifierDict objectForKey:kIASKType]; -} - -- (NSString*)titleForCurrentValue:(id)currentValue { - NSArray *values = [self multipleValues]; - NSArray *titles = [self multipleTitles]; - if (values.count != titles.count) { - return nil; - } - NSInteger keyIndex = [values indexOfObject:currentValue]; - if (keyIndex == NSNotFound) { - return nil; - } - @try { - return [self.settingsReader titleForStringId:[titles objectAtIndex:keyIndex]]; - } - @catch (NSException * e) {} - return nil; -} - -- (NSInteger)multipleValuesCount { - return [[_multipleValuesDict objectForKey:kIASKValues] count]; -} - -- (NSArray*)multipleValues { - return [_multipleValuesDict objectForKey:kIASKValues]; -} - -- (NSArray*)multipleTitles { - return [_multipleValuesDict objectForKey:kIASKTitles]; -} - -- (NSString*)file { - return [_specifierDict objectForKey:kIASKFile]; -} - -- (id)defaultValue { - return [_specifierDict objectForKey:kIASKDefaultValue]; -} - -- (id)defaultStringValue { - return [[_specifierDict objectForKey:kIASKDefaultValue] description]; -} - -- (BOOL)defaultBoolValue { - id defaultValue = [self defaultValue]; - if ([defaultValue isEqual:[self trueValue]]) { - return YES; - } - if ([defaultValue isEqual:[self falseValue]]) { - return NO; - } - return [defaultValue boolValue]; -} - -- (id)trueValue { - return [_specifierDict objectForKey:kIASKTrueValue]; -} - -- (id)falseValue { - return [_specifierDict objectForKey:kIASKFalseValue]; -} - -- (float)minimumValue { - return [[_specifierDict objectForKey:kIASKMinimumValue] floatValue]; -} - -- (float)maximumValue { - return [[_specifierDict objectForKey:kIASKMaximumValue] floatValue]; -} - -- (NSString*)minimumValueImage { - return [_specifierDict objectForKey:kIASKMinimumValueImage]; -} - -- (NSString*)maximumValueImage { - return [_specifierDict objectForKey:kIASKMaximumValueImage]; -} - -- (BOOL)isSecure { - return [[_specifierDict objectForKey:kIASKIsSecure] boolValue]; -} - -- (UIKeyboardType)keyboardType { - if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:kIASKKeyboardAlphabet]) { - return UIKeyboardTypeDefault; - } - else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:kIASKKeyboardNumbersAndPunctuation]) { - return UIKeyboardTypeNumbersAndPunctuation; - } - else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:kIASKKeyboardNumberPad]) { - return UIKeyboardTypeNumberPad; - } - else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:kIASKKeyboardDecimalPad]) { - if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_4_1) { - return UIKeyboardTypeDecimalPad; - } - else { - return UIKeyboardTypeNumbersAndPunctuation; - } - } - else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:KIASKKeyboardURL]) { - return UIKeyboardTypeURL; - } - else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:kIASKKeyboardEmailAddress]) { - return UIKeyboardTypeEmailAddress; - } - return UIKeyboardTypeDefault; -} - -- (UITextAutocapitalizationType)autocapitalizationType { - if ([[_specifierDict objectForKey:kIASKAutocapitalizationType] isEqualToString:kIASKAutoCapNone]) { - return UITextAutocapitalizationTypeNone; - } - else if ([[_specifierDict objectForKey:kIASKAutocapitalizationType] isEqualToString:kIASKAutoCapSentences]) { - return UITextAutocapitalizationTypeSentences; - } - else if ([[_specifierDict objectForKey:kIASKAutocapitalizationType] isEqualToString:kIASKAutoCapWords]) { - return UITextAutocapitalizationTypeWords; - } - else if ([[_specifierDict objectForKey:kIASKAutocapitalizationType] isEqualToString:kIASKAutoCapAllCharacters]) { - return UITextAutocapitalizationTypeAllCharacters; - } - return UITextAutocapitalizationTypeNone; -} - -- (UITextAutocorrectionType)autoCorrectionType { - if ([[_specifierDict objectForKey:kIASKAutoCorrectionType] isEqualToString:kIASKAutoCorrDefault]) { - return UITextAutocorrectionTypeDefault; - } - else if ([[_specifierDict objectForKey:kIASKAutoCorrectionType] isEqualToString:kIASKAutoCorrNo]) { - return UITextAutocorrectionTypeNo; - } - else if ([[_specifierDict objectForKey:kIASKAutoCorrectionType] isEqualToString:kIASKAutoCorrYes]) { - return UITextAutocorrectionTypeYes; - } - return UITextAutocorrectionTypeDefault; -} - -@end |