mapbox / mapbox/mapbox-navigation-android
Generate suspend functions
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
In some contributions, we started adding ad-hoc `suspend` functions next to equivalents that take a callback as an argument. This is to simplify integration for Kotlin users, however, there is currently no consistency to how those functions are named or exposed, and shipping both increases maintenance needs.
To simplify the development process and ensure consistency across the SDK, we should build a simple generator that for each callback-based method will also provide a `suspend` function. We could leverage annotation processors and libraries like [`KotlinPoet`](https://github.com/square/kotlinpoet) to generate extension function files that expose `suspend` functions for each annotated callback function.
In the interim, we should limit direct exposure of `suspend` functions and only place them in `internal` packages or annotate with the `Experimental` compiler flag otherwise so that we can safely stabilize the concept either before or after going GA.
/cc @mapbox/navigation-android
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing ad-hoc suspend functions and their callback-based equivalents in the Android SDK, then assess annotation processors and KotlinPoet for generating extension function files. Done means callback methods consistently expose generated suspend functions while direct exposure remains limited to internal packages or uses the Experimental compiler flag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system, mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100