riku
2020-08-21 0328eab9276e57487eb2cfff31a945a01dd8c73a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package cn.flightfeather.thirdapp.module.inspection
 
import android.arch.lifecycle.MutableLiveData
import cn.flightfeather.thirdapp.bean.Mediafile
import cn.flightfeather.thirdapp.bean.vo.GitlistVo
import cn.flightfeather.thirdapp.common.net.ResultCallBack
import cn.flightfeather.thirdapp.module.base.BaseViewModel
import cn.flightfeather.thirdapp.repository.InspectionRepository
import cn.flightfeather.thirdapp.repository.ProblemRepository
 
/**
 * @author riku
 * Date: 2019/8/2
 */
class MenuNewGitViewModel : BaseViewModel() {
 
    private val inspectionRepository = InspectionRepository()
    private val problemRepository = ProblemRepository()
 
    val gitList = MutableLiveData<ArrayList<GitlistVo>>().apply { value = ArrayList() }
 
    /**
     *
     */
    fun getGitList(inspectionId: String) {
        inspectionRepository.getGitList(inspectionId, object : ResultCallBack<List<GitlistVo>> {
            override fun onSuccess(result: List<GitlistVo>?) {
                result?.let {
                    gitList.value?.apply {
                        clear()
                        addAll(it)
                    }
 
                    gitList.value = gitList.value
                }
            }
 
            override fun onFailure() {
            }
 
        })
    }
 
    /**
     * 新增本地多媒体文件记录
     */
    fun putMediaFile(mediaFile: Mediafile) {
        problemRepository.putMediaFileLocal(mediaFile, object : ResultCallBack<Int> {
            override fun onSuccess(result: Int?) {
 
            }
 
            override fun onFailure() {
 
            }
 
        })
    }
 
}