diff --git a/Classes/Base.lproj/WizardViews.xib b/Classes/Base.lproj/WizardViews.xib
index ec354b32a..0f68015ae 100644
--- a/Classes/Base.lproj/WizardViews.xib
+++ b/Classes/Base.lproj/WizardViews.xib
@@ -491,7 +491,7 @@
-
+
@@ -618,7 +618,7 @@
-
+
diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 29c84341d..51483dfed 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -122,6 +122,19 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
// root section
{
+ const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ int count = ms_list_size(accounts);
+ for (int i = 1; i <= count; i++, accounts = accounts->next) {
+ NSString *key = [NSString stringWithFormat:@"account_%d_menu", i];
+ LinphoneProxyConfig *proxy = (LinphoneProxyConfig *)accounts->data;
+ [self setCString:linphone_address_get_username(linphone_proxy_config_get_identity_address(proxy))
+ forKey:key];
+ }
+ }
+ // account section
+ {
+ // todo
+ /*
LinphoneProxyConfig *cfg = NULL;
linphone_core_get_default_proxy(lc, &cfg);
if (cfg) {
@@ -191,6 +204,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
[self setCString:linphone_auth_info_get_ha1(ai) forKey:@"ha1_preference"];
}
[self setBool:[lm lpConfigBoolForKey:@"advanced_account_preference"] forKey:@"advanced_account_preference"];
+ */
}
// audio section
diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m
index d9a98bd7b..cb55ee898 100644
--- a/Classes/LinphoneUI/UICompositeViewController.m
+++ b/Classes/LinphoneUI/UICompositeViewController.m
@@ -622,10 +622,20 @@
}
completion:^(BOOL finished) {
_sideMenuView.hidden = hidden;
+ if (hidden) {
+ [self.sideMenuViewController viewWillDisappear:animated];
+ } else {
+ [self.sideMenuViewController viewWillAppear:animated];
+ }
}];
} else {
_sideMenuView.frame = d;
_sideMenuView.hidden = hidden;
+ if (hidden) {
+ [self.sideMenuViewController viewWillDisappear:animated];
+ } else {
+ [self.sideMenuViewController viewWillAppear:animated];
+ }
}
}
diff --git a/Classes/SettingsViewController.h b/Classes/SettingsViewController.h
index ba88909ca..538d3b98c 100644
--- a/Classes/SettingsViewController.h
+++ b/Classes/SettingsViewController.h
@@ -23,7 +23,8 @@
#import "IASKAppSettingsViewController.h"
#import "LinphoneCoreSettingsStore.h"
-@interface SettingsViewController: UIViewController {
+@interface SettingsViewController
+ : UIViewController {
@private
LinphoneCoreSettingsStore* settingsStore;
}
diff --git a/Classes/SettingsViewController.m b/Classes/SettingsViewController.m
index 71a02e0c3..9ee5095b0 100644
--- a/Classes/SettingsViewController.m
+++ b/Classes/SettingsViewController.m
@@ -539,6 +539,20 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
+ if ([specifier.key hasPrefix:@"account_"] && [specifier.key hasSuffix:@"_menu"]) {
+ const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ int index = [[specifier.key substringFromIndex:@"account_".length] stringByReplacingOccurrencesOfString:@"_menu"
+ withString:@""]
+ .intValue -
+ 1;
+ if (index < ms_list_size(accounts)) {
+ LinphoneProxyConfig *proxy = (LinphoneProxyConfig *)ms_list_nth_data(accounts, index);
+ NSString *name = [NSString
+ stringWithUTF8String:linphone_address_get_username(linphone_proxy_config_get_identity_address(proxy))];
+ [specifier.specifierDict setValue:name forKey:kIASKTitle];
+ }
+ }
+
return specifier;
}
@@ -546,6 +560,11 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneManager *lm = [LinphoneManager instance];
NSMutableSet *hiddenKeys = [NSMutableSet set];
+ const MSList *accounts = linphone_core_get_proxy_config_list([LinphoneManager getLc]);
+ for (int i = ms_list_size(accounts) + 1; i <= 5; i++) {
+ [hiddenKeys addObject:[NSString stringWithFormat:@"account_%d_menu", i]];
+ }
+
if (!linphone_core_sip_transport_supported([LinphoneManager getLc], LinphoneTransportTls)) {
[hiddenKeys addObject:@"media_encryption_preference"];
}
@@ -657,15 +676,6 @@ static UICompositeViewDescription *compositeDescription = nil;
return hiddenKeys;
}
-- (void)goToWizard {
- WizardViewController *controller =
- DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[WizardViewController compositeViewDescription]],
- WizardViewController);
- if (controller != nil) {
- [controller reset];
- }
-}
-
#pragma mark - IASKSettingsDelegate Functions
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController *)sender {
@@ -692,20 +702,8 @@ static UICompositeViewDescription *compositeDescription = nil;
}
#endif
if ([key isEqual:@"wizard_button"]) {
- if (linphone_core_get_default_proxy_config(lc) == NULL) {
- [self goToWizard];
- return;
- }
- UIAlertView *alert = [[UIAlertView alloc]
- initWithTitle:NSLocalizedString(@"Warning", nil)
- message:
- NSLocalizedString(
- @"Launching the Wizard will delete any existing proxy config.\nAre you sure to want it?",
- nil)
- delegate:self
- cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
- otherButtonTitles:NSLocalizedString(@"Launch Wizard", nil), nil];
- [alert show];
+ [PhoneMainView.instance changeCurrentView:WizardViewController.compositeViewDescription];
+ return;
} else if ([key isEqual:@"clear_proxy_button"]) {
if (linphone_core_get_default_proxy_config(lc) == NULL) {
return;
@@ -759,15 +757,6 @@ static UICompositeViewDescription *compositeDescription = nil;
}
}
-#pragma mark - UIAlertView delegate
-
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
- if (buttonIndex != 1)
- return; /* cancel */
- else
- [self goToWizard];
-}
-
#pragma mark - Mail composer for send log
- (void)emailAttachment:(NSData *)attachment mimeType:(NSString *)type name:(NSString *)attachmentName {
if (attachmentName == nil || type == nil || attachmentName == nil) {
diff --git a/Classes/SideMenuTableViewController.m b/Classes/SideMenuTableViewController.m
index c3575061b..c1c060624 100644
--- a/Classes/SideMenuTableViewController.m
+++ b/Classes/SideMenuTableViewController.m
@@ -58,17 +58,29 @@
#pragma mark - Table View Controller
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
+ return ms_list_size(linphone_core_get_proxy_config_list([LinphoneManager getLc])) > 1 ? 2 : 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return [_sideMenuEntries count];
+ if (section == 0) {
+ // default account is shown in the header already
+ return ms_list_size(linphone_core_get_proxy_config_list([LinphoneManager getLc])) - 1;
+ } else {
+ return [_sideMenuEntries count];
+ }
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- SideMenuEntry *entry = [_sideMenuEntries objectAtIndex:indexPath.row];
UITableViewCell *cell = [[UITableViewCell alloc] init];
- cell.textLabel.text = entry->title;
+ if (indexPath.section == 0) {
+ LinphoneProxyConfig *proxy =
+ ms_list_nth_data(linphone_core_get_proxy_config_list([LinphoneManager getLc]), (int)indexPath.row);
+ cell.textLabel.text = [NSString
+ stringWithUTF8String:linphone_address_get_username(linphone_proxy_config_get_identity_address(proxy))];
+ } else {
+ SideMenuEntry *entry = [_sideMenuEntries objectAtIndex:indexPath.row];
+ cell.textLabel.text = entry->title;
+ }
return cell;
}
diff --git a/Classes/SideMenuViewController.m b/Classes/SideMenuViewController.m
index 7523f989b..a5c51bc28 100644
--- a/Classes/SideMenuViewController.m
+++ b/Classes/SideMenuViewController.m
@@ -32,6 +32,7 @@
- (void)viewWillAppear:(BOOL)animated {
[self updateHeader];
+ [_sideMenuTableViewController.tableView reloadData];
}
- (IBAction)onLateralSwipe:(id)sender {
diff --git a/Classes/WizardViewController.m b/Classes/WizardViewController.m
index eb0eae884..78eb49f44 100644
--- a/Classes/WizardViewController.m
+++ b/Classes/WizardViewController.m
@@ -377,7 +377,6 @@ static UICompositeViewDescription *compositeDescription = nil;
LinphoneManager *lm = [LinphoneManager instance];
[lm configurePushTokenForProxyConfig:proxyCfg];
- [lm removeAllAccounts];
linphone_proxy_config_enable_register(proxyCfg, true);
linphone_core_add_auth_info(lc, info);
@@ -477,7 +476,14 @@ static UICompositeViewDescription *compositeDescription = nil;
#pragma mark -
-- (void)registrationUpdate:(LinphoneRegistrationState)state message:(NSString *)message {
+- (void)registrationUpdate:(LinphoneRegistrationState)state
+ forProxy:(LinphoneProxyConfig *)proxy
+ message:(NSString *)message {
+ // in wizard we only care about ourself
+ if (proxy != linphone_core_get_default_proxy_config([LinphoneManager getLc])) {
+ return;
+ }
+
switch (state) {
case LinphoneRegistrationOk: {
_waitView.hidden = true;
@@ -523,6 +529,8 @@ static UICompositeViewDescription *compositeDescription = nil;
linphone_core_enable_video_preview([LinphoneManager getLc], FALSE);
[[LinphoneManager instance] resetLinphoneCore];
linphone_core_enable_video_preview([LinphoneManager getLc], hasPreview);
+ // we will set the new default proxy config in the wizard
+ linphone_core_set_default_proxy_config([LinphoneManager getLc], NULL);
}
#pragma mark - UITextFieldDelegate Functions
@@ -864,7 +872,9 @@ static UICompositeViewDescription *compositeDescription = nil;
- (void)registrationUpdateEvent:(NSNotification *)notif {
NSString *message = [notif.userInfo objectForKey:@"message"];
- [self registrationUpdate:[[notif.userInfo objectForKey:@"state"] intValue] message:message];
+ [self registrationUpdate:[[notif.userInfo objectForKey:@"state"] intValue]
+ forProxy:[[notif.userInfo objectForKeyedSubscript:@"cfg"] pointerValue]
+ message:message];
}
#pragma mark - XMLRPCConnectionDelegate Functions
diff --git a/Settings/InAppSettings.bundle/Account.plist b/Settings/InAppSettings.bundle/Account.plist
new file mode 100644
index 000000000..e20bfe2a9
--- /dev/null
+++ b/Settings/InAppSettings.bundle/Account.plist
@@ -0,0 +1,159 @@
+
+
+
+
+ PreferenceSpecifiers
+
+
+ Key
+ clear_proxy_button
+ Title
+ Clear Account
+ Type
+ IASKButtonSpecifier
+
+
+ AutocapitalizationType
+ None
+ AutocorrectionType
+ No
+ DefaultValue
+
+ IsSecure
+
+ Key
+ username_preference
+ KeyboardType
+ Alphabet
+ Title
+ User name
+ Type
+ PSTextFieldSpecifier
+
+
+ AutocapitalizationType
+ None
+ AutocorrectionType
+ No
+ DefaultValue
+
+ IsSecure
+
+ Key
+ userid_preference
+ KeyboardType
+ Alphabet
+ Title
+ User ID
+ Type
+ PSTextFieldSpecifier
+
+
+ AutocapitalizationType
+ None
+ AutocorrectionType
+ No
+ DefaultValue
+
+ IsSecure
+
+ Key
+ password_preference
+ KeyboardType
+ Alphabet
+ Title
+ Password
+ Type
+ PSTextFieldSpecifier
+
+
+ AutocapitalizationType
+ None
+ AutocorrectionType
+ No
+ DefaultValue
+
+ IsSecure
+
+ Key
+ domain_preference
+ KeyboardType
+ URL
+ Title
+ Domain
+ Type
+ PSTextFieldSpecifier
+
+
+ AutocapitalizationType
+ None
+ AutocorrectionType
+ No
+ DefaultValue
+
+ IsSecure
+
+ Key
+ proxy_preference
+ KeyboardType
+ URL
+ Title
+ Proxy
+ Type
+ PSTextFieldSpecifier
+
+
+ DefaultValue
+ udp
+ Key
+ transport_preference
+ Title
+ Transport
+ Titles
+
+ UDP
+ TCP
+ TLS
+
+ Type
+ PSMultiValueSpecifier
+ Values
+
+ udp
+ tcp
+ tls
+
+
+
+ Title
+ Outbound proxy
+ DefaultValue
+
+ Key
+ outbound_proxy_preference
+ Type
+ PSToggleSwitchSpecifier
+
+
+ Title
+ AVPF
+ DefaultValue
+
+ Key
+ avpf_preference
+ Type
+ PSToggleSwitchSpecifier
+
+
+ Type
+ PSToggleSwitchSpecifier
+ Title
+ More options
+ Key
+ advanced_account_preference
+ DefaultValue
+
+
+
+
+
diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist
index dedc25c2d..05ace17ab 100644
--- a/Settings/InAppSettings.bundle/Root.plist
+++ b/Settings/InAppSettings.bundle/Root.plist
@@ -6,7 +6,7 @@
Title
- SIP account
+ SIP accounts
Type
PSGroupSpecifier
@@ -20,153 +20,53 @@
Key
- clear_proxy_button
+ account_1_menu
+ File
+ Account
Title
- Clear Account
+ Account 1
Type
- IASKButtonSpecifier
+ PSChildPaneSpecifier
- AutocapitalizationType
- None
- AutocorrectionType
- No
- DefaultValue
-
- IsSecure
-
Key
- username_preference
- KeyboardType
- Alphabet
+ account_2_menu
+ File
+ Account
Title
- User name
+ Account 2
Type
- PSTextFieldSpecifier
+ PSChildPaneSpecifier
- AutocapitalizationType
- None
- AutocorrectionType
- No
- DefaultValue
-
- IsSecure
-
Key
- userid_preference
- KeyboardType
- Alphabet
+ account_3_menu
+ File
+ Account
Title
- User ID
+ Account 3
Type
- PSTextFieldSpecifier
+ PSChildPaneSpecifier
- AutocapitalizationType
- None
- AutocorrectionType
- No
- DefaultValue
-
- IsSecure
-
Key
- password_preference
- KeyboardType
- Alphabet
+ account_4_menu
+ File
+ Account
Title
- Password
+ Account 4
Type
- PSTextFieldSpecifier
+ PSChildPaneSpecifier
- AutocapitalizationType
- None
- AutocorrectionType
- No
- DefaultValue
-
- IsSecure
-
Key
- domain_preference
- KeyboardType
- URL
+ account_5_menu
+ File
+ Account
Title
- Domain
+ Account 5
Type
- PSTextFieldSpecifier
-
-
- AutocapitalizationType
- None
- AutocorrectionType
- No
- DefaultValue
-
- IsSecure
-
- Key
- proxy_preference
- KeyboardType
- URL
- Title
- Proxy
- Type
- PSTextFieldSpecifier
-
-
- DefaultValue
- udp
- Key
- transport_preference
- Title
- Transport
- Titles
-
- UDP
- TCP
- TLS
-
- Type
- PSMultiValueSpecifier
- Values
-
- udp
- tcp
- tls
-
-
-
- Title
- Outbound proxy
- DefaultValue
-
- Key
- outbound_proxy_preference
- Type
- PSToggleSwitchSpecifier
-
-
- Title
- AVPF
- DefaultValue
-
- Key
- avpf_preference
- Type
- PSToggleSwitchSpecifier
-
-
- Type
- PSToggleSwitchSpecifier
- Title
- More options
- Key
- advanced_account_preference
- DefaultValue
-
+ PSChildPaneSpecifier
Title