wetherinfo 로그

This commit is contained in:
JUNGGWAN KIM 2024-09-23 17:41:01 +09:00
parent f3111e84f9
commit 798c6ce27f

View File

@ -7,6 +7,9 @@ import androidx.work.WorkerParameters
import com.google.android.gms.location.LocationServices
import com.google.android.gms.location.Priority
import com.google.android.gms.tasks.CancellationTokenSource
import io.realm.kotlin.Realm
import io.realm.kotlin.RealmConfiguration
import io.realm.kotlin.types.TypedRealmObject
import rasel.lunar.launcher.model.WeatherInfo
import rasel.lunar.launcher.utils.BLog
import retrofit2.Call
@ -16,7 +19,7 @@ import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.create
import retrofit2.http.GET
import retrofit2.http.Path
import kotlin.reflect.KClass
class OpenWeatherGetter : BaseGetter {
companion object {
@ -36,7 +39,12 @@ class OpenWeatherGetter : BaseGetter {
getWeather()
// 정형화된 정보를 취드하여 realm db에 저장 하자
val config = RealmConfiguration.create(
schema = setOf(OpenWeatherGetter::class) as Set<KClass<out TypedRealmObject>>
)
val realm = Realm.open(config)
realm.close()
return Result.success()
}
@ -70,7 +78,13 @@ class OpenWeatherGetter : BaseGetter {
call?.enqueue(object: Callback<WeatherInfo?> {
override fun onResponse(call: Call<WeatherInfo?>, response: Response<WeatherInfo?>) {
BLog.LOGE("Location error >>> $response")
BLog.LOGE("Location error >>> ${WeatherInfo().toString()}")
// 받아온 결과를 메모리에 올려놓고 처리할 클래스가 필요해
response.body()?.let {w->
BLog.LOGE("Location error >>> ${w.coord}}")
}
}
override fun onFailure(call: Call<WeatherInfo?>, t: Throwable) {