package com.abbidot.tracker.deprecated.ui.fragment.vm

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.abbidot.tracker.base.BaseFragment
import kotlinx.coroutines.launch

/**
 *Created  by .yzq on 2021/11/8/008.
 * @link
 * @description: HomeViewModel
 */
class HomeViewModel : ViewModel() {
    fun getData() {
        viewModelScope.launch {
//            MyDatabase.deviceDao().insert(listOf(
//                    DeviceBean(5, 4, "tesdfd", conState = ConState.CONNECTED, "7547sgdgdgy64e4r"),
//                    DeviceBean(3, 2, "65757", conState = ConState.DISCONNECTED, "gujghj"),
//                    DeviceBean()))
        }

    }


//    var userInfo = MutableLiveData<GeocodeAddressBean>()
    /**
     * 根据经纬度获取地址
     */
    fun getAddress(fragment: BaseFragment<*>, latitude: Double, longitude: Double){
        viewModelScope.launch {
            val latlng = "$latitude,$longitude"
            val fields = "formatted_address,name,rating,geometry"
            val key = "你的Key"
//            RetrofitManger.getApiService().getAddress(
//                    latlng, "zh", fields, key
//            ).putValue2Data(GeocodeAddressBean::class.java,userInfo)
        }
    }
}