Updating OvershareKit and InAppSettingsKit.

This commit is contained in:
Samuel Clay 2014-05-19 13:33:42 -07:00
parent 68403a0eca
commit 2cb5a1e9d2
347 changed files with 4048 additions and 2783 deletions

View file

@ -751,7 +751,7 @@ static NSString * const kAFMultipartFormBoundary = @"Boundary+0xAbCdEfGbOuNdArY"
static NSString * const kAFMultipartFormCRLF = @"\r\n";
static NSInteger const kAFStreamToStreamBufferSize = 1024 * 1024; //1 meg default
//static NSInteger const kAFStreamToStreamBufferSize = 1024 * 1024; //1 meg default
static inline NSString * AFMultipartFormInitialBoundary() {
return [NSString stringWithFormat:@"--%@%@", kAFMultipartFormBoundary, kAFMultipartFormCRLF];

View file

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>4.0.3</string>
<string>4.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -58,7 +58,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>4.0.3</string>
<string>4.1.0</string>
<key>FacebookAppID</key>
<string>230426707030569</string>
<key>LSRequiresIPhoneOS</key>

File diff suppressed because it is too large Load diff

View file

@ -31,10 +31,6 @@
#error "IASK needs ARC"
#endif
static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3f;
static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2f;
static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8f;
static NSString *kIASKCredits = @"Powered by InAppSettingsKit"; // Leave this as-is!!!
#define kIASKSpecifierValuesViewControllerIndex 0
@ -50,6 +46,7 @@ CGRect IASKCGRectSwap(CGRect rect);
id _currentFirstResponder;
__weak UIViewController *_currentChildViewController;
BOOL _reloadDisabled;
}
@property (nonatomic, strong) id currentFirstResponder;
@ -93,7 +90,7 @@ CGRect IASKCGRectSwap(CGRect rect);
self.tableView.contentOffset = CGPointMake(0, 0);
self.settingsReader = nil; // automatically initializes itself
_hiddenKeys = nil;
[self.tableView reloadData];
if (!_reloadDisabled) [self.tableView reloadData];
}
- (BOOL)isPad {
@ -116,6 +113,7 @@ CGRect IASKCGRectSwap(CGRect rect);
}
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {
_reloadDisabled = NO;
_showDoneButton = YES;
// If set to YES, will display credits for InAppSettingsKit creators
_showCreditsFooter = YES;
@ -132,7 +130,7 @@ CGRect IASKCGRectSwap(CGRect rect);
return [self initWithStyle:UITableViewStyleGrouped];
}
- (void) viewDidLoad {
- (void)viewDidLoad {
[super viewDidLoad];
if ([self isPad]) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
@ -192,8 +190,8 @@ CGRect IASKCGRectSwap(CGRect rect);
[super viewDidAppear:animated];
NSNotificationCenter *dc = [NSNotificationCenter defaultCenter];
IASK_IF_IOS4_OR_GREATER([dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];);
IASK_IF_IOS4_OR_GREATER([dc addObserver:self selector:@selector(reload) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];);
[dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];
[dc addObserver:self selector:@selector(reload) name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
[dc addObserver:self selector:@selector(synchronizeSettings) name:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication]];
}
@ -203,7 +201,11 @@ CGRect IASKCGRectSwap(CGRect rect);
}
- (void)viewDidDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] removeObserver:self];
NSNotificationCenter *dc = [NSNotificationCenter defaultCenter];
[dc removeObserver:self name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];
[dc removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication]];
[dc removeObserver:self name:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication]];
[dc removeObserver:self name:UIApplicationWillTerminateNotification object:[UIApplication sharedApplication]];
// hide the keyboard
[self.currentFirstResponder resignFirstResponder];
@ -292,7 +294,7 @@ CGRect IASKCGRectSwap(CGRect rect);
[self.tableView endUpdates];
} else {
self.settingsReader.hiddenKeys = theHiddenKeys;
[self.tableView reloadData];
if (!_reloadDisabled) [self.tableView reloadData];
}
}
UIViewController *childViewController = _currentChildViewController;
@ -401,17 +403,23 @@ CGRect IASKCGRectSwap(CGRect rect);
}
}
NSString *title;
if ((title = [self tableView:tableView titleForHeaderInSection:section])) {
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
CGSize size = [title
boundingRectWithSize:CGSizeMake(tableView.frame.size.width - 2*kIASKHorizontalPaddingGroupTitles, INFINITY)
options:nil
attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:[UIFont labelFontSize]],
NSParagraphStyleAttributeName: paragraphStyle}
context:nil].size;
return roundf(size.height+kIASKVerticalPaddingGroupTitles);
NSString *title = [self tableView:tableView titleForHeaderInSection:section];
if ([title length] > 0) {
CGSize size = CGSizeZero;
IASK_IF_PRE_IOS7
(
size = [title sizeWithFont:[UIFont boldSystemFontOfSize:[UIFont labelFontSize]]
constrainedToSize:CGSizeMake(tableView.frame.size.width - 2*kIASKHorizontalPaddingGroupTitles, INFINITY)
lineBreakMode:NSLineBreakByWordWrapping];
);
IASK_IF_IOS7_OR_GREATER
(
size = [title boundingRectWithSize:CGSizeMake(tableView.frame.size.width - 2*kIASKHorizontalPaddingGroupTitles, INFINITY)
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName: [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]}
context:nil].size;
);
return roundf(size.height+kIASKVerticalPaddingGroupTitles);
}
return 0;
}
@ -429,13 +437,11 @@ CGRect IASKCGRectSwap(CGRect rect);
return [NSString stringWithFormat:@"%@\n\n%@", footerText, kIASKCredits];
}
} else {
if ([footerText length] == 0) {
return nil;
}
return [self.settingsReader footerTextForSection:section];
return footerText;
}
}
- (UITableViewCell*)newCellForIdentifier:(NSString*)identifier {
UITableViewCell *cell = nil;
if ([identifier isEqualToString:kIASKPSToggleSwitchSpecifier]) {
@ -463,8 +469,10 @@ CGRect IASKCGRectSwap(CGRect rect);
} else {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
cell.textLabel.minimumScaleFactor = kIASKMinimumFontSize/[UIFont labelFontSize];
cell.detailTextLabel.minimumScaleFactor = kIASKMinimumFontSize/[UIFont labelFontSize];
IASK_IF_PRE_IOS6(cell.textLabel.minimumFontSize = kIASKMinimumFontSize;
cell.detailTextLabel.minimumFontSize = kIASKMinimumFontSize;);
IASK_IF_IOS6_OR_GREATER(cell.textLabel.minimumScaleFactor = kIASKMinimumFontSize / cell.textLabel.font.pointSize;
cell.detailTextLabel.minimumScaleFactor = kIASKMinimumFontSize / cell.detailTextLabel.font.pointSize;);
return cell;
}
@ -567,6 +575,7 @@ CGRect IASKCGRectSwap(CGRect rect);
} else if ([specifier.type isEqualToString:kIASKButtonSpecifier]) {
NSString *value = [self.settingsStore objectForKey:specifier.key];
cell.textLabel.text = [value isKindOfClass:[NSString class]] ? [self.settingsReader titleForStringId:value] : specifier.title;
cell.accessoryType = (specifier.textAlignment == NSTextAlignmentLeft) ? UITableViewCellAccessoryDisclosureIndicator : UITableViewCellAccessoryNone;
} else {
cell.textLabel.text = specifier.title;
}
@ -616,8 +625,17 @@ CGRect IASKCGRectSwap(CGRect rect);
} else if ([[specifier type] isEqualToString:kIASKPSTextFieldSpecifier]) {
IASKPSTextFieldSpecifierViewCell *textFieldCell = (id)[tableView cellForRowAtIndexPath:indexPath];
[textFieldCell.textField becomeFirstResponder];
} else if ([[specifier type] isEqualToString:kIASKPSChildPaneSpecifier]) {
if ([specifier viewControllerStoryBoardID]){
NSString *storyBoardFileFromSpecifier = [specifier viewControllerStoryBoardFile];
storyBoardFileFromSpecifier = storyBoardFileFromSpecifier && storyBoardFileFromSpecifier.length > 0 ? storyBoardFileFromSpecifier : @"MainStoryboard";
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:storyBoardFileFromSpecifier bundle:nil];
UIViewController * vc = [storyBoard instantiateViewControllerWithIdentifier:[specifier viewControllerStoryBoardID]];
[self.navigationController pushViewController:vc animated:YES];
return;
}
Class vcClass = [specifier viewControllerClass];
if (vcClass) {
SEL initSelector = [specifier viewControllerSelector];
@ -627,7 +645,7 @@ CGRect IASKCGRectSwap(CGRect rect);
UIViewController * vc = [vcClass alloc];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
vc = [vc performSelector:initSelector withObject:[specifier file] withObject:[specifier key]];
vc = [vc performSelector:initSelector withObject:[specifier file] withObject:specifier];
#pragma clang diagnostic pop
if ([vc respondsToSelector:@selector(setDelegate:)]) {
[vc performSelector:@selector(setDelegate:) withObject:self.delegate];
@ -644,16 +662,23 @@ CGRect IASKCGRectSwap(CGRect rect);
return;
}
_reloadDisabled = YES; // Disable internal unnecessary reloads
IASKAppSettingsViewController *targetViewController = [[[self class] alloc] init];
targetViewController.showDoneButton = NO;
targetViewController.settingsStore = self.settingsStore;
targetViewController.showCreditsFooter = NO; // Does not reload the tableview (but next setters do it)
targetViewController.delegate = self.delegate;
targetViewController.settingsStore = self.settingsStore;
targetViewController.file = specifier.file;
targetViewController.hiddenKeys = self.hiddenKeys;
targetViewController.title = specifier.title;
targetViewController.showCreditsFooter = NO;
_currentChildViewController = targetViewController;
_reloadDisabled = NO;
[self.tableView reloadData];
[[self navigationController] pushViewController:targetViewController animated:YES];
} else if ([[specifier type] isEqualToString:kIASKOpenURLSpecifier]) {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:specifier.file]];
@ -684,8 +709,7 @@ CGRect IASKCGRectSwap(CGRect rect);
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.navigationBar.barStyle = self.navigationController.navigationBar.barStyle;
mailViewController.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;
mailViewController.navigationBar.titleTextAttributes =
self.navigationController.navigationBar.titleTextAttributes;
mailViewController.navigationBar.titleTextAttributes = self.navigationController.navigationBar.titleTextAttributes;
if ([specifier localizedObjectForKey:kIASKMailComposeSubject]) {
[mailViewController setSubject:[specifier localizedObjectForKey:kIASKMailComposeSubject]];
@ -726,9 +750,11 @@ CGRect IASKCGRectSwap(CGRect rect);
mailViewController.mailComposeDelegate = vc;
_currentChildViewController = mailViewController;
[vc presentViewController:mailViewController
animated:YES
completion:nil];
UIStatusBarStyle savedStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
[vc presentViewController:mailViewController animated:YES completion:^{
[UIApplication sharedApplication].statusBarStyle = savedStatusBarStyle;
}];
} else {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Mail not configured", @"InAppSettingsKit")
@ -817,7 +843,9 @@ static NSDictionary *oldUserDefaults = nil;
}
}
if (indexPathsToUpdate.count) {
[self.tableView reloadRowsAtIndexPaths:indexPathsToUpdate withRowAnimation:UITableViewRowAnimationNone];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.tableView reloadRowsAtIndexPaths:indexPathsToUpdate withRowAnimation:UITableViewRowAnimationNone];
});
}
}

View file

@ -16,15 +16,14 @@
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import "IASKSpecifier.h"
@interface IASKAppSettingsWebViewController : UIViewController <UIWebViewDelegate, MFMailComposeViewControllerDelegate> {
UIWebView *webView;
NSURL *url;
}
@interface IASKAppSettingsWebViewController : UIViewController <UIWebViewDelegate, MFMailComposeViewControllerDelegate>
- (id)initWithFile:(NSString*)htmlFileName key:(NSString*)key;
- (id)initWithFile:(NSString*)htmlFileName specifier:(IASKSpecifier*)specifier;
@property (nonatomic, retain) UIWebView *webView;
@property (nonatomic, retain) NSURL *url;
@property (nonatomic, strong) UIWebView *webView;
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, strong) NSString *customTitle;
@end

View file

@ -15,13 +15,11 @@
//
#import "IASKAppSettingsWebViewController.h"
#import "IASKSettingsReader.h"
@implementation IASKAppSettingsWebViewController
@synthesize url;
@synthesize webView;
- (id)initWithFile:(NSString*)urlString key:(NSString*)key {
- (id)initWithFile:(NSString*)urlString specifier:(IASKSpecifier*)specifier {
self = [super init];
if (self) {
self.url = [NSURL URLWithString:urlString];
@ -32,27 +30,27 @@
else
self.url = nil;
}
self.customTitle = [specifier localizedObjectForKey:kIASKChildTitle];
self.title = self.customTitle ? : specifier.title;
}
return self;
}
- (void)loadView
{
webView = [[UIWebView alloc] init];
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
webView.delegate = self;
self.webView = [[UIWebView alloc] init];
self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.webView.delegate = self;
self.view = webView;
self.view = self.webView;
}
- (void)viewWillAppear:(BOOL)animated {
[webView loadRequest:[NSURLRequest requestWithURL:self.url]];
}
- (void)viewDidUnload {
[super viewDidUnload];
self.webView = nil;
UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 40, 20)];
activityIndicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
[activityIndicatorView startAnimating];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityIndicatorView];
[self.webView loadRequest:[NSURLRequest requestWithURL:self.url]];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
@ -60,7 +58,8 @@
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
self.navigationItem.title = [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"];
self.navigationItem.rightBarButtonItem = nil;
self.title = self.customTitle.length ? self.customTitle : [self.webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
@ -126,9 +125,14 @@
[mailViewController setToRecipients:toRecipients];
[self presentViewController:mailViewController
animated:YES
completion:nil];
mailViewController.navigationBar.barStyle = self.navigationController.navigationBar.barStyle;
mailViewController.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;
mailViewController.navigationBar.titleTextAttributes = self.navigationController.navigationBar.titleTextAttributes;
UIStatusBarStyle savedStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
[self presentViewController:mailViewController animated:YES completion:^{
[UIApplication sharedApplication].statusBarStyle = savedStatusBarStyle;
}];
return NO;
}
@ -141,8 +145,7 @@
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
[self dismissViewControllerAnimated:YES
completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];
}
@end

View file

@ -36,8 +36,11 @@
#define kIASKAutoCorrectionType @"AutocorrectionType"
#define kIASKValues @"Values"
#define kIASKTitles @"Titles"
#define kIASKShortTitles @"ShortTitles"
#define kIASKViewControllerClass @"IASKViewControllerClass"
#define kIASKViewControllerSelector @"IASKViewControllerSelector"
#define kIASKViewControllerStoryBoardFile @"IASKViewControllerStoryBoardFile"
#define kIASKViewControllerStoryBoardId @"IASKViewControllerStoryBoardId"
#define kIASKButtonClass @"IASKButtonClass"
#define kIASKButtonAction @"IASKButtonAction"
#define kIASKMailComposeToRecipents @"IASKMailComposeToRecipents"
@ -83,6 +86,12 @@
#define kIASKMailComposeSpecifier @"IASKMailComposeSpecifier"
#define kIASKCustomViewSpecifier @"IASKCustomViewSpecifier"
// IASKChildTitle can be set if IASKViewControllerClass is set to IASKAppSettingsWebViewController.
// If IASKChildTitle is set, the navigation title is fixed to it; otherwise, the title value is used and is overridden by the HTML title tag
// as soon as the web page is loaded; if IASKChildTitle is set to the empty string, the title is not shown on push but _will_ be replaced by
// the HTML title as soon as the page is loaded. The value of IASKChildTitle is localizable.
#define kIASKChildTitle @"IASKChildTitle"
#define kIASKAppSettingChanged @"kAppSettingChanged"
#define kIASKSectionHeaderIndex 0
@ -95,7 +104,7 @@
#define kIASKMaxLabelWidth 240
#define kIASKMinValueWidth 35
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
#define kIASKPaddingLeft (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 ? 14 : 9)
#define kIASKPaddingLeft (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 ? 15 : 9)
#else
#define kIASKPaddingLeft 9
#endif
@ -108,20 +117,56 @@
#define kIASKMinimumFontSize 12.0f
#ifndef kCFCoreFoundationVersionNumber_iPhoneOS_4_0
#define kCFCoreFoundationVersionNumber_iPhoneOS_4_0 550.32
#ifndef kCFCoreFoundationVersionNumber_iOS_7_0
#define kCFCoreFoundationVersionNumber_iOS_7_0 843.00
#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) \
#ifdef __IPHONE_6_0
#define IASK_IF_IOS6_OR_GREATER(...) \
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_6_0) \
{ \
__VA_ARGS__ \
}
#else
#define IASK_IF_IOS6_OR_GREATER(...)
#endif
#ifdef __IPHONE_6_0
#define IASK_IF_PRE_IOS6(...) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_6_0) \
{ \
__VA_ARGS__ \
} \
_Pragma("clang diagnostic pop")
#else
#define IASK_IF_PRE_IOS6(...) __VA_ARGS__
#endif
#ifdef __IPHONE_7_0
#define IASK_IF_IOS7_OR_GREATER(...) \
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) \
{ \
__VA_ARGS__ \
}
#else
#define IASK_IF_IOS7_OR_GREATER(...)
#endif
#ifdef __IPHONE_7_0
#define IASK_IF_PRE_IOS7(...) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
if (kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0) \
{ \
__VA_ARGS__ \
} \
_Pragma("clang diagnostic pop")
#else
#define IASK_IF_PRE_IOS7(...) __VA_ARGS__
#endif
@class IASKSpecifier;

View file

@ -24,7 +24,7 @@
- (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)setInteger:(NSInteger)value forKey:(NSString*)key;
- (void)setObject:(id)value forKey:(NSString*)key;
- (BOOL)boolForKey:(NSString*)key;
- (float)floatForKey:(NSString*)key;

View file

@ -38,8 +38,8 @@
[self setObject:[NSNumber numberWithFloat:value] forKey:key];
}
- (void)setInteger:(int)value forKey:(NSString*)key {
[self setObject:[NSNumber numberWithInt:value] forKey:key];
- (void)setInteger:(NSInteger)value forKey:(NSString*)key {
[self setObject:[NSNumber numberWithInteger:value] forKey:key];
}
- (void)setDouble:(double)value forKey:(NSString*)key {

View file

@ -49,7 +49,7 @@
[self.defaults setDouble:value forKey:key];
}
- (void)setInteger:(int)value forKey:(NSString*)key {
- (void)setInteger:(NSInteger)value forKey:(NSString*)key {
[self.defaults setInteger:value forKey:key];
}

View file

@ -50,8 +50,10 @@
- (NSString*)footerText;
- (Class)viewControllerClass;
- (SEL)viewControllerSelector;
-(Class)buttonClass;
-(SEL)buttonAction;
- (NSString*)viewControllerStoryBoardFile;
- (NSString*)viewControllerStoryBoardID;
- (Class)buttonClass;
- (SEL)buttonAction;
- (UIImage *)cellImage;
- (UIImage *)highlightedCellImage;
- (BOOL)adjustsFontSizeToFitWidth;

View file

@ -16,6 +16,7 @@
#import "IASKSpecifier.h"
#import "IASKSettingsReader.h"
#import "IASKAppSettingsWebViewController.h"
@interface IASKSpecifier ()
@ -40,7 +41,7 @@
- (void)_reinterpretValues:(NSDictionary*)specifierDict {
NSArray *values = [_specifierDict objectForKey:kIASKValues];
NSArray *titles = [_specifierDict objectForKey:kIASKTitles];
NSArray *shortTitles = [_specifierDict objectForKey:kIASKShortTitles];
NSMutableDictionary *multipleValuesDict = [NSMutableDictionary new];
if (values) {
@ -51,10 +52,15 @@
[multipleValuesDict setObject:titles forKey:kIASKTitles];
}
if (shortTitles) {
[multipleValuesDict setObject:shortTitles forKey:kIASKShortTitles];
}
[self setMultipleValuesDict:multipleValuesDict];
}
- (NSString*)localizedObjectForKey:(NSString*)key {
return [self.settingsReader titleForStringId:[_specifierDict objectForKey:key]];
IASKSettingsReader *settingsReader = self.settingsReader;
return [settingsReader titleForStringId:[_specifierDict objectForKey:key]];
}
- (NSString*)title {
@ -65,19 +71,28 @@
return [self localizedObjectForKey:kIASKFooterText];
}
-(Class) viewControllerClass {
- (Class)viewControllerClass {
[IASKAppSettingsWebViewController class]; // make sure this is linked into the binary/library
return NSClassFromString([_specifierDict objectForKey:kIASKViewControllerClass]);
}
-(SEL) viewControllerSelector {
- (SEL)viewControllerSelector {
return NSSelectorFromString([_specifierDict objectForKey:kIASKViewControllerSelector]);
}
-(Class)buttonClass {
- (NSString*)viewControllerStoryBoardFile {
return [_specifierDict objectForKey:kIASKViewControllerStoryBoardFile];
}
- (NSString*)viewControllerStoryBoardID {
return [_specifierDict objectForKey:kIASKViewControllerStoryBoardId];
}
- (Class)buttonClass {
return NSClassFromString([_specifierDict objectForKey:kIASKButtonClass]);
}
-(SEL)buttonAction {
- (SEL)buttonAction {
return NSSelectorFromString([_specifierDict objectForKey:kIASKButtonAction]);
}
@ -91,7 +106,10 @@
- (NSString*)titleForCurrentValue:(id)currentValue {
NSArray *values = [self multipleValues];
NSArray *titles = [self multipleTitles];
NSArray *titles = [self multipleShortTitles];
if (!titles)
titles = [self multipleTitles];
if (values.count != titles.count) {
return nil;
}
@ -100,7 +118,8 @@
return nil;
}
@try {
return [self.settingsReader titleForStringId:[titles objectAtIndex:keyIndex]];
IASKSettingsReader *strongSettingsReader = self.settingsReader;
return [strongSettingsReader titleForStringId:[titles objectAtIndex:keyIndex]];
}
@catch (NSException * e) {}
return nil;
@ -118,6 +137,10 @@
return [_multipleValuesDict objectForKey:kIASKTitles];
}
- (NSArray*)multipleShortTitles {
return [_multipleValuesDict objectForKey:kIASKShortTitles];
}
- (NSString*)file {
return [_specifierDict objectForKey:kIASKFile];
}
@ -189,12 +212,7 @@
return UIKeyboardTypeASCIICapable;
}
else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:kIASKKeyboardDecimalPad]) {
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_4_1) {
return UIKeyboardTypeDecimalPad;
}
else {
return UIKeyboardTypeNumbersAndPunctuation;
}
return UIKeyboardTypeDecimalPad;
}
else if ([[_specifierDict objectForKey:KIASKKeyboardType] isEqualToString:KIASKKeyboardURL]) {
return UIKeyboardTypeURL;
@ -236,12 +254,20 @@
- (UIImage *)cellImage
{
return [UIImage imageNamed:[_specifierDict objectForKey:kIASKCellImage]];
NSString *imageName = [_specifierDict objectForKey:kIASKCellImage];
if( imageName.length == 0 )
return nil;
return [UIImage imageNamed:imageName];
}
- (UIImage *)highlightedCellImage
{
return [UIImage imageNamed:[[_specifierDict objectForKey:kIASKCellImage ] stringByAppendingString:@"Highlighted"]];
NSString *imageName = [[_specifierDict objectForKey:kIASKCellImage ] stringByAppendingString:@"Highlighted"];
if( imageName.length == 0 )
return nil;
return [UIImage imageNamed:imageName];
}
- (BOOL)adjustsFontSizeToFitWidth {
@ -265,4 +291,8 @@
}
return NSTextAlignmentLeft;
}
- (id)valueForKey:(NSString *)key {
return [_specifierDict objectForKey:key];
}
@end

View file

@ -32,7 +32,7 @@
UIViewAutoresizingFlexibleLeftMargin;
_textField.font = [UIFont systemFontOfSize:17.0f];
_textField.minimumFontSize = kIASKMinimumFontSize;
_textField.textColor = [UIColor colorWithRed:0.275 green:0.376 blue:0.522 alpha:1.000];
_textField.textColor = [UIColor colorWithRed:0.275f green:0.376f blue:0.522f alpha:1.000f];
[self.contentView addSubview:_textField];
self.selectionStyle = UITableViewCellSelectionStyleNone;

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 299 B

View file

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 435 B

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 758 B

After

Width:  |  Height:  |  Size: 758 B

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Some files were not shown because too many files have changed in this diff Show more