Skip to content

Commit

Permalink
Merge pull request #3127 from ONLYOFFICE/feature/fix-bugs
Browse files Browse the repository at this point in the history
[DE PE SSE mobile] Fix Bug 61642
  • Loading branch information
maxkadushkin authored Aug 19, 2024
2 parents 5132ab5 + cbe6be3 commit 200eb0b
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
31 changes: 31 additions & 0 deletions apps/documenteditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ class MainController extends Component {
Common.Gateway.on('downloadas', this.onDownloadAs.bind(this));
Common.Gateway.on('requestclose', this.onRequestClose.bind(this));
Common.Gateway.on('setfavorite', this.onSetFavorite.bind(this));
Common.Gateway.on('insertimage', this.insertImage.bind(this));

Common.Gateway.sendInfo({
mode: appOptions.isEdit ? 'edit' : 'view'
Expand Down Expand Up @@ -499,6 +500,30 @@ class MainController extends Component {
}
}

insertImage (data) {
if (data && (data.url || data.images)) {
if (data.url) {
console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
}

let arr = [];

if (data.images && data.images.length > 0) {
for (let i = 0; i < data.images.length; i++) {
if (data.images[i] && data.images[i].url) {
arr.push(data.images[i].url);
}
}
} else if (data.url) {
arr.push(data.url);
}

data._urls = arr;
}

this.insertImageFromStorage(data);
}

loadDefaultMetricSettings() {
const appOptions = this.props.storeAppOptions;
let region = '';
Expand Down Expand Up @@ -934,6 +959,12 @@ class MainController extends Component {
Common.Notifications.on('markfavorite', this.markFavorite.bind(this));
}

insertImageFromStorage(data) {
if (data && data._urls && (!data.c || data.c === 'add') && data._urls.length > 0) {
this.api.AddImageUrl(data._urls, undefined, data.token);
}
}

markFavorite(favorite) {
Common.Gateway.metaChange({ favorite });
}
Expand Down
31 changes: 31 additions & 0 deletions apps/presentationeditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ class MainController extends Component {
});
}

insertImageFromStorage(data) {
if (data && data._urls && (!data.c || data.c === 'add') && data._urls.length > 0) {
this.api.AddImageUrl(data._urls, undefined, data.token);
}
}

onApiTextReplaced(found, replaced) {
const { t } = this.props;

Expand Down Expand Up @@ -563,6 +569,7 @@ class MainController extends Component {
Common.Gateway.on('processrightschange', this.onProcessRightsChange.bind(this));
Common.Gateway.on('downloadas', this.onDownloadAs.bind(this));
Common.Gateway.on('requestclose', this.onRequestClose.bind(this));
Common.Gateway.on('insertimage', this.insertImage.bind(this));

Common.Gateway.sendInfo({
mode: appOptions.isEdit ? 'edit' : 'view'
Expand All @@ -582,6 +589,30 @@ class MainController extends Component {
appOptions.changeDocReady(true);
}

insertImage (data) {
if (data && (data.url || data.images)) {
if (data.url) {
console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
}

let arr = [];

if (data.images && data.images.length > 0) {
for (let i = 0; i < data.images.length; i++) {
if (data.images[i] && data.images[i].url) {
arr.push(data.images[i].url);
}
}
} else if (data.url) {
arr.push(data.url);
}

data._urls = arr;
}

this.insertImageFromStorage(data);
}

onLicenseChanged (params) {
const appOptions = this.props.storeAppOptions;
const licType = params.asc_getLicenseType();
Expand Down
31 changes: 31 additions & 0 deletions apps/spreadsheeteditor/mobile/src/controller/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,12 @@ class MainController extends Component {
this.api.asc_setFilteringMode && this.api.asc_setFilteringMode(storeAppOptions.canModifyFilter);
}

insertImageFromStorage (data) {
if (data && data._urls && (!data.c || data.c === 'add') && data._urls.length > 0) {
this.api.asc_addImageDrawingObject(data._urls, undefined, data.token);
}
}

onNeedUpdateExternalReference() {
const { t } = this.props;

Expand Down Expand Up @@ -732,6 +738,7 @@ class MainController extends Component {
Common.Gateway.on('processrightschange', this.onProcessRightsChange.bind(this));
Common.Gateway.on('downloadas', this.onDownloadAs.bind(this));
Common.Gateway.on('requestclose', this.onRequestClose.bind(this));
Common.Gateway.on('insertimage', this.insertImage.bind(this));

Common.Gateway.sendInfo({
mode: appOptions.isEdit ? 'edit' : 'view'
Expand All @@ -750,6 +757,30 @@ class MainController extends Component {
appOptions.changeDocReady(true);
}

insertImage (data) {
if (data && (data.url || data.images)) {
if (data.url) {
console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
}

let arr = [];

if (data.images && data.images.length > 0) {
for (let i = 0; i < data.images.length; i++) {
if (data.images[i] && data.images[i].url) {
arr.push(data.images[i].url);
}
}
} else if (data.url) {
arr.push(data.url);
}

data._urls = arr;
}

this.insertImageFromStorage(data);
}

applyMode (appOptions) {
this.api.asc_enableKeyEvents(appOptions.isEdit);

Expand Down

0 comments on commit 200eb0b

Please sign in to comment.