Commit 80288257 authored by Felix Paul Kühne's avatar Felix Paul Kühne

fix regression introduced in 2.4.x: we displayed the library contents on...

fix regression introduced in 2.4.x: we displayed the library contents on launch while the it was still unlocked
parent 0de02cdb
......@@ -2,7 +2,7 @@
* VLCAppDelegate.h
* VLC for iOS
*****************************************************************************
* Copyright (c) 2013-2014 VideoLAN. All rights reserved.
* Copyright (c) 2013-2015 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
......@@ -13,6 +13,7 @@
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCDropboxTableViewController.h"
#import "VLCHTTPUploaderController.h"
#import "GHRevealViewController.h"
......@@ -20,7 +21,6 @@
#import "VLCDownloadViewController.h"
@class VLCPlaylistViewController;
@class PAPasscodeViewController;
@interface VLCAppDelegate : UIResponder <UIApplicationDelegate>
- (void)updateMediaList;
......@@ -48,5 +48,6 @@
@property (nonatomic, strong) VLCMenuTableViewController *menuViewController;
@property (nonatomic) VLCHTTPUploaderController *uploadController;
@property (nonatomic, readonly) BOOL passcodeValidated;
@end
......@@ -95,10 +95,8 @@
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// enable crash preventer
void (^setupBlock)() = ^ {
[[MLMediaLibrary sharedMediaLibrary] applicationWillStart];
_playlistViewController = [[VLCPlaylistViewController alloc] init];
void (^setupBlock)() = ^{
_playlistViewController = [[VLCPlaylistViewController alloc] init];
UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:_playlistViewController];
[navCon loadTheme];
......@@ -113,11 +111,13 @@
_revealController.contentViewController.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
[self.window makeKeyAndVisible];
[self validatePasscode];
[[MLMediaLibrary sharedMediaLibrary] applicationWillStart];
VLCMediaFileDiscoverer *discoverer = [VLCMediaFileDiscoverer sharedInstance];
[discoverer addObserver:self];
[discoverer startDiscovering:[self directoryPath]];
[self validatePasscode];
};
NSError *error = nil;
......@@ -466,6 +466,11 @@
#pragma mark - pass code validation
- (BOOL)passcodeValidated
{
return _passcodeValidated;
}
- (void)validatePasscode
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
......@@ -491,6 +496,8 @@
- (void)PAPasscodeViewControllerDidEnterPasscode:(PAPasscodeViewController *)controller
{
_passcodeValidated = YES;
[self.playlistViewController updateViewContents];
[self.window.rootViewController dismissViewControllerAnimated:YES completion:nil];
}
......
......@@ -454,6 +454,11 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
{
_foundMedia = [[NSMutableArray alloc] init];
if (![(VLCAppDelegate *)[UIApplication sharedApplication].delegate passcodeValidated]) {
APLog(@"library is locked, won't show contents");
return;
}
self.navigationItem.leftBarButtonItem = _menuButton;
if (_libraryMode == VLCLibraryModeAllAlbums)
self.title = NSLocalizedString(@"LIBRARY_MUSIC", nil);
......
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