//
//  SuiteWVUIWebViewController.m
//  SuiteApp
//
//  Created by junmo on 2018/12/18.
//  Copyright © 2018年 微博@iOS程序犭袁. All rights reserved.
//


#import "SuiteWVUIWebViewController.h"
#import "StaticJSBridgeManager.h"

@implementation SuiteWVUIWebViewController
#if __has_include(<WindVane/WindVane.h>)

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        self.title = @"Suite";
        self.autoLoadTitle = YES;
        // 允许操作导航栏
        self.allowsControlNavigationBar = YES;
        self.useToolbar = YES;
        self.useWKWebView = WVUseWKWebViewCustom;
        
        self.loadUrl = [[self localFileURL] absoluteString];
        
        /*
         WVTristateNO = 0,     // 表示 否。
         WVTristateYES = 1,    // 表示 是。
         WVTristateNotSure = 2 // 表示 不确定。
         */
        // 隐藏或显示导航栏，隐藏导航栏时总是同时隐藏状态栏
        //[self setNavigationBarHidden:WVTristateYES];
        
    }
    return self;
}

// 重写
- (BOOL)decideIsUseWKWebView {
    NSLog(@"decide is use WKWebView");
    return YES;
}

- (NSURL *)localFileURL {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
    NSURL *localURL = [NSURL fileURLWithPath:path];
    return localURL;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [StaticJSBridgeManager registerJSBridgeToWVWebViewController:self];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}
#else
#endif
@end

