package com.mayi.demo;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import com.mayi.fastdevelop.bean.AppConfig;
import com.mayi.fastdevelop.commonpage.UpdateDownLoadAPKActvity;

public class DownLoadAPKActivity extends UpdateDownLoadAPKActvity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.avtivity_download_apk);
        findViewById(R.id.b1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UpdateDownLoadAPK();
            }
        });
        findViewById(R.id.b2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                forceUpdateDownLoadAPK();
            }
        });
    }


    private void forceUpdateDownLoadAPK() {
        AppConfig appConfig = new AppConfig();
        appConfig.setServerVersion(3);
        appConfig.setFileSize("40");
        appConfig.setForceUpdate(true);
        appConfig.setNeedUpdate(true);
        appConfig.setUpdateRemark("强制更新\n强制更新");
        appConfig.setUpdateUrl("https://kuka-life.oss-cn-hangzhou.aliyuncs.com/usermanager/app/android/userManager.apk");
        downLoadAPK(appConfig);
    }

    private void UpdateDownLoadAPK() {
        AppConfig appConfig = new AppConfig();
        appConfig.setNeedUpdate(true);
        appConfig.setServerVersion(3);
        appConfig.setFileSize("40");
        appConfig.setUpdateRemark("提示更新\n提示更新");
        appConfig.setUpdateUrl("https://kuka-life.oss-cn-hangzhou.aliyuncs.com/usermanager/app/android/userManager.apk");
        downLoadAPK(appConfig);
    }

}
