Skip to content

Commit

Permalink
Issue #SB-000 merge: Merge pull request #3523 from swayangjit/release…
Browse files Browse the repository at this point in the history
…-7.0.0

Issue #SB-000 merge: Merge branch 'release-6.0.0_v13' into release-7.0.0
  • Loading branch information
swayangjit authored Jan 23, 2024
2 parents 1e6c760 + fdb925f commit c3d3f95
Show file tree
Hide file tree
Showing 29 changed files with 1,517 additions and 347 deletions.
8 changes: 4 additions & 4 deletions build_config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cordova-plugin=cordova-plugin-x-socialsharing
cordova-plugin=cordova-plugin-androidx-adapter
cordova-plugin=cordova-plugin-device
cordova-plugin=cordova-plugin-file
cordova-plugin=https://github.com/vishwanath1004/cordova-plugin-file-transfer
cordova-plugin=https://github.com/shikshalokam/cordova-plugin-file-transfer.git
cordova-plugin=cordova-plugin-inappbrowser
cordova-plugin=cordova-plugin-network-information
cordova-plugin=cordova-plugin-statusbar
Expand All @@ -20,20 +20,20 @@ cordova-plugin=cordova-plugin-android-permissions
cordova-plugin=cordova.plugins.diagnostic
cordova-plugin=com.telerik.plugins.nativepagetransitions
cordova-plugin=cordova-plugin-secure-storage-echo
cordova-plugin=cordova-plugin-chooser
cordova-plugin=https://github.com/shikshalokam/cordova-plugin-chooser.git
cordova-plugin=cordova-plugin-appavailability
cordova-plugin=cordova-plugin-filepicker
cordova-plugin=cordova-plugin-document-viewer
cordova-plugin=com-sarriaroman-photoviewer
cordova-plugin=cordova-plugin-filepath
cordova-plugin=https://github.com/shikshalokam/cordova-plugin-filepath.git
cordova-plugin=https://github.com/greybax/cordova-plugin-proguard.git
cordova-plugin=https://github.com/Sunbird-Ed/sb-cordova-plugin-utility.git#release-4.1.0
cordova-plugin=https://github.com/Sunbird-Ed/sb-cordova-plugin-downloadmanager.git
cordova-plugin=https://github.com/Sunbird-Ed/sb-cordova-plugin-db.git#release-4.6.0
cordova-plugin=https://github.com/Sunbird-Ed/sb-cordova-plugin-customtabs#release-5.0.2 --variable URL_SCHEME=@string/custom_scheme_url --variable URL_HOST=mobile
cordova-plugin=cordova-sqlite-storage
cordova plugin=cordova-plugin-googleplus
cordova-pligin=cordova-plugin-camera
cordova-plugin=https://github.com/shikshalokam/cordova-plugin-camera.git
[email protected]
cordova-plugin=cordova-plugin-filechooser
cordova-plugin=cordova-plugin-media
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,19 @@
"cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-appavailability": "^0.4.2",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-camera": "^6.0.0",
"cordova-plugin-chooser": "^1.3.2",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-document-viewer": "^0.9.13",
"cordova-plugin-file": "^7.0.0",
"cordova-plugin-file": "^8.0.0",
"cordova-plugin-file-opener2": "^2.2.1",
"cordova-plugin-filechooser": "^1.2.0",
"cordova-plugin-filepath": "^1.5.8",
"cordova-plugin-filepicker": "^1.1.6",
"cordova-plugin-googleplus": "^8.5.2",
"cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^4.2.1",
"cordova-plugin-media": "^6.1.0",
"cordova-plugin-media": "^7.0.0",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-printer": "^0.8.0",
"cordova-plugin-secure-storage-echo": "^5.1.1",
Expand Down Expand Up @@ -199,11 +197,13 @@
"cordova-plugin-app-version": "^0.1.14",
"cordova-plugin-awesome-shared-preferences": "git+https://github.com/adriano-di-giovanni/cordova-plugin-shared-preferences.git",
"cordova-plugin-badge-fix": "^0.8.10",
"cordova-plugin-camera": "git+https://github.com/vishwanath1004/cordova-plugin-camera.git",
"cordova-plugin-code-push": "git+https://github.com/swayangjit/cordova-plugin-code-push.git",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-fcm-with-dependecy-updated": "git+https://github.com/Sunbird-Ed/sb-cordova-plugin-fcm.git#release-5.1.2",
"cordova-plugin-file": "^7.0.0",
"cordova-plugin-file-transfer": "git+https://github.com/vishwanath1004/cordova-plugin-file-transfer.git",
"cordova-plugin-file-transfer": "git+https://github.com/shikshalokam/cordova-plugin-file-transfer.git",
"cordova-plugin-filepath": "git+https://github.com/shikshalokam/cordova-plugin-filepath.git",
"cordova-plugin-inappupdatemanager": "git+https://github.com/subranil/cordova-plugin-inappupdatemanager.git#release-3.7.0",
"cordova-plugin-local-notification": "git+https://github.com/fquirin/cordova-plugin-local-notifications.git",
"cordova-plugin-openrap": "git+https://github.com/project-sunbird/cordova-plugin-openrap.git",
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/dashboard/dashboard.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ describe('DashboardComponent', () => {
const mockCommonUtilService: Partial<CommonUtilService> = {
showToast: jest.fn(),
translateMessage: jest.fn(),
showSettingsPageToast: jest.fn()
showSettingsPageToast: jest.fn(),
isAndroidVer13: jest.fn()
};
const mockStoragePermissionHandlerService: Partial<StoragePermissionHandlerService> = {};
const mockAppVersion: Partial<AppVersion> = {
Expand Down Expand Up @@ -85,7 +86,7 @@ describe('DashboardComponent', () => {
dashboardComponent.exportCsv()
// assert
setTimeout(() => {
expect(mockStoragePermissionHandlerService.checkForPermissions).toHaveBeenCalled();
// expect(mockStoragePermissionHandlerService.checkForPermissions).toHaveBeenCalled();
done()
});
})
Expand Down
57 changes: 33 additions & 24 deletions src/app/components/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,41 @@ export class DashboardComponent implements OnInit {
ID.DOWNLOAD_CLICKED
);
const appName = await this.appVersion.getAppName();
await this.storagePermissionHandlerService.checkForPermissions(PageId.ACTIVITY_DASHBOARD).then(async (result) => {
if (result) {
const expTime = new Date().getTime();
const filename = this.collectionName.trim() + '_' + expTime + '.csv';
const downloadDirectory = this.platform.is('ios') ? `${cordova.file.documentsDirectory}Download/` : cordova.file.externalDataDirectory
if(this.commonUtilService.isAndroidVer13()) {
this.handleExportCsv();
} else {
await this.storagePermissionHandlerService.checkForPermissions(PageId.ACTIVITY_DASHBOARD).then(async (result) => {
if (result) {
this.handleExportCsv();
} else {
await this.commonUtilService.showSettingsPageToast('FILE_MANAGER_PERMISSION_DESCRIPTION', appName, PageId.ACTIVITY_DASHBOARD, true);
}
}).catch((err) => {
console.log('checkForPermissions err', err);
});
}
}

this.lib.instance.exportCsv({ 'strict': true }).then((csvData) => {
console.log('exportCSVdata', csvData);
this.file.writeFile(downloadDirectory, filename, csvData, { replace: true })
.then((res) => {
console.log('rs write file', res);
this.openCsv(res.nativeURL);
this.commonUtilService.showToast(
this.commonUtilService.translateMessage('DOWNLOAD_COMPLETED', filename), false, 'custom-toast');
})
.catch((err) => {
this.writeFile(downloadDirectory, csvData);
console.log('writeFile err', err);
});
}).catch((err) => {
console.log('checkForPermissions err', err);
});
handleExportCsv() {
const expTime = new Date().getTime();
const filename = this.collectionName.trim() + '_' + expTime + '.csv';
const downloadDirectory = this.platform.is('ios') ? `${cordova.file.documentsDirectory}Download/` : cordova.file.externalDataDirectory

} else {
await this.commonUtilService.showSettingsPageToast('FILE_MANAGER_PERMISSION_DESCRIPTION', appName, PageId.ACTIVITY_DASHBOARD, true);
}
this.lib.instance.exportCsv({ 'strict': true }).then((csvData) => {
console.log('exportCSVdata', csvData);
this.file.writeFile(downloadDirectory, filename, csvData, { replace: true })
.then((res) => {
console.log('rs write file', res);
this.openCsv(res.nativeURL);
this.commonUtilService.showToast(
this.commonUtilService.translateMessage('DOWNLOAD_COMPLETED', filename), false, 'custom-toast');
})
.catch((err) => {
this.writeFile(downloadDirectory, csvData);
console.log('writeFile err', err);
});
}).catch((err) => {
console.log('export csv err', err);
});
}

Expand Down
Loading

0 comments on commit c3d3f95

Please sign in to comment.