This commit is contained in:
haomingming
2026-11-03 10:44:43 +08:00
parent ff1f7e9f8b
commit 4ae19c6045
5 changed files with 43 additions and 6 deletions
@@ -187,12 +187,20 @@ public class UIUtils {
* @param context 上下文
* @return true 已登录;false 未登录(已跳转登录页)
*/
private static long lastJumpLoginTime = 0L;
public static boolean checkLoginAndJump(Context context) {
if (isLogined()) {
return true;
}
long now = System.currentTimeMillis();
if (now - lastJumpLoginTime < 800) {
return false;
}
lastJumpLoginTime = now;
Context targetContext = context != null ? context : getContext();
Intent intent = new Intent(targetContext, LoginNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (!(targetContext instanceof Activity)) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}