Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #SB-000 merge: Merge branch 'release-5.0.0' into release-5.0.1 #3199

Merged
merged 38 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
67184d9
Issue #SB-0000 fix: login is enabled for student
vpPavithra Sep 7, 2022
00c2afd
Issue #SB-0000 merge: Merge pull request #3167 from vpPavithra/relea…
swayangjit Sep 8, 2022
aae5eb4
Issue #0000:fix: Bug fixes
kiranharidas187 Sep 19, 2022
9a58d3a
Issue #0000:fix: profile Update warning popup issue resolved
kiranharidas187 Sep 19, 2022
3a4595e
Issue #4.10.1 fix : Video upload from gallery
Sep 20, 2022
5579295
Merge pull request #327 from shikshalokam/video-upload
kiranharidas187 Sep 21, 2022
edc91fb
Issue #SB-30996:fix: Bug fixes
kiranharidas187 Sep 21, 2022
1a5dc61
Issue SB-30996 fix : Missing Text message and pop up message and Dark…
Sep 22, 2022
3089bc9
Issue SB-30996 fix : Missing Text message and pop up message and Dark…
Sep 22, 2022
00922b6
Merge pull request #328 from shikshalokam/SB-30996
kiranharidas187 Sep 23, 2022
41b2e32
Merge branch 'release-4.10.1' into release-4.10.8
kiranharidas187 Sep 23, 2022
40486a2
Issue #SB-000 merge: Merge branch 'release-4.10.7' into release-5.0.0
swayangjit Sep 23, 2022
07d9ff3
Issue #SB-000 merge: Merge pull request #3187 from swayangjit/releas…
swayangjit Sep 23, 2022
19c8c1a
Issue SB-30996 fix : QA issue fixes
Sep 23, 2022
28fbb34
Issue SB-30996 : Attachment order change
Sep 26, 2022
935344f
Merge pull request #329 from shikshalokam/SB-30996
kiranharidas187 Sep 27, 2022
a0a8c93
Issue SB-30996 : Attachment order change
Sep 27, 2022
6bc42f7
Merge pull request #330 from shikshalokam/SB-30996
vishwanath1004 Sep 27, 2022
fb67a57
Issue #0000: fix: video attachment issue fixed
kiranharidas187 Sep 27, 2022
5f413d6
Merge remote-tracking branch 'origin/release-4.10.1' into release-4.10.8
kiranharidas187 Sep 27, 2022
642374a
Issue #0000: new memtypes added
kiranharidas187 Sep 27, 2022
f19b11f
Issue #0000: fix: bug fixes
kiranharidas187 Sep 27, 2022
a70ced7
Merge pull request #3186 from shikshalokam/release-4.10.8
swayangjit Sep 27, 2022
8a150d2
Issue #0000: fix: Video attach issue
kiranharidas187 Sep 28, 2022
ed9be72
Issue #0000:Video format issues
kiranharidas187 Sep 28, 2022
69bbbb1
Issue #0000 merge: Merge pull request #3191 from shikshalokam/release…
swayangjit Sep 28, 2022
87f4f4c
Issue fix :Removing Alert message
Sep 29, 2022
872a637
Merge pull request #331 from shikshalokam/alrt-changes
kiranharidas187 Sep 29, 2022
e4132bb
Merge pull request #3193 from shikshalokam/release-4.10.8
swayangjit Sep 29, 2022
3ec237b
Issue #SB-31057 : fix : Camel cse issue
Oct 4, 2022
0cb2440
Merge pull request #332 from shikshalokam/SB-31057
vishwanath1004 Oct 4, 2022
34257f0
Issue SB-31050 : Camel case issues
Oct 6, 2022
deeda88
Merge pull request #333 from shikshalokam/SB-31050
vishwanath1004 Oct 6, 2022
97e2b23
Issue #SB-31057 merge: Merge pull request #3195 from shikshalokam/re…
swayangjit Oct 6, 2022
dd26ac3
Issue #SB-000 merge: Merge branch 'release-4.10.8' into release-5.0.0
swayangjit Oct 10, 2022
0e9259a
Issue #SB-000 merge: Merge pull request #3198 from swayangjit/release…
swayangjit Oct 10, 2022
7b9be76
Issue #SB-000 merge: Merge branch 'release-5.0.0' into release-5.0.1
swayangjit Oct 10, 2022
5cd36f2
Issue #SB-000 merge: Merge branch 'release-5.0.1' of github.com:Sunbi…
swayangjit Oct 10, 2022
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
26 changes: 24 additions & 2 deletions src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2132,6 +2132,28 @@ ion-icon.mg-popup-btn-icon.md.hydrated{
filter: invert(0) !important;
background: var(--app-secondary-background);
}
.task-card .display-flex-space-btn .title-break{
color: #fff !important;
}
.success{
color: #FFD954 !important;
}
.task-card {
.mandatory-ribben-label{
color: #000 !important;
background-color: #FFD954 !important;
}
.action-btn{
color: #000 !important;
--background: #FFD954 !important;
}

}
.attachments-list{
.card-text{
color: #000 !important;
}
}
.segment-button-has-label-only.segment-button-layout-icon-top.ion-activatable.ion-activatable-instant.ion-focusable.hydrated.segment-button-checked ion-label {
color: black !important;
}
Expand Down Expand Up @@ -2385,11 +2407,11 @@ app-metadata-details,app-add-file {
background: black;
}
.segment-card{
background: #fff;
background: var(--sb-pill-bg);
border-radius: 12px;
box-shadow: var(--button-style-shadow) !important;
ion-segment-button{
margin: 0px 10px;
margin: 0px 0px;
text-transform: none;
ion-label {
font-size: 0.875rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,8 @@ export class ApplicationHeaderComponent implements OnInit, OnDestroy {

private refreshLoginInButton() {
const profileType = this.appGlobalService.getGuestUserType();
this.showLoginButton = (this.commonUtilService.isAccessibleForNonStudentRole(profileType)
&& this.appGlobalService.DISPLAY_SIGNIN_FOOTER_CARD_IN_PROFILE_TAB_FOR_TEACHER) ||
(profileType === ProfileType.STUDENT && this.appGlobalService.DISPLAY_SIGNIN_FOOTER_CARD_IN_PROFILE_TAB_FOR_STUDENT);
this.showLoginButton = this.appGlobalService.DISPLAY_SIGNIN_FOOTER_CARD_IN_PROFILE_TAB_FOR_TEACHER ||
this.appGlobalService.DISPLAY_SIGNIN_FOOTER_CARD_IN_PROFILE_TAB_FOR_STUDENT;
}

private async checkCurrentOrientation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export const localStorageConstants = {
USER_DETAILS:"usersInfo",
SELECTED_LANGUAGE: "selectedLanguage",
LIBRARY_CATEGORIES:"libraryCategories",
FILE_LIMIT:30000000
FILE_LIMIT:50000000
};
18 changes: 12 additions & 6 deletions src/app/manage-learn/core/constants/mimTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const FILE_EXTENSION_HEADERS = {
aac: "audio/aac",
abw: "application/x-abiword",
arc: "application/x-freearc",
avi: "video/x-msvideo",
avi: "video/mp4",
azw: "application/vnd.amazon.ebook",
bin: "application/octet-stream",
bmp: "image/bmp",
Expand Down Expand Up @@ -32,13 +32,13 @@ export const FILE_EXTENSION_HEADERS = {
midi: "audio/midi",
mjs: "text/javascript",
mp3: "audio/mpeg",
mpeg: "video/mpeg",
mpeg: "video/mp4",
mpkg: "application/vnd.apple.installer+xml",
odp: "application/vnd.oasis.opendocument.presentation",
ods: "application/vnd.oasis.opendocument.spreadsheet",
odt: "application/vnd.oasis.opendocument.text",
oga: "audio/ogg",
ogv: "video/ogg",
ogv: "video/mp4",
ogx: "application/ogg",
otf: "font/otf",
png: "image/jpeg",
Expand All @@ -58,7 +58,7 @@ export const FILE_EXTENSION_HEADERS = {
vsd: "application/vnd.visio",
wav: "audio/wav",
weba: "audio/webm",
webm: "video/webm",
webm: "video/mp4",
webp: "image/webp",
woff: "font/woff",
woff2: "font/woff2",
Expand All @@ -68,9 +68,15 @@ export const FILE_EXTENSION_HEADERS = {
xml: "application/xml ",
xul: "application/vnd.mozilla.xul+xml",
zip: "application/zip",
"3gp": "video/3gpp",
"3g2": "video/3gpp2",
"3gp": "video/mp4",
"3g2": "video/mp4",
"7z": "application/x-7z-compressed",
mp4: "video/mp4",
mov: "video/mp4",
mkv:"video/mp4",
wmv: "video/mp4",
ogg: "video/mp4",
m4v:"video/mp4",
flv:"video/mp4"
};

134 changes: 101 additions & 33 deletions src/app/manage-learn/core/services/attachment/attachment.service.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { Injectable } from "@angular/core";
import { Camera, CameraOptions, PictureSourceType } from "@ionic-native/camera/ngx";
import { Camera, CameraOptions, MediaType, PictureSourceType } from "@ionic-native/camera/ngx";
import { Chooser } from "@ionic-native/chooser/ngx";
import { FilePath } from "@ionic-native/file-path/ngx";
import { File } from "@ionic-native/file/ngx";
import { ActionSheetController, Platform, ToastController } from "@ionic/angular";
import { TranslateService } from "@ngx-translate/core";
import { FILE_EXTENSION_HEADERS } from "../../constants";
import { localStorageConstants } from "../../constants/localStorageConstants";
import { LoaderService } from "../loader/loader.service";

@Injectable({
providedIn: 'root'
})
export class AttachmentService {
mediaType: string;
texts: any;
payload : any;
actionSheetOpen : boolean = false;
payload: any;
actionSheetOpen: boolean = false;
constructor(
private camera: Camera,
private file: File,
Expand All @@ -24,7 +26,8 @@ export class AttachmentService {
private filePath: FilePath,
private chooser: Chooser,
// private filePickerIOS: IOSFilePicker,
private translate: TranslateService
private translate: TranslateService,
private loader: LoaderService
) {
this.translate
.get([
Expand All @@ -35,7 +38,8 @@ export class AttachmentService {
"CANCEL",
"FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE",
"FRMELEMNTS_MSG_SUCCESSFULLY_ATTACHED",
"FRMELEMNTS_MSG_ERROR_FILE_SIZE_LIMIT"
"FRMELEMNTS_MSG_ERROR_FILE_SIZE_LIMIT",
"FRMELEMNTS_LBL_FILE_SIZE_EXCEEDED"
])
.subscribe((data) => {
this.texts = data;
Expand Down Expand Up @@ -79,36 +83,99 @@ export class AttachmentService {
return actionSheet.onDidDismiss();
}

takePicture(sourceType: PictureSourceType) {
let options: CameraOptions = {
quality: 10,
takePicture(sourceType: PictureSourceType, mediaType: MediaType = this.camera.MediaType.ALLMEDIA) {
var options: CameraOptions = {
quality: 20,
sourceType: sourceType,
saveToPhotoAlbum: false,
correctOrientation: true,
mediaType: mediaType,
destinationType: this.camera.DestinationType.FILE_URI,
};

this.camera
.getPicture(options)
.then((imagePath) => {
if (this.platform.is("android") && sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) {
this.filePath
.resolveNativePath(imagePath)
.then((filePath) => {
this.copyFile(filePath);
let newFilePath = imagePath;
if (!newFilePath.includes("file://")) {
newFilePath = "file://" + imagePath
}
this.checkForFileSizeRestriction(newFilePath).then(isValidFile => {
if (isValidFile) {
this.filePath
.resolveNativePath(newFilePath)
.then((filePath) => {
this.copyFile(filePath);
})
.catch(error => { })
}
})
} else {
this.copyFile(imagePath);
this.checkForFileSizeRestriction(imagePath).then(isValidFile => {
if (isValidFile) {
this.copyFile(imagePath);
}
})
}
})
.catch((err) => {
console.log(err);
if(err !== "No Image Selected") {
if (err !== "No Image Selected") {
this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE"]);
}
});
}

copyFileToLocalDir(namePath, currentName, newFileName) {
writeFileToPrivateFolder(filePath) {
this.checkForFileSizeRestriction(filePath).then(isValidFile => {
if (isValidFile) {
let path = filePath.substr(0, filePath.lastIndexOf("/") + 1);
let currentName = filePath.split("/").pop();
this.loader.startLoader();
this.file.readAsArrayBuffer(path, currentName).then(success => {
const pathToWrite = this.directoryPath();
const newFileName = this.createFileName(currentName)
this.file.writeFile(pathToWrite, newFileName, success).then(fileWrite => {
const data = {
name: newFileName,
type: this.mimeType(newFileName),
isUploaded: false,
url: "",
};
this.loader.stopLoader();
this.presentToast(this.texts["FRMELEMNTS_MSG_SUCCESSFULLY_ATTACHED"], "success");
this.actionSheetOpen ? this.actionSheetController.dismiss(data) : this.payload.push(data);
}).catch(error => {
this.loader.stopLoader();
this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE"]);
})
}).catch(error => {
this.loader.stopLoader();
this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE"]);
})
}
}).catch(error => { })
}

checkForFileSizeRestriction(filePath): Promise<Boolean> {
return new Promise((resolve, reject) => {
this.file.resolveLocalFilesystemUrl(filePath).then(success => {
success.getMetadata((metadata) => {
if (metadata.size > localStorageConstants.FILE_LIMIT) {
this.presentToast(this.texts["FRMELEMNTS_LBL_FILE_SIZE_EXCEEDED"],'danger', 5000);
reject(false)
} else {
resolve(true)
}
})
}).catch(error => {
reject(false)
})
})
}

copyFileToLocalDir(namePath, currentName, newFileName, completeFilePath) {
this.file.copyFile(namePath, currentName, this.directoryPath(), newFileName).then(
(success) => {
const data = {
Expand All @@ -119,19 +186,20 @@ export class AttachmentService {
};

this.presentToast(this.texts["FRMELEMNTS_MSG_SUCCESSFULLY_ATTACHED"], "success");
this.actionSheetOpen? this.actionSheetController.dismiss(data) : this.payload.push(data);
this.actionSheetOpen ? this.actionSheetController.dismiss(data) : this.payload.push(data);
},
(error) => {
this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE"]);
this.writeFileToPrivateFolder(completeFilePath);
// this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE"]);
}
);
}

async presentToast(text, color = "danger") {
async presentToast(text, color = "danger", duration = 3000) {
const toast = await this.toastController.create({
message: text,
position: "top",
duration: 3000,
duration: duration,
color: color,
});
toast.present();
Expand All @@ -140,11 +208,11 @@ export class AttachmentService {
async openFile() {
try {
const file = await this.chooser.getFile('application/pdf');
let sizeOftheFile:number = file.data.length
if(sizeOftheFile > localStorageConstants.FILE_LIMIT){
let sizeOftheFile: number = file.data.length
if (sizeOftheFile > localStorageConstants.FILE_LIMIT) {
this.actionSheetController.dismiss();
this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_FILE_SIZE_LIMIT"]);
}else{
} else {
const pathToWrite = this.directoryPath();
const newFileName = this.createFileName(file.name)
const writtenFile = await this.file.writeFile(pathToWrite, newFileName, file.data.buffer)
Expand All @@ -156,10 +224,10 @@ export class AttachmentService {
url: "",
};
this.presentToast(this.texts["FRMELEMNTS_MSG_SUCCESSFULLY_ATTACHED"], "success");
this.actionSheetOpen? this.actionSheetController.dismiss(data) : this.payload.push(data);
this.actionSheetOpen ? this.actionSheetController.dismiss(data) : this.payload.push(data);
}
}

} catch (error) {
this.presentToast(this.texts["FRMELEMNTS_MSG_ERROR_WHILE_STORING_FILE"]);
}
Expand All @@ -185,7 +253,7 @@ export class AttachmentService {
let correctPath = filePath.substr(0, filePath.lastIndexOf("/") + 1);
let currentName = filePath.split("/").pop();
currentName = currentName.split("?")[0];
this.copyFileToLocalDir(correctPath, currentName, this.createFileName(currentName));
this.copyFileToLocalDir(correctPath, currentName, this.createFileName(currentName), filePath);
}

createFileName(name) {
Expand Down Expand Up @@ -213,20 +281,20 @@ export class AttachmentService {
return this.file.removeFile(this.directoryPath(), fileName);
}

async openAttachmentSource(type,payload) {
let data:any ='';
async openAttachmentSource(type, payload) {
let data: any = '';
this.actionSheetOpen = false;
this.payload = payload;
switch(type){
switch (type) {
case 'openCamera':
this.takePicture(this.camera.PictureSourceType.CAMERA);
break;
this.takePicture(this.camera.PictureSourceType.CAMERA);
break;
case 'openGallery':
this.takePicture(this.camera.PictureSourceType.PHOTOLIBRARY);
break;
this.takePicture(this.camera.PictureSourceType.PHOTOLIBRARY);
break;
case 'openFiles':
this.openFile();
break;
break;
}
}
}
2 changes: 1 addition & 1 deletion src/app/manage-learn/core/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ProjectService {
})
}
async getTemplateBySoluntionId(id) {
let payload = await this.utils.getProfileInfo();
let payload = await this.utils.getProfileData();
const config = {
url: urlConstants.API_URLS.TEMPLATE_DETAILS + id,
payload: payload,
Expand Down
6 changes: 6 additions & 0 deletions src/app/manage-learn/core/services/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,11 @@ return data;
value: "image",
type: 'image/jpeg'
},
{
name: "FRMELEMNTS_LBL_VIDEOS",
value: "video",
type: "video/mp4"
},
{
name: "FRMELEMNTS_LBL_FILES",
value: "file",
Expand All @@ -752,6 +757,7 @@ return data;
value: "link",
type: "link"
},

];
return tabs;
}
Expand Down
Loading