Commit 175d3f0f authored by Felix Paul Kühne's avatar Felix Paul Kühne

share stored LAN servers across devices

parent 028e27e1
......@@ -97,11 +97,13 @@
[self protocolSelectionChanged:nil];
}
// persistent state
NSUbiquitousKeyValueStore *ukvStore = [NSUbiquitousKeyValueStore defaultStore];
[ukvStore synchronize];
_serverList = [NSMutableArray arrayWithArray:[ukvStore arrayForKey:kVLCStoredServerList]];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
_serverList = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCStoredServerList]];
if (_serverList.count == 0) {
if (![defaults boolForKey:kVLCMigratedToUbiquitousStoredServerList]) {
/* we need to migrate from previous, insecure storage fields */
NSArray *ftpServerList = [defaults objectForKey:kVLCFTPServer];
NSArray *ftpLoginList = [defaults objectForKey:kVLCFTPLogin];
......@@ -123,7 +125,9 @@
[_serverList addObject:[NSString stringWithFormat:@"plex://%@:%@", plexServerList[i], plexPortList[i]]];
}
}
[defaults setObject:_serverList forKey:kVLCStoredServerList];
[ukvStore setArray:_serverList forKey:kVLCStoredServerList];
[ukvStore synchronize];
[defaults setBool:YES forKey:kVLCMigratedToUbiquitousStoredServerList];
[defaults synchronize];
}
......
......@@ -85,6 +85,7 @@
#define WifiInterfaceName @"en0"
#endif
#define kVLCMigratedToUbiquitousStoredServerList @"kVLCMigratedToUbiquitousStoredServerList"
#define kVLCStoredServerList @"kVLCStoredServerList"
#define kVLCStoreDropboxCredentials @"kVLCStoreDropboxCredentials"
#define kVLCStoreOneDriveCredentials @"kVLCStoreOneDriveCredentials"
......
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