Commit 4c026f68 authored by QuentinArguillere's avatar QuentinArguillere
Browse files

Unsubscribe from friends list when removing and account, and add a small...

Unsubscribe from friends list when removing and account, and add a small filter to avoid displaying irrelevant authentication requests from previously logged account on the app
parent fa27a5f1
Pipeline #26966 failed with stage
in 4 minutes and 58 seconds
......@@ -947,13 +947,22 @@
- (void)removeAccount {
LinphoneProxyConfig *config = bctbx_list_nth_data(linphone_core_get_proxy_config_list(LC),
[self integerForKey:@"current_proxy_config_preference"]);
const MSList *lists = linphone_core_get_friends_lists(LC);
while (lists) {
linphone_friend_list_enable_subscriptions(lists->data, FALSE);
linphone_friend_list_update_subscriptions(lists->data);
lists = lists->next;
}
BOOL isDefault = (linphone_core_get_default_proxy_config(LC) == config);
const LinphoneAuthInfo *ai = linphone_proxy_config_find_auth_info(config);
linphone_core_remove_proxy_config(LC, config);
if (ai) {
linphone_core_remove_auth_info(LC, ai);
// Friend list unsubscription above is not instantanous, so give a bit of a time margin before finishing the removal of the auth info
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(20 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
linphone_core_remove_auth_info(LC, ai);
});
}
[self setInteger:-1 forKey:@"current_proxy_config_preference"];
......
......@@ -723,7 +723,22 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
const char * usernameC = linphone_auth_info_get_username(auth_info) ? : "";
const char * domainC = linphone_auth_info_get_domain(auth_info) ? : "";
static UIAlertController *alertView = nil;
// InstantMessageDeliveryNotifications from previous accounts can trigger some pop-up spam asking for indentification
// Try to filter the popup password request to avoid displaying those that do not matter and can be handled through a simple warning
const MSList *configList = linphone_core_get_proxy_config_list(LC);
bool foundMatchingConfig = false;
while (configList && !foundMatchingConfig) {
const char * configUsername = linphone_proxy_config_get_identity(configList->data);
const char * configDomain = linphone_proxy_config_get_domain(configList->data);
foundMatchingConfig = (strcmp(configUsername, usernameC) == 0) && (strcmp(configDomain, domainC) == 0);
configList = configList->next;
}
if (!foundMatchingConfig) {
LOGW(@"Received an authentication request from %s@%s, but ignored it did not match any current user", usernameC, domainC);
return;
}
// avoid having multiple popups
[PhoneMainView.instance dismissViewControllerAnimated:YES completion:nil];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment