forked from mirrors/linphone-iphone
Simplification of view changes
Fix new discution in chat
This commit is contained in:
parent
dbd4f01401
commit
c9558e8f82
40 changed files with 656 additions and 357 deletions
|
|
@ -35,6 +35,8 @@
|
|||
LinphoneChatRoom *chatRoom;
|
||||
UILabel *addressLabel;
|
||||
UIImageView *avatarImage;
|
||||
UIView *headerView;
|
||||
UIView *footerView;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -44,6 +46,8 @@
|
|||
@property (nonatomic, retain) IBOutlet UIButton* sendButton;
|
||||
@property (nonatomic, retain) IBOutlet UILabel *addressLabel;
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *avatarImage;
|
||||
@property (nonatomic, retain) IBOutlet UIView *headerView;
|
||||
@property (nonatomic, retain) IBOutlet UIView *footerView;
|
||||
@property (nonatomic, copy) NSString *remoteAddress;
|
||||
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
@synthesize remoteAddress;
|
||||
@synthesize addressLabel;
|
||||
@synthesize avatarImage;
|
||||
@synthesize headerView;
|
||||
@synthesize footerView;
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
|
|
@ -51,21 +53,27 @@
|
|||
[remoteAddress release];
|
||||
[addressLabel release];
|
||||
[avatarImage release];
|
||||
[headerView release];
|
||||
[footerView release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"ChatRoomViewController";
|
||||
description->tabBar = nil;
|
||||
description->tabBarEnabled = false;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"ChatRoom"
|
||||
content:@"ChatRoomViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:nil
|
||||
tabBarEnabled:false
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -131,7 +139,10 @@
|
|||
}
|
||||
remoteAddress = [aRemoteAddress copy];
|
||||
[tableController setRemoteAddress: remoteAddress];
|
||||
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
if(remoteAddress == NULL) {
|
||||
[LinphoneLogger logc:LinphoneLoggerWarning format:"Cannot update chat room header: null contact"];
|
||||
return;
|
||||
|
|
@ -140,7 +151,7 @@
|
|||
NSString *displayName = nil;
|
||||
UIImage *image = nil;
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:remoteAddress];
|
||||
ABRecordRef acontact =[[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
ABRecordRef acontact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(acontact != nil) {
|
||||
displayName = [FastAddressBook getContactDisplayName:acontact];
|
||||
image = [FastAddressBook getContactImage:acontact thumbnail:true];
|
||||
|
|
@ -220,7 +231,7 @@
|
|||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onBackClick:(id)event {
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
}
|
||||
|
||||
- (IBAction)onEditClick:(id)event {
|
||||
|
|
@ -251,15 +262,19 @@
|
|||
[UIView setAnimationDuration:duration];
|
||||
[UIView setAnimationCurve:curve];
|
||||
[UIView setAnimationBeginsFromCurrentState:TRUE];
|
||||
|
||||
// Move view
|
||||
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
CGRect frame = [[self view] frame];
|
||||
/*
|
||||
CGPoint pos = {0, 0};
|
||||
CGPoint gPos = [[self view] convertPoint:pos toView:nil];
|
||||
frame.size.height = endFrame.origin.y - gPos.y;
|
||||
*/
|
||||
frame.origin.y += endFrame.origin.y - beginFrame.origin.y;
|
||||
[[self view] setFrame:frame];
|
||||
|
||||
// Resize table view
|
||||
CGRect tableFrame = [tableController.view frame];
|
||||
tableFrame.origin.y = [headerView frame].origin.y + [headerView frame].size.height;
|
||||
tableFrame.size.height = [footerView frame].origin.y - tableFrame.origin.y;
|
||||
[tableController.view setFrame:tableFrame];
|
||||
|
||||
[UIView commitAnimations];
|
||||
}
|
||||
|
||||
|
|
@ -271,13 +286,27 @@
|
|||
[UIView setAnimationDuration:duration];
|
||||
[UIView setAnimationCurve:curve];
|
||||
[UIView setAnimationBeginsFromCurrentState:TRUE];
|
||||
|
||||
// Move view
|
||||
CGRect endFrame = [[[notif userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
||||
CGRect frame = [[self view] frame];
|
||||
/*CGPoint pos = {0, 0};
|
||||
CGPoint gPos = [[self view] convertPoint:pos toView:nil];
|
||||
frame.size.height = endFrame.origin.y - gPos.y;*/
|
||||
frame.origin.y += endFrame.origin.y - beginFrame.origin.y;
|
||||
[[self view] setFrame:frame];
|
||||
|
||||
// Resize table view
|
||||
CGPoint pos = {0, 0};
|
||||
CGPoint gPos = [[self.view superview] convertPoint:pos toView:self.view];
|
||||
CGRect tableFrame = [tableController.view frame];
|
||||
tableFrame.origin.y = gPos.y;
|
||||
tableFrame.size.height = [footerView frame].origin.y - tableFrame.origin.y;
|
||||
[tableController.view setFrame:tableFrame];
|
||||
|
||||
// Scroll
|
||||
int lastSection = [tableController.tableView numberOfSections] -1;
|
||||
int lastRow = [tableController.tableView numberOfRowsInSection:lastSection] - 1;
|
||||
[tableController.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:lastRow inSection:lastSection]
|
||||
atScrollPosition:UITableViewScrollPositionBottom
|
||||
animated:TRUE];
|
||||
[UIView commitAnimations];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
</object>
|
||||
<object class="IBUIView" id="414508017">
|
||||
<reference key="NSNextResponder" ref="589117993"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<int key="NSvFlags">290</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="934483770">
|
||||
<reference key="NSNextResponder" ref="414508017"/>
|
||||
|
|
@ -234,10 +234,11 @@
|
|||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIButton" id="487645621">
|
||||
<reference key="NSNextResponder" ref="833509359"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<int key="NSvFlags">257</int>
|
||||
<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">
|
||||
|
|
@ -267,7 +268,7 @@
|
|||
</object>
|
||||
<object class="IBUIImageView" id="946416684">
|
||||
<reference key="NSNextResponder" ref="833509359"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<int key="NSvFlags">260</int>
|
||||
<string key="NSFrameSize">{250, 59}</string>
|
||||
<reference key="NSSuperview" ref="833509359"/>
|
||||
<reference key="NSWindow"/>
|
||||
|
|
@ -282,7 +283,7 @@
|
|||
</object>
|
||||
<object class="IBUITextField" id="87421816">
|
||||
<reference key="NSNextResponder" ref="833509359"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<int key="NSvFlags">260</int>
|
||||
<string key="NSFrame">{{10, 10}, {230, 39}}</string>
|
||||
<reference key="NSSuperview" ref="833509359"/>
|
||||
<reference key="NSWindow"/>
|
||||
|
|
@ -405,6 +406,22 @@
|
|||
</object>
|
||||
<int key="connectionID">44</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">headerView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="414508017"/>
|
||||
</object>
|
||||
<int key="connectionID">45</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">footerView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="833509359"/>
|
||||
</object>
|
||||
<int key="connectionID">46</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
|
|
@ -542,7 +559,7 @@
|
|||
<reference ref="946416684"/>
|
||||
</array>
|
||||
<reference key="parent" ref="589117993"/>
|
||||
<string key="objectName">footer</string>
|
||||
<string key="objectName">footerView</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">15</int>
|
||||
|
|
@ -629,7 +646,7 @@
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">44</int>
|
||||
<int key="maxID">46</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -672,6 +689,8 @@
|
|||
<string key="addressLabel">UILabel</string>
|
||||
<string key="avatarImage">UIImageView</string>
|
||||
<string key="editButton">UIToggleButton</string>
|
||||
<string key="footerView">UIView</string>
|
||||
<string key="headerView">UIView</string>
|
||||
<string key="messageField">UITextField</string>
|
||||
<string key="sendButton">UIButton</string>
|
||||
<string key="tableController">ChatRoomTableViewController</string>
|
||||
|
|
@ -689,6 +708,14 @@
|
|||
<string key="name">editButton</string>
|
||||
<string key="candidateClassName">UIToggleButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="footerView">
|
||||
<string key="name">footerView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="headerView">
|
||||
<string key="name">headerView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="messageField">
|
||||
<string key="name">messageField</string>
|
||||
<string key="candidateClassName">UITextField</string>
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
ChatModel *chat = [data objectAtIndex:[indexPath row]];
|
||||
|
||||
// Go to ChatRoom view
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController);
|
||||
if(controller != nil) {
|
||||
[controller setRemoteAddress:[chat remoteContact]];
|
||||
}
|
||||
|
|
@ -101,10 +101,11 @@
|
|||
if(editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
[tableView beginUpdates];
|
||||
ChatModel *chat = [data objectAtIndex:[indexPath row]];
|
||||
[data removeObjectAtIndex:[indexPath row]];
|
||||
[ChatModel removeConversation:[chat remoteContact]];
|
||||
[data removeObjectAtIndex:[indexPath row]];
|
||||
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||
[tableView endUpdates];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneTextReceived" object:self];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,22 +82,27 @@
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"ChatViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"Chat"
|
||||
content:@"ChatViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar: @"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onAddClick:(id)event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE];
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeMessage];
|
||||
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE];
|
||||
}
|
||||
|
||||
- (IBAction)onEditClick:(id)event {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,21 @@
|
|||
<reference key="NSNextResponder" ref="1031663480"/>
|
||||
<int key="NSvFlags">290</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="868223268">
|
||||
<reference key="NSNextResponder" ref="786589861"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{320, 58}</string>
|
||||
<reference key="NSSuperview" ref="786589861"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="1001416449"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">contact_bar_background.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIButton" id="1031075615">
|
||||
<reference key="NSNextResponder" ref="786589861"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
|
|
@ -97,21 +112,6 @@
|
|||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIImageView" id="868223268">
|
||||
<reference key="NSNextResponder" ref="786589861"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{160, 0}, {160, 58}}</string>
|
||||
<reference key="NSSuperview" ref="786589861"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="1001416449"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">contact_bar_background.png</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{320, 58}</string>
|
||||
<reference key="NSSuperview" ref="1031663480"/>
|
||||
|
|
|
|||
|
|
@ -447,17 +447,25 @@
|
|||
int index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]);
|
||||
CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, index);
|
||||
CFStringRef valueRef = CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey);
|
||||
dest = [NSString stringWithString:(NSString*) valueRef];
|
||||
dest = [FastAddressBook normalizeSipURI:[NSString stringWithString:(NSString*) valueRef]];
|
||||
CFRelease(lDict);
|
||||
CFRelease(lMap);
|
||||
}
|
||||
if(dest != nil) {
|
||||
NSString *displayName = [FastAddressBook getContactDisplayName:contact];
|
||||
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller call:dest displayName:displayName];
|
||||
if([ContactSelection getSelectionMode] != ContactSelectionModeMessage) {
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller call:dest displayName:displayName];
|
||||
}
|
||||
} else {
|
||||
// Go to Chat room view
|
||||
[[PhoneMainView instance] popToView:[ChatViewController compositeViewDescription]];
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController);
|
||||
if(controller != nil) {
|
||||
[controller setRemoteAddress:dest];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
ABAddressBookRevert(addressBook);
|
||||
contact = ABAddressBookGetPersonWithRecordID(addressBook, recordID);
|
||||
if(contact == NULL) {
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
return;
|
||||
}
|
||||
[tableController setContact:contact];
|
||||
|
|
@ -82,7 +82,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
|
||||
- (void)removeContact {
|
||||
if(contact == NULL) {
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
|
||||
- (void)saveData {
|
||||
if(contact == NULL) {
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -218,6 +218,12 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
if([ContactSelection getSelectionMode] == ContactSelectionModeEdit ||
|
||||
[ContactSelection getSelectionMode] == ContactSelectionModeNone) {
|
||||
[editButton setHidden:FALSE];
|
||||
} else {
|
||||
[editButton setHidden:TRUE];
|
||||
}
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {
|
||||
[tableController viewWillAppear:animated];
|
||||
}
|
||||
|
|
@ -240,18 +246,24 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"ContactDetailsViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"ContactDetails"
|
||||
content:@"ContactDetailsViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:@"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)enableEdit:(BOOL)animated {
|
||||
if(![tableController isEditing]) {
|
||||
[tableController setEditing:TRUE animated:animated];
|
||||
|
|
@ -278,7 +290,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
}
|
||||
|
||||
- (IBAction)onBackClick:(id)event {
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
}
|
||||
|
||||
- (IBAction)onEditClick:(id)event {
|
||||
|
|
@ -293,7 +305,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
- (void)onRemove:(id)event {
|
||||
[self disableEdit:FALSE];
|
||||
[self removeContact];
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<string key="NS.object.0">1181</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBUIImageView</string>
|
||||
<string>IBUIButton</string>
|
||||
<string>IBUITableView</string>
|
||||
<string>IBUIView</string>
|
||||
|
|
@ -41,6 +42,20 @@
|
|||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">290</int>
|
||||
<array class="NSMutableArray" key="NSSubviews">
|
||||
<object class="IBUIImageView" id="463087888">
|
||||
<reference key="NSNextResponder" ref="624008635"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{320, 58}</string>
|
||||
<reference key="NSSuperview" ref="624008635"/>
|
||||
<reference key="NSWindow"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">contact_bar_background.png</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUIButton" id="40094652">
|
||||
<reference key="NSNextResponder" ref="624008635"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
|
|
@ -160,7 +175,6 @@
|
|||
<string key="NSFrame">{{0, 59}, {320, 401}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">10</int>
|
||||
|
|
@ -385,6 +399,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<reference ref="100677920"/>
|
||||
<reference ref="40094652"/>
|
||||
<reference ref="827146159"/>
|
||||
<reference ref="463087888"/>
|
||||
</array>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
<string key="objectName">toolBar</string>
|
||||
|
|
@ -420,6 +435,12 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<reference key="parent" ref="624008635"/>
|
||||
<string key="objectName">cancelButton</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">52</int>
|
||||
<reference key="object" ref="463087888"/>
|
||||
<reference key="parent" ref="624008635"/>
|
||||
<string key="objectName">barBackground</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
|
@ -435,6 +456,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="47.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="1" key="47.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
<string key="52.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="8.CustomClassName">UIToggleButton</string>
|
||||
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="2" key="8.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
|
|
@ -445,7 +467,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">51</int>
|
||||
<int key="maxID">52</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -537,6 +559,7 @@ AAgACAAIAAEAAQABAAE</bytes>
|
|||
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<string key="contact_back_default.png">{320, 117}</string>
|
||||
<string key="contact_back_over.png">{320, 117}</string>
|
||||
<string key="contact_bar_background.png">{5, 117}</string>
|
||||
<string key="contact_cancel_default.png">{320, 117}</string>
|
||||
<string key="contact_cancel_over.png">{320, 117}</string>
|
||||
<string key="contact_edit_default.png">{320, 117}</string>
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@
|
|||
|
||||
ABAddressBookRef addressBook;
|
||||
BOOL sipFilter;
|
||||
NSString *tempAddress;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSString* tempAddress;
|
||||
@property (nonatomic, assign) BOOL sipFilter;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
@implementation ContactsTableViewController
|
||||
|
||||
@synthesize sipFilter;
|
||||
@synthesize tempAddress;
|
||||
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
|
|
@ -60,7 +58,6 @@
|
|||
ABAddressBookUnregisterExternalChangeCallback(addressBook, sync_address_book, self);
|
||||
CFRelease(addressBook);
|
||||
[addressBookMap removeAllObjects];
|
||||
[tempAddress release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +149,6 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[self setTempAddress:nil];
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -194,13 +190,12 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
ABRecordRef lPerson = [subDic objectForKey: [subDic keyAtIndex:[indexPath row]]];
|
||||
|
||||
// Go to Contact details view
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ContactDetails push:TRUE], ContactDetailsViewController);
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController);
|
||||
if(controller != nil) {
|
||||
if(tempAddress == nil) {
|
||||
if([ContactSelection getAddAddress] == nil) {
|
||||
[controller setContact:lPerson];
|
||||
} else {
|
||||
[controller editContact:lPerson address:tempAddress];
|
||||
[self setTempAddress:nil];
|
||||
[controller editContact:lPerson address:[ContactSelection getAddAddress]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,26 +20,45 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "UICompositeViewController.h"
|
||||
|
||||
#import "ContactsTableViewController.h"
|
||||
|
||||
typedef enum _ContactSelectionMode {
|
||||
ContactSelectionModeNone,
|
||||
ContactSelectionModeEdit,
|
||||
ContactSelectionModePhone,
|
||||
ContactSelectionModeMessage
|
||||
} ContactSelectionMode;
|
||||
|
||||
@interface ContactSelection : NSObject {
|
||||
}
|
||||
|
||||
+ (void)setSelectionMode:(ContactSelectionMode)selectionMode;
|
||||
+ (ContactSelectionMode)getSelectionMode;
|
||||
+ (void)setAddAddress:(NSString*)address;
|
||||
+ (NSString*)getAddAddress;
|
||||
|
||||
@end
|
||||
|
||||
@interface ContactsViewController : UIViewController<UICompositeViewDelegate> {
|
||||
ContactsTableViewController *tableController;
|
||||
UITableView *tableView;
|
||||
|
||||
UIButton *allButton;
|
||||
UIButton *linphoneButton;
|
||||
UIButton *backButton;
|
||||
UIButton *addButton;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet ContactsTableViewController* tableController;
|
||||
@property (nonatomic, retain) IBOutlet UITableView *tableView;
|
||||
@property (nonatomic, retain) IBOutlet UIButton* allButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton* linphoneButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *backButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *addButton;
|
||||
|
||||
- (IBAction)onAllClick:(id)event;
|
||||
- (IBAction)onLinphoneClick:(id)event;
|
||||
- (IBAction)onAddContactClick:(id)event;
|
||||
|
||||
- (void)setAddress:(NSString*)address;
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -23,6 +23,35 @@
|
|||
|
||||
#import <AddressBook/ABPerson.h>
|
||||
|
||||
@implementation ContactSelection
|
||||
|
||||
static ContactSelectionMode sSelectionMode = ContactSelectionModeNone;
|
||||
static NSString* sAddAddress = nil;
|
||||
|
||||
+ (void)setSelectionMode:(ContactSelectionMode)selectionMode {
|
||||
sSelectionMode = selectionMode;
|
||||
}
|
||||
|
||||
+ (ContactSelectionMode)getSelectionMode {
|
||||
return sSelectionMode;
|
||||
}
|
||||
|
||||
+ (void)setAddAddress:(NSString*)address {
|
||||
if(sAddAddress != nil) {
|
||||
[sAddAddress release];
|
||||
sAddAddress= nil;
|
||||
}
|
||||
if(address != nil) {
|
||||
sAddAddress = [address retain];
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSString*)getAddAddress {
|
||||
return sAddAddress;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ContactsViewController
|
||||
|
||||
@synthesize tableController;
|
||||
|
|
@ -30,6 +59,8 @@
|
|||
|
||||
@synthesize allButton;
|
||||
@synthesize linphoneButton;
|
||||
@synthesize backButton;
|
||||
@synthesize addButton;
|
||||
|
||||
typedef enum _HistoryView {
|
||||
History_All,
|
||||
|
|
@ -50,22 +81,27 @@ typedef enum _HistoryView {
|
|||
|
||||
[allButton release];
|
||||
[linphoneButton release];
|
||||
[backButton release];
|
||||
[addButton release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"ContactsViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"Contacts"
|
||||
content:@"ContactsViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:@"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -85,6 +121,7 @@ typedef enum _HistoryView {
|
|||
}
|
||||
|
||||
[self changeView:History_All];
|
||||
[self update];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
|
|
@ -116,10 +153,6 @@ typedef enum _HistoryView {
|
|||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setAddress:(NSString*)address {
|
||||
[tableController setTempAddress:address];
|
||||
}
|
||||
|
||||
- (void)changeView: (HistoryView) view {
|
||||
if(view == History_All) {
|
||||
[tableController setSipFilter:FALSE];
|
||||
|
|
@ -136,6 +169,20 @@ typedef enum _HistoryView {
|
|||
}
|
||||
}
|
||||
|
||||
- (void)update {
|
||||
switch ([ContactSelection getSelectionMode]) {
|
||||
case ContactSelectionModePhone:
|
||||
case ContactSelectionModeMessage:
|
||||
[addButton setHidden:TRUE];
|
||||
[backButton setHidden:FALSE];
|
||||
break;
|
||||
default:
|
||||
[addButton setHidden:FALSE];
|
||||
[backButton setHidden:TRUE];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Action Functions
|
||||
|
||||
|
|
@ -149,15 +196,18 @@ typedef enum _HistoryView {
|
|||
|
||||
- (IBAction)onAddContactClick:(id)event {
|
||||
// Go to Contact details view
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ContactDetails push:TRUE], ContactDetailsViewController);
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController);
|
||||
if(controller != nil) {
|
||||
if([tableController tempAddress] == nil) {
|
||||
if([ContactSelection getAddAddress] == nil) {
|
||||
[controller newContact];
|
||||
} else {
|
||||
[controller newContact:[tableController tempAddress]];
|
||||
[tableController setTempAddress:nil];
|
||||
[controller newContact:[ContactSelection getAddAddress]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onBackClick:(id)event {
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<object class="IBUIButton" id="257572356">
|
||||
<reference key="NSNextResponder" ref="95706395"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrameSize">{106, 58}</string>
|
||||
<string key="NSFrame">{{108, 0}, {106, 58}}</string>
|
||||
<reference key="NSSuperview" ref="95706395"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="596330568"/>
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
<object class="IBUIButton" id="596330568">
|
||||
<reference key="NSNextResponder" ref="95706395"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{106, 0}, {106, 58}}</string>
|
||||
<string key="NSFrame">{{214, 0}, {106, 58}}</string>
|
||||
<reference key="NSSuperview" ref="95706395"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="600417980"/>
|
||||
|
|
@ -112,10 +112,10 @@
|
|||
<object class="IBUIButton" id="600417980">
|
||||
<reference key="NSNextResponder" ref="95706395"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{212, 0}, {108, 58}}</string>
|
||||
<string key="NSFrameSize">{108, 58}</string>
|
||||
<reference key="NSSuperview" ref="95706395"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="562388802"/>
|
||||
<reference key="NSNextKeyView" ref="1037245389"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<object class="IBUIAccessibilityConfiguration" key="IBUIAccessibilityConfiguration">
|
||||
|
|
@ -137,6 +137,34 @@
|
|||
<reference key="IBUIFontDescription" ref="1011869415"/>
|
||||
<reference key="IBUIFont" ref="895098900"/>
|
||||
</object>
|
||||
<object class="IBUIButton" id="1037245389">
|
||||
<reference key="NSNextResponder" ref="95706395"/>
|
||||
<int key="NSvFlags">-2147483356</int>
|
||||
<string key="NSFrameSize">{108, 58}</string>
|
||||
<reference key="NSSuperview" ref="95706395"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="562388802"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<object class="IBUIAccessibilityConfiguration" key="IBUIAccessibilityConfiguration">
|
||||
<string key="IBUIAccessibilityLabel">Add contact</string>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||
<int key="IBUIContentVerticalAlignment">0</int>
|
||||
<bool key="IBUIAdjustsImageWhenHighlighted">NO</bool>
|
||||
<reference key="IBUINormalTitleShadowColor" ref="873246362"/>
|
||||
<object class="NSCustomResource" key="IBUIHighlightedImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">contacts_back_over.png</string>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="IBUINormalImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">contacts_back_default.png</string>
|
||||
</object>
|
||||
<reference key="IBUIFontDescription" ref="1011869415"/>
|
||||
<reference key="IBUIFont" ref="895098900"/>
|
||||
</object>
|
||||
</array>
|
||||
<string key="NSFrameSize">{320, 58}</string>
|
||||
<reference key="NSSuperview" ref="812520855"/>
|
||||
|
|
@ -246,6 +274,22 @@
|
|||
</object>
|
||||
<int key="connectionID">84</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">backButton</string>
|
||||
<reference key="source" ref="841351856"/>
|
||||
<reference key="destination" ref="1037245389"/>
|
||||
</object>
|
||||
<int key="connectionID">90</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">addButton</string>
|
||||
<reference key="source" ref="841351856"/>
|
||||
<reference key="destination" ref="600417980"/>
|
||||
</object>
|
||||
<int key="connectionID">91</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onAllClick:</string>
|
||||
|
|
@ -297,6 +341,15 @@
|
|||
</object>
|
||||
<int key="connectionID">80</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onBackClick:</string>
|
||||
<reference key="source" ref="1037245389"/>
|
||||
<reference key="destination" ref="841351856"/>
|
||||
<int key="IBEventType">7</int>
|
||||
</object>
|
||||
<int key="connectionID">89</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
|
|
@ -330,9 +383,10 @@
|
|||
<int key="objectID">3</int>
|
||||
<reference key="object" ref="95706395"/>
|
||||
<array class="NSMutableArray" key="children">
|
||||
<reference ref="600417980"/>
|
||||
<reference ref="1037245389"/>
|
||||
<reference ref="257572356"/>
|
||||
<reference ref="596330568"/>
|
||||
<reference ref="600417980"/>
|
||||
</array>
|
||||
<reference key="parent" ref="812520855"/>
|
||||
<string key="objectName">toolBar</string>
|
||||
|
|
@ -368,6 +422,12 @@
|
|||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">tableController</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">87</int>
|
||||
<reference key="object" ref="1037245389"/>
|
||||
<reference key="parent" ref="95706395"/>
|
||||
<string key="objectName">backButton</string>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
|
@ -386,12 +446,14 @@
|
|||
<string key="69.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="76.CustomClassName">ContactsTableViewController</string>
|
||||
<string key="76.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="87.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<real value="0.0" key="87.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">86</int>
|
||||
<int key="maxID">91</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
@ -409,6 +471,7 @@
|
|||
<dictionary class="NSMutableDictionary" key="actions">
|
||||
<string key="onAddContactClick:">id</string>
|
||||
<string key="onAllClick:">id</string>
|
||||
<string key="onBackClick:">id</string>
|
||||
<string key="onLinphoneClick:">id</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="actionInfosByName">
|
||||
|
|
@ -420,22 +483,36 @@
|
|||
<string key="name">onAllClick:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onBackClick:">
|
||||
<string key="name">onBackClick:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo" key="onLinphoneClick:">
|
||||
<string key="name">onLinphoneClick:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="addButton">UIButton</string>
|
||||
<string key="allButton">UIButton</string>
|
||||
<string key="backButton">UIButton</string>
|
||||
<string key="linphoneButton">UIButton</string>
|
||||
<string key="tableController">ContactsTableViewController</string>
|
||||
<string key="tableView">UITableView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="addButton">
|
||||
<string key="name">addButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="allButton">
|
||||
<string key="name">allButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="backButton">
|
||||
<string key="name">backButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="linphoneButton">
|
||||
<string key="name">linphoneButton</string>
|
||||
<string key="candidateClassName">UIButton</string>
|
||||
|
|
@ -469,6 +546,8 @@
|
|||
<string key="contacts_add_over.png">{213, 117}</string>
|
||||
<string key="contacts_all_default.png">{213, 117}</string>
|
||||
<string key="contacts_all_selected.png">{213, 117}</string>
|
||||
<string key="contacts_back_default.png">{213, 117}</string>
|
||||
<string key="contacts_back_over.png">{213, 117}</string>
|
||||
<string key="contacts_linphone_default.png">{213, 117}</string>
|
||||
<string key="contacts_linphone_selected.png">{213, 117}</string>
|
||||
</dictionary>
|
||||
|
|
|
|||
|
|
@ -96,15 +96,19 @@
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"DialerViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = @"UIStateBar";
|
||||
description->stateBarEnabled = true;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"Dialer"
|
||||
content:@"DialerViewController"
|
||||
stateBar:@"UIStateBar"
|
||||
stateBarEnabled:true
|
||||
tabBar:@"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -223,14 +227,16 @@
|
|||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onAddContactClick: (id) event {
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Contacts push:TRUE], ContactsViewController);
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
[ContactSelection setAddAddress:[addressField text]];
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:[addressField text]];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onBackClick: (id) event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_InCall];
|
||||
[[PhoneMainView instance] changeCurrentView:[InCallViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
- (IBAction)onAddressChange: (id)sender {
|
||||
|
|
|
|||
|
|
@ -52,17 +52,20 @@
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"FirstLoginViewController";
|
||||
description->tabBar = nil;
|
||||
description->tabBarEnabled = false;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
}
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"FirstLogin"
|
||||
content:@"FirstLoginViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:nil
|
||||
tabBarEnabled:false
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
#pragma mark - ViewController Functions
|
||||
|
||||
|
|
@ -121,7 +124,7 @@
|
|||
{
|
||||
[[LinphoneManager instance].settingsStore setBool:false forKey:@"enable_first_login_view_preference"];
|
||||
[self.waitView setHidden:true];
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer];
|
||||
[[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]];
|
||||
break;
|
||||
}
|
||||
case LinphoneRegistrationNone:
|
||||
|
|
|
|||
|
|
@ -58,15 +58,19 @@
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"HistoryDetailsViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"HistoryDetails"
|
||||
content:@"HistoryDetailsViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:@"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -245,12 +249,12 @@
|
|||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onBackClick:(id)event {
|
||||
[[PhoneMainView instance] popView];
|
||||
[[PhoneMainView instance] popCurrentView];
|
||||
}
|
||||
|
||||
- (IBAction)onContactClick:(id)event {
|
||||
if(contact) {
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ContactDetails push:TRUE], ContactDetailsViewController);
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setContact:contact];
|
||||
}
|
||||
|
|
@ -258,9 +262,10 @@
|
|||
}
|
||||
|
||||
- (IBAction)onAddContactClick:(id)event {
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Contacts push:TRUE], ContactsViewController);
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
[ContactSelection setAddAddress:[[addressButton titleLabel] text]];
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription] push:TRUE], ContactsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:[[addressButton titleLabel] text]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -287,7 +292,7 @@
|
|||
}
|
||||
|
||||
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController);
|
||||
if(controller != nil) {
|
||||
if(displayName != nil) {
|
||||
[controller call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@
|
|||
|
||||
if(address != nil) {
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller call:address displayName:displayName];
|
||||
}
|
||||
|
|
@ -170,8 +170,8 @@
|
|||
if(editingStyle == UITableViewCellEditingStyleDelete) {
|
||||
[tableView beginUpdates];
|
||||
LinphoneCallLog *callLog = [[callLogs objectAtIndex:[indexPath row]] pointerValue];
|
||||
[callLogs removeObjectAtIndex:[indexPath row]];
|
||||
linphone_core_remove_call_log([LinphoneManager getLc], callLog);
|
||||
[callLogs removeObjectAtIndex:[indexPath row]];
|
||||
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||
[tableView endUpdates];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,15 +55,19 @@ typedef enum _HistoryView {
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"HistoryViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"History"
|
||||
content:@"HistoryViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:@"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -81,15 +81,19 @@ const NSInteger SECURE_BUTTON_TAG=5;
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"InCallViewController";
|
||||
description->tabBar = @"UICallBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = @"UIStateBar";
|
||||
description->stateBarEnabled = true;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"InCall"
|
||||
content:@"InCallViewController"
|
||||
stateBar:@"UIStateBar"
|
||||
stateBarEnabled:true
|
||||
tabBar:@"UICallBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -280,7 +284,7 @@ const NSInteger SECURE_BUTTON_TAG=5;
|
|||
[videoCameraSwitch setAlpha:0.0];
|
||||
[UIView commitAnimations];
|
||||
|
||||
if([[PhoneMainView instance] currentView] == PhoneView_InCall && videoShown)
|
||||
if([[[PhoneMainView instance] currentView] equal:[InCallViewController compositeViewDescription]] && videoShown)
|
||||
[[PhoneMainView instance] showTabBar: false];
|
||||
|
||||
if (hideControlsTimer) {
|
||||
|
|
|
|||
|
|
@ -143,14 +143,14 @@ int __aeabi_idiv(int a, int b) {
|
|||
- (void)setupUI {
|
||||
if ([[LinphoneManager instance].settingsStore boolForKey:@"enable_first_login_view_preference"] == true) {
|
||||
// Change to fist login view
|
||||
[[PhoneMainView instance] changeView: PhoneView_FirstLogin];
|
||||
[[PhoneMainView instance] changeCurrentView: [FirstLoginViewController compositeViewDescription]];
|
||||
} else {
|
||||
// Change to default view
|
||||
const MSList *list = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
|
||||
if(list != NULL) {
|
||||
[[PhoneMainView instance] changeView: PhoneView_Dialer];
|
||||
[[PhoneMainView instance] changeCurrentView: [DialerViewController compositeViewDescription]];
|
||||
} else {
|
||||
[[PhoneMainView instance] changeView: PhoneView_Wizard];
|
||||
[[PhoneMainView instance] changeCurrentView: [WizardViewController compositeViewDescription]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ int __aeabi_idiv(int a, int b) {
|
|||
} else if([notification.userInfo objectForKey:@"chat"] != nil) {
|
||||
NSString *remoteContact = (NSString*)[notification.userInfo objectForKey:@"chat"];
|
||||
// Go to ChatRoom view
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController);
|
||||
if(controller != nil) {
|
||||
[controller setRemoteAddress:remoteContact];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@
|
|||
- (IBAction)onOptionsTransferClick:(id)sender {
|
||||
[self hideOptions];
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:@""];
|
||||
[controller setTransferMode:TRUE];
|
||||
|
|
@ -381,7 +381,7 @@
|
|||
- (IBAction)onOptionsAddClick:(id)sender {
|
||||
[self hideOptions];
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:@""];
|
||||
[controller setTransferMode:FALSE];
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
- (IBAction)onDetailsClick: (id) event {
|
||||
// Go to Chat room view
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription] push:TRUE], ChatRoomViewController);
|
||||
if(controller !=nil) {
|
||||
[controller setRemoteAddress:[chat remoteContact]];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static UIFont *CELL_FONT = nil;
|
|||
if(chat != nil) {
|
||||
[chat release];
|
||||
}
|
||||
chat = achat;
|
||||
chat = [achat retain];
|
||||
[self update];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#import "LinphoneManager.h"
|
||||
|
||||
@interface UICompositeViewDescription: NSObject{
|
||||
@public
|
||||
NSString *name;
|
||||
NSString *content;
|
||||
NSString *stateBar;
|
||||
BOOL stateBarEnabled;
|
||||
|
|
@ -31,8 +31,18 @@
|
|||
BOOL tabBarEnabled;
|
||||
BOOL fullscreen;
|
||||
}
|
||||
|
||||
@property (retain) NSString *name;
|
||||
@property (retain) NSString *content;
|
||||
@property (retain) NSString *stateBar;
|
||||
@property (assign) BOOL stateBarEnabled;
|
||||
@property (retain) NSString *tabBar;
|
||||
@property (assign) BOOL tabBarEnabled;
|
||||
@property (assign) BOOL fullscreen;
|
||||
|
||||
- (id)copy;
|
||||
- (id)init:(NSString *)content stateBar:(NSString*)stateBar
|
||||
- (BOOL)equal:(UICompositeViewDescription*) description;
|
||||
- (id)init:(NSString *)name content:(NSString *)content stateBar:(NSString*)stateBar
|
||||
stateBarEnabled:(BOOL) stateBarEnabled
|
||||
tabBar:(NSString*)tabBar
|
||||
tabBarEnabled:(BOOL) tabBarEnabled
|
||||
|
|
|
|||
|
|
@ -21,32 +21,53 @@
|
|||
|
||||
@implementation UICompositeViewDescription
|
||||
|
||||
@synthesize name;
|
||||
@synthesize content;
|
||||
@synthesize stateBar;
|
||||
@synthesize stateBarEnabled;
|
||||
@synthesize tabBar;
|
||||
@synthesize tabBarEnabled;
|
||||
@synthesize fullscreen;
|
||||
|
||||
- (id)copy {
|
||||
UICompositeViewDescription *copy = [UICompositeViewDescription alloc];
|
||||
copy->content = self->content;
|
||||
copy->stateBar = self->stateBar;
|
||||
copy->stateBarEnabled = self->stateBarEnabled;
|
||||
copy->tabBar = self->tabBar;
|
||||
copy->tabBarEnabled = self->tabBarEnabled;
|
||||
copy->fullscreen = self->fullscreen;
|
||||
copy.content = self.content;
|
||||
copy.stateBar = self.stateBar;
|
||||
copy.stateBarEnabled = self.stateBarEnabled;
|
||||
copy.tabBar = self.tabBar;
|
||||
copy.tabBarEnabled = self.tabBarEnabled;
|
||||
copy.fullscreen = self.fullscreen;
|
||||
return copy;
|
||||
}
|
||||
|
||||
- (id)init:(NSString *)acontent stateBar:(NSString*)astateBar
|
||||
- (BOOL)equal:(UICompositeViewDescription*) description {
|
||||
return [self.name compare:description.name] == NSOrderedSame;
|
||||
}
|
||||
|
||||
- (id)init:(NSString *)aname content:(NSString *)acontent stateBar:(NSString*)astateBar
|
||||
stateBarEnabled:(BOOL) astateBarEnabled
|
||||
tabBar:(NSString*)atabBar
|
||||
tabBarEnabled:(BOOL) atabBarEnabled
|
||||
fullscreen:(BOOL) afullscreen {
|
||||
self->content = acontent;
|
||||
self->stateBar = astateBar;
|
||||
self->stateBarEnabled = astateBarEnabled;
|
||||
self->tabBar = atabBar;
|
||||
self->tabBarEnabled = atabBarEnabled;
|
||||
self->fullscreen = afullscreen;
|
||||
self.name = aname;
|
||||
self.content = acontent;
|
||||
self.stateBar = astateBar;
|
||||
self.stateBarEnabled = astateBarEnabled;
|
||||
self.tabBar = atabBar;
|
||||
self.tabBarEnabled = atabBarEnabled;
|
||||
self.fullscreen = afullscreen;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[name release];
|
||||
[content release];
|
||||
[stateBar release];
|
||||
[tabBar release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation UICompositeViewController
|
||||
|
|
@ -181,28 +202,28 @@
|
|||
// Animate only with a previous screen
|
||||
if(oldViewDescription != nil && viewTransition != nil) {
|
||||
[contentView.layer addAnimation:viewTransition forKey:@"Transition"];
|
||||
if((oldViewDescription->stateBarEnabled == true && currentViewDescription->stateBarEnabled == false) ||
|
||||
(oldViewDescription->stateBarEnabled == false && currentViewDescription->stateBarEnabled == true)) {
|
||||
if((oldViewDescription.stateBarEnabled == true && currentViewDescription.stateBarEnabled == false) ||
|
||||
(oldViewDescription.stateBarEnabled == false && currentViewDescription.stateBarEnabled == true)) {
|
||||
[stateBarView.layer addAnimation:viewTransition forKey:@"Transition"];
|
||||
}
|
||||
if(oldViewDescription->tabBar != currentViewDescription->tabBar) {
|
||||
if(oldViewDescription.tabBar != currentViewDescription.tabBar) {
|
||||
[tabBarView.layer addAnimation:viewTransition forKey:@"Transition"];
|
||||
}
|
||||
}
|
||||
|
||||
if(oldViewDescription != nil && contentViewController != nil && oldViewDescription->content != currentViewDescription->content) {
|
||||
if(oldViewDescription != nil && contentViewController != nil && oldViewDescription.content != currentViewDescription.content) {
|
||||
[UICompositeViewController removeSubView: contentViewController];
|
||||
}
|
||||
if(oldViewDescription != nil && tabBarViewController != nil && oldViewDescription->tabBar != currentViewDescription->tabBar) {
|
||||
if(oldViewDescription != nil && tabBarViewController != nil && oldViewDescription.tabBar != currentViewDescription.tabBar) {
|
||||
[UICompositeViewController removeSubView: tabBarViewController];
|
||||
}
|
||||
if(oldViewDescription != nil && stateBarViewController != nil && oldViewDescription->stateBar != currentViewDescription->stateBar) {
|
||||
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];
|
||||
stateBarViewController = [self getCachedController:description.stateBar];
|
||||
contentViewController = [self getCachedController:description.content];
|
||||
tabBarViewController = [self getCachedController:description.tabBar];
|
||||
}
|
||||
|
||||
if(currentViewDescription == nil) {
|
||||
|
|
@ -210,14 +231,14 @@
|
|||
}
|
||||
|
||||
if(tabBar != nil) {
|
||||
currentViewDescription->tabBarEnabled = [tabBar boolValue];
|
||||
currentViewDescription.tabBarEnabled = [tabBar boolValue];
|
||||
}
|
||||
|
||||
if(fullscreen != nil) {
|
||||
currentViewDescription->fullscreen = [fullscreen boolValue];
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:currentViewDescription->fullscreen withAnimation:UIStatusBarAnimationSlide ];
|
||||
currentViewDescription.fullscreen = [fullscreen boolValue];
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:currentViewDescription.fullscreen withAnimation:UIStatusBarAnimationSlide ];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:currentViewDescription->fullscreen withAnimation:UIStatusBarAnimationNone];
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:currentViewDescription.fullscreen withAnimation:UIStatusBarAnimationNone];
|
||||
}
|
||||
|
||||
// Start animation
|
||||
|
|
@ -235,10 +256,10 @@
|
|||
// Resize StateBar
|
||||
CGRect stateBarFrame = stateBarView.frame;
|
||||
int origin = IPHONE_STATUSBAR_HEIGHT;
|
||||
if(currentViewDescription->fullscreen)
|
||||
if(currentViewDescription.fullscreen)
|
||||
origin = 0;
|
||||
|
||||
if(stateBarViewController != nil && currentViewDescription->stateBarEnabled) {
|
||||
if(stateBarViewController != nil && currentViewDescription.stateBarEnabled) {
|
||||
contentFrame.origin.y = origin + stateBarFrame.size.height;
|
||||
stateBarFrame.origin.y = origin;
|
||||
} else {
|
||||
|
|
@ -248,7 +269,7 @@
|
|||
|
||||
// Resize TabBar
|
||||
CGRect tabFrame = tabBarView.frame;
|
||||
if(tabBarViewController != nil && currentViewDescription->tabBarEnabled) {
|
||||
if(tabBarViewController != nil && currentViewDescription.tabBarEnabled) {
|
||||
tabFrame.origin.y = viewFrame.size.height;
|
||||
tabFrame.origin.x = viewFrame.size.width;
|
||||
tabFrame.size.height = tabBarViewController.view.frame.size.height;
|
||||
|
|
@ -263,17 +284,19 @@
|
|||
}
|
||||
}
|
||||
} else {
|
||||
contentFrame.size.height = tabFrame.origin.y + tabFrame.size.height;
|
||||
contentFrame.size.height = viewFrame.size.height - contentFrame.origin.y;
|
||||
tabFrame.origin.y = viewFrame.size.height;
|
||||
}
|
||||
|
||||
if(currentViewDescription->fullscreen)
|
||||
if(currentViewDescription.fullscreen)
|
||||
contentFrame.size.height = viewFrame.size.height - contentFrame.origin.y;
|
||||
|
||||
// Resize innerView
|
||||
CGRect innerContentFrame = innerView.frame;
|
||||
innerContentFrame.size = contentFrame.size;
|
||||
|
||||
innerContentFrame.origin.x = 0;
|
||||
innerContentFrame.origin.y = 0;
|
||||
innerContentFrame.size.width = contentFrame.size.width;
|
||||
innerContentFrame.size.height = contentFrame.size.height;
|
||||
|
||||
// Set frames
|
||||
[contentView setFrame: contentFrame];
|
||||
|
|
@ -288,13 +311,13 @@
|
|||
|
||||
// Change view
|
||||
if(description != nil) {
|
||||
if(oldViewDescription == nil || oldViewDescription->content != currentViewDescription->content) {
|
||||
if(oldViewDescription == nil || oldViewDescription.content != currentViewDescription.content) {
|
||||
[UICompositeViewController addSubView: contentViewController view:contentView];
|
||||
}
|
||||
if(oldViewDescription == nil || oldViewDescription->tabBar != currentViewDescription->tabBar) {
|
||||
if(oldViewDescription == nil || oldViewDescription.tabBar != currentViewDescription.tabBar) {
|
||||
[UICompositeViewController addSubView: tabBarViewController view:tabBarView];
|
||||
}
|
||||
if(oldViewDescription == nil || oldViewDescription->stateBar != currentViewDescription->stateBar) {
|
||||
if(oldViewDescription == nil || oldViewDescription.stateBar != currentViewDescription.stateBar) {
|
||||
[UICompositeViewController addSubView: stateBarViewController view:stateBarView];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1296</int>
|
||||
<string key="IBDocument.SystemVersion">11D50</string>
|
||||
<string key="IBDocument.SystemVersion">11E53</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.32</string>
|
||||
<string key="IBDocument.HIToolboxVersion">568.00</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.47</string>
|
||||
<string key="IBDocument.HIToolboxVersion">569.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
|
|
@ -57,10 +57,7 @@
|
|||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="481442126"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<reference key="IBUIBackgroundColor" ref="572758541"/>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@
|
|||
- (IBAction)onDetails:(id) event {
|
||||
if(callLog != NULL) {
|
||||
// Go to History details view
|
||||
HistoryDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_HistoryDetails push:TRUE], HistoryDetailsViewController);
|
||||
HistoryDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[HistoryDetailsViewController compositeViewDescription] push:TRUE], HistoryDetailsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setCallLog:callLog];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,9 +125,9 @@
|
|||
}
|
||||
|
||||
- (void)changeViewEvent:(NSNotification*)notif {
|
||||
NSNumber *viewNumber = [notif.userInfo objectForKey: @"view"];
|
||||
if(viewNumber != nil)
|
||||
[self updateView:[viewNumber intValue]];
|
||||
//UICompositeViewDescription *view = [notif.userInfo objectForKey: @"view"];
|
||||
//if(view != nil)
|
||||
[self updateView:[[PhoneMainView instance] firstView]];
|
||||
}
|
||||
|
||||
- (void)textReceived:(NSNotification*)notif {
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
#pragma mark -
|
||||
|
||||
- (void)update {
|
||||
[self updateView:[[PhoneMainView instance] currentView]];
|
||||
[self updateView:[[PhoneMainView instance] firstView]];
|
||||
if([LinphoneManager isLcReady]) {
|
||||
[self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc])];
|
||||
} else {
|
||||
|
|
@ -228,35 +228,35 @@
|
|||
[target.layer removeAnimationForKey:animationID];
|
||||
}
|
||||
|
||||
- (void)updateView:(PhoneView) view {
|
||||
- (void)updateView:(UICompositeViewDescription*) view {
|
||||
// Reset missed call
|
||||
if(view == PhoneView_History) {
|
||||
if([view equal:[HistoryViewController compositeViewDescription]]) {
|
||||
linphone_core_reset_missed_calls_count([LinphoneManager getLc]);
|
||||
[self updateMissedCall:0];
|
||||
}
|
||||
|
||||
// Update buttons
|
||||
if(view == PhoneView_History || view == PhoneView_HistoryDetails) {
|
||||
if([view equal:[HistoryViewController compositeViewDescription]]) {
|
||||
historyButton.selected = TRUE;
|
||||
} else {
|
||||
historyButton.selected = FALSE;
|
||||
}
|
||||
if(view == PhoneView_Contacts || view == PhoneView_ContactDetails) {
|
||||
if([view equal:[ContactsViewController compositeViewDescription]]) {
|
||||
contactsButton.selected = TRUE;
|
||||
} else {
|
||||
contactsButton.selected = FALSE;
|
||||
}
|
||||
if(view == PhoneView_Dialer) {
|
||||
if([view equal:[DialerViewController compositeViewDescription]]) {
|
||||
dialerButton.selected = TRUE;
|
||||
} else {
|
||||
dialerButton.selected = FALSE;
|
||||
}
|
||||
if(view == PhoneView_Settings) {
|
||||
if([view equal:[SettingsViewController compositeViewDescription]]) {
|
||||
settingsButton.selected = TRUE;
|
||||
} else {
|
||||
settingsButton.selected = FALSE;
|
||||
}
|
||||
if(view == PhoneView_Chat || view == PhoneView_ChatRoom) {
|
||||
if([view equal:[ChatViewController compositeViewDescription]]) {
|
||||
chatButton.selected = TRUE;
|
||||
} else {
|
||||
chatButton.selected = FALSE;
|
||||
|
|
@ -267,24 +267,25 @@
|
|||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onHistoryClick: (id) sender {
|
||||
[[PhoneMainView instance] changeView:PhoneView_History];
|
||||
[[PhoneMainView instance] changeCurrentView:[HistoryViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
- (IBAction)onContactsClick: (id) event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Contacts];
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeNone];
|
||||
[ContactSelection setAddAddress:nil];
|
||||
[[PhoneMainView instance] changeCurrentView:[ContactsViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
- (IBAction)onDialerClick: (id) event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer];
|
||||
[[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
- (IBAction)onSettingsClick: (id) event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Settings];
|
||||
[[PhoneMainView instance] changeCurrentView:[SettingsViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
- (IBAction)onChatClick: (id) event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Chat];
|
||||
[[PhoneMainView instance] changeCurrentView:[ChatViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
ChatModel* line = nil;
|
||||
int err = sqlite3_step(sqlStatement);
|
||||
if (err == SQLITE_ROW) {
|
||||
line = [[ChatModel alloc] initWithData:sqlStatement];
|
||||
line = [[[ChatModel alloc] initWithData:sqlStatement] autorelease];
|
||||
} else if (err != SQLITE_DONE) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Error during execution of query: %s (%s)", sql, sqlite3_errmsg(database)];
|
||||
sqlite3_finalize(sqlStatement);
|
||||
|
|
@ -187,6 +187,7 @@
|
|||
while ((err = sqlite3_step(sqlStatement)) == SQLITE_ROW) {
|
||||
ChatModel *line = [[ChatModel alloc] initWithData:sqlStatement];
|
||||
[array addObject:line];
|
||||
[line release];
|
||||
}
|
||||
|
||||
if (err != SQLITE_DONE) {
|
||||
|
|
@ -219,6 +220,7 @@
|
|||
while ((err = sqlite3_step(sqlStatement)) == SQLITE_ROW) {
|
||||
ChatModel *line = [[ChatModel alloc] initWithData:sqlStatement];
|
||||
[array addObject:line];
|
||||
[line release];
|
||||
}
|
||||
|
||||
if (err != SQLITE_DONE) {
|
||||
|
|
|
|||
|
|
@ -37,45 +37,28 @@
|
|||
#import "FirstLoginViewController.h"
|
||||
#import "WizardViewController.h"
|
||||
|
||||
typedef enum _PhoneView {
|
||||
PhoneView_Wizard,
|
||||
PhoneView_FirstLogin,
|
||||
PhoneView_Dialer,
|
||||
PhoneView_History,
|
||||
PhoneView_HistoryDetails,
|
||||
PhoneView_Settings,
|
||||
PhoneView_Chat,
|
||||
PhoneView_ChatRoom,
|
||||
PhoneView_Contacts,
|
||||
PhoneView_ContactDetails,
|
||||
PhoneView_InCall,
|
||||
PhoneView_IncomingCall,
|
||||
PhoneView_END
|
||||
} PhoneView;
|
||||
|
||||
@interface PhoneMainView : UIViewController<CallActionSheetDelegate,UIModalViewDelegate> {
|
||||
@private
|
||||
UICompositeViewController *mainViewController;
|
||||
|
||||
NSMutableDictionary *viewDescriptions;
|
||||
|
||||
UIActionSheet *incomingCallActionSheet;
|
||||
UIActionSheet *batteryActionSheet;
|
||||
|
||||
int loadCount;
|
||||
|
||||
PhoneView currentView;
|
||||
NSMutableArray* viewStack;
|
||||
UICompositeViewDescription *currentView;
|
||||
NSMutableArray *viewStack;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UICompositeViewController *mainViewController;
|
||||
|
||||
- (UIViewController*)changeView:(PhoneView)view;
|
||||
- (UIViewController*)changeView:(PhoneView)view push:(BOOL)push;
|
||||
- (UIViewController*)popView;
|
||||
@property (readonly) UICompositeViewDescription *currentView;
|
||||
- (UIViewController*)changeCurrentView:(UICompositeViewDescription *)currentView;
|
||||
- (UIViewController*)changeCurrentView:(UICompositeViewDescription *)currentView push:(BOOL)push;
|
||||
- (UIViewController*)popCurrentView;
|
||||
- (void)popToView:(UICompositeViewDescription *)currentView;
|
||||
- (UICompositeViewDescription *)firstView;
|
||||
- (void)showTabBar:(BOOL)show;
|
||||
- (void)fullScreen:(BOOL)enabled;
|
||||
- (PhoneView)currentView;
|
||||
|
||||
+ (PhoneMainView*) instance;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,19 +29,16 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
@implementation PhoneMainView
|
||||
|
||||
@synthesize mainViewController;
|
||||
|
||||
@synthesize currentView;
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
- (void)initPhoneMainView {
|
||||
assert (!phoneMainViewInstance);
|
||||
phoneMainViewInstance = self;
|
||||
currentView = -1;
|
||||
currentView = nil;
|
||||
viewStack = [[NSMutableArray alloc] init];
|
||||
loadCount = 0; // For avoiding IOS 4 bug
|
||||
|
||||
// Init view descriptions
|
||||
viewDescriptions = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
|
|
@ -73,11 +70,8 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
|
||||
[mainViewController release];
|
||||
|
||||
[viewDescriptions removeAllObjects];
|
||||
[viewDescriptions release];
|
||||
|
||||
[viewStack release];
|
||||
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
@ -93,19 +87,6 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
|
||||
[self.view addSubview: mainViewController.view];
|
||||
[mainViewController.view setFrame:[self.view frame]];
|
||||
|
||||
// Init descriptions
|
||||
[viewDescriptions setObject:[ChatRoomViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_ChatRoom]];
|
||||
[viewDescriptions setObject:[ChatViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_Chat]];
|
||||
[viewDescriptions setObject:[DialerViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_Dialer]];
|
||||
[viewDescriptions setObject:[ContactsViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_Contacts]];
|
||||
[viewDescriptions setObject:[ContactDetailsViewController compositeViewDescription] forKey:[NSNumber numberWithInt:PhoneView_ContactDetails]];
|
||||
[viewDescriptions setObject:[HistoryViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_History]];
|
||||
[viewDescriptions setObject:[HistoryDetailsViewController compositeViewDescription] forKey:[NSNumber numberWithInt:PhoneView_HistoryDetails]];
|
||||
[viewDescriptions setObject:[InCallViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_InCall]];
|
||||
[viewDescriptions setObject:[SettingsViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_Settings]];
|
||||
[viewDescriptions setObject:[FirstLoginViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_FirstLogin]];
|
||||
[viewDescriptions setObject:[WizardViewController compositeViewDescription] forKey:[NSNumber numberWithInt: PhoneView_Wizard]];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
|
@ -237,7 +218,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
case LinphoneCallConnected:
|
||||
case LinphoneCallUpdated:
|
||||
{
|
||||
[self changeView:PhoneView_InCall];
|
||||
[self changeCurrentView:[InCallViewController compositeViewDescription]];
|
||||
break;
|
||||
}
|
||||
case LinphoneCallUpdatedByRemote:
|
||||
|
|
@ -246,7 +227,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
const LinphoneCallParams* remote = linphone_call_get_remote_params(call);
|
||||
|
||||
if (linphone_call_params_video_enabled(current) && !linphone_call_params_video_enabled(remote)) {
|
||||
[self changeView:PhoneView_InCall];
|
||||
[self changeCurrentView:[InCallViewController compositeViewDescription]];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -259,19 +240,19 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[self dismissIncomingCall:call];
|
||||
if (canHideInCallView) {
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([self changeView:PhoneView_Dialer], DialerViewController);
|
||||
DialerViewController *controller = DYNAMIC_CAST([self changeCurrentView:[DialerViewController compositeViewDescription]], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:@""];
|
||||
[controller setTransferMode:FALSE];
|
||||
}
|
||||
} else {
|
||||
[self changeView:PhoneView_InCall];
|
||||
[self changeCurrentView:[InCallViewController compositeViewDescription]];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LinphoneCallStreamsRunning:
|
||||
{
|
||||
[self changeView:PhoneView_InCall];
|
||||
[self changeCurrentView:[InCallViewController compositeViewDescription]];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -302,29 +283,29 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
return trans;
|
||||
}
|
||||
|
||||
+ (CATransition*)getTransition:(PhoneView)old new:(PhoneView)new {
|
||||
+ (CATransition*)getTransition:(UICompositeViewDescription *)old new:(UICompositeViewDescription *)new {
|
||||
bool left = false;
|
||||
|
||||
if(old == PhoneView_Chat || old == PhoneView_ChatRoom) {
|
||||
if(new == PhoneView_Contacts ||
|
||||
new == PhoneView_Dialer ||
|
||||
new == PhoneView_Settings ||
|
||||
new == PhoneView_History) {
|
||||
if([old equal:[ChatViewController compositeViewDescription]]) {
|
||||
if([new equal:[ContactsViewController compositeViewDescription]] ||
|
||||
[new equal:[DialerViewController compositeViewDescription]] ||
|
||||
[new equal:[SettingsViewController compositeViewDescription]] ||
|
||||
[new equal:[HistoryViewController compositeViewDescription]]) {
|
||||
left = true;
|
||||
}
|
||||
} else if(old == PhoneView_Settings) {
|
||||
if(new == PhoneView_Dialer ||
|
||||
new == PhoneView_Contacts ||
|
||||
new == PhoneView_History) {
|
||||
} else if([old equal:[SettingsViewController compositeViewDescription]]) {
|
||||
if([new equal:[DialerViewController compositeViewDescription]] ||
|
||||
[new equal:[ContactsViewController compositeViewDescription]] ||
|
||||
[new equal:[HistoryViewController compositeViewDescription]]) {
|
||||
left = true;
|
||||
}
|
||||
} else if(old == PhoneView_Dialer) {
|
||||
if(new == PhoneView_Contacts ||
|
||||
new == PhoneView_History) {
|
||||
} else if([old equal:[DialerViewController compositeViewDescription]]) {
|
||||
if([new equal:[ContactsViewController compositeViewDescription]] ||
|
||||
[new equal:[HistoryViewController compositeViewDescription]]) {
|
||||
left = true;
|
||||
}
|
||||
} else if(old == PhoneView_Contacts || old == PhoneView_ContactDetails) {
|
||||
if(new == PhoneView_History) {
|
||||
} else if([old equal:[ContactsViewController compositeViewDescription]]) {
|
||||
if([new equal:[HistoryViewController compositeViewDescription]]) {
|
||||
left = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -348,59 +329,60 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[mainViewController setFullScreen:enabled];
|
||||
}
|
||||
|
||||
- (UIViewController*)changeView:(PhoneView)view {
|
||||
return [self changeView:view push:FALSE];
|
||||
- (UIViewController*)changeCurrentView:(UICompositeViewDescription *)view {
|
||||
return [self changeCurrentView:view push:FALSE];
|
||||
}
|
||||
|
||||
- (UIViewController*)changeView:(PhoneView)view push:(BOOL)push {
|
||||
if(push && currentView != -1) {
|
||||
[viewStack addObject:[NSNumber numberWithInt: currentView]];
|
||||
} else {
|
||||
- (UIViewController*)changeCurrentView:(UICompositeViewDescription*)view push:(BOOL)push {
|
||||
if(!push) {
|
||||
[viewStack removeAllObjects];
|
||||
}
|
||||
return [self _changeView:view transition:nil];
|
||||
[viewStack addObject:view];
|
||||
return [self _changeCurrentView:view transition:nil];
|
||||
}
|
||||
|
||||
- (UIViewController*)_changeView:(PhoneView)view transition:(CATransition*)transition {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: change view %d", view];
|
||||
UICompositeViewDescription* description = [viewDescriptions objectForKey:[NSNumber numberWithInt: view]];
|
||||
if(description == nil)
|
||||
return nil;
|
||||
- (UIViewController*)_changeCurrentView:(UICompositeViewDescription*)view transition:(CATransition*)transition {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: change view %d", [view name]];
|
||||
|
||||
if(view != currentView) {
|
||||
if(![view equal: currentView]) {
|
||||
if(transition == nil)
|
||||
transition = [PhoneMainView getTransition:currentView new:view];
|
||||
[mainViewController setViewTransition:transition];
|
||||
[mainViewController changeView:description];
|
||||
[mainViewController changeView:view];
|
||||
currentView = view;
|
||||
}
|
||||
|
||||
NSDictionary* mdict = [NSMutableDictionary dictionaryWithObject: [NSNumber numberWithInt:currentView] forKey:@"view"];
|
||||
NSDictionary* mdict = [NSMutableDictionary dictionaryWithObject:currentView forKey:@"view"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneMainViewChange" object:self userInfo:mdict];
|
||||
|
||||
return [mainViewController getCurrentViewController];
|
||||
}
|
||||
|
||||
- (UIViewController*)popView {
|
||||
return [self popView:nil];
|
||||
- (void)popToView:(UICompositeViewDescription*)view {
|
||||
while([viewStack count] > 1 && ![[viewStack lastObject] equal:view]) {
|
||||
[viewStack removeLastObject];
|
||||
}
|
||||
[self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition]];
|
||||
}
|
||||
|
||||
- (UIViewController*)popView:(NSArray *)calls {
|
||||
- (UICompositeViewDescription *)firstView {
|
||||
UICompositeViewDescription *view = nil;
|
||||
if([viewStack count]) {
|
||||
view = [viewStack objectAtIndex:0];
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
- (UIViewController*)popCurrentView {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Pop view"];
|
||||
if([viewStack count] > 0) {
|
||||
PhoneView view = [[viewStack lastObject] intValue];
|
||||
[viewStack removeLastObject];
|
||||
[self _changeView:view transition:[PhoneMainView getBackwardTransition]];
|
||||
|
||||
[self _changeCurrentView:[viewStack lastObject] transition:[PhoneMainView getBackwardTransition]];
|
||||
return [mainViewController getCurrentViewController];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (PhoneView)currentView {
|
||||
return currentView;
|
||||
}
|
||||
|
||||
- (void)displayCallError:(LinphoneCall*) call message:(NSString*) message {
|
||||
const char* lUserNameChars=linphone_address_get_username(linphone_call_get_remote_address(call));
|
||||
NSString* lUserName = lUserNameChars?[[[NSString alloc] initWithUTF8String:lUserNameChars] autorelease]:NSLocalizedString(@"Unknown",nil);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">784</int>
|
||||
<string key="IBDocument.SystemVersion">11D50</string>
|
||||
<string key="IBDocument.SystemVersion">11E53</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.32</string>
|
||||
<string key="IBDocument.HIToolboxVersion">568.00</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.47</string>
|
||||
<string key="IBDocument.HIToolboxVersion">569.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">1181</string>
|
||||
|
|
|
|||
|
|
@ -34,15 +34,19 @@
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"SettingsViewController";
|
||||
description->tabBar = @"UIMainBar";
|
||||
description->tabBarEnabled = true;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"Settings"
|
||||
content:@"SettingsViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar: @"UIMainBar"
|
||||
tabBarEnabled:true
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
ABAddressBookRef addressBook;
|
||||
}
|
||||
|
||||
+ (BOOL)isSipURI:(NSString*)address;
|
||||
+ (NSString*)getContactDisplayName:(ABRecordRef)contact;
|
||||
+ (UIImage*)getContactImage:(ABRecordRef)contact thumbnail:(BOOL)thumbnail;
|
||||
- (ABRecordRef)getContact:(NSString*)address;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
if (contact && ABPersonHasImageData(contact)) {
|
||||
CFDataRef imgData = ABPersonCopyImageDataWithFormat(contact, thumbnail?
|
||||
kABPersonImageFormatThumbnail: kABPersonImageFormatOriginalSize);
|
||||
retImage = [[[UIImage alloc] initWithData:(NSData *)imgData] autorelease];
|
||||
retImage = [UIImage imageWithData:(NSData *)imgData];
|
||||
CFRelease(imgData);
|
||||
}
|
||||
return retImage;
|
||||
|
|
@ -51,6 +51,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
+ (BOOL)isSipURI:(NSString*)address {
|
||||
return [address hasPrefix:@"sip:"];
|
||||
}
|
||||
|
||||
+ (NSString*)appendCountryCodeIfPossible:(NSString*)number {
|
||||
if (![number hasPrefix:@"+"] && ![number hasPrefix:@"00"]) {
|
||||
NSString* lCountryCode = [[LinphoneManager instance].settingsStore objectForKey:@"countrycode_preference"];
|
||||
|
|
@ -63,7 +67,11 @@
|
|||
}
|
||||
|
||||
+ (NSString*)normalizeSipURI:(NSString*)address {
|
||||
return address;
|
||||
NSString* ret = address;
|
||||
if(![address hasPrefix:@"sip:"]) {
|
||||
ret = [@"sip:" stringByAppendingString:ret];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ (NSString*)normalizePhoneNumber:(NSString*)address {
|
||||
|
|
|
|||
|
|
@ -78,15 +78,19 @@ typedef enum _ViewElement {
|
|||
|
||||
#pragma mark - UICompositeViewDelegate Functions
|
||||
|
||||
+ (UICompositeViewDescription*) compositeViewDescription {
|
||||
UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
||||
description->content = @"WizardViewController";
|
||||
description->tabBar = nil;
|
||||
description->tabBarEnabled = false;
|
||||
description->stateBar = nil;
|
||||
description->stateBarEnabled = false;
|
||||
description->fullscreen = false;
|
||||
return description;
|
||||
static UICompositeViewDescription *compositeDescription = nil;
|
||||
|
||||
+ (UICompositeViewDescription *)compositeViewDescription {
|
||||
if(compositeDescription == nil) {
|
||||
compositeDescription = [[UICompositeViewDescription alloc] init:@"Wizard"
|
||||
content:@"WizardViewController"
|
||||
stateBar:nil
|
||||
stateBarEnabled:false
|
||||
tabBar:nil
|
||||
tabBarEnabled:false
|
||||
fullscreen:false];
|
||||
}
|
||||
return compositeDescription;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -185,7 +189,7 @@ UICompositeViewDescription *description = [UICompositeViewDescription alloc];
|
|||
}
|
||||
|
||||
- (IBAction)onCancelClick:(id)sender {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer];
|
||||
[[PhoneMainView instance] changeCurrentView:[DialerViewController compositeViewDescription]];
|
||||
}
|
||||
|
||||
- (IBAction)onCreateAccountClick:(id)sender {
|
||||
|
|
|
|||
BIN
Resources/contacts_back_default.png
Normal file
BIN
Resources/contacts_back_default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
Resources/contacts_back_over.png
Normal file
BIN
Resources/contacts_back_over.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -169,6 +169,10 @@
|
|||
C9C8254D15AE207B00D493FA /* options_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = C9C8254B15AE207B00D493FA /* options_selected.png */; };
|
||||
C9C8254F15AE256100D493FA /* transfer_call_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = C9C8254E15AE256100D493FA /* transfer_call_disabled.png */; };
|
||||
C9C8255015AE256100D493FA /* transfer_call_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = C9C8254E15AE256100D493FA /* transfer_call_disabled.png */; };
|
||||
D3119E7215B6A4710005D4A4 /* contacts_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3119E7015B6A4710005D4A4 /* contacts_back_default.png */; };
|
||||
D3119E7315B6A4710005D4A4 /* contacts_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3119E7015B6A4710005D4A4 /* contacts_back_default.png */; };
|
||||
D3119E7415B6A4710005D4A4 /* contacts_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3119E7115B6A4710005D4A4 /* contacts_back_over.png */; };
|
||||
D3119E7515B6A4710005D4A4 /* contacts_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3119E7115B6A4710005D4A4 /* contacts_back_over.png */; };
|
||||
D3128FE115AABC7E00A2147A /* ContactDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3128FDF15AABC7E00A2147A /* ContactDetailsViewController.m */; };
|
||||
D3128FE215AABC7E00A2147A /* ContactDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3128FDF15AABC7E00A2147A /* ContactDetailsViewController.m */; };
|
||||
D3128FE315AABC7E00A2147A /* ContactDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3128FE015AABC7E00A2147A /* ContactDetailsViewController.xib */; };
|
||||
|
|
@ -1091,6 +1095,8 @@
|
|||
C9C8254215AE204D00D493FA /* transfer_call_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = transfer_call_over.png; path = Resources/transfer_call_over.png; sourceTree = "<group>"; };
|
||||
C9C8254B15AE207B00D493FA /* options_selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_selected.png; path = Resources/options_selected.png; sourceTree = "<group>"; };
|
||||
C9C8254E15AE256100D493FA /* transfer_call_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = transfer_call_disabled.png; path = Resources/transfer_call_disabled.png; sourceTree = "<group>"; };
|
||||
D3119E7015B6A4710005D4A4 /* contacts_back_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contacts_back_default.png; path = Resources/contacts_back_default.png; sourceTree = "<group>"; };
|
||||
D3119E7115B6A4710005D4A4 /* contacts_back_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contacts_back_over.png; path = Resources/contacts_back_over.png; sourceTree = "<group>"; };
|
||||
D3128FDE15AABC7E00A2147A /* ContactDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailsViewController.h; sourceTree = "<group>"; };
|
||||
D3128FDF15AABC7E00A2147A /* ContactDetailsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailsViewController.m; sourceTree = "<group>"; };
|
||||
D3128FE015AABC7E00A2147A /* ContactDetailsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ContactDetailsViewController.xib; sourceTree = "<group>"; };
|
||||
|
|
@ -2172,6 +2178,8 @@
|
|||
D354980F15875608000081D8 /* contacts_add_over.png */,
|
||||
D354980315875534000081D8 /* contacts_all_default.png */,
|
||||
D354980215875534000081D8 /* contacts_all_selected.png */,
|
||||
D3119E7015B6A4710005D4A4 /* contacts_back_default.png */,
|
||||
D3119E7115B6A4710005D4A4 /* contacts_back_over.png */,
|
||||
D38327EB1580FE3A00FA0D23 /* contacts_default.png */,
|
||||
D354980515875534000081D8 /* contacts_linphone_default.png */,
|
||||
D354980415875534000081D8 /* contacts_linphone_selected.png */,
|
||||
|
|
@ -2823,6 +2831,8 @@
|
|||
D3157A8C15B4466F00DD8C4C /* history_add_over.png in Resources */,
|
||||
D3157A9015B446CB00DD8C4C /* history_back_default.png in Resources */,
|
||||
D3157A9215B446CB00DD8C4C /* history_back_over.png in Resources */,
|
||||
D3119E7215B6A4710005D4A4 /* contacts_back_default.png in Resources */,
|
||||
D3119E7415B6A4710005D4A4 /* contacts_back_over.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -3073,6 +3083,8 @@
|
|||
D3157A8D15B4466F00DD8C4C /* history_add_over.png in Resources */,
|
||||
D3157A9115B446CB00DD8C4C /* history_back_default.png in Resources */,
|
||||
D3157A9315B446CB00DD8C4C /* history_back_over.png in Resources */,
|
||||
D3119E7315B6A4710005D4A4 /* contacts_back_default.png in Resources */,
|
||||
D3119E7515B6A4710005D4A4 /* contacts_back_over.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue