Merge branch 'dev' of git.shanqu.cc:halo/android/assistant-android into dev

This commit is contained in:
juntao
2022-05-24 17:49:33 +08:00
1900 changed files with 18139 additions and 15668 deletions

View File

@ -1,17 +1,17 @@
package com.gh.gamecenter;
import static com.gh.common.util.EntranceUtils.ENTRANCE_BROWSER;
import static com.gh.common.util.EntranceUtils.HOST_LAUNCH_SIMULATOR_GAME;
import static com.gh.common.util.EntranceUtils.HOST_QQ;
import static com.gh.common.util.EntranceUtils.HOST_QQ_GROUP;
import static com.gh.common.util.EntranceUtils.HOST_WEB;
import static com.gh.common.util.EntranceUtils.KEY_DATA;
import static com.gh.common.util.EntranceUtils.KEY_MARKET_DETAILS;
import static com.gh.common.util.EntranceUtils.KEY_NEXT_TO;
import static com.gh.common.util.EntranceUtils.KEY_TO;
import static com.gh.common.util.EntranceUtils.KEY_TYPE;
import static com.gh.common.util.ExtensionsKt.observableToMain;
import static com.gh.common.util.LoginHelper.WEIBO_SCOPE;
import static com.gh.gamecenter.common.constant.EntranceConsts.ENTRANCE_BROWSER;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_LAUNCH_SIMULATOR_GAME;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_QQ_GROUP;
import static com.gh.gamecenter.common.constant.EntranceConsts.HOST_WEB;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_DATA;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_MARKET_DETAILS;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_NEXT_TO;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_TO;
import static com.gh.gamecenter.common.constant.EntranceConsts.KEY_TYPE;
import static com.gh.gamecenter.common.utils.ExtensionsKt.observableToMain;
import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_PERSONAL;
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
import static com.gh.gamecenter.personal.PersonalFragment.LOGOUT_TAG;
@ -39,54 +39,58 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProviders;
import com.gh.base.AppUncaughtHandler;
import com.gh.base.BaseActivity;
import com.gh.base.fragment.BaseFragment_ViewPager;
import com.gh.common.AppExecutor;
import com.gh.common.DefaultUrlHandler;
import com.gh.common.avoidcallback.AvoidOnResultManager;
import com.gh.common.constant.Config;
import com.gh.common.constant.Constants;
import com.gh.common.exposure.meta.MetaUtil;
import com.gh.common.history.HistoryDatabase;
import com.gh.common.history.HistoryHelper;
import com.gh.common.repository.ReservationRepository;
import com.gh.common.simulator.SimulatorGameManager;
import com.gh.common.util.ActivationHelper;
import com.gh.common.util.AdHelper;
import com.gh.common.util.ClassUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DeviceTokenUtils;
import com.gh.common.util.DeviceUtils;
import com.gh.common.util.DialogHelper;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ErrorHelper;
import com.gh.common.util.ExtensionsKt;
import com.gh.common.util.GsonUtils;
import com.gh.common.util.HomePluggableHelper;
import com.gh.common.util.LogUtils;
import com.gh.common.util.LunchType;
import com.gh.common.util.MtaHelper;
import com.gh.common.util.NotificationHelper;
import com.gh.gamecenter.common.utils.NotificationHelper;
import com.gh.common.util.PackageInstaller;
import com.gh.common.util.PackageUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.QuickLoginHelper;
import com.gh.common.util.SPUtils;
import com.gh.common.util.SentryHelper;
import com.gh.common.util.ShareUtils;
import com.gh.common.util.ToastUtils;
import com.gh.common.util.UrlFilterUtils;
import com.gh.common.util.WechatBindHelper;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.common.avoidcallback.AvoidOnResultManager;
import com.gh.gamecenter.common.base.activity.BaseActivity;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.base.fragment.BaseFragment_ViewPager;
import com.gh.gamecenter.common.base.fragment.ToolbarFragment;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DeviceUtils;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ShareUtils;
import com.gh.gamecenter.core.AppExecutor;
import com.gh.gamecenter.core.utils.ClassUtils;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.core.utils.SentryHelper;
import com.gh.gamecenter.core.utils.ToastUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.download.DownloadFragment;
import com.gh.gamecenter.entity.CommunityEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.InnerMetaInfoEntity;
import com.gh.gamecenter.entity.NotificationUgc;
import com.gh.gamecenter.common.entity.NotificationUgc;
import com.gh.gamecenter.entity.StartupAdEntity;
import com.gh.gamecenter.eventbus.EBNetworkState;
import com.gh.gamecenter.eventbus.EBReuse;
@ -96,10 +100,7 @@ import com.gh.gamecenter.home.skip.PackageSkipActivity;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.normal.NormalFragment;
import com.gh.gamecenter.packagehelper.PackageViewModel;
import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.room.AppDatabase;
import com.gh.gamecenter.room.dao.SimulatorGameDao;
@ -226,12 +227,12 @@ public class MainActivity extends BaseActivity {
mPackageViewModel = ViewModelProviders.of(this, new PackageViewModel.Factory()).get(PackageViewModel.class);
final String message = Config.getExceptionMsg();
final String message = com.gh.gamecenter.common.constant.Config.getExceptionMsg();
if (!TextUtils.isEmpty(message)) {
Config.setExceptionMsg(null);
AppUncaughtHandler.reportException(this, new Throwable(message));
com.gh.gamecenter.common.constant.Config.setExceptionMsg(null);
DataUtils.reportException(this, new Throwable(message));
// 被改过的包闪退时增加跳转到光环游戏详情并自动下载的方法
if (Config.DEFAULT_CHANNEL_FOR_RELEASE.equals(HaloApp.getInstance().getChannel())) {
if (com.gh.gamecenter.common.constant.Config.DEFAULT_CHANNEL_FOR_RELEASE.equals(HaloApp.getInstance().getChannel())) {
DialogHelper.showCenterWarningDialog(this, "发生闪退", "光环助手发生了闪退,建议安装到最新版本修复异常"
, "马上反馈", "马上安装修复",
() -> {
@ -278,7 +279,7 @@ public class MainActivity extends BaseActivity {
// 跳转至其它页面
if (getIntent() != null
&& getIntent().getExtras() != null
&& getIntent().getBooleanExtra(EntranceUtils.KEY_REQUIRE_REDIRECT, false)) {
&& getIntent().getBooleanExtra(EntranceConsts.KEY_REQUIRE_REDIRECT, false)) {
doSkip();
}
@ -546,7 +547,7 @@ public class MainActivity extends BaseActivity {
private void doSkip() {
if (getIntent() != null && getIntent().getExtras() != null) {
getIntent().getExtras().putBoolean(EntranceUtils.KEY_REQUIRE_REDIRECT, false);
getIntent().getExtras().putBoolean(EntranceConsts.KEY_REQUIRE_REDIRECT, false);
}
handler.postDelayed(() -> {
Bundle bundle = getIntent().getExtras();
@ -555,9 +556,9 @@ public class MainActivity extends BaseActivity {
if (!TextUtils.isEmpty(to)) {
Class<?> clazz = ClassUtils.forName(to);
if (clazz != null) {
String entrance = bundle.getString(EntranceUtils.KEY_ENTRANCE);
String entrance = bundle.getString(EntranceConsts.KEY_ENTRANCE);
if (TextUtils.isEmpty(entrance) || !entrance.startsWith("(") || !entrance.endsWith(")")) {
bundle.putString(EntranceUtils.KEY_ENTRANCE, "(插件跳转)");
bundle.putString(EntranceConsts.KEY_ENTRANCE, "(插件跳转)");
}
String packageName = bundle.getString("packageName");
@ -565,8 +566,8 @@ public class MainActivity extends BaseActivity {
bundle.putInt(BaseFragment_ViewPager.ARGS_INDEX, 1);
}
if (NormalFragment.class.isAssignableFrom(clazz)) {
NormalActivity.startFragment(MainActivity.this, (Class<? extends NormalFragment>) clazz, bundle);
if (ToolbarFragment.class.isAssignableFrom(clazz)) {
ToolBarActivity.startFragment(MainActivity.this, (Class<? extends ToolbarFragment>) clazz, bundle);
} else {
Intent skipIntent = new Intent(MainActivity.this, clazz);
skipIntent.putExtras(bundle);
@ -597,7 +598,7 @@ public class MainActivity extends BaseActivity {
}
break;
case HOST_LAUNCH_SIMULATOR_GAME:
String json = getIntent().getStringExtra(EntranceUtils.KEY_GAME);
String json = getIntent().getStringExtra(EntranceConsts.KEY_GAME);
try {
GameEntity gameEntity = GsonUtils.getGson().fromJson(json, new TypeToken<GameEntity>() {
}.getType());
@ -629,8 +630,8 @@ public class MainActivity extends BaseActivity {
}
Utils.log(bundle);
if (bundle.getInt(EntranceUtils.KEY_POSITION) != -1) {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, bundle.getInt(EntranceUtils.KEY_POSITION)));
if (bundle.getInt(EntranceConsts.KEY_POSITION) != -1) {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, bundle.getInt(EntranceConsts.KEY_POSITION)));
}
}
}, 500);
@ -790,7 +791,7 @@ public class MainActivity extends BaseActivity {
// 跳转至其它页面
if (getIntent() != null
&& getIntent().getExtras() != null
&& getIntent().getBooleanExtra(EntranceUtils.KEY_REQUIRE_REDIRECT, false)) {
&& getIntent().getBooleanExtra(EntranceConsts.KEY_REQUIRE_REDIRECT, false)) {
doSkip();
}
@ -892,12 +893,7 @@ public class MainActivity extends BaseActivity {
mSp.edit().putString("syncDeviceID", deviceId).apply();
DialogUtils.showForceDialog(MainActivity.this, "数据同步提醒"
, "系统检测到你是光环助手的老用户,为了避免数据丢失,请尽快登录"
, "前往登录", "残忍拒绝", new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, INDEX_PERSONAL));
}
}, null);
, "前往登录", "残忍拒绝", () -> EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_MAIN, INDEX_PERSONAL)), null);
}
// 获取META-INF中的plugin_update 文件判断是否从游戏插件中下载的app是则获取游戏id启动游戏更新下载该游戏
@ -926,7 +922,7 @@ public class MainActivity extends BaseActivity {
InnerMetaInfoEntity info = GsonUtils.getGson().fromJson(reader, InnerMetaInfoEntity.class);
if (info != null) {
if (EntranceUtils.HOST_COMMUNITY.equals(info.getType())) {
if (EntranceConsts.HOST_COMMUNITY.equals(info.getType())) {
UserManager.getInstance().setCommunityData(new CommunityEntity(info.getLink(), info.getText()));
runOnUiThread(() -> mMainWrapperFragment.setCurrentItem(MainWrapperFragment.INDEX_BBS));
} else {
@ -934,7 +930,7 @@ public class MainActivity extends BaseActivity {
info.getType(),
info.getLink(),
info.getText(),
EntranceUtils.KEY_PLUGIN,
EntranceConsts.KEY_PLUGIN,
"特定包启动跳转");
}
}
@ -1050,4 +1046,10 @@ public class MainActivity extends BaseActivity {
protected boolean isAutoResetViewBackgroundEnabled() {
return true;
}
@Override
protected void updateStaticViewBackground(View view) {
if (view.getId() == R.id.tabLayout || view.getId() == R.id.appbar) return;
super.updateStaticViewBackground(view);
}
}