stream-chat-react-native-core
Version:
The official React Native and Expo components for Stream Chat, a service for building chat applications
25 lines • 1.25 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useChannelMuteActive = void 0;
var _useChannelActions = require("./actions/useChannelActions");
var _useIsDirectChat = require("./useIsDirectChat");
var _useMutedChannels = require("../components/ChannelList/hooks/useMutedChannels");
var _useUserMuteActive = require("../components/Message/hooks/useUserMuteActive");
var useChannelMuteActive = channel => {
var _getOtherUserInDirect;
var isDirectChat = (0, _useIsDirectChat.useIsDirectChat)(channel);
var mutedChannels = (0, _useMutedChannels.useMutedChannels)(channel);
var otherUser = (_getOtherUserInDirect = (0, _useChannelActions.getOtherUserInDirectChannel)(channel)) == null ? void 0 : _getOtherUserInDirect.user;
var otherUserMuted = (0, _useUserMuteActive.useUserMuteActive)(otherUser);
var channelMuted = !!mutedChannels.find(mutedChannel => {
var _mutedChannel$channel;
return channel.cid === ((_mutedChannel$channel = mutedChannel.channel) == null ? void 0 : _mutedChannel$channel.cid);
});
if (!isDirectChat) {
return channelMuted;
}
return channelMuted || otherUserMuted;
};
exports.useChannelMuteActive = useChannelMuteActive;
//# sourceMappingURL=useChannelMuteActive.js.map