diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 5 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 14 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/models/Recipe.ts | 34 | ||||
-rw-r--r-- | src/models/Service.js | 7 |
5 files changed, 48 insertions, 13 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 7df6d5c78..179741338 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -343,6 +343,11 @@ class EditServiceForm extends Component { | |||
343 | </p> | 343 | </p> |
344 | </> | 344 | </> |
345 | )} | 345 | )} |
346 | {recipe.allowFavoritesDelineationInUnreadCount && ( | ||
347 | <Toggle | ||
348 | field={form.$('onlyShowFavoritesInUnreadCount')} | ||
349 | /> | ||
350 | )} | ||
346 | </div> | 351 | </div> |
347 | 352 | ||
348 | <div className="settings__settings-group"> | 353 | <div className="settings__settings-group"> |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index e2ed4eeac..dee7e7cff 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -81,6 +81,10 @@ const messages = defineMessages({ | |||
81 | id: 'settings.service.form.darkReaderSepia', | 81 | id: 'settings.service.form.darkReaderSepia', |
82 | defaultMessage: 'Dark Reader Sepia', | 82 | defaultMessage: 'Dark Reader Sepia', |
83 | }, | 83 | }, |
84 | onlyShowFavoritesInUnreadCount: { | ||
85 | id: 'settings.service.form.onlyShowFavoritesInUnreadCount', | ||
86 | defaultMessage: 'Only show Favorites in unread count', | ||
87 | }, | ||
84 | enableProxy: { | 88 | enableProxy: { |
85 | id: 'settings.service.form.proxy.isEnabled', | 89 | id: 'settings.service.form.proxy.isEnabled', |
86 | defaultMessage: 'Use Proxy', | 90 | defaultMessage: 'Use Proxy', |
@@ -289,6 +293,16 @@ class EditServiceScreen extends Component { | |||
289 | }); | 293 | }); |
290 | } | 294 | } |
291 | 295 | ||
296 | if (recipe.allowFavoritesDelineationInUnreadCount) { | ||
297 | Object.assign(config.fields, { | ||
298 | onlyShowFavoritesInUnreadCount: { | ||
299 | label: intl.formatMessage(messages.onlyShowFavoritesInUnreadCount), | ||
300 | value: service.onlyShowFavoritesInUnreadCount, | ||
301 | default: false, | ||
302 | }, | ||
303 | }); | ||
304 | } | ||
305 | |||
292 | if (proxy.isEnabled) { | 306 | if (proxy.isEnabled) { |
293 | const serviceProxyConfig = stores.settings.proxy[service.id] || {}; | 307 | const serviceProxyConfig = stores.settings.proxy[service.id] || {}; |
294 | 308 | ||
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 25eedb456..471726ecc 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -321,6 +321,7 @@ | |||
321 | "settings.service.form.isHibernatedEnabledInfo": "When enabled, a service will be shut down after a period of time to save system resources.", | 321 | "settings.service.form.isHibernatedEnabledInfo": "When enabled, a service will be shut down after a period of time to save system resources.", |
322 | "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted", | 322 | "settings.service.form.isMutedInfo": "When disabled, all notification sounds and audio playback are muted", |
323 | "settings.service.form.name": "Name", | 323 | "settings.service.form.name": "Name", |
324 | "settings.service.form.onlyShowFavoritesInUnreadCount": "Only show Favorites in unread count", | ||
324 | "settings.service.form.openDarkmodeCss": "Open darkmode.css", | 325 | "settings.service.form.openDarkmodeCss": "Open darkmode.css", |
325 | "settings.service.form.openUserCss": "Open user.css", | 326 | "settings.service.form.openUserCss": "Open user.css", |
326 | "settings.service.form.openUserJs": "Open user.js", | 327 | "settings.service.form.openUserJs": "Open user.js", |
diff --git a/src/models/Recipe.ts b/src/models/Recipe.ts index 6022fb520..83d1d4478 100644 --- a/src/models/Recipe.ts +++ b/src/models/Recipe.ts | |||
@@ -1,6 +1,10 @@ | |||
1 | import semver from 'semver'; | 1 | import semver from 'semver'; |
2 | import { pathExistsSync } from 'fs-extra'; | 2 | import { pathExistsSync } from 'fs-extra'; |
3 | import { join } from 'path'; | 3 | import { join } from 'path'; |
4 | import { | ||
5 | ifUndefinedString, | ||
6 | ifUndefinedBoolean, | ||
7 | } from '../jsUtils'; | ||
4 | 8 | ||
5 | interface IRecipe { | 9 | interface IRecipe { |
6 | id: string; | 10 | id: string; |
@@ -22,6 +26,7 @@ interface IRecipe { | |||
22 | autoHibernate?: boolean; | 26 | autoHibernate?: boolean; |
23 | partition?: string; | 27 | partition?: string; |
24 | message?: string; | 28 | message?: string; |
29 | allowFavoritesDelineationInUnreadCount?: boolean; | ||
25 | }; | 30 | }; |
26 | } | 31 | } |
27 | 32 | ||
@@ -59,6 +64,8 @@ export default class Recipe { | |||
59 | 64 | ||
60 | message: string = ''; | 65 | message: string = ''; |
61 | 66 | ||
67 | allowFavoritesDelineationInUnreadCount: boolean = false; | ||
68 | |||
62 | disablewebsecurity: boolean = false; | 69 | disablewebsecurity: boolean = false; |
63 | 70 | ||
64 | autoHibernate: boolean = false; | 71 | autoHibernate: boolean = false; |
@@ -81,30 +88,31 @@ export default class Recipe { | |||
81 | } | 88 | } |
82 | 89 | ||
83 | this.id = data.id || this.id; | 90 | this.id = data.id || this.id; |
84 | this.name = data.name || this.name; | 91 | this.name = ifUndefinedString(data.name, this.name); |
85 | this.version = data.version || this.version; | 92 | this.version = ifUndefinedString(data.version, this.version); |
86 | this.aliases = data.aliases || this.aliases; | 93 | this.aliases = data.aliases || this.aliases; |
87 | this.path = data.path; | 94 | this.path = data.path; |
88 | 95 | ||
89 | this.serviceURL = data.config.serviceURL || this.serviceURL; | 96 | this.serviceURL = ifUndefinedString(data.config.serviceURL, this.serviceURL); |
90 | 97 | ||
91 | this.hasDirectMessages = data.config.hasDirectMessages || this.hasDirectMessages; | 98 | this.hasDirectMessages = ifUndefinedBoolean(data.config.hasDirectMessages, this.hasDirectMessages); |
92 | this.hasIndirectMessages = data.config.hasIndirectMessages || this.hasIndirectMessages; | 99 | this.hasIndirectMessages = ifUndefinedBoolean(data.config.hasIndirectMessages, this.hasIndirectMessages); |
93 | this.hasNotificationSound = data.config.hasNotificationSound || this.hasNotificationSound; | 100 | this.hasNotificationSound = ifUndefinedBoolean(data.config.hasNotificationSound, this.hasNotificationSound); |
94 | this.hasTeamId = data.config.hasTeamId || this.hasTeamId; | 101 | this.hasTeamId = ifUndefinedBoolean(data.config.hasTeamId, this.hasTeamId); |
95 | this.hasCustomUrl = data.config.hasCustomUrl || this.hasCustomUrl; | 102 | this.hasCustomUrl = ifUndefinedBoolean(data.config.hasCustomUrl, this.hasCustomUrl); |
96 | this.hasHostedOption = data.config.hasHostedOption || this.hasHostedOption; | 103 | this.hasHostedOption = ifUndefinedBoolean(data.config.hasHostedOption, this.hasHostedOption); |
97 | 104 | ||
98 | this.urlInputPrefix = data.config.urlInputPrefix || this.urlInputPrefix; | 105 | this.urlInputPrefix = ifUndefinedString(data.config.urlInputPrefix, this.urlInputPrefix); |
99 | this.urlInputSuffix = data.config.urlInputSuffix || this.urlInputSuffix; | 106 | this.urlInputSuffix = ifUndefinedString(data.config.urlInputSuffix, this.urlInputSuffix); |
100 | 107 | ||
101 | this.disablewebsecurity = data.config.disablewebsecurity || this.disablewebsecurity; | 108 | this.disablewebsecurity = data.config.disablewebsecurity || this.disablewebsecurity; |
102 | 109 | ||
103 | this.autoHibernate = data.config.autoHibernate || this.autoHibernate; | 110 | this.autoHibernate = data.config.autoHibernate || this.autoHibernate; |
104 | 111 | ||
105 | this.partition = data.config.partition || this.partition; | 112 | this.partition = ifUndefinedString(data.config.partition, this.partition); |
106 | 113 | ||
107 | this.message = data.config.message || this.message; | 114 | this.message = ifUndefinedString(data.config.message, this.message); |
115 | this.allowFavoritesDelineationInUnreadCount = ifUndefinedBoolean(data.config.allowFavoritesDelineationInUnreadCount, this.allowFavoritesDelineationInUnreadCount); | ||
108 | } | 116 | } |
109 | 117 | ||
110 | // TODO: Need to remove this if its not used anywhere | 118 | // TODO: Need to remove this if its not used anywhere |
diff --git a/src/models/Service.js b/src/models/Service.js index cc001f98d..75dfde027 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -83,6 +83,8 @@ export default class Service { | |||
83 | 83 | ||
84 | @observable isHibernationRequested = false; | 84 | @observable isHibernationRequested = false; |
85 | 85 | ||
86 | @observable onlyShowFavoritesInUnreadCount = false; | ||
87 | |||
86 | @observable lastUsed = Date.now(); // timestamp | 88 | @observable lastUsed = Date.now(); // timestamp |
87 | 89 | ||
88 | @observable lastHibernated = null; // timestamp | 90 | @observable lastHibernated = null; // timestamp |
@@ -144,6 +146,10 @@ export default class Service { | |||
144 | data.hasCustomIcon, | 146 | data.hasCustomIcon, |
145 | this.hasCustomUploadedIcon, | 147 | this.hasCustomUploadedIcon, |
146 | ); | 148 | ); |
149 | this.onlyShowFavoritesInUnreadCount = ifUndefinedBoolean( | ||
150 | data.onlyShowFavoritesInUnreadCount, | ||
151 | this.onlyShowFavoritesInUnreadCount, | ||
152 | ); | ||
147 | this.proxy = ifUndefinedString(data.proxy, this.proxy); | 153 | this.proxy = ifUndefinedString(data.proxy, this.proxy); |
148 | this.spellcheckerLanguage = ifUndefinedString( | 154 | this.spellcheckerLanguage = ifUndefinedString( |
149 | data.spellcheckerLanguage, | 155 | data.spellcheckerLanguage, |
@@ -191,6 +197,7 @@ export default class Service { | |||
191 | team: this.team, | 197 | team: this.team, |
192 | url: this.url, | 198 | url: this.url, |
193 | hasCustomIcon: this.hasCustomIcon, | 199 | hasCustomIcon: this.hasCustomIcon, |
200 | onlyShowFavoritesInUnreadCount: this.onlyShowFavoritesInUnreadCount, | ||
194 | }; | 201 | }; |
195 | } | 202 | } |
196 | 203 | ||