diff --git a/Classes/ContactsTableViewController.m b/Classes/ContactsTableViewController.m index acf33fe4d..32afdc3c7 100644 --- a/Classes/ContactsTableViewController.m +++ b/Classes/ContactsTableViewController.m @@ -56,9 +56,7 @@ - (void)dealloc { ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self); CFRelease(addressBook); - [addressBookMap removeAllObjects]; [addressBookMap release]; - [avatarMap removeAllObjects]; [avatarMap release]; [super dealloc]; } @@ -72,7 +70,6 @@ // Reset Address book [addressBookMap removeAllObjects]; - [avatarMap removeAllObjects]; NSArray *lContacts = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); for (id lPerson in lContacts) { @@ -142,6 +139,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef info, void *context) { ContactsTableViewController* controller = (ContactsTableViewController*)context; ABAddressBookRevert(addressBook); + [controller->avatarMap removeAllObjects]; [controller loadData]; } diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index dfade8c38..b8bd661da 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -220,6 +220,11 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - UITextFieldDelegate Functions +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + //[textField performSelector:@selector() withObject:nil afterDelay:0]; + return YES; +} + - (BOOL)textFieldShouldReturn:(UITextField *)textField { if (textField == addressField) { [addressField resignFirstResponder]; diff --git a/Classes/DialerViewController.xib b/Classes/DialerViewController.xib index 457b7ea95..f413d2b00 100644 --- a/Classes/DialerViewController.xib +++ b/Classes/DialerViewController.xib @@ -606,7 +606,6 @@ {{214, 0}, {106, 69}} - _NS:9 NO IBCocoaTouchFramework diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index 3f64fd224..95109499c 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -175,7 +175,7 @@ static UICompositeViewDescription *compositeDescription = nil; UITapGestureRecognizer* singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControls:)]; [singleFingerTap setNumberOfTapsRequired:1]; [singleFingerTap setCancelsTouchesInView: FALSE]; - [[[UIApplication sharedApplication].delegate window] addGestureRecognizer:singleFingerTap]; + [[PhoneMainView instance].view addGestureRecognizer:singleFingerTap]; [singleFingerTap release]; videoZoomHandler = [[VideoZoomHandler alloc] init]; @@ -535,7 +535,7 @@ static void hideSpinner(LinphoneCall* call, void* user_data) { otherButtonTitles:nil]; visibleActionSheet.actionSheetStyle = UIActionSheetStyleDefault; - [visibleActionSheet showInView:[[UIApplication sharedApplication].delegate window]]; + [visibleActionSheet showInView:[PhoneMainView instance].view]; /* start cancel timer */ cd.timeout = [NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(dismissActionSheet:) userInfo:nil repeats:NO]; diff --git a/Classes/LinphoneApp.xib b/Classes/LinphoneApp.xib index d2f9903f2..a6ba1dc38 100644 --- a/Classes/LinphoneApp.xib +++ b/Classes/LinphoneApp.xib @@ -2,19 +2,19 @@ 1296 - 11E53 - 2549 - 1138.47 - 569.00 + 11D50 + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 1498 + 1181 - IBProxyObject + IBUIWindow IBUICustomObject IBUIViewController - IBUIWindow + IBProxyObject com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -83,14 +83,6 @@ 10 - - - window - - - - 12 - @@ -104,6 +96,7 @@ 2 + LinphoneWindow -1 @@ -154,17 +147,6 @@ LinphoneAppDelegate NSObject - - window - UIWindow - - - window - - window - UIWindow - - IBProjectSource ./Classes/LinphoneAppDelegate.h @@ -256,6 +238,6 @@ YES 3 - 1498 + 1181 diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index bc83e5280..2983bccb0 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -33,7 +33,6 @@ BOOL started; } -@property (nonatomic, retain) IBOutlet UIWindow *window; @property (assign) BOOL started; @end diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 0e8e05b5d..39f2a343c 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -43,7 +43,6 @@ int __aeabi_idiv(int a, int b) { @implementation LinphoneAppDelegate -@synthesize window; @synthesize started; @@ -58,7 +57,6 @@ int __aeabi_idiv(int a, int b) { } - (void)dealloc { - [window release]; [super dealloc]; } @@ -85,6 +83,7 @@ int __aeabi_idiv(int a, int b) { } - (void)applicationWillResignActive:(UIApplication *)application { + if(![LinphoneManager isLcReady]) return; LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); if (call == NULL) diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 429a50a05..5d4f6d970 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -76,7 +76,10 @@ typedef struct _LinphoneCallAppData { @public CallContext currentCallContextBeforeGoingBackground; } -+ (LinphoneManager*) instance; ++ (LinphoneManager*)instance; +#ifdef DEBUG ++ (void)instanceRelease; +#endif + (LinphoneCore*) getLc; + (BOOL)isLcReady; + (BOOL)runningOnIpad; @@ -90,7 +93,7 @@ typedef struct _LinphoneCallAppData { - (BOOL)resignActive; - (void)becomeActive; -- (void)kickOffNetworkConnection; ++ (void)kickOffNetworkConnection; - (void)setupNetworkReachabilityCallback; - (void)refreshRegisters; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index ef6428797..56fbfadfb 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -159,6 +159,14 @@ struct codec_name_pref_table codec_pref_table[]={ return theLinphoneManager; } +#ifdef DEBUG ++ (void)instanceRelease { + if(theLinphoneManager != nil) { + [theLinphoneManager release]; + theLinphoneManager = nil; + } +} +#endif #pragma mark - Lifecycle Functions @@ -420,18 +428,17 @@ static void linphone_iphone_text_received(LinphoneCore *lc, LinphoneChatRoom *ro #pragma mark - Network Functions -- (void)kickOffNetworkConnection { ++ (void)kickOffNetworkConnection { /*start a new thread to avoid blocking the main ui in case of peer host failure*/ - [NSThread detachNewThreadSelector:@selector(runNetworkConnection) toTarget:self withObject:nil]; -} - -- (void)runNetworkConnection { - CFWriteStreamRef writeStream; - CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"192.168.0.200"/*"linphone.org"*/, 15000, nil, &writeStream); - CFWriteStreamOpen (writeStream); - const char* buff="hello"; - CFWriteStreamWrite (writeStream,(const UInt8*)buff,strlen(buff)); - CFWriteStreamClose (writeStream); + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + CFWriteStreamRef writeStream; + CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"192.168.0.200"/*"linphone.org"*/, 15000, nil, &writeStream); + CFWriteStreamOpen (writeStream); + const char* buff="hello"; + CFWriteStreamWrite (writeStream,(const UInt8*)buff,strlen(buff)); + CFWriteStreamClose (writeStream); + CFRelease(writeStream); + }); } static void showNetworkFlags(SCNetworkReachabilityFlags flags){ @@ -468,7 +475,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach if ((flags == 0) || (flags & networkDownFlags)) { linphone_core_set_network_reachable([LinphoneManager getLc],false); lLinphoneMgr.connectivity = none; - [[LinphoneManager instance] kickOffNetworkConnection]; + [LinphoneManager kickOffNetworkConnection]; } else { Connectivity newConnectivity; BOOL isWifiOnly = lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]),"app","wifi_only_preference",FALSE); @@ -689,6 +696,10 @@ static LinphoneCoreVTable linphonec_vtable = { [mIterateTimer invalidate]; AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setDelegate:nil]; + if (settingsStore != nil) { + [settingsStore release]; + settingsStore = nil; + } if (theLinphoneCore != nil) { //just in case application terminate before linphone core initialization [LinphoneLogger logc:LinphoneLoggerLog format:"Destroy linphonecore"]; linphone_core_destroy(theLinphoneCore); @@ -732,7 +743,7 @@ static LinphoneCoreVTable linphonec_vtable = { return; } //kick up network cnx, just in case - [self kickOffNetworkConnection]; + [LinphoneManager kickOffNetworkConnection]; [self refreshRegisters]; linphone_core_iterate(theLinphoneCore); } diff --git a/Classes/LinphoneUI/UICompositeViewController.h b/Classes/LinphoneUI/UICompositeViewController.h index 98e59a478..8a64479d3 100644 --- a/Classes/LinphoneUI/UICompositeViewController.h +++ b/Classes/LinphoneUI/UICompositeViewController.h @@ -66,11 +66,8 @@ @interface UICompositeViewController : TPMultiLayoutViewController { @private UIView *stateBarView; - UIViewController *stateBarViewController; UIView *contentView; - UIViewController *contentViewController; UIView *tabBarView; - UIViewController *tabBarViewController; NSMutableDictionary *viewControllerCache; @@ -91,5 +88,8 @@ - (void)setToolBarHidden:(BOOL) hidden; - (UIViewController *)getCurrentViewController; - (UIInterfaceOrientation)currentOrientation; +#ifdef DEBUG +- (void)clearCache; +#endif @end diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m index 2a28ad1a8..e81aca9be 100644 --- a/Classes/LinphoneUI/UICompositeViewController.m +++ b/Classes/LinphoneUI/UICompositeViewController.m @@ -78,6 +78,13 @@ [super dealloc]; } +@end +@interface UICompositeViewController () + +@property (nonatomic, retain) UIViewController *stateBarViewController; +@property (nonatomic, retain) UIViewController *tabBarViewController; +@property (nonatomic, retain) UIViewController *contentViewController; + @end @implementation UICompositeViewController @@ -85,6 +92,9 @@ @synthesize stateBarView; @synthesize contentView; @synthesize tabBarView; +@synthesize tabBarViewController = _tabBarViewController; +@synthesize stateBarViewController = _stateBarViewController; +@synthesize contentViewController = _contentViewController; @synthesize viewTransition; @@ -123,16 +133,36 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; + [self.stateBarViewController release]; + [self.tabBarViewController release]; + [self.contentViewController release]; + [contentView release]; [stateBarView release]; [tabBarView release]; - [viewControllerCache removeAllObjects]; + [viewControllerCache release]; + [viewTransition release]; [currentViewDescription release]; [super dealloc]; } +#pragma mark - Property Functions + +- (UIViewController*)stateBarViewController { + return _stateBarViewController; +} + +- (UIViewController*)contentViewController { + return _contentViewController; +} + +- (UIViewController*)tabBarViewController { + return _tabBarViewController; +} + + #pragma mark - ViewController Functions - (void)viewDidLoad { @@ -147,56 +177,56 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - [contentViewController viewWillAppear:animated]; - [tabBarViewController viewWillAppear:animated]; - [stateBarViewController viewWillAppear:animated]; + [self.contentViewController viewWillAppear:animated]; + [self.tabBarViewController viewWillAppear:animated]; + [self.stateBarViewController viewWillAppear:animated]; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - [contentViewController viewDidAppear:animated]; - [tabBarViewController viewDidAppear:animated]; - [stateBarViewController viewDidAppear:animated]; + [self.contentViewController viewDidAppear:animated]; + [self.tabBarViewController viewDidAppear:animated]; + [self.stateBarViewController viewDidAppear:animated]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - [contentViewController viewWillDisappear:animated]; - [tabBarViewController viewWillDisappear:animated]; - [stateBarViewController viewWillDisappear:animated]; + [self.contentViewController viewWillDisappear:animated]; + [self.tabBarViewController viewWillDisappear:animated]; + [self.stateBarViewController viewWillDisappear:animated]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; - [contentViewController viewDidDisappear:animated]; - [tabBarViewController viewDidDisappear:animated]; - [stateBarViewController viewDidDisappear:animated]; + [self.contentViewController viewDidDisappear:animated]; + [self.tabBarViewController viewDidDisappear:animated]; + [self.stateBarViewController viewDidDisappear:animated]; } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { currentOrientation = [self getCorrectInterfaceOrientation:toInterfaceOrientation]; [super willRotateToInterfaceOrientation:currentOrientation duration:duration]; - [contentViewController willRotateToInterfaceOrientation:currentOrientation duration:duration]; - [tabBarViewController willRotateToInterfaceOrientation:currentOrientation duration:duration]; - [stateBarViewController willRotateToInterfaceOrientation:currentOrientation duration:duration]; + [self.contentViewController willRotateToInterfaceOrientation:currentOrientation duration:duration]; + [self.tabBarViewController willRotateToInterfaceOrientation:currentOrientation duration:duration]; + [self.stateBarViewController willRotateToInterfaceOrientation:currentOrientation duration:duration]; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [super willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; - [contentViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; - [tabBarViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; - [stateBarViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; + [self.contentViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; + [self.tabBarViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; + [self.stateBarViewController willAnimateRotationToInterfaceOrientation:currentOrientation duration:duration]; [self update:nil tabBar:nil stateBar:nil fullscreen:nil]; } - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - [contentViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - [tabBarViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - [stateBarViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + [self.contentViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + [self.tabBarViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + [self.stateBarViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { @@ -218,6 +248,10 @@ #pragma mark - +- (void)clearCache { + [viewControllerCache removeAllObjects]; +} + - (UIInterfaceOrientation)currentOrientation { return currentOrientation; } @@ -251,7 +285,7 @@ if(name != nil) { controller = [viewControllerCache objectForKey:name]; if(controller == nil) { - controller = [[NSClassFromString(name) alloc] init]; + controller = [[[NSClassFromString(name) alloc] init] autorelease]; [viewControllerCache setValue:controller forKey:name]; [controller view]; // Load the view } @@ -327,26 +361,29 @@ [super willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; [super didRotateFromInterfaceOrientation:orientation]; - orientation = contentViewController.interfaceOrientation; - [contentViewController willRotateToInterfaceOrientation:correctOrientation duration:0]; - [contentViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; - [contentViewController didRotateFromInterfaceOrientation:orientation]; + orientation = self.contentViewController.interfaceOrientation; + [self.contentViewController willRotateToInterfaceOrientation:correctOrientation duration:0]; + [self.contentViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; + [self.contentViewController didRotateFromInterfaceOrientation:orientation]; - orientation = tabBarViewController.interfaceOrientation; - [tabBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0]; - [tabBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; - [tabBarViewController didRotateFromInterfaceOrientation:orientation]; + orientation = self.tabBarViewController.interfaceOrientation; + [self.tabBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0]; + [self.tabBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; + [self.tabBarViewController didRotateFromInterfaceOrientation:orientation]; - orientation = stateBarViewController.interfaceOrientation; - [stateBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0]; - [stateBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; - [stateBarViewController didRotateFromInterfaceOrientation:orientation]; + orientation = self.stateBarViewController.interfaceOrientation; + [self.stateBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0]; + [self.stateBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0]; + [self.stateBarViewController didRotateFromInterfaceOrientation:orientation]; } #define IPHONE_STATUSBAR_HEIGHT 20 - (void)update: (UICompositeViewDescription*) description tabBar:(NSNumber*)tabBar stateBar:(NSNumber*)stateBar fullscreen:(NSNumber*)fullscreen { + UIViewController *oldContentViewController = self.contentViewController; + UIViewController *oldStateBarViewController = self.stateBarViewController; + UIViewController *oldTabBarViewController = self.tabBarViewController; // Copy view description UICompositeViewDescription *oldViewDescription = nil; @@ -369,18 +406,22 @@ [tabBarView.layer addAnimation:viewTransition forKey:@"transition"]; } } - - [UICompositeViewController removeSubView: contentViewController]; - if(oldViewDescription != nil && tabBarViewController != nil && oldViewDescription.tabBar != currentViewDescription.tabBar) { - [UICompositeViewController removeSubView: tabBarViewController]; - } - if(oldViewDescription != nil && stateBarViewController != nil && oldViewDescription.stateBar != currentViewDescription.stateBar) { - [UICompositeViewController removeSubView: stateBarViewController]; - } - stateBarViewController = [self getCachedController:description.stateBar]; - contentViewController = [self getCachedController:description.content]; - tabBarViewController = [self getCachedController:description.tabBar]; + UIViewController *newContentViewController = [self getCachedController:description.content]; + UIViewController *newStateBarViewController = [self getCachedController:description.stateBar]; + UIViewController *newTabBarViewController = [self getCachedController:description.tabBar]; + + [UICompositeViewController removeSubView: oldContentViewController]; + if(oldTabBarViewController != nil && oldTabBarViewController != newTabBarViewController) { + [UICompositeViewController removeSubView:oldTabBarViewController]; + } + if(oldStateBarViewController != nil && oldStateBarViewController != newStateBarViewController) { + [UICompositeViewController removeSubView:oldStateBarViewController]; + } + + self.stateBarViewController = newStateBarViewController; + self.contentViewController = newContentViewController; + self.tabBarViewController = newTabBarViewController; // Update rotation UIInterfaceOrientation correctOrientation = [self getCorrectInterfaceOrientation:[[UIDevice currentDevice] orientation]]; @@ -441,7 +482,7 @@ if(currentViewDescription.fullscreen) origin = 0; - if(stateBarViewController != nil && currentViewDescription.stateBarEnabled) { + if(self.stateBarViewController != nil && currentViewDescription.stateBarEnabled) { contentFrame.origin.y = origin + stateBarFrame.size.height; stateBarFrame.origin.y = origin; } else { @@ -451,15 +492,15 @@ // Resize TabBar CGRect tabFrame = tabBarView.frame; - if(tabBarViewController != nil && currentViewDescription.tabBarEnabled) { + if(self.tabBarViewController != nil && currentViewDescription.tabBarEnabled) { tabFrame.origin.y = viewFrame.size.height; tabFrame.origin.x = viewFrame.size.width; - tabFrame.size.height = tabBarViewController.view.frame.size.height; - tabFrame.size.width = tabBarViewController.view.frame.size.width; + tabFrame.size.height = self.tabBarViewController.view.frame.size.height; + tabFrame.size.width = self.tabBarViewController.view.frame.size.width; tabFrame.origin.y -= tabFrame.size.height; tabFrame.origin.x -= tabFrame.size.width; contentFrame.size.height = tabFrame.origin.y - contentFrame.origin.y; - for (UIView *view in tabBarViewController.view.subviews) { + for (UIView *view in self.tabBarViewController.view.subviews) { if(view.tag == -1) { contentFrame.size.height += view.frame.origin.y; break; @@ -477,15 +518,15 @@ // Set frames [contentView setFrame: contentFrame]; - [contentViewController.view setFrame: [contentView bounds]]; + [self.contentViewController.view setFrame: [contentView bounds]]; [tabBarView setFrame: tabFrame]; - CGRect frame = [tabBarViewController.view frame]; + CGRect frame = [self.tabBarViewController.view frame]; frame.size.width = [tabBarView bounds].size.width; - [tabBarViewController.view setFrame:frame]; + [self.tabBarViewController.view setFrame:frame]; [stateBarView setFrame: stateBarFrame]; - frame = [stateBarViewController.view frame]; + frame = [self.stateBarViewController.view frame]; frame.size.width = [stateBarView bounds].size.width; - [stateBarViewController.view setFrame:frame]; + [self.stateBarViewController.view setFrame:frame]; // Commit animation if(tabBar != nil || stateBar != nil || fullscreen != nil) { @@ -494,12 +535,12 @@ // Change view if(description != nil) { - [UICompositeViewController addSubView: contentViewController view:contentView]; - if(oldViewDescription == nil || oldViewDescription.tabBar != currentViewDescription.tabBar) { - [UICompositeViewController addSubView: tabBarViewController view:tabBarView]; + [UICompositeViewController addSubView: self.contentViewController view:contentView]; + if(oldTabBarViewController == nil || oldTabBarViewController != self.tabBarViewController) { + [UICompositeViewController addSubView: self.tabBarViewController view:tabBarView]; } - if(oldViewDescription == nil || oldViewDescription.stateBar != currentViewDescription.stateBar) { - [UICompositeViewController addSubView: stateBarViewController view:stateBarView]; + if(oldStateBarViewController == nil || oldStateBarViewController != self.stateBarViewController) { + [UICompositeViewController addSubView: self.stateBarViewController view:stateBarView]; } } @@ -527,7 +568,7 @@ } - (UIViewController *) getCurrentViewController { - return contentViewController; + return [[self.contentViewController retain] autorelease]; } @end diff --git a/Classes/LinphoneUI/UILongTouchButton.m b/Classes/LinphoneUI/UILongTouchButton.m index 012b2ef0e..c4f1b0a21 100644 --- a/Classes/LinphoneUI/UILongTouchButton.m +++ b/Classes/LinphoneUI/UILongTouchButton.m @@ -54,6 +54,12 @@ return self; } +- (void)dealloc { + [self removeTarget:self action:@selector(___touchDown:) forControlEvents:UIControlEventTouchDown]; + [self removeTarget:self action:@selector(___touchUp:) forControlEvents:UIControlEventTouchUpInside|UIControlEventTouchUpOutside]; + [super dealloc]; +} + - (void)___touchDown:(id) sender { [self performSelector:@selector(doLongTouch) withObject:nil afterDelay:0.5]; } diff --git a/Classes/LinphoneUI/UIMainBar.m b/Classes/LinphoneUI/UIMainBar.m index e32cd2ea8..764091d59 100644 --- a/Classes/LinphoneUI/UIMainBar.m +++ b/Classes/LinphoneUI/UIMainBar.m @@ -342,27 +342,27 @@ #pragma mark - Action Functions -- (IBAction)onHistoryClick: (id) sender { +- (IBAction)onHistoryClick:(id)event { [[PhoneMainView instance] changeCurrentView:[HistoryViewController compositeViewDescription]]; } -- (IBAction)onContactsClick: (id) event { +- (IBAction)onContactsClick:(id)event { [ContactSelection setSelectionMode:ContactSelectionModeNone]; [ContactSelection setAddAddress:nil]; [ContactSelection setSipFilter:FALSE]; [[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]]; } -- (IBAction)onDialerClick: (id) event { +- (IBAction)onDialerClick:(id)event { [[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]]; } -- (IBAction)onSettingsClick: (id) event { +- (IBAction)onSettingsClick:(id)event { [[PhoneMainView instance] changeCurrentView:[SettingsViewController compositeViewDescription]]; } /* MODIFICATION Remove chat -- (IBAction)onChatClick: (id) event { +- (IBAction)onChatClick:(id)event { [[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]]; } */ diff --git a/Classes/LinphoneUI/UIStateBar.m b/Classes/LinphoneUI/UIStateBar.m index 45914a3b9..af07b4f2e 100644 --- a/Classes/LinphoneUI/UIStateBar.m +++ b/Classes/LinphoneUI/UIStateBar.m @@ -161,7 +161,7 @@ NSTimer *callSecurityTimer; break; case LinphoneRegistrationNone: registrationStateImage.hidden = NO; - image =[UIImage imageNamed:@"led_disconnected.png"]; + image = [UIImage imageNamed:@"led_disconnected.png"]; break; case LinphoneRegistrationProgress: registrationStateImage.hidden = NO; diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m index 710e108d0..b0e4019b9 100644 --- a/Classes/SettingsViewController.m +++ b/Classes/SettingsViewController.m @@ -19,6 +19,7 @@ #import "SettingsViewController.h" #import "LinphoneManager.h" +#import "PhoneMainView.h" #import "UILinphone.h" #import "UACellBackgroundView.h" @@ -348,6 +349,8 @@ - (void)dealloc { // Remove all observer [[NSNotificationCenter defaultCenter] removeObserver:self]; + [settingsController release]; + [navigationController release]; [super dealloc]; } @@ -453,6 +456,7 @@ static UICompositeViewDescription *compositeDescription = nil; #ifndef DEBUG [hiddenKeys addObject:@"release_button"]; + [hiddenKeys addObject:@"clear_cache_button"]; #endif [hiddenKeys addObject:@"quit_button"]; // Hide for the moment @@ -499,6 +503,12 @@ static UICompositeViewDescription *compositeDescription = nil; NSString *key = [specifier.specifierDict objectForKey:kIASKKey]; #ifdef DEBUG if([key isEqual:@"release_button"]) { + [[UIApplication sharedApplication].keyWindow.rootViewController release]; + [[UIApplication sharedApplication].keyWindow setRootViewController:nil]; + [[LinphoneManager instance] destroyLibLinphone]; + [LinphoneManager instanceRelease]; + } else if([key isEqual:@"clear_cache_button"]) { + [[PhoneMainView instance].mainViewController clearCache]; } #endif } diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 04ff318d5..7065ebd2d 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -172,6 +172,7 @@ void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef info, void - (void)dealloc { ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self); CFRelease(addressBook); + [addressBookMap release]; [super dealloc]; } diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist index ebddc44c5..0d496d742 100644 --- a/Settings/InAppSettings.bundle/Root.plist +++ b/Settings/InAppSettings.bundle/Root.plist @@ -184,6 +184,14 @@ Type IASKButtonSpecifier + + Key + clear_cache_button + Title + Clear cache + Type + IASKButtonSpecifier + StringsTable Root diff --git a/submodules/linphone b/submodules/linphone index e93d9096f..c97efee37 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit e93d9096ff433d3195c177e4c767881406e71d88 +Subproject commit c97efee37aea1ccae3c476a108e988e47f38faa4