Revert "Merge branch 'master' into dev_group_chat" [Outgrade submodule]

This reverts commit e1fe6a61ac, reversing
changes made to 5bfbd6e6d5.
This commit is contained in:
Benjamin Reis 2018-06-12 10:43:51 +02:00
parent de81aed0cf
commit ab15c63731
5 changed files with 63 additions and 69 deletions

View file

@ -16,13 +16,13 @@
@property(nonatomic, strong) NSMutableArray *addresses;
@property(nonatomic, strong) NSMutableArray *phoneOrAddr;
@end
@implementation ChatConversationCreateTableView
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
_magicSearch = linphone_core_create_magic_search(LC);
int y = _contactsGroup.count > 0
? _collectionView.frame.origin.y + _collectionView.frame.size.height
@ -81,7 +81,7 @@
results = results->next;
continue;
}
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
const char *normalizedPhoneNumber = linphone_proxy_config_normalize_phone_number(cfg, phoneNumber);
addr = linphone_proxy_config_normalize_sip_uri(cfg, normalizedPhoneNumber);
@ -100,6 +100,7 @@
results = results->next;
}
[self.tableView reloadData];
}
@ -127,7 +128,7 @@
LinphoneAddress *addr = [LinphoneUtils normalizeSipOrPhoneAddress:key];
if (!addr)
return cell;
cell.linphoneImage.hidden = !linphoneContact;
cell.displayNameLabel.text = [FastAddressBook displayNameForAddress:addr];
cell.addressLabel.text = linphoneContact ? [NSString stringWithUTF8String:linphone_address_as_string(addr)] : phoneOrAddr;
@ -224,7 +225,7 @@
if ([searchText isEqualToString:@""]) {
if (_magicSearch)
linphone_magic_search_reset_search_cache(_magicSearch);
[_searchBar resignFirstResponder];
}
}
@ -251,7 +252,7 @@
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {
if (_magicSearch)
linphone_magic_search_reset_search_cache(_magicSearch);
[searchBar resignFirstResponder];
}

View file

@ -74,7 +74,7 @@
- (void)applicationDidBecomeActive:(UIApplication *)application {
LOGI(@"%@", NSStringFromSelector(_cmd));
if (startedInBackground) {
startedInBackground = FALSE;
[PhoneMainView.instance startUp];
@ -239,7 +239,7 @@
LinphoneManager *instance = [LinphoneManager instance];
//init logs asap
[Log enableLogs:[[LinphoneManager instance] lpConfigIntForKey:@"debugenable_preference"]];
BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"];
BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"];
[self registerForNotifications]; // Register for notifications must be done ASAP to give a chance for first SIP register to be done with right token. Specially true in case of remote provisionning or re-install with new type of signing certificate, like debug to release.

View file

@ -1041,18 +1041,18 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
@"provide password again, or check your "
@"account configuration in the settings.", nil), username, realm]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = NSLocalizedString(@"Password", nil);
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.secureTextEntry = YES;
}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Confirm password", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@ -1063,13 +1063,13 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
linphone_core_add_auth_info(LC, info);
[LinphoneManager.instance refreshRegisters];
}];
UIAlertAction* settingsAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Go to settings", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[PhoneMainView.instance changeCurrentView:SettingsView.compositeViewDescription];
}];
[alertView addAction:defaultAction];
[alertView addAction:continueAction];
[alertView addAction:settingsAction];
@ -1145,7 +1145,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
if (PhoneMainView.instance.currentView == ChatConversationView.compositeViewDescription && room == PhoneMainView.instance.currentRoom)
return;
}
// Create a new notification
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
NSArray *actions;
@ -1572,7 +1572,7 @@ static void networkReachabilityNotification(CFNotificationCenterRef center, void
if ([newSSID compare:mgr.SSID] == NSOrderedSame)
return;
if (newSSID != Nil && newSSID.length > 0 && mgr.SSID != Nil && newSSID.length > 0) {
if (SCNetworkReachabilityGetFlags([mgr getProxyReachability], &flags)) {
LOGI(@"Wifi SSID changed, resesting transports.");
@ -1798,7 +1798,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
linphone_core_enable_video_display(theLinphoneCore, FALSE);
linphone_core_enable_video_capture(theLinphoneCore, FALSE);
}
[self enableProxyPublish:([UIApplication sharedApplication].applicationState == UIApplicationStateActive)];
LOGI(@"Linphone [%s] started on [%s]", linphone_core_get_version(), [[UIDevice currentDevice].model UTF8String]);
@ -1847,11 +1847,11 @@ static BOOL libStarted = FALSE;
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"No microphone", nil)
message:NSLocalizedString(@"You need to plug a microphone to your device to use the application.", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
}
@ -1877,11 +1877,11 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
message:[NSString stringWithFormat:NSLocalizedString(@"Link your Linphone.org account %s to your phone number.", nil),
linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg))]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Maybe later", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
UIAlertAction* continueAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Let's go", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@ -1929,7 +1929,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
LOGI(@"linphonecore is already created");
return;
}
connectivity = none;
// Set audio assets
@ -1965,7 +1965,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
linphone_core_cbs_set_call_encryption_changed(cbs, linphone_iphone_call_encryption_changed);
linphone_core_cbs_set_chat_room_state_changed(cbs, linphone_iphone_chatroom_state_changed);
linphone_core_cbs_set_user_data(cbs, (__bridge void *)(self));
theLinphoneCore = linphone_factory_create_core_with_config(factory, cbs, _configDb);
// Let the core handle cbs
linphone_core_cbs_unref(cbs);
@ -1980,7 +1980,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat
libmsopenh264_init(f);
libmswebrtc_init(f);
libmscodec2_init(f);
linphone_core_reload_ms_plugins(theLinphoneCore, NULL);
[self migrationAllPost];
@ -2153,7 +2153,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
[LinphoneUtils intervalToString:[[UIApplication sharedApplication] backgroundTimeRemaining]]);
}
- (void)startPushLongRunningTask:(NSString *)loc_key callId:(NSString *)callId {
if (!callId)
return;
@ -2161,7 +2160,6 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
if ([callId isEqualToString:@""])
return;
if ([loc_key isEqualToString:@"IM_MSG"]) {
[[UIApplication sharedApplication] endBackgroundTask:pushBgTaskMsg];
pushBgTaskMsg = 0;
@ -2248,7 +2246,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
if (linphone_core_get_global_state(LC) != LinphoneGlobalOn || !linphone_core_get_default_friend_list(LC)) {
LOGW(@"Not changing presence configuration because linphone core not ready yet");
return;
}
}
if ([self lpConfigBoolForKey:@"publish_presence"]) {
// set present to "tv", because "available" does not work yet
@ -2283,7 +2281,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
// disable presence
[self enableProxyPublish:NO];
// handle proxy config if any
if (proxyCfg) {
const char *refkey = proxyCfg ? linphone_proxy_config_get_ref_key(proxyCfg) : NULL;
@ -2565,11 +2563,11 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
UIAlertController *errView = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Network Error", nil)
message:NSLocalizedString(@"There is no network connection available, enable WIFI or WWAN prior to place a call", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
return;
@ -2598,11 +2596,11 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
message:NSLocalizedString(@"Either configure a SIP proxy server from settings prior to place a "
@"call or use a valid SIP address (I.E sip:john@example.net)", nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
return;

View file

@ -152,7 +152,7 @@
BOOL success = FALSE;
if(granted){
LOGD(@"CNContactStore authorization granted");
NSError *contactError;
CNContactStore* store = [[CNContactStore alloc] init];
[store containersMatchingPredicate:[CNContainer predicateForContainersWithIdentifiers:@[ store.defaultContainerIdentifier]] error:&contactError];
@ -164,18 +164,18 @@
CNInstantMessageAddressUsernameKey, CNContactImageDataKey, CNContactOrganizationNameKey
];
CNContactFetchRequest *request = [[CNContactFetchRequest alloc] initWithKeysToFetch:keysToFetch];
success = [store enumerateContactsWithFetchRequest:request error:&contactError usingBlock:^(CNContact *__nonnull contact, BOOL *__nonnull stop) {
if (contactError) {
NSLog(@"error fetching contacts %@",
contactError);
} else {
dispatch_async(dispatch_get_main_queue(), ^{
Contact *newContact = [[Contact alloc] initWithCNContact:contact];
[self registerAddrsFor:newContact];
});
}
}];
}
@ -243,7 +243,7 @@
+ (BOOL)contactHasValidSipDomain:(Contact *)contact {
if (!contact)
return NO;
// Check if one of the contact' sip URI matches the expected SIP filter
NSString *domain = LinphoneManager.instance.contactFilter;
@ -446,7 +446,7 @@
linphone_friend_done(contact.friend);
}
}
BOOL enabled = [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"];
const MSList *lists = linphone_core_get_friends_lists(LC);
while (lists) {

View file

@ -463,46 +463,41 @@
}
+ (LinphoneAddress *)normalizeSipOrPhoneAddress:(NSString *)value {
if (!value || [value isEqualToString:@""]) {
if (!value || [value isEqualToString:@""])
return NULL;
}
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
const char *normvalue;
if (linphone_proxy_config_is_phone_number(cfg, value.UTF8String)) {
normvalue = linphone_proxy_config_normalize_phone_number(cfg, value.UTF8String);
} else {
normvalue = value.UTF8String;
}
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue);
// first try to find a friend with the given address
Contact *c = [FastAddressBook getContactWithAddress:addr];
if (c && c.friend) {
LinphoneFriend *f = c.friend;
const LinphonePresenceModel *m = f ? linphone_friend_get_presence_model_for_uri_or_tel(f, value.UTF8String) : NULL;
const char *contact = m ? linphone_presence_model_get_contact(m) : NULL;
if (contact) {
LinphoneAddress *contact_addr = linphone_address_new(contact);
if (contact_addr) {
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
const char *normvalue;
normvalue = linphone_proxy_config_is_phone_number(cfg, value.UTF8String)
? linphone_proxy_config_normalize_phone_number(cfg, value.UTF8String)
: value.UTF8String;
LinphoneAddress *addr = linphone_proxy_config_normalize_sip_uri(cfg, normvalue);
// first try to find a friend with the given address
Contact *c = [FastAddressBook getContactWithAddress:addr];
if (c && c.friend) {
LinphoneFriend *f = c.friend;
const LinphonePresenceModel *m = f
? linphone_friend_get_presence_model_for_uri_or_tel(f, value.UTF8String)
: NULL;
const char *contact = m ? linphone_presence_model_get_contact(m) : NULL;
if (contact) {
LinphoneAddress *contact_addr = linphone_address_new(contact);
if (contact_addr) {
linphone_address_destroy(addr);
return contact_addr;
}
}
return contact_addr;
}
}
}
// since user wants to escape plus, we assume it expects to have phone
// numbers by default
if (addr) {
if (cfg || (linphone_proxy_config_get_dial_escape_plus(cfg))) {
if (linphone_proxy_config_is_phone_number(cfg, normvalue)) {
linphone_address_set_username(addr, normvalue);
}
} else {
if (linphone_proxy_config_is_phone_number(cfg, value.UTF8String)) {
linphone_address_set_username(addr, value.UTF8String);
}
}
}
if (addr && cfg) {
const char *username = linphone_proxy_config_get_dial_escape_plus(cfg) ? normvalue : value.UTF8String;
if (linphone_proxy_config_is_phone_number(cfg, username))
linphone_address_set_username(addr, username);
}
return addr;
}