Pārlūkot izejas kodu

remove expiredtime in local for game

hanjing 6 gadi atpakaļ
vecāks
revīzija
3dc59ed8d8

+ 14 - 15
app/src/main/java/com/sheep/gamegroup/view/activity/GameCertificationActivity.java

@@ -217,22 +217,21 @@ public class GameCertificationActivity extends BaseActivity {
 
     private void commitChange() {
         if (userEntity == null) return;
-        long expiredTime = (Long.parseLong(userEntity.getLast_login_time()) + (15 * 24 * 60 * 60)) * 1000;
-        if (expiredTime < System.currentTimeMillis()) {
-            Toast.makeText(this, "Token已过期,需要重新登录", Toast.LENGTH_SHORT).show();
-            Jump2View.getInstance().goLoginViewWithoutFinish(activity, SheepApp.getInstance().getGameCode());
-            return;
-        }
-        loading_view_img.setVisibility(View.VISIBLE);
-        change_commit.setText(R.string.change_login_ing);
-        change_commit.setEnabled(false);
-        new Handler().postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                if (!isChangeAccount)
-                    CertificationUtil.newInstance().authCertificationCode(activity, currentToken);
+        CommonUtil.getInstance().checkAuth(currentToken, (ret) -> {
+            if (ret) {
+                loading_view_img.setVisibility(View.VISIBLE);
+                change_commit.setText(R.string.change_login_ing);
+                change_commit.setEnabled(false);
+                new Handler().postDelayed(() -> {
+                    if (!isChangeAccount) {
+                        CertificationUtil.newInstance().authCertificationCode(activity, currentToken);
+                    }
+                }, 2000);
+            } else {
+                Toast.makeText(this, "授权有效期已过,需要重新登录", Toast.LENGTH_SHORT).show();
+                Jump2View.getInstance().goLoginViewWithoutFinish(activity, SheepApp.getInstance().getGameCode());
             }
-        }, 3000);
+        });
     }
 
     /**