This file contains hidden or 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.codingwitharul.bookmyslot.data.networking.models | |
import kotlinx.serialization.SerialName | |
import kotlinx.serialization.Serializable | |
sealed class ApiResponse<out T, out E> { | |
/** | |
* Represents successful network responses (2xx). | |
*/ |
This file contains hidden or 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.codingwitharul.bookmyslot.data.networking | |
internal object Constants { | |
const val HOST = "https://642d737e66a20ec9ce9de798.mockapi.io/api/v1/" | |
} | |
internal object EndPoints { | |
const val Auth = "auth" | |
} |
This file contains hidden or 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.codingwitharul.bookmyslot.data.networking | |
import com.codingwitharul.bookmyslot.common.httpClient | |
import com.codingwitharul.bookmyslot.data.db.DatabaseHelper | |
import com.codingwitharul.bookmyslot.db.UserInfo | |
import com.codingwitharul.bookmyslot.data.networking.models.ApiResponse | |
import io.github.aakira.napier.Napier | |
import io.ktor.client.HttpClient | |
import io.ktor.client.call.body | |
import io.ktor.client.plugins.ClientRequestException |
This file contains hidden or 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.codingwitharul.bookmyslot.common | |
import io.ktor.client.HttpClient | |
import io.ktor.client.HttpClientConfig | |
expect fun httpClient(config: HttpClientConfig<*>.() -> Unit = {}): HttpClient |
This file contains hidden or 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.codingwitharul.bookmyslot.common | |
import io.ktor.client.HttpClient | |
import io.ktor.client.HttpClientConfig | |
import io.ktor.client.engine.okhttp.OkHttp | |
import io.ktor.client.plugins.HttpTimeout | |
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | |
import io.ktor.client.plugins.defaultRequest | |
import io.ktor.client.request.header | |
import io.ktor.serialization.kotlinx.json.json |
This file contains hidden or 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.codingwitharul.bookmyslot.common | |
import io.ktor.client.HttpClient | |
import io.ktor.client.HttpClientConfig | |
import io.ktor.client.engine.darwin.Darwin | |
import io.ktor.client.plugins.HttpTimeout | |
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | |
import io.ktor.client.plugins.defaultRequest | |
import io.ktor.client.request.header | |
import io.ktor.serialization.kotlinx.json.json |
This file contains hidden or 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.codingwitharul.bookmyslot.data.repo | |
import com.codingwitharul.bookmyslot.data.db.DatabaseHelper | |
import com.codingwitharul.bookmyslot.data.networking.ApiClientHelper | |
import com.codingwitharul.bookmyslot.data.networking.EndPoints | |
import com.codingwitharul.bookmyslot.data.networking.apiEndPoint | |
import com.codingwitharul.bookmyslot.data.networking.models.ApiResponse | |
import com.codingwitharul.bookmyslot.data.networking.models.ErrorType | |
import com.codingwitharul.bookmyslot.data.networking.models.getErrorData | |
import com.codingwitharul.bookmyslot.data.networking.safeRequest |
This file contains hidden or 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
sealed class CameraEvent { | |
object Init : CameraEvent() | |
object CaptureImage : CameraEvent() | |
object SwitchCamera : CameraEvent() | |
} | |
abstract class CameraCallback { | |
private val _event = Channel<CameraEvent>() | |
val eventFlow: Flow<CameraEvent> get() = _event.receiveAsFlow() | |
suspend fun sendEvent(event: CameraEvent) { |
This file contains hidden or 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.codingwitharul.bookmyslot.common | |
import android.content.Context | |
import android.net.Uri | |
import android.util.Log | |
import androidx.camera.core.CameraSelector | |
import androidx.camera.core.ImageCapture | |
import androidx.camera.core.ImageCapture.OutputFileOptions.Builder | |
import androidx.camera.core.ImageCaptureException | |
import androidx.camera.core.Preview |
OlderNewer