Commit a18987ed authored by Soomin Lee's avatar Soomin Lee

Remove deprecated medialibrary code

VLCMigrationViewController: Remove completionHandler

AppDelegate: Remove migration related code
parent b9bef051
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#import "NSString+SupportedMedia.h" #import "NSString+SupportedMedia.h"
#import "UIDevice+VLC.h" #import "UIDevice+VLC.h"
#import "VLCHTTPUploaderController.h" #import "VLCHTTPUploaderController.h"
#import "VLCMigrationViewController.h"
#import "VLCPlaybackController.h" #import "VLCPlaybackController.h"
#import "VLCPlaybackController+MediaLibrary.h" #import "VLCPlaybackController+MediaLibrary.h"
#import <MediaPlayer/MediaPlayer.h> #import <MediaPlayer/MediaPlayer.h>
...@@ -37,7 +36,6 @@ ...@@ -37,7 +36,6 @@
@interface VLCAppDelegate () @interface VLCAppDelegate ()
{ {
BOOL _isRunningMigration;
BOOL _isComingFromHandoff; BOOL _isComingFromHandoff;
VLCKeychainCoordinator *_keychainCoordinator; VLCKeychainCoordinator *_keychainCoordinator;
AppCoordinator *appCoordinator; AppCoordinator *appCoordinator;
...@@ -113,33 +111,7 @@ ...@@ -113,33 +111,7 @@
[[MLMediaLibrary sharedMediaLibrary] setSpotlightIndexingEnabled:spotlightEnabled]; [[MLMediaLibrary sharedMediaLibrary] setSpotlightIndexingEnabled:spotlightEnabled];
[[MLMediaLibrary sharedMediaLibrary] applicationWillStart]; [[MLMediaLibrary sharedMediaLibrary] applicationWillStart];
}; };
setupBlock();
NSError *error = nil;
if ([[MLMediaLibrary sharedMediaLibrary] libraryMigrationNeeded]){
_isRunningMigration = YES;
VLCMigrationViewController *migrationController = [[VLCMigrationViewController alloc] initWithNibName:@"VLCMigrationViewController" bundle:nil];
migrationController.completionHandler = ^{
//migrate
setupBlock();
self->_isRunningMigration = NO;
[[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
[[VLCMediaFileDiscoverer sharedInstance] updateMediaList];
};
self.window.rootViewController = migrationController;
[self.window makeKeyAndVisible];
} else {
if (error != nil) {
APLog(@"removed persistentStore since it was corrupt");
NSURL *storeURL = ((MLMediaLibrary *)[MLMediaLibrary sharedMediaLibrary]).persistentStoreURL;
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:&error];
}
setupBlock();
}
/* add our static shortcut items the dynamic way to ease l10n and dynamic elements to be introduced later */ /* add our static shortcut items the dynamic way to ease l10n and dynamic elements to be introduced later */
if (@available(iOS 9, *)) { if (@available(iOS 9, *)) {
...@@ -263,7 +235,7 @@ didFailToContinueUserActivityWithType:(NSString *)userActivityType ...@@ -263,7 +235,7 @@ didFailToContinueUserActivityWithType:(NSString *)userActivityType
- (void)applicationDidBecomeActive:(UIApplication *)application - (void)applicationDidBecomeActive:(UIApplication *)application
{ {
if (!_isRunningMigration && !_isComingFromHandoff) { if (!_isComingFromHandoff) {
[[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase]; [[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
// [[VLCMediaFileDiscoverer sharedInstance] updateMediaList]; // [[VLCMediaFileDiscoverer sharedInstance] updateMediaList];
[[VLCPlaybackController sharedInstance] recoverDisplayedMetadata]; [[VLCPlaybackController sharedInstance] recoverDisplayedMetadata];
......
...@@ -16,5 +16,4 @@ ...@@ -16,5 +16,4 @@
@property(nonatomic) IBOutlet UILabel *statusLabel; @property(nonatomic) IBOutlet UILabel *statusLabel;
@property(nonatomic) IBOutlet UIActivityIndicatorView *spinner; @property(nonatomic) IBOutlet UIActivityIndicatorView *spinner;
@property(nonatomic, copy) void (^completionHandler)(void);
@end @end
...@@ -18,15 +18,9 @@ ...@@ -18,15 +18,9 @@
return self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; return self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
} }
- (void)viewDidLoad { - (void)viewDidLoad
{
[super viewDidLoad]; [super viewDidLoad];
[self.statusLabel setText:NSLocalizedString(@"UPGRADING_LIBRARY", "")]; [self.statusLabel setText:NSLocalizedString(@"UPGRADING_LIBRARY", "")];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
APLog(@"migrating coredata");
[[MLMediaLibrary sharedMediaLibrary] migrateLibrary];
dispatch_async(dispatch_get_main_queue(), ^{
self.completionHandler();
});
});
} }
@end @end
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