forked from mirrors/linphone-iphone
Remove AbstractCall
This commit is contained in:
parent
4e5f50edee
commit
05413c9bb4
17 changed files with 165 additions and 271 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#import "PhoneMainView.h"
|
||||
#import "UACellBackgroundView.h"
|
||||
#import "UILinphone.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation ChatTableViewController
|
||||
|
||||
|
|
@ -90,11 +91,10 @@
|
|||
ChatModel *chat = [data objectAtIndex:[indexPath row]];
|
||||
|
||||
// Go to ChatRoom view
|
||||
[[PhoneMainView instance] changeView:PhoneView_ChatRoom
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"setRemoteContact:", [chat remoteContact]],
|
||||
nil]
|
||||
push:TRUE];
|
||||
ChatRoomTableViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomTableViewController);
|
||||
if(controller != nil) {
|
||||
[controller setRemoteContact:[chat remoteContact]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#import "UILinphone.h"
|
||||
#import "OrderedDictionary.h"
|
||||
#import "FastAddressBook.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@interface Entry : NSObject
|
||||
|
||||
|
|
@ -454,10 +455,10 @@
|
|||
NSString *displayName = [FastAddressBook getContactDisplayName:contact];
|
||||
|
||||
// Go to dialer view
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"call:displayName:", dest, displayName],
|
||||
nil]];
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller call:dest displayName:displayName];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSString *key = nil;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#import "PhoneMainView.h"
|
||||
#import "UACellBackgroundView.h"
|
||||
#import "UILinphone.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation ContactsTableViewController
|
||||
|
||||
|
|
@ -193,14 +194,15 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
ABRecordRef lPerson = [subDic objectForKey: [subDic keyAtIndex:[indexPath row]]];
|
||||
|
||||
// Go to Contact details view
|
||||
NSArray * calls;
|
||||
if(tempAddress == nil) {
|
||||
calls = [NSArray arrayWithObject: [AbstractCall abstractCall:@"setContact:", lPerson]];
|
||||
} else {
|
||||
calls = [NSArray arrayWithObject: [AbstractCall abstractCall:@"editContact:address:", lPerson, tempAddress]];
|
||||
[self setTempAddress:nil];
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ContactDetails push:TRUE], ContactDetailsViewController);
|
||||
if(controller != nil) {
|
||||
if(tempAddress == nil) {
|
||||
[controller setContact:lPerson];
|
||||
} else {
|
||||
[controller editContact:lPerson address:tempAddress];
|
||||
[self setTempAddress:nil];
|
||||
}
|
||||
}
|
||||
[[PhoneMainView instance] changeView:PhoneView_ContactDetails calls:calls push:TRUE];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@
|
|||
|
||||
#import "ContactsViewController.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "Utils.h"
|
||||
|
||||
#import "AddressBook/ABPerson.h"
|
||||
#import <AddressBook/ABPerson.h>
|
||||
|
||||
@implementation ContactsViewController
|
||||
|
||||
|
|
@ -149,14 +150,15 @@ typedef enum _HistoryView {
|
|||
|
||||
- (IBAction)onAddContactClick:(id)event {
|
||||
// Go to Contact details view
|
||||
NSArray * calls;
|
||||
if([tableController tempAddress] == nil) {
|
||||
calls = [NSArray arrayWithObject: [AbstractCall abstractCall:@"newContact"]];
|
||||
} else {
|
||||
calls = [NSArray arrayWithObject: [AbstractCall abstractCall:@"newContact:", [tableController tempAddress]]];
|
||||
[tableController setTempAddress:nil];
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ContactDetails push:TRUE], ContactDetailsViewController);
|
||||
if(controller != nil) {
|
||||
if([tableController tempAddress] == nil) {
|
||||
[controller newContact];
|
||||
} else {
|
||||
[controller newContact:[tableController tempAddress]];
|
||||
[tableController setTempAddress:nil];
|
||||
}
|
||||
}
|
||||
[[PhoneMainView instance] changeView:PhoneView_ContactDetails calls:calls push:TRUE];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -55,10 +55,11 @@
|
|||
}
|
||||
|
||||
- (void)setAddress:(NSString*)address;
|
||||
- (void)setTransferMode:(NSNumber*)enable;
|
||||
- (void)call:(NSString*)address displayName:(NSString *)displayName;
|
||||
- (void)call:(NSString*)address;
|
||||
|
||||
@property (nonatomic, assign) BOOL transferMode;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UITextField* addressField;
|
||||
@property (nonatomic, retain) IBOutlet UIButton* addContactButton;
|
||||
@property (nonatomic, retain) IBOutlet UICallButton* callButton;
|
||||
|
|
|
|||
|
|
@ -24,12 +24,15 @@
|
|||
#import "IncallViewController.h"
|
||||
#import "LinphoneManager.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "Utils.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
||||
@implementation DialerViewController
|
||||
|
||||
@synthesize transferMode;
|
||||
|
||||
@synthesize addressField;
|
||||
@synthesize addContactButton;
|
||||
@synthesize cancelButton;
|
||||
|
|
@ -186,8 +189,8 @@
|
|||
[addressField setText:address];
|
||||
}
|
||||
|
||||
- (void)setTransferMode:(NSNumber*) n {
|
||||
transferMode = [n boolValue];
|
||||
- (void)setTransferMode:(BOOL)atransferMode {
|
||||
transferMode = atransferMode;
|
||||
LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]);
|
||||
LinphoneCallState state = (call != NULL)?linphone_call_get_state(call): 0;
|
||||
[self callUpdate:call state:state];
|
||||
|
|
@ -220,9 +223,10 @@
|
|||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onAddContactClick: (id) event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Contacts
|
||||
calls:[NSArray arrayWithObject:[AbstractCall abstractCall:@"setAddress:", [addressField text]]]
|
||||
push:TRUE];
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Contacts push:TRUE], ContactsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:[addressField text]];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onBackClick: (id) event {
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@
|
|||
@property (nonatomic, retain) IBOutlet UIButton *addContactButton;
|
||||
@property (nonatomic, assign) LinphoneCallLog *callLog;
|
||||
|
||||
- (void)setCallLogValue:(NSValue*)vcallLog;
|
||||
|
||||
- (IBAction)onBackClick:(id)event;
|
||||
- (IBAction)onContactClick:(id)event;
|
||||
- (IBAction)onAddContactClick:(id)event;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#import "HistoryDetailsViewController.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "FastAddressBook.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation HistoryDetailsViewController
|
||||
|
||||
|
|
@ -71,10 +72,6 @@
|
|||
|
||||
#pragma mark - Property Functions
|
||||
|
||||
- (void)setCallLogValue:(NSValue*)vcallLog {
|
||||
[self setCallLog:[vcallLog pointerValue]];
|
||||
}
|
||||
|
||||
- (void)setCallLog:(LinphoneCallLog *)acallLog {
|
||||
self->callLog = acallLog;
|
||||
[self update];
|
||||
|
|
@ -254,16 +251,18 @@
|
|||
|
||||
- (IBAction)onContactClick:(id)event {
|
||||
if(contact) {
|
||||
[[PhoneMainView instance] changeView:PhoneView_ContactDetails
|
||||
calls:[NSArray arrayWithObject:[AbstractCall abstractCall:@"setContact:", contact]]
|
||||
push:TRUE];
|
||||
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ContactDetails push:TRUE], ContactDetailsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setContact:contact];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onAddContactClick:(id)event {
|
||||
[[PhoneMainView instance] changeView:PhoneView_Contacts
|
||||
calls:[NSArray arrayWithObject:[AbstractCall abstractCall:@"setAddress:", [[addressButton titleLabel] text]]]
|
||||
push:TRUE];
|
||||
ContactsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Contacts push:TRUE], ContactsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:[[addressButton titleLabel] text]];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onAddressClick:(id)event {
|
||||
|
|
@ -288,18 +287,14 @@
|
|||
displayName = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
|
||||
if(displayName != nil) {
|
||||
// Go to dialer view
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"call:displayName:", [NSString stringWithUTF8String:lAddress], displayName],
|
||||
nil]];
|
||||
} else {
|
||||
// Go to dialer view
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"call:", [NSString stringWithUTF8String:lAddress]],
|
||||
nil]];
|
||||
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
if(displayName != nil) {
|
||||
[controller call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
|
||||
} else {
|
||||
[controller call:[NSString stringWithUTF8String:lAddress]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#import "PhoneMainView.h"
|
||||
#import "UACellBackgroundView.h"
|
||||
#import "UILinphone.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation HistoryTableViewController
|
||||
|
||||
|
|
@ -123,38 +124,46 @@
|
|||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:NO];
|
||||
|
||||
LinphoneCallLog *log = [[callLogs objectAtIndex:[indexPath row]] pointerValue];
|
||||
LinphoneAddress* partyToCall;
|
||||
if (log->dir == LinphoneCallIncoming) {
|
||||
partyToCall=log->from;
|
||||
LinphoneCallLog *callLog = [[callLogs objectAtIndex:[indexPath row]] pointerValue];
|
||||
LinphoneAddress* addr;
|
||||
if (callLog->dir == LinphoneCallIncoming) {
|
||||
addr = callLog->from;
|
||||
} else {
|
||||
partyToCall=log->to;
|
||||
}
|
||||
const char* username = linphone_address_get_username(partyToCall)!=0?linphone_address_get_username(partyToCall):"";
|
||||
const char* displayName = linphone_address_get_display_name(partyToCall)!=0?linphone_address_get_display_name(partyToCall):"";
|
||||
const char* domain = linphone_address_get_domain(partyToCall);
|
||||
|
||||
LinphoneProxyConfig* proxyCfg;
|
||||
linphone_core_get_default_proxy([LinphoneManager getLc],&proxyCfg);
|
||||
|
||||
NSString* phoneNumber;
|
||||
|
||||
if (proxyCfg && (strcmp(domain, linphone_proxy_config_get_domain(proxyCfg)) == 0)) {
|
||||
phoneNumber = [[NSString alloc] initWithCString:username encoding:[NSString defaultCStringEncoding]];
|
||||
} else {
|
||||
phoneNumber = [[NSString alloc] initWithCString:linphone_address_as_string_uri_only(partyToCall) encoding:[NSString defaultCStringEncoding]];
|
||||
addr = callLog->to;
|
||||
}
|
||||
|
||||
NSString* dispName = [[NSString alloc] initWithCString:displayName encoding:[NSString defaultCStringEncoding]];
|
||||
NSString* displayName = nil;
|
||||
NSString* address = nil;
|
||||
if(addr != NULL) {
|
||||
BOOL useLinphoneAddress = true;
|
||||
// contact name
|
||||
const char* lAddress = linphone_address_as_string_uri_only(addr);
|
||||
if(lAddress) {
|
||||
address = [NSString stringWithUTF8String:lAddress];
|
||||
NSString *normalizedSipAddress = [FastAddressBook normalizeSipURI:address];
|
||||
ABRecordRef contact = [[[LinphoneManager instance] fastAddressBook] getContact:normalizedSipAddress];
|
||||
if(contact) {
|
||||
displayName = [FastAddressBook getContactDisplayName:contact];
|
||||
useLinphoneAddress = false;
|
||||
}
|
||||
}
|
||||
if(useLinphoneAddress) {
|
||||
const char* lDisplayName = linphone_address_get_display_name(addr);
|
||||
const char* lUserName = linphone_address_get_username(addr);
|
||||
if (lDisplayName)
|
||||
displayName = [NSString stringWithUTF8String:lDisplayName];
|
||||
else if(lUserName)
|
||||
displayName = [NSString stringWithUTF8String:lUserName];
|
||||
}
|
||||
}
|
||||
|
||||
// Go to dialer view
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"call:displayName:", phoneNumber, dispName],
|
||||
nil]];
|
||||
|
||||
[phoneNumber release];
|
||||
[dispName release];
|
||||
if(address != nil) {
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller call:address displayName:displayName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#import "CPAnimationSequence.h"
|
||||
#import "CPAnimationStep.h"
|
||||
#import "Utils.h"
|
||||
|
||||
#include "linphonecore.h"
|
||||
#include "private.h"
|
||||
|
|
@ -366,21 +367,21 @@
|
|||
- (IBAction)onOptionsTransferClick:(id)sender {
|
||||
[self hideOptions];
|
||||
// Go to dialer view
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"setAddress:", @""],
|
||||
[AbstractCall abstractCall:@"setTransferMode:", [NSNumber numberWithInt: TRUE]],
|
||||
nil]];
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:@""];
|
||||
[controller setTransferMode:TRUE];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onOptionsAddClick:(id)sender {
|
||||
[self hideOptions];
|
||||
// Go to dialer view
|
||||
[[PhoneMainView instance] changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"setAddress:", @""],
|
||||
[AbstractCall abstractCall:@"setTransferMode:", [NSNumber numberWithInt: FALSE]],
|
||||
nil]];
|
||||
// Go to dialer view
|
||||
DialerViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:@""];
|
||||
[controller setTransferMode:FALSE];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onOptionsClick:(id)sender {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#import "UIChatCell.h"
|
||||
#import "PhoneMainView.h"
|
||||
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation UIChatCell
|
||||
|
||||
|
|
@ -125,11 +125,10 @@
|
|||
|
||||
- (IBAction)onDetailsClick: (id) event {
|
||||
// Go to Chat room view
|
||||
[[PhoneMainView instance] changeView:PhoneView_ChatRoom
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"setRemoteContact:", [chat remoteContact]],
|
||||
nil]
|
||||
push:TRUE];
|
||||
ChatRoomViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_ChatRoom push:TRUE], ChatRoomViewController);
|
||||
if(controller !=nil) {
|
||||
[controller setRemoteContact:[chat remoteContact]];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onDeleteClick: (id) event {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#import "UIHistoryCell.h"
|
||||
#import "LinphoneManager.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation UIHistoryCell
|
||||
|
||||
|
|
@ -69,11 +70,10 @@
|
|||
- (IBAction)onDetails:(id) event {
|
||||
if(callLog != NULL) {
|
||||
// Go to History details view
|
||||
[[PhoneMainView instance] changeView:PhoneView_HistoryDetails
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"setCallLogValue:", [NSValue valueWithPointer: callLog]],
|
||||
nil]
|
||||
push:TRUE];
|
||||
HistoryDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeView:PhoneView_HistoryDetails push:TRUE], HistoryDetailsViewController);
|
||||
if(controller != nil) {
|
||||
[controller setCallLog:callLog];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,22 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "LinphoneManager.h"
|
||||
#import "CallDelegate.h"
|
||||
#import "UICompositeViewController.h"
|
||||
#import "UIModalViewController.h"
|
||||
#import "AbstractCall.h"
|
||||
|
||||
#import "FirstLoginViewController.h"
|
||||
#import "IncomingCallViewController.h"
|
||||
#import "ChatRoomViewController.h"
|
||||
#import "ChatViewController.h"
|
||||
#import "DialerViewController.h"
|
||||
#import "ContactsViewController.h"
|
||||
#import "ContactDetailsViewController.h"
|
||||
#import "HistoryViewController.h"
|
||||
#import "HistoryDetailsViewController.h"
|
||||
#import "InCallViewController.h"
|
||||
#import "SettingsViewController.h"
|
||||
#import "FirstLoginViewController.h"
|
||||
#import "WizardViewController.h"
|
||||
|
||||
typedef enum _PhoneView {
|
||||
PhoneView_Wizard,
|
||||
|
|
@ -58,12 +70,9 @@ typedef enum _PhoneView {
|
|||
|
||||
@property (nonatomic, retain) IBOutlet UICompositeViewController *mainViewController;
|
||||
|
||||
- (void)changeView:(PhoneView)view;
|
||||
- (void)changeView:(PhoneView)view push:(BOOL)push;
|
||||
- (void)changeView:(PhoneView)view calls:(NSArray *)calls;
|
||||
- (void)changeView:(PhoneView)view calls:(NSArray *)calls push:(BOOL)push;
|
||||
- (void)popView;
|
||||
- (void)popView:(NSArray *)calls;
|
||||
- (UIViewController*)changeView:(PhoneView)view;
|
||||
- (UIViewController*)changeView:(PhoneView)view push:(BOOL)push;
|
||||
- (UIViewController*)popView;
|
||||
- (void)showTabBar:(BOOL)show;
|
||||
- (void)fullScreen:(BOOL)enabled;
|
||||
- (PhoneView)currentView;
|
||||
|
|
|
|||
|
|
@ -20,22 +20,7 @@
|
|||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
#import "PhoneMainView.h"
|
||||
|
||||
#import "FirstLoginViewController.h"
|
||||
#import "IncomingCallViewController.h"
|
||||
|
||||
#import "ChatRoomViewController.h"
|
||||
#import "ChatViewController.h"
|
||||
#import "DialerViewController.h"
|
||||
#import "ContactsViewController.h"
|
||||
#import "ContactDetailsViewController.h"
|
||||
#import "HistoryViewController.h"
|
||||
#import "HistoryDetailsViewController.h"
|
||||
#import "InCallViewController.h"
|
||||
#import "SettingsViewController.h"
|
||||
#import "FirstLoginViewController.h"
|
||||
#import "WizardViewController.h"
|
||||
|
||||
#import "Utils.h"
|
||||
#import "UIView+ModalStack.h"
|
||||
|
||||
static PhoneMainView* phoneMainViewInstance=nil;
|
||||
|
|
@ -236,11 +221,11 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[self dismissIncomingCall:call];
|
||||
if (canHideInCallView) {
|
||||
// Go to dialer view
|
||||
[self changeView:PhoneView_Dialer
|
||||
calls:[NSArray arrayWithObjects:
|
||||
[AbstractCall abstractCall:@"setAddress:", @""],
|
||||
[AbstractCall abstractCall:@"setTransferMode:", [NSNumber numberWithInt: FALSE]],
|
||||
nil]];
|
||||
DialerViewController *controller = DYNAMIC_CAST([self changeView:PhoneView_Dialer], DialerViewController);
|
||||
if(controller != nil) {
|
||||
[controller setAddress:@""];
|
||||
[controller setTransferMode:FALSE];
|
||||
}
|
||||
} else {
|
||||
[self changeView:PhoneView_InCall];
|
||||
}
|
||||
|
|
@ -325,32 +310,24 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[mainViewController setFullScreen:enabled];
|
||||
}
|
||||
|
||||
- (void)changeView:(PhoneView)view {
|
||||
[self changeView:view calls:nil push:FALSE];
|
||||
- (UIViewController*)changeView:(PhoneView)view {
|
||||
return [self changeView:view push:FALSE];
|
||||
}
|
||||
|
||||
- (void)changeView:(PhoneView)view calls:(NSArray *)dict {
|
||||
[self changeView:view calls:dict push:FALSE];
|
||||
}
|
||||
|
||||
- (void)changeView:(PhoneView)view push:(BOOL)push {
|
||||
[self changeView:view calls:nil push:push];
|
||||
}
|
||||
|
||||
- (void)changeView:(PhoneView)view calls:(NSArray *)calls push:(BOOL)push {
|
||||
- (UIViewController*)changeView:(PhoneView)view push:(BOOL)push {
|
||||
if(push && currentView != -1) {
|
||||
[viewStack addObject:[NSNumber numberWithInt: currentView]];
|
||||
} else {
|
||||
[viewStack removeAllObjects];
|
||||
}
|
||||
[self _changeView:view calls:calls transition:nil];
|
||||
return [self _changeView:view transition:nil];
|
||||
}
|
||||
|
||||
- (void)_changeView:(PhoneView)view calls:(NSArray *)calls transition:(CATransition*)transition {
|
||||
- (UIViewController*)_changeView:(PhoneView)view transition:(CATransition*)transition {
|
||||
NSLog(@"PhoneMainView: change view %d", view);
|
||||
UICompositeViewDescription* description = [viewDescriptions objectForKey:[NSNumber numberWithInt: view]];
|
||||
if(description == nil)
|
||||
return;
|
||||
return nil;
|
||||
|
||||
if(view != currentView) {
|
||||
if(transition == nil)
|
||||
|
|
@ -360,28 +337,26 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
currentView = view;
|
||||
}
|
||||
|
||||
// Call abstractCall
|
||||
if(calls != nil) {
|
||||
for(AbstractCall *call in calls) {
|
||||
[call call:[mainViewController getCurrentViewController]];
|
||||
}
|
||||
}
|
||||
|
||||
NSDictionary* mdict = [NSMutableDictionary dictionaryWithObject: [NSNumber numberWithInt:currentView] forKey:@"view"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"LinphoneMainViewChange" object:self userInfo:mdict];
|
||||
|
||||
return [mainViewController getCurrentViewController];
|
||||
}
|
||||
|
||||
- (void)popView {
|
||||
[self popView:nil];
|
||||
- (UIViewController*)popView {
|
||||
return [self popView:nil];
|
||||
}
|
||||
|
||||
- (void)popView:(NSArray *)calls {
|
||||
- (UIViewController*)popView:(NSArray *)calls {
|
||||
NSLog(@"PhoneMainView: Pop!");
|
||||
if([viewStack count] > 0) {
|
||||
PhoneView view = [[viewStack lastObject] intValue];
|
||||
[viewStack removeLastObject];
|
||||
[self _changeView:view calls:calls transition:[PhoneMainView getBackwardTransition]];
|
||||
[self _changeView:view transition:[PhoneMainView getBackwardTransition]];
|
||||
|
||||
return [mainViewController getCurrentViewController];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (PhoneView)currentView {
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
/* AbstractCall.m
|
||||
*
|
||||
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import "AbstractCall.h"
|
||||
|
||||
@implementation AbstractCall
|
||||
|
||||
@synthesize functionName;
|
||||
@synthesize functionArgs;
|
||||
|
||||
+ (id)abstractCall:(NSString *)name, ... {
|
||||
AbstractCall *object;
|
||||
va_list args;
|
||||
va_start(args, name);
|
||||
object = [[AbstractCall alloc] init:name args:args];
|
||||
va_end(args);
|
||||
return [object autorelease];
|
||||
}
|
||||
|
||||
- (id)init:(NSString *)name, ... {
|
||||
AbstractCall *object;
|
||||
va_list args;
|
||||
va_start(args, name);
|
||||
object = [self init:name args:args];
|
||||
va_end(args);
|
||||
return object;
|
||||
}
|
||||
|
||||
- (id)init:(NSString *)name args:(va_list)args {
|
||||
self = [super init];
|
||||
if(self != nil) {
|
||||
self->functionName = name;
|
||||
NSMutableArray *array = [[NSMutableArray alloc] init];
|
||||
int count = 0;
|
||||
for(int i = 0; i < [self->functionName length]; ++i) {
|
||||
if([self->functionName characterAtIndex:i] == ':') {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < count; ++i) {
|
||||
id arg = va_arg(args, id);
|
||||
[array addObject:arg];
|
||||
}
|
||||
self->functionArgs = array;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[functionName release];
|
||||
[functionArgs release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)call:(id)object {
|
||||
@try {
|
||||
SEL selector = NSSelectorFromString(functionName);
|
||||
NSMethodSignature *signature = [object methodSignatureForSelector:selector];
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
||||
[invocation setTarget:object];
|
||||
[invocation setSelector:selector];
|
||||
for(int i=0; i<[functionArgs count]; i++)
|
||||
{
|
||||
id arg = [functionArgs objectAtIndex:i];
|
||||
[invocation setArgument:&arg atIndex:i+2]; // The first two arguments are the hidden arguments self and _cmd
|
||||
}
|
||||
[invocation invoke]; // Invoke the selector
|
||||
} @catch (NSException *exception) {
|
||||
NSLog(@"Abstract Call: Can't call %@ with arguments %@ on %@", functionName, functionArgs, object);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* AbstractCall.h
|
||||
/* Utils.h
|
||||
*
|
||||
* Copyright (C) 2012 Belledonne Comunications, Grenoble, France
|
||||
*
|
||||
|
|
@ -17,19 +17,13 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#ifndef LINPHONE_UTILS_H
|
||||
#define LINPHONE_UTILS_H
|
||||
|
||||
#define DYNAMIC_CAST(x, cls) \
|
||||
({ \
|
||||
cls *inst_ = (cls *)(x); \
|
||||
[inst_ isKindOfClass:[cls class]]? inst_ : nil; \
|
||||
})
|
||||
|
||||
@interface AbstractCall : NSObject {
|
||||
NSString *functionName;
|
||||
NSArray *functionArgs;
|
||||
}
|
||||
|
||||
@property (retain) NSString *functionName;
|
||||
@property (retain) NSArray *functionArgs;
|
||||
|
||||
+ (id)abstractCall:(NSString *)name, ...;
|
||||
- (id)init:(NSString *)name, ...;
|
||||
- (void)call:(id) object;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
|
@ -633,8 +633,6 @@
|
|||
D3ED3EB4158738FB006C0DE4 /* HistoryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3ED3EB2158738FA006C0DE4 /* HistoryViewController.xib */; };
|
||||
D3ED3EB81587392C006C0DE4 /* HistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3ED3EB615873929006C0DE4 /* HistoryViewController.m */; };
|
||||
D3ED3EB91587392C006C0DE4 /* HistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3ED3EB615873929006C0DE4 /* HistoryViewController.m */; };
|
||||
D3F26BEC159869A6005F9CAB /* AbstractCall.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F26BEB159869A6005F9CAB /* AbstractCall.m */; };
|
||||
D3F26BED159869A6005F9CAB /* AbstractCall.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F26BEB159869A6005F9CAB /* AbstractCall.m */; };
|
||||
D3F26BF115986B73005F9CAB /* IncomingCallViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F26BEF15986B71005F9CAB /* IncomingCallViewController.m */; };
|
||||
D3F26BF215986B73005F9CAB /* IncomingCallViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F26BEF15986B71005F9CAB /* IncomingCallViewController.m */; };
|
||||
D3F26BF315986B73005F9CAB /* IncomingCallViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F26BF015986B72005F9CAB /* IncomingCallViewController.xib */; };
|
||||
|
|
@ -1088,6 +1086,7 @@
|
|||
C90FAA7615AF54E6002091CB /* HistoryDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryDetailsViewController.h; sourceTree = "<group>"; };
|
||||
C90FAA7715AF54E6002091CB /* HistoryDetailsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryDetailsViewController.m; sourceTree = "<group>"; };
|
||||
C90FAA7815AF54E6002091CB /* HistoryDetailsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HistoryDetailsViewController.xib; sourceTree = "<group>"; };
|
||||
C9B3A6FD15B485DB006F52EE /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utils.h; path = Utils/Utils.h; sourceTree = "<group>"; };
|
||||
C9C8253F15AE204D00D493FA /* options_add_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_add_disabled.png; path = Resources/options_add_disabled.png; sourceTree = "<group>"; };
|
||||
C9C8254015AE204D00D493FA /* options_transfer_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_transfer_disabled.png; path = Resources/options_transfer_disabled.png; sourceTree = "<group>"; };
|
||||
C9C8254115AE204D00D493FA /* transfer_call_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = transfer_call_default.png; path = Resources/transfer_call_default.png; sourceTree = "<group>"; };
|
||||
|
|
@ -1393,8 +1392,6 @@
|
|||
D3ED3EB2158738FA006C0DE4 /* HistoryViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HistoryViewController.xib; sourceTree = "<group>"; };
|
||||
D3ED3EB515873928006C0DE4 /* HistoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryViewController.h; sourceTree = "<group>"; };
|
||||
D3ED3EB615873929006C0DE4 /* HistoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = HistoryViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
D3F26BEA159869A6005F9CAB /* AbstractCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AbstractCall.h; path = Utils/AbstractCall.h; sourceTree = "<group>"; };
|
||||
D3F26BEB159869A6005F9CAB /* AbstractCall.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AbstractCall.m; path = Utils/AbstractCall.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
D3F26BEE15986B71005F9CAB /* IncomingCallViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IncomingCallViewController.h; sourceTree = "<group>"; };
|
||||
D3F26BEF15986B71005F9CAB /* IncomingCallViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IncomingCallViewController.m; sourceTree = "<group>"; };
|
||||
D3F26BF015986B72005F9CAB /* IncomingCallViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IncomingCallViewController.xib; sourceTree = "<group>"; };
|
||||
|
|
@ -2335,8 +2332,6 @@
|
|||
D326483415887D4400930C67 /* Utils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D3F26BEA159869A6005F9CAB /* AbstractCall.h */,
|
||||
D3F26BEB159869A6005F9CAB /* AbstractCall.m */,
|
||||
D38935F715A6D06800A3A3AA /* CPAnimation */,
|
||||
D32B9DFA15A2F131000B6DEC /* FastAddressBook.h */,
|
||||
D32B9DFB15A2F131000B6DEC /* FastAddressBook.m */,
|
||||
|
|
@ -2344,6 +2339,7 @@
|
|||
D326483715887D5200930C67 /* OrderedDictionary.m */,
|
||||
D3F9A9DD15AF0FFE0045320F /* TPKeyboardAvoiding */,
|
||||
D3F9A9EB15AF27620045320F /* UACellBackgroundView */,
|
||||
C9B3A6FD15B485DB006F52EE /* Utils.h */,
|
||||
);
|
||||
name = Utils;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -3150,7 +3146,6 @@
|
|||
D3EA53FD159850E80037DC6B /* LinphoneManager.m in Sources */,
|
||||
D3EA540D1598528B0037DC6B /* ChatTableViewController.m in Sources */,
|
||||
D3EA5411159853750037DC6B /* UIChatCell.m in Sources */,
|
||||
D3F26BEC159869A6005F9CAB /* AbstractCall.m in Sources */,
|
||||
D3F26BF115986B73005F9CAB /* IncomingCallViewController.m in Sources */,
|
||||
D31B4B21159876C0002E6C72 /* UICompositeViewController.m in Sources */,
|
||||
D3F34F351599C354005BE94F /* UIModalViewController.m in Sources */,
|
||||
|
|
@ -3240,7 +3235,6 @@
|
|||
D3EA53FE159850E80037DC6B /* LinphoneManager.m in Sources */,
|
||||
D3EA540E1598528B0037DC6B /* ChatTableViewController.m in Sources */,
|
||||
D3EA5412159853750037DC6B /* UIChatCell.m in Sources */,
|
||||
D3F26BED159869A6005F9CAB /* AbstractCall.m in Sources */,
|
||||
D3F26BF215986B73005F9CAB /* IncomingCallViewController.m in Sources */,
|
||||
D31B4B22159876C0002E6C72 /* UICompositeViewController.m in Sources */,
|
||||
D3F34F361599C354005BE94F /* UIModalViewController.m in Sources */,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue