coroutinesmanager v1.2.0 Release Notes

Release Date: 2019-11-07 // over 4 years ago
  • 🔨 Many refactoring and changes

    • ICoroutinesManager : IAsyncTasksManager and you can call any async methods inside launchOnUI
      Example:

      class MyCoroutinesWorker : ICoroutinesManager {fun onRepeateButtonClickListener() = launchOnUITryCatchFinally( tryBlock = {val result = doTryCatchAsyncAwait( tryBlock = { println("----> ASYNC 'TRY' BLOCK") delay(3000L) "OPERATION COMPLETE" }, catchBlock = { println("----> ASYNC 'CATCH' BLOCK") throw it } ) }, catchBlock = { // Catch an Error on UI with it }, finallyBlock = { // final block }) }

    • lazy initialization of Dispatcher in CoroutinesProvider.kt

    • 0️⃣ default cancelationHandlersSet in CoroutinesProvider.kt and ICoroutinesManager can handle cancelation too

    • val ICoroutinesManager.isCancelled: Boolean and val ICoroutinesManager.isCompleted: Boolean

    • 👷 fun ICoroutinesManager.cancelAllCoroutines() - cancel all coroutines with async and UI jobs

    • replace var wasCancelled: Boolean from IAsyncTasksManager.kt by val IAsyncTasksManager.isCancelled: Boolean

    You can launch async task without calling launchOnUI with new functions:

    • launchOnUIAsyncAwait
    • launchOnUITryCatchAsyncAwait
    • launchOnUITryCatchFinallyAsyncAwait
    • launchOnUITryFinallyAsyncAwait
      👷 Block try always will be called on Async Job

    📚 Documentation added and example changed
    🍱 ❤️ Coroutines