Permalink
Browse files

Allow specifying settings in target's info.plist file

  • Loading branch information...
golopupinsky committed Dec 31, 2016
1 parent 6c80414 commit 81cf25c9b26fad1e066027e28daa9f13cdaabe3a
Showing with 12 additions and 4 deletions.
  1. +12 −4 app/Jasonette/Jason.m
@@ -113,8 +113,7 @@ - (void)start{
*
**************************************************/
JasonAppDelegate *app = (JasonAppDelegate *)[[UIApplication sharedApplication] delegate];
NSURL *file = [[NSBundle mainBundle] URLForResource:@"settings" withExtension:@"plist"];
NSDictionary *plist = [NSDictionary dictionaryWithContentsOfURL:file];
NSDictionary *plist = [self getSettings];
ROOT_URL = plist[@"url"];
INITIAL_LOADING = plist[@"loading"];
@@ -837,8 +836,7 @@ - (NSArray *)getKeys{
*
********************************************************************************************************/
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
NSURL *file = [[NSBundle mainBundle] URLForResource:@"settings" withExtension:@"plist"];
NSDictionary *plist = [NSDictionary dictionaryWithContentsOfURL:file];
NSDictionary *plist = [self getSettings];
for(NSString *key in plist){
if(![key isEqualToString:@"url"]){
NSString *new_key = [NSString stringWithFormat:@"$keys.%@", key];
@@ -852,6 +850,16 @@ - (NSArray *)getKeys{
}
return [newKeys copy];
}
-(NSDictionary*)getSettings{
NSDictionary * infoPlistSettings = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"settings"];
if(infoPlistSettings != nil){//target's info.plist file contains customized settings
return infoPlistSettings;
}else{//settings not found in target's Info.plist - get from file
NSURL *file = [[NSBundle mainBundle] URLForResource:@"settings" withExtension:@"plist"];
NSDictionary *settingsPlistSettings = [NSDictionary dictionaryWithContentsOfURL:file];
return settingsPlistSettings;
}
}
- (NSDictionary *)getEnv{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
NSURL *file = [[NSBundle mainBundle] URLForResource:@"Info" withExtension:@"plist"];

0 comments on commit 81cf25c

Please sign in to comment.