Commit 377866d4 authored by hywang's avatar hywang

1.增加登录日期判断,2020年以前的禁止登录

parent 98c33772
......@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect"
minSdkVersion 21
targetSdkVersion 29
versionCode 6
versionName "1.0.5"
versionCode 7
versionName "2.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
......
......@@ -50,15 +50,15 @@ public class RetrofitClient {
private static final int CACHE_TIMEOUT = 10 * 1024 * 1024;
//服务端根路径
public static String baseUrl =
// "serve.xlglmnmyzspt.org.cn"//正式
"serve.xlglmnmyzspt.org.cn"//正式
// "39.101.170.186"//阿里云测试
"192.168.8.135"//董
// "192.168.8.135"//董
// "192.168.43.154"//张敏
;
public static String port =
// ""//正式
""//正式
// "9000"//阿里云测试
"9000"//董
// "9000"//董
;
private static Context mContext = Utils.getContext();
......
......@@ -99,6 +99,22 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding, LoginVM> {
}
}
});
viewModel.dateEvent.observe(this, new Observer<Integer>() {
@Override
public void onChanged(Integer integer) {
new MaterialDialog.Builder(LoginActivity.this).canceledOnTouchOutside(false).title("系统提示").content("日期错误,请联网自动获取日期").positiveText("退出").onAny(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (which == DialogAction.POSITIVE) {
ModuleManager.destroyLibSO();
finish();
android.os.Process.killProcess(android.os.Process.myPid());
}
}
}).show();
}
});
}
@Override
......
......@@ -25,6 +25,7 @@ import com.phlx.anchorcollect.params.BaseResponse;
import com.phlx.anchorcollect.params.CollectResponse;
import com.phlx.anchorcollect.ui.main.MainActivity;
import com.phlx.anchorcollect.ui.splash.SplashActivity;
import com.phlx.anchorcollect.util.DateUtils;
import com.phlx.anchorcollect.util.StringUtil;
import com.phlx.anchorcollect.util.TextUtil;
......@@ -63,6 +64,9 @@ public class LoginVM extends BaseViewModel<Repository> {
//更新app
public SingleLiveEvent<Integer> appUpdateEvent = new SingleLiveEvent<>();
//手机时间问题,退出软件
public SingleLiveEvent<Integer> dateEvent = new SingleLiveEvent<>();
public int loginType;//登录后是否跳转, 0跳转main 1不跳转
......@@ -109,6 +113,10 @@ public class LoginVM extends BaseViewModel<Repository> {
public BindingCommand loginOnClickCommand = new BindingCommand(new BindingAction() {
@Override
public void call() {
if(Integer.parseInt(DateUtils.getYear())<2020){
dateEvent.call();
return;
}
if (Configs.isOnLine) {
login();
} else {
......
package com.phlx.anchorcollect.util;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtils {
public static String getYear(){
public static String getYear() {
String year = "";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
year = simpleDateFormat.format(new Date());
return year;
}
String year = "";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
year = simpleDateFormat.format(new Date());
return year;
}
public static long getYearLong() {
Calendar c1 = Calendar.getInstance();
c1.set(Integer.parseInt(getYear()), 0, 1, 0, 0, 0);
return c1.getTimeInMillis();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment