feat(notification): implement Android and iOS APIs (#340)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-05 05:22:19 -07:00
committed by GitHub
parent 1397172e95
commit be1c775b8d
25 changed files with 3700 additions and 90 deletions
@@ -0,0 +1,25 @@
package app.tauri.notification
import android.annotation.SuppressLint
import android.content.Context
class AssetUtils {
companion object {
const val RESOURCE_ID_ZERO_VALUE = 0
@SuppressLint("DiscouragedApi")
fun getResourceID(context: Context, resourceName: String?, dir: String?): Int {
return context.resources.getIdentifier(resourceName, dir, context.packageName)
}
fun getResourceBaseName(resPath: String?): String? {
if (resPath == null) return null
if (resPath.contains("/")) {
return resPath.substring(resPath.lastIndexOf('/') + 1)
}
return if (resPath.contains(".")) {
resPath.substring(0, resPath.lastIndexOf('.'))
} else resPath
}
}
}