This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.myapplication | |
import android.content.pm.PackageManager | |
import androidx.activity.result.ActivityResultLauncher | |
import androidx.activity.result.contract.ActivityResultContracts | |
import androidx.core.app.ActivityCompat | |
import androidx.core.content.ContextCompat | |
import androidx.fragment.app.Fragment | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleObserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.presentation.splash | |
import androidx.lifecycle.ViewModel | |
import com.cleanarchitectkotlinflowhiltsimplestway.domain.SampleUseCase | |
import com.cleanarchitectkotlinflowhiltsimplestway.presentation.State | |
import com.cleanarchitectkotlinflowhiltsimplestway.utils.Utils | |
import dagger.hilt.android.lifecycle.HiltViewModel | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.flow | |
import javax.inject.Inject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.presentation.splash | |
import android.os.Bundle | |
import android.widget.TextView | |
import androidx.activity.viewModels | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.lifecycle.lifecycleScope | |
import com.cleanarchitectkotlinflowhiltsimplestway.R | |
import com.cleanarchitectkotlinflowhiltsimplestway.presentation.State | |
import dagger.hilt.android.AndroidEntryPoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.presentation | |
import android.app.Application | |
import dagger.hilt.android.HiltAndroidApp | |
@HiltAndroidApp | |
class App : Application() { | |
override fun onCreate() { | |
super.onCreate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.presentation | |
import org.json.JSONObject | |
import retrofit2.HttpException | |
open class NetworkErrorException( | |
val errorCode: Int = -1, | |
val errorMessage: String, | |
val response: String = "" | |
) : Exception() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.presentation | |
sealed class State<out T> { | |
object LoadingState : State<Nothing>() | |
data class ErrorState(var exception: Throwable) : State<Nothing>() | |
data class DataState<T>(var data: T) : State<T>() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.domain | |
import com.google.gson.JsonObject | |
import com.cleanarchitectkotlinflowhiltsimplestway.data.APIs | |
import javax.inject.Inject | |
class SampleUseCase @Inject constructor( | |
private val apIs: APIs | |
) { | |
suspend operator fun invoke(): JsonObject { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.data | |
import com.google.gson.JsonObject | |
import retrofit2.http.GET | |
interface APIs { | |
@GET("api/users") | |
suspend fun sampleGet(): JsonObject | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.utils | |
import android.content.Context | |
import com.cleanarchitectkotlinflowhiltsimplestway.data.APIs | |
import com.cleanarchitectkotlinflowhiltsimplestway.presentation.App | |
import com.google.gson.GsonBuilder | |
import dagger.Module | |
import dagger.Provides | |
import dagger.hilt.InstallIn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cleanarchitectkotlinflowhiltsimplestway.utils | |
import com.cleanarchitectkotlinflowhiltsimplestway.domain.AuthenticationException | |
import com.cleanarchitectkotlinflowhiltsimplestway.domain.NetworkErrorException | |
import com.cleanarchitectkotlinflowhiltsimplestway.domain.State | |
import retrofit2.HttpException | |
import java.net.ConnectException | |
import java.net.SocketTimeoutException | |
import java.net.UnknownHostException |
NewerOlder