// ĠCopyright Ġ 2 0 1 5 - present Ġ 6 5 0 ĠInd ust ries . ĠAll Ġrights Ġreserved . Ċ package Ġabi 4 4 _ 0 _ 0 . expo . modules . sensors . modules Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . pm . PackageManager Ċ import Ġandroid . hardware . Sensor Event Ċ import Ġandroid . os . Bundle Ċ import Ġabi 4 4 _ 0 _ 0 . expo . modules . interfaces . sensors . Sensor Service Interface Ċ import Ġabi 4 4 _ 0 _ 0 . expo . modules . interfaces . sensors . services . Ped ometer Service Interface Ċ import Ġabi 4 4 _ 0 _ 0 . expo . modules . core . Promise Ċ import Ġabi 4 4 _ 0 _ 0 . expo . modules . core . interfaces . Ex po Method Ċ Ċ class ĠPed ometer Module ( react Context : ĠContext ?) Ġ: ĠBase Sensor Module ( react Context ) Ġ{ ĊĠ Ġprivate Ġvar Ġsteps At The Beginning : ĠInt ? Ġ= Ġnull ĊĠ Ġoverride Ġval ĠeventName : ĠString Ġ= Ġ" Exponent . ped ometer Update " ĊĊĠ Ġoverride Ġfun ĠgetName (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġ" Exponent Ped ometer " ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget Sensor Service (): ĠSensor Service Interface Ġ{ ĊĠĠĠ Ġreturn Ġmodule Registry . getModule ( Ped ometer Service Interface :: class . java ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġevent ToMap ( sensor Event : ĠSensor Event ): ĠBundle Ġ{ ĊĠĠĠ Ġif Ġ( steps At The Beginning Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġsteps At The Beginning Ġ= Ġsensor Event . values [ 0 ]. toInt () Ġ- Ġ 1 ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠBundle (). apply Ġ{ ĊĠĠĠĠĠ Ġput Double (" steps ", Ġ( sensor Event . values [ 0 ] Ġ- Ġsteps At The Beginning !! ). toDouble ()) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Ex po Method ĊĠ Ġfun Ġstart Ob serving ( promise : ĠPromise ) Ġ{ ĊĠĠĠ Ġsuper . start Ob serving () ĊĠĠĠ Ġsteps At The Beginning Ġ= Ġnull ĊĠĠĠ Ġpromise . resolve ( null ) ĊĠ Ġ} ĊĊĠ Ġ@ Ex po Method ĊĠ Ġfun Ġstop Ob serving ( promise : ĠPromise ) Ġ{ ĊĠĠĠ Ġsuper . stop Ob serving () ĊĠĠĠ Ġsteps At The Beginning Ġ= Ġnull ĊĠĠĠ Ġpromise . resolve ( null ) ĊĠ Ġ} ĊĊĠ Ġ@ Ex po Method ĊĠ Ġfun Ġset Update Interval ( update Interval : ĠInt , Ġpromise : ĠPromise ) Ġ{ ĊĠĠĠ Ġsuper . set Update Interval ( update Interval ) ĊĠĠĠ Ġpromise . resolve ( null ) ĊĠ Ġ} ĊĊĠ Ġ@ Ex po Method ĊĠ Ġfun Ġis Available Async ( promise : ĠPromise ) Ġ{ ĊĠĠĠ Ġpromise . resolve ( context . package Manager . has System Feature ( PackageManager . FEATURE _ SENSOR _ STEP _ COUNTER )) ĊĠ Ġ} ĊĊĠ Ġ@ Ex po Method ĊĠ Ġfun Ġget Step Count Async ( startDate : ĠInt ?, ĠendDate : ĠInt ?, Ġpromise : ĠPromise ) Ġ{ ĊĠĠĠ Ġpromise . reject (" E _ NOT _ AVAILABLE ", Ġ" Getting Ġstep Ġcount Ġfor Ġdate Ġrange Ġis Ġnot Ġsupported Ġon ĠAndroid Ġyet .") ĊĠ Ġ} Ċ } Ċ