/* Ċ Ġ* ĠCopyright Ġ 2 0 2 0 - 2 0 2 1 Ġli in ah am ari Ċ Ġ* Ċ Ġ* ĠPermission Ġis Ġhereby Ġgranted , Ġfree Ġof Ġcharge , Ġto Ġany Ġperson Ġobtaining Ġa Ġcopy Ġof Ġthis Ġsoftware Ġand Ġassociated Ġdocumentation Ġfiles Ċ Ġ* Ġ( the Ġ" Software "), Ġto Ġdeal Ġin Ġthe ĠSoftware Ġwithout Ġrestriction , Ġincluding Ġwithout Ġlimitation Ġthe Ġrights Ġto Ġuse , Ġcopy , Ġmodify , Ġmerge , Ċ Ġ* Ġpublish , Ġdistribute , Ġsublicense , Ġand / or Ġsell Ġcopies Ġof Ġthe ĠSoftware , Ġand Ġto Ġpermit Ġpersons Ġto Ġwhom Ġthe ĠSoftware Ġis Ġfurnished Ġto Ġdo Ġso , Ċ Ġ* Ġsubject Ġto Ġthe Ġfollowing Ġconditions : Ċ Ġ* Ċ Ġ* ĠThe Ġabove Ġcopyright Ġnotice Ġand Ġthis Ġpermission Ġnotice Ġshall Ġbe Ġincluded Ġin Ġall Ġcopies Ġor Ġsubstantial Ġportions Ġof Ġthe ĠSoftware . Ċ Ġ* Ċ Ġ* ĠTHE ĠSOFTWARE ĠIS ĠPROVIDED Ġ" AS ĠIS ", ĠWITHOUT ĠWARRANTY ĠOF ĠANY ĠKIND , ĠEXPRESS ĠOR ĠIMPLIED , ĠINCLUDING ĠBUT ĠNOT ĠLIMITED ĠTO ĠTHE ĠWARRANTIES ĠOF Ċ Ġ* ĠMERCHANTABILITY , ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠAND ĠNONINFRINGEMENT . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE ĠAUTHORS ĠOR ĠCOPYRIGHT ĠHOLDERS ĠBE ĠLIABLE ĠFOR Ċ Ġ* ĠANY ĠCLAIM , ĠDAMAGES ĠOR ĠOTHER ĠLIABILITY , ĠWHETHER ĠIN ĠAN ĠACTION ĠOF ĠCONTRACT , ĠTORT ĠOR ĠOTHERWISE , ĠARISING ĠFROM , ĠOUT ĠOF ĠOR ĠIN ĠCONNECTION ĠWITH ĠTHE Ċ Ġ* ĠSOFTWARE ĠOR ĠTHE ĠUSE ĠOR ĠOTHER ĠDEALINGS ĠIN ĠTHE ĠSOFTWARE . Ċ Ġ*/ Ċ Ċ package Ġdev . li in ah am ari . follow er . helper Ċ Ċ import Ġandroid . net . Connectivity Manager Ċ import Ġandroid . net . Network Capabilities Ċ import Ġjavax . inject . Inject Ċ import Ġjavax . inject . Singleton Ċ Ċ @ Singleton Ċ class ĠNetwork Handler Ċ @ Inject Ġconstructor ( private Ġval Ġconnectivity Manager : ĠConnect ivity Manager ) Ġ{ ĊĠĠĠ Ġfun Ġis Network Available (): ĠBoolean Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnetwork Ġ= Ġconnectivity Manager . active Network Ġ?: Ġreturn Ġfalse ĊĠĠĠĠĠĠĠ Ġval Ġactive Network Ġ= Ġconnectivity Manager . get Network Capabilities ( network ) Ġ?: Ġreturn Ġfalse ĊĊĠĠĠĠĠĠĠ Ġreturn Ġwhen Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactive Network . has Transport ( Network Capabilities . TRANSPORT _ WIFI ) Ġ-> Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactive Network . has Transport ( Network Capabilities . TRANSPORT _ CELL ULAR ) Ġ-> Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactive Network . has Transport ( Network Capabilities . TRANSPORT _ ETHER NET ) Ġ-> Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactive Network . has Transport ( Network Capabilities . TRANSPORT _ BL U ETO OTH ) Ġ-> Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġfalse ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ