uxcam / react-native-ux-cam

51 stars 10 forks source link

index.d.ts does not appear accurate. #112

Open andrewtremblay opened 10 months ago

andrewtremblay commented 10 months ago

The UXCam SDK do not seem to be returning the right types in some cases. For example the index.d.ts type file says that pendingSessionCount returns a number but it appears to actually return a promise that resolves to a number.

Similarly. optInSchematicRecordingStatus and optInOverallStatus and isRecording all appear to be returning promises of booleans.

Our current workaround for this is to wrap each function for this that behaves in this way. Example:

  /** Returns the current recording status */
  async isRecording(): Promise<boolean> {
    let isRecording = false; // assume we are not recording
    try {
      // UXCam does not seem to have the right types here.
      // The types say that isRecording returns a boolean
      // but it is actually returning the promise of a boolean.
      isRecording = await (RNUxcam.isRecording() as any as Promise<boolean>);
    } catch (e) {
      trackError(e);
    }
    return isRecording;
  }
DFDIEGOH commented 10 months ago

Hi @andrewtremblay, Diego here from UXCam - Thank you for sharing this, Will check this internally and will get back to you as soon as possible.

andrejguran commented 5 months ago

There is more: updateConfiguration is implemented only for iOS not for Android

kzlar commented 3 months ago

@DFDIEGOH This is still an issue, any update on this? Thank you!