"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useRoomSubscription = void 0;
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
var _react = require("react");
const useRoomSubscription = ({
  room
}) => {
  (0, _react.useEffect)(() => {
    const unsubscriber = [];
    if (room !== null && room !== void 0 && room.roomId && (room === null || room === void 0 ? void 0 : room.status) !== 'recorded') {
      unsubscriber.push((0, _tsSdkReactNative.subscribeTopic)((0, _tsSdkReactNative.getRoomWatcherTopic)(room)));
    }
    return () => unsubscriber.forEach(fn => fn());
  }, [room, room === null || room === void 0 ? void 0 : room.roomId]);
  return null;
};
exports.useRoomSubscription = useRoomSubscription;
//# sourceMappingURL=useRoomSubscription.js.map