Fixed feature flags

This commit is contained in:
Kasra Bigdeli
2023-08-04 21:34:58 -07:00
parent a720d22b44
commit 71619e18b1
2 changed files with 8 additions and 6 deletions
+6 -2
View File
@@ -6,8 +6,8 @@ import Logger from '../utils/Logger'
export default class FeatureFlags {
static instance: FeatureFlags
featureFlags: any | undefined
static IS_PRO_ENABLED: 'isProEnabled'
private featureFlags: any | undefined
static IS_PRO_ENABLED = 'isProEnabled'
static get(datastore: DataStore) {
if (!FeatureFlags.instance) {
@@ -22,6 +22,10 @@ export default class FeatureFlags {
self.featureFlags = self.datastore.getFeatureFlags()
}
getFeatureFlags(): any | undefined {
return this.featureFlags
}
private refreshFeatureFlags() {
const self = this
Promise.resolve() //
+2 -4
View File
@@ -127,13 +127,11 @@ export default class ProManager {
return self.proDataStore.getApiKey()
})
.then(function (apiKey) {
const flags = self.featureFlagsProvider.getFeatureFlags()
return {
isSubscribed: !!apiKey,
isFeatureFlagEnabled:
self.featureFlagsProvider.featureFlags &&
self.featureFlagsProvider.featureFlags[
FeatureFlags.IS_PRO_ENABLED
],
flags && flags[FeatureFlags.IS_PRO_ENABLED],
}
})
}