mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Fix Call cell pause button state
Fix CompositeView rotation
This commit is contained in:
parent
18103091cd
commit
1139019cf8
4 changed files with 85 additions and 85 deletions
|
|
@ -182,7 +182,9 @@ enum TableSection {
|
|||
const MSList *list = linphone_core_get_calls([LinphoneManager getLc]);
|
||||
while(list != NULL) {
|
||||
UICallCellData *data = [self getCallData:(LinphoneCall*)list->data];
|
||||
data->minimize = true;
|
||||
if(data) {
|
||||
data->minimize = true;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
[[self tableView] reloadData];
|
||||
|
|
@ -192,7 +194,9 @@ enum TableSection {
|
|||
const MSList *list = linphone_core_get_calls([LinphoneManager getLc]);
|
||||
while(list != NULL) {
|
||||
UICallCellData *data = [self getCallData:(LinphoneCall*)list->data];
|
||||
data->minimize = false;
|
||||
if(data) {
|
||||
data->minimize = false;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
[[self tableView] reloadData];
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ typedef enum _UICallCellOtherView {
|
|||
|
||||
- (id)init:(LinphoneCall*) call;
|
||||
|
||||
@property (nonatomic, retain) UIImage *image;
|
||||
@property (nonatomic, retain) NSString *address;
|
||||
|
||||
@end
|
||||
|
||||
@interface UICallCell : UITableViewCell {
|
||||
|
|
|
|||
|
|
@ -20,21 +20,73 @@
|
|||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import "UICallCell.h"
|
||||
|
||||
#import "UILinphone.h"
|
||||
#import "LinphoneManager.h"
|
||||
#import "FastAddressBook.h"
|
||||
|
||||
@implementation UICallCellData
|
||||
|
||||
@synthesize address;
|
||||
@synthesize image;
|
||||
|
||||
- (id)init:(LinphoneCall*) acall {
|
||||
self = [super init];
|
||||
if(self != nil) {
|
||||
self->minimize = false;
|
||||
self->view = UICallCellOtherView_Avatar;
|
||||
self->call = acall;
|
||||
image = [[UIImage imageNamed:@"avatar_unknown.png"] retain];
|
||||
address = [@"Unknown" retain];
|
||||
[self update];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
if(call == NULL) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"];
|
||||
return;
|
||||
}
|
||||
const LinphoneAddress* addr = linphone_call_get_remote_address(call);
|
||||
|
||||
if(addr != NULL) {
|
||||
BOOL useLinphoneAddress = true;
|
||||
// contact name
|
||||
char* lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if(lAddress) {
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
|
||||
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(contact) {
|
||||
useLinphoneAddress = false;
|
||||
self.address = [FastAddressBook getContactDisplayName:contact];
|
||||
UIImage *tmpImage = [FastAddressBook getContactImage:contact thumbnail:false];
|
||||
if(tmpImage != nil) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, (unsigned long)NULL), ^(void) {
|
||||
[tmpImage forceDecompression];
|
||||
self.image = tmpImage;
|
||||
});
|
||||
}
|
||||
}
|
||||
ms_free(lAddress);
|
||||
}
|
||||
if(useLinphoneAddress) {
|
||||
const char* lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char* lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName)
|
||||
self.address = [NSString stringWithUTF8String:lDisplayName];
|
||||
else if(lUserName)
|
||||
self.address = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[address release];
|
||||
[image release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation UICallCell
|
||||
|
|
@ -201,7 +253,6 @@
|
|||
}
|
||||
if(adata != nil) {
|
||||
data = [adata retain];
|
||||
[self updateContact];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -309,53 +360,6 @@
|
|||
|
||||
#pragma mark -
|
||||
|
||||
- (void)updateContact {
|
||||
if(data == nil || data->call == NULL) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"];
|
||||
return;
|
||||
}
|
||||
LinphoneCall *call = data->call;
|
||||
const LinphoneAddress* addr = linphone_call_get_remote_address(call);
|
||||
|
||||
UIImage *image = nil;
|
||||
NSString* address = nil;
|
||||
if(addr != NULL) {
|
||||
BOOL useLinphoneAddress = true;
|
||||
// contact name
|
||||
char* lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if(lAddress) {
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:[NSString stringWithUTF8String:lAddress]];
|
||||
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(contact) {
|
||||
image = [FastAddressBook getContactImage:contact thumbnail:false];
|
||||
address = [FastAddressBook getContactDisplayName:contact];
|
||||
useLinphoneAddress = false;
|
||||
}
|
||||
ms_free(lAddress);
|
||||
}
|
||||
if(useLinphoneAddress) {
|
||||
const char* lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char* lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName)
|
||||
address = [NSString stringWithUTF8String:lDisplayName];
|
||||
else if(lUserName)
|
||||
address = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
|
||||
// Set Image
|
||||
if(image == nil) {
|
||||
image = [UIImage imageNamed:@"avatar_unknown.png"];
|
||||
}
|
||||
[avatarImage setImage:image];
|
||||
|
||||
// Set Address
|
||||
if(address == nil) {
|
||||
address = @"Unknown";
|
||||
}
|
||||
[addressLabel setText:address];
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
if(data == nil || data->call == NULL) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update call cell: null call or data"];
|
||||
|
|
@ -363,6 +367,11 @@
|
|||
}
|
||||
LinphoneCall *call = data->call;
|
||||
|
||||
[pauseButton setType:UIPauseButtonType_Call call:call];
|
||||
|
||||
[addressLabel setText:data.address];
|
||||
[avatarImage setImage:data.image];
|
||||
|
||||
LinphoneCallState state = linphone_call_get_state(call);
|
||||
if(!conferenceCell) {
|
||||
if(state == LinphoneCallOutgoingRinging) {
|
||||
|
|
@ -407,7 +416,6 @@
|
|||
[self setFrame:frame];
|
||||
[otherView setHidden:true];
|
||||
}
|
||||
[pauseButton setType:UIPauseButtonType_Call call:call];
|
||||
|
||||
[self updateStats];
|
||||
|
||||
|
|
|
|||
|
|
@ -384,38 +384,6 @@
|
|||
return UIInterfaceOrientationPortrait;
|
||||
}
|
||||
|
||||
- (void)updateInterfaceOrientation:(UIInterfaceOrientation)correctOrientation {
|
||||
UIInterfaceOrientation orientation;
|
||||
|
||||
orientation = self.interfaceOrientation;
|
||||
if(orientation != correctOrientation) {
|
||||
[super willRotateToInterfaceOrientation:correctOrientation duration:0];
|
||||
[super willAnimateRotationToInterfaceOrientation:correctOrientation duration:0];
|
||||
[super didRotateFromInterfaceOrientation:orientation];
|
||||
}
|
||||
|
||||
orientation = self.contentViewController.interfaceOrientation;
|
||||
if(orientation != correctOrientation) {
|
||||
[self.contentViewController willRotateToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.contentViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.contentViewController didRotateFromInterfaceOrientation:orientation];
|
||||
}
|
||||
|
||||
orientation = self.tabBarViewController.interfaceOrientation;
|
||||
if(orientation != correctOrientation) {
|
||||
[self.tabBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.tabBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.tabBarViewController didRotateFromInterfaceOrientation:orientation];
|
||||
}
|
||||
|
||||
orientation = self.stateBarViewController.interfaceOrientation;
|
||||
if(orientation != correctOrientation) {
|
||||
[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 {
|
||||
|
|
@ -469,7 +437,24 @@
|
|||
if(currentOrientation != correctOrientation) {
|
||||
[PhoneMainView setOrientation:correctOrientation animated:currentOrientation!=UIDeviceOrientationUnknown];
|
||||
} else {
|
||||
[self updateInterfaceOrientation:correctOrientation];
|
||||
if(oldContentViewController != newContentViewController) {
|
||||
UIInterfaceOrientation oldOrientation = self.contentViewController.interfaceOrientation;
|
||||
[self.contentViewController willRotateToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.contentViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.contentViewController didRotateFromInterfaceOrientation:oldOrientation];
|
||||
}
|
||||
if(oldTabBarViewController != newTabBarViewController) {
|
||||
UIInterfaceOrientation oldOrientation = self.tabBarViewController.interfaceOrientation;
|
||||
[self.tabBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.tabBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.tabBarViewController didRotateFromInterfaceOrientation:oldOrientation];
|
||||
}
|
||||
if(oldStateBarViewController != newStateBarViewController) {
|
||||
UIInterfaceOrientation oldOrientation = self.stateBarViewController.interfaceOrientation;
|
||||
[self.stateBarViewController willRotateToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.stateBarViewController willAnimateRotationToInterfaceOrientation:correctOrientation duration:0];
|
||||
[self.stateBarViewController didRotateFromInterfaceOrientation:oldOrientation];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
oldViewDescription = (currentViewDescription != nil)? [currentViewDescription copy]: nil;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue