Merge branch 'new_ui' of git://git.linphone.org/linphone-iphone

Conflicts:
	Classes/LinphoneUI/UICallBar.xib
	Resources/call_state_outgoing_default.png
	Resources/call_state_ringing_default.png
This commit is contained in:
Yann Diorcet 2012-07-19 11:45:06 +02:00
commit c83763a62a
26 changed files with 234 additions and 120 deletions

View file

@ -69,8 +69,8 @@ static UICompositeViewDescription *compositeDescription = nil;
content:@"ChatRoomViewController"
stateBar:nil
stateBarEnabled:false
tabBar:nil
tabBarEnabled:false
tabBar:@"UIMainBar"
tabBarEnabled:true
fullscreen:false];
}
return compositeDescription;
@ -255,7 +255,8 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark - Keyboard Event Functions
- (void)keyboardWillHide:(NSNotification *)notif {
CGRect beginFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
//CGRect beginFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
//CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
UIViewAnimationCurve curve = [[[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue];
NSTimeInterval duration = [[[notif userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView beginAnimations:@"resize" context:nil];
@ -264,9 +265,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[UIView setAnimationBeginsFromCurrentState:TRUE];
// Move view
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect frame = [[self view] frame];
frame.origin.y += endFrame.origin.y - beginFrame.origin.y;
frame.origin.y = 0;
[[self view] setFrame:frame];
// Resize table view
@ -279,7 +279,8 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)keyboardWillShow:(NSNotification *)notif {
CGRect beginFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
//CGRect beginFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
UIViewAnimationCurve curve = [[[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue];
NSTimeInterval duration = [[[notif userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
[UIView beginAnimations:@"resize" context:nil];
@ -288,9 +289,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[UIView setAnimationBeginsFromCurrentState:TRUE];
// Move view
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
CGRect frame = [[self view] frame];
frame.origin.y += endFrame.origin.y - beginFrame.origin.y;
frame.origin.y = [self.view convertPoint:endFrame.origin fromView:nil].y - frame.size.height;
[[self view] setFrame:frame];
// Resize table view

View file

@ -238,7 +238,6 @@
<string key="NSFrame">{{250, 0}, {70, 59}}</string>
<reference key="NSSuperview" ref="833509359"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<object class="IBUIAccessibilityConfiguration" key="IBUIAccessibilityConfiguration">
@ -303,6 +302,7 @@
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">

View file

@ -102,6 +102,8 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onAddClick:(id)event {
[ContactSelection setSelectionMode:ContactSelectionModeMessage];
[ContactSelection setAddAddress:nil];
[ContactSelection setSipFilter:TRUE];
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE];
}

View file

@ -26,9 +26,8 @@
OrderedDictionary* addressBookMap;
ABAddressBookRef addressBook;
BOOL sipFilter;
}
@property (nonatomic, assign) BOOL sipFilter;
- (void)loadData;
@end

View file

@ -27,8 +27,6 @@
@implementation ContactsTableViewController
@synthesize sipFilter;
#pragma mark - Lifecycle Functions
- (void)initContactsTableViewController {
@ -62,17 +60,9 @@
}
#pragma mark - Property Functions
- (void)setSipFilter:(BOOL)asipFilter {
self->sipFilter = asipFilter;
[self reloadData];
}
#pragma mark -
- (void)reloadData {
- (void)loadData {
[LinphoneLogger logc:LinphoneLoggerLog format:"Load contact list"];
@synchronized (addressBookMap) {
@ -82,7 +72,7 @@
NSArray *lContacts = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
for (id lPerson in lContacts) {
BOOL add = true;
if(sipFilter) {
if([ContactSelection getSipFilter]) {
add = false;
ABMultiValueRef lMap = ABRecordCopyValue((ABRecordRef)lPerson, kABPersonInstantMessageProperty);
for(int i = 0; i < ABMultiValueGetCount(lMap); ++i) {
@ -91,6 +81,8 @@
if(CFStringCompare((CFStringRef)@"SIP", CFDictionaryGetValue(lDict, @"service"), kCFCompareCaseInsensitive) == 0) {
add = true;
}
} else {
add = true;
}
CFRelease(lDict);
}
@ -141,7 +133,7 @@
static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef info, void *context) {
ContactsTableViewController* controller = (ContactsTableViewController*)context;
ABAddressBookRevert(addressBook);
[controller reloadData];
[controller loadData];
}

View file

@ -36,6 +36,8 @@ typedef enum _ContactSelectionMode {
+ (ContactSelectionMode)getSelectionMode;
+ (void)setAddAddress:(NSString*)address;
+ (NSString*)getAddAddress;
+ (void)setSipFilter:(BOOL)enable;
+ (BOOL)getSipFilter;
@end

View file

@ -27,6 +27,7 @@
static ContactSelectionMode sSelectionMode = ContactSelectionModeNone;
static NSString* sAddAddress = nil;
static BOOL sSipFilter = FALSE;
+ (void)setSelectionMode:(ContactSelectionMode)selectionMode {
sSelectionMode = selectionMode;
@ -50,6 +51,14 @@ static NSString* sAddAddress = nil;
return sAddAddress;
}
+ (void)setSipFilter:(BOOL)enable {
sSipFilter = enable;
}
+ (BOOL)getSipFilter {
return sSipFilter;
}
@end
@implementation ContactsViewController
@ -120,7 +129,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[tableController viewWillAppear:animated];
}
[self changeView:History_All];
[self update];
}
@ -141,6 +149,8 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewDidLoad {
[super viewDidLoad];
[self changeView:History_All];
// Set selected+over background: IB lack !
[linphoneButton setImage:[UIImage imageNamed:@"contacts_linphone_selected.png"]
forState:(UIControlStateHighlighted | UIControlStateSelected)];
@ -155,14 +165,16 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)changeView: (HistoryView) view {
if(view == History_All) {
[tableController setSipFilter:FALSE];
[ContactSelection setSipFilter:FALSE];
[tableController loadData];
allButton.selected = TRUE;
} else {
allButton.selected = FALSE;
}
if(view == History_Linphone) {
[tableController setSipFilter:TRUE];
[ContactSelection setSipFilter:TRUE];
[tableController loadData];
linphoneButton.selected = TRUE;
} else {
linphoneButton.selected = FALSE;
@ -181,6 +193,14 @@ static UICompositeViewDescription *compositeDescription = nil;
[backButton setHidden:TRUE];
break;
}
if([ContactSelection getSipFilter]) {
allButton.selected = FALSE;
linphoneButton.selected = TRUE;
} else {
allButton.selected = TRUE;
linphoneButton.selected = FALSE;
}
[tableController loadData];
}

View file

@ -229,6 +229,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onAddContactClick: (id) event {
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
[ContactSelection setAddAddress:[addressField text]];
[ContactSelection setSipFilter:FALSE];
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController);
if(controller != nil) {

View file

@ -264,6 +264,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onAddContactClick:(id)event {
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
[ContactSelection setAddAddress:[[addressButton titleLabel] text]];
[ContactSelection setSipFilter:FALSE];
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController);
if(controller != nil) {
}

View file

@ -78,11 +78,11 @@
</object>
<object class="NSCustomResource" key="IBUIHighlightedImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">history_back_over.png</string>
<string key="NSResourceName">history_details_back_over.png</string>
</object>
<object class="NSCustomResource" key="IBUINormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">history_back_default.png</string>
<string key="NSResourceName">history_details_back_default.png</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="74407898">
<int key="type">2</int>
@ -113,11 +113,11 @@
<reference key="IBUINormalTitleShadowColor" ref="30732699"/>
<object class="NSCustomResource" key="IBUIHighlightedImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">history_add_over.png</string>
<string key="NSResourceName">history_details_add_over.png</string>
</object>
<object class="NSCustomResource" key="IBUINormalImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">history_add_default.png</string>
<string key="NSResourceName">history_details_add_default.png</string>
</object>
<reference key="IBUIFontDescription" ref="74407898"/>
<reference key="IBUIFont" ref="255564883"/>
@ -417,6 +417,7 @@
<string key="NSFrame">{{33, 273}, {255, 50}}</string>
<reference key="NSSuperview" ref="581237105"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
@ -633,7 +634,7 @@
<int key="objectID">8</int>
<reference key="object" ref="778261436"/>
<reference key="parent" ref="136975389"/>
<string key="objectName">barBackground</string>
<string key="objectName">background</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
@ -753,7 +754,7 @@
<int key="objectID">50</int>
<reference key="object" ref="121359009"/>
<reference key="parent" ref="136975389"/>
<string key="objectName">backButton</string>
<string key="objectName">addButton</string>
</object>
</array>
</object>
@ -780,11 +781,11 @@
<string key="38.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="50.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="1" key="50.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
<real value="0.0" key="50.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="1" key="9.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
<real value="0.0" key="9.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
@ -896,10 +897,10 @@
<string key="button_background_default.png">{550, 101}</string>
<string key="button_background_over.png">{550, 101}</string>
<string key="contact_bar_background.png">{5, 117}</string>
<string key="history_add_default.png">{320, 117}</string>
<string key="history_add_over.png">{320, 117}</string>
<string key="history_back_default.png">{320, 117}</string>
<string key="history_back_over.png">{320, 117}</string>
<string key="history_details_add_default.png">{320, 117}</string>
<string key="history_details_add_over.png">{320, 117}</string>
<string key="history_details_back_default.png">{320, 117}</string>
<string key="history_details_back_over.png">{320, 117}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>

View file

@ -361,9 +361,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
linphone_core_enable_video(lc, enableVideo, enableVideo);
NSString *menc = [self stringForKey:@"media_encryption_preference"];
if (menc && [menc compare:@"SRTP"])
if (menc && [menc compare:@"SRTP"] == NSOrderedSame)
linphone_core_set_media_encryption(lc, LinphoneMediaEncryptionSRTP);
else if (menc && [menc compare:@"ZRTP"])
else if (menc && [menc compare:@"ZRTP"] == NSOrderedSame)
linphone_core_set_media_encryption(lc, LinphoneMediaEncryptionZRTP);
else linphone_core_set_media_encryption(lc, LinphoneMediaEncryptionNone);

View file

@ -57,6 +57,7 @@
@synthesize conferenceCell;
@synthesize currentCall;
#pragma mark - Lifecycle Functions
- (id)initWithIdentifier:(NSString*)identifier {
@ -97,6 +98,7 @@
data = nil;
}
#pragma mark - Properties Functions
- (void)setData:(UICallCellData *)adata {

View file

@ -32,8 +32,11 @@
@synthesize dateLabel;
@synthesize chat;
static const CGFloat CELL_MIN_HEIGHT = 65.0f;
static const CGFloat CELL_MESSAGE_MAX_WIDTH = 280.0f;
static const CGFloat CELL_MIN_HEIGHT = 40.0f;
static const CGFloat CELL_MIN_WIDTH = 150.0f;
static const CGFloat CELL_MAX_WIDTH = 320.0f;
static const CGFloat CELL_MESSAGE_X_MARGIN = 26.0f;
static const CGFloat CELL_MESSAGE_Y_MARGIN = 33.0f;
static const CGFloat CELL_FONT_SIZE = 17.0f;
static UIFont *CELL_FONT = nil;
@ -115,53 +118,52 @@ static UIFont *CELL_FONT = nil;
}
- (void)resizeContent {
// Resize content
{
CGRect frame = [contentView frame];
frame.origin.x = 0.0f;
frame.origin.y = 0.0f;
frame.size = [self frame].size;
[ contentView setFrame:frame];
}
if(chat != nil) {
CGPoint center = [contentView center];
if(![[chat direction] intValue]) { // Inverted
// Resize Content
CGRect contentFrame = [contentView frame];
contentFrame.size = [UIChatRoomCell viewSize:[chat message]];
if([[chat direction] intValue]) { // Inverted
contentFrame.origin.x = 0.0f;
contentFrame.origin.y = 0.0f;
} else {
contentFrame.origin.x = CELL_MAX_WIDTH - contentFrame.size.width;
contentFrame.origin.y = 0.0f;
}
[contentView setFrame:contentFrame];
CGRect messageFrame = [messageView frame];
messageFrame.origin.y = ([contentView frame].size.height - messageFrame.size.height)/2;
if([[chat direction] intValue]) { // Inverted
[backgroundImage setImage:[TUNinePatchCache imageOfSize:[backgroundImage bounds].size
forNinePatchNamed:@"chat_bubble_incoming"]];
center.y += 6;
messageFrame.origin.y += 5;
} else {
[backgroundImage setImage:[TUNinePatchCache imageOfSize:[backgroundImage bounds].size
forNinePatchNamed:@"chat_bubble_outgoing"]];
center.y -= 6;
messageFrame.origin.y -= 5;
}
[messageView setCenter:center];
}
// Resize messageView
{
CGRect frame = [messageView frame];
frame.size.height = [UIChatRoomCell messageHeight:[chat message]] + 10;
[messageView setFrame:frame];
[messageView setFrame:messageFrame];
}
}
+ (CGFloat)messageHeight:(NSString*)message {
+ (CGSize)viewSize:(NSString*)message {
if(CELL_FONT == nil) {
CELL_FONT = [UIFont systemFontOfSize:CELL_FONT_SIZE];
}
CGSize messageSize = [message sizeWithFont: CELL_FONT
constrainedToSize: CGSizeMake(CELL_MESSAGE_MAX_WIDTH, 10000.0f)
constrainedToSize: CGSizeMake(CELL_MAX_WIDTH - CELL_MESSAGE_X_MARGIN, 10000.0f)
lineBreakMode: UILineBreakModeTailTruncation];
return messageSize.height;
messageSize.height += CELL_MESSAGE_Y_MARGIN;
if(messageSize.height < CELL_MIN_HEIGHT)
messageSize.height = CELL_MIN_HEIGHT;
messageSize.width += CELL_MESSAGE_X_MARGIN;
if(messageSize.width < CELL_MIN_WIDTH)
messageSize.width = CELL_MIN_WIDTH;
return messageSize;
}
+ (CGFloat)height:(ChatModel*)chat {
CGFloat height = [UIChatRoomCell messageHeight:[chat message]];
height += 40;
if(height < CELL_MIN_HEIGHT)
height = CELL_MIN_HEIGHT;
return height;
return [UIChatRoomCell viewSize:[chat message]].height;
}

View file

@ -40,7 +40,7 @@
<object class="IBUIImageView" id="340144998">
<reference key="NSNextResponder" ref="579600281"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{10, 10}, {300, 120}}</string>
<string key="NSFrame">{{5, 5}, {310, 130}}</string>
<reference key="NSSuperview" ref="579600281"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="456806949"/>
@ -59,7 +59,7 @@
<object class="IBUILabel" id="281972462">
<reference key="NSNextResponder" ref="456806949"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{280, 90}</string>
<string key="NSFrameSize">{294, 107}</string>
<reference key="NSSuperview" ref="456806949"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="859609488"/>
@ -92,7 +92,7 @@
<object class="IBUIButton" id="859609488">
<reference key="NSNextResponder" ref="456806949"/>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{236, 0}, {44, 44}}</string>
<string key="NSFrame">{{250, 0}, {44, 44}}</string>
<reference key="NSSuperview" ref="456806949"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="504194589"/>
@ -131,10 +131,9 @@
<object class="IBUILabel" id="504194589">
<reference key="NSNextResponder" ref="456806949"/>
<int key="NSvFlags">265</int>
<string key="NSFrame">{{0, 90}, {280, 10}}</string>
<string key="NSFrame">{{14, 107}, {280, 7}}</string>
<reference key="NSSuperview" ref="456806949"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@ -149,16 +148,16 @@
<int key="IBUITextAlignment">2</int>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">12</double>
<double key="pointSize">10</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">12</double>
<double key="NSSize">10</double>
<int key="NSfFlags">16</int>
</object>
</object>
</array>
<string key="NSFrame">{{20, 20}, {280, 100}}</string>
<string key="NSFrame">{{13, 13}, {294, 114}}</string>
<reference key="NSSuperview" ref="579600281"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="281972462"/>

View file

@ -211,9 +211,7 @@
}
}
if(oldViewDescription != nil && contentViewController != nil && oldViewDescription.content != currentViewDescription.content) {
[UICompositeViewController removeSubView: contentViewController];
}
[UICompositeViewController removeSubView: contentViewController];
if(oldViewDescription != nil && tabBarViewController != nil && oldViewDescription.tabBar != currentViewDescription.tabBar) {
[UICompositeViewController removeSubView: tabBarViewController];
}
@ -311,9 +309,7 @@
// Change view
if(description != nil) {
if(oldViewDescription == nil || oldViewDescription.content != currentViewDescription.content) {
[UICompositeViewController addSubView: contentViewController view:contentView];
}
[UICompositeViewController addSubView: contentViewController view:contentView];
if(oldViewDescription == nil || oldViewDescription.tabBar != currentViewDescription.tabBar) {
[UICompositeViewController addSubView: tabBarViewController view:tabBarView];
}

View file

@ -282,6 +282,7 @@
- (IBAction)onContactsClick: (id) event {
[ContactSelection setSelectionMode:ContactSelectionModeNone];
[ContactSelection setAddAddress:nil];
[ContactSelection setSipFilter:FALSE];
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]];
}

View file

@ -23,10 +23,12 @@
UIImageView* registrationStateImage;
UILabel* registrationStateLabel;
UIImageView* callQualityImage;
UIImageView* callSecurityImage;
}
@property (nonatomic, retain) IBOutlet UIImageView* registrationStateImage;
@property (nonatomic, retain) IBOutlet UILabel* registrationStateLabel;
@property (nonatomic, retain) IBOutlet UIImageView* callQualityImage;
@property (nonatomic, retain) IBOutlet UIImageView* callSecurityImage;
@end

View file

@ -27,14 +27,21 @@
@synthesize registrationStateImage;
@synthesize registrationStateLabel;
@synthesize callQualityImage;
@synthesize callSecurityImage;
NSTimer *callQualityTimer;
NSTimer *callSecurityTimer;
#pragma mark - Lifecycle Functions
- (id)init {
return [super initWithNibName:@"UIStateBar" bundle:[NSBundle mainBundle]];
self = [super initWithNibName:@"UIStateBar" bundle:[NSBundle mainBundle]];
if(self != nil) {
self->callSecurityImage = nil;
self->callQualityImage = nil;
}
return self;
}
- (void) dealloc {
@ -57,6 +64,13 @@ NSTimer *callQualityTimer;
userInfo:nil
repeats:YES];
// Set callQualityTimer
callSecurityTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(callSecurityUpdate)
userInfo:nil
repeats:YES];
// Set observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(registrationUpdate:)
@ -65,6 +79,7 @@ NSTimer *callQualityTimer;
[callQualityImage setHidden: true];
[callSecurityImage setHidden: true];
// Update to default state
LinphoneProxyConfig* config = NULL;
@ -81,7 +96,14 @@ NSTimer *callQualityTimer;
name:@"LinphoneRegistrationUpdate"
object:nil];
[callQualityTimer invalidate];
if(callQualityTimer != nil) {
[callQualityTimer invalidate];
callQualityTimer = nil;
}
if(callQualityTimer != nil) {
[callSecurityTimer invalidate];
callSecurityTimer = nil;
}
}
@ -157,6 +179,44 @@ NSTimer *callQualityTimer;
#pragma mark -
- (void)callSecurityUpdate {
BOOL pending = false;
BOOL security = true;
if(![LinphoneManager isLcReady]) {
[callSecurityImage setHidden: true];
return;
}
const MSList *list = linphone_core_get_calls([LinphoneManager getLc]);
if(list == NULL) {
[callSecurityImage setHidden: true];
return;
}
while(list != NULL) {
LinphoneCall *call = (LinphoneCall*) list->data;
LinphoneMediaEncryption enc = linphone_call_params_get_media_encryption(linphone_call_get_current_params(call));
if(enc == LinphoneMediaEncryptionNone)
security = false;
else if(enc == LinphoneMediaEncryptionZRTP) {
if(!linphone_call_get_authentication_token_verified(call)) {
pending = true;
}
}
list = list->next;
}
if(security) {
if(pending) {
[callSecurityImage setImage:[UIImage imageNamed:@"security_pending.png"]];
} else {
[callSecurityImage setImage:[UIImage imageNamed:@"security_ok.png"]];
}
} else {
[callSecurityImage setImage:[UIImage imageNamed:@"security_ko.png"]];
}
[callSecurityImage setHidden: false];
}
- (void)callQualityUpdate {
UIImage *image = nil;
if([LinphoneManager isLcReady]) {

View file

@ -103,11 +103,22 @@
<string key="NSFrame">{{219, 3}, {27, 17}}</string>
<reference key="NSSuperview" ref="848661322"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<reference key="NSNextKeyView" ref="522045680"/>
<string key="NSReuseIdentifierKey">_NS:567</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIImageView" id="522045680">
<reference key="NSNextResponder" ref="848661322"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{254, 3}, {27, 17}}</string>
<reference key="NSSuperview" ref="848661322"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:567</string>
<int key="IBUIContentMode">1</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<string key="NSFrameSize">{320, 23}</string>
<reference key="NSSuperview"/>
@ -155,6 +166,14 @@
</object>
<int key="connectionID">16</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">callSecurityImage</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="522045680"/>
</object>
<int key="connectionID">18</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@ -183,6 +202,7 @@
<reference ref="200467549"/>
<reference ref="393098359"/>
<reference ref="327031870"/>
<reference ref="522045680"/>
</array>
<reference key="parent" ref="0"/>
</object>
@ -208,7 +228,13 @@
<int key="objectID">13</int>
<reference key="object" ref="327031870"/>
<reference key="parent" ref="848661322"/>
<string key="objectName">callQualityIndicatorImage</string>
<string key="objectName">callQualityImage</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">17</int>
<reference key="object" ref="522045680"/>
<reference key="parent" ref="848661322"/>
<string key="objectName">callSecurityImage</string>
</object>
</array>
</object>
@ -219,6 +245,7 @@
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="17.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -227,7 +254,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">16</int>
<int key="maxID">18</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -236,6 +263,7 @@
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="callQualityImage">UIImageView</string>
<string key="callSecurityImage">UIImageView</string>
<string key="registrationStateImage">UIImageView</string>
<string key="registrationStateLabel">UILabel</string>
</dictionary>
@ -244,6 +272,10 @@
<string key="name">callQualityImage</string>
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo" key="callSecurityImage">
<string key="name">callSecurityImage</string>
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo" key="registrationStateImage">
<string key="name">registrationStateImage</string>
<string key="candidateClassName">UIImageView</string>

View file

@ -341,17 +341,19 @@ static PhoneMainView* phoneMainViewInstance=nil;
}
- (UIViewController*)changeCurrentView:(UICompositeViewDescription*)view push:(BOOL)push {
BOOL force = push;
if(!push) {
force = [viewStack count] > 1;
[viewStack removeAllObjects];
}
[viewStack addObject:view];
return [self _changeCurrentView:view transition:nil];
return [self _changeCurrentView:view transition:nil force:force];
}
- (UIViewController*)_changeCurrentView:(UICompositeViewDescription*)view transition:(CATransition*)transition {
- (UIViewController*)_changeCurrentView:(UICompositeViewDescription*)view transition:(CATransition*)transition force:(BOOL)force {
[LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: change view %d", [view name]];
if(![view equal: currentView]) {
if(force || ![view equal: currentView]) {
if(transition == nil)
transition = [PhoneMainView getTransition:currentView new:view];
[mainViewController setViewTransition:transition];
@ -369,7 +371,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
while([viewStack count] > 1 && ![[viewStack lastObject] equal:view]) {
[viewStack removeLastObject];
}
[self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition]];
[self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition] force:TRUE];
}
- (UICompositeViewDescription *)firstView {
@ -384,7 +386,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
[LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Pop view"];
if([viewStack count] > 0) {
[viewStack removeLastObject];
[self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition]];
[self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition] force:TRUE];
return [mainViewController getCurrentViewController];
}
return nil;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -180,14 +180,14 @@
D3128FF415AABE4E00A2147A /* contact_edit_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3128FE915AABE4E00A2147A /* contact_edit_default.png */; };
D3128FF515AABE4E00A2147A /* contact_edit_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3128FEA15AABE4E00A2147A /* contact_edit_over.png */; };
D3128FF615AABE4E00A2147A /* contact_edit_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3128FEA15AABE4E00A2147A /* contact_edit_over.png */; };
D3157A8A15B4466F00DD8C4C /* history_add_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8815B4466F00DD8C4C /* history_add_default.png */; };
D3157A8B15B4466F00DD8C4C /* history_add_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8815B4466F00DD8C4C /* history_add_default.png */; };
D3157A8C15B4466F00DD8C4C /* history_add_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8915B4466F00DD8C4C /* history_add_over.png */; };
D3157A8D15B4466F00DD8C4C /* history_add_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8915B4466F00DD8C4C /* history_add_over.png */; };
D3157A9015B446CB00DD8C4C /* history_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8E15B446CB00DD8C4C /* history_back_default.png */; };
D3157A9115B446CB00DD8C4C /* history_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8E15B446CB00DD8C4C /* history_back_default.png */; };
D3157A9215B446CB00DD8C4C /* history_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8F15B446CB00DD8C4C /* history_back_over.png */; };
D3157A9315B446CB00DD8C4C /* history_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8F15B446CB00DD8C4C /* history_back_over.png */; };
D3157A8A15B4466F00DD8C4C /* history_details_add_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8815B4466F00DD8C4C /* history_details_add_default.png */; };
D3157A8B15B4466F00DD8C4C /* history_details_add_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8815B4466F00DD8C4C /* history_details_add_default.png */; };
D3157A8C15B4466F00DD8C4C /* history_details_add_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8915B4466F00DD8C4C /* history_details_add_over.png */; };
D3157A8D15B4466F00DD8C4C /* history_details_add_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8915B4466F00DD8C4C /* history_details_add_over.png */; };
D3157A9015B446CB00DD8C4C /* history_details_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8E15B446CB00DD8C4C /* history_details_back_default.png */; };
D3157A9115B446CB00DD8C4C /* history_details_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8E15B446CB00DD8C4C /* history_details_back_default.png */; };
D3157A9215B446CB00DD8C4C /* history_details_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8F15B446CB00DD8C4C /* history_details_back_over.png */; };
D3157A9315B446CB00DD8C4C /* history_details_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3157A8F15B446CB00DD8C4C /* history_details_back_over.png */; };
D3196D3415A321E3007FEEBA /* options_add_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3196D3015A321E2007FEEBA /* options_add_default.png */; };
D3196D3515A321E3007FEEBA /* options_add_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3196D3015A321E2007FEEBA /* options_add_default.png */; };
D3196D3615A321E3007FEEBA /* options_add_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3196D3115A321E2007FEEBA /* options_add_over.png */; };
@ -1090,10 +1090,10 @@
D3128FE815AABE4E00A2147A /* contact_back_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_back_over.png; path = Resources/contact_back_over.png; sourceTree = "<group>"; };
D3128FE915AABE4E00A2147A /* contact_edit_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_edit_default.png; path = Resources/contact_edit_default.png; sourceTree = "<group>"; };
D3128FEA15AABE4E00A2147A /* contact_edit_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_edit_over.png; path = Resources/contact_edit_over.png; sourceTree = "<group>"; };
D3157A8815B4466F00DD8C4C /* history_add_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_add_default.png; path = Resources/history_add_default.png; sourceTree = "<group>"; };
D3157A8915B4466F00DD8C4C /* history_add_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_add_over.png; path = Resources/history_add_over.png; sourceTree = "<group>"; };
D3157A8E15B446CB00DD8C4C /* history_back_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_back_default.png; path = Resources/history_back_default.png; sourceTree = "<group>"; };
D3157A8F15B446CB00DD8C4C /* history_back_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_back_over.png; path = Resources/history_back_over.png; sourceTree = "<group>"; };
D3157A8815B4466F00DD8C4C /* history_details_add_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_details_add_default.png; path = Resources/history_details_add_default.png; sourceTree = "<group>"; };
D3157A8915B4466F00DD8C4C /* history_details_add_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_details_add_over.png; path = Resources/history_details_add_over.png; sourceTree = "<group>"; };
D3157A8E15B446CB00DD8C4C /* history_details_back_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_details_back_default.png; path = Resources/history_details_back_default.png; sourceTree = "<group>"; };
D3157A8F15B446CB00DD8C4C /* history_details_back_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = history_details_back_over.png; path = Resources/history_details_back_over.png; sourceTree = "<group>"; };
D3196D3015A321E2007FEEBA /* options_add_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_add_default.png; path = Resources/options_add_default.png; sourceTree = "<group>"; };
D3196D3115A321E2007FEEBA /* options_add_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_add_over.png; path = Resources/options_add_over.png; sourceTree = "<group>"; };
D3196D3215A321E3007FEEBA /* options_transfer_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_transfer_default.png; path = Resources/options_transfer_default.png; sourceTree = "<group>"; };
@ -2203,12 +2203,12 @@
D3F83EFB158205A100336684 /* hangup_over.png */,
D36C43CE158F2F370048BA40 /* header_conference.png */,
D3F26BFB15987083005F9CAB /* header_incoming.png */,
D3157A8815B4466F00DD8C4C /* history_add_default.png */,
D3157A8915B4466F00DD8C4C /* history_add_over.png */,
D3157A8815B4466F00DD8C4C /* history_details_add_default.png */,
D3157A8915B4466F00DD8C4C /* history_details_add_over.png */,
D3ED3E9315872EF1006C0DE4 /* history_all_default.png */,
D3ED3E9215872EF1006C0DE4 /* history_all_selected.png */,
D3157A8E15B446CB00DD8C4C /* history_back_default.png */,
D3157A8F15B446CB00DD8C4C /* history_back_over.png */,
D3157A8E15B446CB00DD8C4C /* history_details_back_default.png */,
D3157A8F15B446CB00DD8C4C /* history_details_back_over.png */,
D347347C1580E5F8003C7B8C /* history_default.png */,
D3ED3E9415872EF1006C0DE4 /* history_edit_default.png */,
D3ED3E9515872EF1006C0DE4 /* history_edit_over.png */,
@ -2828,10 +2828,10 @@
D3E84F2A15B00F4100420DAC /* dialer_alt_background.png in Resources */,
D3E84F3815B011AF00420DAC /* contact_cancel_default.png in Resources */,
D3E84F3A15B011AF00420DAC /* contact_cancel_over.png in Resources */,
D3157A8A15B4466F00DD8C4C /* history_add_default.png in Resources */,
D3157A8C15B4466F00DD8C4C /* history_add_over.png in Resources */,
D3157A9015B446CB00DD8C4C /* history_back_default.png in Resources */,
D3157A9215B446CB00DD8C4C /* history_back_over.png in Resources */,
D3157A8A15B4466F00DD8C4C /* history_details_add_default.png in Resources */,
D3157A8C15B4466F00DD8C4C /* history_details_add_over.png in Resources */,
D3157A9015B446CB00DD8C4C /* history_details_back_default.png in Resources */,
D3157A9215B446CB00DD8C4C /* history_details_back_over.png in Resources */,
D3119E7215B6A4710005D4A4 /* contacts_back_default.png in Resources */,
D3119E7415B6A4710005D4A4 /* contacts_back_over.png in Resources */,
);
@ -3081,10 +3081,10 @@
D3E84F2B15B00F4100420DAC /* dialer_alt_background.png in Resources */,
D3E84F3915B011AF00420DAC /* contact_cancel_default.png in Resources */,
D3E84F3B15B011AF00420DAC /* contact_cancel_over.png in Resources */,
D3157A8B15B4466F00DD8C4C /* history_add_default.png in Resources */,
D3157A8D15B4466F00DD8C4C /* history_add_over.png in Resources */,
D3157A9115B446CB00DD8C4C /* history_back_default.png in Resources */,
D3157A9315B446CB00DD8C4C /* history_back_over.png in Resources */,
D3157A8B15B4466F00DD8C4C /* history_details_add_default.png in Resources */,
D3157A8D15B4466F00DD8C4C /* history_details_add_over.png in Resources */,
D3157A9115B446CB00DD8C4C /* history_details_back_default.png in Resources */,
D3157A9315B446CB00DD8C4C /* history_details_back_over.png in Resources */,
D3119E7315B6A4710005D4A4 /* contacts_back_default.png in Resources */,
D3119E7515B6A4710005D4A4 /* contacts_back_over.png in Resources */,
);