From 0126d4c672b68303b199341bbf9a1eefc0ee95a5 Mon Sep 17 00:00:00 2001 From: Yann Diorcet Date: Mon, 1 Oct 2012 11:43:52 +0200 Subject: [PATCH] Add userinfo in user call data Fix fr translation --- Classes/InCallTableViewController.h | 4 --- Classes/InCallTableViewController.m | 40 +++++++++++++------------ Classes/InCallViewController.m | 9 +----- Classes/LinphoneManager.h | 1 + Classes/LinphoneManager.m | 4 +-- Resources/fr.lproj/Localizable.strings | Bin 17996 -> 17998 bytes linphone.ldb/Contents.plist | 2 +- 7 files changed, 26 insertions(+), 34 deletions(-) diff --git a/Classes/InCallTableViewController.h b/Classes/InCallTableViewController.h index 99abc4d60..e1dcd6d30 100644 --- a/Classes/InCallTableViewController.h +++ b/Classes/InCallTableViewController.h @@ -25,13 +25,9 @@ @interface InCallTableViewController : UITableViewController { @private - NSMutableDictionary* callCellData; NSTimer *updateTime; } -- (void)removeCallData:(LinphoneCall*) call; -- (UICallCellData*)addCallData:(LinphoneCall*) call; -- (UICallCellData*)getCallData:(LinphoneCall*) call; - (void)minimizeAll; - (void)maximizeAll; diff --git a/Classes/InCallTableViewController.m b/Classes/InCallTableViewController.m index 2e2798824..8a5a009ba 100644 --- a/Classes/InCallTableViewController.m +++ b/Classes/InCallTableViewController.m @@ -23,9 +23,10 @@ #import "LinphoneManager.h" - @implementation InCallTableViewController +static NSString *const kLinphoneInCallCellData = @"LinphoneInCallCellData"; + enum TableSection { ConferenceSection = 0, CallSection = 1 @@ -34,7 +35,6 @@ enum TableSection { #pragma mark - Lifecycle Functions - (void)initInCallTableViewController { - callCellData = [[NSMutableDictionary alloc] init]; } - (id)init{ @@ -62,8 +62,6 @@ enum TableSection { } - (void)dealloc { - [callCellData removeAllObjects]; - [callCellData release]; [super dealloc]; } @@ -134,10 +132,9 @@ enum TableSection { - (void)removeCallData:(LinphoneCall*) call { // Remove data associated with the call if(call != NULL) { - NSValue *value = [NSValue valueWithPointer:call]; - UICallCellData * data = [callCellData objectForKey:value]; - if(data == nil) { - [callCellData removeObjectForKey:value]; + LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call); + if(appData != NULL) { + [appData->userInfos removeObjectForKey:kLinphoneInCallCellData]; } } } @@ -146,11 +143,10 @@ enum TableSection { // Handle data associated with the call UICallCellData * data = nil; if(call != NULL) { - NSValue *value = [NSValue valueWithPointer:call]; - data = [callCellData objectForKey:value]; - if(data == nil) { + LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call); + if(appData != NULL) { data = [[UICallCellData alloc] init:call]; - [callCellData setObject:data forKey:value]; + [appData->userInfos setObject:data forKey:kLinphoneInCallCellData]; } } return data; @@ -160,8 +156,10 @@ enum TableSection { // Handle data associated with the call UICallCellData * data = nil; if(call != NULL) { - NSValue *value = [NSValue valueWithPointer:call]; - data = [callCellData objectForKey:value]; + LinphoneCallAppData* appData = (LinphoneCallAppData*) linphone_call_get_user_pointer(call); + if(appData != NULL) { + data = [appData->userInfos objectForKey:kLinphoneInCallCellData]; + } } return data; } @@ -178,17 +176,21 @@ enum TableSection { } - (void)minimizeAll { - for(id key in callCellData) { - UICallCellData *data = [callCellData objectForKey:key]; + const MSList *list = linphone_core_get_calls([LinphoneManager getLc]); + while(list != NULL) { + UICallCellData *data = [self getCallData:(LinphoneCall*)list->data]; data->minimize = true; + list = list->next; } [[self tableView] reloadData]; } - (void)maximizeAll { - for(id key in callCellData) { - UICallCellData *data = [callCellData objectForKey:key]; + const MSList *list = linphone_core_get_calls([LinphoneManager getLc]); + while(list != NULL) { + UICallCellData *data = [self getCallData:(LinphoneCall*)list->data]; data->minimize = false; + list = list->next; } [[self tableView] reloadData]; } @@ -308,7 +310,7 @@ enum TableSection { - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { bool inConference = indexPath.section == ConferenceSection; LinphoneCall* call = [InCallTableViewController retrieveCallAtIndex:indexPath.row inConference:inConference]; - UICallCellData* data = [callCellData objectForKey:[NSValue valueWithPointer:call]]; + UICallCellData* data = [self getCallData:call]; if(data != nil &&data->minimize) return [UICallCell getMinimizedHeight]; return [UICallCell getMaximizedHeight]; diff --git a/Classes/InCallViewController.m b/Classes/InCallViewController.m index 07b123d72..f37166c28 100644 --- a/Classes/InCallViewController.m +++ b/Classes/InCallViewController.m @@ -234,14 +234,7 @@ static UICompositeViewDescription *compositeDescription = nil; if(call == NULL) { return; } - - // Handle data associated with the call - if(state == LinphoneCallReleased) { - [callTableController removeCallData: call]; - } else { - [callTableController addCallData: call]; - } - + switch (state) { case LinphoneCallIncomingReceived: case LinphoneCallOutgoingInit: diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 7ba9318ce..e31492bd9 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -67,6 +67,7 @@ struct NetworkReachabilityContext { typedef struct _LinphoneCallAppData { bool_t batteryWarningShown; UILocalNotification *notification; + NSMutableDictionary *userInfos; } LinphoneCallAppData; typedef struct _LinphoneManagerSounds { diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index eda755873..ce5a14580 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -47,7 +47,7 @@ static LinphoneManager* theLinphoneManager = nil; const char *const LINPHONERC_APPLICATION_KEY = "app"; -NSString *const kLinphoneCoreUpdate = @"kLinphoneCoreUpdate"; +NSString *const kLinphoneCoreUpdate = @"LinphoneCoreUpdate"; NSString *const kLinphoneDisplayStatusUpdate = @"LinphoneDisplayStatusUpdate"; NSString *const kLinphoneTextReceived = @"LinphoneTextReceived"; NSString *const kLinphoneCallUpdate = @"LinphoneCallUpdate"; @@ -376,12 +376,12 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char free (linphone_call_get_user_pointer(call)); linphone_call_set_user_pointer(call, NULL); } - return; } if (!linphone_call_get_user_pointer(call)) { LinphoneCallAppData* data = (LinphoneCallAppData*) malloc(sizeof(LinphoneCallAppData)); data->batteryWarningShown = FALSE; data->notification = nil; + data->userInfos = [[NSMutableDictionary alloc] init]; linphone_call_set_user_pointer(call, data); } diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings index 196affc93153b24f284602f3317e7df0b8304645..1e1d8e52d9f4feb25f7f499796271ea188152641 100644 GIT binary patch delta 18 acmX@p!+5TTaYK&y en Direct connection fr - Connexion direct + Connexion directe snapshots