diff options
author | vantezzen <properly@protonmail.com> | 2019-09-07 15:50:23 +0200 |
---|---|---|
committer | vantezzen <properly@protonmail.com> | 2019-09-07 15:50:23 +0200 |
commit | e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e (patch) | |
tree | b8314e4155503b135dcb07e8b4a0e847e25c19cf /src/containers/settings | |
parent | Update CHANGELOG.md (diff) | |
parent | Update CHANGELOG.md (diff) | |
download | ferdium-app-e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e.tar.gz ferdium-app-e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e.tar.zst ferdium-app-e7a74514c1e7c3833dfdcf5900cb87f9e6e8354e.zip |
Merge branch 'master' of https://github.com/meetfranz/franz into franz-5.3.0
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/AccountScreen.js | 5 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 4 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 47 | ||||
-rw-r--r-- | src/containers/settings/RecipesScreen.js | 40 | ||||
-rw-r--r-- | src/containers/settings/TeamScreen.js | 2 |
5 files changed, 83 insertions, 15 deletions
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index fd3317301..41cdeb79a 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js | |||
@@ -30,7 +30,7 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend | |||
30 | 30 | ||
31 | let url; | 31 | let url; |
32 | if (api === 'https://api.franzinfra.com') { | 32 | if (api === 'https://api.franzinfra.com') { |
33 | url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; | 33 | url = stores.user.getAuthURL(`${WEBSITE}${route}?utm_source=app&utm_medium=account_dashboard`); |
34 | } else { | 34 | } else { |
35 | url = `${api}${route}`; | 35 | url = `${api}${route}`; |
36 | } | 36 | } |
@@ -49,6 +49,8 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend | |||
49 | <ErrorBoundary> | 49 | <ErrorBoundary> |
50 | <AccountDashboard | 50 | <AccountDashboard |
51 | user={user.data} | 51 | user={user.data} |
52 | isPremiumOverrideUser={user.isPremiumOverride} | ||
53 | isProUser={user.isPro} | ||
52 | isLoading={isLoadingUserInfo} | 54 | isLoading={isLoadingUserInfo} |
53 | isLoadingPlans={isLoadingPlans} | 55 | isLoadingPlans={isLoadingPlans} |
54 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} | 56 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} |
@@ -58,6 +60,7 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend | |||
58 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} | 60 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} |
59 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} | 61 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} |
60 | openEditAccount={() => this.handleWebsiteLink('/user/profile')} | 62 | openEditAccount={() => this.handleWebsiteLink('/user/profile')} |
63 | upgradeToPro={() => this.handleWebsiteLink('/inapp/user/licenses')} | ||
61 | openBilling={() => this.handleWebsiteLink('/user/billing')} | 64 | openBilling={() => this.handleWebsiteLink('/user/billing')} |
62 | openInvoices={() => this.handleWebsiteLink('/user/invoices')} | 65 | openInvoices={() => this.handleWebsiteLink('/user/invoices')} |
63 | /> | 66 | /> |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index 870ca4ecd..e4ff03bb3 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -330,8 +330,8 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
330 | onSubmit={d => this.onSubmit(d)} | 330 | onSubmit={d => this.onSubmit(d)} |
331 | onDelete={() => this.deleteService()} | 331 | onDelete={() => this.deleteService()} |
332 | isProxyFeatureEnabled={proxyFeature.isEnabled} | 332 | isProxyFeatureEnabled={proxyFeature.isEnabled} |
333 | isProxyPremiumFeature={proxyFeature.isPremium} | 333 | isServiceProxyIncludedInCurrentPlan={proxyFeature.isIncludedInCurrentPlan} |
334 | isSpellcheckerPremiumFeature={spellcheckerFeature.isPremium} | 334 | isSpellcheckerIncludedInCurrentPlan={spellcheckerFeature.isIncludedInCurrentPlan} |
335 | /> | 335 | /> |
336 | </ErrorBoundary> | 336 | </ErrorBoundary> |
337 | ); | 337 | ); |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index 38f73c20f..954f64dc6 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -6,6 +6,7 @@ import { defineMessages, intlShape } from 'react-intl'; | |||
6 | import AppStore from '../../stores/AppStore'; | 6 | 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 TodosStore from '../../features/todos/store'; | ||
9 | import Form from '../../lib/Form'; | 10 | import Form from '../../lib/Form'; |
10 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; | 11 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; |
11 | import { DEFAULT_APP_SETTINGS } from '../../config'; | 12 | import { DEFAULT_APP_SETTINGS } from '../../config'; |
@@ -19,6 +20,7 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; | |||
19 | import { API } from '../../environment'; | 20 | import { API } from '../../environment'; |
20 | 21 | ||
21 | import globalMessages from '../../i18n/globalMessages'; | 22 | import globalMessages from '../../i18n/globalMessages'; |
23 | import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; | ||
22 | 24 | ||
23 | const messages = defineMessages({ | 25 | const messages = defineMessages({ |
24 | autoLaunchOnStart: { | 26 | autoLaunchOnStart: { |
@@ -73,6 +75,10 @@ const messages = defineMessages({ | |||
73 | id: 'settings.app.form.beta', | 75 | id: 'settings.app.form.beta', |
74 | defaultMessage: '!!!Include beta versions', | 76 | defaultMessage: '!!!Include beta versions', |
75 | }, | 77 | }, |
78 | enableTodos: { | ||
79 | id: 'settings.app.form.enableTodos', | ||
80 | defaultMessage: '!!!Enable Franz Todos', | ||
81 | }, | ||
76 | }); | 82 | }); |
77 | 83 | ||
78 | export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { | 84 | export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { |
@@ -81,7 +87,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
81 | }; | 87 | }; |
82 | 88 | ||
83 | onSubmit(settingsData) { | 89 | onSubmit(settingsData) { |
84 | const { app, settings, user } = this.props.actions; | 90 | const { todos } = this.props.stores; |
91 | const { | ||
92 | app, | ||
93 | settings, | ||
94 | user, | ||
95 | todos: todosActions, | ||
96 | } = this.props.actions; | ||
85 | 97 | ||
86 | app.launchOnStartup({ | 98 | app.launchOnStartup({ |
87 | enable: settingsData.autoLaunchOnStart, | 99 | enable: settingsData.autoLaunchOnStart, |
@@ -112,10 +124,16 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
112 | locale: settingsData.locale, | 124 | locale: settingsData.locale, |
113 | }, | 125 | }, |
114 | }); | 126 | }); |
127 | |||
128 | if (todos.isFeatureActive) { | ||
129 | todosActions.toggleTodosFeatureVisibility(); | ||
130 | } | ||
115 | } | 131 | } |
116 | 132 | ||
117 | prepareForm() { | 133 | prepareForm() { |
118 | const { app, settings, user } = this.props.stores; | 134 | const { |
135 | app, settings, user, todos, | ||
136 | } = this.props.stores; | ||
119 | const { intl } = this.context; | 137 | const { intl } = this.context; |
120 | 138 | ||
121 | const locales = getSelectOptions({ | 139 | const locales = getSelectOptions({ |
@@ -171,8 +189,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
171 | }, | 189 | }, |
172 | enableSpellchecking: { | 190 | enableSpellchecking: { |
173 | label: intl.formatMessage(messages.enableSpellchecking), | 191 | label: intl.formatMessage(messages.enableSpellchecking), |
174 | value: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremium ? false : settings.all.app.enableSpellchecking, | 192 | value: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : settings.all.app.enableSpellchecking, |
175 | default: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremium ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, | 193 | default: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, |
176 | }, | 194 | }, |
177 | spellcheckerLanguage: { | 195 | spellcheckerLanguage: { |
178 | label: intl.formatMessage(globalMessages.spellcheckerLanguage), | 196 | label: intl.formatMessage(globalMessages.spellcheckerLanguage), |
@@ -204,16 +222,28 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
204 | }, | 222 | }, |
205 | }; | 223 | }; |
206 | 224 | ||
225 | if (todos.isFeatureActive) { | ||
226 | config.fields.enableTodos = { | ||
227 | label: intl.formatMessage(messages.enableTodos), | ||
228 | value: todos.settings.isFeatureEnabledByUser, | ||
229 | default: DEFAULT_IS_FEATURE_ENABLED_BY_USER, | ||
230 | }; | ||
231 | } | ||
232 | |||
207 | return new Form(config); | 233 | return new Form(config); |
208 | } | 234 | } |
209 | 235 | ||
210 | render() { | 236 | render() { |
211 | const { | 237 | const { |
238 | app, | ||
239 | todos, | ||
240 | } = this.props.stores; | ||
241 | const { | ||
212 | updateStatus, | 242 | updateStatus, |
213 | cacheSize, | 243 | cacheSize, |
214 | updateStatusTypes, | 244 | updateStatusTypes, |
215 | isClearingAllCache, | 245 | isClearingAllCache, |
216 | } = this.props.stores.app; | 246 | } = app; |
217 | const { | 247 | const { |
218 | checkForUpdates, | 248 | checkForUpdates, |
219 | installUpdate, | 249 | installUpdate, |
@@ -235,7 +265,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
235 | cacheSize={cacheSize} | 265 | cacheSize={cacheSize} |
236 | isClearingAllCache={isClearingAllCache} | 266 | isClearingAllCache={isClearingAllCache} |
237 | onClearAllCache={clearAllCache} | 267 | onClearAllCache={clearAllCache} |
238 | isSpellcheckerPremiumFeature={spellcheckerConfig.isPremium} | 268 | isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan} |
269 | isTodosEnabled={todos.isFeatureActive} | ||
239 | /> | 270 | /> |
240 | </ErrorBoundary> | 271 | </ErrorBoundary> |
241 | ); | 272 | ); |
@@ -247,6 +278,7 @@ EditSettingsScreen.wrappedComponent.propTypes = { | |||
247 | app: PropTypes.instanceOf(AppStore).isRequired, | 278 | app: PropTypes.instanceOf(AppStore).isRequired, |
248 | user: PropTypes.instanceOf(UserStore).isRequired, | 279 | user: PropTypes.instanceOf(UserStore).isRequired, |
249 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | 280 | settings: PropTypes.instanceOf(SettingsStore).isRequired, |
281 | todos: PropTypes.instanceOf(TodosStore).isRequired, | ||
250 | }).isRequired, | 282 | }).isRequired, |
251 | actions: PropTypes.shape({ | 283 | actions: PropTypes.shape({ |
252 | app: PropTypes.shape({ | 284 | app: PropTypes.shape({ |
@@ -261,5 +293,8 @@ EditSettingsScreen.wrappedComponent.propTypes = { | |||
261 | user: PropTypes.shape({ | 293 | user: PropTypes.shape({ |
262 | update: PropTypes.func.isRequired, | 294 | update: PropTypes.func.isRequired, |
263 | }).isRequired, | 295 | }).isRequired, |
296 | todos: PropTypes.shape({ | ||
297 | toggleTodosFeatureVisibility: PropTypes.func.isRequired, | ||
298 | }).isRequired, | ||
264 | }).isRequired, | 299 | }).isRequired, |
265 | }; | 300 | }; |
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js index eda5ae54c..132820b6f 100644 --- a/src/containers/settings/RecipesScreen.js +++ b/src/containers/settings/RecipesScreen.js | |||
@@ -1,7 +1,9 @@ | |||
1 | import { remote, shell } from 'electron'; | ||
1 | import React, { Component } from 'react'; | 2 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 3 | import PropTypes from 'prop-types'; |
3 | import { autorun } from 'mobx'; | 4 | import { autorun } from 'mobx'; |
4 | import { inject, observer } from 'mobx-react'; | 5 | import { inject, observer } from 'mobx-react'; |
6 | import path from 'path'; | ||
5 | 7 | ||
6 | import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; | 8 | import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; |
7 | import RecipeStore from '../../stores/RecipesStore'; | 9 | import RecipeStore from '../../stores/RecipesStore'; |
@@ -10,6 +12,11 @@ import UserStore from '../../stores/UserStore'; | |||
10 | 12 | ||
11 | import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; | 13 | import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; |
12 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | 14 | import ErrorBoundary from '../../components/util/ErrorBoundary'; |
15 | import { FRANZ_DEV_DOCS } from '../../config'; | ||
16 | import { gaEvent } from '../../lib/analytics'; | ||
17 | import { communityRecipesStore } from '../../features/communityRecipes'; | ||
18 | |||
19 | const { app } = remote; | ||
13 | 20 | ||
14 | export default @inject('stores', 'actions') @observer class RecipesScreen extends Component { | 21 | export default @inject('stores', 'actions') @observer class RecipesScreen extends Component { |
15 | static propTypes = { | 22 | static propTypes = { |
@@ -67,9 +74,16 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend | |||
67 | 74 | ||
68 | render() { | 75 | render() { |
69 | const { | 76 | const { |
70 | recipePreviews, recipes, services, user, | 77 | recipePreviews, |
78 | recipes, | ||
79 | services, | ||
80 | user, | ||
71 | } = this.props.stores; | 81 | } = this.props.stores; |
72 | const { showAddServiceInterface } = this.props.actions.service; | 82 | |
83 | const { | ||
84 | app: appActions, | ||
85 | service: serviceActions, | ||
86 | } = this.props.actions; | ||
73 | 87 | ||
74 | const { filter } = this.props.params; | 88 | const { filter } = this.props.params; |
75 | let recipeFilter; | 89 | let recipeFilter; |
@@ -77,7 +91,7 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend | |||
77 | if (filter === 'all') { | 91 | if (filter === 'all') { |
78 | recipeFilter = recipePreviews.all; | 92 | recipeFilter = recipePreviews.all; |
79 | } else if (filter === 'dev') { | 93 | } else if (filter === 'dev') { |
80 | recipeFilter = recipePreviews.dev; | 94 | recipeFilter = communityRecipesStore.communityRecipes; |
81 | } else { | 95 | } else { |
82 | recipeFilter = recipePreviews.featured; | 96 | recipeFilter = recipePreviews.featured; |
83 | } | 97 | } |
@@ -89,6 +103,8 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend | |||
89 | || recipes.installRecipeRequest.isExecuting | 103 | || recipes.installRecipeRequest.isExecuting |
90 | || recipePreviews.searchRecipePreviewsRequest.isExecuting; | 104 | || recipePreviews.searchRecipePreviewsRequest.isExecuting; |
91 | 105 | ||
106 | const recipeDirectory = path.join(app.getPath('userData'), 'recipes', 'dev'); | ||
107 | |||
92 | return ( | 108 | return ( |
93 | <ErrorBoundary> | 109 | <ErrorBoundary> |
94 | <RecipesDashboard | 110 | <RecipesDashboard |
@@ -97,12 +113,23 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend | |||
97 | addedServiceCount={services.all.length} | 113 | addedServiceCount={services.all.length} |
98 | isPremium={user.data.isPremium} | 114 | isPremium={user.data.isPremium} |
99 | hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted} | 115 | hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted} |
100 | showAddServiceInterface={showAddServiceInterface} | 116 | showAddServiceInterface={serviceActions.showAddServiceInterface} |
101 | searchRecipes={e => this.searchRecipes(e)} | 117 | searchRecipes={e => this.searchRecipes(e)} |
102 | resetSearch={() => this.resetSearch()} | 118 | resetSearch={() => this.resetSearch()} |
103 | searchNeedle={this.state.needle} | 119 | searchNeedle={this.state.needle} |
104 | serviceStatus={services.actionStatus} | 120 | serviceStatus={services.actionStatus} |
105 | devRecipesCount={recipePreviews.dev.length} | 121 | recipeFilter={filter} |
122 | recipeDirectory={recipeDirectory} | ||
123 | openRecipeDirectory={() => { | ||
124 | shell.openItem(recipeDirectory); | ||
125 | gaEvent('Recipe', 'open-recipe-folder', 'Open Folder'); | ||
126 | }} | ||
127 | openDevDocs={() => { | ||
128 | appActions.openExternalUrl({ url: FRANZ_DEV_DOCS }); | ||
129 | gaEvent('Recipe', 'open-dev-docs', 'Developer Documentation'); | ||
130 | }} | ||
131 | isCommunityRecipesIncludedInCurrentPlan={communityRecipesStore.isCommunityRecipesIncludedInCurrentPlan} | ||
132 | isUserPremiumUser={user.isPremium} | ||
106 | /> | 133 | /> |
107 | </ErrorBoundary> | 134 | </ErrorBoundary> |
108 | ); | 135 | ); |
@@ -117,6 +144,9 @@ RecipesScreen.wrappedComponent.propTypes = { | |||
117 | user: PropTypes.instanceOf(UserStore).isRequired, | 144 | user: PropTypes.instanceOf(UserStore).isRequired, |
118 | }).isRequired, | 145 | }).isRequired, |
119 | actions: PropTypes.shape({ | 146 | actions: PropTypes.shape({ |
147 | app: PropTypes.shape({ | ||
148 | openExternalUrl: PropTypes.func.isRequired, | ||
149 | }).isRequired, | ||
120 | service: PropTypes.shape({ | 150 | service: PropTypes.shape({ |
121 | showAddServiceInterface: PropTypes.func.isRequired, | 151 | showAddServiceInterface: PropTypes.func.isRequired, |
122 | }).isRequired, | 152 | }).isRequired, |
diff --git a/src/containers/settings/TeamScreen.js b/src/containers/settings/TeamScreen.js index c69d5ad08..f600c9947 100644 --- a/src/containers/settings/TeamScreen.js +++ b/src/containers/settings/TeamScreen.js | |||
@@ -14,7 +14,6 @@ export default @inject('stores', 'actions') @observer class TeamScreen extends C | |||
14 | const { actions, stores } = this.props; | 14 | const { actions, stores } = this.props; |
15 | 15 | ||
16 | const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; | 16 | const url = `${WEBSITE}${route}?authToken=${stores.user.authToken}&utm_source=app&utm_medium=account_dashboard`; |
17 | console.log(url); | ||
18 | 17 | ||
19 | actions.app.openExternalUrl({ url }); | 18 | actions.app.openExternalUrl({ url }); |
20 | } | 19 | } |
@@ -31,6 +30,7 @@ export default @inject('stores', 'actions') @observer class TeamScreen extends C | |||
31 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} | 30 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} |
32 | retryUserInfoRequest={() => this.reloadData()} | 31 | retryUserInfoRequest={() => this.reloadData()} |
33 | openTeamManagement={() => this.handleWebsiteLink('/user/team')} | 32 | openTeamManagement={() => this.handleWebsiteLink('/user/team')} |
33 | isProUser={user.isPro} | ||
34 | /> | 34 | /> |
35 | </ErrorBoundary> | 35 | </ErrorBoundary> |
36 | ); | 36 | ); |