aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/auth/SetupAssistantScreen.js133
-rw-r--r--src/containers/layout/AppLayoutContainer.js2
-rw-r--r--src/containers/settings/EditServiceScreen.js14
-rw-r--r--src/containers/settings/EditSettingsScreen.js5
4 files changed, 147 insertions, 7 deletions
diff --git a/src/containers/auth/SetupAssistantScreen.js b/src/containers/auth/SetupAssistantScreen.js
new file mode 100644
index 000000000..960ed7e33
--- /dev/null
+++ b/src/containers/auth/SetupAssistantScreen.js
@@ -0,0 +1,133 @@
1/* eslint-disable no-await-in-loop */
2import React, { Component } from 'react';
3import PropTypes from 'prop-types';
4import { inject, observer } from 'mobx-react';
5
6import { sleep } from '../../helpers/async-helpers';
7import SetupAssistant from '../../components/auth/SetupAssistant';
8import ServicesStore from '../../stores/ServicesStore';
9import RecipesStore from '../../stores/RecipesStore';
10import { TODOS_RECIPE_ID } from '../../features/todos';
11import UserStore from '../../stores/UserStore';
12
13export default @inject('stores', 'actions') @observer class SetupAssistantScreen extends Component {
14 services = {
15 whatsapp: {
16 name: 'WhatsApp',
17 hasTeamId: false,
18 },
19 messenger: {
20 name: 'Messenger',
21 hasTeamId: false,
22 },
23 gmail: {
24 name: 'Gmail',
25 hasTeamId: false,
26 },
27 skype: {
28 name: 'Skype',
29 hasTeamId: false,
30 },
31 telegram: {
32 name: 'Telegram',
33 hasTeamId: false,
34 },
35 instagram: {
36 name: 'Instagram',
37 hasTeamId: false,
38 },
39 slack: {
40 name: 'Slack',
41 hasTeamId: true,
42 },
43 hangouts: {
44 name: 'Hangouts',
45 hasTeamId: false,
46 },
47 linkedin: {
48 name: 'LinkedIn',
49 hasTeamId: false,
50 },
51 }
52
53 state = {
54 isSettingUpServices: false,
55 }
56
57 async setupServices(serviceConfig) {
58 const { stores: { services, router, user } } = this.props;
59 console.log(serviceConfig);
60
61 this.setState({
62 isSettingUpServices: true,
63 });
64
65 // The store requests are not build for paralell requests so we need to finish one request after another
66 for (const config of serviceConfig) {
67 const serviceData = {
68 name: this.services[config.id].name,
69 };
70
71 if (config.team) {
72 serviceData.team = config.team;
73 }
74
75 await services._createService({
76 recipeId: config.id,
77 serviceData,
78 redirect: false,
79 skipCleanup: true,
80 });
81
82 await sleep(100);
83 }
84
85 // Add Franz ToDos
86 await services._createService({
87 recipeId: TODOS_RECIPE_ID,
88 serviceData: {
89 name: 'Franz ToDos',
90 },
91 redirect: false,
92 skipCleanup: true,
93 });
94
95 this.setState({
96 isSettingUpServices: false,
97 });
98
99 await sleep(100);
100
101 router.push(user.pricingRoute);
102 }
103
104 render() {
105 return (
106 <SetupAssistant
107 onSubmit={config => this.setupServices(config)}
108 services={this.services}
109 embed={false}
110 isSettingUpServices={this.state.isSettingUpServices}
111 />
112 );
113 }
114}
115
116SetupAssistantScreen.wrappedComponent.propTypes = {
117 stores: PropTypes.shape({
118 services: PropTypes.instanceOf(ServicesStore),
119 recipes: PropTypes.instanceOf(RecipesStore),
120 user: PropTypes.instanceOf(UserStore),
121 }).isRequired,
122 actions: PropTypes.shape({
123 user: PropTypes.shape({
124 invite: PropTypes.func.isRequired,
125 }).isRequired,
126 service: PropTypes.shape({
127 createService: PropTypes.func.isRequired,
128 }).isRequired,
129 recipe: PropTypes.shape({
130 install: PropTypes.func.isRequired,
131 }).isRequired,
132 }).isRequired,
133};
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index a4312d9de..d7e413bb9 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -116,6 +116,7 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
116 isWorkspaceDrawerOpen={workspaceStore.isWorkspaceDrawerOpen} 116 isWorkspaceDrawerOpen={workspaceStore.isWorkspaceDrawerOpen}
117 showMessageBadgeWhenMutedSetting={settings.all.app.showMessageBadgeWhenMuted} 117 showMessageBadgeWhenMutedSetting={settings.all.app.showMessageBadgeWhenMuted}
118 showMessageBadgesEvenWhenMuted={ui.showMessageBadgesEvenWhenMuted} 118 showMessageBadgesEvenWhenMuted={ui.showMessageBadgesEvenWhenMuted}
119 isTodosServiceActive={services.isTodosServiceActive || false}
119 /> 120 />
120 ); 121 );
121 122
@@ -131,6 +132,7 @@ export default @inject('stores', 'actions') @observer class AppLayoutContainer e
131 update={updateService} 132 update={updateService}
132 userHasCompletedSignup={user.hasCompletedSignup} 133 userHasCompletedSignup={user.hasCompletedSignup}
133 hasActivatedTrial={user.hasActivatedTrial} 134 hasActivatedTrial={user.hasActivatedTrial}
135 isSpellcheckerEnabled={settings.app.enableSpellchecking}
134 /> 136 />
135 ); 137 );
136 138
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js
index 6aeecaa6d..d92d3bc07 100644
--- a/src/containers/settings/EditServiceScreen.js
+++ b/src/containers/settings/EditServiceScreen.js
@@ -33,9 +33,9 @@ const messages = defineMessages({
33 id: 'settings.service.form.enableService', 33 id: 'settings.service.form.enableService',
34 defaultMessage: '!!!Enable service', 34 defaultMessage: '!!!Enable service',
35 }, 35 },
36 disableHibernation: { 36 enableHibernation: {
37 id: 'settings.service.form.disableHibernation', 37 id: 'settings.service.form.enableHibernation',
38 defaultMessage: '!!!Disable hibernation', 38 defaultMessage: '!!!Enable hibernation',
39 }, 39 },
40 enableNotification: { 40 enableNotification: {
41 id: 'settings.service.form.enableNotification', 41 id: 'settings.service.form.enableNotification',
@@ -167,10 +167,10 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex
167 value: service.isEnabled, 167 value: service.isEnabled,
168 default: true, 168 default: true,
169 }, 169 },
170 disableHibernation: { 170 isHibernationEnabled: {
171 label: intl.formatMessage(messages.disableHibernation), 171 label: intl.formatMessage(messages.enableHibernation),
172 value: action !== 'edit' ? false : service.disableHibernation, 172 value: action !== 'edit' ? recipe.autoHibernate : service.isHibernationEnabled,
173 default: false, 173 default: true,
174 }, 174 },
175 isNotificationEnabled: { 175 isNotificationEnabled: {
176 label: intl.formatMessage(messages.enableNotification), 176 label: intl.formatMessage(messages.enableNotification),
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 097f0ed8b..148bb2c53 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -25,6 +25,7 @@ import globalMessages from '../../i18n/globalMessages';
25import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; 25import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos';
26import WorkspacesStore from '../../features/workspaces/store'; 26import WorkspacesStore from '../../features/workspaces/store';
27import { DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED } from '../../features/workspaces'; 27import { DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED } from '../../features/workspaces';
28import ServicesStore from '../../stores/ServicesStore';
28 29
29const messages = defineMessages({ 30const messages = defineMessages({
30 autoLaunchOnStart: { 31 autoLaunchOnStart: {
@@ -587,6 +588,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
587 app, 588 app,
588 todos, 589 todos,
589 workspaces, 590 workspaces,
591 services,
590 } = this.props.stores; 592 } = this.props.stores;
591 const { 593 const {
592 updateStatus, 594 updateStatus,
@@ -628,6 +630,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
628 isUsingCustomTodoService={this.props.stores.todos.isUsingCustomTodoService} 630 isUsingCustomTodoService={this.props.stores.todos.isUsingCustomTodoService}
629 isNightlyEnabled={this.props.stores.settings.app.nightly} 631 isNightlyEnabled={this.props.stores.settings.app.nightly}
630 openProcessManager={() => this.openProcessManager()} 632 openProcessManager={() => this.openProcessManager()}
633 hasAddedTodosAsService={services.isTodosServiceAdded}
634 isOnline={app.isOnline}
631 /> 635 />
632 </ErrorBoundary> 636 </ErrorBoundary>
633 ); 637 );
@@ -639,6 +643,7 @@ EditSettingsScreen.wrappedComponent.propTypes = {
639 app: PropTypes.instanceOf(AppStore).isRequired, 643 app: PropTypes.instanceOf(AppStore).isRequired,
640 user: PropTypes.instanceOf(UserStore).isRequired, 644 user: PropTypes.instanceOf(UserStore).isRequired,
641 settings: PropTypes.instanceOf(SettingsStore).isRequired, 645 settings: PropTypes.instanceOf(SettingsStore).isRequired,
646 services: PropTypes.instanceOf(ServicesStore).isRequired,
642 todos: PropTypes.instanceOf(TodosStore).isRequired, 647 todos: PropTypes.instanceOf(TodosStore).isRequired,
643 workspaces: PropTypes.instanceOf(WorkspacesStore).isRequired, 648 workspaces: PropTypes.instanceOf(WorkspacesStore).isRequired,
644 }).isRequired, 649 }).isRequired,