diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 51cb4a8ff..41bb737b9 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -43,17 +43,17 @@ [[LinphoneManager instance] becomeActive]; } -- (void)registerDefaultsFromSettingsBundle { - // source: http://stackoverflow.com/questions/510216/ +- (void) loadDefaultSettings { + NSString *settingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"]; if(!settingsBundle) { NSLog(@"Could not find Settings.bundle"); return; } - + NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[settingsBundle stringByAppendingPathComponent:@"Root.plist"]]; NSArray *preferences = [settings objectForKey:@"PreferenceSpecifiers"]; - + NSMutableDictionary *defaultsToRegister = [[NSMutableDictionary alloc] initWithCapacity:[preferences count]]; for(NSDictionary *prefSpecification in preferences) { NSString *key = [prefSpecification objectForKey:@"Key"]; @@ -61,26 +61,15 @@ [defaultsToRegister setObject:[prefSpecification objectForKey:@"DefaultValue"] forKey:key]; } } - + + NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: + @"NO", @"enable_first_login_view_preference", // + nil]; + + [defaultsToRegister addEntriesFromDictionary:appDefaults]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultsToRegister]; [defaultsToRegister release]; -} - -- (void) loadDefaultSettings { - - // if this is the first launch after installing, we would like to load default settings values from Settings.bundle - NSObject *somePrefVal = [[NSUserDefaults standardUserDefaults] objectForKey:@"debugenable_preference"]; - if(!somePrefVal) { - // has no value, so defaults have not been loaded yet - [self registerDefaultsFromSettingsBundle]; - } - - NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: - @"NO", @"enable_first_login_view_preference", // - nil]; - - [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - [[NSUserDefaults standardUserDefaults] synchronize]; + [[NSUserDefaults standardUserDefaults] synchronize]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ diff --git a/Classes/LinphoneUI/LinphoneManager.m b/Classes/LinphoneUI/LinphoneManager.m index b87078e3c..f78ef8daa 100644 --- a/Classes/LinphoneUI/LinphoneManager.m +++ b/Classes/LinphoneUI/LinphoneManager.m @@ -401,8 +401,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach proxyReachability=SCNetworkReachabilityCreateWithName(nil, linphone_address_get_domain(addr)); } else { - if (configCheckDisable == false - && (!domain && !username)) { + if (configCheckDisable == false ) { UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"It seems you have not configured any proxy server from settings" delegate:self