aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Service.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-06-14 15:29:04 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-06-14 15:29:04 +0200
commitbbfb750bafadae49116b1a420664ea753cd9b50b (patch)
treedddf11190cfdcfaa8171f7609b1e4d5dd0654dff /src/models/Service.js
parentAdd "service limit reached" screen (diff)
downloadferdium-app-bbfb750bafadae49116b1a420664ea753cd9b50b.tar.gz
ferdium-app-bbfb750bafadae49116b1a420664ea753cd9b50b.tar.zst
ferdium-app-bbfb750bafadae49116b1a420664ea753cd9b50b.zip
Restrict services with customURL when not premium user
Diffstat (limited to 'src/models/Service.js')
-rw-r--r--src/models/Service.js17
1 files changed, 15 insertions, 2 deletions
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';
4 4
5const debug = require('debug')('Franz:Service'); 5const debug = require('debug')('Franz:Service');
6 6
7export const RESTRICTION_TYPES = {
8 SERVICE_LIMIT: 0,
9 CUSTOM_URL: 1,
10};
11
7export default class Service { 12export default class Service {
8 id = ''; 13 id = '';
9 14
@@ -59,6 +64,12 @@ export default class Service {
59 64
60 @observable errorMessage = ''; 65 @observable errorMessage = '';
61 66
67 @observable isUsingCustomUrl = false;
68
69 @observable isServiceAccessRestricted = false;
70
71 @observable restrictionType = null;
72
62 constructor(data, recipe) { 73 constructor(data, recipe) {
63 if (!data) { 74 if (!data) {
64 console.error('Service config not valid'); 75 console.error('Service config not valid');
@@ -104,8 +115,6 @@ export default class Service {
104 115
105 this.recipe = recipe; 116 this.recipe = recipe;
106 117
107 this.isServiceAccessRestricted = false;
108
109 autorun(() => { 118 autorun(() => {
110 if (!this.isEnabled) { 119 if (!this.isEnabled) {
111 this.webview = null; 120 this.webview = null;
@@ -113,6 +122,10 @@ export default class Service {
113 this.unreadDirectMessageCount = 0; 122 this.unreadDirectMessageCount = 0;
114 this.unreadIndirectMessageCount = 0; 123 this.unreadIndirectMessageCount = 0;
115 } 124 }
125
126 if (this.recipe.hasCustomUrl && this.customUrl) {
127 this.isUsingCustomUrl = true;
128 }
116 }); 129 });
117 } 130 }
118 131