All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.net.iriscan.sdk.BiometricSdkFactory.kt Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
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
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy