Compare commits
13 Commits
v4.5.0-250
...
v4.5.2-252
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d9a4baf32 | |||
| 3a9132ff8c | |||
| 02a6ec9f7d | |||
| c779d775e3 | |||
| 3fbcd33f98 | |||
| dbcdd7f3cc | |||
| 69d9854b44 | |||
| 5246d6e743 | |||
| b20d598751 | |||
| 85e9799f20 | |||
| 6b533c8d09 | |||
| 2797135db4 | |||
| 7507a027da |
@ -352,7 +352,7 @@ dependencies {
|
||||
implementation "com.github.PhilJay:MPAndroidChart:${chart}"
|
||||
|
||||
implementation project(':libraries:LGLibrary')
|
||||
implementation project(':libraries:MTA')
|
||||
// implementation project(':libraries:MTA')
|
||||
implementation project(':libraries:QQShare')
|
||||
// implementation project(':libraries:TalkingData')
|
||||
// implementation project(':libraries:UmengPush')
|
||||
|
||||
@ -118,7 +118,9 @@ class CertificationDialog(context: Context, private val authDialogEntity: AuthDi
|
||||
|
||||
//跳转登录页面
|
||||
private fun gotoLoginPage() {
|
||||
CheckLoginUtils.checkLogin(AppManager.getInstance().currentActivity() as AppCompatActivity,
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
CheckLoginUtils.checkLogin(currentActivity as AppCompatActivity,
|
||||
null, true, "实名认证弹窗") {
|
||||
if (UserManager.getInstance().isAuth) {
|
||||
listener.onConfirm()
|
||||
@ -129,7 +131,9 @@ class CertificationDialog(context: Context, private val authDialogEntity: AuthDi
|
||||
|
||||
//跳转实名认证页面
|
||||
private fun gotoAuthPage() {
|
||||
AvoidOnResultManager.getInstance(AppManager.getInstance().currentActivity() as AppCompatActivity)
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
AvoidOnResultManager.getInstance(currentActivity as AppCompatActivity)
|
||||
.startForResult(UserInfoEditActivity.getIntent(context, UserViewModel.TYPE_ID_CARD), object : Callback {
|
||||
override fun onActivityResult(resultCode: Int, data: Intent?) {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
|
||||
@ -7,7 +7,6 @@ import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.exposure.meta.MetaUtil;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
@ -16,15 +15,9 @@ import com.gh.gid.GidHelper;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.config.CommonDebug;
|
||||
import com.lightgame.utils.Utils;
|
||||
import com.tencent.stat.MtaSDkException;
|
||||
import com.tencent.stat.StatConfig;
|
||||
import com.tencent.stat.StatCrashReporter;
|
||||
import com.tencent.stat.StatReportStrategy;
|
||||
import com.tencent.stat.StatService;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import io.sentry.android.core.SentryAndroid;
|
||||
import io.sentry.core.Sentry;
|
||||
@ -90,42 +83,42 @@ public class DataUtils {
|
||||
// }
|
||||
|
||||
//MTA
|
||||
try {
|
||||
/**
|
||||
*
|
||||
* 不要启用!!!!全部由{@link com.gh.base.AppUncaughtHandler}处理
|
||||
*/
|
||||
StatConfig.setAutoExceptionCaught(false);
|
||||
|
||||
StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
|
||||
crashReporter.setJavaCrashHandlerStatus(false);
|
||||
// crashReporter.setEnableInstantReporting(true);
|
||||
|
||||
StatConfig.setDebugEnable(false);
|
||||
|
||||
// 设置数据上报策略
|
||||
// 测试渠道的时候即时上传,方便查看日志
|
||||
if (Config.DEFAULT_CHANNEL.equals(HaloApp.getInstance().getChannel())) {
|
||||
StatConfig.setStatSendStrategy(StatReportStrategy.INSTANT);
|
||||
} else {
|
||||
StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
|
||||
StatConfig.setSendPeriodMinutes(5);
|
||||
}
|
||||
|
||||
// 设置启用Tlink
|
||||
StatConfig.setTLinkStatus(true);
|
||||
|
||||
StatConfig.init(context);
|
||||
StatConfig.setInstallChannel(channel);
|
||||
StatConfig.setAntoActivityLifecycleStat(true);
|
||||
StatConfig.setAppVersion(PackageUtils.getVersionName());
|
||||
|
||||
// 开启收集服务
|
||||
StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
|
||||
StatService.registerActivityLifecycleCallbacks(context);
|
||||
} catch (MtaSDkException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// try {
|
||||
// /**
|
||||
// *
|
||||
// * 不要启用!!!!全部由{@link com.gh.base.AppUncaughtHandler}处理
|
||||
// */
|
||||
// StatConfig.setAutoExceptionCaught(false);
|
||||
//
|
||||
// StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
|
||||
// crashReporter.setJavaCrashHandlerStatus(false);
|
||||
//// crashReporter.setEnableInstantReporting(true);
|
||||
//
|
||||
// StatConfig.setDebugEnable(false);
|
||||
//
|
||||
// // 设置数据上报策略
|
||||
// // 测试渠道的时候即时上传,方便查看日志
|
||||
// if (Config.DEFAULT_CHANNEL.equals(HaloApp.getInstance().getChannel())) {
|
||||
// StatConfig.setStatSendStrategy(StatReportStrategy.INSTANT);
|
||||
// } else {
|
||||
// StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
|
||||
// StatConfig.setSendPeriodMinutes(5);
|
||||
// }
|
||||
//
|
||||
// // 设置启用Tlink
|
||||
// StatConfig.setTLinkStatus(true);
|
||||
//
|
||||
// StatConfig.init(context);
|
||||
// StatConfig.setInstallChannel(channel);
|
||||
// StatConfig.setAntoActivityLifecycleStat(true);
|
||||
// StatConfig.setAppVersion(PackageUtils.getVersionName());
|
||||
//
|
||||
// // 开启收集服务
|
||||
// StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
|
||||
// StatService.registerActivityLifecycleCallbacks(context);
|
||||
// } catch (MtaSDkException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
// init bugly
|
||||
// try {
|
||||
@ -180,17 +173,17 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
public static void onEvent(Context var0, String var1, String var2) {
|
||||
Properties prop = new Properties();
|
||||
prop.setProperty(var1, var2);
|
||||
StatService.trackCustomKVEvent(var0, var1, prop);
|
||||
// Properties prop = new Properties();
|
||||
// prop.setProperty(var1, var2);
|
||||
// StatService.trackCustomKVEvent(var0, var1, prop);
|
||||
}
|
||||
|
||||
public static void onPause(Activity var0) {
|
||||
StatService.onPause(var0);
|
||||
// StatService.onPause(var0);
|
||||
}
|
||||
|
||||
public static void onResume(Activity var0) {
|
||||
StatService.onResume(var0);
|
||||
// StatService.onResume(var0);
|
||||
}
|
||||
|
||||
// 游戏启动
|
||||
@ -202,30 +195,30 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
public static void onEvent(Context var0, String var1, String var2, Map<String, Object> var3) {
|
||||
Properties prop = new Properties();
|
||||
prop.setProperty("label", var2);
|
||||
for (String key : var3.keySet()) {
|
||||
prop.setProperty(key, var3.get(key) + "");
|
||||
}
|
||||
StatService.trackCustomKVEvent(var0, var1, prop);
|
||||
// Properties prop = new Properties();
|
||||
// prop.setProperty("label", var2);
|
||||
// for (String key : var3.keySet()) {
|
||||
// prop.setProperty(key, var3.get(key) + "");
|
||||
// }
|
||||
// StatService.trackCustomKVEvent(var0, var1, prop);
|
||||
}
|
||||
|
||||
public static void trackTimeEvent(Context context, String eventId, int costTime, String... kv) {
|
||||
|
||||
Properties prop = new Properties();
|
||||
for (int i = 0; i < kv.length; i++) {
|
||||
if (i % 2 != 0 || i != 0) {
|
||||
String key = kv[i - 1];
|
||||
String value = kv[i];
|
||||
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
prop.setProperty(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prop.size() == 0) return;
|
||||
|
||||
StatService.trackCustomKVTimeIntervalEvent(context, costTime, eventId, prop);
|
||||
//
|
||||
// Properties prop = new Properties();
|
||||
// for (int i = 0; i < kv.length; i++) {
|
||||
// if (i % 2 != 0 || i != 0) {
|
||||
// String key = kv[i - 1];
|
||||
// String value = kv[i];
|
||||
// if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
// prop.setProperty(key, value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (prop.size() == 0) return;
|
||||
//
|
||||
// StatService.trackCustomKVTimeIntervalEvent(context, costTime, eventId, prop);
|
||||
}
|
||||
|
||||
// 游戏下载
|
||||
|
||||
@ -76,9 +76,10 @@ object DownloadObserver {
|
||||
// MtaHelper.onEventWithBasicDeviceInfo("下载失败弹窗",
|
||||
// "游戏", downloadEntity.name,
|
||||
// "平台", downloadEntity.platform)
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
DialogUtils.showAlertDialog(AppManager.getInstance().currentActivity(), "下载失败", "下载链接已失效,建议提交反馈", "立即反馈", "取消", {
|
||||
SuggestionActivity.startSuggestionActivity(AppManager.getInstance().currentActivity(),
|
||||
DialogUtils.showAlertDialog(currentActivity, "下载失败", "下载链接已失效,建议提交反馈", "立即反馈", "取消", {
|
||||
SuggestionActivity.startSuggestionActivity(currentActivity,
|
||||
SuggestType.gameQuestion, "notfound",
|
||||
StringUtils.buildString(downloadEntity.name, ",问题反馈:下载链接失效"),
|
||||
SimpleGameEntity(gameId, downloadEntity.name, ""))
|
||||
@ -141,7 +142,9 @@ object DownloadObserver {
|
||||
if (gameEntity?.simulator != null) {
|
||||
val isInstalled = PackageUtils.isInstalledFromAllPackage(HaloApp.getInstance().application, gameEntity.simulator!!.apk!!.packageName)
|
||||
if (!isInstalled) {
|
||||
SimulatorDownloadManager.getInstance().showDownloadDialog(AppManager.getInstance().currentActivity(), gameEntity.simulator,
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
SimulatorDownloadManager.getInstance().showDownloadDialog(currentActivity, gameEntity.simulator,
|
||||
SimulatorDownloadManager.SimulatorLocation.LAUNCH, gameEntity.id, gameEntity.name
|
||||
?: "", null)
|
||||
}
|
||||
|
||||
@ -1,61 +1,52 @@
|
||||
package com.gh.common.util
|
||||
|
||||
import android.os.Build
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.exposure.meta.MetaUtil
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Utils
|
||||
import com.tencent.stat.StatService
|
||||
import java.util.*
|
||||
|
||||
object MtaHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun onEvent(eventId: String, vararg kv: String?) {
|
||||
val prop = Properties()
|
||||
|
||||
if (kv.size == 1) {
|
||||
prop.setProperty(kv[0], kv[0])
|
||||
StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
|
||||
Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}]")
|
||||
return
|
||||
}
|
||||
|
||||
for (i in kv.indices) {
|
||||
if (i % 2 != 0) {
|
||||
val key = kv[i - 1]
|
||||
val value = kv[i]
|
||||
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
prop.setProperty(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}]")
|
||||
StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
|
||||
// val prop = Properties()
|
||||
//
|
||||
// if (kv.size == 1) {
|
||||
// prop.setProperty(kv[0], kv[0])
|
||||
// StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
|
||||
// Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}]")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// for (i in kv.indices) {
|
||||
// if (i % 2 != 0) {
|
||||
// val key = kv[i - 1]
|
||||
// val value = kv[i]
|
||||
// if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
// prop.setProperty(key, value)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}]")
|
||||
// StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun onEventWithTime(eventId: String, time: Int, vararg kv: String?) {
|
||||
val prop = Properties()
|
||||
for (i in kv.indices) {
|
||||
if (i % 2 != 0 || i != 0) {
|
||||
val key = kv[i - 1]
|
||||
val value = kv[i]
|
||||
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
prop.setProperty(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prop.size == 0 && kv.size == 1) {
|
||||
prop.setProperty(kv[0], kv[0])
|
||||
}
|
||||
|
||||
if (prop.size == 0) return
|
||||
Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}] + last $time seconds")
|
||||
StatService.trackCustomKVTimeIntervalEvent(HaloApp.getInstance().application, time, eventId, prop)
|
||||
// val prop = Properties()
|
||||
// for (i in kv.indices) {
|
||||
// if (i % 2 != 0 || i != 0) {
|
||||
// val key = kv[i - 1]
|
||||
// val value = kv[i]
|
||||
// if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
// prop.setProperty(key, value)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (prop.size == 0 && kv.size == 1) {
|
||||
// prop.setProperty(kv[0], kv[0])
|
||||
// }
|
||||
//
|
||||
// if (prop.size == 0) return
|
||||
// Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}] + last $time seconds")
|
||||
// StatService.trackCustomKVTimeIntervalEvent(HaloApp.getInstance().application, time, eventId, prop)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,29 +54,29 @@ object MtaHelper {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun onEventWithBasicDeviceInfo(eventId: String, vararg kv: String) {
|
||||
val prop = Properties()
|
||||
for (i in kv.indices) {
|
||||
if (i % 2 != 0) {
|
||||
val key = kv[i - 1]
|
||||
val value = kv[i]
|
||||
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
prop.setProperty(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prop.setProperty("光环版本", BuildConfig.VERSION_NAME)
|
||||
prop.setProperty("网络状态", DeviceUtils.getNetwork(HaloApp.getInstance().application))
|
||||
prop.setProperty("IMEI", MetaUtil.getIMEI())
|
||||
prop.setProperty("机型", Build.MODEL)
|
||||
prop.setProperty("厂商", Build.MANUFACTURER)
|
||||
prop.setProperty("Android版本", Build.VERSION.RELEASE)
|
||||
if (!TextUtils.isEmpty(HaloApp.getInstance().gid)) {
|
||||
prop.setProperty("GID", HaloApp.getInstance().gid)
|
||||
}
|
||||
|
||||
Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}]")
|
||||
StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
|
||||
// val prop = Properties()
|
||||
// for (i in kv.indices) {
|
||||
// if (i % 2 != 0) {
|
||||
// val key = kv[i - 1]
|
||||
// val value = kv[i]
|
||||
// if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
|
||||
// prop.setProperty(key, value)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// prop.setProperty("光环版本", BuildConfig.VERSION_NAME)
|
||||
// prop.setProperty("网络状态", DeviceUtils.getNetwork(HaloApp.getInstance().application))
|
||||
// prop.setProperty("IMEI", MetaUtil.getIMEI())
|
||||
// prop.setProperty("机型", Build.MODEL)
|
||||
// prop.setProperty("厂商", Build.MANUFACTURER)
|
||||
// prop.setProperty("Android版本", Build.VERSION.RELEASE)
|
||||
// if (!TextUtils.isEmpty(HaloApp.getInstance().gid)) {
|
||||
// prop.setProperty("GID", HaloApp.getInstance().gid)
|
||||
// }
|
||||
//
|
||||
// Utils.log("MTA", "$eventId + [${kv.joinToString(" , ")}]")
|
||||
// StatService.trackCustomKVEvent(HaloApp.getInstance().application, eventId, prop)
|
||||
}
|
||||
|
||||
}
|
||||
@ -41,7 +41,10 @@ object PackageInstaller {
|
||||
fun install(context: Context, downloadEntity: DownloadEntity, showUnzipToast: Boolean) {
|
||||
val pkgPath = downloadEntity.path
|
||||
val isXapk = XapkInstaller.XAPK_EXTENSION_NAME == pkgPath.getExtension()
|
||||
InstallPermissionDialogFragment.show(AppManager.getInstance().currentActivity() as AppCompatActivity, downloadEntity) {
|
||||
|
||||
val currentActivity = AppManager.getInstance().currentActivity() ?: return
|
||||
|
||||
InstallPermissionDialogFragment.show(currentActivity as AppCompatActivity, downloadEntity) {
|
||||
// 取消状态栏下载完成的通知,若存在
|
||||
downloadEntity.meta[Constants.MARK_ALREADY_TRIGGERED_INSTALLATION] = "YES"
|
||||
DownloadNotificationHelper.addOrUpdateDownloadNotification(downloadEntity)
|
||||
|
||||
@ -185,6 +185,11 @@ public class PackageUtils {
|
||||
|
||||
public static boolean compareSignatureBetweenInstalledAppWithApk(Context context, String packageName, String apkFilePath) {
|
||||
try {
|
||||
// 统计签名比较使用的频率 (大文件会触发 ANR)
|
||||
SentryHelper.INSTANCE.onEvent(
|
||||
"SIGNATURE_COMPARE",
|
||||
"packageName", packageName);
|
||||
|
||||
Signature sig = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures[0];
|
||||
|
||||
// Fuck HUAWEI, 华为系统调用 getPackageArchiveInfo 获取魔羯 apk 的签名时会耗时超过5秒造成 ANR,没有找到解决方法
|
||||
|
||||
@ -7,6 +7,7 @@ import android.preference.PreferenceManager
|
||||
import android.text.TextUtils
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.loghub.LoghubUtils
|
||||
import com.gh.common.runOnIoThread
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.entity.GameDigestEntity
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
@ -106,7 +107,8 @@ object PackageObserver {
|
||||
}
|
||||
})
|
||||
}
|
||||
postNewlyInstalledApp(gameId, packageName)
|
||||
|
||||
runOnIoThread { postNewlyInstalledApp(gameId, packageName) }
|
||||
}
|
||||
|
||||
if ("卸载" == busFour.type) {
|
||||
|
||||
@ -14,6 +14,7 @@ import com.gh.common.exposure.ExposureEvent
|
||||
import com.gh.common.exposure.ExposureSource
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.dip2px
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
@ -100,6 +101,11 @@ class SpecialCatalogAdapter(context: Context, private val mCatalogViewModel: Cat
|
||||
is CatalogImageItemHolder -> {
|
||||
val imageEntity = mEntityList[position].bigImage!!
|
||||
holder.binding.run {
|
||||
image.layoutParams = image.layoutParams.apply {
|
||||
val imageWidth = mContext.resources.displayMetrics.widthPixels - (80F + 16F + 16F).dip2px()
|
||||
height = imageWidth * 9 / 16
|
||||
}
|
||||
|
||||
entity = imageEntity.image
|
||||
|
||||
var exposureEvent: ExposureEvent? = null
|
||||
|
||||
@ -61,7 +61,7 @@ object PackageRepository {
|
||||
val gameUpdateLiveData = MutableLiveData<List<GameUpdateEntity>>()
|
||||
val gameInstalledLiveData = MutableLiveData<List<GameInstall>>()
|
||||
|
||||
val gameInstalled = ArrayList<GameInstall>()
|
||||
val gameInstalled = Collections.synchronizedList(ArrayList<GameInstall>())
|
||||
val gameUpdate = ArrayList<GameUpdateEntity>()
|
||||
|
||||
init {
|
||||
@ -190,7 +190,7 @@ object PackageRepository {
|
||||
*
|
||||
* @param list 已安装的游戏包名集合
|
||||
*/
|
||||
private fun loadInstalledGameDigestAndNotifyData(list: ArrayList<String>) {
|
||||
private fun loadInstalledGameDigestAndNotifyData(list: ArrayList<String>, onWorkerThreadOnly: Boolean = false) {
|
||||
var isNotifyUpdate = false
|
||||
val latch = ObservableUtil.latch(list.size, {
|
||||
if (isNotifyUpdate || gameUpdateLiveData.value == null) notifyGameUpdateData()
|
||||
@ -199,33 +199,39 @@ object PackageRepository {
|
||||
|
||||
for (pkgName in list) {
|
||||
val filterQuery = UrlFilterUtils.getFilterQuery("package", pkgName)
|
||||
mSensitiveApi.loadGameDataByPackageName(filterQuery)
|
||||
|
||||
var observable = mSensitiveApi.loadGameDataByPackageName(filterQuery)
|
||||
.map(RegionSettingHelper.filterGame)
|
||||
.map(ApkActiveUtils.filterMapperList)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<List<GameEntity>>() {
|
||||
override fun onResponse(response: List<GameEntity>?) {
|
||||
if (response != null) {
|
||||
val gh_id = PackageUtils.getMetaData(HaloApp.getInstance().application, pkgName, "gh_id")
|
||||
for (game in response) {
|
||||
if (gh_id == null || gh_id == game.id) {
|
||||
gameInstalled.add(GameInstall.transformGameInstall(game, pkgName))
|
||||
val isCanPluggable = checkGamePlugin(game, pkgName)
|
||||
val isCanUpdate = checkGameUpdate(game)
|
||||
if (!isNotifyUpdate && isCanUpdate || isCanPluggable) {
|
||||
isNotifyUpdate = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!onWorkerThreadOnly) {
|
||||
// 这里面的代码(根据包名获取签名?)或许是造成安装完成后的 ANR 和 startForegroundService did not then call startForeground 的原因
|
||||
// 为了避免影响其它地方,这里只处理安装完成后的调用
|
||||
observable = observable.observeOn(AndroidSchedulers.mainThread())
|
||||
}
|
||||
observable.subscribe(object : Response<List<GameEntity>>() {
|
||||
override fun onResponse(response: List<GameEntity>?) {
|
||||
if (response != null) {
|
||||
val gh_id = PackageUtils.getMetaData(HaloApp.getInstance().application, pkgName, "gh_id")
|
||||
for (game in response) {
|
||||
if (gh_id == null || gh_id == game.id) {
|
||||
gameInstalled.add(GameInstall.transformGameInstall(game, pkgName))
|
||||
val isCanPluggable = checkGamePlugin(game, pkgName)
|
||||
val isCanUpdate = checkGameUpdate(game)
|
||||
if (!isNotifyUpdate && isCanUpdate || isCanPluggable) {
|
||||
isNotifyUpdate = true
|
||||
}
|
||||
}
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
latch.countDown()
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
latch.countDown()
|
||||
}
|
||||
})
|
||||
override fun onFailure(e: HttpException?) {
|
||||
latch.countDown()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +309,7 @@ object PackageRepository {
|
||||
|
||||
val list = ArrayList<String>()
|
||||
list.add(pkgName)
|
||||
loadInstalledGameDigestAndNotifyData(list)
|
||||
loadInstalledGameDigestAndNotifyData(list, true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.ExtensionsKt;
|
||||
import com.gh.common.util.InstallUtils;
|
||||
@ -38,7 +39,14 @@ public class InstallAndUninstallReceiver extends BroadcastReceiver {
|
||||
String versionName = PackageUtils.getVersionByPackage(packageName);
|
||||
EBPackage installEb = new EBPackage("安装", packageName, versionName);
|
||||
EventBus.getDefault().post(installEb);
|
||||
PackageObserver.onPackageChanged(installEb);
|
||||
if (PackageUtils.isAppOnForeground(context)) {
|
||||
PackageObserver.onPackageChanged(installEb);
|
||||
} else {
|
||||
// 处于后台运行的时候尝试延迟 1 秒再触发 onPackageChanged (猜测是引起 ANR 的原因)
|
||||
AppExecutor.getUiExecutor().executeWithDelay(() -> {
|
||||
PackageObserver.onPackageChanged(installEb);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
// 接收卸载广播
|
||||
|
||||
@ -28,8 +28,10 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
|
||||
@ -7,8 +7,8 @@ ext {
|
||||
targetSdkVersion = 26
|
||||
|
||||
// application info (每个大版本之间的 versionCode 增加 20)
|
||||
versionCode = 250
|
||||
versionName = "4.5.0"
|
||||
versionCode = 252
|
||||
versionName = "4.5.2"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
// AndroidX
|
||||
|
||||
Submodule libraries/LGLibrary updated: 7b35e95492...93049eb802
@ -1,7 +1,7 @@
|
||||
include ':app'
|
||||
//include ':libraries:im'
|
||||
include ':libraries:LGLibrary'
|
||||
include ':libraries:MTA'
|
||||
//include ':libraries:MTA'
|
||||
include ':libraries:QQShare'
|
||||
//include ':libraries:TalkingData'
|
||||
//include ':libraries:UmengPush'
|
||||
|
||||
Reference in New Issue
Block a user