Commit 572b3072 authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne
Browse files

networkLogin : Plex ability to save and use a account without specify an url


Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 22abf27c
......@@ -241,6 +241,15 @@
else
service = [NSString stringWithFormat:@"%@://%@",
scheme, server];
if ([scheme isEqualToString:@"plex"]) {
if ([server isEqualToString:@""])
service = [service stringByAppendingString:@"Account"];
else
if ([port isEqualToString:@""])
service = [service stringByAppendingString:@":32400"];
}
[_serverList addObject:service];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:_serverList forKey:kVLCStoredServerList];
......@@ -385,7 +394,10 @@ forRowAtIndexPath:(NSIndexPath *)indexPath
self.protocolSegmentedControl.selectedSegmentIndex = self.serverProtocol;
[self protocolSelectionChanged:nil];
self.serverField.text = service.host;
if ([service.host isEqualToString:@"Account"])
self.serverField.text = @"";
else
self.serverField.text = service.host;
self.portField.text = [service.port stringValue];
NSArray *accounts = [SSKeychain accountsForService:serviceString];
......
......@@ -55,6 +55,10 @@
if([responseString rangeOfString:@"Unauthorized"].location != NSNotFound) {
NSString *serviceString = [NSString stringWithFormat:@"plex://%@%@", address, port];
NSArray *accounts = [SSKeychain accountsForService:serviceString];
if (!accounts) {
serviceString = @"plex://Account";
accounts = [SSKeychain accountsForService:serviceString];
}
if (accounts) {
NSDictionary *account = [accounts firstObject];
NSString *username = [account objectForKey:@"acct"];
......
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