Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #138 from DolbyIO/release/3.8.1-beta.1
Browse files Browse the repository at this point in the history
Release/3.8.1 beta.1
  • Loading branch information
kbetl-dlb authored Apr 24, 2023
2 parents 33d6e72 + b80accf commit a992bbe
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 23 deletions.
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ MOCKITO_CORE_VERSION=2.26.0
POWERMOCK_VERSION=2.0.2
ROBOLECTRIC_VERSION=4.4
JUNIT_VERSION=4.13.2
COMMS_SDK_VERSION="3.8.0"
COMMS_SDK_VERSION="3.8.1-beta.1"
COMPONENT_NAME="react-native-sdk"
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-comms-sdk-example",
"description": "Example app for react-native-dolbyio-sdk",
"version": "3.8.0+1",
"version": "3.8.1-beta.1+1",
"license": "MIT",
"private": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ const ActiveParticipantsHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.notification.onActiveParticipants(onActiveParticipants);
var unsubscribe = CommsAPI.notification.onActiveParticipants(onActiveParticipants);
// eslint-disable-next-line react-hooks/exhaustive-deps
return () => {
unsubscribe();
};
}, []);

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ const ConferenceCreatedHandler: React.FC = () => {


useEffect(() => {
return CommsAPI.notification.onConferenceCreated(onConferenceCreated);
// eslint-disable-next-line react-hooks/exhaustive-deps
var unsubscribe = CommsAPI.notification.onConferenceCreated(onConferenceCreated);
return () => {
unsubscribe();
};
}, []);

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CommsAPI from '@dolbyio/comms-sdk-react-native';

import type { ConferenceEndedEventType } from '../../../../src/services/notification/events';

const ConferenceCreatedHandler: React.FC = () => {
const ConferenceEndedHandler: React.FC = () => {
const onConferenceEnded = (data: ConferenceEndedEventType) => {
console.log(
'CONFERENCE ENDED EVENT DATA: \n',
Expand All @@ -14,11 +14,13 @@ const ConferenceCreatedHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.notification.onConferenceEnded(onConferenceEnded);
// eslint-disable-next-line react-hooks/exhaustive-deps
var unsubscribe = CommsAPI.notification.onConferenceEnded(onConferenceEnded);
return () => {
unsubscribe();
};
}, []);

return null;
};

export default ConferenceCreatedHandler;
export default ConferenceEndedHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const ConferenceStatusHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.notification.onConferenceStatus(onConferenceStatus);
// eslint-disable-next-line react-hooks/exhaustive-deps
var unsubscribe = CommsAPI.notification.onConferenceStatus(onConferenceStatus);
return () => {
unsubscribe();
};
}, []);

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ const InvitationHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.notification.onInvitationReceived(onInvitationReceived);
// eslint-disable-next-line react-hooks/exhaustive-deps
var unsubscribe = CommsAPI.notification.onInvitationReceived(onInvitationReceived);
return () => {
unsubscribe();
};
}, []);

return null;
Expand Down
5 changes: 4 additions & 1 deletion example/src/components/MessageHandler/MessageHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const MessageHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.command.onMessageReceived(onMessageReceived);
var unsubscribe = CommsAPI.command.onMessageReceived(onMessageReceived);
return () => {
unsubscribe();
};
}, []);

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ const ParticipantJoinedHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.notification.onParticipantJoined(onParticipantJoined);
var unsubscribe = CommsAPI.notification.onParticipantJoined(onParticipantJoined);
return () => {
unsubscribe();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const ParticipantLeftHandler: React.FC = () => {
};

useEffect(() => {
return CommsAPI.notification.onParticipantLeft(onParticipantLeft);
// eslint-disable-next-line react-hooks/exhaustive-deps
var unsubscribe = CommsAPI.notification.onParticipantLeft(onParticipantLeft);
return () => {
unsubscribe();
};
}, []);

return null;
Expand Down
2 changes: 1 addition & 1 deletion ios/Services/CommsAPIModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ private enum EventKeys: String, CaseIterable {
}

private let componentName = "react-native-sdk"
private let sdkVersion = "3.8.0"
private let sdkVersion = "3.8.1-beta.1"

@objc(RNCommsAPIModule)
public class CommsAPIModule: ReactEmitter {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dolbyio/comms-sdk-react-native",
"version": "3.8.0",
"version": "3.8.1-beta.1",
"description": "Dolby.io iAPI SDK for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
21 changes: 17 additions & 4 deletions src/utils/NativeEvents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NativeEventEmitter } from 'react-native';
import { NativeEventEmitter, NativeModule } from 'react-native';

import type { VideoViewEventMap } from '../VideoView/events';
import type { CommsAPIEventMap } from '../events';
Expand All @@ -21,19 +21,32 @@ interface NativeEventType
VideoViewEventMap {}

export default class NativeEvents {
private _nativeEventEmitter: any = undefined;
private _nativeEventEmitter: NativeEventEmitter;

constructor(module: any) {
constructor(module: NativeModule) {
this._nativeEventEmitter = new NativeEventEmitter(module);
}

public addListener<K extends keyof NativeEventType>(
type: K,
listener: (event: NativeEventType[K], type?: K) => void
): UnregisterListener {
return this?._nativeEventEmitter?.addListener(
let emitterSubscription = this?._nativeEventEmitter?.addListener(
type,
(event: NativeEventType[K]) => listener(event, type)
);

// This is a work around to keep backward compability.
// Previously we were returning a object that had a remove method rather
// than just returnign function, as per documentation. We are now returning a function
// that can be called to unsubscribe but to preserve backward compability we add
// remove method to the function.
function unregisterListener() {
emitterSubscription.remove();
}
unregisterListener.remove = function () {
emitterSubscription.remove();
};
return unregisterListener;
}
}

0 comments on commit a992bbe

Please sign in to comment.