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.bill_it.common.auth | |
import com.codingwitharul.bill_it.common.model.GoogleUser | |
import com.codingwitharul.bill_it.data.networking.ApiClientHelper | |
import com.codingwitharul.bill_it.utils.toThrowable | |
import io.ktor.http.* | |
import io.ktor.server.cio.* | |
import io.ktor.server.engine.* | |
import io.ktor.client.request.* | |
import io.ktor.client.statement.* |
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.bill_it.common.auth | |
import androidx.compose.runtime.Composable | |
actual class GoogleAuthProvider(val oauth: GoogleOAuthDesktop) { | |
@Composable | |
actual fun getUiProvider(): GoogleAuthenticator { | |
return GoogleAuthenticator(oauth) | |
} |
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.bill_it.common.auth | |
import androidx.compose.runtime.Composable | |
actual class GoogleAuthProvider() { | |
@Composable | |
actual fun getUiProvider(): GoogleAuthenticator = GoogleAuthenticator() | |
actual suspend fun signOut() { |
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.bill_it.common.auth | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.platform.LocalContext | |
import androidx.credentials.CredentialManager | |
import com.google.firebase.auth.FirebaseAuth | |
actual class GoogleAuthProvider(val credentialManager: CredentialManager) { | |
@Composable | |
actual fun getUiProvider(): GoogleAuthenticator { |
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.bill_it.common.auth | |
import androidx.compose.runtime.Composable | |
import com.codingwitharul.bill_it.common.auth.GoogleAuthenticator | |
expect class GoogleAuthProvider { | |
@Composable | |
fun getUiProvider(): GoogleAuthenticator |
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
@Preview | |
@Composable | |
fun ImageCaptureView(onImageCaptured: (Path?) -> Unit, onClose: () -> Unit = {}) { | |
val scope = rememberCoroutineScope() | |
val callback = remember { | |
object : CameraCallback() { | |
override fun onCaptureImage(image: Path?, error: String?) { | |
showToast("Image Captured $image") | |
onImageCaptured(image) |
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
@OptIn(ExperimentalForeignApi::class) | |
@Composable | |
actual fun CameraView(callback: CameraCallback) { | |
val session = AVCaptureSession() | |
session.sessionPreset = AVCaptureSessionPresetPhoto | |
val output = AVCaptureStillImageOutput().apply { | |
outputSettings = mapOf(AVVideoCodecKey to platform.AVFoundation.AVVideoCodecJPEG) | |
} | |
session.addOutput(output) | |
val cameraPreviewLayer = AVCaptureVideoPreviewLayer(session = session) |
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 |
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.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 |
NewerOlder