diff --git a/ios/Plugin/common/Serialization.swift b/ios/Plugin/common/Serialization.swift index edee624..ecd3525 100644 --- a/ios/Plugin/common/Serialization.swift +++ b/ios/Plugin/common/Serialization.swift @@ -255,7 +255,10 @@ func serializeIsInsideGeofence(_ isInsideGeofence: Result, + isInsideGeofence: Result, ): Result { switch (isInsideGeofence.type) { case 'success': + let successValue = isInsideGeofence.value; + if (successValue.type !== 'isInsideGeofence') { + throw new Error(`Invalid isInsideGeofence: ${JSON.stringify(successValue)}`); + } return { type: 'success', - value: isInsideGeofence.value, + value: successValue.value, }; case 'failure': return { diff --git a/src/data_types/internal/IsInsideGeofence.ts b/src/data_types/internal/IsInsideGeofence.ts new file mode 100644 index 0000000..90a2b34 --- /dev/null +++ b/src/data_types/internal/IsInsideGeofence.ts @@ -0,0 +1,4 @@ +export type IsInsideGeofence = { + type: 'isInsideGeofence'; + value: boolean; +}; diff --git a/src/data_types/internal/OrderInternal.ts b/src/data_types/internal/OrderInternal.ts index fd9529e..c6b1fbf 100644 --- a/src/data_types/internal/OrderInternal.ts +++ b/src/data_types/internal/OrderInternal.ts @@ -1,8 +1,9 @@ import { Result } from '../Result'; import type { LocationErrorInternal } from './LocationErrorInternal'; +import type { IsInsideGeofence } from './IsInsideGeofence'; export type OrderInternal = { orderHandle: string; - isInsideGeofence: Result; + isInsideGeofence: Result; index: number; };