Commit 529bf307 authored by Pierre SAGASPE's avatar Pierre SAGASPE

networkLogin : add alert view if the protocol are not selected for saving or connecting

parent 7c886c04
Pipeline #121 failed with stage
in 0 seconds
...@@ -188,6 +188,9 @@ ...@@ -188,6 +188,9 @@
- (void)saveLoginDataSource:(VLCNetworkLoginDataSourceLogin *)dataSource - (void)saveLoginDataSource:(VLCNetworkLoginDataSourceLogin *)dataSource
{ {
if (!self.protocolSelected)
return;
VLCNetworkServerLoginInformation *login = dataSource.loginInformation; VLCNetworkServerLoginInformation *login = dataSource.loginInformation;
// TODO: move somewere else? // TODO: move somewere else?
// Normalize Plex login // Normalize Plex login
...@@ -213,6 +216,9 @@ ...@@ -213,6 +216,9 @@
- (void)connectLoginDataSource:(VLCNetworkLoginDataSourceLogin *)dataSource - (void)connectLoginDataSource:(VLCNetworkLoginDataSourceLogin *)dataSource
{ {
if (!self.protocolSelected)
return;
VLCNetworkServerLoginInformation *loginInformation = dataSource.loginInformation; VLCNetworkServerLoginInformation *loginInformation = dataSource.loginInformation;
self.loginInformation = loginInformation; self.loginInformation = loginInformation;
...@@ -222,8 +228,7 @@ ...@@ -222,8 +228,7 @@
_activityBackgroundView.hidden = NO; _activityBackgroundView.hidden = NO;
[_activityIndicator startAnimating]; [_activityIndicator startAnimating];
[self performSelectorInBackground:@selector(_plexLogin) [self performSelectorInBackground:@selector(_plexLogin) withObject:nil];
withObject:nil];
} else { } else {
[self.delegate loginWithLoginViewController:self loginInfo:dataSource.loginInformation]; [self.delegate loginWithLoginViewController:self loginInfo:dataSource.loginInformation];
} }
...@@ -231,6 +236,21 @@ ...@@ -231,6 +236,21 @@
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES]; [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
} }
- (BOOL)protocolSelected
{
if (self.protocolDataSource.protocol == VLCServerProtocolUndefined) {
VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"PROTOCOL_NOT_SELECTED", nil)
message:NSLocalizedString(@"PROTOCOL_NOT_SELECTED", nil)
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alertView performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
[self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
return NO;
}
return YES;
}
#pragma mark - VLCNetworkLoginDataSourceSavedLoginsDelegate #pragma mark - VLCNetworkLoginDataSourceSavedLoginsDelegate
- (void)loginsDataSource:(VLCNetworkLoginDataSourceSavedLogins *)dataSource selectedLogin:(VLCNetworkServerLoginInformation *)login - (void)loginsDataSource:(VLCNetworkLoginDataSourceSavedLogins *)dataSource selectedLogin:(VLCNetworkServerLoginInformation *)login
{ {
......
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