diff --git a/.gitmodules b/.gitmodules
index eb4760cd1..d29905eee 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -9,7 +9,7 @@
url = git://git.linphone.org/speex
[submodule "submodules/externals/opencore-amr"]
path = submodules/externals/opencore-amr
- url = git://git.linphone.org/opencore-amr
+ url = git://git.linphone.org/opencore-amr.git
ignore = dirty
[submodule "submodules/msamr"]
path = submodules/msamr
diff --git a/Classes/AboutView.m b/Classes/AboutView.m
index bdd061eaa..884a34013 100644
--- a/Classes/AboutView.m
+++ b/Classes/AboutView.m
@@ -128,6 +128,6 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (IBAction)onDialerBackClick:(id)sender {
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ [PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}
@end
diff --git a/Classes/AssistantView.h b/Classes/AssistantView.h
index 524f22643..2ee58224c 100644
--- a/Classes/AssistantView.h
+++ b/Classes/AssistantView.h
@@ -29,7 +29,7 @@
UIView *nextView;
NSMutableArray *historyViews;
LinphoneProxyConfig *new_config;
- LinphoneProxyConfig *previous_default_config;
+ int number_of_configs_before;
}
@property(nonatomic, strong) IBOutlet TPKeyboardAvoidingScrollView *contentView;
diff --git a/Classes/AssistantView.m b/Classes/AssistantView.m
index 2e35d179b..89317afc5 100644
--- a/Classes/AssistantView.m
+++ b/Classes/AssistantView.m
@@ -84,31 +84,24 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(registrationUpdateEvent:)
- name:kLinphoneRegistrationUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(configuringUpdate:)
- name:kLinphoneConfiguringStateUpdate
- object:nil];
- // we will set the new default proxy config in the assistant
- previous_default_config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
- linphone_core_set_default_proxy_config([LinphoneManager getLc], NULL);
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(registrationUpdateEvent:)
+ name:kLinphoneRegistrationUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(configuringUpdate:)
+ name:kLinphoneConfiguringStateUpdate
+ object:nil];
new_config = NULL;
[self resetTextFields];
[self changeView:_welcomeView back:FALSE animation:FALSE];
+ number_of_configs_before = ms_list_size(linphone_core_get_proxy_config_list(LC));
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
- // if we quit assistant without creating a new proxy config, just restore the previous one
- if (!linphone_core_get_default_proxy_config([LinphoneManager getLc])) {
- linphone_core_set_default_proxy_config([LinphoneManager getLc], previous_default_config);
- }
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)fitContent {
@@ -132,11 +125,10 @@ static UICompositeViewDescription *compositeDescription = nil;
linphone_account_creator_unref(account_creator);
account_creator = NULL;
}
- [[LinphoneManager instance] resetLinphoneCore];
+ [LinphoneManager.instance resetLinphoneCore];
account_creator = linphone_account_creator_new(
- [LinphoneManager getLc],
- [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""]
- .UTF8String);
+ LC, [LinphoneManager.instance lpConfigStringForKey:@"xmlrpc_url" inSection:@"assistant" withDefault:@""]
+ .UTF8String);
linphone_account_creator_set_user_data(account_creator, (__bridge void *)(self));
linphone_account_creator_cbs_set_existence_tested(linphone_account_creator_get_callbacks(account_creator),
assistant_existence_tested);
@@ -147,25 +139,25 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)loadAssistantConfig:(NSString *)rcFilename {
NSString *fullPath = [@"file://" stringByAppendingString:[LinphoneManager bundleFile:rcFilename]];
- linphone_core_set_provisioning_uri([LinphoneManager getLc], fullPath.UTF8String);
- [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"];
+ linphone_core_set_provisioning_uri(LC, fullPath.UTF8String);
+ [LinphoneManager.instance lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"];
[self resetLiblinphone];
}
- (void)reset {
- [[LinphoneManager instance] removeAllAccounts];
- [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"];
+ [LinphoneManager.instance removeAllAccounts];
+ [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"pushnotification_preference"];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LCSipTransports transportValue = {5060, 5060, -1, -1};
if (linphone_core_set_sip_transports(lc, &transportValue)) {
LOGE(@"cannot set transport");
}
- [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"ice_preference"];
- [[LinphoneManager instance] lpConfigSetString:@"" forKey:@"stun_preference"];
+ [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"ice_preference"];
+ [LinphoneManager.instance lpConfigSetString:@"" forKey:@"stun_preference"];
linphone_core_set_stun_server(lc, NULL);
linphone_core_set_firewall_policy(lc, LinphonePolicyNoFirewall);
[self resetTextFields];
@@ -178,7 +170,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
+ (NSString *)errorForStatus:(LinphoneAccountCreatorStatus)status {
- BOOL usePhoneNumber = [[LinphoneManager instance] lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"];
+ BOOL usePhoneNumber = [LinphoneManager.instance lpConfigBoolForKey:@"use_phone_number" inSection:@"assistant"];
switch (status) {
case LinphoneAccountCreatorEmailInvalid:
return NSLocalizedString(@"Invalid email.", nil);
@@ -221,8 +213,8 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)configureProxyConfig {
- LinphoneCore *lc = [LinphoneManager getLc];
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneCore *lc = LC;
+ LinphoneManager *lm = LinphoneManager.instance;
// remove previous proxy config, if any
if (new_config != NULL) {
@@ -240,7 +232,7 @@ static UICompositeViewDescription *compositeDescription = nil;
linphone_core_set_default_proxy_config(lc, new_config);
// reload address book to prepend proxy config domain to contacts' phone number
// todo: STOP doing that!
- [[[LinphoneManager instance] fastAddressBook] reload];
+ [[LinphoneManager.instance fastAddressBook] reload];
}
}
@@ -255,10 +247,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[self displayUsernameAsPhoneOrUsername];
if (view == _welcomeView) {
- BOOL show_logo =
- [[LinphoneManager instance] lpConfigBoolForKey:@"show_assistant_logo_in_choice_view_preference"];
- BOOL show_extern = ![[LinphoneManager instance] lpConfigBoolForKey:@"hide_assistant_custom_account"];
- BOOL show_new = ![[LinphoneManager instance] lpConfigBoolForKey:@"hide_assistant_create_account"];
+ BOOL show_logo = [LinphoneManager.instance lpConfigBoolForKey:@"show_assistant_logo_in_choice_view_preference"];
+ BOOL show_extern = ![LinphoneManager.instance lpConfigBoolForKey:@"hide_assistant_custom_account"];
+ BOOL show_new = ![LinphoneManager.instance lpConfigBoolForKey:@"hide_assistant_create_account"];
if (!placement_done) {
// visibility
@@ -285,7 +276,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
// Animation
- if (animation && [[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) {
+ if (animation && ANIMATED) {
CATransition *trans = [CATransition animation];
[trans setType:kCATransitionPush];
[trans setDuration:0.35];
@@ -326,18 +317,10 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)fillDefaultValues {
[self resetTextFields];
- LinphoneProxyConfig *current_conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
- if (current_conf != NULL) {
- if (linphone_proxy_config_find_auth_info(current_conf) != NULL) {
- LOGI(@"A proxy config was set up with the remote provisioning, skip assistant");
- [self onDialerClick:nil];
- }
- }
-
- LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config([LinphoneManager getLc]);
+ LinphoneProxyConfig *default_conf = linphone_core_create_proxy_config(LC);
const char *identity = linphone_proxy_config_get_identity(default_conf);
if (identity) {
- LinphoneAddress *default_addr = linphone_address_new(identity);
+ LinphoneAddress *default_addr = linphone_core_interpret_url(LC, identity);
if (default_addr) {
const char *domain = linphone_address_get_domain(default_addr);
const char *username = linphone_address_get_username(default_addr);
@@ -486,7 +469,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if ([inputEntry rangeOfString:@"://"].location == NSNotFound) {
inputEntry = [NSString stringWithFormat:@"http://%@", inputEntry];
}
- return (linphone_core_set_provisioning_uri([LinphoneManager getLc], inputEntry.UTF8String) != 0);
+ return (linphone_core_set_provisioning_uri(LC, inputEntry.UTF8String) != 0);
}
return TRUE;
}];
@@ -523,7 +506,7 @@ static UICompositeViewDescription *compositeDescription = nil;
switch (state) {
case LinphoneRegistrationOk: {
_waitView.hidden = true;
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ [PhoneMainView.instance popToView:DialerView.compositeViewDescription];
break;
}
case LinphoneRegistrationNone:
@@ -543,7 +526,7 @@ static UICompositeViewDescription *compositeDescription = nil;
otherButtonTitles:nil];
[alert addButtonWithTitle:@"Continue"
block:^(void) {
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ [PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}];
[alert show];
break;
@@ -564,6 +547,12 @@ static UICompositeViewDescription *compositeDescription = nil;
switch (status) {
case LinphoneConfiguringSuccessful:
+ // we successfully loaded a remote provisioned config, go to dialer
+ if (number_of_configs_before < ms_list_size(linphone_core_get_proxy_config_list(LC))) {
+ LOGI(@"A proxy config was set up with the remote provisioning, skip assistant");
+ [self onDialerClick:nil];
+ }
+
if (nextView == nil) {
[self fillDefaultValues];
} else {
@@ -633,7 +622,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
[alert addButtonWithTitle:NSLocalizedString(@"Skip verification", nil)
block:^{
[thiz configureProxyConfig];
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ [PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}];
[alert show];
}
@@ -705,7 +694,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
nextView = _remoteProvisioningView;
[self loadAssistantConfig:@"assistant_remote.rc"];
[self findTextField:ViewElement_URL].text =
- [[LinphoneManager instance] lpConfigStringForKey:@"config-uri" inSection:@"misc"];
+ [LinphoneManager.instance lpConfigStringForKey:@"config-uri" inSection:@"misc"];
}
- (IBAction)onCreateAccountClick:(id)sender {
@@ -730,7 +719,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
- (IBAction)onRemoteProvisioningLoginClick:(id)sender {
_waitView.hidden = NO;
- [[LinphoneManager instance] lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"];
+ [LinphoneManager.instance lpConfigSetInt:1 forKey:@"transient_provisioning" inSection:@"misc"];
[self configureProxyConfig];
}
@@ -754,7 +743,7 @@ void assistant_validation_tested(LinphoneAccountCreator *creator, LinphoneAccoun
}
- (IBAction)onDialerClick:(id)sender {
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ [PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}
@end
diff --git a/Classes/Base.lproj/CallIncomingView.xib b/Classes/Base.lproj/CallIncomingView.xib
index e18d31111..6651bf888 100644
--- a/Classes/Base.lproj/CallIncomingView.xib
+++ b/Classes/Base.lproj/CallIncomingView.xib
@@ -34,13 +34,6 @@
-
+
-
+
@@ -281,7 +281,7 @@
-
+
diff --git a/Classes/Base.lproj/CallOutgoingView.xib b/Classes/Base.lproj/CallOutgoingView.xib
index c35efb243..6d3ac0234 100644
--- a/Classes/Base.lproj/CallOutgoingView.xib
+++ b/Classes/Base.lproj/CallOutgoingView.xib
@@ -10,6 +10,7 @@
+
@@ -40,7 +41,7 @@
-
+
@@ -120,8 +121,22 @@
+
-
-
+
@@ -223,13 +224,6 @@
-
+
@@ -246,7 +247,7 @@
-
+
@@ -317,44 +318,8 @@
-
-
-
+
+
+
diff --git a/Classes/Base.lproj/CallView.xib b/Classes/Base.lproj/CallView.xib
index 12237d2f5..8eda3cad7 100644
--- a/Classes/Base.lproj/CallView.xib
+++ b/Classes/Base.lproj/CallView.xib
@@ -716,8 +716,8 @@
-
-
+
+
diff --git a/Classes/Base.lproj/DialerView.xib b/Classes/Base.lproj/DialerView.xib
index 3f30ab4d2..6cceee355 100644
--- a/Classes/Base.lproj/DialerView.xib
+++ b/Classes/Base.lproj/DialerView.xib
@@ -47,7 +47,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
diff --git a/Classes/Base.lproj/DialerView~ipad.xib b/Classes/Base.lproj/DialerView~ipad.xib
index af249e670..1b8acb03f 100644
--- a/Classes/Base.lproj/DialerView~ipad.xib
+++ b/Classes/Base.lproj/DialerView~ipad.xib
@@ -1,5 +1,5 @@
-
+
@@ -63,8 +63,8 @@
-
-
+
+
@@ -72,7 +72,7 @@
-
+
@@ -389,8 +389,8 @@
-
-
+
+
@@ -398,7 +398,7 @@
-
+
@@ -709,7 +709,7 @@
-
+
diff --git a/Classes/Base.lproj/SideMenuView.xib b/Classes/Base.lproj/SideMenuView.xib
index 50397d262..9e99f1e38 100644
--- a/Classes/Base.lproj/SideMenuView.xib
+++ b/Classes/Base.lproj/SideMenuView.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -31,10 +31,9 @@
-
+
-
@@ -47,12 +46,10 @@
-
-
@@ -85,7 +79,6 @@
-
@@ -93,7 +86,6 @@
-
@@ -101,7 +93,6 @@
-
diff --git a/Classes/Base.lproj/SideMenuView~ipad.xib b/Classes/Base.lproj/SideMenuView~ipad.xib
index 175226f7a..22527a3ab 100644
--- a/Classes/Base.lproj/SideMenuView~ipad.xib
+++ b/Classes/Base.lproj/SideMenuView~ipad.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -34,7 +34,6 @@
-
@@ -47,12 +46,10 @@
-
-
@@ -85,7 +79,6 @@
-
@@ -93,7 +86,6 @@
-
@@ -101,7 +93,6 @@
-
diff --git a/Classes/CallConferenceTableView.m b/Classes/CallConferenceTableView.m
index 7a5f389a8..71bd14208 100644
--- a/Classes/CallConferenceTableView.m
+++ b/Classes/CallConferenceTableView.m
@@ -48,7 +48,7 @@
#pragma mark - UITableViewDataSource Functions
- (LinphoneCall *)conferenceCallForRow:(NSInteger)row {
- const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]);
+ const MSList *calls = linphone_core_get_calls(LC);
int i = -1;
while (calls) {
if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(calls->data))) {
@@ -74,7 +74,7 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]);
+ const MSList *calls = linphone_core_get_calls(LC);
int count = 0;
while (calls) {
if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(calls->data))) {
diff --git a/Classes/CallIncomingView.m b/Classes/CallIncomingView.m
index ec431a6d0..6d8d29b8d 100644
--- a/Classes/CallIncomingView.m
+++ b/Classes/CallIncomingView.m
@@ -30,16 +30,16 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdateEvent:)
- name:kLinphoneCallUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdateEvent:)
+ name:kLinphoneCallUpdate
+ object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCallUpdate object:nil];
}
#pragma mark - UICompositeViewDelegate Functions
diff --git a/Classes/CallOutgoingView.h b/Classes/CallOutgoingView.h
index 94c65d56d..5ad6a1504 100644
--- a/Classes/CallOutgoingView.h
+++ b/Classes/CallOutgoingView.h
@@ -35,6 +35,7 @@
@property(weak, nonatomic) IBOutlet UIBluetoothButton *routesBluetoothButton;
@property(weak, nonatomic) IBOutlet UIButton *routesEarpieceButton;
@property(weak, nonatomic) IBOutlet UISpeakerButton *routesSpeakerButton;
+@property(weak, nonatomic) IBOutlet UIMicroButton *microButton;
- (IBAction)onDeclineClick:(id)sender;
diff --git a/Classes/CallOutgoingView.m b/Classes/CallOutgoingView.m
index 723e5ef4e..43ee7fb7e 100644
--- a/Classes/CallOutgoingView.m
+++ b/Classes/CallOutgoingView.m
@@ -48,16 +48,14 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(bluetoothAvailabilityUpdateEvent:)
- name:kLinphoneBluetoothAvailabilityUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(bluetoothAvailabilityUpdateEvent:)
+ name:kLinphoneBluetoothAvailabilityUpdate
+ object:nil];
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (!call) {
- if (![PhoneMainView.instance popCurrentView]) {
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
- }
+ [PhoneMainView.instance popCurrentView];
} else {
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
@@ -68,6 +66,10 @@ static UICompositeViewDescription *compositeDescription = nil;
}
[self hideSpeaker:LinphoneManager.instance.bluetoothAvailable];
+
+ [_speakerButton update];
+ [_microButton update];
+ [_routesButton update];
}
- (void)viewWillDisappear:(BOOL)animated {
@@ -77,35 +79,32 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onRoutesBluetoothClick:(id)sender {
[self hideRoutes:TRUE animated:TRUE];
- [[LinphoneManager instance] setBluetoothEnabled:TRUE];
+ [LinphoneManager.instance setBluetoothEnabled:TRUE];
}
- (IBAction)onRoutesEarpieceClick:(id)sender {
[self hideRoutes:TRUE animated:TRUE];
- [[LinphoneManager instance] setSpeakerEnabled:FALSE];
- [[LinphoneManager instance] setBluetoothEnabled:FALSE];
+ [LinphoneManager.instance setSpeakerEnabled:FALSE];
+ [LinphoneManager.instance setBluetoothEnabled:FALSE];
}
- (IBAction)onRoutesSpeakerClick:(id)sender {
[self hideRoutes:TRUE animated:TRUE];
- [[LinphoneManager instance] setSpeakerEnabled:TRUE];
+ [LinphoneManager.instance setSpeakerEnabled:TRUE];
}
- (IBAction)onRoutesClick:(id)sender {
if ([_routesView isHidden]) {
- [self hideRoutes:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hideRoutes:FALSE animated:ANIMATED];
} else {
- [self hideRoutes:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hideRoutes:TRUE animated:ANIMATED];
}
}
- (IBAction)onDeclineClick:(id)sender {
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call) {
- linphone_core_terminate_call([LinphoneManager getLc], call);
- }
- if (![PhoneMainView.instance popCurrentView]) {
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ linphone_core_terminate_call(LC, call);
}
}
@@ -124,11 +123,7 @@ static UICompositeViewDescription *compositeDescription = nil;
_routesEarpieceButton.selected = !_routesBluetoothButton.selected && !_routesSpeakerButton.selected;
if (hidden != _routesView.hidden) {
- // if (animated) {
- // [self hideAnimation:hidden forView:_routesView completion:nil];
- // } else {
[_routesView setHidden:hidden];
- // }
}
}
diff --git a/Classes/CallPausedTableView.m b/Classes/CallPausedTableView.m
index 2f62d8e41..5878d3588 100644
--- a/Classes/CallPausedTableView.m
+++ b/Classes/CallPausedTableView.m
@@ -54,7 +54,7 @@
#pragma mark - UITableViewDataSource Functions
- (LinphoneCall *)conferenceCallForRow:(NSInteger)row {
- const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]);
+ const MSList *calls = linphone_core_get_calls(LC);
int i = -1;
while (calls) {
if (linphone_call_get_state(calls->data) == LinphoneCallPaused) {
@@ -81,7 +81,7 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]);
+ const MSList *calls = linphone_core_get_calls(LC);
int count = 0;
int conference_in_pause = 0;
while (calls) {
@@ -90,7 +90,7 @@
count++;
}
if (linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call)) &&
- !linphone_core_is_in_conference([LinphoneManager getLc])) {
+ !linphone_core_is_in_conference(LC)) {
conference_in_pause = 1;
}
calls = calls->next;
diff --git a/Classes/CallSideMenuView.m b/Classes/CallSideMenuView.m
index cd46d4ba8..e53fa3ffb 100644
--- a/Classes/CallSideMenuView.m
+++ b/Classes/CallSideMenuView.m
@@ -134,7 +134,7 @@
}
- (void)updateStats:(NSTimer *)timer {
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (!call) {
_statsLabel.text = NSLocalizedString(@"No call in progress", nil);
diff --git a/Classes/CallView.m b/Classes/CallView.m
index 464deeb10..64394e1ab 100644
--- a/Classes/CallView.m
+++ b/Classes/CallView.m
@@ -123,7 +123,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewDidUnload {
[PhoneMainView.instance.view removeGestureRecognizer:singleFingerTap];
// Remove all observer
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
[super viewDidUnload];
}
@@ -134,7 +134,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[self updateUnreadMessage:FALSE];
// Update on show
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0;
[self callUpdate:call state:state animated:FALSE];
[self hideRoutes:TRUE animated:FALSE];
@@ -144,24 +144,26 @@ static UICompositeViewDescription *compositeDescription = nil;
[self callDurationUpdate];
[self onCurrentCallChange];
// Set windows (warn memory leaks)
- linphone_core_set_native_video_window_id([LinphoneManager getLc], (__bridge void *)(_videoView));
- linphone_core_set_native_preview_window_id([LinphoneManager getLc], (__bridge void *)(_videoPreview));
+ linphone_core_set_native_video_window_id(LC, (__bridge void *)(_videoView));
+ linphone_core_set_native_preview_window_id(LC, (__bridge void *)(_videoPreview));
+
+ [self previewTouchLift];
// Enable tap
[singleFingerTap setEnabled:TRUE];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(messageReceived:)
- name:kLinphoneMessageReceived
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(bluetoothAvailabilityUpdateEvent:)
- name:kLinphoneBluetoothAvailabilityUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdateEvent:)
- name:kLinphoneCallUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(messageReceived:)
+ name:kLinphoneMessageReceived
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(bluetoothAvailabilityUpdateEvent:)
+ name:kLinphoneBluetoothAvailabilityUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdateEvent:)
+ name:kLinphoneCallUpdate
+ object:nil];
[NSTimer scheduledTimerWithTimeInterval:1
target:self
@@ -202,7 +204,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
// Remove observer
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)viewDidDisappear:(BOOL)animated {
@@ -215,7 +217,7 @@ static UICompositeViewDescription *compositeDescription = nil;
// Disable tap
[singleFingerTap setEnabled:FALSE];
- if (linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) {
+ if (linphone_core_get_calls_nb(LC) == 0) {
// reseting speaker button because no more call
_speakerButton.selected = FALSE;
}
@@ -240,7 +242,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
- (void)updateBottomBar:(LinphoneCall *)call state:(LinphoneCallState)state {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
[_speakerButton update];
[_microButton update];
@@ -356,7 +358,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
// only show camera switch button if we have more than 1 camera
_videoCameraSwitch.hidden = (disabled || !LinphoneManager.instance.frontCamId);
- _videoPreview.hidden = (disabled || !linphone_core_self_view_enabled([LinphoneManager getLc]));
+ _videoPreview.hidden = (disabled || !linphone_core_self_view_enabled(LC));
if (hideControlsTimer != nil) {
[hideControlsTimer invalidate];
@@ -379,7 +381,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
[_videoWaitingForFirstImage setHidden:NO];
[_videoWaitingForFirstImage startAnimating];
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
// linphone_call_params_get_used_video_codec return 0 if no video stream enabled
if (call != NULL && linphone_call_params_get_used_video_codec(linphone_call_get_current_params(call))) {
linphone_call_set_next_video_frame_decoded_callback(call, hideSpinner, (__bridge void *)(self));
@@ -403,14 +405,13 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
- (void)callDurationUpdate {
- int duration = linphone_core_get_current_call([LinphoneManager getLc])
- ? linphone_call_get_duration(linphone_core_get_current_call([LinphoneManager getLc]))
- : 0;
+ int duration =
+ linphone_core_get_current_call(LC) ? linphone_call_get_duration(linphone_core_get_current_call(LC)) : 0;
_durationLabel.text = [LinphoneUtils durationToString:duration];
}
- (void)onCurrentCallChange {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *call = linphone_core_get_current_call(lc);
_noActiveCallView.hidden = (call || linphone_core_is_in_conference(lc));
@@ -504,7 +505,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
- (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state animated:(BOOL)animated {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
[self updateBottomBar:call state:state];
if (hiddenVolume) {
[PhoneMainView.instance setVolumeHidden:FALSE];
@@ -594,7 +595,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
#pragma mark - ActionSheet Functions
- (void)displayAskToEnableVideoCall:(LinphoneCall *)call {
- if (linphone_core_get_video_policy([LinphoneManager getLc])->automatically_accept)
+ if (linphone_core_get_video_policy(LC)->automatically_accept)
return;
NSString *username = [FastAddressBook displayNameForAddress:linphone_call_get_remote_address(call)];
@@ -604,9 +605,9 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
confirmMessage:NSLocalizedString(@"ACCEPT", nil)
onCancelClick:^() {
LOGI(@"User declined video proposal");
- if (call == linphone_core_get_current_call([LinphoneManager getLc])) {
+ if (call == linphone_core_get_current_call(LC)) {
LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
- linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy);
+ linphone_core_accept_call_update(LC, call, paramsCopy);
linphone_call_params_destroy(paramsCopy);
[videoDismissTimer invalidate];
videoDismissTimer = nil;
@@ -614,10 +615,10 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
}
onConfirmationClick:^() {
LOGI(@"User accept video proposal");
- if (call == linphone_core_get_current_call([LinphoneManager getLc])) {
+ if (call == linphone_core_get_current_call(LC)) {
LinphoneCallParams *paramsCopy = linphone_call_params_copy(linphone_call_get_current_params(call));
linphone_call_params_enable_video(paramsCopy, TRUE);
- linphone_core_accept_call_update([LinphoneManager getLc], call, paramsCopy);
+ linphone_core_accept_call_update(LC, call, paramsCopy);
linphone_call_params_destroy(paramsCopy);
[videoDismissTimer invalidate];
videoDismissTimer = nil;
@@ -674,71 +675,66 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
- (IBAction)onNumpadClick:(id)sender {
if ([_numpadView isHidden]) {
- [self hidePad:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hidePad:FALSE animated:ANIMATED];
} else {
- [self hidePad:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hidePad:TRUE animated:ANIMATED];
}
}
- (IBAction)onChatClick:(id)sender {
- ChatsListView *view = VIEW(ChatsListView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
+ [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
}
- (IBAction)onRoutesBluetoothClick:(id)sender {
[self hideRoutes:TRUE animated:TRUE];
- [[LinphoneManager instance] setBluetoothEnabled:TRUE];
+ [LinphoneManager.instance setBluetoothEnabled:TRUE];
}
- (IBAction)onRoutesEarpieceClick:(id)sender {
[self hideRoutes:TRUE animated:TRUE];
- [[LinphoneManager instance] setSpeakerEnabled:FALSE];
- [[LinphoneManager instance] setBluetoothEnabled:FALSE];
+ [LinphoneManager.instance setSpeakerEnabled:FALSE];
+ [LinphoneManager.instance setBluetoothEnabled:FALSE];
}
- (IBAction)onRoutesSpeakerClick:(id)sender {
[self hideRoutes:TRUE animated:TRUE];
- [[LinphoneManager instance] setSpeakerEnabled:TRUE];
+ [LinphoneManager.instance setSpeakerEnabled:TRUE];
}
- (IBAction)onRoutesClick:(id)sender {
if ([_routesView isHidden]) {
- [self hideRoutes:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hideRoutes:FALSE animated:ANIMATED];
} else {
- [self hideRoutes:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hideRoutes:TRUE animated:ANIMATED];
}
}
- (IBAction)onOptionsTransferClick:(id)sender {
[self hideOptions:TRUE animated:TRUE];
- // Go to dialer view
DialerView *view = VIEW(DialerView);
+ [view setAddress:@""];
+ [view setTransferMode:TRUE];
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
- if (view != nil) {
- [view setAddress:@""];
- [view setTransferMode:TRUE];
- }
}
- (IBAction)onOptionsAddClick:(id)sender {
[self hideOptions:TRUE animated:TRUE];
- // Go to dialer view
DialerView *view = VIEW(DialerView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
[view setAddress:@""];
[view setTransferMode:FALSE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
- (IBAction)onOptionsClick:(id)sender {
if ([_optionsView isHidden]) {
- [self hideOptions:FALSE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hideOptions:FALSE animated:ANIMATED];
} else {
- [self hideOptions:TRUE animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ [self hideOptions:TRUE animated:ANIMATED];
}
}
- (IBAction)onOptionsConferenceClick:(id)sender {
- linphone_core_add_all_to_conference([LinphoneManager getLc]);
+ linphone_core_add_all_to_conference(LC);
}
#pragma mark - Animation
diff --git a/Classes/ChatConversationCreateTableView.m b/Classes/ChatConversationCreateTableView.m
index a82b4fa89..0e069f238 100644
--- a/Classes/ChatConversationCreateTableView.m
+++ b/Classes/ChatConversationCreateTableView.m
@@ -45,7 +45,7 @@
}];
// also add current entry, if not listed
NSString *nsuri = filter.lowercaseString;
- LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], nsuri.UTF8String);
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, nsuri.UTF8String);
if (addr) {
char *uri = linphone_address_as_string(addr);
nsuri = [NSString stringWithUTF8String:uri];
@@ -81,7 +81,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
LinphoneChatRoom *room = linphone_core_get_chat_room_from_uri(
- [LinphoneManager getLc], ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String);
+ LC, ((NSString *)[_contacts.allKeys objectAtIndex:indexPath.row]).UTF8String);
if (!room) {
[PhoneMainView.instance popCurrentView];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Invalid address", nil)
@@ -94,7 +94,7 @@
ChatConversationView *view = VIEW(ChatConversationView);
[view setChatRoom:room];
[PhoneMainView.instance popCurrentView];
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
}
diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m
index b6b78a726..286df380d 100644
--- a/Classes/ChatConversationTableView.m
+++ b/Classes/ChatConversationTableView.m
@@ -54,7 +54,7 @@
messageList = linphone_chat_room_get_history(chatRoom, 0);
// also append transient upload messages because they are not in history yet!
- for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) {
+ for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
const LinphoneAddress *ftd_peer =
linphone_chat_room_get_peer_address(linphone_chat_message_get_chat_room(ftd.message));
const LinphoneAddress *peer = linphone_chat_room_get_peer_address(chatRoom);
@@ -103,20 +103,6 @@
}
}
-- (void)debugMessages {
- if (!messageList) {
- LOGE(@"No data to debug");
- return;
- }
- MSList *item = messageList;
- int count = 0;
- while (item) {
- LinphoneChatMessage *msg = (LinphoneChatMessage *)item->data;
- LOGI(@"Message %d: %s", count++, linphone_chat_message_get_text(msg));
- item = item->next;
- }
-}
-
- (void)scrollToLastUnread:(BOOL)animated {
if (messageList == nil || chatRoom == nil) {
return;
diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m
index 20a7fc1cd..e5066e9e6 100644
--- a/Classes/ChatConversationView.m
+++ b/Classes/ChatConversationView.m
@@ -42,7 +42,7 @@
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - UICompositeViewDelegate Functions
@@ -88,34 +88,34 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(applicationWillEnterForeground:)
- name:UIApplicationDidBecomeActiveNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(keyboardWillShow:)
- name:UIKeyboardWillShowNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(keyboardWillHide:)
- name:UIKeyboardWillHideNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(textReceivedEvent:)
- name:kLinphoneMessageReceived
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(onMessageChange:)
- name:UITextViewTextDidChangeNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(textComposeEvent:)
- name:kLinphoneTextComposeEvent
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdateEvent:)
- name:kLinphoneCallUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(applicationWillEnterForeground:)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(keyboardWillShow:)
+ name:UIKeyboardWillShowNotification
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(keyboardWillHide:)
+ name:UIKeyboardWillHideNotification
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(textReceivedEvent:)
+ name:kLinphoneMessageReceived
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(onMessageChange:)
+ name:UITextViewTextDidChangeNotification
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(textComposeEvent:)
+ name:kLinphoneTextComposeEvent
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdateEvent:)
+ name:kLinphoneCallUpdate
+ object:nil];
[_backToCallButton update];
@@ -124,7 +124,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
[[_tableController tableView] reloadData];
- BOOL fileSharingEnabled = linphone_core_get_file_transfer_server([LinphoneManager getLc]) != NULL;
+ BOOL fileSharingEnabled = linphone_core_get_file_transfer_server(LC) != NULL;
[_pictureButton setEnabled:fileSharingEnabled];
[self callUpdateEvent:nil];
@@ -137,7 +137,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[self setComposingVisible:FALSE withDelay:0]; // will hide the "user is composing.." message
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
@@ -182,8 +182,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)callUpdateEvent:(NSNotification *)notif {
- _callButton.hidden =
- (_tableController.isEditing || linphone_core_get_current_call([LinphoneManager getLc]) != NULL);
+ _callButton.hidden = (_tableController.isEditing || linphone_core_get_current_call(LC) != NULL);
}
- (void)update {
@@ -237,8 +236,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)saveAndSend:(UIImage *)image url:(NSURL *)url {
// photo from Camera, must be saved first
if (url == nil) {
- [[LinphoneManager instance]
- .photoLibrary
+ [LinphoneManager.instance.photoLibrary
writeImageToSavedPhotosAlbum:image.CGImage
orientation:(ALAssetOrientation)[image imageOrientation]
completionBlock:^(NSURL *assetURL, NSError *error) {
@@ -331,7 +329,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if (strcasecmp(cr_from_string, fromStr) == 0) {
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
linphone_chat_room_mark_as_read(room);
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
}
[_tableController addChatEntry:chat];
[_tableController scrollToLastUnread:TRUE];
@@ -496,6 +494,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (IBAction)onDeleteClick:(id)sender {
+ LOGI(@"onDeleteClick");
NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"Do you want to delete selected messages?", nil)];
[UIConfirmationDialog ShowWithMessage:msg
cancelMessage:nil
@@ -516,13 +515,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (IBAction)onCallClick:(id)sender {
- NSString *displayName = [FastAddressBook displayNameForAddress:linphone_chat_room_get_peer_address(chatRoom)];
- // Go to dialer view
- DialerView *view = VIEW(DialerView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
- char *uri = linphone_address_as_string(linphone_chat_room_get_peer_address(chatRoom));
- [view call:[NSString stringWithUTF8String:uri] displayName:displayName];
- ms_free(uri);
+ [LinphoneManager.instance call:linphone_chat_room_get_peer_address(chatRoom) transfer:NO];
}
- (IBAction)onListSwipe:(id)sender {
diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m
index ddb4ed335..29756c6fe 100644
--- a/Classes/ChatsListTableView.m
+++ b/Classes/ChatsListTableView.m
@@ -58,8 +58,8 @@
[super viewDidAppear:animated];
// we cannot do that in viewWillAppear because we will change view while previous transition
// was not finished, leading to "[CALayer retain]: message sent to deallocated instance" error msg
- if (IPAD && [self totalNumberOfItems] == 0) {
- [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription];
+ if (IPAD && [self totalNumberOfItems] > 0) {
+ [PhoneMainView.instance changeCurrentView:ChatConversationView.compositeViewDescription];
}
}
@@ -82,7 +82,7 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo
- (MSList *)sortChatRooms {
MSList *sorted = nil;
- const MSList *unsorted = linphone_core_get_chat_rooms([LinphoneManager getLc]);
+ const MSList *unsorted = linphone_core_get_chat_rooms(LC);
const MSList *iter = unsorted;
while (iter) {
@@ -163,7 +163,7 @@ static void chatTable_free_chatrooms(void *data) {
UIChatCell *cell = (UIChatCell *)[tableView cellForRowAtIndexPath:indexPath];
[cell updateUnreadBadge];
}
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
}
@@ -181,7 +181,7 @@ static void chatTable_free_chatrooms(void *data) {
}
FileTransferDelegate *ftdToDelete = nil;
- for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) {
+ for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) {
ftdToDelete = ftd;
break;
@@ -193,7 +193,7 @@ static void chatTable_free_chatrooms(void *data) {
data = ms_list_remove(data, chatRoom);
// will force a call to [self loadData]
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
@@ -211,7 +211,7 @@ static void chatTable_free_chatrooms(void *data) {
}
FileTransferDelegate *ftdToDelete = nil;
- for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) {
+ for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) {
ftdToDelete = ftd;
break;
@@ -223,7 +223,7 @@ static void chatTable_free_chatrooms(void *data) {
data = ms_list_remove(data, chatRoom);
// will force a call to [self loadData]
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self];
}];
}
diff --git a/Classes/ChatsListView.m b/Classes/ChatsListView.m
index 6fe1e2c28..c78ad994b 100644
--- a/Classes/ChatsListView.m
+++ b/Classes/ChatsListView.m
@@ -27,10 +27,10 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(textReceivedEvent:)
- name:kLinphoneMessageReceived
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(textReceivedEvent:)
+ name:kLinphoneMessageReceived
+ object:nil];
[_backToCallButton update];
[self setEditing:NO];
}
@@ -38,7 +38,7 @@
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneMessageReceived object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneMessageReceived object:nil];
}
#pragma mark - Event Functions
@@ -59,7 +59,7 @@ static UICompositeViewDescription *compositeDescription = nil;
sideMenu:SideMenuView.class
fullscreen:false
isLeftFragment:YES
- fragmentWith:ChatConversationView.class];
+ fragmentWith:ChatConversationCreateView.class];
}
return compositeDescription;
}
@@ -71,8 +71,7 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark - Action Functions
- (IBAction)onAddClick:(id)event {
- ChatConversationCreateView *view = VIEW(ChatConversationCreateView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:YES];
+ [PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription];
}
- (IBAction)onEditionChangeClick:(id)sender {
diff --git a/Classes/Contact.m b/Classes/Contact.m
index 1979b5a95..059fce1b8 100644
--- a/Classes/Contact.m
+++ b/Classes/Contact.m
@@ -64,7 +64,7 @@
for (int i = 0; i < ABMultiValueGetCount(map); ++i) {
CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(map, i);
if (CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) {
- if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField,
+ if (CFStringCompare((CFStringRef)LinphoneManager.instance.contactSipField,
CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey),
kCFCompareCaseInsensitive) == 0) {
NSString *value = (NSString *)(CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey));
@@ -211,7 +211,7 @@
- (BOOL)addSipAddress:(NSString *)sip {
NSDictionary *lDict = @{
(NSString *) kABPersonInstantMessageUsernameKey : sip, (NSString *)
- kABPersonInstantMessageServiceKey : [LinphoneManager instance].contactSipField
+ kABPersonInstantMessageServiceKey : LinphoneManager.instance.contactSipField
};
BOOL ret = [self addInProperty:kABPersonInstantMessageProperty value:(__bridge CFTypeRef)(lDict)];
diff --git a/Classes/ContactDetailsTableView.m b/Classes/ContactDetailsTableView.m
index a6489c035..b087b98b3 100644
--- a/Classes/ContactDetailsTableView.m
+++ b/Classes/ContactDetailsTableView.m
@@ -34,7 +34,7 @@
} else if (section == ContactSections_Sip) {
return _contact.sipAddresses;
} else if (section == ContactSections_Email) {
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) {
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"] == true) {
return _contact.emails;
}
}
@@ -166,8 +166,8 @@
} else if ([indexPath section] == ContactSections_Sip) {
value = _contact.sipAddresses[indexPath.row];
LinphoneAddress *addr = NULL;
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"contact_display_username_only"] &&
- (addr = linphone_address_new([value UTF8String]))) {
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"contact_display_username_only"] &&
+ (addr = linphone_core_interpret_url(LC, [value UTF8String]))) {
value = [NSString stringWithCString:linphone_address_get_username(addr)
encoding:[NSString defaultCStringEncoding]];
linphone_address_destroy(addr);
@@ -201,7 +201,7 @@
#pragma mark - UITableViewDelegate Functions
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
- BOOL showEmails = [[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"];
+ BOOL showEmails = [LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"];
if (editing) {
// add phone/SIP/email entries so that the user can add new data
for (int section = 0; section < [self numberOfSectionsInTableView:[self tableView]]; ++section) {
diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m
index 16d493c32..700d1fb75 100644
--- a/Classes/ContactDetailsView.m
+++ b/Classes/ContactDetailsView.m
@@ -78,7 +78,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
- (void)removeContact {
if (_contact != NULL) {
inhibUpdate = TRUE;
- [[[LinphoneManager instance] fastAddressBook] removeContact:_contact];
+ [[LinphoneManager.instance fastAddressBook] removeContact:_contact];
inhibUpdate = FALSE;
}
[PhoneMainView.instance popCurrentView];
@@ -111,7 +111,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
} else {
LOGI(@"Save AddressBook: Success!");
}
- [[LinphoneManager instance].fastAddressBook reload];
+ [LinphoneManager.instance.fastAddressBook reload];
}
- (void)selectContact:(ABRecordRef)acontact andReload:(BOOL)reload {
@@ -131,15 +131,15 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
}
- (void)addCurrentContactContactField:(NSString *)address {
- LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String);
+ LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, address.UTF8String);
NSString *username =
linphoneAddress ? [NSString stringWithUTF8String:linphone_address_get_username(linphoneAddress)] : address;
if (([username rangeOfString:@"@"].length > 0) &&
- ([[LinphoneManager instance] lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) {
+ ([LinphoneManager.instance lpConfigBoolForKey:@"show_contacts_emails_preference"] == true)) {
[_tableController addEmailField:username];
} else if ((linphone_proxy_config_is_phone_number(NULL, [username UTF8String])) &&
- ([[LinphoneManager instance] lpConfigBoolForKey:@"save_new_contacts_as_phone_number"] == true)) {
+ ([LinphoneManager.instance lpConfigBoolForKey:@"save_new_contacts_as_phone_number"] == true)) {
[_tableController addPhoneField:username];
} else {
[_tableController addSipField:address];
@@ -312,7 +312,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
}
- FastAddressBook *fab = [LinphoneManager instance].fastAddressBook;
+ FastAddressBook *fab = LinphoneManager.instance.fastAddressBook;
CFErrorRef error = NULL;
if (!ABPersonRemoveImageData(_contact, (CFErrorRef *)&error)) {
LOGI(@"Can't remove entry: %@", [(__bridge NSError *)error localizedDescription]);
diff --git a/Classes/ContactsListTableView.m b/Classes/ContactsListTableView.m
index 9396d6915..cb1c5ac64 100644
--- a/Classes/ContactsListTableView.m
+++ b/Classes/ContactsListTableView.m
@@ -229,7 +229,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
// Go to Contact details view
ContactDetailsView *view = VIEW(ContactDetailsView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
if ([ContactSelection getSelectionMode] != ContactSelectionModeEdit) {
[view setContact:lPerson];
} else {
@@ -254,7 +254,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
[tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section]
withRowAnimation:UITableViewRowAnimationFade];
}
- [[[LinphoneManager instance] fastAddressBook] removeContact:contact];
+ [[LinphoneManager.instance fastAddressBook] removeContact:contact];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];
@@ -273,7 +273,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
if ([self.tableView numberOfRowsInSection:indexPath.section] == 1) {
[addressBookMap removeObjectForKey:firstChar];
}
- [[[LinphoneManager instance] fastAddressBook] removeContact:contact];
+ [[LinphoneManager.instance fastAddressBook] removeContact:contact];
}];
}
diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m
index 058aadc35..32d745fd2 100644
--- a/Classes/ContactsListView.m
+++ b/Classes/ContactsListView.m
@@ -131,7 +131,7 @@ static UICompositeViewDescription *compositeDescription = nil;
cancelButtonTitle:NSLocalizedString(@"Continue", nil)
otherButtonTitles:nil];
[error show];
- [PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
+ [PhoneMainView.instance popCurrentView];
}
}
@@ -178,9 +178,8 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (IBAction)onAddContactClick:(id)event {
- // Go to Contact details view
ContactDetailsView *view = VIEW(ContactDetailsView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
if ([ContactSelection getAddAddress] == nil) {
[view newContact];
} else {
diff --git a/Classes/DialerView.h b/Classes/DialerView.h
index 41ac64876..7c745d1dd 100644
--- a/Classes/DialerView.h
+++ b/Classes/DialerView.h
@@ -31,8 +31,6 @@
}
- (void)setAddress:(NSString *)address;
-- (void)call:(NSString *)address displayName:(NSString *)displayName;
-- (void)call:(NSString *)address;
@property(nonatomic, assign) BOOL transferMode;
diff --git a/Classes/DialerView.m b/Classes/DialerView.m
index d6a3538dc..0de66f30d 100644
--- a/Classes/DialerView.m
+++ b/Classes/DialerView.m
@@ -64,7 +64,7 @@
- (void)dealloc {
// Remove all observers
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - UICompositeViewDelegate Functions
@@ -98,15 +98,15 @@ static UICompositeViewDescription *compositeDescription = nil;
!IPAD && UIInterfaceOrientationIsLandscape(PhoneMainView.instance.mainViewController.currentOrientation);
// Set observer
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdateEvent:)
- name:kLinphoneCallUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdateEvent:)
+ name:kLinphoneCallUpdate
+ object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(coreUpdateEvent:)
- name:kLinphoneCoreUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(coreUpdateEvent:)
+ name:kLinphoneCoreUpdate
+ object:nil];
// technically not needed, but older versions of linphone had this button
// disabled by default. In this case, updating by pushing a new version with
@@ -115,8 +115,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[callButton setEnabled:TRUE];
// Update on show
- LinphoneManager *mgr = [LinphoneManager instance];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneManager *mgr = LinphoneManager.instance;
+ LinphoneCore *lc = LC;
LinphoneCall *call = linphone_core_get_current_call(lc);
LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0;
[self callUpdate:call state:state];
@@ -140,13 +140,15 @@ static UICompositeViewDescription *compositeDescription = nil;
[backgroundView setHidden:TRUE];
[videoCameraSwitch setHidden:TRUE];
}
+ } else {
+ linphone_core_enable_video_preview(lc, FALSE);
}
[addressField setText:@""];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)viewDidLoad {
@@ -180,7 +182,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[oneButton addGestureRecognizer:oneLongGesture];
if (IPAD) {
- if ([LinphoneManager instance].frontCamId != nil) {
+ if (LinphoneManager.instance.frontCamId != nil) {
// only show camera switch button if we have more than 1 camera
[videoCameraSwitch setHidden:FALSE];
}
@@ -222,7 +224,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)coreUpdateEvent:(NSNotification *)notif {
if (IPAD) {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (linphone_core_video_display_enabled(lc) && linphone_core_video_preview_enabled(lc)) {
linphone_core_set_native_preview_window_id(lc, (__bridge void *)(videoPreview));
[backgroundView setHidden:FALSE];
@@ -288,7 +290,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (BOOL)displayDebugPopup:(NSString *)address {
- LinphoneManager *mgr = [LinphoneManager instance];
+ LinphoneManager *mgr = LinphoneManager.instance;
NSString *debugAddress = [mgr lpConfigStringForKey:@"debug_popup_magic" withDefault:@""];
if (![debugAddress isEqualToString:@""] && [address isEqualToString:debugAddress]) {
@@ -307,15 +309,14 @@ static UICompositeViewDescription *compositeDescription = nil;
[self presentMailViewWithTitle:appName forRecipients:@[ logsAddress ] attachLogs:true];
}];
- BOOL debugEnabled = [[LinphoneManager instance] lpConfigBoolForKey:@"debugenable_preference"];
+ BOOL debugEnabled = [LinphoneManager.instance lpConfigBoolForKey:@"debugenable_preference"];
NSString *actionLog =
(debugEnabled ? NSLocalizedString(@"Disable logs", nil) : NSLocalizedString(@"Enable logs", nil));
[alertView addButtonWithTitle:actionLog
block:^{
// enable / disable
- BOOL enableDebug = ![mgr lpConfigBoolForKey:@"debugenable_preference"];
- [mgr lpConfigSetBool:enableDebug forKey:@"debugenable_preference"];
- [mgr setLogsEnabled:enableDebug];
+ BOOL enableDebug = !debugEnabled;
+ [Log enableLogs:enableDebug];
}];
[alertView show];
@@ -327,7 +328,7 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark -
- (void)callUpdate:(LinphoneCall *)call state:(LinphoneCallState)state {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
BOOL callInProgress = (linphone_core_get_calls_nb(lc) > 0);
addCallButton.hidden = (!callInProgress || transferMode);
transferButton.hidden = (!callInProgress || !transferMode);
@@ -342,23 +343,11 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)setTransferMode:(BOOL)atransferMode {
transferMode = atransferMode;
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
LinphoneCallState state = (call != NULL) ? linphone_call_get_state(call) : 0;
[self callUpdate:call state:state];
}
-- (void)call:(NSString *)address {
- LinphoneAddress *addr = linphone_address_new(address.UTF8String);
- NSString *displayName = addr ? [FastAddressBook displayNameForAddress:addr] : nil;
- if (addr)
- linphone_address_destroy(addr);
- [self call:address displayName:displayName];
-}
-
-- (void)call:(NSString *)address displayName:(NSString *)displayName {
- [[LinphoneManager instance] call:address displayName:displayName transfer:transferMode];
-}
-
#pragma mark - UITextFieldDelegate Functions
- (BOOL)textField:(UITextField *)textField
@@ -372,6 +361,12 @@ static UICompositeViewDescription *compositeDescription = nil;
if (textField == addressField) {
[addressField resignFirstResponder];
}
+ if (textField.text.length > 0) {
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, textField.text.UTF8String);
+ [LinphoneManager.instance call:addr transfer:FALSE];
+ if (addr)
+ linphone_address_destroy(addr);
+ }
return YES;
}
@@ -394,12 +389,11 @@ static UICompositeViewDescription *compositeDescription = nil;
[ContactSelection setSipFilter:nil];
[ContactSelection setNameOrEmailFilter:nil];
[ContactSelection enableEmailFilter:FALSE];
- ContactsListView *view = VIEW(ContactsListView);
- [PhoneMainView.instance changeCurrentView:view.class.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription];
}
- (IBAction)onBackClick:(id)event {
- [PhoneMainView.instance changeCurrentView:CallView.compositeViewDescription];
+ [PhoneMainView.instance popToView:CallView.compositeViewDescription];
}
- (IBAction)onAddressChange:(id)sender {
@@ -428,12 +422,15 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)onOneLongClick:(id)sender {
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneManager *lm = LinphoneManager.instance;
NSString *voiceMail = [lm lpConfigStringForKey:@"voice_mail_uri"];
- if (voiceMail != nil) {
- [lm call:voiceMail displayName:NSLocalizedString(@"Voice mail", nil) transfer:FALSE];
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, voiceMail ? voiceMail.UTF8String : NULL);
+ if (addr) {
+ linphone_address_set_display_name(addr, NSLocalizedString(@"Voice mail", nil).UTF8String);
+ [lm call:addr transfer:FALSE];
+ linphone_address_destroy(addr);
} else {
- LOGE(@"Cannot call voice mail because URI not set!");
+ LOGE(@"Cannot call voice mail because URI not set or invalid!");
}
}
@end
diff --git a/Classes/FirstLoginView.m b/Classes/FirstLoginView.m
index cd2473341..249163798 100644
--- a/Classes/FirstLoginView.m
+++ b/Classes/FirstLoginView.m
@@ -51,16 +51,16 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// Set observer
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(registrationUpdateEvent:)
- name:kLinphoneRegistrationUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(registrationUpdateEvent:)
+ name:kLinphoneRegistrationUpdate
+ object:nil];
- [_usernameField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_username"]];
- [_passwordField setText:[[LinphoneManager instance] lpConfigStringForKey:@"assistant_password"]];
+ [_usernameField setText:[LinphoneManager.instance lpConfigStringForKey:@"assistant_username"]];
+ [_passwordField setText:[LinphoneManager.instance lpConfigStringForKey:@"assistant_password"]];
// Update on show
- const MSList *list = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ const MSList *list = linphone_core_get_proxy_config_list(LC);
if (list != NULL) {
LinphoneProxyConfig *config = (LinphoneProxyConfig *)list->data;
if (config) {
@@ -97,18 +97,18 @@ static UICompositeViewDescription *compositeDescription = nil;
[super viewWillDisappear:animated];
// Remove observer
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
}
- (void)viewDidLoad {
[super viewDidLoad];
- NSString *siteUrl = [[LinphoneManager instance] lpConfigStringForKey:@"first_login_view_url"];
+ NSString *siteUrl = [LinphoneManager.instance lpConfigStringForKey:@"first_login_view_url"];
if (siteUrl == nil) {
siteUrl = @"http://www.linphone.org";
}
[_siteButton setTitle:siteUrl forState:UIControlStateNormal];
- account_creator = linphone_account_creator_new([LinphoneManager getLc], siteUrl.UTF8String);
+ account_creator = linphone_account_creator_new(LC, siteUrl.UTF8String);
}
- (void)shouldEnableNextButton {
@@ -128,7 +128,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)registrationUpdate:(LinphoneRegistrationState)state {
switch (state) {
case LinphoneRegistrationOk: {
- [[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"enable_first_login_view_preference"];
+ [LinphoneManager.instance lpConfigSetBool:FALSE forKey:@"enable_first_login_view_preference"];
[_waitView setHidden:true];
[PhoneMainView.instance changeCurrentView:DialerView.compositeViewDescription];
break;
@@ -142,8 +142,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[_waitView setHidden:true];
// erase uername passwd
- [[LinphoneManager instance] lpConfigSetString:nil forKey:@"assistant_username"];
- [[LinphoneManager instance] lpConfigSetString:nil forKey:@"assistant_password"];
+ [LinphoneManager.instance lpConfigSetString:nil forKey:@"assistant_username"];
+ [LinphoneManager.instance lpConfigSetString:nil forKey:@"assistant_password"];
break;
}
case LinphoneRegistrationProgress: {
@@ -170,8 +170,8 @@ static UICompositeViewDescription *compositeDescription = nil;
domain:_domainField.text
OnSuccess:^(NSString *url) {
if (url) {
- linphone_core_set_provisioning_uri([LinphoneManager getLc], url.UTF8String);
- [[LinphoneManager instance] resetLinphoneCore];
+ linphone_core_set_provisioning_uri(LC, url.UTF8String);
+ [LinphoneManager.instance resetLinphoneCore];
} else {
_waitView.hidden = YES;
}
diff --git a/Classes/HistoryDetailsTableView.m b/Classes/HistoryDetailsTableView.m
index 998b26949..c0a7a3dab 100644
--- a/Classes/HistoryDetailsTableView.m
+++ b/Classes/HistoryDetailsTableView.m
@@ -20,7 +20,7 @@
}
if (peer) {
- const MSList *logs = linphone_core_get_call_history_for_address([LinphoneManager getLc], peer);
+ const MSList *logs = linphone_core_get_call_history_for_address(LC, peer);
while (logs != NULL) {
LinphoneCallLog *log = (LinphoneCallLog *)logs->data;
if (linphone_address_weak_equal(linphone_call_log_get_remote_address(log), peer)) {
diff --git a/Classes/HistoryDetailsView.m b/Classes/HistoryDetailsView.m
index 02216d51c..37cbc7b33 100644
--- a/Classes/HistoryDetailsView.m
+++ b/Classes/HistoryDetailsView.m
@@ -72,20 +72,20 @@ static UICompositeViewDescription *compositeDescription = nil;
[self update];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(update)
- name:kLinphoneAddressBookUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(update)
+ name:kLinphoneAddressBookUpdate
+ object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(coreUpdateEvent:)
- name:kLinphoneCoreUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(coreUpdateEvent:)
+ name:kLinphoneCoreUpdate
+ object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - Event Functions
@@ -100,7 +100,7 @@ static UICompositeViewDescription *compositeDescription = nil;
// Look for the call log
callLog = NULL;
if (_callLogId) {
- const MSList *list = linphone_core_get_call_logs([LinphoneManager getLc]);
+ const MSList *list = linphone_core_get_call_logs(LC);
while (list != NULL) {
LinphoneCallLog *log = (LinphoneCallLog *)list->data;
const char *cid = linphone_call_log_get_call_id(log);
@@ -143,7 +143,7 @@ static UICompositeViewDescription *compositeDescription = nil;
ABRecordRef contact = [FastAddressBook getContactWithAddress:addr];
if (contact) {
ContactDetailsView *view = VIEW(ContactDetailsView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
[ContactSelection setSelectionMode:ContactSelectionModeNone];
[view setContact:contact];
}
@@ -159,33 +159,24 @@ static UICompositeViewDescription *compositeDescription = nil;
[ContactSelection setSipFilter:nil];
[ContactSelection enableEmailFilter:FALSE];
[ContactSelection setNameOrEmailFilter:nil];
- [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:ContactsListView.compositeViewDescription];
ms_free(lAddress);
}
}
- (IBAction)onCallClick:(id)event {
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
- char *lAddress = linphone_address_as_string_uri_only(addr);
- if (lAddress == NULL)
- return;
- NSString *displayName = [FastAddressBook displayNameForAddress:addr];
-
- DialerView *view = VIEW(DialerView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
- [view call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
- ms_free(lAddress);
+ [LinphoneManager.instance call:addr transfer:NO];
}
- (IBAction)onChatClick:(id)event {
const LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
if (addr == NULL)
return;
- [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
ChatConversationView *view = VIEW(ChatConversationView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
- LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr);
+ LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr);
[view setChatRoom:room];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
@end
diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m
index d65cd98d1..5ef0ff972 100644
--- a/Classes/HistoryListTableView.m
+++ b/Classes/HistoryListTableView.m
@@ -53,24 +53,24 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(loadData)
- name:kLinphoneAddressBookUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(loadData)
+ name:kLinphoneAddressBookUpdate
+ object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(coreUpdateEvent:)
- name:kLinphoneCoreUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(coreUpdateEvent:)
+ name:kLinphoneCoreUpdate
+ object:nil];
[self loadData];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneAddressBookUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneAddressBookUpdate object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCoreUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCoreUpdate object:nil];
}
#pragma mark - Event Functions
@@ -110,7 +110,7 @@
}
}
- const MSList *logs = linphone_core_get_call_logs([LinphoneManager getLc]);
+ const MSList *logs = linphone_core_get_call_logs(LC);
self.sections = [NSMutableDictionary dictionary];
while (logs != NULL) {
LinphoneCallLog *log = (LinphoneCallLog *)logs->data;
@@ -228,12 +228,7 @@
[cell onDetails:self];
} else {
LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog);
- char *uri = linphone_address_as_string(addr);
- DialerView *view = VIEW(DialerView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
- [view call:[NSString stringWithUTF8String:uri]
- displayName:[FastAddressBook displayNameForAddress:addr]];
- ms_free(uri);
+ [LinphoneManager.instance call:addr transfer:NO];
}
}
}
@@ -248,10 +243,10 @@
LinphoneCallLog *callLog = [log pointerValue];
MSList *count = linphone_call_log_get_user_data(callLog);
while (count) {
- linphone_core_remove_call_log([LinphoneManager getLc], count->data);
+ linphone_core_remove_call_log(LC, count->data);
count = count->next;
}
- linphone_core_remove_call_log([LinphoneManager getLc], callLog);
+ linphone_core_remove_call_log(LC, callLog);
linphone_call_log_unref(callLog);
[[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log];
if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) {
@@ -273,10 +268,10 @@
LinphoneCallLog *callLog = [log pointerValue];
MSList *count = linphone_call_log_get_user_data(callLog);
while (count) {
- linphone_core_remove_call_log([LinphoneManager getLc], count->data);
+ linphone_core_remove_call_log(LC, count->data);
count = count->next;
}
- linphone_core_remove_call_log([LinphoneManager getLc], callLog);
+ linphone_core_remove_call_log(LC, callLog);
linphone_call_log_unref(callLog);
[[_sections objectForKey:_sortedDays[indexPath.section]] removeObject:log];
if (((NSArray *)[_sections objectForKey:_sortedDays[indexPath.section]]).count == 0) {
diff --git a/Classes/HistoryListView.m b/Classes/HistoryListView.m
index fa9c6be73..06bb528be 100644
--- a/Classes/HistoryListView.m
+++ b/Classes/HistoryListView.m
@@ -58,9 +58,9 @@ static UICompositeViewDescription *compositeDescription = nil;
[self onEditionChangeClick:nil];
// Reset missed call
- linphone_core_reset_missed_calls_count([LinphoneManager getLc]);
+ linphone_core_reset_missed_calls_count(LC);
// Fake event
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
}
#pragma mark -
diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m
index bf13f0773..f8a76a36f 100644
--- a/Classes/ImagePickerView.m
+++ b/Classes/ImagePickerView.m
@@ -173,7 +173,7 @@ static UICompositeViewDescription *compositeDescription = nil;
void (^block)(UIImagePickerControllerSourceType) = ^(UIImagePickerControllerSourceType type) {
ImagePickerView *view = VIEW(ImagePickerView);
if (!(IPAD && ipadView && ipadPopoverView)) {
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
view.sourceType = type;
diff --git a/Classes/InAppProductsManager.m b/Classes/InAppProductsManager.m
index 76cb06fca..729d14a56 100644
--- a/Classes/InAppProductsManager.m
+++ b/Classes/InAppProductsManager.m
@@ -44,7 +44,7 @@
- (instancetype)init {
if ((self = [super init]) != nil) {
_enabled = (([SKPaymentQueue canMakePayments]) &&
- ([[LinphoneManager instance] lpConfigBoolForKey:@"enabled" inSection:@"in_app_purchase"]));
+ ([LinphoneManager.instance lpConfigBoolForKey:@"enabled" inSection:@"in_app_purchase"]));
_initialized = false;
_available = false;
_accountActivationInProgress = false;
@@ -107,8 +107,8 @@
monthly:(BOOL)monthly {
if (phoneNumber) {
NSString *productID =
- [[LinphoneManager instance] lpConfigStringForKey:(monthly ? @"paid_account_id_monthly" : @"paid_account_id")
- inSection:@"in_app_purchase"];
+ [LinphoneManager.instance lpConfigStringForKey:(monthly ? @"paid_account_id_monthly" : @"paid_account_id")
+ inSection:@"in_app_purchase"];
self.accountCreationData = @{ @"phoneNumber" : phoneNumber, @"password" : password, @"email" : email };
if (![self purchaseWitID:productID]) {
@@ -123,8 +123,8 @@
if (phoneNumber) {
NSString *receiptBase64 = [self getReceipt];
if (receiptBase64) {
- NSURL *URL = [NSURL URLWithString:[[LinphoneManager instance] lpConfigStringForKey:@"receipt_validation_url"
- inSection:@"in_app_purchase"]];
+ NSURL *URL = [NSURL URLWithString:[LinphoneManager.instance lpConfigStringForKey:@"receipt_validation_url"
+ inSection:@"in_app_purchase"]];
XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL:URL];
// buying for the first time: need to create the account
// if ([transaction.transactionIdentifier
@@ -175,7 +175,7 @@
#pragma mark ProductListLoading
- (void)loadProducts {
- NSArray *list = [[[[LinphoneManager instance] lpConfigStringForKey:@"products_list" inSection:@"in_app_purchase"]
+ NSArray *list = [[[LinphoneManager.instance lpConfigStringForKey:@"products_list" inSection:@"in_app_purchase"]
stringByReplacingOccurrencesOfString:@" "
withString:@""] componentsSeparatedByString:@","];
@@ -262,8 +262,8 @@
if (latestReceiptMD5 == nil || ![latestReceiptMD5 isEqualToString:[receiptBase64 md5]]) {
// transaction is null when restoring user purchases at application start or if user clicks the "restore" button
// We must validate the receipt on our server
- NSURL *URL = [NSURL URLWithString:[[LinphoneManager instance] lpConfigStringForKey:@"receipt_validation_url"
- inSection:@"in_app_purchase"]];
+ NSURL *URL = [NSURL URLWithString:[LinphoneManager.instance lpConfigStringForKey:@"receipt_validation_url"
+ inSection:@"in_app_purchase"]];
XMLRPCRequest *request = [[XMLRPCRequest alloc] initWithURL:URL];
// buying for the first time: need to create the account
// if ([transaction.transactionIdentifier
@@ -299,11 +299,11 @@
- (NSString *)getPhoneNumber {
NSString *phoneNumber = @"";
- LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
+ LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC);
if (config) {
const char *identity = linphone_proxy_config_get_identity(config);
if (identity) {
- LinphoneAddress *addr = linphone_address_new(identity);
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, identity);
if (addr) {
phoneNumber = [NSString stringWithUTF8String:linphone_address_get_username(addr)];
linphone_address_destroy(addr);
@@ -374,7 +374,7 @@
- (void)postNotificationforStatus:(IAPPurchaseNotificationStatus)status withDict:(NSDictionary *)dict {
_status = status;
LOGI(@"Triggering notification for status %@", status);
- [[NSNotificationCenter defaultCenter] postNotificationName:status object:self userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:status object:self userInfo:dict];
}
- (void)XMLRPCRequest:(XMLRPCRequest *)request didReceiveResponse:(XMLRPCResponse *)response {
@@ -389,7 +389,7 @@
LOGI(@"XMLRPC response %@: %@", [request method], [response body]);
NSString *productID =
- [[LinphoneManager instance] lpConfigStringForKey:@"paid_account_id" inSection:@"in_app_purchase"];
+ [LinphoneManager.instance lpConfigStringForKey:@"paid_account_id" inSection:@"in_app_purchase"];
// validation succeeded
if (![response isFault] && [response object] != nil) {
@@ -479,7 +479,7 @@
#else
- (void)postNotificationforStatus:(IAPPurchaseNotificationStatus)status {
_status = status;
- [[NSNotificationCenter defaultCenter] postNotificationName:status object:self userInfo:nil];
+ [NSNotificationCenter.defaultCenter postNotificationName:status object:self userInfo:nil];
LOGE(@"Not supported, triggering %@", status);
}
- (BOOL)purchaseAccount:(NSString *)phoneNumber
@@ -526,11 +526,11 @@
#pragma mark - XMLRPCConnectionDelegate Functions
- (void)request:(XMLRPCRequest *)request didReceiveResponse:(XMLRPCResponse *)response {
- [[[LinphoneManager instance] iapManager] XMLRPCRequest:request didReceiveResponse:response];
+ [[LinphoneManager.instance iapManager] XMLRPCRequest:request didReceiveResponse:response];
}
- (void)request:(XMLRPCRequest *)request didFailWithError:(NSError *)error {
- [[[LinphoneManager instance] iapManager] XMLRPCRequest:request didFailWithError:error];
+ [[LinphoneManager.instance iapManager] XMLRPCRequest:request didFailWithError:error];
}
- (BOOL)request:(XMLRPCRequest *)request canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
diff --git a/Classes/KIF b/Classes/KIF
index 21a137bc8..c01c06361 160000
--- a/Classes/KIF
+++ b/Classes/KIF
@@ -1 +1 @@
-Subproject commit 21a137bc8068f9fb738f835c6e285d44fe2ce4dd
+Subproject commit c01c063616dbdab05bea25eb94c7643a52f2b7dc
diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m
index c55dd4db4..32e7e37b4 100644
--- a/Classes/LinphoneAppDelegate.m
+++ b/Classes/LinphoneAppDelegate.m
@@ -48,17 +48,17 @@
- (void)applicationDidEnterBackground:(UIApplication *)application {
LOGI(@"%@", NSStringFromSelector(_cmd));
- [[LinphoneManager instance] enterBackgroundMode];
+ [LinphoneManager.instance enterBackgroundMode];
}
- (void)applicationWillResignActive:(UIApplication *)application {
LOGI(@"%@", NSStringFromSelector(_cmd));
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *call = linphone_core_get_current_call(lc);
if (call) {
/* save call context */
- LinphoneManager *instance = [LinphoneManager instance];
+ LinphoneManager *instance = LinphoneManager.instance;
instance->currentCallContextBeforeGoingBackground.call = call;
instance->currentCallContextBeforeGoingBackground.cameraIsEnabled = linphone_call_camera_enabled(call);
@@ -68,7 +68,7 @@
}
}
- if (![[LinphoneManager instance] resignActive]) {
+ if (![LinphoneManager.instance resignActive]) {
}
}
@@ -80,11 +80,11 @@
[PhoneMainView.instance startUp];
[PhoneMainView.instance updateStatusBar:nil];
}
- LinphoneManager *instance = [LinphoneManager instance];
+ LinphoneManager *instance = LinphoneManager.instance;
[instance becomeActive];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *call = linphone_core_get_current_call(lc);
if (call) {
@@ -159,7 +159,7 @@
UIApplication *app = [UIApplication sharedApplication];
UIApplicationState state = app.applicationState;
- LinphoneManager *instance = [LinphoneManager instance];
+ LinphoneManager *instance = LinphoneManager.instance;
BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"];
BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"];
@@ -199,7 +199,7 @@
[[UIApplication sharedApplication] endBackgroundTask:bgStartId];
}];
- [[LinphoneManager instance] startLinphoneCore];
+ [LinphoneManager.instance startLinphoneCore];
// initialize UI
[self.window makeKeyAndVisible];
[RootViewManager setupWithPortrait:(PhoneMainView *)self.window.rootViewController];
@@ -220,15 +220,15 @@
- (void)applicationWillTerminate:(UIApplication *)application {
LOGI(@"%@", NSStringFromSelector(_cmd));
- linphone_core_terminate_all_calls([LinphoneManager getLc]);
+ linphone_core_terminate_all_calls(LC);
// destroyLinphoneCore automatically unregister proxies but if we are using
// remote push notifications, we want to continue receiving them
- if ([LinphoneManager instance].pushNotificationToken != nil) {
+ if (LinphoneManager.instance.pushNotificationToken != nil) {
// trick me! setting network reachable to false will avoid sending unregister
- linphone_core_set_network_reachable([LinphoneManager getLc], FALSE);
+ linphone_core_set_network_reachable(LC, FALSE);
}
- [[LinphoneManager instance] destroyLinphoneCore];
+ [LinphoneManager.instance destroyLinphoneCore];
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
@@ -276,26 +276,23 @@
NSString *loc_key = [alert objectForKey:@"loc-key"];
/*if we receive a remote notification, it is probably because our TCP background socket was no more working.
As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (linphone_core_get_calls(lc) == NULL) { // if there are calls, obviously our TCP socket shall be working
linphone_core_set_network_reachable(lc, FALSE);
- [LinphoneManager instance].connectivity = none; /*force connectivity to be discovered again*/
- [[LinphoneManager instance] refreshRegisters];
+ LinphoneManager.instance.connectivity = none; /*force connectivity to be discovered again*/
+ [LinphoneManager.instance refreshRegisters];
if (loc_key != nil) {
NSString *callId = [userInfo objectForKey:@"call-id"];
if (callId != nil) {
- [[LinphoneManager instance] addPushCallId:callId];
+ [LinphoneManager.instance addPushCallId:callId];
} else {
LOGE(@"PushNotification: does not have call-id yet, fix it !");
}
if ([loc_key isEqualToString:@"IM_MSG"] || [loc_key isEqualToString:@"IM_FULLMSG"]) {
-
[PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
-
} else if ([loc_key isEqualToString:@"IC_MSG"]) {
-
[self fixRing];
}
}
@@ -311,7 +308,7 @@
}
- (LinphoneChatRoom *)findChatRoomForContact:(NSString *)contact {
- const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]);
+ const MSList *rooms = linphone_core_get_chat_rooms(LC);
const char *from = [contact UTF8String];
while (rooms) {
const LinphoneAddress *room_from_address = linphone_chat_room_get_peer_address((LinphoneChatRoom *)rooms->data);
@@ -333,24 +330,23 @@
BOOL auto_answer = TRUE;
// some local notifications have an internal timer to relaunch themselves at specified intervals
if ([[notification.userInfo objectForKey:@"timer"] intValue] == 1) {
- [[LinphoneManager instance] cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]];
- auto_answer = [[LinphoneManager instance] lpConfigBoolForKey:@"autoanswer_notif_preference"];
+ [LinphoneManager.instance cancelLocalNotifTimerForCallId:[notification.userInfo objectForKey:@"callId"]];
+ auto_answer = [LinphoneManager.instance lpConfigBoolForKey:@"autoanswer_notif_preference"];
}
if (auto_answer) {
- [[LinphoneManager instance] acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]];
+ [LinphoneManager.instance acceptCallForCallId:[notification.userInfo objectForKey:@"callId"]];
}
} else if ([notification.userInfo objectForKey:@"from_addr"] != nil) {
NSString *remoteContact = (NSString *)[notification.userInfo objectForKey:@"from_addr"];
- [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
LinphoneChatRoom *room = [self findChatRoomForContact:remoteContact];
ChatConversationView *view = VIEW(ChatConversationView);
[view setChatRoom:room];
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
} else if ([notification.userInfo objectForKey:@"callLog"] != nil) {
NSString *callLog = (NSString *)[notification.userInfo objectForKey:@"callLog"];
HistoryDetailsView *view = VIEW(HistoryDetailsView);
[view setCallLogId:callLog];
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
}
}
@@ -360,7 +356,7 @@
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
LOGI(@"%@ : %@", NSStringFromSelector(_cmd), userInfo);
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneManager *lm = LinphoneManager.instance;
// save the completion handler for later execution.
// 2 outcomes:
@@ -373,7 +369,7 @@
userInfo:nil
repeats:FALSE];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
// If no call is yet received at this time, then force Linphone to drop the current socket and make new one to
// register, so that we get
// a better chance to receive the INVITE.
@@ -389,12 +385,12 @@
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
LOGI(@"%@ : %@", NSStringFromSelector(_cmd), deviceToken);
- [[LinphoneManager instance] setPushNotificationToken:deviceToken];
+ [LinphoneManager.instance setPushNotificationToken:deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
LOGI(@"%@ : %@", NSStringFromSelector(_cmd), [error localizedDescription]);
- [[LinphoneManager instance] setPushNotificationToken:nil];
+ [LinphoneManager.instance setPushNotificationToken:nil];
}
#pragma mark - User notifications
@@ -411,7 +407,7 @@
LOGI(@"%@", NSStringFromSelector(_cmd));
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LOGI(@"%@", NSStringFromSelector(_cmd));
if ([notification.category isEqualToString:@"incoming_call"]) {
if ([identifier isEqualToString:@"answer"]) {
@@ -455,7 +451,7 @@
- (void)ConfigurationStateUpdateEvent:(NSNotification *)notif {
LinphoneConfiguringState state = [[notif.userInfo objectForKey:@"state"] intValue];
if (state == LinphoneConfiguringSuccessful) {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
UIAlertView *error = [[UIAlertView alloc]
@@ -468,7 +464,7 @@
[PhoneMainView.instance startUp];
}
if (state == LinphoneConfiguringFailed) {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneConfiguringStateUpdate object:nil];
[_waitingIndicator dismissWithClickedButtonIndex:0 animated:true];
UIAlertView *error =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Failure", nil)
@@ -507,13 +503,13 @@
- (void)attemptRemoteConfiguration {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(ConfigurationStateUpdateEvent:)
- name:kLinphoneConfiguringStateUpdate
- object:nil];
- linphone_core_set_provisioning_uri([LinphoneManager getLc], [configURL UTF8String]);
- [[LinphoneManager instance] destroyLinphoneCore];
- [[LinphoneManager instance] startLinphoneCore];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(ConfigurationStateUpdateEvent:)
+ name:kLinphoneConfiguringStateUpdate
+ object:nil];
+ linphone_core_set_provisioning_uri(LC, [configURL UTF8String]);
+ [LinphoneManager.instance destroyLinphoneCore];
+ [LinphoneManager.instance startLinphoneCore];
}
@end
diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index fdf02aa8d..e2a511700 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -99,7 +99,7 @@
}
- (void)transformCodecsToKeys:(const MSList *)codecs {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
const MSList *elem = codecs;
for (; elem != NULL; elem = elem->next) {
@@ -115,7 +115,7 @@
}
- (void)transformAccountToKeys:(NSString *)username {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
const MSList *proxies = linphone_core_get_proxy_config_list(lc);
while (username && proxies &&
strcmp(username.UTF8String,
@@ -151,7 +151,7 @@
const LinphoneAddress *identity_addr = linphone_proxy_config_get_identity_address(proxy);
if (identity_addr) {
const char *server_addr = linphone_proxy_config_get_server_addr(proxy);
- LinphoneAddress *proxy_addr = linphone_address_new(server_addr);
+ LinphoneAddress *proxy_addr = linphone_core_interpret_url(LC, server_addr);
int port = linphone_address_get_port(proxy_addr);
[self setCString:linphone_address_get_username(identity_addr)
@@ -218,12 +218,12 @@
}
- (void)transformLinphoneCoreToKeys {
- LinphoneManager *lm = [LinphoneManager instance];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneManager *lm = LinphoneManager.instance;
+ LinphoneCore *lc = LC;
// root section
{
- const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ const MSList *accounts = linphone_core_get_proxy_config_list(LC);
int count = ms_list_size(accounts);
for (int i = 1; i <= count; i++, accounts = accounts->next) {
NSString *key = [NSString stringWithFormat:@"menu_account_%d", i];
@@ -265,7 +265,7 @@
[self setBool:(pol->automatically_accept) forKey:@"accept_video_preference"];
[self setBool:linphone_core_self_view_enabled(lc) forKey:@"self_video_preference"];
BOOL previewEnabled = [lm lpConfigBoolForKey:@"preview_preference" withDefault:YES];
- [self setBool:previewEnabled forKey:@"preview_preference"];
+ [self setBool:IPAD && previewEnabled forKey:@"preview_preference"];
const char *preset = linphone_core_get_video_preset(lc);
[self setCString:preset ? preset : "default" forKey:@"video_preset_preference"];
@@ -348,7 +348,7 @@
// tunnel section
if (linphone_core_tunnel_available()) {
- LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]);
+ LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC);
[self setObject:[lm lpConfigStringForKey:@"tunnel_mode_preference" withDefault:@"off"]
forKey:@"tunnel_mode_preference"];
const MSList *configs = linphone_tunnel_get_servers(tunnel);
@@ -364,17 +364,13 @@
// advanced section
{
- [self setBool:[lm lpConfigBoolForKey:@"debugenable_preference" withDefault:NO]
- forKey:@"debugenable_preference"];
- [self setBool:[lm lpConfigBoolForKey:@"animations_preference" withDefault:NO] forKey:@"animations_preference"];
- [self setBool:[lm lpConfigBoolForKey:@"backgroundmode_preference" withDefault:NO]
- forKey:@"backgroundmode_preference"];
- [self setBool:[lm lpConfigBoolForKey:@"start_at_boot_preference" withDefault:NO]
- forKey:@"start_at_boot_preference"];
- [self setBool:[lm lpConfigBoolForKey:@"autoanswer_notif_preference" withDefault:NO]
- forKey:@"autoanswer_notif_preference"];
+ [self setBool:[lm lpConfigBoolForKey:@"debugenable_preference"] forKey:@"debugenable_preference"];
+ [self setBool:ANIMATED forKey:@"animations_preference"];
+ [self setBool:[lm lpConfigBoolForKey:@"backgroundmode_preference"] forKey:@"backgroundmode_preference"];
+ [self setBool:[lm lpConfigBoolForKey:@"start_at_boot_preference"] forKey:@"start_at_boot_preference"];
+ [self setBool:[lm lpConfigBoolForKey:@"autoanswer_notif_preference"] forKey:@"autoanswer_notif_preference"];
[self setBool:[lm lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES] forKey:@"show_msg_in_notif"];
- [self setBool:[lm lpConfigBoolForKey:@"enable_first_login_view_preference" withDefault:NO]
+ [self setBool:[lm lpConfigBoolForKey:@"enable_first_login_view_preference"]
forKey:@"enable_first_login_view_preference"];
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc);
if (parsed != NULL) {
@@ -389,7 +385,7 @@
// Post event
NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneLogsUpdate object:self userInfo:eventDic];
}
- (void)alertAccountError:(NSString *)error {
@@ -403,8 +399,8 @@
- (void)synchronizeAccounts {
LOGI(@"Account changed, synchronizing.");
- LinphoneManager *lm = [LinphoneManager instance];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneManager *lm = LinphoneManager.instance;
+ LinphoneCore *lc = LC;
LinphoneProxyConfig *proxyCfg = NULL;
NSString *error = nil;
@@ -457,7 +453,7 @@
const char *route = NULL;
- if (isWifiOnly && [LinphoneManager instance].connectivity == wwan)
+ if (isWifiOnly && LinphoneManager.instance.connectivity == wwan)
expire = 0;
if ((!proxyAddress || [proxyAddress length] < 1) && domain) {
@@ -469,7 +465,7 @@
}
char *proxy = ms_strdup(proxyAddress.UTF8String);
- LinphoneAddress *proxy_addr = linphone_address_new(proxy);
+ LinphoneAddress *proxy_addr = linphone_core_interpret_url(LC, proxy);
if (proxy_addr) {
LinphoneTransportType type = LinphoneTransportUdp;
@@ -484,7 +480,7 @@
}
char normalizedUserName[256];
- LinphoneAddress *linphoneAddress = linphone_address_new("sip:user@domain.com");
+ LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, "sip:user@domain.com");
proxyCfg = ms_list_nth_data(linphone_core_get_proxy_config_list(lc),
[self integerForKey:@"current_proxy_config_preference"]);
@@ -527,7 +523,7 @@
}
[lm lpConfigSetInt:pushnotification forKey:@"pushnotification_preference"];
- [[LinphoneManager instance] configurePushTokenForProxyConfig:proxyCfg];
+ [LinphoneManager.instance configurePushTokenForProxyConfig:proxyCfg];
linphone_proxy_config_enable_register(proxyCfg, is_enabled);
linphone_proxy_config_enable_avpf(proxyCfg, use_avpf);
@@ -548,7 +544,7 @@
if (proxyAi) {
linphone_core_remove_auth_info(lc, proxyAi);
}
- LinphoneAddress *from = linphone_address_new(identity);
+ LinphoneAddress *from = linphone_core_interpret_url(LC, identity);
if (from) {
const char *userid_str = (userID != nil) ? [userID UTF8String] : NULL;
LinphoneAuthInfo *info = linphone_auth_info_new(
@@ -577,11 +573,11 @@
}
}
// reload address book to prepend proxy config domain to contacts' phone number
- [[[LinphoneManager instance] fastAddressBook] reload];
+ [[LinphoneManager.instance fastAddressBook] reload];
}
- (void)synchronizeCodecs:(const MSList *)codecs {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
PayloadType *pt;
const MSList *elem;
@@ -593,8 +589,8 @@
}
- (BOOL)synchronize {
- LinphoneManager *lm = [LinphoneManager instance];
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneManager *lm = LinphoneManager.instance;
+ LinphoneCore *lc = LC;
// root section
{
BOOL account_changed = NO;
@@ -640,7 +636,7 @@
BOOL equalizer = [self boolForKey:@"eq_active"];
[lm lpConfigSetBool:equalizer forKey:@"eq_active" inSection:@"sound"];
- [[LinphoneManager instance] configureVbrCodecs];
+ [LinphoneManager.instance configureVbrCodecs];
NSString *au_device = @"AU: Audio Unit Receiver";
if (!voice_processing) {
@@ -659,7 +655,7 @@
policy.automatically_accept = [self boolForKey:@"accept_video_preference"];
linphone_core_set_video_policy(lc, &policy);
linphone_core_enable_self_view(lc, [self boolForKey:@"self_video_preference"]);
- BOOL preview_preference = [self boolForKey:@"preview_preference"];
+ BOOL preview_preference = IPAD && [self boolForKey:@"preview_preference"];
[lm lpConfigSetInt:preview_preference forKey:@"preview_preference"];
NSString *videoPreset = [self stringForKey:@"video_preset_preference"];
@@ -713,7 +709,7 @@
BOOL wifiOnly = [self boolForKey:@"wifi_only_preference"];
[lm lpConfigSetInt:wifiOnly forKey:@"wifi_only_preference"];
if ([self valueChangedForKey:@"wifi_only_preference"]) {
- [[LinphoneManager instance] setupNetworkReachabilityCallback];
+ [LinphoneManager.instance setupNetworkReachabilityCallback];
}
NSString *stun_server = [self stringForKey:@"stun_preference"];
@@ -762,7 +758,7 @@
NSString *lTunnelPrefMode = [self stringForKey:@"tunnel_mode_preference"];
NSString *lTunnelPrefAddress = [self stringForKey:@"tunnel_address_preference"];
int lTunnelPrefPort = [self integerForKey:@"tunnel_port_preference"];
- LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]);
+ LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC);
TunnelMode mode = tunnel_off;
int lTunnelPort = 443;
if (lTunnelPrefPort) {
@@ -790,16 +786,12 @@
}
[lm lpConfigSetString:lTunnelPrefMode forKey:@"tunnel_mode_preference"];
- [[LinphoneManager instance] setTunnelMode:mode];
+ [LinphoneManager.instance setTunnelMode:mode];
}
}
// advanced section
{
- BOOL debugmode = [self boolForKey:@"debugenable_preference"];
- [lm lpConfigSetInt:debugmode forKey:@"debugenable_preference"];
- [[LinphoneManager instance] setLogsEnabled:debugmode];
-
BOOL animations = [self boolForKey:@"animations_preference"];
[lm lpConfigSetInt:animations forKey:@"animations_preference"];
@@ -839,13 +831,13 @@
// Post event
NSDictionary *eventDic = [NSDictionary dictionaryWithObject:self forKey:@"settings"];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneSettingsUpdate object:self userInfo:eventDic];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneSettingsUpdate object:self userInfo:eventDic];
return YES;
}
- (void)removeAccount {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneProxyConfig *config = ms_list_nth_data(linphone_core_get_proxy_config_list(lc),
[self integerForKey:@"current_proxy_config_preference"]);
diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h
index ba7a45232..3387f31cf 100644
--- a/Classes/LinphoneManager.h
+++ b/Classes/LinphoneManager.h
@@ -154,7 +154,6 @@ typedef struct _LinphoneManagerSounds {
- (bool)allowSpeaker;
- (void)configureVbrCodecs;
-- (void)setLogsEnabled:(BOOL)enabled;
+ (BOOL)copyFile:(NSString*)src destination:(NSString*)dst override:(BOOL)override;
+ (NSString*)bundleFile:(NSString*)file;
@@ -162,8 +161,7 @@ typedef struct _LinphoneManagerSounds {
+ (NSString*)cacheDirectory;
- (void)acceptCall:(LinphoneCall *)call evenWithVideo:(BOOL)video;
-- (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer;
-
+- (BOOL)call:(const LinphoneAddress *)address transfer:(BOOL)transfer;
+(id)getMessageAppDataForKey:(NSString*)key inMessage:(LinphoneChatMessage*)msg;
+(void)setValueInMessageAppData:(id)value forKey:(NSString*)key inMessage:(LinphoneChatMessage*)msg;
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index f6348ed4c..6c8053f2d 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -72,13 +72,13 @@ NSString *const kLinphoneFileTransferRecvUpdate = @"LinphoneFileTransferRecvUpda
const int kLinphoneAudioVbrCodecDefaultBitrate = 36; /*you can override this from linphonerc or linphonerc-factory*/
-extern void libmsilbc_init(void);
-extern void libmsamr_init(void);
-extern void libmsx264_init(void);
-extern void libmsopenh264_init(void);
-extern void libmssilk_init(void);
-extern void libmsbcg729_init(void);
-extern void libmswebrtc_init(void);
+extern void libmsilbc_init(MSFactory *factory);
+extern void libmsamr_init(MSFactory *factory);
+extern void libmsx264_init(MSFactory *factory);
+extern void libmsopenh264_init(MSFactory *factory);
+extern void libmssilk_init(MSFactory *factory);
+extern void libmsbcg729_init(MSFactory *factory);
+extern void libmswebrtc_init(MSFactory *factory);
#define FRONT_CAM_NAME \
"AV Capture: com.apple.avfoundation.avcapturedevice.built-in_video:1" /*"AV Capture: Front Camera"*/
@@ -251,10 +251,10 @@ struct codec_name_pref_table codec_pref_table[] = {{"speex", 8000, "speex_8k_pre
- (id)init {
if ((self = [super init])) {
AudioSessionInitialize(NULL, NULL, NULL, NULL);
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(audioRouteChangeListenerCallback2:)
- name:AVAudioSessionRouteChangeNotification
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(audioRouteChangeListenerCallback2:)
+ name:AVAudioSessionRouteChangeNotification
+ object:nil];
NSString *path = [[NSBundle mainBundle] pathForResource:@"msg" ofType:@"wav"];
self.messagePlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:path] error:nil];
@@ -292,7 +292,7 @@ struct codec_name_pref_table codec_pref_table[] = {{"speex", 8000, "speex_8k_pre
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)silentPushFailed:(NSTimer *)timer {
@@ -440,7 +440,6 @@ exit_dbmigration:
return;
if ([self lpConfigIntForKey:migration_flag withDefault:0]) {
- LOGI(@"UserPrefs migration already performed, skip");
return;
}
@@ -519,9 +518,8 @@ exit_dbmigration:
/* File transfer migration */
if ([self lpConfigBoolForKey:@"file_transfer_migration_done"] == FALSE) {
const char *newURL = "https://www.linphone.org:444/lft.php";
- LOGI(@"Migrating sharing server url from %s to %s",
- linphone_core_get_file_transfer_server([LinphoneManager getLc]), newURL);
- linphone_core_set_file_transfer_server([LinphoneManager getLc], newURL);
+ LOGI(@"Migrating sharing server url from %s to %s", linphone_core_get_file_transfer_server(LC), newURL);
+ linphone_core_set_file_transfer_server(LC, newURL);
[self lpConfigSetBool:TRUE forKey:@"file_transfer_migration_done"];
}
}
@@ -568,7 +566,7 @@ static void dump_section(const char *section, void *data) {
+ (void)dumpLcConfig {
if (theLinphoneCore) {
- LpConfig *conf = [LinphoneManager instance].configDb;
+ LpConfig *conf = LinphoneManager.instance.configDb;
lp_config_for_each_section(conf, dump_section, conf);
}
}
@@ -585,11 +583,11 @@ static void linphone_iphone_log_user_warning(struct _LinphoneCore *lc, const cha
- (void)displayStatus:(NSString *)message {
// Post event
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneDisplayStatusUpdate
- object:self
- userInfo:@{
- @"message" : message
- }];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneDisplayStatusUpdate
+ object:self
+ userInfo:@{
+ @"message" : message
+ }];
}
static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char *message) {
@@ -650,7 +648,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char
LinphoneCallLog *callLog = linphone_call_get_call_log(call);
NSString *callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)];
- if (![[LinphoneManager instance] popPushCallID:callId]) {
+ if (![LinphoneManager.instance popPushCallID:callId]) {
// case where a remote notification is not already received
// Create a new local notification
data->notification = [[UILocalNotification alloc] init];
@@ -773,8 +771,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char
@"state" : [NSNumber numberWithInt:state],
@"message" : [NSString stringWithUTF8String:message]
};
- LOGI(@"Call %p changed to state %s: %s", call, linphone_call_state_to_string(state), message);
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self userInfo:dict];
}
static void linphone_iphone_call_state(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState state,
@@ -802,7 +799,7 @@ static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGloba
// dispatch the notification asynchronously
dispatch_async(dispatch_get_main_queue(), ^(void) {
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneGlobalStateUpdate object:self userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneGlobalStateUpdate object:self userInfo:dict];
});
}
@@ -829,9 +826,9 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon
// dispatch the notification asynchronously
dispatch_async(dispatch_get_main_queue(), ^(void) {
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneConfiguringStateUpdate
- object:self
- userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneConfiguringStateUpdate
+ object:self
+ userInfo:dict];
});
}
@@ -856,7 +853,7 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon
NSDictionary *dict = [NSDictionary
dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:state], @"state", [NSValue valueWithPointer:cfg], @"cfg",
[NSString stringWithUTF8String:message], @"message", nil];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneRegistrationUpdate object:self userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneRegistrationUpdate object:self userInfo:dict];
}
static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyConfig *cfg,
@@ -906,13 +903,12 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
LinphoneAuthInfo *info =
linphone_auth_info_new(username.UTF8String, NULL, password.UTF8String, NULL,
realm.UTF8String, domain.UTF8String);
- linphone_core_add_auth_info([LinphoneManager getLc], info);
+ linphone_core_add_auth_info(LC, info);
[LinphoneManager.instance refreshRegisters];
}];
[alertView addButtonWithTitle:NSLocalizedString(@"Go to settings", nil)
block:^{
- SettingsView *view = VIEW(SettingsView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
+ [PhoneMainView.instance changeCurrentView:SettingsView.compositeViewDescription];
}];
[alertView show];
}
@@ -933,9 +929,6 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
NSString *from = [FastAddressBook displayNameForAddress:remoteAddress];
char *c_address = linphone_address_as_string_uri_only(remoteAddress);
NSString *remote_uri = [NSString stringWithUTF8String:c_address];
- const char *chat = linphone_chat_message_get_text(msg);
- if (chat == NULL)
- chat = "";
ms_free(c_address);
@@ -943,12 +936,13 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
// Create a new notification
UILocalNotification *notif = [[UILocalNotification alloc] init];
if (notif) {
+ NSString *chat = [UIChatBubbleTextCell TextMessageForChat:msg];
notif.repeatInterval = 0;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8) {
notif.category = @"incoming_msg";
}
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) {
- notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, @(chat)];
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"show_msg_in_notif" withDefault:YES]) {
+ notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_FULLMSG", nil), from, chat];
} else {
notif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"IM_MSG", nil), from];
}
@@ -968,7 +962,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
@"call-id" : callID
};
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMessageReceived object:self userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMessageReceived object:self userInfo:dict];
}
static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message) {
@@ -986,7 +980,7 @@ static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom
if (body != NULL) {
[dict setObject:[NSValue valueWithPointer:body] forKey:@"content"];
}
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneNotifyReceived object:self userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneNotifyReceived object:self userInfo:dict];
}
static void linphone_iphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event,
@@ -1014,19 +1008,17 @@ static void linphone_iphone_call_encryption_changed(LinphoneCore *lc, LinphoneCa
[dict setObject:[NSValue valueWithPointer:call] forKey:@"call"];
[dict setObject:[NSNumber numberWithBool:on] forKey:@"on"];
[dict setObject:[NSString stringWithUTF8String:authentication_token] forKey:@"token"];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallEncryptionChanged
- object:self
- userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallEncryptionChanged object:self userInfo:dict];
}
#pragma mark - Message composition start
- (void)onMessageComposeReceived:(LinphoneCore *)core forRoom:(LinphoneChatRoom *)room {
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneTextComposeEvent
- object:self
- userInfo:@{
- @"room" : [NSValue valueWithPointer:room]
- }];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneTextComposeEvent
+ object:self
+ userInfo:@{
+ @"room" : [NSValue valueWithPointer:room]
+ }];
}
static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room) {
@@ -1135,7 +1127,7 @@ static void showNetworkFlags(SCNetworkReachabilityFlags flags) {
static void networkReachabilityNotification(CFNotificationCenterRef center, void *observer, CFStringRef name,
const void *object, CFDictionaryRef userInfo) {
- LinphoneManager *mgr = [LinphoneManager instance];
+ LinphoneManager *mgr = LinphoneManager.instance;
SCNetworkReachabilityFlags flags;
// for an unknown reason, we are receiving multiple time the notification, so
@@ -1153,7 +1145,7 @@ static void networkReachabilityNotification(CFNotificationCenterRef center, void
void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *nilCtx) {
showNetworkFlags(flags);
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneManager *lm = LinphoneManager.instance;
SCNetworkReachabilityFlags networkDownFlags = kSCNetworkReachabilityFlagsConnectionRequired |
kSCNetworkReachabilityFlagsConnectionOnTraffic |
kSCNetworkReachabilityFlagsConnectionOnDemand;
@@ -1167,7 +1159,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
lm.connectivity = none;
[LinphoneManager kickOffNetworkConnection];
} else {
- LinphoneTunnel *tunnel = linphone_core_get_tunnel([LinphoneManager getLc]);
+ LinphoneTunnel *tunnel = linphone_core_get_tunnel(LC);
Connectivity newConnectivity;
BOOL isWifiOnly = [lm lpConfigBoolForKey:@"wifi_only_preference" withDefault:FALSE];
if (!ctx || ctx->testWWan)
@@ -1390,9 +1382,9 @@ static LinphoneCoreVTable linphonec_vtable = {
// Post event
NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCoreUpdate
- object:[LinphoneManager instance]
- userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCoreUpdate
+ object:LinphoneManager.instance
+ userInfo:dict];
}
static BOOL libStarted = FALSE;
@@ -1448,18 +1440,18 @@ static BOOL libStarted = FALSE;
return;
}
linphone_core_set_log_collection_path([[LinphoneManager cacheDirectory] UTF8String]);
- [self setLogsEnabled:[self lpConfigBoolForKey:@"debugenable_preference"]];
+ [Log enableLogs:[self lpConfigBoolForKey:@"debugenable_preference"]];
connectivity = none;
ms_init(); // Need to initialize mediastreamer2 before loading the plugins
// Load plugins if available in the linphone SDK - otherwise these calls will do nothing
- libmsilbc_init();
- libmssilk_init();
- libmsamr_init();
- libmsx264_init();
- libmsopenh264_init();
- libmsbcg729_init();
- libmswebrtc_init();
+ libmsilbc_init(ms_factory_get_fallback());
+ libmssilk_init(ms_factory_get_fallback());
+ libmsamr_init(ms_factory_get_fallback());
+ libmsx264_init(ms_factory_get_fallback());
+ libmsopenh264_init(ms_factory_get_fallback());
+ libmsbcg729_init(ms_factory_get_fallback());
+ libmswebrtc_init(ms_factory_get_fallback());
theLinphoneCore = linphone_core_new_with_config(&linphonec_vtable, configDb, (__bridge void *)(self));
LOGI(@"Create linphonecore %p", theLinphoneCore);
@@ -1495,19 +1487,19 @@ static BOOL libStarted = FALSE;
(or skipped).
Wait for this to finish the code configuration */
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(audioSessionInterrupted:)
- name:AVAudioSessionInterruptionNotification
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(globalStateChangedNotificationHandler:)
- name:kLinphoneGlobalStateUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(configuringStateChangedNotificationHandler:)
- name:kLinphoneConfiguringStateUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(inappReady:) name:kIAPReady object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(audioSessionInterrupted:)
+ name:AVAudioSessionInterruptionNotification
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(globalStateChangedNotificationHandler:)
+ name:kLinphoneGlobalStateUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(configuringStateChangedNotificationHandler:)
+ name:kLinphoneConfiguringStateUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(inappReady:) name:kIAPReady object:nil];
/*call iterate once immediately in order to initiate background connections with sip server or remote provisioning
* grab, if any */
@@ -1522,7 +1514,7 @@ static BOOL libStarted = FALSE;
// just in case
[self removeCTCallCenterCb];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
if (theLinphoneCore != nil) { // just in case application terminate before linphone core initialization
@@ -1539,9 +1531,9 @@ static BOOL libStarted = FALSE;
// Post event
NSDictionary *dict =
[NSDictionary dictionaryWithObject:[NSValue valueWithPointer:theLinphoneCore] forKey:@"core"];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCoreUpdate
- object:[LinphoneManager instance]
- userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCoreUpdate
+ object:LinphoneManager.instance
+ userInfo:dict];
SCNetworkReachabilityUnscheduleFromRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
if (proxyReachability)
@@ -1625,7 +1617,7 @@ static int comp_call_id(const LinphoneCall *call, const char *callid) {
if (!success) {
LOGE(@"Could not play the message sound");
}
- AudioServicesPlaySystemSound([LinphoneManager instance].sounds.vibrate);
+ AudioServicesPlaySystemSound(LinphoneManager.instance.sounds.vibrate);
}
static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
@@ -1646,14 +1638,14 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
// handle proxy config if any
if (proxyCfg) {
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"backgroundmode_preference"] ||
- [[LinphoneManager instance] lpConfigBoolForKey:@"pushnotification_preference"]) {
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"] ||
+ [LinphoneManager.instance lpConfigBoolForKey:@"pushnotification_preference"]) {
// For registration register
[self refreshRegisters];
}
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"backgroundmode_preference"]) {
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"]) {
// register keepalive
if ([[UIApplication sharedApplication]
@@ -1699,7 +1691,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
LOGI(@"Entering [%s] bg mode", shouldEnterBgMode ? "normal" : "lite");
if (!shouldEnterBgMode) {
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"pushnotification_preference"]) {
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"pushnotification_preference"]) {
LOGI(@"Keeping lc core to handle push");
/*destroy voip socket if any and reset connectivity mode*/
connectivity = none;
@@ -1727,8 +1719,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
linphone_core_start_dtmf_stream(theLinphoneCore);
/*start the video preview in case we are in the main view*/
- if (IPAD && linphone_core_video_display_enabled(theLinphoneCore) &&
- [self lpConfigBoolForKey:@"preview_preference"]) {
+ if (linphone_core_video_display_enabled(theLinphoneCore) && [self lpConfigBoolForKey:@"preview_preference"]) {
linphone_core_enable_video_preview(theLinphoneCore, TRUE);
}
/*check last keepalive handler date*/
@@ -1844,9 +1835,9 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
NSDictionary *dict =
[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:bluetoothAvailable], @"available", nil];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneBluetoothAvailabilityUpdate
- object:self
- userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneBluetoothAvailabilityUpdate
+ object:self
+ userInfo:dict];
CFRelease(newRoute);
}
}
@@ -1916,7 +1907,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
linphone_core_accept_call_with_params(theLinphoneCore, call, lcallParams);
}
-- (void)call:(NSString *)address displayName:(NSString *)displayName transfer:(BOOL)transfer {
+- (BOOL)call:(const LinphoneAddress *)iaddr transfer:(BOOL)transfer {
// First verify that network is available, abort otherwise.
if (!linphone_core_is_network_reachable(theLinphoneCore)) {
UIAlertView *error = [[UIAlertView alloc]
@@ -1929,7 +1920,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
- return;
+ return FALSE;
}
// Then check that no GSM calls are in progress, abort otherwise.
@@ -1943,14 +1934,11 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
- return;
+ return FALSE;
}
- LinphoneAddress *addr = NULL;
- // Continue by checking that the provided address is a valid SIP address, abort otherwise.
- if ([address length] == 0) {
- // no address provided... nothing to do
- } else if ((addr = linphone_core_interpret_url([LinphoneManager getLc], address.UTF8String)) == NULL) {
+ // Then check that the supplied address is valid
+ if (!iaddr) {
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
@@ -1960,44 +1948,48 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
otherButtonTitles:nil];
[error show];
+ return FALSE;
+ }
+ LinphoneAddress *addr = linphone_address_clone(iaddr);
+ NSString *displayName = [FastAddressBook displayNameForAddress:addr];
+
+ // Finally we can make the call
+ LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL);
+ if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) {
+ LOGI(@"Enabling low bandwidth mode");
+ linphone_call_params_enable_low_bandwidth(lcallParams, YES);
+ }
+
+ if (displayName != nil) {
+ linphone_address_set_display_name(addr, displayName.UTF8String);
+ }
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"override_domain_with_default_one"]) {
+ linphone_address_set_domain(
+ addr, [[LinphoneManager.instance lpConfigStringForKey:@"domain" inSection:@"assistant"] UTF8String]);
+ }
+ if (transfer) {
+ char *caddr = linphone_address_as_string(addr);
+ linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), caddr);
+ ms_free(caddr);
} else {
- // Finally we can make the call
- LinphoneCallParams *lcallParams = linphone_core_create_call_params(theLinphoneCore, NULL);
- if ([self lpConfigBoolForKey:@"edge_opt_preference"] && (self.network == network_2g)) {
- LOGI(@"Enabling low bandwidth mode");
- linphone_call_params_enable_low_bandwidth(lcallParams, YES);
- }
-
- if (displayName != nil) {
- linphone_address_set_display_name(addr, displayName.UTF8String);
- }
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"override_domain_with_default_one"]) {
- linphone_address_set_domain(
- addr, [[[LinphoneManager instance] lpConfigStringForKey:@"domain" inSection:@"assistant"] UTF8String]);
- }
-
- if (transfer) {
- char *caddr = linphone_address_as_string(addr);
- linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), caddr);
- ms_free(caddr);
- } else {
- LinphoneCall *call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams);
- if (call) {
- // The LinphoneCallAppData object should be set on call creation with callback
- // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash
- // We are NOT responsible for creating the AppData.
- LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call);
- if (data == nil) {
- LOGE(@"New call instanciated but app data was not set. Expect it to crash.");
- /* will be used later to notify user if video was not activated because of the linphone core*/
- } else {
- data->videoRequested = linphone_call_params_video_enabled(lcallParams);
- }
+ LinphoneCall *call = linphone_core_invite_address_with_params(theLinphoneCore, addr, lcallParams);
+ if (call) {
+ // The LinphoneCallAppData object should be set on call creation with callback
+ // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash
+ // We are NOT responsible for creating the AppData.
+ LinphoneCallAppData *data = (__bridge LinphoneCallAppData *)linphone_call_get_user_data(call);
+ if (data == nil) {
+ LOGE(@"New call instanciated but app data was not set. Expect it to crash.");
+ /* will be used later to notify user if video was not activated because of the linphone core*/
+ } else {
+ data->videoRequested = linphone_call_params_video_enabled(lcallParams);
}
}
- linphone_address_destroy(addr);
- linphone_call_params_destroy(lcallParams);
}
+ linphone_address_destroy(addr);
+ linphone_call_params_destroy(lcallParams);
+
+ return TRUE;
}
#pragma mark - Property Functions
@@ -2084,7 +2076,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
+ (int)unreadMessageCount {
int count = 0;
- const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]);
+ const MSList *rooms = linphone_core_get_chat_rooms(LC);
const MSList *item = rooms;
while (item) {
LinphoneChatRoom *room = (LinphoneChatRoom *)item->data;
@@ -2140,25 +2132,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
}
-- (void)setLogsEnabled:(BOOL)enabled {
- if ([LinphoneManager isRunningTests]) {
- NSLog(@"Running tests, forcing logs to MESSAGE level");
- linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
- linphone_core_set_log_level(ORTP_MESSAGE);
- } else {
- if (enabled) {
- NSLog(@"Enabling debug logs");
- linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
- linphone_core_set_log_level(ORTP_DEBUG);
- linphone_core_enable_log_collection(enabled);
- } else {
- NSLog(@"Disabling debug logs");
- linphone_core_enable_log_collection(enabled);
- linphone_core_disable_logs();
- }
- }
-}
-
+ (id)getMessageAppDataForKey:(NSString *)key inMessage:(LinphoneChatMessage *)msg {
if (msg == nil)
@@ -2353,15 +2326,15 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
#pragma mark -
- (void)removeAllAccounts {
- linphone_core_clear_proxy_config([LinphoneManager getLc]);
- linphone_core_clear_all_auth_info([LinphoneManager getLc]);
+ linphone_core_clear_proxy_config(LC);
+ linphone_core_clear_all_auth_info(LC);
}
+ (BOOL)isMyself:(const LinphoneAddress *)addr {
if (!addr)
return NO;
- const MSList *it = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ const MSList *it = linphone_core_get_proxy_config_list(LC);
while (it) {
if (linphone_address_weak_equal(addr, linphone_proxy_config_get_identity_address(it->data))) {
return YES;
diff --git a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib
index 1668cddf2..baa4d9320 100644
--- a/Classes/LinphoneUI/Base.lproj/UICompositeView.xib
+++ b/Classes/LinphoneUI/Base.lproj/UICompositeView.xib
@@ -1,9 +1,9 @@
-
+
-
+
@@ -26,17 +26,12 @@
-
-
-
-
-
@@ -46,22 +41,18 @@
-
-
-
-
@@ -73,34 +64,28 @@
-
-
-
-
-
-
diff --git a/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib b/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib
index d4b20b633..13cacd621 100644
--- a/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib
+++ b/Classes/LinphoneUI/Base.lproj/UICompositeView~ipad.xib
@@ -1,5 +1,5 @@
-
+
@@ -28,9 +28,6 @@
-
-
-
diff --git a/Classes/LinphoneUI/StatusBarView.m b/Classes/LinphoneUI/StatusBarView.m
index 1e0b19cdc..524d80989 100644
--- a/Classes/LinphoneUI/StatusBarView.m
+++ b/Classes/LinphoneUI/StatusBarView.m
@@ -31,7 +31,7 @@
#pragma mark - Lifecycle Functions
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
[callQualityTimer invalidate];
}
@@ -41,37 +41,36 @@
[super viewWillAppear:animated];
// Set observer
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(registrationUpdate:)
- name:kLinphoneRegistrationUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(registrationUpdate:)
+ name:kLinphoneRegistrationUpdate
+ object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(globalStateUpdate:)
- name:kLinphoneGlobalStateUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(globalStateUpdate:)
+ name:kLinphoneGlobalStateUpdate
+ object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(notifyReceived:)
- name:kLinphoneNotifyReceived
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(notifyReceived:)
+ name:kLinphoneNotifyReceived
+ object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdate:)
- name:kLinphoneCallUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(onCallEncryptionChanged:)
- name:kLinphoneCallEncryptionChanged
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdate:)
+ name:kLinphoneCallUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(onCallEncryptionChanged:)
+ name:kLinphoneCallEncryptionChanged
+ object:nil];
// Update to default state
- LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
- messagesUnreadCount =
- lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count", 0);
+ LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC);
+ messagesUnreadCount = lp_config_get_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", 0);
[self proxyConfigUpdate:config];
- [self updateUI:linphone_core_get_calls_nb([LinphoneManager getLc])];
+ [self updateUI:linphone_core_get_calls_nb(LC)];
[self updateVoicemail];
}
@@ -79,10 +78,10 @@
[super viewWillDisappear:animated];
// Remove observer
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneGlobalStateUpdate object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneNotifyReceived object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneGlobalStateUpdate object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneNotifyReceived object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kLinphoneCallUpdate object:nil];
if (callQualityTimer != nil) {
[callQualityTimer invalidate];
@@ -102,7 +101,7 @@
#pragma mark - Event Functions
- (void)registrationUpdate:(NSNotification *)notif {
- LinphoneProxyConfig *config = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
+ LinphoneProxyConfig *config = linphone_core_get_default_proxy_config(LC);
[self proxyConfigUpdate:config];
}
@@ -111,7 +110,7 @@
}
- (void)onCallEncryptionChanged:(NSNotification *)notif {
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call && (linphone_call_params_get_media_encryption(linphone_call_get_current_params(call)) ==
LinphoneMediaEncryptionZRTP) &&
@@ -139,8 +138,7 @@
LOGI(@"Received new NOTIFY from voice mail: there is/are now %d message(s) unread", messagesUnreadCount);
// save in lpconfig for future
- lp_config_set_int(linphone_core_get_config([LinphoneManager getLc]), "app", "voice_mail_messages_count",
- messagesUnreadCount);
+ lp_config_set_int(linphone_core_get_config(LC), "app", "voice_mail_messages_count", messagesUnreadCount);
[self updateVoicemail];
}
@@ -152,7 +150,7 @@
- (void)callUpdate:(NSNotification *)notif {
// show voice mail only when there is no call
- [self updateUI:linphone_core_get_calls([LinphoneManager getLc]) != NULL];
+ [self updateUI:linphone_core_get_calls(LC) != NULL];
[self updateVoicemail];
}
@@ -174,7 +172,7 @@
- (void)proxyConfigUpdate:(LinphoneProxyConfig *)config {
LinphoneRegistrationState state = LinphoneRegistrationNone;
NSString *message = nil;
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneGlobalState gstate = linphone_core_get_global_state(lc);
if (gstate == LinphoneGlobalConfiguring) {
@@ -182,7 +180,7 @@
} else if (config == NULL) {
state = LinphoneRegistrationNone;
if (linphone_core_get_proxy_config_list(lc) != NULL) {
- if (linphone_core_is_network_reachable([LinphoneManager getLc])) {
+ if (linphone_core_is_network_reachable(LC)) {
message = NSLocalizedString(@"No default account", nil);
} else {
message = NSLocalizedString(@"Network down", nil);
@@ -258,7 +256,7 @@
BOOL pending = false;
BOOL security = true;
- const MSList *list = linphone_core_get_calls([LinphoneManager getLc]);
+ const MSList *list = linphone_core_get_calls(LC);
if (list == NULL) {
if (securityDialog) {
[securityDialog dismiss];
@@ -285,7 +283,7 @@
}
- (void)callQualityUpdate {
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call != NULL) {
int quality = MIN(4, floor(linphone_call_get_average_quality(call)));
NSString *accessibilityValue = [NSString stringWithFormat:NSLocalizedString(@"Call quality: %d", nil), quality];
@@ -304,8 +302,8 @@
#pragma mark - Action Functions
- (IBAction)onSecurityClick:(id)sender {
- if (linphone_core_get_calls_nb([LinphoneManager getLc])) {
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ if (linphone_core_get_calls_nb(LC)) {
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call != NULL) {
LinphoneMediaEncryption enc =
linphone_call_params_get_media_encryption(linphone_call_get_current_params(call));
@@ -319,13 +317,13 @@
cancelMessage:NSLocalizedString(@"DENY", nil)
confirmMessage:NSLocalizedString(@"ACCEPT", nil)
onCancelClick:^() {
- if (linphone_core_get_current_call([LinphoneManager getLc]) == call) {
+ if (linphone_core_get_current_call(LC) == call) {
linphone_call_set_authentication_token_verified(call, NO);
}
weakSelf->securityDialog = nil;
}
onConfirmationClick:^() {
- if (linphone_core_get_current_call([LinphoneManager getLc]) == call) {
+ if (linphone_core_get_current_call(LC) == call) {
linphone_call_set_authentication_token_verified(call, YES);
}
weakSelf->securityDialog = nil;
@@ -342,7 +340,7 @@
}
- (IBAction)onRegistrationStateClick:(id)sender {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (linphone_core_get_default_proxy_config(lc)) {
linphone_core_refresh_registers(lc);
} else if (linphone_core_get_proxy_config_list(lc)) {
diff --git a/Classes/LinphoneUI/TabBarView.m b/Classes/LinphoneUI/TabBarView.m
index 9899e059c..49478bcdf 100644
--- a/Classes/LinphoneUI/TabBarView.m
+++ b/Classes/LinphoneUI/TabBarView.m
@@ -27,24 +27,24 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(changeViewEvent:)
- name:kLinphoneMainViewChange
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdate:)
- name:kLinphoneCallUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(messageReceived:)
- name:kLinphoneMessageReceived
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(changeViewEvent:)
+ name:kLinphoneMainViewChange
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdate:)
+ name:kLinphoneCallUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(messageReceived:)
+ name:kLinphoneMessageReceived
+ object:nil];
[self update:FALSE];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
@@ -56,7 +56,7 @@
- (void)callUpdate:(NSNotification *)notif {
// LinphoneCall *call = [[notif.userInfo objectForKey: @"call"] pointerValue];
// LinphoneCallState state = [[notif.userInfo objectForKey: @"state"] intValue];
- [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:TRUE];
+ [self updateMissedCall:linphone_core_get_missed_calls_count(LC) appear:TRUE];
}
- (void)changeViewEvent:(NSNotification *)notif {
@@ -74,7 +74,7 @@
- (void)update:(BOOL)appear {
[self updateSelectedButton:[PhoneMainView.instance currentView]];
- [self updateMissedCall:linphone_core_get_missed_calls_count([LinphoneManager getLc]) appear:appear];
+ [self updateMissedCall:linphone_core_get_missed_calls_count(LC) appear:appear];
[self updateUnreadMessage:appear];
}
@@ -131,7 +131,7 @@
: -selectedNewFrame.size.height /*hide it if none is selected*/))));
}
- CGFloat delay = [[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] ? 0.3 : 0;
+ CGFloat delay = ANIMATED ? 0.3 : 0;
[UIView animateWithDuration:delay
animations:^{
_selectedButtonImage.frame = selectedNewFrame;
diff --git a/Classes/LinphoneUI/UIBackToCallButton.m b/Classes/LinphoneUI/UIBackToCallButton.m
index 377e1ea57..5cc7f05a2 100644
--- a/Classes/LinphoneUI/UIBackToCallButton.m
+++ b/Classes/LinphoneUI/UIBackToCallButton.m
@@ -14,16 +14,16 @@
- (instancetype)init {
if (self = [super init]) {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdateEvent:)
- name:kLinphoneCallUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdateEvent:)
+ name:kLinphoneCallUpdate
+ object:nil];
}
return self;
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)callUpdateEvent:(NSNotification *)notif {
@@ -31,12 +31,11 @@
}
- (void)update {
- self.hidden = (_tableView.isEditing || linphone_core_get_current_call([LinphoneManager getLc]) == NULL);
+ self.hidden = (_tableView.isEditing || linphone_core_get_current_call(LC) == NULL);
}
- (IBAction)onBackToCallClick:(id)sender {
- CallView *view = VIEW(CallView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
+ [PhoneMainView.instance popToView:CallView.compositeViewDescription];
}
@end
diff --git a/Classes/LinphoneUI/UIBouncingView.m b/Classes/LinphoneUI/UIBouncingView.m
index df2cf3490..d43a8f305 100644
--- a/Classes/LinphoneUI/UIBouncingView.m
+++ b/Classes/LinphoneUI/UIBouncingView.m
@@ -18,23 +18,23 @@ static NSString *const kDisappearAnimation = @"disappear";
@implementation UIBouncingView
INIT_WITH_COMMON_CF {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(settingsUpdate:)
- name:kLinphoneSettingsUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(applicationWillEnterForeground:)
- name:UIApplicationWillEnterForegroundNotification
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(settingsUpdate:)
+ name:kLinphoneSettingsUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(applicationWillEnterForeground:)
+ name:UIApplicationWillEnterForegroundNotification
+ object:nil];
return self;
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)settingsUpdate:(NSNotification *)notif {
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == false) {
+ if (ANIMATED == false) {
[self stopAnimating:NO];
} else {
if (![self isHidden]) {
@@ -105,7 +105,7 @@ INIT_WITH_COMMON_CF {
}
[self setHidden:FALSE];
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) {
+ if (ANIMATED) {
if (animated) {
[self appearAnimation:kAppearAnimation
target:self
diff --git a/Classes/LinphoneUI/UICallButton.m b/Classes/LinphoneUI/UICallButton.m
index 184b5c20c..36ec0f4a4 100644
--- a/Classes/LinphoneUI/UICallButton.m
+++ b/Classes/LinphoneUI/UICallButton.m
@@ -61,7 +61,7 @@
- (void)touchUp:(id)sender {
NSString *address = addressField.text;
if (address.length == 0) {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCallLog *log = linphone_core_get_last_outgoing_call_log(lc);
if (log) {
LinphoneAddress *to = linphone_call_log_get_to(log);
@@ -87,16 +87,15 @@
}
if ([address length] > 0) {
- LinphoneAddress *addr = linphone_address_new(address.UTF8String);
- NSString *displayName = addr ? [FastAddressBook displayNameForAddress:addr] : nil;
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, address.UTF8String);
+ [LinphoneManager.instance call:addr transfer:FALSE];
if (addr)
linphone_address_destroy(addr);
- [LinphoneManager.instance call:address displayName:displayName transfer:FALSE];
}
}
- (void)updateVideoPolicy {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (linphone_core_video_capture_enabled(lc) && linphone_core_get_video_policy(lc)->automatically_initiate) {
[self setImage:[UIImage imageNamed:@"call_video_start_default.png"] forState:UIControlStateNormal];
[self setImage:[UIImage imageNamed:@"call_video_start_disabled.png"] forState:UIControlStateDisabled];
diff --git a/Classes/LinphoneUI/UICallConferenceCell.m b/Classes/LinphoneUI/UICallConferenceCell.m
index 6470df9cf..ce2dde8f8 100644
--- a/Classes/LinphoneUI/UICallConferenceCell.m
+++ b/Classes/LinphoneUI/UICallConferenceCell.m
@@ -43,6 +43,6 @@
}
- (IBAction)onKickClick:(id)sender {
- linphone_core_remove_from_conference([LinphoneManager getLc], _call);
+ linphone_core_remove_from_conference(LC, _call);
}
@end
diff --git a/Classes/LinphoneUI/UICamSwitch.m b/Classes/LinphoneUI/UICamSwitch.m
index 67d36e2cc..ae606a272 100644
--- a/Classes/LinphoneUI/UICamSwitch.m
+++ b/Classes/LinphoneUI/UICamSwitch.m
@@ -34,8 +34,8 @@ INIT_WITH_COMMON_CF {
#pragma mark -
- (void)touchUp:(id)sender {
- const char *currentCamId = (char *)linphone_core_get_video_device([LinphoneManager getLc]);
- const char **cameras = linphone_core_get_video_devices([LinphoneManager getLc]);
+ const char *currentCamId = (char *)linphone_core_get_video_device(LC);
+ const char **cameras = linphone_core_get_video_devices(LC);
const char *newCamId = NULL;
int i;
@@ -49,10 +49,10 @@ INIT_WITH_COMMON_CF {
}
if (newCamId) {
LOGI(@"Switching from [%s] to [%s]", currentCamId, newCamId);
- linphone_core_set_video_device([LinphoneManager getLc], newCamId);
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ linphone_core_set_video_device(LC, newCamId);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call != NULL) {
- linphone_core_update_call([LinphoneManager getLc], call, NULL);
+ linphone_core_update_call(LC, call, NULL);
}
}
}
diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m
index a1b3bd068..b85a67c4e 100644
--- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m
+++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m
@@ -62,7 +62,7 @@
const LinphoneContent *c = linphone_chat_message_get_file_transfer_information(amessage);
if (c) {
const char *name = linphone_content_get_name(c);
- for (FileTransferDelegate *aftd in [[LinphoneManager instance] fileTransferDelegates]) {
+ for (FileTransferDelegate *aftd in [LinphoneManager.instance fileTransferDelegates]) {
if (linphone_chat_message_get_file_transfer_information(aftd.message) &&
(linphone_chat_message_is_outgoing(aftd.message) == linphone_chat_message_is_outgoing(amessage)) &&
strcmp(name, linphone_content_get_name(
@@ -156,21 +156,13 @@
[_ftd download:self.message];
_cancelButton.hidden = NO;
_downloadButton.hidden = YES;
-
- // we must tell the tableview to refresh the cell to reflect its internal state
- ChatConversationView *view = VIEW(ChatConversationView);
- [view.tableController updateChatEntry:self.message];
}
- (IBAction)onCancelClick:(id)sender {
FileTransferDelegate *tmp = _ftd;
[self disconnectFromFileDelegate];
- [tmp cancel];
_fileTransferProgress.progress = 0;
- [self update];
- // we must tell the tableview to refresh the cell to reflect its internal state
- ChatConversationView *view = VIEW(ChatConversationView);
- [view.tableController updateChatEntry:self.message];
+ [tmp cancel];
}
- (void)onResendClick:(id)event {
@@ -191,7 +183,7 @@
} else {
if (![_messageImageView isLoading]) {
ImageView *view = VIEW(ImageView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
CGImageRef fullScreenRef = [[_messageImageView.fullImageUrl defaultRepresentation] fullScreenImage];
UIImage *fullScreen = [UIImage imageWithCGImage:fullScreenRef];
[view setImage:fullScreen];
@@ -210,19 +202,19 @@
_ftd = aftd;
_fileTransferProgress.progress = 0;
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(onFileTransferSendUpdate:)
- name:kLinphoneFileTransferSendUpdate
- object:_ftd];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(onFileTransferRecvUpdate:)
- name:kLinphoneFileTransferRecvUpdate
- object:_ftd];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(onFileTransferSendUpdate:)
+ name:kLinphoneFileTransferSendUpdate
+ object:_ftd];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(onFileTransferRecvUpdate:)
+ name:kLinphoneFileTransferRecvUpdate
+ object:_ftd];
}
- (void)disconnectFromFileDelegate {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
_ftd = nil;
}
diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m
index 362c503d9..a670d77e6 100644
--- a/Classes/LinphoneUI/UIChatBubbleTextCell.m
+++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m
@@ -70,9 +70,16 @@
}
+ (NSString *)TextMessageForChat:(LinphoneChatMessage *)message {
- const char *text = linphone_chat_message_get_text(message) ?: "";
- return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding]
- ?: NSLocalizedString(@"(invalid string)", nil);
+ const char *url = linphone_chat_message_get_external_body_url(message);
+ const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(message);
+ // Last message was a file transfer (image) so display a picture...
+ if (url || last_content) {
+ return @"🗻";
+ } else {
+ const char *text = linphone_chat_message_get_text(message) ?: "";
+ return [NSString stringWithUTF8String:text] ?: [NSString stringWithCString:text encoding:NSASCIIStringEncoding]
+ ?: NSLocalizedString(@"(invalid string)", nil);
+ }
}
+ (NSString *)ContactDateForChat:(LinphoneChatMessage *)message {
@@ -185,8 +192,7 @@
[self onDeleteClick:nil];
- [[LinphoneManager instance]
- .photoLibrary assetForURL:imageUrl
+ [LinphoneManager.instance.photoLibrary assetForURL:imageUrl
resultBlock:^(ALAsset *asset) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
^(void) {
diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m
index 22caf1a17..770b28736 100644
--- a/Classes/LinphoneUI/UIChatCell.m
+++ b/Classes/LinphoneUI/UIChatCell.m
@@ -69,22 +69,12 @@
LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom);
if (last_message) {
- const char *text = linphone_chat_message_get_text(last_message);
- const char *url = linphone_chat_message_get_external_body_url(last_message);
- const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(last_message);
- // Last message was a file transfer (image) so display a picture...
- if (url || last_content) {
- _chatContentLabel.text = @"🗻";
- // otherwise show beginning of the text message
- } else if (text) {
- NSString *message = [NSString stringWithUTF8String:text];
- // shorten long messages
- if ([message length] > 50)
- message = [[message substringToIndex:50] stringByAppendingString:@"[...]"];
-
- _chatContentLabel.text = message;
+ NSString *message = [UIChatBubbleTextCell TextMessageForChat:last_message];
+ // shorten long messages
+ if ([message length] > 50) {
+ message = [[message substringToIndex:50] stringByAppendingString:@"[...]"];
}
-
+ _chatContentLabel.text = message;
_chatLatestTimeLabel.text =
[LinphoneUtils timeToString:linphone_chat_message_get_time(last_message) withFormat:LinphoneDateChatList];
_chatLatestTimeLabel.hidden = NO;
diff --git a/Classes/LinphoneUI/UICheckBoxTableView.m b/Classes/LinphoneUI/UICheckBoxTableView.m
index 4a631f02b..506fd901d 100644
--- a/Classes/LinphoneUI/UICheckBoxTableView.m
+++ b/Classes/LinphoneUI/UICheckBoxTableView.m
@@ -130,6 +130,7 @@
[_selectedItems removeAllObjects];
[self selectToggleButton:!_toggleSelectionButton.selected]; // TODO: why do we need that?
+ LOGI(@"onSelectionToggle: select %@", _toggleSelectionButton.selected ? @"NONE" : @"ALL");
for (int i = 0; i < [self numberOfSectionsInTableView:self.tableView]; i++) {
for (int j = 0; j < [self tableView:self.tableView numberOfRowsInSection:i]; j++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i];
diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m
index 470eff907..d17a94655 100644
--- a/Classes/LinphoneUI/UICompositeView.m
+++ b/Classes/LinphoneUI/UICompositeView.m
@@ -116,7 +116,7 @@
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - ViewController Functions
@@ -158,10 +158,10 @@
[self.tabBarViewController viewWillAppear:animated];
[self.statusBarViewController viewWillAppear:animated];
[self.sideMenuViewController viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(orientationDidChange:)
- name:UIDeviceOrientationDidChangeNotification
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(orientationDidChange:)
+ name:UIDeviceOrientationDidChangeNotification
+ object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
}
@@ -184,7 +184,7 @@
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
diff --git a/Classes/LinphoneUI/UIContactDetailsCell.m b/Classes/LinphoneUI/UIContactDetailsCell.m
index 2d301fdbd..2c1d5eaa5 100644
--- a/Classes/LinphoneUI/UIContactDetailsCell.m
+++ b/Classes/LinphoneUI/UIContactDetailsCell.m
@@ -43,7 +43,7 @@
- (void)setAddress:(NSString *)address {
_addressLabel.text = _editTextfield.text = address;
- LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String);
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String);
_chatButton.enabled = _callButton.enabled = (addr != NULL);
_chatButton.accessibilityLabel =
@@ -75,28 +75,20 @@
}
- (IBAction)onCallClick:(id)event {
- LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String);
- if (addr == NULL)
- return;
- char *lAddress = linphone_address_as_string_uri_only(addr);
- NSString *displayName = [FastAddressBook displayNameForAddress:addr];
-
- DialerView *view = VIEW(DialerView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
- [view call:[NSString stringWithUTF8String:lAddress] displayName:displayName];
- ms_free(lAddress);
- linphone_address_destroy(addr);
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String);
+ [LinphoneManager.instance call:addr transfer:NO];
+ if (addr)
+ linphone_address_destroy(addr);
}
- (IBAction)onChatClick:(id)event {
- LinphoneAddress *addr = linphone_core_interpret_url([LinphoneManager getLc], _addressLabel.text.UTF8String);
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, _addressLabel.text.UTF8String);
if (addr == NULL)
return;
- [PhoneMainView.instance changeCurrentView:ChatsListView.compositeViewDescription];
ChatConversationView *view = VIEW(ChatConversationView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
- LinphoneChatRoom *room = linphone_core_get_chat_room([LinphoneManager getLc], addr);
+ LinphoneChatRoom *room = linphone_core_get_chat_room(LC, addr);
[view setChatRoom:room];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
linphone_address_destroy(addr);
}
diff --git a/Classes/LinphoneUI/UIDigitButton.m b/Classes/LinphoneUI/UIDigitButton.m
index 700b15faa..af417e17d 100644
--- a/Classes/LinphoneUI/UIDigitButton.m
+++ b/Classes/LinphoneUI/UIDigitButton.m
@@ -64,18 +64,18 @@
#pragma mark - Actions Functions
- (void)touchDown:(id)sender {
- if (addressField && (!dtmf || !linphone_core_in_call([LinphoneManager getLc]))) {
+ if (addressField && (!dtmf || !linphone_core_in_call(LC))) {
NSString *newAddress = [NSString stringWithFormat:@"%@%c", addressField.text, digit];
[addressField setText:newAddress];
- linphone_core_play_dtmf([LinphoneManager getLc], digit, -1);
+ linphone_core_play_dtmf(LC, digit, -1);
} else {
- linphone_call_send_dtmf(linphone_core_get_current_call([LinphoneManager getLc]), digit);
- linphone_core_play_dtmf([LinphoneManager getLc], digit, 100);
+ linphone_call_send_dtmf(linphone_core_get_current_call(LC), digit);
+ linphone_core_play_dtmf(LC, digit, 100);
}
}
- (void)touchUp:(id)sender {
- linphone_core_stop_dtmf([LinphoneManager getLc]);
+ linphone_core_stop_dtmf(LC);
}
@end
diff --git a/Classes/LinphoneUI/UIHangUpButton.m b/Classes/LinphoneUI/UIHangUpButton.m
index 47e4b2c3b..665ed00e6 100644
--- a/Classes/LinphoneUI/UIHangUpButton.m
+++ b/Classes/LinphoneUI/UIHangUpButton.m
@@ -76,7 +76,7 @@
#pragma mark -
- (void)update {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (linphone_core_get_calls_nb(lc) == 1 || // One call
linphone_core_get_current_call(lc) != NULL || // In call
linphone_core_is_in_conference(lc) || // In conference
@@ -91,7 +91,7 @@
#pragma mark - Action Functions
- (void)touchUp:(id)sender {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *currentcall = linphone_core_get_current_call(lc);
if (linphone_core_is_in_conference(lc) || // In conference
(linphone_core_get_conference_size(lc) > 0 && [UIHangUpButton callCount:lc] == 0) // Only one conf
diff --git a/Classes/LinphoneUI/UIHistoryCell.m b/Classes/LinphoneUI/UIHistoryCell.m
index f34708b5b..15458d2fd 100644
--- a/Classes/LinphoneUI/UIHistoryCell.m
+++ b/Classes/LinphoneUI/UIHistoryCell.m
@@ -60,7 +60,9 @@
// Go to History details view
HistoryDetailsView *view = VIEW(HistoryDetailsView);
[view setCallLogId:[NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)]];
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
+ [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
+ } else {
+ LOGE(@"Cannot open selected call log, it is NULL or corrupted");
}
}
diff --git a/Classes/LinphoneUI/UIMicroButton.m b/Classes/LinphoneUI/UIMicroButton.m
index 80a1cc13e..8a4944a69 100644
--- a/Classes/LinphoneUI/UIMicroButton.m
+++ b/Classes/LinphoneUI/UIMicroButton.m
@@ -24,15 +24,15 @@
@implementation UIMicroButton
- (void)onOn {
- linphone_core_enable_mic([LinphoneManager getLc], false);
+ linphone_core_enable_mic(LC, false);
}
- (void)onOff {
- linphone_core_enable_mic([LinphoneManager getLc], true);
+ linphone_core_enable_mic(LC, true);
}
- (bool)onUpdate {
- return !linphone_core_mic_enabled([LinphoneManager getLc]);
+ return !linphone_core_mic_enabled(LC);
}
@end
diff --git a/Classes/LinphoneUI/UIPauseButton.m b/Classes/LinphoneUI/UIPauseButton.m
index 586de121d..c390d056a 100644
--- a/Classes/LinphoneUI/UIPauseButton.m
+++ b/Classes/LinphoneUI/UIPauseButton.m
@@ -75,7 +75,7 @@
}
+ (LinphoneCall *)getCall {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *currentCall = linphone_core_get_current_call(lc);
if (currentCall == nil && linphone_core_get_calls_nb(lc) == 1) {
currentCall = (LinphoneCall *)linphone_core_get_calls(lc)->data;
@@ -96,23 +96,23 @@
switch (type) {
case UIPauseButtonType_Call: {
if (call != nil) {
- linphone_core_pause_call([LinphoneManager getLc], call);
+ linphone_core_pause_call(LC, call);
} else {
LOGW(@"Cannot toggle pause buttton, because no current call");
}
break;
}
case UIPauseButtonType_Conference: {
- linphone_core_leave_conference([LinphoneManager getLc]);
+ linphone_core_leave_conference(LC);
// Fake event
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
break;
}
case UIPauseButtonType_CurrentCall: {
LinphoneCall *currentCall = [UIPauseButton getCall];
if (currentCall != nil) {
- linphone_core_pause_call([LinphoneManager getLc], currentCall);
+ linphone_core_pause_call(LC, currentCall);
} else {
LOGW(@"Cannot toggle pause buttton, because no current call");
}
@@ -125,22 +125,22 @@
switch (type) {
case UIPauseButtonType_Call: {
if (call != nil) {
- linphone_core_resume_call([LinphoneManager getLc], call);
+ linphone_core_resume_call(LC, call);
} else {
LOGW(@"Cannot toggle pause buttton, because no current call");
}
break;
}
case UIPauseButtonType_Conference: {
- linphone_core_enter_conference([LinphoneManager getLc]);
+ linphone_core_enter_conference(LC);
// Fake event
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneCallUpdate object:self];
break;
}
case UIPauseButtonType_CurrentCall: {
LinphoneCall *currentCall = [UIPauseButton getCall];
if (currentCall != nil) {
- linphone_core_resume_call([LinphoneManager getLc], currentCall);
+ linphone_core_resume_call(LC, currentCall);
} else {
LOGW(@"Cannot toggle pause buttton, because no current call");
}
@@ -151,7 +151,7 @@
- (bool)onUpdate {
bool ret = false;
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *c = call;
switch (type) {
case UIPauseButtonType_Conference: {
diff --git a/Classes/LinphoneUI/UIRoundedImageView.m b/Classes/LinphoneUI/UIRoundedImageView.m
index 90847d109..2b75d4eee 100644
--- a/Classes/LinphoneUI/UIRoundedImageView.m
+++ b/Classes/LinphoneUI/UIRoundedImageView.m
@@ -23,15 +23,15 @@ INIT_WITH_COMMON_CF {
[self setBordered:NO];
[self setRoundRadius];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(orientationDidChange:)
- name:@"UIDeviceOrientationDidChangeNotification"
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(orientationDidChange:)
+ name:@"UIDeviceOrientationDidChangeNotification"
+ object:nil];
return self;
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
- (void)orientationDidChange:(NSNotification *)k {
@@ -51,7 +51,8 @@ INIT_WITH_COMMON_CF {
}
- (void)setBordered:(BOOL)bordered {
- borderView.hidden = !bordered;
+ // bugged on rotation yet
+ borderView.hidden = TRUE; //! bordered;
}
- (CGRect)computeBox {
CGFloat min = MIN(self.frame.size.width, self.frame.size.height);
diff --git a/Classes/LinphoneUI/UISpeakerButton.m b/Classes/LinphoneUI/UISpeakerButton.m
index 8b0279666..5580f12be 100644
--- a/Classes/LinphoneUI/UISpeakerButton.m
+++ b/Classes/LinphoneUI/UISpeakerButton.m
@@ -60,16 +60,16 @@ INIT_WITH_COMMON_CF {
#pragma mark - UIToggleButtonDelegate Functions
- (void)onOn {
- [[LinphoneManager instance] setSpeakerEnabled:TRUE];
+ [LinphoneManager.instance setSpeakerEnabled:TRUE];
}
- (void)onOff {
- [[LinphoneManager instance] setSpeakerEnabled:FALSE];
+ [LinphoneManager.instance setSpeakerEnabled:FALSE];
}
- (bool)onUpdate {
- [self setEnabled:[[LinphoneManager instance] allowSpeaker]];
- return [[LinphoneManager instance] speakerEnabled];
+ [self setEnabled:[LinphoneManager.instance allowSpeaker]];
+ return [LinphoneManager.instance speakerEnabled];
}
@end
diff --git a/Classes/LinphoneUI/UITransferButton.m b/Classes/LinphoneUI/UITransferButton.m
index 809336ee8..8ad3a577e 100644
--- a/Classes/LinphoneUI/UITransferButton.m
+++ b/Classes/LinphoneUI/UITransferButton.m
@@ -58,7 +58,10 @@
#pragma mark -
- (void)touchUp:(id)sender {
- [[LinphoneManager instance] call:[addressField text] displayName:nil transfer:TRUE];
+ LinphoneAddress *addr = linphone_core_interpret_url(LC, addressField.text.UTF8String);
+ [LinphoneManager.instance call:addr transfer:TRUE];
+ if (addr)
+ linphone_address_destroy(addr);
}
@end
diff --git a/Classes/LinphoneUI/UIVideoButton.m b/Classes/LinphoneUI/UIVideoButton.m
index 0c1f5aebe..04e298e63 100644
--- a/Classes/LinphoneUI/UIVideoButton.m
+++ b/Classes/LinphoneUI/UIVideoButton.m
@@ -33,7 +33,7 @@ INIT_WITH_COMMON_CF {
}
- (void)onOn {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (!linphone_core_video_display_enabled(lc))
return;
@@ -41,7 +41,7 @@ INIT_WITH_COMMON_CF {
[self setEnabled:FALSE];
[waitView startAnimating];
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call) {
LinphoneCallAppData *callAppData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call);
callAppData->videoRequested =
@@ -56,7 +56,7 @@ INIT_WITH_COMMON_CF {
}
- (void)onOff {
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
if (!linphone_core_video_display_enabled(lc))
return;
@@ -64,7 +64,7 @@ INIT_WITH_COMMON_CF {
[self setEnabled:FALSE];
[waitView startAnimating];
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call) {
LinphoneCallParams *call_params = linphone_call_params_copy(linphone_call_get_current_params(call));
linphone_call_params_enable_video(call_params, FALSE);
@@ -77,7 +77,7 @@ INIT_WITH_COMMON_CF {
- (bool)onUpdate {
bool video_enabled = false;
- LinphoneCore *lc = [LinphoneManager getLc];
+ LinphoneCore *lc = LC;
LinphoneCall *currentCall = linphone_core_get_current_call(lc);
if (linphone_core_video_supported(lc)) {
if (linphone_core_video_display_enabled(lc) && currentCall && !linphone_call_media_in_progress(currentCall) &&
diff --git a/Classes/LinphoneUI/VideoZoomHandler.m b/Classes/LinphoneUI/VideoZoomHandler.m
index 85c4940f8..87a62126a 100644
--- a/Classes/LinphoneUI/VideoZoomHandler.m
+++ b/Classes/LinphoneUI/VideoZoomHandler.m
@@ -36,7 +36,7 @@
} else {
cx = cy = 0.5;
}
- linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, &cx, &cy);
+ linphone_call_zoom_video(linphone_core_get_current_call(LC), zoomLevel, &cx, &cy);
}
- (void)videoPan:(UIPanGestureRecognizer *)reco {
@@ -58,7 +58,7 @@
return;
}
- linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), zoomLevel, &x, &y);
+ linphone_call_zoom_video(linphone_core_get_current_call(LC), zoomLevel, &x, &y);
cx = x;
cy = y;
}
@@ -82,7 +82,7 @@
return;
}
- linphone_call_zoom_video(linphone_core_get_current_call([LinphoneManager getLc]), s, &cx, &cy);
+ linphone_call_zoom_video(linphone_core_get_current_call(LC), s, &cx, &cy);
}
- (void)resetZoom {
diff --git a/Classes/Log.h b/Classes/Log.h
index becc2e538..c1d98b0c4 100644
--- a/Classes/Log.h
+++ b/Classes/Log.h
@@ -19,18 +19,19 @@
#import "LinphoneManager.h"
-#define LOGV(level, ...) [LinphoneLogger log:level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
-#define LOGD(...) LOGV(ORTP_DEBUG, __VA_ARGS__)
-#define LOGI(...) LOGV(ORTP_MESSAGE, __VA_ARGS__)
-#define LOGW(...) LOGV(ORTP_WARNING, __VA_ARGS__)
-#define LOGE(...) LOGV(ORTP_ERROR, __VA_ARGS__)
-#define LOGF(...) LOGV(ORTP_FATAL, __VA_ARGS__)
+#define APP_LVL 1 << 7
+#define LOGV(level, ...) [Log log:APP_LVL & level file:__FILE__ line:__LINE__ format:__VA_ARGS__]
+#define LOGD(...) LOGV(APP_LVL | ORTP_DEBUG, __VA_ARGS__)
+#define LOGI(...) LOGV(APP_LVL | ORTP_MESSAGE, __VA_ARGS__)
+#define LOGW(...) LOGV(APP_LVL | ORTP_WARNING, __VA_ARGS__)
+#define LOGE(...) LOGV(APP_LVL | ORTP_ERROR, __VA_ARGS__)
+#define LOGF(...) LOGV(APP_LVL | ORTP_FATAL, __VA_ARGS__)
-#define IPAD (LinphoneManager.runningOnIpad)
-
-@interface LinphoneLogger : NSObject {
+@interface Log : NSObject {
}
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ...;
++ (void)enableLogs:(BOOL)enabled;
+
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
@end
\ No newline at end of file
diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h
index 855b41570..b3122151d 100644
--- a/Classes/PhoneMainView.h
+++ b/Classes/PhoneMainView.h
@@ -81,9 +81,7 @@
@property(weak, readonly) UICompositeViewDescription *currentView;
@property(readonly, strong) MPVolumeView *volumeView;
-- (void)changeCurrentView:(UICompositeViewDescription *)currentView;
-- (void)changeCurrentView:(UICompositeViewDescription *)currentView push:(BOOL)push;
-- (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push animated:(BOOL)animated;
+- (void)changeCurrentView:(UICompositeViewDescription *)view;
- (UIViewController*)popCurrentView;
- (UIViewController *)popToView:(UICompositeViewDescription *)currentView;
- (UICompositeViewDescription *)firstView;
diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m
index f25ded396..167d428de 100644
--- a/Classes/PhoneMainView.m
+++ b/Classes/PhoneMainView.m
@@ -78,7 +78,7 @@ static RootViewManager *rootViewManagerInstance = nil;
currentViewController = newMainView;
LinphoneAppDelegate *delegate = (LinphoneAppDelegate *)[UIApplication sharedApplication].delegate;
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"] == true) {
+ if (ANIMATED) {
[UIView transitionWithView:delegate.window
duration:0.3
options:UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowAnimatedContent
@@ -154,7 +154,7 @@ static RootViewManager *rootViewManagerInstance = nil;
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
}
#pragma mark - ViewController Functions
@@ -173,39 +173,32 @@ static RootViewManager *rootViewManagerInstance = nil;
[super viewWillAppear:animated];
// Set observers
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(callUpdate:)
- name:kLinphoneCallUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(registrationUpdate:)
- name:kLinphoneRegistrationUpdate
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(textReceived:)
- name:kLinphoneMessageReceived
- object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(onGlobalStateChanged:)
- name:kLinphoneGlobalStateUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(callUpdate:)
+ name:kLinphoneCallUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(registrationUpdate:)
+ name:kLinphoneRegistrationUpdate
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(textReceived:)
+ name:kLinphoneMessageReceived
+ object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(onGlobalStateChanged:)
+ name:kLinphoneGlobalStateUpdate
+ object:nil];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(batteryLevelChanged:)
- name:UIDeviceBatteryLevelDidChangeNotification
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(batteryLevelChanged:)
+ name:UIDeviceBatteryLevelDidChangeNotification
+ object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
-
- // Remove observers
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneCallUpdate object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneRegistrationUpdate object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kLinphoneMessageReceived object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:UIDeviceBatteryLevelDidChangeNotification
- object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
[[UIDevice currentDevice] setBatteryMonitoringEnabled:NO];
}
@@ -294,9 +287,9 @@ static RootViewManager *rootViewManagerInstance = nil;
- (void)onGlobalStateChanged:(NSNotification *)notif {
LinphoneGlobalState state = (LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue];
static BOOL already_shown = FALSE;
- if (state == LinphoneGlobalOn && !already_shown && [LinphoneManager instance].wasRemoteProvisioned) {
- LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
- if ([[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" inSection:@"app"] && conf == NULL) {
+ if (state == LinphoneGlobalOn && !already_shown && LinphoneManager.instance.wasRemoteProvisioned) {
+ LinphoneProxyConfig *conf = linphone_core_get_default_proxy_config(LC);
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"show_login_view" inSection:@"app"] && conf == NULL) {
already_shown = TRUE;
AssistantView *view = VIEW(AssistantView);
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
@@ -329,7 +322,7 @@ static RootViewManager *rootViewManagerInstance = nil;
case LinphoneCallPausedByRemote:
case LinphoneCallConnected:
case LinphoneCallStreamsRunning: {
- [self changeCurrentView:CallView.compositeViewDescription push:NO];
+ [self changeCurrentView:CallView.compositeViewDescription];
break;
}
case LinphoneCallUpdatedByRemote: {
@@ -345,19 +338,15 @@ static RootViewManager *rootViewManagerInstance = nil;
[self displayCallError:call message:message];
}
case LinphoneCallEnd: {
- const MSList *calls = linphone_core_get_calls([LinphoneManager getLc]);
+ const MSList *calls = linphone_core_get_calls(LC);
if (calls == NULL) {
- // if ((currentView == CallView.compositeViewDescription) ||
- // (currentView == CallIncomingView.compositeViewDescription) ||
- // (currentView == CallOutgoingView.compositeViewDescription)) {
- DialerView *view = VIEW(DialerView);
- [view setAddress:@""];
- [view setTransferMode:FALSE];
- [self changeCurrentView:view.compositeViewDescription push:NO];
- // [self popCurrentView];
- // }
+ while ((currentView == CallView.compositeViewDescription) ||
+ (currentView == CallIncomingView.compositeViewDescription) ||
+ (currentView == CallOutgoingView.compositeViewDescription)) {
+ [self popCurrentView];
+ }
} else {
- linphone_core_resume_call([LinphoneManager getLc], (LinphoneCall *)calls->data);
+ linphone_core_resume_call(LC, (LinphoneCall *)calls->data);
[self changeCurrentView:CallView.compositeViewDescription];
}
break;
@@ -382,7 +371,7 @@ static RootViewManager *rootViewManagerInstance = nil;
#pragma mark -
- (void)orientationUpdate:(UIInterfaceOrientation)orientation {
- int oldLinphoneOrientation = linphone_core_get_device_rotation([LinphoneManager getLc]);
+ int oldLinphoneOrientation = linphone_core_get_device_rotation(LC);
int newRotation = 0;
switch (orientation) {
case UIInterfaceOrientationPortrait:
@@ -401,22 +390,22 @@ static RootViewManager *rootViewManagerInstance = nil;
newRotation = oldLinphoneOrientation;
}
if (oldLinphoneOrientation != newRotation) {
- linphone_core_set_device_rotation([LinphoneManager getLc], newRotation);
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ linphone_core_set_device_rotation(LC, newRotation);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
// Orientation has changed, must call update call
- linphone_core_update_call([LinphoneManager getLc], call, NULL);
+ linphone_core_update_call(LC, call, NULL);
}
}
}
- (void)startUp {
LinphoneCore *core = nil;
@try {
- core = [LinphoneManager getLc];
- LinphoneManager *lm = [LinphoneManager instance];
+ core = LC;
+ LinphoneManager *lm = LinphoneManager.instance;
if (linphone_core_get_global_state(core) != LinphoneGlobalOn) {
[self changeCurrentView:DialerView.compositeViewDescription];
- } else if ([[LinphoneManager instance] lpConfigBoolForKey:@"enable_first_login_view_preference"] == true) {
+ } else if ([LinphoneManager.instance lpConfigBoolForKey:@"enable_first_login_view_preference"] == true) {
[PhoneMainView.instance changeCurrentView:FirstLoginView.compositeViewDescription];
} else {
// always start to dialer when testing
@@ -438,9 +427,9 @@ static RootViewManager *rootViewManagerInstance = nil;
- (void)updateApplicationBadgeNumber {
int count = 0;
- count += linphone_core_get_missed_calls_count([LinphoneManager getLc]);
+ count += linphone_core_get_missed_calls_count(LC);
count += [LinphoneManager unreadMessageCount];
- count += linphone_core_get_calls_nb([LinphoneManager getLc]);
+ count += linphone_core_get_calls_nb(LC);
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
}
@@ -544,44 +533,35 @@ static RootViewManager *rootViewManagerInstance = nil;
[mainViewController setFullscreen:enabled];
}
-- (void)changeCurrentView:(UICompositeViewDescription *)view {
- [self changeCurrentView:view push:TRUE];
-}
-
-- (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push {
- [self changeCurrentView:view
- push:push
- animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
-}
-
-- (void)changeCurrentView:(UICompositeViewDescription *)view push:(BOOL)push animated:(BOOL)animated {
+- (UIViewController *)popCurrentView {
NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
- if (push && view) {
- [viewStack addObject:view];
+ if (viewStack.count <= 1) {
+ [viewStack removeAllObjects];
+ LOGW(@"PhoneMainView: Trying to pop view but none stacked, going to %@!",
+ DialerView.compositeViewDescription.name);
+ } else {
+ [viewStack removeLastObject];
+ LOGI(@"PhoneMainView: Popping view %@, going to %@", currentView.name,
+ ((UICompositeViewDescription *)(viewStack.lastObject ?: DialerView.compositeViewDescription)).name);
}
- [self _changeCurrentView:view transition:nil animated:animated];
+ [self _changeCurrentView:viewStack.lastObject ?: DialerView.compositeViewDescription
+ transition:[PhoneMainView getBackwardTransition]
+ animated:ANIMATED];
+ return [mainViewController getCurrentViewController];
}
-- (BOOL)isUnauthorizedView:(UICompositeViewDescription *)view {
- return [[LinphoneManager.instance lpConfigStringForKey:@"unauthorized_views"] containsString:view.name];
+- (void)changeCurrentView:(UICompositeViewDescription *)view {
+ [self _changeCurrentView:view transition:nil animated:ANIMATED];
}
- (UIViewController *)_changeCurrentView:(UICompositeViewDescription *)view
transition:(CATransition *)transition
animated:(BOOL)animated {
PhoneMainView *vc = [[RootViewManager instance] setViewControllerForDescription:view];
-
- if ([self isUnauthorizedView:view]) {
- NSString *fallback = [LinphoneManager.instance lpConfigStringForKey:@"fallback_view"];
- UICompositeViewDescription *fallback_view = DialerView.compositeViewDescription;
- if (fallback && [NSClassFromString(fallback) respondsToSelector:@selector(compositeViewDescription)]) {
- fallback_view = [NSClassFromString(fallback) performSelector:@selector(compositeViewDescription)];
- }
- LOGW(@"Trying to access unauthorized view %@, going back to %@", view.name, fallback_view.name);
- view = fallback_view;
- }
if (![view equal:vc.currentView] || vc != self) {
LOGI(@"Change current view to %@", view.name);
+ NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
+ [viewStack addObject:view];
if (animated && transition == nil)
transition = [PhoneMainView getTransition:vc.currentView new:view];
[vc.mainViewController setViewTransition:(animated ? transition : nil)];
@@ -593,19 +573,17 @@ static RootViewManager *rootViewManagerInstance = nil;
//[[RootViewManager instance] setViewControllerForDescription:view];
NSDictionary *mdict = [NSMutableDictionary dictionaryWithObject:vc->currentView forKey:@"view"];
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneMainViewChange object:self userInfo:mdict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneMainViewChange object:self userInfo:mdict];
return [vc->mainViewController getCurrentViewController];
}
- (UIViewController *)popToView:(UICompositeViewDescription *)view {
NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
- while ([viewStack count] > 1 && ![[viewStack lastObject] equal:view]) {
+ while (viewStack.count > 0 && ![[viewStack lastObject] equal:view]) {
[viewStack removeLastObject];
}
- return [self _changeCurrentView:[viewStack lastObject]
- transition:[PhoneMainView getBackwardTransition]
- animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
+ return [self _changeCurrentView:view transition:[PhoneMainView getBackwardTransition] animated:ANIMATED];
}
- (UICompositeViewDescription *)firstView {
@@ -617,20 +595,6 @@ static RootViewManager *rootViewManagerInstance = nil;
return view;
}
-- (UIViewController *)popCurrentView {
- NSMutableArray *viewStack = [RootViewManager instance].viewDescriptionStack;
- if ([viewStack count] > 1) {
- LOGI(@"PhoneMainView: Pop view");
- [viewStack removeLastObject];
- [self _changeCurrentView:[viewStack lastObject]
- transition:[PhoneMainView getBackwardTransition]
- animated:[[LinphoneManager instance] lpConfigBoolForKey:@"animations_preference"]];
- return [mainViewController getCurrentViewController];
- }
- LOGW(@"PhoneMainView: Trying to pop view but none stacked!");
- return nil;
-}
-
- (void)displayCallError:(LinphoneCall *)call message:(NSString *)message {
const char *lUserNameChars = linphone_address_get_username(linphone_call_get_remote_address(call));
NSString *lUserName =
@@ -639,7 +603,7 @@ static RootViewManager *rootViewManagerInstance = nil;
NSString *lTitle;
// get default proxy
- LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
+ LinphoneProxyConfig *proxyCfg = linphone_core_get_default_proxy_config(LC);
if (proxyCfg == nil) {
lMessage = NSLocalizedString(@"Please make sure your device is connected to the internet and double check your "
@"SIP account configuration in the settings.",
@@ -688,7 +652,7 @@ static RootViewManager *rootViewManagerInstance = nil;
- (void)playMessageSoundForCallID:(NSString *)callID {
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneManager *lm = LinphoneManager.instance;
// if the message was already received through a push notif, we don't need to ring
if (![lm popPushCallID:callID]) {
[lm playMessageSound];
@@ -701,7 +665,7 @@ static RootViewManager *rootViewManagerInstance = nil;
NSString *callId = [NSString stringWithUTF8String:linphone_call_log_get_call_id(callLog)];
if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) {
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneManager *lm = LinphoneManager.instance;
BOOL callIDFromPush = [lm popPushCallID:callId];
BOOL autoAnswer = [lm lpConfigBoolForKey:@"autoanswer_notif_preference"];
@@ -711,7 +675,7 @@ static RootViewManager *rootViewManagerInstance = nil;
} else {
AudioServicesPlaySystemSound(lm.sounds.vibrate);
CallIncomingView *view = VIEW(CallIncomingView);
- [self changeCurrentView:view.compositeViewDescription push:TRUE];
+ [self changeCurrentView:view.compositeViewDescription];
[view setCall:call];
[view setDelegate:self];
}
@@ -723,7 +687,7 @@ static RootViewManager *rootViewManagerInstance = nil;
UIDeviceBatteryState state = [UIDevice currentDevice].batteryState;
LOGD(@"Battery state:%d level:%.2f", state, level);
- LinphoneCall *call = linphone_core_get_current_call([LinphoneManager getLc]);
+ LinphoneCall *call = linphone_core_get_current_call(LC);
if (call && linphone_call_params_video_enabled(linphone_call_get_current_params(call))) {
LinphoneCallAppData *callData = (__bridge LinphoneCallAppData *)linphone_call_get_user_pointer(call);
if (callData != nil) {
@@ -740,7 +704,7 @@ static RootViewManager *rootViewManagerInstance = nil;
linphone_call_params_copy(linphone_call_get_current_params(call));
// stop video
linphone_call_params_enable_video(paramsCopy, FALSE);
- linphone_core_update_call([LinphoneManager getLc], call, paramsCopy);
+ linphone_core_update_call(LC, call, paramsCopy);
}];
[sheet showInView:self.view];
callData->batteryWarningShown = TRUE;
@@ -759,11 +723,11 @@ static RootViewManager *rootViewManagerInstance = nil;
}
- (void)incomingCallAccepted:(LinphoneCall *)call evenWithVideo:(BOOL)video {
- [[LinphoneManager instance] acceptCall:call evenWithVideo:video];
+ [LinphoneManager.instance acceptCall:call evenWithVideo:video];
}
- (void)incomingCallDeclined:(LinphoneCall *)call {
- linphone_core_terminate_call([LinphoneManager getLc], call);
+ linphone_core_terminate_call(LC, call);
}
@end
diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m
index 298fcd49e..5973357f2 100644
--- a/Classes/SettingsView.m
+++ b/Classes/SettingsView.m
@@ -161,7 +161,7 @@
}
// Start notification after animation of DCRoundSwitch
dispatch_async(dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
postNotificationName:kIASKAppSettingChanged
object:[toggle key]
userInfo:[NSDictionary dictionaryWithObject:[self.settingsStore objectForKey:[toggle key]]
@@ -282,6 +282,13 @@ INIT_WITH_COMMON_CF {
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
+ // when device is slow and you are typing an item too much, a crash may happen
+ // because we try to push the same view multiple times - in that case we should
+ // do nothing but wait for device to respond again.
+ if (self.navigationController.topViewController == viewController) {
+ return;
+ }
+
[UINavigationControllerEx removeBackground:viewController.view];
[viewController view]; // Force view
@@ -361,10 +368,10 @@ static UICompositeViewDescription *compositeDescription = nil;
[super viewWillDisappear:animated];
[_settingsController dismiss:self];
// Set observer
- [[NSNotificationCenter defaultCenter] removeObserver:self name:kIASKAppSettingChanged object:nil];
+ [NSNotificationCenter.defaultCenter removeObserver:self name:kIASKAppSettingChanged object:nil];
- if (linphone_ringtoneplayer_is_started(linphone_core_get_ringtoneplayer([LinphoneManager getLc]))) {
- linphone_core_stop_ringing([LinphoneManager getLc]);
+ if (linphone_ringtoneplayer_is_started(linphone_core_get_ringtoneplayer(LC))) {
+ linphone_core_stop_ringing(LC);
}
}
@@ -376,10 +383,10 @@ static UICompositeViewDescription *compositeDescription = nil;
[self recomputeAccountLabelsAndSync];
// Set observer
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(appSettingChanged:)
- name:kIASKAppSettingChanged
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(appSettingChanged:)
+ name:kIASKAppSettingChanged
+ object:nil];
}
#pragma mark - Event Functions
@@ -407,7 +414,7 @@ static UICompositeViewDescription *compositeDescription = nil;
removeFromHiddenKeys = debugEnabled;
[keys addObject:@"send_logs_button"];
[keys addObject:@"reset_logs_button"];
- [[LinphoneManager instance] setLogsEnabled:debugEnabled];
+ [Log enableLogs:debugEnabled];
} else if ([@"account_mandatory_advanced_preference" compare:notif.object] == NSOrderedSame) {
removeFromHiddenKeys = [[notif.userInfo objectForKey:@"account_mandatory_advanced_preference"] boolValue];
for (NSString *key in settingsStore->dict) {
@@ -435,7 +442,7 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark -
+ (IASKSpecifier *)filterSpecifier:(IASKSpecifier *)specifier {
- if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) {
+ if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) {
if ([[specifier key] isEqualToString:@"account_transport_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
@@ -449,7 +456,7 @@ static UICompositeViewDescription *compositeDescription = nil;
} else {
if ([[specifier key] isEqualToString:@"media_encryption_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
- if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionZRTP)) {
+ if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionZRTP)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"ZRTP"];
[dict setObject:titles forKey:@"Titles"];
@@ -457,7 +464,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[values removeObject:@"ZRTP"];
[dict setObject:values forKey:@"Values"];
}
- if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionSRTP)) {
+ if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionSRTP)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"SRTP"];
[dict setObject:titles forKey:@"Titles"];
@@ -465,7 +472,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[values removeObject:@"SRTP"];
[dict setObject:values forKey:@"Values"];
}
- if (!linphone_core_media_encryption_supported([LinphoneManager getLc], LinphoneMediaEncryptionDTLS)) {
+ if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionDTLS)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"DTLS"];
[dict setObject:titles forKey:@"Titles"];
@@ -478,7 +485,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
if ([specifier.key hasPrefix:@"menu_account_"]) {
- const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ const MSList *accounts = linphone_core_get_proxy_config_list(LC);
int index = [specifier.key substringFromIndex:@"menu_account_".length].intValue - 1;
if (index < ms_list_size(accounts)) {
LinphoneProxyConfig *proxy = (LinphoneProxyConfig *)ms_list_nth_data(accounts, index);
@@ -492,15 +499,15 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (NSSet *)findHiddenKeys {
- LinphoneManager *lm = [LinphoneManager instance];
+ LinphoneManager *lm = LinphoneManager.instance;
NSMutableSet *hiddenKeys = [NSMutableSet set];
- const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ const MSList *accounts = linphone_core_get_proxy_config_list(LC);
for (int i = ms_list_size(accounts) + 1; i <= 5; i++) {
[hiddenKeys addObject:[NSString stringWithFormat:@"menu_account_%d", i]];
}
- if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) {
+ if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) {
[hiddenKeys addObject:@"media_encryption_preference"];
}
@@ -513,7 +520,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"flush_images_button"];
#endif
- if (![[LinphoneManager instance] lpConfigBoolForKey:@"debugenable_preference"]) {
+ if (![LinphoneManager.instance lpConfigBoolForKey:@"debugenable_preference"]) {
[hiddenKeys addObject:@"send_logs_button"];
[hiddenKeys addObject:@"reset_logs_button"];
}
@@ -528,10 +535,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"wifi_only_preference"];
- [hiddenKeys addObject:@"quit_button"]; // Hide for the moment
- [hiddenKeys addObject:@"about_button"]; // Hide for the moment
-
- if (!linphone_core_video_supported([LinphoneManager getLc])) {
+ if (!linphone_core_video_supported(LC)) {
[hiddenKeys addObject:@"video_menu"];
}
@@ -557,16 +561,15 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"enable_first_login_view_preference"];
- if (!linphone_core_video_supported([LinphoneManager getLc])) {
+ if (!linphone_core_video_supported(LC)) {
[hiddenKeys addObject:@"enable_video_preference"];
}
- if (!linphone_core_video_display_enabled([LinphoneManager getLc])) {
+ if (!linphone_core_video_display_enabled(LC)) {
[hiddenKeys addObject:@"video_menu"];
}
- if (!linphone_core_get_video_preset([LinphoneManager getLc]) ||
- strcmp(linphone_core_get_video_preset([LinphoneManager getLc]), "custom") != 0) {
+ if (!linphone_core_get_video_preset(LC) || strcmp(linphone_core_get_video_preset(LC), "custom") != 0) {
[hiddenKeys addObject:@"video_preferred_fps_preference"];
[hiddenKeys addObject:@"download_bandwidth_preference"];
}
@@ -578,7 +581,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"port_preference"];
}
- if (linphone_core_get_stun_server([LinphoneManager getLc]) == NULL) {
+ if (linphone_core_get_stun_server(LC) == NULL) {
[hiddenKeys addObject:@"ice_preference"];
}
@@ -605,7 +608,7 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
- if (![[[LinphoneManager instance] iapManager] enabled]) {
+ if (![[LinphoneManager.instance iapManager] enabled]) {
[hiddenKeys addObject:@"in_app_products_button"];
}
@@ -654,7 +657,7 @@ static UICompositeViewDescription *compositeDescription = nil;
if ([key isEqual:@"release_button"]) {
[UIApplication sharedApplication].keyWindow.rootViewController = nil;
[[UIApplication sharedApplication].keyWindow setRootViewController:nil];
- [[LinphoneManager instance] destroyLinphoneCore];
+ [LinphoneManager.instance destroyLinphoneCore];
[LinphoneManager instanceRelease];
} else if ([key isEqual:@"clear_cache_button"]) {
[PhoneMainView.instance.mainViewController
@@ -662,10 +665,9 @@ static UICompositeViewDescription *compositeDescription = nil;
} else if ([key isEqual:@"battery_alert_button"]) {
[[UIDevice currentDevice] _setBatteryState:UIDeviceBatteryStateUnplugged];
[[UIDevice currentDevice] _setBatteryLevel:0.01f];
- [[NSNotificationCenter defaultCenter] postNotificationName:UIDeviceBatteryLevelDidChangeNotification
- object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:UIDeviceBatteryLevelDidChangeNotification object:self];
} else if ([key isEqual:@"flush_images_button"]) {
- const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]);
+ const MSList *rooms = linphone_core_get_chat_rooms(LC);
while (rooms) {
const MSList *messages = linphone_chat_room_get_history(rooms->data, 0);
while (messages) {
@@ -695,8 +697,6 @@ static UICompositeViewDescription *compositeDescription = nil;
[_settingsController.navigationController popViewControllerAnimated:NO];
}];
[alert show];
- } else if ([key isEqual:@"about_button"]) {
- [PhoneMainView.instance changeCurrentView:AboutView.compositeViewDescription push:TRUE];
} else if ([key isEqual:@"reset_logs_button"]) {
linphone_core_reset_log_collection();
} else if ([key isEqual:@"send_logs_button"]) {
@@ -821,9 +821,7 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onDialerBackClick:(id)sender {
[_settingsController.navigationController popViewControllerAnimated:NO];
-
- DialerView *view = VIEW(DialerView);
- [PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
+ [PhoneMainView.instance popToView:DialerView.compositeViewDescription];
}
- (IBAction)onBackClick:(id)sender {
diff --git a/Classes/SideMenuTableView.m b/Classes/SideMenuTableView.m
index 40985246b..6495f93ac 100644
--- a/Classes/SideMenuTableView.m
+++ b/Classes/SideMenuTableView.m
@@ -39,24 +39,18 @@
addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Assistant", nil)
tapBlock:^() {
[PhoneMainView.instance
- changeCurrentView:AssistantView.compositeViewDescription
- push:NO
- animated:NO];
+ changeCurrentView:AssistantView.compositeViewDescription];
}]];
[_sideMenuEntries
addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"Settings", nil)
tapBlock:^() {
[PhoneMainView.instance
- changeCurrentView:SettingsView.compositeViewDescription
- push:NO
- animated:NO];
+ changeCurrentView:SettingsView.compositeViewDescription];
}]];
[_sideMenuEntries addObject:[[SideMenuEntry alloc] initWithTitle:NSLocalizedString(@"About", nil)
tapBlock:^() {
[PhoneMainView.instance
- changeCurrentView:AboutView.compositeViewDescription
- push:NO
- animated:NO];
+ changeCurrentView:AboutView.compositeViewDescription];
}]];
}
@@ -68,10 +62,9 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
- BOOL hasDefault = (linphone_core_get_default_proxy_config([LinphoneManager getLc]) != NULL);
+ BOOL hasDefault = (linphone_core_get_default_proxy_config(LC) != NULL);
// default account is shown in the header already
- return MAX(0,
- ms_list_size(linphone_core_get_proxy_config_list([LinphoneManager getLc])) - (hasDefault ? 1 : 0));
+ return MAX(0, ms_list_size(linphone_core_get_proxy_config_list(LC)) - (hasDefault ? 1 : 0));
} else {
return [_sideMenuEntries count];
}
@@ -80,8 +73,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[UITableViewCell alloc] init];
if (indexPath.section == 0) {
- LinphoneProxyConfig *proxy =
- ms_list_nth_data(linphone_core_get_proxy_config_list([LinphoneManager getLc]), (int)indexPath.row);
+ LinphoneProxyConfig *proxy = ms_list_nth_data(linphone_core_get_proxy_config_list(LC), (int)indexPath.row);
if (proxy) {
cell.textLabel.text = [NSString stringWithUTF8String:linphone_proxy_config_get_identity(proxy)];
cell.imageView.image = [StatusBarView imageForState:linphone_proxy_config_get_state(proxy)];
diff --git a/Classes/SideMenuView.m b/Classes/SideMenuView.m
index 8400bd301..bc1fcc5a6 100644
--- a/Classes/SideMenuView.m
+++ b/Classes/SideMenuView.m
@@ -26,10 +26,10 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(registrationUpdateEvent:)
- name:kLinphoneRegistrationUpdate
- object:nil];
+ [NSNotificationCenter.defaultCenter addObserver:self
+ selector:@selector(registrationUpdateEvent:)
+ name:kLinphoneRegistrationUpdate
+ object:nil];
[self updateHeader];
[_sideMenuTableViewController.tableView reloadData];
@@ -47,7 +47,7 @@
}
- (void)updateHeader {
- LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
+ LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config(LC);
if (default_proxy != NULL) {
const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy);
diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m
index 7bc2eae63..b86eb6e9e 100644
--- a/Classes/Utils/FastAddressBook.m
+++ b/Classes/Utils/FastAddressBook.m
@@ -76,7 +76,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
+ (NSString *)appendCountryCodeIfPossible:(NSString *)number {
if (![number hasPrefix:@"+"] && ![number hasPrefix:@"00"]) {
- NSString *lCountryCode = [[LinphoneManager instance] lpConfigStringForKey:@"countrycode_preference"];
+ NSString *lCountryCode = [LinphoneManager.instance lpConfigStringForKey:@"countrycode_preference"];
if (lCountryCode && [lCountryCode length] > 0) {
// append country code
return [lCountryCode stringByAppendingString:number];
@@ -90,7 +90,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
address = [[address componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]
componentsJoinedByString:@" "];
NSString *normalizedSipAddress = nil;
- LinphoneAddress *linphoneAddress = linphone_core_interpret_url([LinphoneManager getLc], [address UTF8String]);
+ LinphoneAddress *linphoneAddress = linphone_core_interpret_url(LC, [address UTF8String]);
if (linphoneAddress != NULL) {
char *tmp = linphone_address_as_string_uri_only(linphoneAddress);
if (tmp != NULL) {
@@ -211,7 +211,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
CFDictionaryRef lDict = ABMultiValueCopyValueAtIndex(lMap, i);
BOOL add = false;
if (CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) {
- if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField,
+ if (CFStringCompare((CFStringRef)LinphoneManager.instance.contactSipField,
CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey),
kCFCompareCaseInsensitive) == 0) {
add = true;
@@ -237,7 +237,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
}
CFRelease(lContacts);
}
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneAddressBookUpdate object:self];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneAddressBookUpdate object:self];
}
void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void *context) {
@@ -273,14 +273,14 @@ void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info, void
if (CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) {
CFStringRef serviceKey = CFDictionaryGetValue(lDict, kABPersonInstantMessageServiceKey);
- if (CFStringCompare((CFStringRef)[LinphoneManager instance].contactSipField, serviceKey,
+ if (CFStringCompare((CFStringRef)LinphoneManager.instance.contactSipField, serviceKey,
kCFCompareCaseInsensitive) == 0) {
match = true;
}
} else if (domain != nil) {
// check domain
- LinphoneAddress *address = linphone_address_new(
- [(NSString *)CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey) UTF8String]);
+ LinphoneAddress *address = linphone_core_interpret_url(
+ LC, [(NSString *)CFDictionaryGetValue(lDict, kABPersonInstantMessageUsernameKey) UTF8String]);
if (address) {
const char *dom = linphone_address_get_domain(address);
diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m
index 3ffef5ae6..fc18b2fe6 100644
--- a/Classes/Utils/FileTransferDelegate.m
+++ b/Classes/Utils/FileTransferDelegate.m
@@ -22,7 +22,7 @@
}
+ (FileTransferDelegate *)messageDelegate:(LinphoneChatMessage *)message {
- for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) {
+ for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) {
if (ftd.message == message) {
return ftd;
}
@@ -47,14 +47,13 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
UIImage *image = [UIImage imageWithData:thiz.data];
CFBridgingRetain(thiz);
- [[[LinphoneManager instance] fileTransferDelegates] removeObject:thiz];
+ [[LinphoneManager.instance fileTransferDelegates] removeObject:thiz];
// until image is properly saved, keep a reminder on it so that the
// chat bubble is aware of the fact that image is being saved to device
[LinphoneManager setValueInMessageAppData:@"saving..." forKey:@"localimage" inMessage:message];
- [[LinphoneManager instance]
- .photoLibrary
+ [LinphoneManager.instance.photoLibrary
writeImageToSavedPhotosAlbum:image.CGImage
orientation:(ALAssetOrientation)[image imageOrientation]
completionBlock:^(NSURL *assetURL, NSError *error) {
@@ -75,7 +74,7 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
inMessage:message];
}
thiz.message = NULL;
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
postNotificationName:kLinphoneFileTransferRecvUpdate
object:thiz
userInfo:@{
@@ -93,7 +92,7 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
LOGD(@"Transfer of %s (%d bytes): already %ld sent, adding %ld", linphone_content_get_name(content),
linphone_content_get_size(content), [thiz.data length], size);
[thiz.data appendBytes:linphone_buffer_get_string_content(buffer) length:size];
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
postNotificationName:kLinphoneFileTransferRecvUpdate
object:thiz
userInfo:@{
@@ -116,9 +115,9 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
}];
LOGD(@"Transfer of %s (%d bytes): already sent %ld (%f%%), remaining %ld", linphone_content_get_name(content),
total, offset, offset * 100.f / total, remaining);
- [[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneFileTransferSendUpdate
- object:thiz
- userInfo:dict];
+ [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneFileTransferSendUpdate
+ object:thiz
+ userInfo:dict];
LinphoneBuffer *buffer = NULL;
@try {
@@ -172,7 +171,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
}
- (BOOL)download:(LinphoneChatMessage *)message {
- [[[LinphoneManager instance] fileTransferDelegates] addObject:self];
+ [[LinphoneManager.instance fileTransferDelegates] addObject:self];
_message = message;
@@ -191,7 +190,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
}
- (void)stopAndDestroy {
- [[[LinphoneManager instance] fileTransferDelegates] removeObject:self];
+ [[LinphoneManager.instance fileTransferDelegates] removeObject:self];
if (_message != NULL) {
LinphoneChatMessage *msg = _message;
_message = NULL;
@@ -203,7 +202,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
linphone_chat_message_cancel_file_transfer(msg);
}
_data = nil;
- LOGI(@"%p Destroying", self);
+ LOGD(@"%p Destroying", self);
}
- (void)cancel {
diff --git a/Classes/Utils/Log.m b/Classes/Utils/Log.m
index 1c93ba76b..e05118de9 100644
--- a/Classes/Utils/Log.m
+++ b/Classes/Utils/Log.m
@@ -19,7 +19,7 @@
#import "Log.h"
-@implementation LinphoneLogger
+@implementation Log
+ (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format:(NSString *)format, ... {
va_list args;
@@ -28,45 +28,67 @@
const char *utf8str = [str cStringUsingEncoding:NSString.defaultCStringEncoding];
int filesize = 20;
const char *filename = strchr(file, '/') ? strrchr(file, '/') + 1 : file;
- if (severity <= ORTP_DEBUG) {
+
+ char levelC = 'U'; // undefined
+ if ((severity & ORTP_FATAL) != 0) {
+ levelC = 'F';
+ } else if ((severity & ORTP_ERROR) != 0) {
+ levelC = 'E';
+ } else if ((severity & ORTP_WARNING) != 0) {
+ levelC = 'W';
+ } else if ((severity & ORTP_MESSAGE) != 0) {
+ levelC = 'I';
+ } else if ((severity & ORTP_DEBUG) != 0) {
+ levelC = 'D';
+ }
+
+ if ((severity & ORTP_DEBUG) != 0) {
// lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even
// not in debug build...
- ortp_debug("%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
+ ortp_debug("%c %*s:%3d - %s", levelC, filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
+ utf8str);
} else {
- ortp_log(severity, "%*s:%3d - %s", filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
- utf8str);
+ // we want application logs to be always enabled (except debug ones) so use | ORTP_ERROR extra mask
+ ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize,
+ filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
}
va_end(args);
}
++ (void)enableLogs:(BOOL)enabled {
+ [LinphoneManager.instance lpConfigSetBool:enabled forKey:@"debugenable_preference"];
+ linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
+ if (enabled) {
+ NSLog(@"Enabling debug logs");
+ linphone_core_set_log_level(ORTP_DEBUG);
+ } else {
+ NSLog(@"Disabling debug logs");
+ linphone_core_set_log_level(ORTP_ERROR);
+ }
+ linphone_core_enable_log_collection(enabled);
+}
+
#pragma mark - Logs Functions callbacks
void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
NSString *format = [[NSString alloc] initWithUTF8String:fmt];
NSString *formatedString = [[NSString alloc] initWithFormat:format arguments:args];
- char levelC = 'I';
- switch ((OrtpLogLevel)lev) {
- case ORTP_FATAL:
- levelC = 'F';
- break;
- case ORTP_ERROR:
- levelC = 'E';
- break;
- case ORTP_WARNING:
- levelC = 'W';
- break;
- case ORTP_MESSAGE:
- levelC = 'I';
- break;
- case ORTP_TRACE:
- case ORTP_DEBUG:
- levelC = 'D';
- break;
- case ORTP_LOGLEV_END:
- return;
+ NSString *lvl = @"";
+ if ((lev & APP_LVL) == 0) {
+ if ((lev & ORTP_FATAL) != 0) {
+ lvl = @"F ";
+ } else if ((lev & ORTP_ERROR) != 0) {
+ lvl = @"E ";
+ } else if ((lev & ORTP_WARNING) != 0) {
+ lvl = @"W ";
+ } else if ((lev & ORTP_MESSAGE) != 0) {
+ lvl = @"I ";
+ } else if (((lev & ORTP_TRACE) != 0) || ((lev & ORTP_DEBUG) != 0)) {
+ lvl = @"D ";
+ }
}
- // since \r are interpreted like \n, avoid double new lines when logging packets
- NSLog(@"%c %@", levelC, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]);
+ // since \r are interpreted like \n, avoid double new lines when logging network packets (belle-sip)
+ NSLog(@"%@%@", lvl, [formatedString stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"]);
}
@end
diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h
index af581620b..eb139926c 100644
--- a/Classes/Utils/Utils.h
+++ b/Classes/Utils/Utils.h
@@ -19,6 +19,10 @@
#import "LinphoneManager.h"
+#define IPAD (LinphoneManager.runningOnIpad)
+#define ANIMATED ([LinphoneManager.instance lpConfigBoolForKey:@"animations_preference"])
+#define LC ([LinphoneManager getLc])
+
@interface LinphoneUtils : NSObject
+ (BOOL)findAndResignFirstResponder:(UIView*)view;
diff --git a/Classes/fr.lproj/AssistantViewScreens.strings b/Classes/fr.lproj/AssistantViewScreens.strings
index 258d79c3e..ca028abe0 100644
Binary files a/Classes/fr.lproj/AssistantViewScreens.strings and b/Classes/fr.lproj/AssistantViewScreens.strings differ
diff --git a/Resources/fr.lproj/Localizable.strings b/Resources/fr.lproj/Localizable.strings
index bf01483df..b8e02ae08 100644
Binary files a/Resources/fr.lproj/Localizable.strings and b/Resources/fr.lproj/Localizable.strings differ
diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory
index 77e05a713..b59c2071e 100644
--- a/Resources/linphonerc-factory
+++ b/Resources/linphonerc-factory
@@ -17,8 +17,6 @@ display_filter_auto_rotate=0
#contact_filter_on_default_domain=1
#use_phone_number=0
send_logs_include_linphonerc_and_chathistory=0
-fallback_view=DialerView
-unauthorized_views=FirstView
[assistant]
username_regex=^[a-z0-9_.\-]*$
diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist
index 30e709696..f37c4fd13 100644
--- a/Settings/InAppSettings.bundle/Root.plist
+++ b/Settings/InAppSettings.bundle/Root.plist
@@ -150,22 +150,6 @@
Type
PSGroupSpecifier
-
- Key
- about_button
- Title
- About
- Type
- IASKButtonSpecifier
-
-
- Key
- quit_button
- Title
- Quit
- Type
- IASKButtonSpecifier
-
Key
release_button
diff --git a/Settings/InAppSettings.bundle/ar.lproj/Root.strings b/Settings/InAppSettings.bundle/ar.lproj/Root.strings
index 12d8424cd..0e3d4508c 100644
Binary files a/Settings/InAppSettings.bundle/ar.lproj/Root.strings and b/Settings/InAppSettings.bundle/ar.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/de.lproj/Root.strings b/Settings/InAppSettings.bundle/de.lproj/Root.strings
index bd0a0f89b..352084443 100644
Binary files a/Settings/InAppSettings.bundle/de.lproj/Root.strings and b/Settings/InAppSettings.bundle/de.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/en.lproj/Root.strings b/Settings/InAppSettings.bundle/en.lproj/Root.strings
index e6aefd61f..7bc369289 100644
--- a/Settings/InAppSettings.bundle/en.lproj/Root.strings
+++ b/Settings/InAppSettings.bundle/en.lproj/Root.strings
@@ -14,8 +14,6 @@
"Tunnel" = "Tunnel";
"Advanced" = "Advanced";
"Development debug actions" = "Development debug actions";
-"About" = "About";
-"Quit" = "Quit";
"Release core" = "Release core";
"Clear cache" = "Clear cache";
"Battery alert" = "Battery alert";
diff --git a/Settings/InAppSettings.bundle/fr.lproj/Network.strings b/Settings/InAppSettings.bundle/fr.lproj/Network.strings
index 3ee85d5cb..f297b0d48 100644
Binary files a/Settings/InAppSettings.bundle/fr.lproj/Network.strings and b/Settings/InAppSettings.bundle/fr.lproj/Network.strings differ
diff --git a/Settings/InAppSettings.bundle/fr.lproj/Root.strings b/Settings/InAppSettings.bundle/fr.lproj/Root.strings
index b2b623377..bc18aae58 100644
Binary files a/Settings/InAppSettings.bundle/fr.lproj/Root.strings and b/Settings/InAppSettings.bundle/fr.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/fr.lproj/Video.strings b/Settings/InAppSettings.bundle/fr.lproj/Video.strings
index a530a1e8d..887fff3de 100644
Binary files a/Settings/InAppSettings.bundle/fr.lproj/Video.strings and b/Settings/InAppSettings.bundle/fr.lproj/Video.strings differ
diff --git a/Settings/InAppSettings.bundle/ja.lproj/Root.strings b/Settings/InAppSettings.bundle/ja.lproj/Root.strings
index cbee92d3c..e3214cc1b 100644
Binary files a/Settings/InAppSettings.bundle/ja.lproj/Root.strings and b/Settings/InAppSettings.bundle/ja.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/nl.lproj/Root.strings b/Settings/InAppSettings.bundle/nl.lproj/Root.strings
index c971a0eec..7048fa129 100644
Binary files a/Settings/InAppSettings.bundle/nl.lproj/Root.strings and b/Settings/InAppSettings.bundle/nl.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/ru.lproj/Root.strings b/Settings/InAppSettings.bundle/ru.lproj/Root.strings
index f837d1e4d..4200d86f7 100644
Binary files a/Settings/InAppSettings.bundle/ru.lproj/Root.strings and b/Settings/InAppSettings.bundle/ru.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/sv.lproj/Root.strings b/Settings/InAppSettings.bundle/sv.lproj/Root.strings
index 7b5f657d2..053f7678a 100644
Binary files a/Settings/InAppSettings.bundle/sv.lproj/Root.strings and b/Settings/InAppSettings.bundle/sv.lproj/Root.strings differ
diff --git a/Settings/InAppSettings.bundle/zh_TW.lproj/Root.strings b/Settings/InAppSettings.bundle/zh_TW.lproj/Root.strings
index d1219411f..30046b646 100644
Binary files a/Settings/InAppSettings.bundle/zh_TW.lproj/Root.strings and b/Settings/InAppSettings.bundle/zh_TW.lproj/Root.strings differ
diff --git a/TestsUI/ChatTester.m b/TestsUI/ChatTester.m
index 788d07760..eb3c7b99f 100644
--- a/TestsUI/ChatTester.m
+++ b/TestsUI/ChatTester.m
@@ -68,9 +68,7 @@
}
- (void)uploadImageWithQuality:(NSString *)quality {
- UITableView *tv = [self findTableView:@"ChatRoom list"];
-
- long messagesCount = [tv numberOfRowsInSection:0];
+ static int ind = 0;
[tester tapViewWithAccessibilityLabel:@"Send picture"];
[tester tapViewWithAccessibilityLabel:@"Photo library"];
// if popup "Linphone would access your photo" pops up, click OK.
@@ -80,8 +78,11 @@
}
#endif
- // select random photo to avoid having the same multiple times
- [tester choosePhotoInAlbum:@"Camera Roll" atRow:2 column:2 + (messagesCount % 2)];
+ // select random photo to avoid having the same multiple times.
+ // There are 9 photos by default, so lets use just 8 (2 rows, 4 columns).
+ LOGI(@"Selecting photo at row %d, column %d", 1 + (ind / 4) % 2, 1 + ind % 4);
+ [tester choosePhotoInAlbum:@"Camera Roll" atRow:1 + (ind / 4) % 2 column:1 + ind % 4];
+ ind++;
// wait for the quality popup to show up
UIAccessibilityElement *element = nil;
@@ -104,7 +105,7 @@
// wait for the upload to terminate...
for (int i = 0; i < 45; i++) {
[tester waitForTimeInterval:1.f];
- if ([[[LinphoneManager instance] fileTransferDelegates] count] == 0)
+ if (LinphoneManager.instance.fileTransferDelegates.count == 0)
break;
}
[tester waitForViewWithAccessibilityLabel:@"Download"];
diff --git a/TestsUI/LinphoneTestCase.m b/TestsUI/LinphoneTestCase.m
index d3d672543..371ef2365 100644
--- a/TestsUI/LinphoneTestCase.m
+++ b/TestsUI/LinphoneTestCase.m
@@ -48,6 +48,7 @@
- (void)beforeEach {
[[LinphoneManager instance] lpConfigSetInt:NO forKey:@"animations_preference"];
+ linphone_core_set_log_level(ORTP_MESSAGE);
}
- (NSString *)me {
@@ -104,8 +105,8 @@
linphone_core_clear_proxy_config(lc);
linphone_core_clear_all_auth_info(lc);
- LinphoneAddress *testAddr = linphone_address_new(
- [[NSString stringWithFormat:@"sip:%@@%@", [self me], [self accountDomain]] UTF8String]);
+ LinphoneAddress *testAddr = linphone_core_interpret_url(
+ LC, [[NSString stringWithFormat:@"sip:%@@%@", [self me], [self accountDomain]] UTF8String]);
linphone_address_set_header(testAddr, "X-Create-Account", "yes");
linphone_address_set_transport(testAddr, LinphoneTransportTcp);
linphone_address_set_port(testAddr, 0);
diff --git a/linphone_Prefix.pch b/linphone_Prefix.pch
index c562b2c3a..7bc9a548d 100644
--- a/linphone_Prefix.pch
+++ b/linphone_Prefix.pch
@@ -13,3 +13,6 @@
#import "UIToggleButton.h"
#import "UISpeakerButton.h"
#import "UIBluetoothButton.h"
+#import "UIMicroButton.h"
+
+#import "UIChatBubbleTextCell.h"
diff --git a/prepare.py b/prepare.py
index c356ed368..248e79c42 100755
--- a/prepare.py
+++ b/prepare.py
@@ -320,8 +320,10 @@ sdk:
\t\techo "[{archs}] Mixing `basename $$archive` in $$destpath"; \\
\t\tlipo -create $$all_paths -output $$destpath; \\
\tdone; \\
-\techo 'NOTE: the following libraries were STUBBED:'; \\
-\tcat WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt
+\tif test -s WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; then \\
+\t\techo 'NOTE: the following libraries were STUBBED:'; \\
+\t\tcat WORK/ios-{first_arch}/Build/dummy_libraries/dummy_libraries.txt; \\
+\tfi
build: $(addsuffix -build, $(archs))
\t$(MAKE) sdk
diff --git a/submodules/externals/opencore-amr b/submodules/externals/opencore-amr
new file mode 160000
index 000000000..cf4409e03
--- /dev/null
+++ b/submodules/externals/opencore-amr
@@ -0,0 +1 @@
+Subproject commit cf4409e03ec56b1cd85a2f9532f58bc1fa9db274
diff --git a/submodules/externals/openh264 b/submodules/externals/openh264
index 3a75956fb..2610ab183 160000
--- a/submodules/externals/openh264
+++ b/submodules/externals/openh264
@@ -1 +1 @@
-Subproject commit 3a75956fb2584cca84a95ba1fcbc72fa2c91f98d
+Subproject commit 2610ab183249aee91862d2ad065f61db89107b34