package Ġcom . ben . bug tracker client . view Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . lifecycle . lifecycle Scope Ċ import Ġandroidx . view binding . View Binding Ċ import Ġcom . ben . bug tracker client . model . Custom Response Ċ import Ġcom . ben . bug tracker client . network . Bug Tracker Network Ċ import Ġcom . ben . bug tracker client . network . User Preference Ċ import Ġcom . ben . bug tracker client . repository . Base Repository Ċ import Ġcom . ben . bug tracker client . view model . factory . ViewModel Factory Ċ import Ġkotlinx . coroutines . flow . first Ċ import Ġkotlinx . coroutines . launch Ċ import Ġokhttp 3 . ResponseBody Ċ import Ġkotlin . reflect . K Class Ċ Ċ abstract Ġclass ĠBase Fragment < VM : ĠViewModel , ĠVB : ĠView Binding , ĠR : ĠBase Repository >: ĠFragment () Ġ{ ĊĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġuser Preference : ĠUser Preference ĊĠĠĠ Ġprotected Ġlateinit Ġvar Ġbinding : ĠVB ĊĠĠĠ Ġprotected Ġlateinit Ġvar ĠviewModel : ĠVM ĊĠĠĠ Ġprotected Ġval Ġbug Tracker Network Ġ= ĠBug Tracker Network ĊĊĊĠĠĠ Ġoverride Ġfun ĠonCreate View ( ĊĠĠĠĠĠĠĠ Ġinflater : ĠLayoutInflater , ĊĠĠĠĠĠĠĠ Ġcontainer : ĠViewGroup ?, ĊĠĠĠĠĠĠĠ ĠsavedInstanceState : ĠBundle ? ĊĠĠĠ Ġ): ĠView ? Ġ{ ĊĠĠĠĠĠĠĠ Ġuser Preference Ġ= ĠUser Preference ( require Context ()) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= Ġon Bind Fragment ( in flater , Ġcontainer , ĠsavedInstanceState ) ĊĠĠĠĠĠĠĠ Ġval ĠviewModel Factory Ġ= ĠViewModel Factory ( on Bind Repository ()) ĊĠĠĠĠĠĠĠ ĠviewModel Ġ= ĠViewModel Provider ( this , ĠviewModel Factory ). get ( on Bind ViewModel ()) ĊĠĠĠĠĠĠĠ Ġlifecycle Scope . launch When Started Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuser Preference . accessToken Flow . first () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġbinding . root ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġinline Ġfun Ġ< re ified ĠC > Ġon Convert Body ToJson ( response Body : ĠResponse Body ): ĠC ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġbug Tracker Network . gson . fromJson ( response Body . string (), ĠC :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġabstract Ġfun Ġon Bind Fragment ( in flater : ĠLayoutInflater , Ġcontainer : ĠViewGroup ?, ĠsavedInstanceState : ĠBundle ?): ĠVB ĊĠĠĠ Ġabstract Ġfun Ġon Bind ViewModel (): ĠClass < VM > ĊĠĠĠ Ġabstract Ġfun Ġon Bind Repository (): ĠR Ċ }