Skip to content

Commit

Permalink
Merge pull request #277 from arfath-gwl/release-2.7.0
Browse files Browse the repository at this point in the history
Release 2.7.0
  • Loading branch information
swayangjit authored Jan 24, 2020
2 parents 033164b + fca496e commit a8d37cd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sunbird-sdk",
"version": "2.7.13",
"version": "2.7.14",
"description": "Heart of the sunbird mobile app.",
"main": "dist/index.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/content/handlers/delete-content-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ export class DeleteContentHandler {
const localData = contentInDb[ContentEntry.COLUMN_NAME_LOCAL_DATA];
const localContentData: ContentData = localData && JSON.parse(localData);
let appIcon = '';
let itemSetPreviewUrl = '';
if (localData) {
appIcon = localContentData.appIcon;
appIcon = localContentData.appIcon ? FileUtil.getFileName(localContentData.appIcon) : '';
itemSetPreviewUrl = localContentData.itemSetPreviewUrl ? FileUtil.getFileName(localContentData.itemSetPreviewUrl) : '';
}
this.rm(ContentUtil.getBasePath(path), appIcon ? FileUtil.getFileName(appIcon) : '');
this.rm(ContentUtil.getBasePath(path), [appIcon, itemSetPreviewUrl].join(':'));
}
contentInDb[ContentEntry.COLUMN_NAME_VISIBILITY] = visibility;
contentInDb[ContentEntry.COLUMN_NAME_REF_COUNT] = ContentUtil.addOrUpdateRefCount(refCount);
Expand Down
18 changes: 13 additions & 5 deletions src/content/handlers/export/copy-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ export class CopyAsset {
const contentInDb = element as ContentEntry.SchemaMap;
const contentData = exportContentContext.items![i];
const appIcon = contentData['appIcon'];
if (appIcon) {
try {
await this.copyFile(contentInDb[ContentEntry.COLUMN_NAME_PATH]!, exportContentContext.tmpLocationPath!, appIcon);
} catch (e) {
console.error(e);
const setPreviewUrl = contentData['itemSetPreviewUrl'];

for (const item of [appIcon, setPreviewUrl]) {
if (item && !item.startsWith('https:')) {
try {
await this.copyFile(
contentInDb[ContentEntry.COLUMN_NAME_PATH]!,
exportContentContext.tmpLocationPath!,
item
);
} catch (e) {
console.error(e);
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/content/handlers/import/extract-payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class ExtractPayloads {
const pkgVersion = item.pkgVersion;
const artifactUrl = item.artifactUrl;
const appIcon = item.appIcon;
const itemSetPreviewUrl = item.itemSetPreviewUrl;
const board = item.board;
const medium = item.medium;
const grade = item.gradeLevel;
Expand Down Expand Up @@ -170,6 +171,13 @@ export class ExtractPayloads {
} catch (e) {
}
}

try {
if (!itemSetPreviewUrl.startsWith('https:')) {
this.copyAssets(importContext.tmpLocation!, itemSetPreviewUrl, payloadDestination!, false);
}
} catch (e) {
}
}
const basePath = this.getBasePath(payloadDestination, doesContentExist, existingContentPath);
if (visibility === Visibility.DEFAULT.valueOf()) {
Expand Down

0 comments on commit a8d37cd

Please sign in to comment.