make Notifier getSoundForRoom synchronous
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
26e763d135
commit
dc099efb19
2 changed files with 7 additions and 8 deletions
|
@ -122,7 +122,7 @@ const Notifier = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getSoundForRoom: async function(roomId) {
|
getSoundForRoom: function(roomId) {
|
||||||
// We do no caching here because the SDK caches setting
|
// We do no caching here because the SDK caches setting
|
||||||
// and the browser will cache the sound.
|
// and the browser will cache the sound.
|
||||||
const content = SettingsStore.getValue("notificationSound", roomId);
|
const content = SettingsStore.getValue("notificationSound", roomId);
|
||||||
|
@ -151,7 +151,7 @@ const Notifier = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_playAudioNotification: async function(ev, room) {
|
_playAudioNotification: async function(ev, room) {
|
||||||
const sound = await this.getSoundForRoom(room.roomId);
|
const sound = this.getSoundForRoom(room.roomId);
|
||||||
console.log(`Got sound ${sound && sound.name || "default"} for ${room.roomId}`);
|
console.log(`Got sound ${sound && sound.name || "default"} for ${room.roomId}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -39,12 +39,11 @@ export default class NotificationsSettingsTab extends React.Component {
|
||||||
|
|
||||||
// TODO: [REACT-WARNING] Replace component with real class, use constructor for refs
|
// TODO: [REACT-WARNING] Replace component with real class, use constructor for refs
|
||||||
UNSAFE_componentWillMount() { // eslint-disable-line camelcase
|
UNSAFE_componentWillMount() { // eslint-disable-line camelcase
|
||||||
Notifier.getSoundForRoom(this.props.roomId).then((soundData) => {
|
const soundData = Notifier.getSoundForRoom(this.props.roomId);
|
||||||
if (!soundData) {
|
if (!soundData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({currentSound: soundData.name || soundData.url});
|
this.setState({currentSound: soundData.name || soundData.url});
|
||||||
});
|
|
||||||
|
|
||||||
this._soundUpload = createRef();
|
this._soundUpload = createRef();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue