package Ġio . nova foundation . nova . feature _ account _ impl . presentation . node . mixin . impl Ċ Ċ import Ġandroidx . lifecycle . as LiveData Ċ import Ġio . nova foundation . nova . common . resources . ResourceManager Ċ import Ġio . nova foundation . nova . core . model . Node Ċ import Ġio . nova foundation . nova . feature _ account _ api . domain . interfaces . Account Interactor Ċ import Ġio . nova foundation . nova . feature _ account _ impl . R Ċ import Ġio . nova foundation . nova . feature _ account _ impl . data . map pers . map Node To Node Model Ċ import Ġio . nova foundation . nova . feature _ account _ impl . presentation . node . mixin . api . Node Listing Mixin Ċ import Ġio . nova foundation . nova . feature _ account _ impl . presentation . node . model . Node Header Model Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . flow . flow On Ċ import Ġkotlinx . coroutines . flow . map Ċ Ċ class ĠNode Listing Provider ( ĊĠĠĠ Ġprivate Ġval Ġaccount Interactor : ĠAccount Interactor , ĊĠĠĠ Ġprivate Ġval Ġresource Manager : ĠResourceManager , Ċ ) Ġ: ĠNode Listing Mixin Ġ{ ĊĊĠĠĠ Ġoverride Ġval Ġgrouped Node Models LiveData Ġ= Ġget Group ed Nodes () ĊĠĠĠĠĠĠĠ Ġ. as LiveData () ĊĊĠĠĠ Ġprivate Ġfun Ġget Group ed Nodes () Ġ= Ġaccount Interactor . nodes Flow () ĊĠĠĠĠĠĠĠ Ġ. map (:: transform To Models ) ĊĠĠĠĠĠĠĠ Ġ. flow On ( Dispatch ers . Default ) ĊĊĠĠĠ Ġprivate Ġfun Ġtransform To Models ( list : ĠList < Node >): ĠList < Any > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdefault Header Ġ= ĠNode Header Model ( resource Manager . getString ( R . string . connection _ management _ default _ title )) ĊĠĠĠĠĠĠĠ Ġval Ġcustom Header Ġ= ĠNode Header Model ( resource Manager . getString ( R . string . connection _ management _ custom _ title )) ĊĊĠĠĠĠĠĠĠ Ġval Ġdefault Nodes Ġ= Ġlist . filter ( Node :: is Default ) ĊĠĠĠĠĠĠĠ Ġval Ġcustom Nodes Ġ= Ġlist . filter Ġ{ Ġ! it . is Default Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn Ġmutable ListOf < Any >(). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd ( default Header ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġadd All ( default Nodes . map (:: map Node To Node Model )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( custom Nodes . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd ( custom Header ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadd All ( custom Nodes . map (:: map Node To Node Model )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ