Permalink
Browse files

if a specifier links to a url or twitter it doesn't need a default va…

…lue or identifier
  • Loading branch information...
1 parent c9c6d49 commit 51a5d182c7a62ac197f92f6796fc1c0b0d5a32ff @kgn committed Jan 22, 2013
Showing with 16 additions and 7 deletions.
  1. +16 −7 InAppSettings/InAppSettingsSpecifier.m
@@ -46,7 +46,10 @@ - (NSString *)cellName{
}
- (id)getValue{
- id value = [[NSUserDefaults standardUserDefaults] valueForKey:[self getKey]];
+ id value = nil;
+ if([self getKey]){
+ value = [[NSUserDefaults standardUserDefaults] valueForKey:[self getKey]];
+ }
if(value == nil){
value = [self valueForKey:InAppSettingsSpecifierDefaultValue];
}
@@ -75,6 +78,10 @@ - (BOOL)hasDefaultValue{
return ([self valueForKey:InAppSettingsSpecifierDefaultValue]) ? YES:NO;
}
+- (BOOL)isTwitterOrURL{
+ return ([self valueForKey:InAppSettingsSpecifierInAppTwitter] || [self valueForKey:InAppSettingsSpecifierInAppURL]) ? YES:NO;
+}
+
- (BOOL)isValid{
if(![self getType]){
return NO;
@@ -153,12 +160,14 @@ - (BOOL)isValid{
}
if([self isType:InAppSettingsPSTitleValueSpecifier]){
- if(![self hasKey]){
- return NO;
- }
-
- if(![self hasDefaultValue]){
- return NO;
+ if(![self isTwitterOrURL]){
+ if(![self hasKey]){
+ return NO;
+ }
+
+ if(![self hasDefaultValue]){
+ return NO;
+ }
}
return YES;

0 comments on commit 51a5d18

Please sign in to comment.