Closed NattyNarwhal closed 2 years ago
Prototype, but it opens server views too early, causing them not to be properly authenticated:
diff --git a/Submariner/SBDatabaseController.m b/Submariner/SBDatabaseController.m
index a1447c9..ca0897a 100644
--- a/Submariner/SBDatabaseController.m
+++ b/Submariner/SBDatabaseController.m
@@ -247,7 +247,14 @@ - (void)windowDidLoad {
forKey:@"subviews"];
[contentView setAnimations:ani];
- [self setCurrentViewController: musicController];
+ NSString *lastViewedURLString = [[NSUserDefaults standardUserDefaults] objectForKey: @"LastViewedResource"];
+ if (lastViewedURLString != nil) {
+ NSURL *lastViewedURL = [NSURL URLWithString: lastViewedURLString];
+ SBResource *lastViewed = (SBResource *)[self.managedObjectContext objectWithID:[self.managedObjectContext.persistentStoreCoordinator managedObjectIDForURIRepresentation: lastViewedURL]];
+ [self displayViewControllerForResource: lastViewed];
+ } else {
+ [self setCurrentViewController: musicController];
+ }
// player timer
@@ -963,6 +970,9 @@ - (void)populatedDefaultSections {
//}
- (void)displayViewControllerForResource:(SBResource *)resource {
+ // NSURLs dont go to plists
+ NSString *urlString = resource.objectID.URIRepresentation.absoluteString;
+ [[NSUserDefaults standardUserDefaults] setObject: urlString forKey: @"LastViewedResource"];
// swith view relative to a selected resource
if([resource isKindOfClass:[SBLibrary class]]) {
Right now, we default to the library, and that's not always too useful.