/** Ċ * ĠCopyright ĠS or am its u ĠCo ., ĠLtd . ĠAll ĠRights ĠReserved . Ċ * ĠSPDX - License - Identifier : ĠGPL - 3 . 0 Ċ */ Ċ Ċ package Ġjp . co . sor am its u . feature _ wallet _ impl . presentation . pol kas wap Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġjp . co . sor am its u . common . presentation . Single Live Event Ċ import Ġjp . co . sor am its u . common . presentation . view model . Base ViewModel Ċ import Ġjp . co . sor am its u . feature _ wallet _ api . domain . interfaces . Pol kas wap Interactor Ċ import Ġjp . co . sor am its u . feature _ wallet _ api . domain . model . Market Ċ import Ġjp . co . sor am its u . feature _ wallet _ api . launcher . Wallet Router Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠPol ka Swap ViewModel ( ĊĠĠĠ Ġprivate Ġval Ġrouter : ĠWallet Router , ĊĠĠĠ Ġprivate Ġval Ġpol kas wap Interactor : ĠPol kas wap Interactor , Ċ ) Ġ: ĠBase ViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ selected Market LiveData Ġ= ĠMutable LiveData < Market >() ĊĠĠĠ Ġval Ġselected Market LiveData : ĠLive Data < Market > Ġ= Ġ_ selected Market LiveData ĊĊĠĠĠ Ġprivate Ġval Ġ_ market List LiveData Ġ= ĠSingle Live Event < Pair < List < Market >, ĠMarket >>() ĊĠĠĠ Ġval Ġmarket List LiveData : ĠLive Data < Pair < List < Market >, ĠMarket >> Ġ= Ġ_ market List LiveData ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ selected Market LiveData . value Ġ= ĠMarket . SM ART ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġmarket Clicked ( market : ĠMarket ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ selected Market LiveData . value Ġ= Ġmarket ĊĠĠĠĠĠĠĠ Ġpol kas wap Interactor . set Swap Market ( market ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġmarket Settings Clicked () Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtry Catch Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmark ets Ġ= Ġpol kas wap Interactor . get Available Sources () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( mark ets . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ_ market List LiveData . value Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmark ets Ġto Ġ(_ selected Market LiveData . value Ġ?: ĠMarket . SM ART ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġback Pressed () Ġ{ ĊĠĠĠĠĠĠĠ Ġrouter . pop Back Stack Fragment () ĊĠĠĠ Ġ} Ċ } Ċ