///
/// metamask_nativeutilsOnLoad.kt
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///

package com.margelo.nitro.metamask.nativeutils

import android.util.Log

internal class metamask_nativeutilsOnLoad {
  companion object {
    private const val TAG = "metamask_nativeutilsOnLoad"
    private var didLoad = false
    /**
     * Initializes the native part of "metamask_nativeutils".
     * This method is idempotent and can be called more than once.
     */
    @JvmStatic
    fun initializeNative() {
      if (didLoad) return
      try {
        Log.i(TAG, "Loading metamask_nativeutils C++ library...")
        System.loadLibrary("metamask_nativeutils")
        Log.i(TAG, "Successfully loaded metamask_nativeutils C++ library!")
        didLoad = true
      } catch (e: Error) {
        Log.e(TAG, "Failed to load metamask_nativeutils C++ library! Is it properly installed and linked? " +
                    "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
        throw e
      }
    }
  }
}
