优化
This commit is contained in:
1 parent
d691e66c0f
commit
128595a7e2
1 file changed
+2
-2
@@ -65,11 +65,11 @@ abstract class BaseAssociationViewModel(application: Application) : BaseViewMode
|
|||||||
if (json.isJsonArray()) {
|
if (json.isJsonArray()) {
|
||||||
GSON.fromJsonArray<ThemeConfig.Config>(json).getOrThrow()?.forEach {
|
GSON.fromJsonArray<ThemeConfig.Config>(json).getOrThrow()?.forEach {
|
||||||
ThemeConfig.addConfig(it)
|
ThemeConfig.addConfig(it)
|
||||||
} ?: throw NoStackTraceException("格式不对")
|
}
|
||||||
} else {
|
} else {
|
||||||
GSON.fromJsonObject<ThemeConfig.Config>(json).getOrThrow()?.let {
|
GSON.fromJsonObject<ThemeConfig.Config>(json).getOrThrow()?.let {
|
||||||
ThemeConfig.addConfig(it)
|
ThemeConfig.addConfig(it)
|
||||||
} ?: throw NoStackTraceException("格式不对")
|
}
|
||||||
}
|
}
|
||||||
}.onSuccess {
|
}.onSuccess {
|
||||||
finally.invoke(context.getString(R.string.success), "导入主题成功")
|
finally.invoke(context.getString(R.string.success), "导入主题成功")
|
||||||
|
|||||||
Reference in new issue
Block a user