fix: 修复主页闪退
This commit is contained in:
parent
89d6497831
commit
f21e66fab6
|
|
@ -208,7 +208,10 @@ class MainForumListFragment : BaseFragment(), Refreshable, Toolbar.OnMenuItemCli
|
||||||
}
|
}
|
||||||
val workInfoLiveData =
|
val workInfoLiveData =
|
||||||
WorkManager.getInstance(attachContext).getWorkInfoByIdLiveData(id)
|
WorkManager.getInstance(attachContext).getWorkInfoByIdLiveData(id)
|
||||||
|
if (view != null) {
|
||||||
|
runCatching {
|
||||||
workInfoLiveData.observe(viewLifecycleOwner) {
|
workInfoLiveData.observe(viewLifecycleOwner) {
|
||||||
|
runCatching {
|
||||||
if (it == null) {
|
if (it == null) {
|
||||||
workInfoLiveData.removeObservers(viewLifecycleOwner)
|
workInfoLiveData.removeObservers(viewLifecycleOwner)
|
||||||
return@observe
|
return@observe
|
||||||
|
|
@ -216,6 +219,7 @@ class MainForumListFragment : BaseFragment(), Refreshable, Toolbar.OnMenuItemCli
|
||||||
if (it.progress.getBoolean(DATA_SUCCESS, false)) {
|
if (it.progress.getBoolean(DATA_SUCCESS, false)) {
|
||||||
workInfoLiveData.removeObservers(viewLifecycleOwner)
|
workInfoLiveData.removeObservers(viewLifecycleOwner)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (DateTimeUtils.isToday(
|
if (DateTimeUtils.isToday(
|
||||||
it.progress.getLong(
|
it.progress.getLong(
|
||||||
DATA_TIMESTAMP,
|
DATA_TIMESTAMP,
|
||||||
|
|
@ -226,6 +230,8 @@ class MainForumListFragment : BaseFragment(), Refreshable, Toolbar.OnMenuItemCli
|
||||||
okSignProgressData = it.progress
|
okSignProgressData = it.progress
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
okSignProgressData = null
|
okSignProgressData = null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue