Skip to content

Commit

Permalink
Merge pull request #691 from MartinHarkins/issue-690-fix-2.25.3-typings
Browse files Browse the repository at this point in the history
fix typings for issue 690
  • Loading branch information
jeffswartz authored Oct 3, 2023
2 parents bf5af09 + 693f1e3 commit 1d4af9c
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 62 deletions.
118 changes: 59 additions & 59 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ declare module "opentok-react-native" {
code: string;
message: string;
}

interface SubscriberAudioStatsEvent {
audioBytesReceived: number,
audioPacketsLost: number,
Expand Down Expand Up @@ -129,35 +129,6 @@ declare module "opentok-react-native" {
*/
getSessionInfo?: any

/**
* Used to get capabilities of the client
*/
getCapabilities(): Promise<{
canForceMute: boolean;
canPublish: boolean;
canSubscribe: boolean;
}>

/**
* Mutes all streams in the session.
*/
forceMuteAll(excludedStreamIds: string[]): Promise<>

/**
* Mutes a stream in the session.
*/
forceMuteStream(streamId: string): Promise<>

/**
* Disables the force mute state for the session.
*/
disableForceMute(): Promise<>

/**
* Used to report an issue
*/
reportIssue(): Promise<string>

/**
* Event handlers passed into the native session instance.
*/
Expand All @@ -173,9 +144,9 @@ declare module "opentok-react-native" {
/**
* EU proxy server URL provided by vonage. Please check https://tokbox.com/developer/guides/eu-proxy/
*/
proxyUrl?: string;
proxyUrl?: string;

/**
/**
* Android only - valid options are 'mediaOverlay' or 'onTop'
*/
androidZOrder?: "mediaOverlay" | "onTop";
Expand All @@ -193,15 +164,15 @@ declare module "opentok-react-native" {
/**
* Android only - default is false.
* Deprecated and ignored.
*/
isCamera2Capable?: boolean;

/**
* Whether to use the allowed IP list feature - default is false
*/
ipWhitelist?: boolean;

/**
* Enable Stereo output
*/
Expand All @@ -213,9 +184,9 @@ declare module "opentok-react-native" {
includeServers: 'all' | 'custom';
transportPolicy: 'all' | 'relay';
customServers: {
urls: string[];
username?: string;
credential?: string;
urls: string[];
username?: string;
credential?: string;
}[];
};
}
Expand Down Expand Up @@ -295,7 +266,36 @@ declare module "opentok-react-native" {
/**
* https://github.com/opentok/opentok-react-native/blob/master/docs/OTSession.md
*/
export class OTSession extends React.Component<OTSessionProps> {}
export class OTSession extends React.Component<OTSessionProps, unknown> {
/**
* Used to get capabilities of the client
*/
getCapabilities: () => Promise<{
canForceMute: boolean;
canPublish: boolean;
canSubscribe: boolean;
}>

/**
* Mutes all streams in the session.
*/
forceMuteAll: (excludedStreamIds: string[]) => Promise<void>

/**
* Mutes a stream in the session.
*/
forceMuteStream: (streamId: string) => Promise<void>

/**
* Disables the force mute state for the session.
*/
disableForceMute: () => Promise<void>

/**
* Used to report an issue
*/
reportIssue: () => Promise<string>
}

interface OTPublisherProps extends ViewProps {
/**
Expand All @@ -307,13 +307,6 @@ declare module "opentok-react-native" {
* Event handlers passed into native publsiher instance
*/
eventHandlers?: OTPublisherEventHandlers;

/**
* Gets the RTC stats report for the publisher. This is an asynchronous operation.
* The OTPublisher object dispatches an rtcStatsReport event when RTC statistics for
* the publisher are available.
*/
getRtcStatsReport(): void;
}

interface OTPublisherProperties {
Expand Down Expand Up @@ -401,10 +394,10 @@ declare module "opentok-react-native" {
otrnError?: CallbackWithParam<any, any>;

/**
* Sent when RTC stats reports are available for the publisher,
* Sent when RTC stats reports are available for the publisher,
* in response to calling the OTPublisher.getRtcStatsReport() method.
*/
rtcStatsReport?: CallbackWithParam<PublisherRtcStatsReport[]>, any>;
rtcStatsReport?: CallbackWithParam<PublisherRtcStatsReport[], any>;

/**
* Sent when the publisher starts streaming.
Expand All @@ -420,7 +413,14 @@ declare module "opentok-react-native" {
/**
* https://github.com/opentok/opentok-react-native/blob/master/docs/OTPublisher.md
*/
export class OTPublisher extends React.Component<OTPublisherProps> {}
export class OTPublisher extends React.Component<OTPublisherProps, unknown> {
/**
* Gets the RTC stats report for the publisher. This is an asynchronous operation.
* The OTPublisher object dispatches an rtcStatsReport event when RTC statistics for
* the publisher are available.
*/
getRtcStatsReport?: () => void;
}

interface OTSubscriberProps extends ViewProps {
/**
Expand Down Expand Up @@ -452,13 +452,6 @@ declare module "opentok-react-native" {
* If set to true, the subscriber can subscribe to it's own publisher stream (default: false)
*/
subscribeToSelf?: boolean;

/**
* Gets the RTC stats report for the subscriber. This is an asynchronous operation.
* The OTSubscriber object dispatches an rtcStatsReport event when RTC statistics for
* the publisher are available.
*/
getRtcStatsReport(): void;
}

interface OTSubscriberProperties {
Expand Down Expand Up @@ -505,10 +498,10 @@ declare module "opentok-react-native" {
otrnError?: CallbackWithParam<any, any>;

/**
* Sent when an RTC stats report is available for the subscriber,
* Sent when an RTC stats report is available for the subscriber,
* in response to calling the OTSubscriber.getRtcStatsReport() method.
*/
rtcStatsReport?: CallbackWithParam<RtcStatsReport>, any>;
rtcStatsReport?: CallbackWithParam<RtcStatsReport, any>;

/**
* Sent when a frame of video has been decoded. Although the subscriber will connect in a relatively short time, video can take more time to synchronize. This message is sent after the connected message is sent.
Expand Down Expand Up @@ -551,9 +544,16 @@ declare module "opentok-react-native" {
/**
* https://github.com/opentok/opentok-react-native/blob/main/docs/OTSubscriber.md#custom-rendering-of-streams
*/
export class OTSubscriberView extends React.Component<OTSubscriberViewProps> {}
export class OTSubscriberView extends React.Component<OTSubscriberViewProps, unknown> {}
/**
* https://github.com/opentok/opentok-react-native/blob/master/docs/OTSubscriber.md
*/
export class OTSubscriber extends React.Component<OTSubscriberProps> {}
export class OTSubscriber extends React.Component<OTSubscriberProps, unknown> {
/**
* Gets the RTC stats report for the subscriber. This is an asynchronous operation.
* The OTSubscriber object dispatches an rtcStatsReport event when RTC statistics for
* the publisher are available.
*/
getRtcStatsReport: () => void;
}
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.25.4 (October 2023)

- [Fix]: Fixes TypeScript definitions - issue #690.

# 2.25.3 (September 2023)

- [Update]: Add API to implement functionality missing from the OpenTok Android and iOS SDKs:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opentok-react-native",
"version": "2.25.3",
"version": "2.25.4",
"description": "React Native components for OpenTok iOS and Android SDKs",
"main": "src/index.js",
"homepage": "https://www.tokbox.com",
Expand Down

0 comments on commit 1d4af9c

Please sign in to comment.