Skip to content

Commit

Permalink
fix: close audio and exit fullscreen before shut down
Browse files Browse the repository at this point in the history
  • Loading branch information
Renovamen committed May 4, 2021
1 parent 8532abb commit 55093c9
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/components/topbar/MenuBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,28 @@ export default class MenuBar extends Component {
});
};

logout = () => {
clearBeforeLogout = (foo, param) => {
Promise.all([
this.toggleFullScreen(false),
this.toggleAudio(false),
this.setVolume(100)
]).then(() => this.props.setLogin(false));
]).then(() => foo(param));
};

logout = () => {
this.clearBeforeLogout(this.props.setLogin, false);
};

shut = (e) => {
this.clearBeforeLogout(this.props.shutMac, e);
};

restart = (e) => {
this.clearBeforeLogout(this.props.restartMac, e);
};

sleep = (e) => {
this.clearBeforeLogout(this.props.sleepMac, e);
};

render() {
Expand All @@ -152,9 +168,9 @@ export default class MenuBar extends Component {
{this.state.showAppleMenu && (
<AppleMenu
logout={this.logout}
shut={this.props.shutMac}
restart={this.props.restartMac}
sleep={this.props.sleepMac}
shut={this.shut}
restart={this.restart}
sleep={this.sleep}
/>
)}

Expand Down

0 comments on commit 55093c9

Please sign in to comment.