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 @@
@protocol VLCNetworkLoginViewController <NSObject>
@required
- (void)loginToServer:(NSString *)server confirmedWithUsername:(NSString *)username andPassword:(NSString *)password;
- (void)loginToURL:(NSURL *)url confirmedWithUsername:(NSString *)username andPassword:(NSString *)password;
@end
@interface VLCNetworkLoginViewController : UIViewController
......@@ -29,6 +29,7 @@
@property (nonatomic, retain) id delegate;
- (IBAction)dismiss:(id)sender;
- (IBAction)dismissWithAnimation:(id)sender;
- (IBAction)connectToServer:(id)sender;
@end
......@@ -24,13 +24,13 @@
self.modalPresentationStyle = UIModalPresentationFormSheet;
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.navigationItem.leftBarButtonItem = dismissButton;
}
}
- (IBAction)dismiss:(id)sender
- (IBAction)dismissWithAnimation:(id)sender
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
[self.navigationController popViewControllerAnimated:YES];
......@@ -38,14 +38,26 @@
[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
{
[self dismiss:nil];
if (self.delegate) {
if ([self.delegate respondsToSelector:@selector(loginToServer:confirmedWithUsername:andPassword:)])
[self.delegate loginToServer:self.serverAddressField.text confirmedWithUsername:self.usernameField.text andPassword:self.passwordField.text];
if ([self.delegate respondsToSelector:@selector(loginToURL:confirmedWithUsername:andPassword:)]) {
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
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