package Ġcom . adam k ob us . compose . navigation . demo . ui . cat details Ċ Ċ import Ġandroidx . compose . runtime . mutable State Of Ċ import Ġcom . adam k ob us . android . vm . Lifecycle Aware ViewModel Ċ import Ġcom . adam k ob us . android . vm . View Param Ċ import Ġcom . adam k ob us . compose . navigation . Navigation Consumer Ċ import Ġcom . adam k ob us . compose . navigation . demo . ui . app bar . Animated AppBar State Ċ import Ġcom . adam k ob us . compose . navigation . demo . ui . app bar . AppBar Icon State Ċ import Ġcom . adam k ob us . compose . navigation . demo . ui . app bar . AppBar State Source Ċ import Ġcom . adam k ob us . compose . navigation . demo . ui . app bar . AppBar Title State Ċ import Ġcom . adam k ob us . compose . navigation . demo . ui . cats . R Ċ import Ġcom . adam k ob us . compose . navigation . demo . ui . nav . C ats Browser Graph Ċ import Ġcom . adam k ob us . compose . navigation . demo core . data . Cat Info Ċ import Ġcom . adam k ob us . compose . navigation . demo core . model . C ats Source Ċ import Ġcom . adam k ob us . compose . navigation . demo core . util . Async Data Ċ import Ġdagger . h ilt . android . lifecycle . H ilt ViewModel Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġjavax . inject . Inject Ċ Ċ @ Opt In ( Experimental Cor outines Api :: class ) Ċ @ H ilt ViewModel Ċ class ĠCat Details Screen VM Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġcats Source : ĠC ats Source , ĊĠĠĠ Ġprivate Ġval Ġnavigation Consumer : ĠNavigation Consumer , ĊĠĠĠ Ġprivate Ġval Ġapp Bar State Source : ĠApp Bar State Source Ċ ) Ġ: ĠLifecycle Aware ViewModel () Ġ{ ĊĊĠĠĠ Ġval Ġcat Id Param Ġ= ĠView Param < Int >() ĊĊĠĠĠ Ġprivate Ġval Ġcat Info Ġ= Ġmutable State Of < Async Data < Cat Info , ĠThrowable >>( Async Data . Loading ()) ĊĠĠĠ Ġval Ġscreen State Ġ= ĠCat Details Screen State ( ĊĠĠĠĠĠĠĠ Ġcat Info Ġ= Ġcat Info ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġval Ġapp Bar State Ġ= ĠAnimated AppBar State ( ĊĠĠĠĠĠĠĠ Ġtitle State Ġ= ĠApp Bar Title State ( title Res Id Ġ= ĠR . string . cat _ details _ title ), ĊĠĠĠĠĠĠĠ Ġicon State Ġ= ĠApp Bar Icon State . back Ġ{ Ġon Back Pressed () Ġ} ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġfun Ġon Back Pressed () Ġ{ ĊĠĠĠĠĠĠĠ Ġnavigation Consumer . offer ( C ats Browser Graph . Cat Details . pop ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġrun On Start Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapp Bar State Source . offer ( app Bar State ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġrun On Start Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcat Id Param . observe (). collect Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcat Info . value Ġ= ĠAsync Data . Present ( cats Source . getC at ( it )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIllegalArgumentException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcat Info . value Ġ= ĠAsync Data . Missing ( e ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ