Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/entryx64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
!define MUI_UNICON "icon.ico"
!define PRODUCT_NAME "Entry"
!define APP_NAME "Entry.exe"
!define PRODUCT_VERSION "2.1.5"
!define PRODUCT_VERSION "2.1.6"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "http://www.playentry.org/"

Expand Down
2 changes: 1 addition & 1 deletion build/entryx86.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
!define MUI_UNICON "icon.ico"
!define PRODUCT_NAME "Entry"
!define APP_NAME "Entry.exe"
!define PRODUCT_VERSION "2.1.5"
!define PRODUCT_VERSION "2.1.6"
!define PRODUCT_PUBLISHER "EntryLabs"
!define PRODUCT_WEB_SITE "http://www.playentry.org/"

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"private": true,
"productName": "Entry",
"name": "entry",
"version": "2.1.5",
"version": "2.1.6",
"description": "Entry for offline",
"main": "src/main_build/main.bundle.js",
"scripts": {
Expand Down Expand Up @@ -36,8 +36,8 @@
"async-csv": "^2.1.3",
"axios": "^0.19.2",
"cross-spawn": "^7.0.3",
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.42",
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.1.5",
"entry-hw": "git+https://github.com/entrylabs/entry-hw.git#dist/v1.9.44",
"entry-js": "git+https://github.com/entrylabs/entryjs.git#dist/offline_v2.1.6",
"entry-tool": "git+https://github.com/entrylabs/entry-tool.git#dist/20221024",
"excel4node": "^1.7.0",
"fs-extra": "^8.1.0",
Expand Down
132 changes: 65 additions & 67 deletions src/renderer/helper/entry/entryModalHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class EntryModalHelper {
objectType: 'sprite',
sprite: {
name: `${RendererUtils.getLang(
'Workspace.new_object'
'Workspace.new_object',
)}${Entry.container.getAllObjects().length + 1}`,
pictures: [
{
Expand Down Expand Up @@ -116,55 +116,14 @@ class EntryModalHelper {
Entry.container.addObject(object, 0);
},
dummyUploads: async ({ formData, objectData }: { formData: any; objectData: any }) => {
const pictures = formData ? formData.values() : [];
const objects = objectData ? objectData.values() : [];

const uploadPicturesPaths = [];
const uploadObjectPaths = [];
// picture files
for (const value of pictures) {
if (value.path) {
uploadPicturesPaths.push(value.path);
}
}

// eo files
for (const value of objects) {
if (value.path) {
uploadObjectPaths.push(value.path);
}
}

const results = await IpcRendererHelper.importPictures(uploadPicturesPaths);
const objectResults = await IpcRendererHelper.importObjects(uploadObjectPaths);

EntryModalHelper.popup.setData({
data: {
data: [],
uploads: results.concat(
objectResults.map((objectModel: any) => {
// thumbnail 용으로 쓸 selectedPicture 표기. 본 데이터는 sprite
const [firstObject] = objectModel.objects;

let selected = firstObject.selectedPicture;
if (firstObject.objectType === 'textBox') {
// selected = firstObject;
selected = {
sprite: objectModel,
name: firstObject.name,
text: firstObject.text,
objectType: firstObject.objectType,
options: firstObject.entity || {},
_id: Entry.generateHash(),
fileurl:
'../../renderer/resources/images/workspace/text_icon_ko.svg',
};
}

return selected;
})
),
},
const result = [
await this.uploadItem('picture', formData),
await this.uploadItem('object', objectData),
];

result.forEach((uploads) => {
const _uploads = uploads || [];
EntryModalHelper.popup.setData({ data: { uploads: _uploads, data:[] } });
});
},
uploads: (data: any) => {
Expand All @@ -179,7 +138,7 @@ class EntryModalHelper {
},
uploadFail: (data: any) => {
EntryModalHelper.getAlertModal(
RendererUtils.getLang(`${data.messageParent}.${data.message}`)
RendererUtils.getLang(`${data.messageParent}.${data.message}`),
);
},
fail: () => {
Expand All @@ -191,6 +150,45 @@ class EntryModalHelper {
});
}

static async uploadItem (kind: any, formData: any) {
if (!kind || !formData) {
return null;
}
const datas = formData ? formData.values() : [];
const uploadPaths = [];

for (const value of datas) {
if (value.path) {
uploadPaths.push(value.path);
}
}

if (kind === 'object') {
const results = await IpcRendererHelper.importObjects(uploadPaths);

return (
results.flatMap((item: any) => item.objects.map((object: any) => {
object.id = Entry.generateHash();
if (object.objectType === 'textBox') {
object.selectedPicture = {
name: object.name,
text: object.text,
objectType: object.objectType,
options: object.entity || {},
_id: Entry.generateHash(),
fileurl: '../../renderer/resources/images/workspace/text_icon_ko.svg',
};
}
object.selectedPicture.sprite = item;
return object.selectedPicture;
})) || []
);
} else if (kind === 'picture') {
const results = await IpcRendererHelper.importPictures(uploadPaths);
return results;
}
}

/**
* 모양 추가 팝업을 노출한다.
* fetch 시 Object 와 동일하나, Object 내의 Pictures 를 전부 까서 보여주는 차이가 있다.
Expand Down Expand Up @@ -292,7 +290,7 @@ class EntryModalHelper {
},
uploadFail: (data: any) => {
EntryModalHelper.getAlertModal(
RendererUtils.getLang(`${data.messageParent}.${data.message}`)
RendererUtils.getLang(`${data.messageParent}.${data.message}`),
);
},
fail: () => {
Expand Down Expand Up @@ -389,7 +387,7 @@ class EntryModalHelper {
},
uploadFail: (data: any) => {
EntryModalHelper.getAlertModal(
RendererUtils.getLang(`${data.messageParent}.${data.message}`)
RendererUtils.getLang(`${data.messageParent}.${data.message}`),
);
},
fail: (data: any) => {
Expand All @@ -416,7 +414,7 @@ class EntryModalHelper {
}

const langFilteredData = allFetchedData.filter(
(element) => element.lang === langType
(element) => element.lang === langType,
);

EntryModalHelper.popup.setData({
Expand All @@ -437,10 +435,10 @@ class EntryModalHelper {
const max = _.max([fields.length, ..._.map(origin, (row) => row.length)]);
fields = _.concat(fields, new Array(max - fields.length).fill(''));
origin = _.map(origin, (row) =>
_.concat(row, new Array(max - row.length).fill(''))
_.concat(row, new Array(max - row.length).fill('')),
);
return { ...tableInfo, ...infos, fields, data: origin };
})
}),
);
tableInfos.map((item) => {
Entry.playground.dataTable.addSource(item);
Expand Down Expand Up @@ -525,15 +523,15 @@ class EntryModalHelper {
callback && callback();
} else {
EntryModalHelper.getAlertModal(
RendererUtils.getLang('Workspace.deselect_expansion_block_warning')
RendererUtils.getLang('Workspace.deselect_expansion_block_warning'),
);
}
},
itemon: ({ callback }: { callback?: () => void }) => {
callback && callback();
},
},
expansionBlocks as any
expansionBlocks as any,
);
}

Expand All @@ -552,7 +550,7 @@ class EntryModalHelper {
callback && callback();
} else {
EntryModalHelper.getAlertModal(
RendererUtils.getLang('Workspace.deselect_ai_utilize_block_warning')
RendererUtils.getLang('Workspace.deselect_ai_utilize_block_warning'),
);
}
},
Expand All @@ -561,7 +559,7 @@ class EntryModalHelper {
},
},
aiBlocks as any,
'../../../node_modules/entry-js/images/aiUtilize/'
'../../../node_modules/entry-js/images/aiUtilize/',
);
}

Expand Down Expand Up @@ -599,7 +597,7 @@ class EntryModalHelper {

static async _addAIUtilizeBlocks(blocks: any) {
const addBlocks = blocks.filter(
({ name }: { name: string }) => !Entry.aiUtilizeBlocks.includes(name)
({ name }: { name: string }) => !Entry.aiUtilizeBlocks.includes(name),
);
const removeBlocks = this._getActiveAIUtilizeBlocks()
.filter((item) => item.active)
Expand All @@ -618,7 +616,7 @@ class EntryModalHelper {

static _addExpansionBlocks(blocks: any) {
const addBlocks = blocks.filter(
({ name }: { name: string }) => !Entry.expansionBlocks.includes(name)
({ name }: { name: string }) => !Entry.expansionBlocks.includes(name),
);
const removeBlocks = this._getActiveExpansionBlocks()
.filter((item) => item.active)
Expand Down Expand Up @@ -691,7 +689,7 @@ class EntryModalHelper {
},
uploadFail: (data: any) => {
EntryModalHelper.getAlertModal(
RendererUtils.getLang(`${data.messageParent}.${data.message}`)
RendererUtils.getLang(`${data.messageParent}.${data.message}`),
);
},
fail: () => {
Expand All @@ -710,7 +708,7 @@ class EntryModalHelper {
type: string,
events: PopupEventListeners = {},
data: any = [],
imageBaseUrl: string = '../../../node_modules/entry-js/images/hardware/'
imageBaseUrl: string = '../../../node_modules/entry-js/images/hardware/',
) {
this.loadPopup(data);
const popup = EntryModalHelper.popup;
Expand Down Expand Up @@ -772,7 +770,7 @@ class EntryModalHelper {
const modalStyleLink = document.createElement('link');
modalStyleLink.setAttribute(
'href',
'../../../node_modules/@entrylabs/modal/dist/entry/entry-modal.css'
'../../../node_modules/@entrylabs/modal/dist/entry/entry-modal.css',
);
modalStyleLink.setAttribute('rel', 'stylesheet');
document.head.appendChild(modalStyleLink);
Expand Down Expand Up @@ -865,7 +863,7 @@ class EntryModalHelper {
.alert(
`${RendererUtils.getLang('Msgs.version_update_msg1').replace(
/%1/gi,
latestVersion
latestVersion,
)}\n\n${RendererUtils.getLang('Msgs.version_update_msg3')}`,
RendererUtils.getLang('General.update_title'),
{
Expand All @@ -877,7 +875,7 @@ class EntryModalHelper {
},
parentClassName: 'versionAlert',
withDontShowAgain: true,
}
},
)
.one('click', (event: string, { dontShowChecked }: { dontShowChecked: boolean }) => {
if (event === 'ok') {
Expand Down
Loading