diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-12-24 22:11:36 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2017-12-24 22:11:36 +0100 |
commit | df44b69c4655415fe1e44689ece443ec06ef0f52 (patch) | |
tree | e677ed5f5328bb3b14bc976c7392d8e259f89034 /src/containers/settings | |
parent | [wip] add icon upload (diff) | |
parent | Merge pull request #494 from heavypackets/websecurity-enable-patch (diff) | |
download | ferdium-app-df44b69c4655415fe1e44689ece443ec06ef0f52.tar.gz ferdium-app-df44b69c4655415fe1e44689ece443ec06ef0f52.tar.zst ferdium-app-df44b69c4655415fe1e44689ece443ec06ef0f52.zip |
Merge branch 'develop' into feature/icon-upload
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/AccountScreen.js | 5 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 20 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 58 |
3 files changed, 77 insertions, 6 deletions
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index a1ac8bda3..008c495d4 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js | |||
@@ -69,6 +69,7 @@ export default class AccountScreen extends Component { | |||
69 | render() { | 69 | render() { |
70 | const { user, payment, app } = this.props.stores; | 70 | const { user, payment, app } = this.props.stores; |
71 | const { openExternalUrl } = this.props.actions.app; | 71 | const { openExternalUrl } = this.props.actions.app; |
72 | const { user: userActions } = this.props.actions; | ||
72 | 73 | ||
73 | const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; | 74 | const isLoadingUserInfo = user.getUserInfoRequest.isExecuting; |
74 | const isLoadingOrdersInfo = payment.ordersDataRequest.isExecuting; | 75 | const isLoadingOrdersInfo = payment.ordersDataRequest.isExecuting; |
@@ -89,6 +90,9 @@ export default class AccountScreen extends Component { | |||
89 | openExternalUrl={url => openExternalUrl({ url })} | 90 | openExternalUrl={url => openExternalUrl({ url })} |
90 | onCloseSubscriptionWindow={() => this.onCloseWindow()} | 91 | onCloseSubscriptionWindow={() => this.onCloseWindow()} |
91 | stopMiner={() => this.stopMiner()} | 92 | stopMiner={() => this.stopMiner()} |
93 | deleteAccount={userActions.delete} | ||
94 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} | ||
95 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} | ||
92 | /> | 96 | /> |
93 | ); | 97 | ); |
94 | } | 98 | } |
@@ -109,6 +113,7 @@ AccountScreen.wrappedComponent.propTypes = { | |||
109 | }).isRequired, | 113 | }).isRequired, |
110 | user: PropTypes.shape({ | 114 | user: PropTypes.shape({ |
111 | update: PropTypes.func.isRequired, | 115 | update: PropTypes.func.isRequired, |
116 | delete: PropTypes.func.isRequired, | ||
112 | }).isRequired, | 117 | }).isRequired, |
113 | }).isRequired, | 118 | }).isRequired, |
114 | }; | 119 | }; |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index 52a9fa6db..8827896ef 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -26,6 +26,10 @@ const messages = defineMessages({ | |||
26 | id: 'settings.service.form.enableNotification', | 26 | id: 'settings.service.form.enableNotification', |
27 | defaultMessage: '!!!Enable Notifications', | 27 | defaultMessage: '!!!Enable Notifications', |
28 | }, | 28 | }, |
29 | enableBadge: { | ||
30 | id: 'settings.service.form.enableBadge', | ||
31 | defaultMessage: '!!!Show unread message badges', | ||
32 | }, | ||
29 | enableAudio: { | 33 | enableAudio: { |
30 | id: 'settings.service.form.enableAudio', | 34 | id: 'settings.service.form.enableAudio', |
31 | defaultMessage: '!!!Enable audio', | 35 | defaultMessage: '!!!Enable audio', |
@@ -92,6 +96,11 @@ export default class EditServiceScreen extends Component { | |||
92 | value: service.isNotificationEnabled, | 96 | value: service.isNotificationEnabled, |
93 | default: true, | 97 | default: true, |
94 | }, | 98 | }, |
99 | isBadgeEnabled: { | ||
100 | label: intl.formatMessage(messages.enableBadge), | ||
101 | value: service.isBadgeEnabled, | ||
102 | default: true, | ||
103 | }, | ||
95 | isMuted: { | 104 | isMuted: { |
96 | label: intl.formatMessage(messages.enableAudio), | 105 | label: intl.formatMessage(messages.enableAudio), |
97 | value: !service.isMuted, | 106 | value: !service.isMuted, |
@@ -127,11 +136,22 @@ export default class EditServiceScreen extends Component { | |||
127 | }); | 136 | }); |
128 | } | 137 | } |
129 | 138 | ||
139 | // More fine grained and use case specific validation rules | ||
130 | if (recipe.hasTeamId && recipe.hasCustomUrl) { | 140 | if (recipe.hasTeamId && recipe.hasCustomUrl) { |
131 | config.fields.team.validate = [oneRequired(['team', 'customUrl'])]; | 141 | config.fields.team.validate = [oneRequired(['team', 'customUrl'])]; |
132 | config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])]; | 142 | config.fields.customUrl.validate = [url, oneRequired(['team', 'customUrl'])]; |
133 | } | 143 | } |
134 | 144 | ||
145 | // If a service can be hosted and has a teamId or customUrl | ||
146 | if (recipe.hasHostedOption && (recipe.hasTeamId || recipe.hasCustomUrl)) { | ||
147 | if (config.fields.team) { | ||
148 | config.fields.team.validate = []; | ||
149 | } | ||
150 | if (config.fields.customUrl) { | ||
151 | config.fields.customUrl.validate = [url]; | ||
152 | } | ||
153 | } | ||
154 | |||
135 | if (recipe.hasIndirectMessages) { | 155 | if (recipe.hasIndirectMessages) { |
136 | Object.assign(config.fields, { | 156 | Object.assign(config.fields, { |
137 | isIndirectMessageBadgeEnabled: { | 157 | isIndirectMessageBadgeEnabled: { |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index b10acf3c6..45ded9e5c 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -7,7 +7,7 @@ import AppStore from '../../stores/AppStore'; | |||
7 | import SettingsStore from '../../stores/SettingsStore'; | 7 | import SettingsStore from '../../stores/SettingsStore'; |
8 | import UserStore from '../../stores/UserStore'; | 8 | import UserStore from '../../stores/UserStore'; |
9 | import Form from '../../lib/Form'; | 9 | import Form from '../../lib/Form'; |
10 | import languages from '../../i18n/languages'; | 10 | import { APP_LOCALES } from '../../i18n/languages'; |
11 | import { gaPage } from '../../lib/analytics'; | 11 | import { gaPage } from '../../lib/analytics'; |
12 | import { DEFAULT_APP_SETTINGS } from '../../config'; | 12 | import { DEFAULT_APP_SETTINGS } from '../../config'; |
13 | 13 | ||
@@ -43,6 +43,22 @@ const messages = defineMessages({ | |||
43 | id: 'settings.app.form.showDisabledServices', | 43 | id: 'settings.app.form.showDisabledServices', |
44 | defaultMessage: '!!!Display disabled services tabs', | 44 | defaultMessage: '!!!Display disabled services tabs', |
45 | }, | 45 | }, |
46 | showMessageBadgeWhenMuted: { | ||
47 | id: 'settings.app.form.showMessagesBadgesWhenMuted', | ||
48 | defaultMessage: '!!!Show unread message badge when notifications are disabled', | ||
49 | }, | ||
50 | enableSpellchecking: { | ||
51 | id: 'settings.app.form.enableSpellchecking', | ||
52 | defaultMessage: '!!!Enable spell checking', | ||
53 | }, | ||
54 | spellcheckingLanguage: { | ||
55 | id: 'settings.app.form.spellcheckingLanguage', | ||
56 | defaultMessage: '!!!Language for spell checking', | ||
57 | }, | ||
58 | // spellcheckingAutomaticDetection: { | ||
59 | // id: 'settings.app.form.spellcheckingAutomaticDetection', | ||
60 | // defaultMessage: '!!!Detect language automatically', | ||
61 | // }, | ||
46 | beta: { | 62 | beta: { |
47 | id: 'settings.app.form.beta', | 63 | id: 'settings.app.form.beta', |
48 | defaultMessage: '!!!Include beta versions', | 64 | defaultMessage: '!!!Include beta versions', |
@@ -73,6 +89,9 @@ export default class EditSettingsScreen extends Component { | |||
73 | enableSystemTray: settingsData.enableSystemTray, | 89 | enableSystemTray: settingsData.enableSystemTray, |
74 | minimizeToSystemTray: settingsData.minimizeToSystemTray, | 90 | minimizeToSystemTray: settingsData.minimizeToSystemTray, |
75 | showDisabledServices: settingsData.showDisabledServices, | 91 | showDisabledServices: settingsData.showDisabledServices, |
92 | showMessageBadgeWhenMuted: settingsData.showMessageBadgeWhenMuted, | ||
93 | enableSpellchecking: settingsData.enableSpellchecking, | ||
94 | // spellcheckingLanguage: settingsData.spellcheckingLanguage, | ||
76 | locale: settingsData.locale, | 95 | locale: settingsData.locale, |
77 | beta: settingsData.beta, | 96 | beta: settingsData.beta, |
78 | }, | 97 | }, |
@@ -89,14 +108,25 @@ export default class EditSettingsScreen extends Component { | |||
89 | const { app, settings, user } = this.props.stores; | 108 | const { app, settings, user } = this.props.stores; |
90 | const { intl } = this.context; | 109 | const { intl } = this.context; |
91 | 110 | ||
92 | const options = []; | 111 | const locales = []; |
93 | Object.keys(languages).forEach((key) => { | 112 | Object.keys(APP_LOCALES).forEach((key) => { |
94 | options.push({ | 113 | locales.push({ |
95 | value: key, | 114 | value: key, |
96 | label: languages[key], | 115 | label: APP_LOCALES[key], |
97 | }); | 116 | }); |
98 | }); | 117 | }); |
99 | 118 | ||
119 | // const spellcheckerLocales = [{ | ||
120 | // value: 'auto', | ||
121 | // label: intl.formatMessage(messages.spellcheckingAutomaticDetection), | ||
122 | // }]; | ||
123 | // Object.keys(SPELLCHECKER_LOCALES).forEach((key) => { | ||
124 | // spellcheckerLocales.push({ | ||
125 | // value: key, | ||
126 | // label: SPELLCHECKER_LOCALES[key], | ||
127 | // }); | ||
128 | // }); | ||
129 | |||
100 | const config = { | 130 | const config = { |
101 | fields: { | 131 | fields: { |
102 | autoLaunchOnStart: { | 132 | autoLaunchOnStart: { |
@@ -129,10 +159,26 @@ export default class EditSettingsScreen extends Component { | |||
129 | value: settings.all.showDisabledServices, | 159 | value: settings.all.showDisabledServices, |
130 | default: DEFAULT_APP_SETTINGS.showDisabledServices, | 160 | default: DEFAULT_APP_SETTINGS.showDisabledServices, |
131 | }, | 161 | }, |
162 | showMessageBadgeWhenMuted: { | ||
163 | label: intl.formatMessage(messages.showMessageBadgeWhenMuted), | ||
164 | value: settings.all.showMessageBadgeWhenMuted, | ||
165 | default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted, | ||
166 | }, | ||
167 | enableSpellchecking: { | ||
168 | label: intl.formatMessage(messages.enableSpellchecking), | ||
169 | value: settings.all.enableSpellchecking, | ||
170 | default: DEFAULT_APP_SETTINGS.enableSpellchecking, | ||
171 | }, | ||
172 | // spellcheckingLanguage: { | ||
173 | // label: intl.formatMessage(messages.spellcheckingLanguage), | ||
174 | // value: settings.all.spellcheckingLanguage, | ||
175 | // options: spellcheckerLocales, | ||
176 | // default: DEFAULT_APP_SETTINGS.spellcheckingLanguage, | ||
177 | // }, | ||
132 | locale: { | 178 | locale: { |
133 | label: intl.formatMessage(messages.language), | 179 | label: intl.formatMessage(messages.language), |
134 | value: app.locale, | 180 | value: app.locale, |
135 | options, | 181 | options: locales, |
136 | default: DEFAULT_APP_SETTINGS.locale, | 182 | default: DEFAULT_APP_SETTINGS.locale, |
137 | }, | 183 | }, |
138 | beta: { | 184 | beta: { |