Package 

Class FlushWorker


  • 
    public final class FlushWorker
    
                        

    Watches for connectivity changes and flushes any cached requests using the provided networkExecutor. Caches requests using JSON Lines format.

    • Method Summary

      Modifier and Type Method Description
      final Unit start() Start listening and attempt an immediate flush on init.
      final Unit stop() Stop the periodic flush timer.
      final Unit cacheRequest(CachedRequest req) Append a failed request to the cache file as a single JSON line.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FlushWorker

        FlushWorker(Context context, SuspendFunction3<String, String, String, String> networkExecutor)
        Parameters:
        context - application context
        networkExecutor - a suspend func taking (method, route, jsonData) -> responseString?
    • Method Detail

      • start

        @RequiresPermission(value = android.permission.ACCESS_NETWORK_STATE) final Unit start()

        Start listening and attempt an immediate flush on init.

      • stop

         final Unit stop()

        Stop the periodic flush timer.