package Ġcom . the apache 6 4 . re ky . ui . screen Ċ Ċ import Ġandroidx . core . text . is Digits Only Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġcom . the apache 6 4 . re ky . data . local . model . User Ċ import Ġcom . the apache 6 4 . re ky . util . flow . mutable Event Flow Ċ import Ġdagger . h ilt . android . lifecycle . H ilt ViewModel Ċ import Ġkotlinx . coroutines . flow . Mutable State Flow Ċ import Ġkotlinx . coroutines . flow . as Shared Flow Ċ import Ġkotlinx . coroutines . flow . as State Flow Ċ import Ġtim ber . log . Tim ber Ċ import Ġjavax . inject . Inject Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġthe apache 6 4 Ġ: ĠMay Ġ 3 0 ĠSun , 2 0 2 1 Ġ@ Ġ 1 8 : 2 4 Ċ Ġ*/ Ċ @ H ilt ViewModel Ċ class ĠMain ViewModel Ġ@ Inject Ġconstructor ( Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ pick ed Directory Ġ= ĠMutable State Flow < String >(" ( choose Ġdirectory )") ĊĠĠĠ Ġval Ġpicked Directory Ġ= Ġ_ pick ed Directory . as State Flow () ĊĊĠĠĠ Ġprivate Ġval Ġ_ dial Ġ= Ġmutable Event Flow < String >() ĊĠĠĠ Ġval Ġdial Ġ= Ġ_ dial . as Shared Flow () ĊĊĠĠĠ Ġfun Ġon Dir Pick ed ( directory : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ_ pick ed Directory . value Ġ= Ġdirectory ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġon User Long Clicked ( user : ĠUser ) Ġ{ ĊĠĠĠĠĠĠĠ ĠTim ber . d (" Clicked Ġ$ user "); ĊĠĠĠĠĠĠĠ Ġif Ġ( user . contact . name . is Digits Only ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ_ dial . try Emit ( user . contact . name ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }