<commit_before>package com.petrulak.cleankotlin.ui.example1.fragment

import com.petrulak.cleankotlin.di.scope.ViewScope
import com.petrulak.cleankotlin.domain.interactor.GetWeatherUseCase
import com.petrulak.cleankotlin.domain.model.Weather
import com.petrulak.cleankotlin.ui.example1.fragment.Example1Contract.View
import dagger.internal.Preconditions.checkNotNull
import timber.log.Timber
import javax.inject.Inject

@ViewScope
class Example1Presenter
@Inject
constructor(
    private val getWeather: GetWeatherUseCase) : Example1Contract.Presenter {

    private var view: View? = null

    override fun attachView(view: View) {
        this.view = checkNotNull(view)
    }

    override fun start() {
        refresh()
    }

    override fun stop() {
        getWeather.dispose()
    }

    override fun refresh() {
        getWeather.dispose() //clear older disposables
        getWeather.execute({ onWeatherSuccess(it) }, { Timber.e(it) }, "London,uk")
        /* In case you are not interested in errors, use: getWeather.execute({ view?.showWeather(it) }, params = "London,uk") */
    }

    private fun onWeatherSuccess(item: Weather) {
        Timber.e("visibility ${item.visibility}")
        view?.showWeather(item)
    }
}<commit_msg>Some leftovers to remove.<commit_after>package com.petrulak.cleankotlin.ui.example1.fragment

import com.petrulak.cleankotlin.di.scope.ViewScope
import com.petrulak.cleankotlin.domain.interactor.GetWeatherUseCase
import com.petrulak.cleankotlin.domain.model.Weather
import com.petrulak.cleankotlin.ui.example1.fragment.Example1Contract.View
import dagger.internal.Preconditions.checkNotNull
import timber.log.Timber
import javax.inject.Inject

@ViewScope
class Example1Presenter
@Inject
constructor(
    private val getWeather: GetWeatherUseCase) : Example1Contract.Presenter {

    private var view: View? = null

    override fun attachView(view: View) {
        this.view = checkNotNull(view)
    }

    override fun start() {
        refresh()
    }

    override fun stop() {
        getWeather.dispose()
    }

    override fun refresh() {
        getWeather.dispose() //clear older disposables
        getWeather.execute({ onWeatherSuccess(it) }, { Timber.e(it) }, "London,uk")
        /* In case you are not interested in errors, use: getWeather.execute({ view?.showWeather(it) }, params = "London,uk") instead */
    }

    private fun onWeatherSuccess(item: Weather) {
        view?.showWeather(item)
    }
}
{'fraction_non_alphanumeric': 0.10624493106244931, 'fraction_numerical': 0.0040551500405515, 'mean_word_length': 3.6901140684410647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7063287', 'n_tokens_mistral': 785, 'n_tokens_neox': 766, 'n_words': 154}