package com.phlx.wool;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

/**
 * <pre>
 *     author : lei
 *     e-mail : 18600395998@163.com
 *     time   : 2020/04/27
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class Configs {


    /**
     * 下载apk地址
     */
    public static String downloadApk = "/app/download?type=2";

    /**
     * 是否在线操作
     */
    public static boolean isOnLine = false;
    /**
     * 是否后缀端口
     */
    public static boolean isAddPort = true;

    //ip port
    public static final String SP_APP_IP = "sp_app_ip";
    public static final String SP_APP_PORT = "sp_app_port";
    //用户信息
    public static final String SP_USER_NAME = "sp_user_name";
    public static final String SP_NAME = "sp_name";
    public static final String SP_USER_PASSWORD = "sp_user_password";
    public static final String SP_USER_EMAIL = "sp_user_email";
    public static final String SP_FREQUENCY_CONFIG = "sp_frequency_config";
    public static final String SP_USER_PHONE = "sp_user_phone";
    public static final String SP_USER_UNIT = "sp_user_unit";
    //选择养殖场
    public static final String SP_UNIT_NAME = "sp_unit_unit";
    public static final String SP_UNIT_CODE = "sp_unit_code";
    public static final String SP_UNIT_PHONE = "sp_unit_phone";
    public static final String SP_UNIT_ID_CARD = "sp_unit_id_card";
    //type inventory页面显示类型
    public static final String WORK_TYPE_M = "work_type_mark";
    public static final String WORK_TYPE_Q = "work_type_quarantine";
    public static final String WORK_TYPE_H = "work_type_harmless";

    //0 高频，1低频
    public static String FREQUENCY_CONFIG = "0";


    public static String packageName(Context context) {
        PackageManager manager = context.getPackageManager();
        String name = null;
        try {
            PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
            name = info.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        return name;
    }
}
