//
//  BaseViewController.m
//  XenonSDK
//
//  Created by SAGESSE on 2019/5/29.
//  Copyright © 2019 SAGESSE. All rights reserved.
//

#import "XenonSDK.h"
#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    return [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil ?: XenonSDK.sharedSDK.bundle];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    if (!self.prefersUnifiedBackground) {
        return;
    }
    
    self.view.backgroundColor = UIColor.clearColor;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    if (!self.prefersAutomaticBackView) {
        return;
    }
    
    if (self.navigationController.viewControllers.count == 1) {
        self.backView.hidden = YES;
    }
}


- (BOOL)prefersUnifiedBackground {
    return YES;
}
- (BOOL)prefersAutomaticBackView {
    return YES;
}




/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end