From bbea0544cc45a515efcfcebd5e2695efb00eba88 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 4 Feb 2011 14:54:24 +0100 Subject: [PATCH] add default settings --- Classes/FirstLoginViewController.h | 4 ++-- Classes/FirstLoginViewController.m | 6 +++--- Classes/PhoneViewController.m | 2 +- Classes/linphoneAppDelegate.m | 13 +++++++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Classes/FirstLoginViewController.h b/Classes/FirstLoginViewController.h index 97b27cf68..e528c5c52 100644 --- a/Classes/FirstLoginViewController.h +++ b/Classes/FirstLoginViewController.h @@ -1,6 +1,6 @@ -/* IncallViewController.h +/* FirstLoginViewController.h * - * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * Copyright (C) 2011 Belledonne Comunications, Grenoble, France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/Classes/FirstLoginViewController.m b/Classes/FirstLoginViewController.m index e1ca0a50a..519dbc5e2 100644 --- a/Classes/FirstLoginViewController.m +++ b/Classes/FirstLoginViewController.m @@ -1,6 +1,6 @@ -/* IncallViewController.h +/* FirstLoginViewController.m * - * Copyright (C) 2009 Belledonne Comunications, Grenoble, France + * Copyright (C) 2011 Belledonne Comunications, Grenoble, France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,7 +79,7 @@ } -(void) displayRegisteredFromUI:(UIViewController*) viewCtrl forUser:(NSString*) username withDisplayName:(NSString*) displayName onDomain:(NSString*)domain { - [[NSUserDefaults standardUserDefaults] setBool:true forKey:@"enable_first_login_view_preference"]; + [[NSUserDefaults standardUserDefaults] setBool:false forKey:@"enable_first_login_view_preference"]; [self.parentViewController dismissModalViewControllerAnimated:true]; [self.activityIndicator setHidden:true]; [[LinphoneManager instance] setRegistrationDelegate:nil]; diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 6794ab5fd..ef9b23dd2 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -82,7 +82,7 @@ - (void)viewDidAppear:(BOOL)animated { [[UIApplication sharedApplication] setIdleTimerDisabled:true]; [mute reset]; - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"enable_first_login_view_preference"] == false) { + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"enable_first_login_view_preference"] == true) { myFirstLoginViewController = [[FirstLoginViewController alloc] initWithNibName:@"FirstLoginViewController" bundle:[NSBundle mainBundle]]; [[LinphoneManager instance] setRegistrationDelegate:myFirstLoginViewController]; diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index fd05da6c5..60b6a3983 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -43,8 +43,21 @@ [[LinphoneManager instance] becomeActive]; } +- (void) loadDefaultSettings { + NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: + @"NO", @"enable_first_login_view_preference", // + nil]; + + [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; + [[NSUserDefaults standardUserDefaults] synchronize]; + +} - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ + /* + *Custumization + */ + [self loadDefaultSettings]; //as defined in PhoneMainView.xib //dialer myPhoneViewController = (PhoneViewController*) [myTabBarController.viewControllers objectAtIndex: DIALER_TAB_INDEX];