Merge branch 'fix/CWZS-86' into 'dev'
fix: 修复推送更新测试问题 https://jira.shanqu.cc/browse/CWZS-86 See merge request halo/android/assistant-android!1164
This commit is contained in:
@ -205,9 +205,6 @@ public class Config {
|
||||
|
||||
// 加载完设置后刷新下
|
||||
PackageHelper.initList();
|
||||
|
||||
// 初始化畅玩相关的东西
|
||||
VHelper.init(HaloApp.getInstance());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -316,11 +313,14 @@ public class Config {
|
||||
RetrofitManager.getInstance()
|
||||
.getVApi().getSettings(BuildConfig.VERSION_NAME)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BiResponse<VSetting>() {
|
||||
@Override
|
||||
public void onSuccess(VSetting data) {
|
||||
mVSetting = data;
|
||||
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
|
||||
|
||||
VHelper.init(HaloApp.getInstance());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -208,48 +208,52 @@ object VHelper {
|
||||
|
||||
VArchiveHelper.init()
|
||||
|
||||
val config = Config.getVSettingEntity()?.va
|
||||
if (config?.arch64 != null
|
||||
&& PackageUtils.isInstalledFromAllPackage(context, config.arch64.packageName)
|
||||
) {
|
||||
if (isVIsUsed()) {
|
||||
connectService(shouldCheckUpdate = true)
|
||||
if (isVIsUsed()) {
|
||||
connectService(shouldCheckUpdate = true)
|
||||
}
|
||||
|
||||
PackageObserver.registerPackageChangeChangeListener(mPackageObserver)
|
||||
|
||||
// 注册应用可见事件监听
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(object : DefaultLifecycleObserver {
|
||||
override fun onStart(owner: LifecycleOwner) {
|
||||
super.onStart(owner)
|
||||
|
||||
mIsAppVisible = true
|
||||
|
||||
if (mShouldReConnectOnVisible) {
|
||||
mShouldReConnectOnVisible = false
|
||||
connectService(shouldConnectSilently = true)
|
||||
}
|
||||
}
|
||||
|
||||
// 检查畅玩助手64位组件更新
|
||||
getVSpaceUpdate(config.arch64, true)
|
||||
}
|
||||
override fun onStop(owner: LifecycleOwner) {
|
||||
super.onStop(owner)
|
||||
|
||||
if (config?.arch32 != null
|
||||
&& PackageUtils.isInstalledFromAllPackage(context, config.arch32.packageName)
|
||||
) {
|
||||
// 检查畅玩助手32位组件更新
|
||||
getVSpaceUpdate(config.arch32, false)
|
||||
}
|
||||
PackageObserver.registerPackageChangeChangeListener(mPackageObserver)
|
||||
mIsAppVisible = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
val config = Config.getVSettingEntity()?.va
|
||||
|
||||
if (config?.arch64 != null
|
||||
&& m64UpdateEntity == null
|
||||
&& PackageUtils.isInstalledFromAllPackage(context, config.arch64.packageName)
|
||||
) {
|
||||
// 检查畅玩助手 64 位组件更新
|
||||
getVSpaceUpdate(config.arch64, true)
|
||||
}
|
||||
|
||||
if (config?.arch32 != null
|
||||
&& m32UpdateEntity == null
|
||||
&& PackageUtils.isInstalledFromAllPackage(context, config.arch32.packageName)
|
||||
) {
|
||||
// 检查畅玩助手 32 位组件更新
|
||||
getVSpaceUpdate(config.arch32, false)
|
||||
}
|
||||
|
||||
vGameLiveData.observeForever(mVGameObserver)
|
||||
|
||||
// 注册应用可见事件监听
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(object : DefaultLifecycleObserver {
|
||||
override fun onStart(owner: LifecycleOwner) {
|
||||
super.onStart(owner)
|
||||
|
||||
mIsAppVisible = true
|
||||
|
||||
if (mShouldReConnectOnVisible) {
|
||||
mShouldReConnectOnVisible = false
|
||||
connectService(shouldConnectSilently = true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop(owner: LifecycleOwner) {
|
||||
super.onStop(owner)
|
||||
|
||||
mIsAppVisible = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user