[Mobile] For Bug 54642

This commit is contained in:
Julia Radzhabova 2022-05-23 16:27:13 +03:00
parent f2d4e4b2a3
commit 7a52d21254
9 changed files with 239 additions and 8 deletions

View file

@ -532,7 +532,9 @@
"warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
"warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.",
"warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"warnProcessRightsChange": "You don't have permission to edit this file."
"warnProcessRightsChange": "You don't have permission to edit this file.",
"textRequestMacros": "A macro makes a request to URL. Do you want to allow the request to the %1?",
"textRememberMacros": "Remember my choice for all macros"
},
"Settings": {
"advDRMOptions": "Protected File",

View file

@ -49,6 +49,7 @@ class MainController extends Component {
};
this.defaultTitleText = __APP_TITLE_TEXT__;
this.stackMacrosRequests = [];
const { t } = this.props;
this._t = t('Main', {returnObjects:true});
@ -99,6 +100,9 @@ class MainController extends Component {
}
this.props.storeApplicationSettings.changeMacrosSettings(value);
value = localStorage.getItem("de-mobile-allow-macros-request");
this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0);
Common.Notifications.trigger('configOptionsFill');
};
@ -160,6 +164,7 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
this.api.asc_registerCallback('asc_onDocumentContentReady', onDocumentContentReady);
this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this));
this.api.asc_registerCallback('asc_onMacrosPermissionRequest', this.onMacrosPermissionRequest.bind(this));
this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this));
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -1008,6 +1013,69 @@ class MainController extends Component {
}
}
onMacrosPermissionRequest (url, callback) {
if (url && callback) {
this.stackMacrosRequests.push({url: url, callback: callback});
if (this.stackMacrosRequests.length>1) {
return;
}
} else if (this.stackMacrosRequests.length>0) {
url = this.stackMacrosRequests[0].url;
callback = this.stackMacrosRequests[0].callback;
} else
return;
const value = this.props.storeApplicationSettings.macrosRequest;
if (value>0) {
callback && callback(value === 1);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
} else {
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.textRequestMacros.replace('%1', url),
content: `<div class="checkbox-in-modal">
<label class="checkbox">
<input type="checkbox" name="checkbox-show-macros" />
<i class="icon-checkbox"></i>
</label>
<span class="right-text">${_t.textRememberMacros}</span>
</div>`,
buttons: [{
text: _t.textYes,
onClick: () => {
const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
this.props.storeApplicationSettings.changeMacrosRequest(1);
LocalStorage.setItem("de-mobile-allow-macros-request", 1);
}
setTimeout(() => {
if (callback) callback(true);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
}, 1);
}},
{
text: _t.textNo,
onClick: () => {
const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
this.props.storeApplicationSettings.changeMacrosRequest(2);
LocalStorage.setItem("de-mobile-allow-macros-request", 2);
}
setTimeout(() => {
if (callback) callback(false);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
}, 1);
}
}]
}).open();
}
}
render() {
return (
<Fragment>

View file

@ -11,13 +11,15 @@ export class storeApplicationSettings {
isComments: observable,
isResolvedComments: observable,
macrosMode: observable,
macrosRequest: observable,
changeSpellCheck: action,
changeUnitMeasurement: action,
changeNoCharacters: action,
changeShowTableEmptyLine: action,
changeDisplayComments: action,
changeDisplayResolved: action,
changeMacrosSettings: action
changeMacrosSettings: action,
changeMacrosRequest: action
})
}
@ -28,6 +30,7 @@ export class storeApplicationSettings {
isComments = false;
isResolvedComments = false;
macrosMode = 0;
macrosRequest = 0;
changeUnitMeasurement(value) {
this.unitMeasurement = +value;
@ -57,4 +60,8 @@ export class storeApplicationSettings {
changeMacrosSettings(value) {
this.macrosMode = +value;
}
changeMacrosRequest(value) {
this.macrosRequest = value;
}
}

View file

@ -126,7 +126,9 @@
"warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
"warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.",
"warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"warnProcessRightsChange": "You don't have permission to edit the file."
"warnProcessRightsChange": "You don't have permission to edit the file.",
"textRequestMacros": "A macro makes a request to URL. Do you want to allow the request to the %1?",
"textRememberMacros": "Remember my choice for all macros"
}
},
"Error": {

View file

@ -44,6 +44,7 @@ class MainController extends Component {
};
this.defaultTitleText = __APP_TITLE_TEXT__;
this.stackMacrosRequests = [];
const { t } = this.props;
this._t = t('Controller.Main', {returnObjects:true});
@ -92,6 +93,9 @@ class MainController extends Component {
value = parseInt(value);
}
this.props.storeApplicationSettings.changeMacrosSettings(value);
value = localStorage.getItem("pe-mobile-allow-macros-request");
this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0);
};
const loadDocument = data => {
@ -139,6 +143,7 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this));
this.api.asc_registerCallback('asc_onMacrosPermissionRequest', this.onMacrosPermissionRequest.bind(this));
this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this));
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -819,6 +824,69 @@ class MainController extends Component {
}
}
onMacrosPermissionRequest (url, callback) {
if (url && callback) {
this.stackMacrosRequests.push({url: url, callback: callback});
if (this.stackMacrosRequests.length>1) {
return;
}
} else if (this.stackMacrosRequests.length>0) {
url = this.stackMacrosRequests[0].url;
callback = this.stackMacrosRequests[0].callback;
} else
return;
const value = this.props.storeApplicationSettings.macrosRequest;
if (value>0) {
callback && callback(value === 1);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
} else {
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.textRequestMacros.replace('%1', url),
content: `<div class="checkbox-in-modal">
<label class="checkbox">
<input type="checkbox" name="checkbox-show-macros" />
<i class="icon-checkbox"></i>
</label>
<span class="right-text">${_t.textRememberMacros}</span>
</div>`,
buttons: [{
text: _t.textYes,
onClick: () => {
const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
this.props.storeApplicationSettings.changeMacrosRequest(1);
LocalStorage.setItem("pe-mobile-allow-macros-request", 1);
}
setTimeout(() => {
if (callback) callback(true);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
}, 1);
}},
{
text: _t.textNo,
onClick: () => {
const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
this.props.storeApplicationSettings.changeMacrosRequest(2);
LocalStorage.setItem("pe-mobile-allow-macros-request", 2);
}
setTimeout(() => {
if (callback) callback(false);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
}, 1);
}
}]
}).open();
}
}
onProcessSaveResult (data) {
this.api.asc_OnSaveEnd(data.result);

View file

@ -6,15 +6,18 @@ export class storeApplicationSettings {
unitMeasurement: observable,
isSpellChecking: observable,
macrosMode: observable,
macrosRequest: observable,
changeUnitMeasurement: action,
changeSpellCheck: action,
changeMacrosSettings: action
changeMacrosSettings: action,
changeMacrosRequest: action
});
}
unitMeasurement = 1;
isSpellChecking = true;
macrosMode = 0;
macrosRequest = 0;
changeUnitMeasurement(value) {
this.unitMeasurement = +value;
@ -27,4 +30,8 @@ export class storeApplicationSettings {
changeMacrosSettings(value) {
this.macrosMode = +value;
}
changeMacrosRequest(value) {
this.macrosRequest = value;
}
}

View file

@ -160,7 +160,9 @@
"warnLicenseUsersExceeded": "You've reached the user limit for %1 editors. Contact your administrator to learn more.",
"warnNoLicense": "You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only. Contact %1 sales team for personal upgrade terms.",
"warnNoLicenseUsers": "You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",
"warnProcessRightsChange": "You don't have permission to edit the file."
"warnProcessRightsChange": "You don't have permission to edit the file.",
"textRequestMacros": "A macro makes a request to URL. Do you want to allow the request to the %1?",
"textRememberMacros": "Remember my choice for all macros"
}
},
"Error": {

View file

@ -56,6 +56,7 @@ class MainController extends Component {
'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios'];
this.defaultTitleText = __APP_TITLE_TEXT__;
this.stackMacrosRequests = [];
const { t } = this.props;
this._t = t('Controller.Main', {returnObjects:true});
@ -138,6 +139,9 @@ class MainController extends Component {
value = parseInt(value);
}
this.props.storeApplicationSettings.changeMacrosSettings(value);
value = localStorage.getItem("sse-mobile-allow-macros-request");
this.props.storeApplicationSettings.changeMacrosRequest((value !== null) ? parseInt(value) : 0);
};
const loadDocument = data => {
@ -187,6 +191,7 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);
this.api.asc_registerCallback('asc_onLicenseChanged', this.onLicenseChanged.bind(this));
this.api.asc_registerCallback('asc_onMacrosPermissionRequest', this.onMacrosPermissionRequest.bind(this));
this.api.asc_registerCallback('asc_onRunAutostartMacroses', this.onRunAutostartMacroses.bind(this));
this.api.asc_setDocInfo(docInfo);
this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId);
@ -790,6 +795,69 @@ class MainController extends Component {
}
}
onMacrosPermissionRequest (url, callback) {
if (url && callback) {
this.stackMacrosRequests.push({url: url, callback: callback});
if (this.stackMacrosRequests.length>1) {
return;
}
} else if (this.stackMacrosRequests.length>0) {
url = this.stackMacrosRequests[0].url;
callback = this.stackMacrosRequests[0].callback;
} else
return;
const value = this.props.storeApplicationSettings.macrosRequest;
if (value>0) {
callback && callback(value === 1);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
} else {
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.textRequestMacros.replace('%1', url),
content: `<div class="checkbox-in-modal">
<label class="checkbox">
<input type="checkbox" name="checkbox-show-macros" />
<i class="icon-checkbox"></i>
</label>
<span class="right-text">${_t.textRememberMacros}</span>
</div>`,
buttons: [{
text: _t.textYes,
onClick: () => {
const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
this.props.storeApplicationSettings.changeMacrosRequest(1);
LocalStorage.setItem("sse-mobile-allow-macros-request", 1);
}
setTimeout(() => {
if (callback) callback(true);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
}, 1);
}},
{
text: _t.textNo,
onClick: () => {
const dontshow = $$('input[name="checkbox-show-macros"]').prop('checked');
if (dontshow) {
this.props.storeApplicationSettings.changeMacrosRequest(2);
LocalStorage.setItem("sse-mobile-allow-macros-request", 2);
}
setTimeout(() => {
if (callback) callback(false);
this.stackMacrosRequests.shift();
this.onMacrosPermissionRequest();
}, 1);
}
}]
}).open();
}
}
onDownloadUrl (url, fileType) {
if (this._state.isFromGatewayDownloadAs) {
Common.Gateway.downloadAs(url, fileType);

View file

@ -6,6 +6,7 @@ export class storeApplicationSettings {
makeObservable(this, {
unitMeasurement: observable,
macrosMode: observable,
macrosRequest: observable,
formulaLang: observable,
regCode: observable,
regExample: observable,
@ -19,6 +20,7 @@ export class storeApplicationSettings {
setRegExample: action,
changeUnitMeasurement: action,
changeMacrosSettings: action,
changeMacrosRequest: action,
changeDisplayComments: action,
changeDisplayResolved: action,
changeRefStyle: action,
@ -28,6 +30,7 @@ export class storeApplicationSettings {
unitMeasurement = Common.Utils.Metric.getCurrentMetric();
macrosMode = 0;
macrosRequest = 0;
formulaLang = LocalStorage.getItem('sse-settings-func-lang') || this.getFormulaLanguages()[0].value;
regCode = undefined;
regExample = '';
@ -102,6 +105,10 @@ export class storeApplicationSettings {
this.macrosMode = +value;
}
changeMacrosRequest(value) {
this.macrosRequest = value;
}
changeDisplayComments(value) {
this.isComments = value;
if (!value) this.changeDisplayResolved(value);