Add userinfo in user call data

Fix fr translation
This commit is contained in:
Yann Diorcet 2012-10-01 11:43:52 +02:00
parent 7db406cdb6
commit 0126d4c672
7 changed files with 26 additions and 34 deletions

View file

@ -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;

View file

@ -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];

View file

@ -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:

View file

@ -67,6 +67,7 @@ struct NetworkReachabilityContext {
typedef struct _LinphoneCallAppData {
bool_t batteryWarningShown;
UILocalNotification *notification;
NSMutableDictionary *userInfos;
} LinphoneCallAppData;
typedef struct _LinphoneManagerSounds {

View file

@ -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);
}

View file

@ -12836,7 +12836,7 @@ La cause était: %2$@</string>
<key>en</key>
<string>Direct connection</string>
<key>fr</key>
<string>Connexion direct</string>
<string>Connexion directe</string>
</dict>
<key>snapshots</key>
<dict/>