import invoker,{BRIDGE_ERROR_CODE,CONTINUOUS_EVENT_LIST,PLATFORM_TYPE_ENUM,API_INVOKER_TYPE}from"./invoker";function startGeolocationHandler(e,o){var n=o.resolve,t=o.reject,r=o.context,i=o.platformType,a=o.containerType,s=o.appType,c=invoker.registerEvent(CONTINUOUS_EVENT_LIST.UPDATE_LOCATION,(function(o){var n=o.data;n.errorCode!==BRIDGE_ERROR_CODE.SUCCESS?e.onFail&&e.onFail(n):e.onSuccess&&e.onSuccess(n.result)}));if(a){var l=function(o){invoker.registerContinuesEvent(e.sceneId,c),invoker.handleBridgeResponse(o,n,t)},E=function(o){invoker.registerContinuesEvent(e.sceneId,c),invoker.handleBridgeResponse(o,n,t)};s===API_INVOKER_TYPE.MINI_APP?(console.log("taurus.common.startGeolocation",e),r&&r({m:"taurus.common.startGeolocation",args:e,onSuccess:l,onFail:E})):i===PLATFORM_TYPE_ENUM.ANDROID?r&&r(l,E,"taurus.common","startGeolocation",e):i===PLATFORM_TYPE_ENUM.IOS&&r.callHandler("taurus.common.startGeolocation",Object.assign({},e),(function(o){invoker.registerContinuesEvent(e.sceneId,c),invoker.handleBridgeResponse(o,n,t)}))}else r&&r.call("startGeolocation",e,(function(o){invoker.registerContinuesEvent(e.sceneId,c),invoker.handleBridgeResponse(o,n,t)}))}invoker.registerAPI("startGeolocation",{mobile:startGeolocationHandler,mini:startGeolocationHandler}),startGeolocation.version={android:"1.3.2",ios:"1.3.2"};export default function startGeolocation(e){return invoker.invoke("startGeolocation",e)}