package com.dynamsoft.reactnativelib.license import android.annotation.SuppressLint import com.dynamsoft.license.LicenseManager import com.dynamsoft.license.bean.InnerData import com.facebook.react.bridge.Promise import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactMethod class LicenseModuleImpl(private val reactContext: ReactApplicationContext) { companion object { const val NAME = "DynamsoftLicenseModule" } fun getName() = NAME @ReactMethod fun initLicense(license: String?, promise: Promise) { @SuppressLint("RestrictedApi") InnerData.remark.edition = "android-react-native" LicenseManager.initLicense(license) { isSuccessful, error -> if (isSuccessful) { promise.resolve(true) } else { promise.reject(error?.message?:"InitLicense failed.", error) } } } @ReactMethod fun setDeviceFriendlyName(deviceFriendlyName: String) { LicenseManager.setDeviceFriendlyName(deviceFriendlyName) } @ReactMethod fun getDeviceUUID(promise: Promise) { promise.resolve(LicenseManager.getDeviceUUID()) } }