package Ġdeck ers . th ib ault . aves . channel . calls Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . media . Media Scanner Connection Ċ import Ġandroid . net . Uri Ċ import Ġdeck ers . th ib ault . aves . channel . calls . Co result . Companion . safe Ċ import Ġdeck ers . th ib ault . aves . model . provider . Media Store Image Provider Ċ import Ġio . flutter . plugin . common . MethodCall Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġio . flutter . plugin . common . Method Channel . MethodCall Handler Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . Global Scope Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠMedia Store Handler ( private Ġval Ġcontext : ĠContext ) Ġ: ĠMethod Call Handler Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġon MethodCall ( call : ĠMethod Call , Ġresult : ĠMethod Channel . Result ) Ġ{ ĊĠĠĠĠĠĠĠ Ġwhen Ġ( call . method ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" check Obsolete Content Ids " Ġ-> ĠGlobal Scope . launch ( Dispatch ers . IO ) Ġ{ Ġsafe ( call , Ġresult , Ġ:: check Obsolete Content Ids ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" check Obsolete Paths " Ġ-> ĠGlobal Scope . launch ( Dispatch ers . IO ) Ġ{ Ġsafe ( call , Ġresult , Ġ:: check Obsolete Paths ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" scan File " Ġ-> ĠGlobal Scope . launch ( Dispatch ers . IO ) Ġ{ Ġsafe ( call , Ġresult , Ġ:: scan File ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġresult . not Implemented () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcheck Obsolete Content Ids ( call : ĠMethod Call , Ġresult : ĠMethod Channel . Result ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġknown Content Ids Ġ= Ġcall . argument < List < Int >> (" known Content Ids ") ĊĠĠĠĠĠĠĠ Ġif Ġ( known Content Ids Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresult . error (" check Obsolete Content Ids - args ", Ġ" failed Ġbecause Ġof Ġmissing Ġarguments ", Ġnull ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġresult . success ( Media Store Image Provider (). check Obsolete Content Ids ( context , Ġknown Content Ids )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcheck Obsolete Paths ( call : ĠMethod Call , Ġresult : ĠMethod Channel . Result ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġknown Path ById Ġ= Ġcall . argument < Map < Int , ĠString >> (" known Path ById ") ĊĠĠĠĠĠĠĠ Ġif Ġ( known Path ById Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresult . error (" check Obsolete Paths - args ", Ġ" failed Ġbecause Ġof Ġmissing Ġarguments ", Ġnull ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġresult . success ( Media Store Image Provider (). check Obsolete Paths ( context , Ġknown Path ById )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġscan File ( call : ĠMethod Call , Ġresult : ĠMethod Channel . Result ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpath Ġ= Ġcall . argument < String >(" path ") ĊĠĠĠĠĠĠĠ Ġval ĠmimeType Ġ= Ġcall . argument < String >(" mime Type ") ĊĠĠĠĠĠĠĠ ĠMedia Scanner Connection . scan File ( context , ĠarrayOf ( path ), ĠarrayOf ( mime Type )) Ġ{ Ġ_, Ġuri : ĠUri ? Ġ-> Ġresult . success ( uri ?. toString ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠCHAN NEL Ġ= Ġ" deck ers . th ib ault / aves / media _ store " ĊĠĠĠ Ġ} Ċ }