package Ġat . r tr . r mb t . android . ui . activity Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . databinding . Data Binding Util Ċ import Ġandroidx . lifecycle . lifecycle Scope Ċ import Ġat . r tr . r mb t . android . R Ċ import Ġat . r tr . r mb t . android . databinding . Activity Permissions Binding Ċ import Ġat . r tr . r mb t . android . di . viewModel Lazy Ċ import Ġat . r tr . r mb t . android . ui . fragment . Permissions Accuracy Fragment Ċ import Ġat . r tr . r mb t . android . ui . fragment . Permissions Analytics Fragment Ċ import Ġat . r tr . r mb t . android . ui . fragment . Permissions ClientId Fragment Ċ import Ġat . r tr . r mb t . android . ui . fragment . Permissions Signal Fragment Ċ import Ġat . r tr . r mb t . android . ui . fragment . Permissions Welcome Fragment Ċ import Ġat . r tr . r mb t . android . view model . Permissions Page Ċ import Ġat . r tr . r mb t . android . view model . Permissions ViewModel Ċ import Ġkotlinx . coroutines . flow . launch In Ċ import Ġkotlinx . coroutines . flow . map Ċ import Ġkotlinx . coroutines . flow . receive As Flow Ċ Ċ class ĠPermissions Activity Ġ: ĠBase Activity () Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġbinding : ĠActivity Permissions Binding ĊĠĠĠ Ġprivate Ġval ĠviewModel : ĠPermissions ViewModel Ġby ĠviewModel Lazy () ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġbinding Ġ= ĠData Binding Util . set ContentView ( this , ĠR . layout . activity _ permissions ) ĊĊĠĠĠĠĠĠĠ Ġsupport FragmentManager . beginTransaction (). replace ( binding . container . id , Ġget ( Permissions Page . W EL CO ME ), ĠPermissions Page . W EL CO ME . toString ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. commit Allow ing State Loss () ĊĊĠĠĠĠĠĠĠ ĠviewModel . permissions Page Channel . receive As Flow (). map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsupport FragmentManager . beginTransaction (). replace ( binding . container . id , Ġget ( it ), Ġit . toString ()). commit Allow ing State Loss () ĊĠĠĠĠĠĠĠ Ġ}. launch In ( lifecycle Scope ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . flow Completed Channel . receive As Flow (). map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠviewModel . permissions W ere Ask ed () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfinish Affinity () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠHome Activity . start ( this ) ĊĠĠĠĠĠĠĠ Ġ}. launch In ( lifecycle Scope ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġon Back Pressed () Ġ{ ĊĠĠĠĠĠĠĠ Ġfinish () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġget ( page : ĠPermissions Page ) Ġ= Ġwhen Ġ( page ) Ġ{ ĊĠĠĠĠĠĠĠ ĠPermissions Page . AC CUR ACY Ġ-> ĠPermissions Accuracy Fragment . newInstance () ĊĠĠĠĠĠĠĠ ĠPermissions Page . SIGNAL Ġ-> ĠPermissions Signal Fragment . newInstance () ĊĠĠĠĠĠĠĠ ĠPermissions Page . ANAL YT ICS Ġ-> ĠPermissions Analytics Fragment . newInstance () ĊĠĠĠĠĠĠĠ ĠPermissions Page . CLIENT _ ID Ġ-> ĠPermissions ClientId Fragment . newInstance () ĊĠĠĠĠĠĠĠ Ġelse Ġ-> ĠPermissions Welcome Fragment . newInstance () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠREQUEST _ CODE _ AC CUR ACY Ġ= Ġ 1 1 0 3 ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠREQUEST _ CODE _ SIGNAL Ġ= Ġ 1 1 0 4 ĊĊĠĠĠĠĠĠĠ Ġfun Ġstart ( context : ĠContext ) Ġ= Ġcontext . startActivity ( Intent ( context , ĠPermissions Activity :: class . java ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġflags Ġ= ĠIntent . FLAG _ ACTIVITY _ CLEAR _ TASK Ġor ĠIntent . FLAG _ ACTIVITY _ NEW _ TASK ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} Ċ }