package Ġio . github . d roid ka igi . conf sched 2 0 1 9 . staff . ui . store Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . action . Action Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . dispatcher . Dispatcher Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . ext . to LiveData Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . model . Loading State Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . model . Staff Contents Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . model . Staff SearchResult Ċ import Ġio . github . d roid ka igi . conf sched 2 0 1 9 . store . Store Ċ import Ġkotlinx . coroutines . channels . map Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠStaff Search Store Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġdispatcher : ĠDispatcher Ċ ) Ġ: ĠStore () Ġ{ ĊĠĠĠ Ġval Ġquery Ġget () Ġ= Ġsearch Result . value ?. query ĊĊĠĠĠ Ġval Ġloading State : ĠLive Data < Loading State > Ġ= Ġdispatcher ĊĠĠĠĠĠĠĠ Ġ. subscribe < Action . Staff Search Loading StateChanged >() ĊĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . loading State Ġ} ĊĠĠĠĠĠĠĠ Ġ. to LiveData ( this , ĠLoading State . LOADING ) ĊĠĠĠ Ġval Ġsearch Result Ġ= Ġdispatcher ĊĠĠĠĠĠĠĠ Ġ. subscribe < Action . Staff SearchResult Loaded >() ĊĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . search Result Ġ} ĊĠĠĠĠĠĠĠ Ġ. to LiveData ( this , ĠStaff SearchResult . EMPTY ) ĊĠĠĠ Ġval Ġstaff Contents Ġ= Ġdispatcher ĊĠĠĠĠĠĠĠ Ġ. subscribe < Action . Staff Loaded >() ĊĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġit . staff Contents Ġ} ĊĠĠĠĠĠĠĠ Ġ. to LiveData ( this , ĠStaff Contents . EMPTY ) Ċ } Ċ