package Ġcom . ams . c av us . todo . list . view model Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . arch . lifecycle . Android ViewModel Ċ import Ġandroid . arch . lifecycle . Lifecycle Ċ import Ġandroid . arch . lifecycle . Lifecycle Observer Ċ import Ġandroid . arch . lifecycle . On Lifecycle Event Ċ import Ġcom . ams . c av us . todo . list . adapter . Generic Items Adapter Ċ import Ġcom . ams . c av us . todo . list . service . Generic Item Service Ċ import Ġcom . ams . c av us . todo . login . service . Azure Auth Service Ċ import Ġcom . example . am st odo . util . Single Live Event Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠGeneric Items ViewModel Ġ( app : ĠApplication ) Ġ: ĠAndroid ViewModel ( app ), ĠLifecycle Observer { ĊĊĠĠĠ Ġval Ġadapter Ġ= ĠGeneric Items Adapter () ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġauth Service : ĠAzure Auth Service ĊĊĠĠĠ Ġ@ Inject ĊĠĠĠ Ġlateinit Ġvar Ġgeneric Items Service : ĠGeneric Item Service ĊĊĠĠĠ Ġval Ġback To Login Event Ġ= ĠSingle Live Event < Unit >() ĊĊĠĠĠ Ġ@ On Lifecycle Event ( Lifecycle . Event . ON _ CREATE ) ĊĠĠĠ Ġfun ĠonCreate () Ġ{ ĊĠĠĠĠĠĠĠ Ġgeneric Items Service . fetch ( null ) Ġ{ Ġitems Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter . items Ġ= Ġitems ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadapter . notify DataSet Changed () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġon Sign Out () Ġ{ ĊĠĠĠĠĠĠĠ Ġauth Service . reset () ĊĠĠĠĠĠĠĠ Ġback To Login Event . call () ĊĠĠĠ Ġ} Ċ Ċ }