[DE PE mobile] Fix app options stores according to mobx v. 6

This commit is contained in:
JuliaSvinareva 2021-03-09 18:05:16 +03:00
parent 1cf1bb5df3
commit 1c899fb7ed
2 changed files with 27 additions and 11 deletions

View file

@ -1,16 +1,23 @@
import {action, observable} from 'mobx';
import {makeObservable, action, observable} from 'mobx';
export class storeAppOptions {
constructor() {
// makeObservable(this);
makeObservable(this, {
isEdit: observable,
canViewComments: observable,
canReview: observable,
setConfigOptions: action,
setPermissionOptions: action,
setCanViewReview: action
});
}
@observable isEdit = false;
@observable canViewComments = false;
@observable canReview = false;
isEdit = false;
canViewComments = false;
canReview = false;
config = {};
@action setConfigOptions (config) {
setConfigOptions (config) {
this.config = config;
this.user = Common.Utils.fillUserInfo(config.user, config.lang, "Local.User"/*me.textAnonymous*/);
this.isDesktopApp = config.targetApp == 'desktop';
@ -32,7 +39,7 @@ export class storeAppOptions {
this.canBack = this.canBackToFolder === true;
this.canPlugins = false;
}
@action setPermissionOptions (document, licType, params, permissions) {
setPermissionOptions (document, licType, params, permissions) {
this.review = (permissions.review === undefined) ? (permissions.edit !== false) : permissions.review;
this.canAnalytics = params.asc_getIsAnalyticsEnable();
this.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);
@ -79,7 +86,7 @@ export class storeAppOptions {
this.canUseReviewPermissions = this.canLicense && this.customization && this.customization.reviewPermissions && (typeof (this.customization.reviewPermissions) == 'object');
}
@action setCanViewReview (value) {
setCanViewReview (value) {
this.canViewReview = value;
}
}

View file

@ -1,8 +1,17 @@
import {action, observable} from 'mobx';
import {makeObservable, action, observable} from 'mobx';
export class storeAppOptions {
constructor() {
makeObservable(this, {
isEdit: observable,
setConfigOptions: action,
setPermissionOptions: action
});
}
isEdit = false;
config = {};
@action setConfigOptions (config) {
setConfigOptions (config) {
this.config = config;
this.user = Common.Utils.fillUserInfo(config.user, config.lang, "Local.User"/*me.textAnonymous*/);
this.isDesktopApp = config.targetApp == 'desktop';
@ -24,7 +33,7 @@ export class storeAppOptions {
this.canBack = this.canBackToFolder === true;
this.canPlugins = false;
}
@action setPermissionOptions (document, licType, params, permissions) {
setPermissionOptions (document, licType, params, permissions) {
this.review = (permissions.review === undefined) ? (permissions.edit !== false) : permissions.review;
this.canAnalytics = params.asc_getIsAnalyticsEnable();
this.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit);