-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
1.实现网络类
NetWorkViewModel 中可看出来 DemoApiService ,每请求一次需要create一次,这一块是可以不必要的
2.BaseViewModel 这个类会被业务多次集成,对应的Model也会重复写,引发网络处理多次重写代码
3.BaseViewModel里stateLiveData来对网络做一个标识,现在正在思考这个思路,单个请求可以这么玩,但是当多个请求的时候,对应结果集体输出,上层无法准确知道对应处理
目前优化了,
1.DemoApiService在AppApplication里init,静态单列,
2.BaseViewModel里增加公用ApiHelper 辅助类 集中处理结果
3.BaseViewModel 初始化ApiHelper对象 对应处理类持有BaseViewModel,即可使用stateLiveData
正在修改多网络请求结果问题
Metadata
Metadata
Assignees
Labels
No labels