|
@@ -24,6 +24,8 @@
|
|
****************************************************************************/
|
|
****************************************************************************/
|
|
package org.cocos2dx.javascript;
|
|
package org.cocos2dx.javascript;
|
|
|
|
|
|
|
|
+import org.androidannotations.annotations.sharedpreferences.Pref;
|
|
|
|
+import org.androidannotations.api.sharedpreferences.IntPrefField;
|
|
import org.cocos2dx.lib.Cocos2dxActivity;
|
|
import org.cocos2dx.lib.Cocos2dxActivity;
|
|
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
|
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
|
|
|
|
|
@@ -66,13 +68,17 @@ import androidx.core.os.EnvironmentCompat;
|
|
|
|
|
|
import com.lzy.okgo.cache.CacheEntity;
|
|
import com.lzy.okgo.cache.CacheEntity;
|
|
import com.lzy.okgo.db.CacheManager;
|
|
import com.lzy.okgo.db.CacheManager;
|
|
|
|
+import com.lzy.okgo.model.HttpParams;
|
|
import com.orhanobut.logger.Logger;
|
|
import com.orhanobut.logger.Logger;
|
|
import com.zedu.R;
|
|
import com.zedu.R;
|
|
import com.zedu.cocos.congming.app.device.DeviceEntity;
|
|
import com.zedu.cocos.congming.app.device.DeviceEntity;
|
|
|
|
+import com.zedu.cocos.congming.app.device.DevicePrefs_;
|
|
import com.zedu.cocos.congming.component.apk.ApkInfo;
|
|
import com.zedu.cocos.congming.component.apk.ApkInfo;
|
|
import com.zedu.cocos.congming.page.activate.ActivateActivity_;
|
|
import com.zedu.cocos.congming.page.activate.ActivateActivity_;
|
|
|
|
+import com.zedu.cocos.congming.page.device.DeviceActivity_;
|
|
import com.zedu.cocos.congming.page.launcher.LauncherActivity;
|
|
import com.zedu.cocos.congming.page.launcher.LauncherActivity;
|
|
import com.zedu.cocos.congming.page.launcher.LauncherActivity_;
|
|
import com.zedu.cocos.congming.page.launcher.LauncherActivity_;
|
|
|
|
+import com.zedu.support.request.OkgoClientCache;
|
|
import com.zedu.support.request.response.BaseResponse;
|
|
import com.zedu.support.request.response.BaseResponse;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
@@ -90,7 +96,7 @@ public class AppActivity extends Cocos2dxActivity {
|
|
private static Cocos2dxActivity sCocos2dxActivity;
|
|
private static Cocos2dxActivity sCocos2dxActivity;
|
|
private static ImageView sSplashBgImageView = null;
|
|
private static ImageView sSplashBgImageView = null;
|
|
public static Toast mToast;
|
|
public static Toast mToast;
|
|
- private boolean checkActivity = false;
|
|
|
|
|
|
+ private boolean checkActivity = true;
|
|
public static Uri faceImageUri;
|
|
public static Uri faceImageUri;
|
|
// 用于保存图片的文件路径,Android 10以下使用图片路径访问图片
|
|
// 用于保存图片的文件路径,Android 10以下使用图片路径访问图片
|
|
private String mCameraImagePath;
|
|
private String mCameraImagePath;
|
|
@@ -126,7 +132,7 @@ public class AppActivity extends Cocos2dxActivity {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
this.runOnUiThread(() -> {
|
|
this.runOnUiThread(() -> {
|
|
- checkActivity();
|
|
|
|
|
|
+ checkActivityAndDeviceStatus();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}).start();
|
|
}).start();
|
|
@@ -162,14 +168,14 @@ public class AppActivity extends Cocos2dxActivity {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 检查激活信息
|
|
|
|
|
|
+ * 检查激活信息和设备状态
|
|
*/
|
|
*/
|
|
- public void checkActivity() {
|
|
|
|
|
|
+ public void checkActivityAndDeviceStatus() {
|
|
if (!checkActivity) {
|
|
if (!checkActivity) {
|
|
Logger.d("激活验证开关未开启");
|
|
Logger.d("激活验证开关未开启");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Logger.d("开始验证激活信息");
|
|
|
|
|
|
+
|
|
// 获取设备信息
|
|
// 获取设备信息
|
|
ApkInfo item = new ApkInfo("聪明宝", R.mipmap.ic_launcher, APP_COCOS_CMB_ID, APP_COCOS_CMB_BIND);
|
|
ApkInfo item = new ApkInfo("聪明宝", R.mipmap.ic_launcher, APP_COCOS_CMB_ID, APP_COCOS_CMB_BIND);
|
|
if (StringUtils.isEmpty(LauncherActivity.deviceId)) {
|
|
if (StringUtils.isEmpty(LauncherActivity.deviceId)) {
|
|
@@ -177,6 +183,17 @@ public class AppActivity extends Cocos2dxActivity {
|
|
LauncherActivity_.intent(this).start();
|
|
LauncherActivity_.intent(this).start();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ Logger.d("开始验证设备状态");
|
|
|
|
+ // 获取设备信息
|
|
|
|
+ Integer status = getSharedPreferences("DevicePrefs", 0).getInt("status",0);
|
|
|
|
+ if(status == 1){
|
|
|
|
+ Logger.d("跳转到LauncherActivity_");
|
|
|
|
+ DeviceActivity_.intent(this).start();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Logger.d("开始验证激活信息");
|
|
// 获取激活信息
|
|
// 获取激活信息
|
|
String cacheKey = String.format("activate-%s-%s", LauncherActivity.deviceId, item.productId);
|
|
String cacheKey = String.format("activate-%s-%s", LauncherActivity.deviceId, item.productId);
|
|
CacheEntity<?> cacheEntity = CacheManager.getInstance().get(cacheKey);
|
|
CacheEntity<?> cacheEntity = CacheManager.getInstance().get(cacheKey);
|