Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions app/Jasonette/Jason.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,10 @@ - (void)start{
**************************************************/
JasonAppDelegate *app = (JasonAppDelegate *)[[UIApplication sharedApplication] delegate];
NSDictionary *plist = [self getSettings];
ROOT_URL = plist[@"url"];
INITIAL_LOADING = plist[@"loading"];

JasonViewController *vc = [[JasonViewController alloc] init];
vc.url = ROOT_URL;
vc.url = [self getRootUrl];
vc.loading = INITIAL_LOADING;
vc.view.backgroundColor = [UIColor whiteColor];
vc.extendedLayoutIncludesOpaqueBars = YES;
Expand Down Expand Up @@ -850,6 +849,23 @@ - (NSArray *)getKeys{
}
return [newKeys copy];
}
-(NSString*)getRootUrl{
NSDictionary *plist = [self getSettings];

NSArray *preferredLocalizations = [NSLocale preferredLanguages];
for (__strong NSString *loc in preferredLocalizations) {//try getting localized root url for one of the preferred localizations
loc = [[loc substringToIndex:2] uppercaseString];
NSString *localizedUrl = [@"url" stringByAppendingString:loc];
if(plist[localizedUrl]){
ROOT_URL = plist[localizedUrl];
break;
}
}
if(ROOT_URL == nil){//set default root url if nothing was set
ROOT_URL = plist[@"url"];
}
return ROOT_URL;
}
-(NSDictionary*)getSettings{
NSDictionary * infoPlistSettings = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"settings"];
if(infoPlistSettings != nil){//target's info.plist file contains customized settings
Expand Down