From bbfb750bafadae49116b1a420664ea753cd9b50b Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 14 Jun 2019 15:29:04 +0200 Subject: Restrict services with customURL when not premium user --- src/models/Service.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/models/Service.js') diff --git a/src/models/Service.js b/src/models/Service.js index fa3648a39..848a84aa2 100644 --- a/src/models/Service.js +++ b/src/models/Service.js @@ -4,6 +4,11 @@ import normalizeUrl from 'normalize-url'; const debug = require('debug')('Franz:Service'); +export const RESTRICTION_TYPES = { + SERVICE_LIMIT: 0, + CUSTOM_URL: 1, +}; + export default class Service { id = ''; @@ -59,6 +64,12 @@ export default class Service { @observable errorMessage = ''; + @observable isUsingCustomUrl = false; + + @observable isServiceAccessRestricted = false; + + @observable restrictionType = null; + constructor(data, recipe) { if (!data) { console.error('Service config not valid'); @@ -104,8 +115,6 @@ export default class Service { this.recipe = recipe; - this.isServiceAccessRestricted = false; - autorun(() => { if (!this.isEnabled) { this.webview = null; @@ -113,6 +122,10 @@ export default class Service { this.unreadDirectMessageCount = 0; this.unreadIndirectMessageCount = 0; } + + if (this.recipe.hasCustomUrl && this.customUrl) { + this.isUsingCustomUrl = true; + } }); } -- cgit v1.2.3-54-g00ecf