aboutsummaryrefslogtreecommitdiffstats
path: root/src/models
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2021-09-24 07:39:41 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-09-24 07:48:24 +0530
commit2e96a61955e525bf6269e41342bf3ffce05805a6 (patch)
treeb45118a2000d751b0d22ff08d12385b96d195145 /src/models
parentUpdate submodules, browserslist data updates and linter fixes [skip ci] (diff)
downloadferdium-app-2e96a61955e525bf6269e41342bf3ffce05805a6.tar.gz
ferdium-app-2e96a61955e525bf6269e41342bf3ffce05805a6.tar.zst
ferdium-app-2e96a61955e525bf6269e41342bf3ffce05805a6.zip
Allow services to delineate favorites vs non-favorites in unread counts (#1979)
implements getferdi/recipes#721 (eg: office365-owa)
Diffstat (limited to 'src/models')
-rw-r--r--src/models/Recipe.ts34
-rw-r--r--src/models/Service.js7
2 files changed, 28 insertions, 13 deletions
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 @@
1import semver from 'semver'; 1import semver from 'semver';
2import { pathExistsSync } from 'fs-extra'; 2import { pathExistsSync } from 'fs-extra';
3import { join } from 'path'; 3import { join } from 'path';
4import {
5 ifUndefinedString,
6 ifUndefinedBoolean,
7} from '../jsUtils';
4 8
5interface IRecipe { 9interface 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