commonMain.net.iriscan.sdk.BiometricSdkFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of biometric-sdk Show documentation
Show all versions of biometric-sdk Show documentation
Biometric SDK Kotlin Multiplatform library (android + ios)
package net.iriscan.sdk
import com.soywiz.korio.concurrent.atomic.korAtomic
import io.github.aakira.napier.DebugAntilog
import io.github.aakira.napier.Napier
import net.iriscan.sdk.io.ResourceIOFactory
/**
* @author Slava Gornostal
*/
object BiometricSdkFactory : BiometricSdk {
init {
Napier.base(DebugAntilog())
}
private val instanceRef = korAtomic(null)
override fun configBuilder(): BiometricSdkConfigBuilder = BiometricSdkConfigBuilder()
override fun initialize(config: BiometricSdkConfig) {
if (instanceRef.value != null) {
return
}
ResourceIOFactory.initialize(config.context)
this.instanceRef.compareAndSet(null, BiometricSdkOperationsImpl(config))
}
override fun getInstance(): BiometricSdkOperations? {
Napier.e("Biometric SDK is not ready. Initialize SDK by calling initialize(...)")
return instanceRef.value
}
}