diff --git a/Mini vMac/AppDelegate.h b/Mini vMac/AppDelegate.h index b409dd9..03a4945 100644 --- a/Mini vMac/AppDelegate.h +++ b/Mini vMac/AppDelegate.h @@ -9,6 +9,8 @@ #import #import "EmulatorProtocol.h" +extern NSString *DocumentsChangedNotification; + @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; diff --git a/Mini vMac/AppDelegate.m b/Mini vMac/AppDelegate.m index 205c27f..0f31144 100644 --- a/Mini vMac/AppDelegate.m +++ b/Mini vMac/AppDelegate.m @@ -13,6 +13,7 @@ static AppDelegate *sharedAppDelegate = nil; static NSObject *sharedEmulator = nil; +NSString *DocumentsChangedNotification = @"documentsChanged"; @interface AppDelegate () @@ -286,6 +287,8 @@ static NSObject *sharedEmulator = nil; if (error) { [self showAlertWithTitle:fileName message:error.localizedFailureReason]; } else { + NSDictionary *userInfo = @{@"path": destinationPath}; + [[NSNotificationCenter defaultCenter] postNotificationName:DocumentsChangedNotification object:self userInfo:userInfo]; [self showAlertWithTitle:@"File Import" message:[NSString stringWithFormat:@"%@ imported to Documents", destinationPath.lastPathComponent]]; } } diff --git a/Mini vMac/InsertDiskViewController.m b/Mini vMac/InsertDiskViewController.m index d609d3b..61e33d7 100644 --- a/Mini vMac/InsertDiskViewController.m +++ b/Mini vMac/InsertDiskViewController.m @@ -64,6 +64,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(reloadData:) name:[AppDelegate sharedEmulator].insertDiskNotification object:nil]; [nc addObserver:self selector:@selector(reloadData:) name:[AppDelegate sharedEmulator].ejectDiskNotification object:nil]; + [nc addObserver:self selector:@selector(reloadData:) name:DocumentsChangedNotification object:nil]; } - (void)viewDidDisappear:(BOOL)animated { @@ -71,6 +72,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:[AppDelegate sharedEmulator].insertDiskNotification object:nil]; [nc removeObserver:self name:[AppDelegate sharedEmulator].ejectDiskNotification object:nil]; + [nc removeObserver:self name:DocumentsChangedNotification object:nil]; } - (void)loadDirectoryContents {