package com.uas.module.common.utils.Helper;


import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;

import com.uas.module.common.app.AppConfig;

/**
 * Created by Arison on 2019/5/15.
 */

public class LoginHelper {

    public static final String ACTION_LOGIN = AppConfig.sPackageName + ".action.login";// 登陆
    public static final String ACTION_LOGOUT = AppConfig.sPackageName + ".action.logout";// 用户手动注销登出
    public static final String ACTION_CONFLICT = AppConfig.sPackageName + ".action.conflict";// 登陆冲突（另外一个设备登陆了）
    public static final String ACTION_TOKEN = AppConfig.sPackageName + ".action.token";// token异常



    // 登出广播
    public static void broadcastLogout(Context context) {
        Intent intent = new Intent(ACTION_LOGOUT);
        context.sendBroadcast(intent);
    }



    // 获取登陆和登出的action filter
    public static IntentFilter getLogInOutActionFilter() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(ACTION_LOGIN);
        intentFilter.addAction(ACTION_LOGOUT);
        intentFilter.addAction(ACTION_CONFLICT);
        return intentFilter;
    }
}
