import React from 'react';
import { SafeAreaView, Text, Image, Alert, Linking,LogBox } from 'react-native';
import { images } from '../../assets/images/imageIndex';
import { inject, observer } from "mobx-react"
import { observable, makeObservable } from 'mobx'
import AsyncStorage from '@react-native-community/async-storage';
const SplashScreen = inject("appStore")(observer(class SplashScreen extends React.Component {

  constructor(props) {
    super(props);
    this.store = props.appStore;
    LogBox.ignoreAllLogs();
  }
  async componentDidMount() {
    this.init()
    await this.performTimeConsumingTask();
  }

  performTimeConsumingTask = async () => {
    return new Promise(resolve =>
      setTimeout(() => {
        resolve('result');
        this.store.splash = true;
      }, 500),
    );
  };

  init() {
    this.store.getProductsDetails()
  }

  // async requestUserPermission() {
  //   const authStatus = await messaging().requestPermission();
  //   const enabled =
  //     authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
  //     authStatus === messaging.AuthorizationStatus.PROVISIONAL;

  //   if (enabled) {
  //     console.log('Authorization status:', authStatus);
  //   }
  // }

  render() {
    return (
      <SafeAreaView
        style={{
          flex: 1,
          justifyContent: 'center',
          alignItems: 'center',
          backgroundColor: 'white',
        }}>

        <Image source={images.splash.logo} />

      </SafeAreaView>
    );
  }
}))
export default SplashScreen
