Skip to content

Commit

Permalink
Resolve merge conflict with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Annika Wickert committed Apr 19, 2020
2 parents beb3b8d + 1c229b9 commit 2dbd22e
Show file tree
Hide file tree
Showing 16 changed files with 237 additions and 50 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,5 @@ matrix:
- libpng-dev
- libxtst-dev

before_script:
- | # Fix chrome-sandbox: https://github.com/electron/electron/issues/17972
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
echo "Fixing chrome-sandbox permissions..."
sudo chown root ./node_modules/electron/dist/chrome-sandbox
sudo chmod 4755 ./node_modules/electron/dist/chrome-sandbox
fi
script:
- npm run dist
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ location /external_api.js {
}
```

The following additional HTTP header are known not work with the Electron App:

```
Content-Security-Policy "frame-ancestors 'none'";
X-Frame-Options "DENY";
```

## Development

If you want to hack on this project, here is how you do it.
Expand Down
13 changes: 4 additions & 9 deletions app/features/conference/components/Conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { connect } from 'react-redux';
import { push } from 'react-router-redux';

import config from '../../config';
import { setEmail, setName } from '../../settings';
import { getSetting, setEmail, setName } from '../../settings';

import { conferenceEnded, conferenceJoined } from '../actions';
import { LoadingIndicator, Wrapper } from '../styled';
Expand Down Expand Up @@ -403,17 +403,12 @@ class Conference extends Component<Props, State> {
* Maps (parts of) the redux state to the React props.
*
* @param {Object} state - The redux state.
* @returns {{
* _avatarURL: string,
* _email: string,
* _name: string,
* _serverURL: string,
* _startWithAudioMuted: boolean,
* _startWithVideoMuted: boolean
* }}
* @returns {Props}
*/
function _mapStateToProps(state: Object) {
return {
_alwaysOnTopWindowEnabled:
getSetting(state, 'alwaysOnTopWindowEnabled', true),
_avatarURL: state.settings.avatarURL,
_email: state.settings.email,
_name: state.settings.name,
Expand Down
78 changes: 78 additions & 0 deletions app/features/onboarding/components/AlwaysOnTopWindowSpotlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// @flow

import { Spotlight } from '@atlaskit/onboarding';

import React, { Component } from 'react';
import { connect } from 'react-redux';
import type { Dispatch } from 'redux';

import { closeDrawer } from '../../navbar';

import { continueOnboarding } from '../actions';

type Props = {

/**
* Redux dispatch.
*/
dispatch: Dispatch<*>;
};

/**
* Always on Top Windows Spotlight Component.
*/
class AlwaysOnTopWindowSpotlight extends Component<Props, *> {
/**
* Initializes a new {@code StartMutedTogglesSpotlight} instance.
*
* @inheritdoc
*/
constructor(props: Props) {
super(props);

this._next = this._next.bind(this);
}

/**
* Render function of component.
*
* @returns {ReactElement}
*/
render() {
return (
<Spotlight
actions = { [
{
onClick: this._next,
text: 'Next'
}
] }
dialogPlacement = 'left top'
target = { 'always-on-top-window' } >
You can toggle whether you want to enable the "always-on-top" window,
which is displayed when the main window loses focus.
This will be applied to all conferences.
</Spotlight>
);
}

_next: (*) => void;

/**
* Close the spotlight component.
*
* @returns {void}
*/
_next() {
const { dispatch } = this.props;

dispatch(continueOnboarding());

// FIXME: find a better way to do this.
setTimeout(() => {
dispatch(closeDrawer());
}, 300);
}
}

export default connect()(AlwaysOnTopWindowSpotlight);
11 changes: 1 addition & 10 deletions app/features/onboarding/components/StartMutedTogglesSpotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import type { Dispatch } from 'redux';

import { closeDrawer } from '../../navbar';

import { continueOnboarding } from '../actions';

type Props = {
Expand Down Expand Up @@ -63,14 +61,7 @@ class StartMutedTogglesSpotlight extends Component<Props, *> {
* @returns {void}
*/
_next() {
const { dispatch } = this.props;

dispatch(continueOnboarding());

// FIXME: find a better way to do this.
setTimeout(() => {
dispatch(closeDrawer());
}, 300);
this.props.dispatch(continueOnboarding());
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/features/onboarding/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ export { default as SettingsDrawerSpotlight } from './SettingsDrawerSpotlight';
export {
default as StartMutedTogglesSpotlight
} from './StartMutedTogglesSpotlight';
export {
default as AlwaysOnTopWindowSpotlight
} from './AlwaysOnTopWindowSpotlight';
9 changes: 6 additions & 3 deletions app/features/onboarding/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
NameSettingSpotlight,
EmailSettingSpotlight,
ServerSettingSpotlight,
StartMutedTogglesSpotlight
StartMutedTogglesSpotlight,
AlwaysOnTopWindowSpotlight
} from './components';

export const onboardingSteps = {
Expand All @@ -20,7 +21,8 @@ export const onboardingSteps = {
'name-setting',
'email-setting',
'server-setting',
'start-muted-toggles'
'start-muted-toggles',
'always-on-top-window'
]
};

Expand All @@ -31,5 +33,6 @@ export const onboardingComponents = {
'name-setting': NameSettingSpotlight,
'email-setting': EmailSettingSpotlight,
'server-setting': ServerSettingSpotlight,
'start-muted-toggles': StartMutedTogglesSpotlight
'start-muted-toggles': StartMutedTogglesSpotlight,
'always-on-top-window': AlwaysOnTopWindowSpotlight
};
13 changes: 5 additions & 8 deletions app/features/settings/components/AlwaysOnTopWindowToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import type { Dispatch } from 'redux';

import { TogglesContainer } from '../styled';
import { setWindowAlwaysOnTop } from '../actions';

import ToggleWithLabel from './ToggleWithLabel';
Expand Down Expand Up @@ -45,13 +44,11 @@ class AlwaysOnTopWindowToggle extends Component<Props> {
*/
render() {
return (
<TogglesContainer>
<ToggleWithLabel
isDefaultChecked = { this.props._alwaysOnTopWindowEnabled }
label = 'Always on Top Window'
onChange = { this._onAlwaysOnTopWindowToggleChange }
value = { this.props._alwaysOnTopWindowEnabled } />
</TogglesContainer>
<ToggleWithLabel
isDefaultChecked = { this.props._alwaysOnTopWindowEnabled }
label = 'Always on Top Window'
onChange = { this._onAlwaysOnTopWindowToggleChange }
value = { this.props._alwaysOnTopWindowEnabled } />
);
}

Expand Down
20 changes: 11 additions & 9 deletions app/features/settings/components/SettingsDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Dispatch } from 'redux';

import { closeDrawer, DrawerContainer, Logo } from '../../navbar';
import { Onboarding, startOnboarding } from '../../onboarding';
import { AvatarContainer, SettingsContainer } from '../styled';
import { AvatarContainer, SettingsContainer, TogglesContainer } from '../styled';
import { setEmail, setName } from '../actions';

import AlwaysOnTopWindowToggle from './AlwaysOnTopWindowToggle';
Expand Down Expand Up @@ -130,14 +130,16 @@ class SettingsDrawer extends Component<Props, *> {
name = 'server-setting'>
<ServerURLField />
</SpotlightTarget>
<SpotlightTarget
name = 'start-muted-toggles'>
<StartMutedToggles />
</SpotlightTarget>
<SpotlightTarget
name = 'window-always-on-top'>
<AlwaysOnTopWindowToggle />
</SpotlightTarget>
<TogglesContainer>
<SpotlightTarget
name = 'start-muted-toggles'>
<StartMutedToggles />
</SpotlightTarget>
<SpotlightTarget
name = 'always-on-top-window'>
<AlwaysOnTopWindowToggle />
</SpotlightTarget>
</TogglesContainer>
<Onboarding section = 'settings-drawer' />
</SettingsContainer>
</DrawerContainer>
Expand Down
5 changes: 2 additions & 3 deletions app/features/settings/components/StartMutedToggles.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import type { Dispatch } from 'redux';

import { TogglesContainer } from '../styled';
import {
setStartWithAudioMuted,
setStartWithVideoMuted
Expand Down Expand Up @@ -85,7 +84,7 @@ class StartMutedToggles extends Component<Props, State> {
*/
render() {
return (
<TogglesContainer>
<>
<ToggleWithLabel
isDefaultChecked = { this.props._startWithAudioMuted }
label = 'Start with Audio muted'
Expand All @@ -96,7 +95,7 @@ class StartMutedToggles extends Component<Props, State> {
label = 'Start with Video muted'
onChange = { this._onVideoToggleChange }
value = { this.state.startWithVideoMuted } />
</TogglesContainer>
</>
);
}

Expand Down
20 changes: 20 additions & 0 deletions app/features/settings/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @flow

/**
* Get's the value for the given setting, providing a default value.
*
* @param {Object} state - The redux state.
* @param {string} setting - The name for the desired setting.
* @param {*} defaultValue - The default value, in case the setting is
* undefined.
* @returns {*} The setting value.
*/
export function getSetting(state: Object, setting: string, defaultValue: any) {
const value = state.settings[setting];

if (typeof value === 'undefined') {
return defaultValue;
}

return value;
}
1 change: 1 addition & 0 deletions app/features/settings/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './actions';
export * from './actionTypes';
export * from './components';
export * from './functions';
export * from './styled';

export { default as middleware } from './middleware';
Expand Down
1 change: 1 addition & 0 deletions app/features/settings/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type State = {
const username = window.jitsiNodeAPI.osUserInfo().username;

const DEFAULT_STATE = {
alwaysOnTopWindowEnabled: true,
avatarURL: getAvatarURL({ id: username }),
email: '',
name: username,
Expand Down
Loading

0 comments on commit 2dbd22e

Please sign in to comment.