Commit 7a3c61b5 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

Network Login Panel: allow control object to wipe an instance without animation

parent f4672bda
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
@protocol VLCNetworkLoginViewController <NSObject> @protocol VLCNetworkLoginViewController <NSObject>
@required @required
- (void)loginToServer:(NSString *)server confirmedWithUsername:(NSString *)username andPassword:(NSString *)password; - (void)loginToURL:(NSURL *)url confirmedWithUsername:(NSString *)username andPassword:(NSString *)password;
@end @end
@interface VLCNetworkLoginViewController : UIViewController @interface VLCNetworkLoginViewController : UIViewController
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
@property (nonatomic, retain) id delegate; @property (nonatomic, retain) id delegate;
- (IBAction)dismiss:(id)sender; - (IBAction)dismiss:(id)sender;
- (IBAction)dismissWithAnimation:(id)sender;
- (IBAction)connectToServer:(id)sender; - (IBAction)connectToServer:(id)sender;
@end @end
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
self.modalPresentationStyle = UIModalPresentationFormSheet; self.modalPresentationStyle = UIModalPresentationFormSheet;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
UIBarButtonItem *dismissButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(dismiss:)]; UIBarButtonItem *dismissButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(dismissWithAnimation:)];
self.title = @"Connect to Server"; self.title = @"Connect to Server";
self.navigationItem.leftBarButtonItem = dismissButton; self.navigationItem.leftBarButtonItem = dismissButton;
} }
} }
- (IBAction)dismiss:(id)sender - (IBAction)dismissWithAnimation:(id)sender
{ {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
...@@ -38,14 +38,26 @@ ...@@ -38,14 +38,26 @@
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
- (IBAction)dismiss:(id)sender
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
[self.navigationController popViewControllerAnimated:NO];
else
[self dismissViewControllerAnimated:NO completion:nil];
}
- (IBAction)connectToServer:(id)sender - (IBAction)connectToServer:(id)sender
{ {
[self dismiss:nil];
if (self.delegate) { if (self.delegate) {
if ([self.delegate respondsToSelector:@selector(loginToServer:confirmedWithUsername:andPassword:)]) if ([self.delegate respondsToSelector:@selector(loginToURL:confirmedWithUsername:andPassword:)]) {
[self.delegate loginToServer:self.serverAddressField.text confirmedWithUsername:self.usernameField.text andPassword:self.passwordField.text]; NSString *string = self.serverAddressField.text;
if (![string hasPrefix:@"ftp://"])
string = [NSString stringWithFormat:@"ftp://%@", string];
[self.delegate loginToURL:[NSURL URLWithString:string] confirmedWithUsername:self.usernameField.text andPassword:self.passwordField.text];
}
} }
[self dismiss:nil];
} }
@end @end
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