package com.android.chmo.ui.activity;

import android.widget.ImageView;

import com.android.chmo.R;
import com.android.chmo.app.ChmoApplication;
import com.android.chmo.app.SpManager;
import com.android.chmo.base.BaseActivity;
import com.android.chmo.im.IMManager;
import com.android.chmo.model.LoginUser;

import butterknife.BindView;

/**
 * Created by Administrator on 2018/7/31.
 */

public class WelcomeActivity extends BaseActivity {
    @BindView(R.id.image)
    ImageView imageView;

    @Override
    protected int getContentResId() {
        return R.layout.activity_welcome;
    }

    @Override
    public void initView() {
        imageView.postDelayed(new Runnable() {
            @Override
            public void run() {
                ChmoApplication.isInit = true;
                if(SpManager.getInstance().getBoolean("appStarted")) {
                    LoginUser user = ChmoApplication.getApp().getLoginUser();
                    if(null != user) {
                        IMManager.login();
                        openPage(MainActivity.class);
                    } else {
                        openPage(LoginActivity.class);
                    }
                } else {
                    openPage(GuideActivity.class);
                }

                finish();
            }
        },ChmoApplication.isInit ? 100 : 1000);

    }


}
