package Ġcom . ray w ender lich . guard post Ċ Ċ import Ġandroid . content . Broadcast Receiver Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġcom . ray w ender lich . guard post . data . SSO User Ċ Ċ class ĠGuard post Auth Receiver ( ĊĠ Ġprivate Ġval Ġ_ login : ĠMutable LiveData < SSO User > Ġ= ĠMutable LiveData (), ĊĠ Ġprivate Ġval Ġ_ logout : ĠMutable LiveData < Boolean > Ġ= ĠMutable LiveData (), ĊĠ Ġprivate Ġval Ġ_ error : ĠMutable LiveData < Int > Ġ= ĠMutable LiveData (), ĊĠ Ġval Ġlogin : ĠLive Data < SSO User > Ġ= Ġ_ login , ĊĠ Ġval Ġlogout : ĠLive Data < Boolean > Ġ= Ġ_ logout , ĊĠ Ġval Ġerror : ĠLive Data < Int > Ġ= Ġ_ error Ċ ) Ġ: ĠBroadcast Receiver () Ġ{ ĊĊĠ Ġoverride Ġfun Ġon Receive ( context : ĠContext ?, Ġintent : ĠIntent ?) Ġ{ ĊĠĠĠ Ġif Ġ( null Ġ== Ġintent ) Ġ{ ĊĠĠĠĠĠ Ġ_ error . post Value ( Guard post Auth . Auth Errors . INVALID _ RESPONSE ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġwhen Ġ( intent ?. action ) Ġ{ ĊĠĠĠĠĠ ĠGuard post Auth . Broadcast Actions . LOGIN _ SUCCESS Ġ-> ĊĠĠĠĠĠĠĠ Ġ_ login . post Value ( intent . get Parcelable Extra ( Redirect Activity . EXTRA _ RESULT )) ĊĠĠĠĠĠ ĠGuard post Auth . Broadcast Actions . LOGIN _ FAILURE Ġ-> ĊĠĠĠĠĠĠĠ Ġ_ error . post Value ( Guard post Auth . Auth Errors . INVALID _ RESPONSE ) ĊĠĠĠĠĠ ĠGuard post Auth . Broadcast Actions . LOG OUT _ SUCCESS Ġ-> ĊĠĠĠĠĠĠĠ Ġ_ logout . post Value ( true ) ĊĠĠĠĠĠ ĠGuard post Auth . Broadcast Actions . FAILURE Ġ-> ĊĠĠĠĠĠĠĠ Ġ_ error . post Value ( ĊĠĠĠĠĠĠĠĠĠ Ġintent . getInt Extra ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRedirect Activity . EXTRA _ RESULT , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠGuard post Auth . Auth Errors . INVALID _ RESPONSE ĊĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ