update:2020.02.02
fix:修复在没有网络情况下 暂无信息 显示的bug add:增加了灰度测试的接口和推送
This commit is contained in:
@@ -89,9 +89,9 @@ android {
|
||||
}
|
||||
newl {
|
||||
flavorDimensions "default"
|
||||
// versionCode 163
|
||||
versionCode 1031
|
||||
versionName "1.2.3"
|
||||
versionCode 164
|
||||
// versionCode 1031
|
||||
versionName "1.2.4"
|
||||
/*********************************极光推送************************************/
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME: "com.jiaoguanyi.appstore",
|
||||
|
||||
@@ -338,17 +338,34 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
}
|
||||
tv_version = findViewById(R.id.version);
|
||||
tv_version.setText(BuildConfig.VERSION_NAME);
|
||||
|
||||
layout_class = findViewById(R.id.layout_class);
|
||||
layout_number = findViewById(R.id.layout_number);
|
||||
layout_name = findViewById(R.id.layout_name);
|
||||
|
||||
tv_batch = findViewById(R.id.tv_batch);
|
||||
String batch = (String) SPUtils.get(this, "batch", "暂无信息");
|
||||
if (TextUtils.isEmpty(batch)||batch.equalsIgnoreCase("暂无信息")){
|
||||
tv_batch.setVisibility(View.GONE);
|
||||
}
|
||||
tv_batch.setText(batch);
|
||||
tv_class = findViewById(R.id.tv_class);
|
||||
String classes = (String) SPUtils.get(this, "classes", "暂无信息");
|
||||
if (TextUtils.isEmpty(classes)||classes.equalsIgnoreCase("暂无信息")){
|
||||
layout_class.setVisibility(View.GONE);
|
||||
}
|
||||
tv_class.setText(classes);
|
||||
tv_number = findViewById(R.id.tv_number);
|
||||
String sno = (String) SPUtils.get(this, "sno", "暂无信息");
|
||||
if (TextUtils.isEmpty(sno)||sno.equalsIgnoreCase("暂无信息")){
|
||||
layout_number.setVisibility(View.GONE);
|
||||
}
|
||||
tv_number.setText(sno);
|
||||
tv_name = findViewById(R.id.tv_name);
|
||||
String realname = (String) SPUtils.get(this, "realname", "暂无信息");
|
||||
if (TextUtils.isEmpty(realname)||realname.equalsIgnoreCase("暂无信息")){
|
||||
layout_name.setVisibility(View.GONE);
|
||||
}
|
||||
tv_name.setText(realname);
|
||||
back = findViewById(R.id.back);
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -358,9 +375,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
}
|
||||
});
|
||||
iv_locked = findViewById(R.id.locked);
|
||||
layout_class = findViewById(R.id.layout_class);
|
||||
layout_number = findViewById(R.id.layout_number);
|
||||
layout_name = findViewById(R.id.layout_name);
|
||||
|
||||
|
||||
bt_checkupdate = findViewById(R.id.chkupd);
|
||||
bt_checkupdate.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -621,6 +636,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
private void checkUpdate() {
|
||||
HTTPInterface.checkUpdate(mHandler, "com.jiaoguanyi.store");
|
||||
// HTTPInterface.checkUpdate(mHandler, "com.jiaoguanyi.appstore");
|
||||
HTTPInterface.checkTestUpdate(MainActivity.this);
|
||||
}
|
||||
|
||||
private Handler mHandler = new Handler() {
|
||||
@@ -643,7 +659,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
StudentsInfo info = com.alibaba.fastjson.JSONObject.parseObject(String.valueOf(msg.obj), StudentsInfo.class);
|
||||
SPUtils.put(MainActivity.this, "admin_id", info.getAdmin_id());
|
||||
if (null != info) {
|
||||
if (info.getBatch().equals("")) {
|
||||
if (TextUtils.isEmpty(info.getBatch())) {
|
||||
tv_batch.setVisibility(View.GONE);
|
||||
tv_batch.setText("暂无信息");
|
||||
} else {
|
||||
@@ -651,7 +667,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
tv_batch.setText(info.getBatch());
|
||||
SPUtils.put(MainActivity.this, "batch", info.getBatch());
|
||||
}
|
||||
if (info.getClasses().equals("")) {
|
||||
if (TextUtils.isEmpty(info.getClasses())) {
|
||||
layout_class.setVisibility(View.GONE);
|
||||
tv_class.setText("暂无信息");
|
||||
} else {
|
||||
@@ -659,7 +675,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
tv_class.setText(info.getClasses());
|
||||
SPUtils.put(MainActivity.this, "classes", info.getClasses());
|
||||
}
|
||||
if (info.getSno().equals("")) {
|
||||
if (TextUtils.isEmpty(info.getSno())) {
|
||||
layout_number.setVisibility(View.GONE);
|
||||
tv_number.setText("暂无信息");
|
||||
} else {
|
||||
@@ -667,7 +683,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
tv_number.setText(info.getSno());
|
||||
SPUtils.put(MainActivity.this, "sno", info.getSno());
|
||||
}
|
||||
if (info.getRealname().equals("")) {
|
||||
if (TextUtils.isEmpty(info.getRealname())) {
|
||||
layout_name.setVisibility(View.GONE);
|
||||
tv_name.setText("暂无信息");
|
||||
} else {
|
||||
@@ -684,30 +700,29 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
|
||||
// tv_number.setText("暂无信息");
|
||||
// tv_name.setText("暂无信息");
|
||||
String batch = (String) SPUtils.get(MainActivity.this, "batch", "暂无信息");
|
||||
if (!"暂无信息".equals(batch)) {
|
||||
tv_batch.setText(batch);
|
||||
} else {
|
||||
if (TextUtils.isEmpty(batch)||"暂无信息".equals(batch)) {
|
||||
tv_batch.setVisibility(View.GONE);
|
||||
} else {
|
||||
tv_batch.setText(batch);
|
||||
}
|
||||
|
||||
String classes = (String) SPUtils.get(MainActivity.this, "classes", "暂无信息");
|
||||
if (!"暂无信息".equals(classes)) {
|
||||
tv_class.setText(classes);
|
||||
} else {
|
||||
if (TextUtils.isEmpty(classes)||"暂无信息".equals(classes)) {
|
||||
layout_class.setVisibility(View.GONE);
|
||||
} else {
|
||||
tv_class.setText(classes);
|
||||
}
|
||||
String sno = (String) SPUtils.get(MainActivity.this, "sno", "暂无信息");
|
||||
if (!"暂无信息".equals(sno)) {
|
||||
tv_number.setText(sno);
|
||||
} else {
|
||||
if (TextUtils.isEmpty(sno)||"暂无信息".equals(sno)) {
|
||||
layout_number.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
String realname = (String) SPUtils.get(MainActivity.this, "realname", "暂无信息");
|
||||
if (!"暂无信息".equals(realname)) {
|
||||
tv_name.setText(realname);
|
||||
} else {
|
||||
tv_number.setText(sno);
|
||||
}
|
||||
String realname = (String) SPUtils.get(MainActivity.this, "realname", "暂无信息");
|
||||
if (TextUtils.isEmpty(realname)||"暂无信息".equals(realname)) {
|
||||
layout_name.setVisibility(View.GONE);
|
||||
} else {
|
||||
tv_name.setText(realname);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mjsheng.myappstore.bean;
|
||||
|
||||
public class StudentsInfo {
|
||||
private String id;
|
||||
private String batch;
|
||||
private String realname;
|
||||
private String classes ;
|
||||
private String sno;
|
||||
private int admin_id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBatch() {
|
||||
return batch;
|
||||
}
|
||||
|
||||
public void setBatch(String batch) {
|
||||
this.batch = batch;
|
||||
}
|
||||
|
||||
public String getRealname() {
|
||||
return realname;
|
||||
}
|
||||
|
||||
public void setRealname(String realname) {
|
||||
this.realname = realname;
|
||||
}
|
||||
|
||||
public String getClasses() {
|
||||
return classes;
|
||||
}
|
||||
|
||||
public void setClasses(String classes) {
|
||||
this.classes = classes;
|
||||
}
|
||||
|
||||
public String getSno() {
|
||||
return sno;
|
||||
}
|
||||
|
||||
public void setSno(String sno) {
|
||||
this.sno = sno;
|
||||
}
|
||||
|
||||
public int getAdmin_id() {
|
||||
return admin_id;
|
||||
}
|
||||
|
||||
public void setAdmin_id(int admin_id) {
|
||||
this.admin_id = admin_id;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mjsheng.myappstore.network;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.icu.text.SimpleDateFormat;
|
||||
import android.os.Build;
|
||||
@@ -15,11 +16,9 @@ import android.util.Log;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
import com.mjsheng.myappstore.MyApplication;
|
||||
@@ -27,7 +26,6 @@ import com.mjsheng.myappstore.bean.Appground;
|
||||
import com.mjsheng.myappstore.bean.BaseResponse;
|
||||
import com.mjsheng.myappstore.bean.NetAndLaunchBean;
|
||||
import com.mjsheng.myappstore.bean.NetAndLaunchData;
|
||||
import com.mjsheng.myappstore.bean.TimeControl;
|
||||
import com.mjsheng.myappstore.bean.UserInfo;
|
||||
import com.mjsheng.myappstore.jpush.TagAliasOperatorHelper;
|
||||
import com.mjsheng.myappstore.network.api.newapi.SnTimeControl;
|
||||
@@ -44,7 +42,6 @@ import com.mjsheng.myappstore.utils.ToastUtil;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@@ -58,7 +55,6 @@ import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.ACTION_SET;
|
||||
import static com.mjsheng.myappstore.jpush.TagAliasOperatorHelper.sequence;
|
||||
@@ -308,6 +304,57 @@ public class HTTPInterface {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
synchronized public static void checkTestUpdate(final Context context) {
|
||||
OkGo.<String>get(Configure.GET_SN_APP_TEST)
|
||||
.params("sn", Utils.getSerial())
|
||||
.execute(new StringCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s, Call call, okhttp3.Response response) {
|
||||
JSONObject jsonObject = JSON.parseObject(s);
|
||||
int code = jsonObject.getInteger("code");
|
||||
String msg = jsonObject.getString("msg");
|
||||
if (code == 200) {
|
||||
JSONObject data = JSON.parseObject(jsonObject.getString("data"));
|
||||
installTestAPK(context, data);
|
||||
} else {
|
||||
Log.e("checkTestUpdate", "onSuccess: " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Call call, Response response, Exception e) {
|
||||
super.onError(call, response, e);
|
||||
Log.e("checkTestUpdate", "onError" + e.getMessage());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void installTestAPK(final Context context, JSONObject jsonObject) {
|
||||
final String url = jsonObject.getString("app_url");
|
||||
int versionCode = jsonObject.getInteger("app_version_code");
|
||||
final String packageName = jsonObject.getString("app_package");
|
||||
String app_name = jsonObject.getString("app_name");
|
||||
final com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
|
||||
object.put("app_name", app_name);
|
||||
object.put("app_package", packageName);
|
||||
PackageManager pm = context.getPackageManager();
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (packageInfo == null || packageInfo.versionCode < versionCode) {
|
||||
Utils.ariaDownload(context, url, object);
|
||||
} else {
|
||||
Log.e("installTestAPK", "APK: " + "无更新");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
synchronized public static void setJpushTags(final Context context) {
|
||||
OkGo.get(Configure.GET_DEVICES_TAGS)
|
||||
.params("sn", Utils.getSerial())
|
||||
|
||||
@@ -1259,6 +1259,7 @@ public class InitJpushServer extends Service {
|
||||
|
||||
private void checkUpdate() {
|
||||
HTTPInterface.checkUpdate(mHandler, "com.jiaoguanyi.store");
|
||||
HTTPInterface.checkTestUpdate(InitJpushServer.this);
|
||||
}
|
||||
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
|
||||
@@ -219,4 +219,7 @@ public class Configure {
|
||||
//获取时间管控
|
||||
public final static String GET_TOP_APP_CONTROL = HTTP_TAG_HEAD_NEW + "Sn/getSnAppControl";
|
||||
//获取时间管控
|
||||
public final static String GET_SN_APP_TEST = HTTP_TAG_HEAD_NEW + "Sn/getSnAppTest";
|
||||
//获取时间管控
|
||||
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
#Mon Jan 18 17:14:30 CST 2021
|
||||
sdk.dir=E\:\\Sdk
|
||||
#Mon Feb 01 22:13:27 CST 2021
|
||||
sdk.dir=G\:\\AndroidSDK
|
||||
|
||||
Reference in New Issue
Block a user