reload disk list after importing document
This commit is contained in:
parent
f511efdb0b
commit
222a6d8d8f
|
@ -9,6 +9,8 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import "EmulatorProtocol.h"
|
||||
|
||||
extern NSString *DocumentsChangedNotification;
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow *window;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
static AppDelegate *sharedAppDelegate = nil;
|
||||
static NSObject<Emulator> *sharedEmulator = nil;
|
||||
NSString *DocumentsChangedNotification = @"documentsChanged";
|
||||
|
||||
@interface AppDelegate () <UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning>
|
||||
|
||||
|
@ -286,6 +287,8 @@ static NSObject<Emulator> *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]];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue