package com.ysnows.update.component;

import com.billy.cc.core.component.CC;
import com.billy.cc.core.component.CCResult;
import com.billy.cc.core.component.IComponent;
import com.tencent.bugly.beta.Beta;
import com.ysnows.base.ccextension.BIComponent;
import com.ysnows.update.util.InitUpgrade;

/**
 * 初始化
 * CCRetrofit.getInstance()
 * .create(IUpdate.class)
 * .init();
 * <p>
 * 静默提示
 * CCRetrofit.getInstance()
 * .create(IUpdate.class)
 * .checkUpgrade(false);
 * 有提示
 * CCRetrofit.getInstance()
 * .create(IUpdate.class)
 * .checkUpgrade(true);
 */
public class CpUpdate extends BIComponent implements IComponent {

    public boolean init(CC cc) {
        InitUpgrade.initBugly(cc.getContext().getApplicationContext());
        CC.sendCCResult(cc.getCallId(), CCResult.success());
        return false;
    }

    public boolean checkUpgrade(CC cc, boolean isManual) {
        Beta.checkUpgrade(isManual, false);//立即启动升级提示
        CC.sendCCResult(cc.getCallId(), CCResult.success());
        return false;
    }
}





