Skip to content

Commit

Permalink
ActionSheet [nfc]: Use streamId in actionsheet functions wherever pos…
Browse files Browse the repository at this point in the history
…sible.

This commits uses the streamId parameter (introduced in the previous
commit) to replace the usage of `streamName` as stream identifier
wherever possible.

Wherever possible means where the conversion is straightforward and
does not require modification of current api definitions.
  • Loading branch information
AkashDhiman committed Jun 15, 2021
1 parent f44af8b commit 288edc1
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/message/messageActionSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,20 @@ const deleteTopic = async ({ auth, streamName, topic, dispatch, _ }) => {
deleteTopic.title = 'Delete topic';
deleteTopic.errorMessage = 'Failed to delete topic';

const unmuteStream = async ({ auth, streamName, subscriptions }) => {
const sub = subscriptions.find(x => x.name === streamName);
if (sub) {
await api.setSubscriptionProperty(auth, sub.stream_id, 'is_muted', false);
}
const unmuteStream = async ({ auth, streamId, subscriptions }) => {
await api.setSubscriptionProperty(auth, streamId, 'is_muted', false);
};
unmuteStream.title = 'Unmute stream';
unmuteStream.errorMessage = 'Failed to unmute stream';

const muteStream = async ({ auth, streamName, subscriptions }) => {
const sub = subscriptions.find(x => x.name === streamName);
if (sub) {
await api.setSubscriptionProperty(auth, sub.stream_id, 'is_muted', true);
}
const muteStream = async ({ auth, streamId, subscriptions }) => {
await api.setSubscriptionProperty(auth, streamId, 'is_muted', true);
};
muteStream.title = 'Mute stream';
muteStream.errorMessage = 'Failed to mute stream';

const showStreamSettings = ({ streamName, subscriptions }) => {
const sub = subscriptions.find(x => x.name === streamName);
if (sub) {
NavigationService.dispatch(navigateToStream(sub.stream_id));
}
const showStreamSettings = ({ streamId, subscriptions }) => {
NavigationService.dispatch(navigateToStream(streamId));
};
showStreamSettings.title = 'Stream settings';
showStreamSettings.errorMessage = 'Failed to show stream settings';
Expand Down

0 comments on commit 288edc1

Please sign in to comment.