import App from './index.vue';

Service.componentsOptions['BILIPAGE'] = App;

const systemInfo = bl.getSystemInfoSync();
const config = APP_JSON;
const pages = config.pages.filter(x=> x.path === 'BILIPAGE');
const globalConfig = config.window;
const tabBar = config.tabBar;

if (pages.length > 0) {
	App.enablePullDownRefresh = typeof pages[0].enablePullDownRefresh !== 'undefined' ? pages[0].enablePullDownRefresh : (globalConfig && globalConfig.enablePullDownRefresh || false);
	
	// 兼容安卓5.46及以下app.json读取逻辑的错误
	if (systemInfo.platform === 'android' && systemInfo.SDKVersion < '2.4.0') {
		App.hasNavigationBar = pages[0].hasNavigationBar || (globalConfig && globalConfig.hasNavigationBar || false);
	} else {
		App.hasNavigationBar = typeof pages[0].hasNavigationBar !== 'undefined' ? pages[0].hasNavigationBar : (globalConfig && globalConfig.hasNavigationBar || false);
	}
	
	if (tabBar) {
		let _tabItem = tabBar.list.filter(x=> x.pagePath === 'BILIPAGE');
		if (_tabItem.length > 0) {
			App.hasNavigationBar = true;
		}
	}
}
