Skip to content

Commit

Permalink
Merge pull request #18 from brendancboyle/dev
Browse files Browse the repository at this point in the history
1.2.1
  • Loading branch information
bcbee authored Dec 26, 2018
2 parents e8680da + 0959a5f commit 74c59c3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
51 changes: 27 additions & 24 deletions app/components/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,24 @@ type State = {
export default class Login extends Component<Props, State> {
state = { hasPermissions: true };

componentDidMount() {
this.checkPermissions();
constructor(props) {
super(props);
this.checkPermissions = this.checkPermissions.bind(this);
}

initialPermissionCheck = true;
componentWillMount() {
this.checkPermissions();
// setInterval(this.checkPermissions, 1000);
}

checkPermissions() {
SendKeys.hasPermissions()
.then(v => {
if (!this.initialPermissionCheck && !v) {
dialog.showErrorBox(
'Whoops!',
`UPR is still missing the required permissions. Please try again, or restart UPR Desktop.`
);
Sentry.captureMessage('Check permissions failed', 'warning');
}
this.initialPermissionCheck = false;
return this.setState({ hasPermissions: v });
})
async checkPermissions() {
const v = await SendKeys.hasPermissions()
.catch(e => {
console.error(e);
Sentry.captureException(e);
});
this.setState({ hasPermissions: v });
return v;
}

macPermissionWarning() {
Expand All @@ -58,8 +54,15 @@ export default class Login extends Component<Props, State> {
title="Welcome to UPR"
buttonTitle="Check Permissions"
buttonActive
buttonOnClick={() => {
this.checkPermissions();
buttonOnClick={async () => {
const v = await this.checkPermissions();
if (!v) {
dialog.showErrorBox(
'Whoops!',
`UPR is still missing the required permissions. Please try again, or restart UPR Desktop.`
);
Sentry.captureMessage('Check permissions failed', 'warning');
}
}}
>
<div>
Expand All @@ -70,7 +73,7 @@ export default class Login extends Component<Props, State> {
</p>
<p>
To allow this, open System Preferences then select Security &
Privacy. Make sure UPR is checked in the Automation tab.
Privacy. Make sure UPR is checked in both the Automation and Accessibility tabs.
</p>
</div>
</Modal>
Expand All @@ -83,12 +86,12 @@ export default class Login extends Component<Props, State> {
} = this;
return (
<div className={styles.container} data-tid="container">
<img src={Logo} alt="Logo" className={styles.logo} />
<br />
<img src={Banner} alt="Banner" className={styles.banner} />
<img src={Logo} alt="Logo" className={styles.logo}/>
<br/>
<img src={Banner} alt="Banner" className={styles.banner}/>
<h2>Universal Presenter Remote</h2>
<TokenForm />
<ConnectButton token={token} />
<TokenForm/>
<ConnectButton token={token}/>
{this.macPermissionWarning()}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "upr-desktop",
"productName": "Universal Presenter Remote",
"version": "1.2.0",
"version": "1.2.1",
"description": "Control your presentations from any platform.",
"main": "./main.prod.js",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "upr-desktop",
"productName": "Universal Presenter Remote",
"version": "1.2.0",
"version": "1.2.1",
"description": "Control your presentations from any platform.",
"scripts": {
"build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",
Expand Down

0 comments on commit 74c59c3

Please sign in to comment.