@file:OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)

package com.example.testdemo

import kotlinx.cinterop.ExperimentalForeignApi
import kotlin.experimental.ExperimentalNativeApi
import com.example.arith.Arith

// 既然去掉了 Compose，我们先通过 NAPI 返回一个简单的标识，证明 Kotlin 代码已成功运行
@CName("getKotlinGreeting")
fun getKotlinGreeting(): String {
    return Greeting().greet() + " (HarmonyOS Native)"
}

@CName("getKotlinUiText")
fun getKotlinUiText(): String = ohosUiText()

fun ohosUiText(): String {
    val base = appInfo()
    val add = Arith.add(7, 3)
    val sub = Arith.sub(7, 3)
    return "$base\nAdd is $add, Sub is $sub"
}
