| ba4a92bd | 21-Aug-2023 |
Łukasz Kosmaty <[email protected]> |
[core][Android] Add function builders (#24022)
# Why
Adds a sync function builder and extends the capability of the async function builder.
# How
In the public version of `expo-modules-cor
[core][Android] Add function builders (#24022)
# Why
Adds a sync function builder and extends the capability of the async function builder.
# How
In the public version of `expo-modules-core`, we use an async builder to export suspendable functions. However, we cannot decorate exported functions, and the concept of function builder can help here. For example, if we want to check if the user granted permissions in each function call, we must do it imperatively. I would like to add a more declarative approach. So I've extended the capability of correct function builders implementation to allow such an approach in the future.
With that change, syntaxes like this are possible:
```kotlin
AsyncFunction("getReadPermissionAsync") With Manifest.permission.READ_EXTERNAL_STORAGE Permission { status: Int ->
}
```
```kotlin
AsyncFunction("getReadPermissionAsync")
.With(Manifest.permission.READ_EXTERNAL_STORAGE)
.Permission { status: Int ->
}
```
# Test Plan
- bare-expo ✅
show more ...
|