mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
bugs before presantation
This commit is contained in:
@@ -1,72 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gpr.gabinetedigital">
|
<manifest package="com.gpr.gabinetedigital" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<!-- Required permissions -->
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
<uses-feature android:name="android.hardware.camera" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-feature android:name="android.hardware.camera" />
|
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:requestLegacyExternalStorage="true" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/title_activity_main" android:launchMode="singleTop" android:name=".MainActivity" android:theme="@style/AppTheme.NoActionBarLaunch">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<application
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
android:allowBackup="true"
|
</intent-filter>
|
||||||
android:icon="@mipmap/ic_launcher"
|
</activity>
|
||||||
android:label="@string/app_name"
|
<activity android:exported="true" android:label="@string/app_name" android:name="de.mindlib.sendIntent.SendIntentActivity" android:theme="@style/AppTheme.NoActionBar">
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
<intent-filter>
|
||||||
android:supportsRtl="true"
|
<action android:name="android.intent.action.SEND" />
|
||||||
android:theme="@style/AppTheme"
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
android:usesCleartextTraffic="true"
|
<data android:mimeType="image/*" />
|
||||||
android:requestLegacyExternalStorage="true">
|
<data android:mimeType="video/*" />
|
||||||
|
</intent-filter>
|
||||||
<activity
|
<intent-filter>
|
||||||
android:name=".MainActivity"
|
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
android:exported="true"
|
<data android:mimeType="image/*" />
|
||||||
android:label="@string/title_activity_main"
|
<data android:mimeType="video/*" />
|
||||||
android:launchMode="singleTop"
|
</intent-filter>
|
||||||
android:theme="@style/AppTheme.NoActionBarLaunch">
|
</activity>
|
||||||
<intent-filter>
|
<provider android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
</provider>
|
||||||
</intent-filter>
|
</application>
|
||||||
|
|
||||||
</activity>
|
|
||||||
<!-- Add new One Activity for handle Intent here -->
|
|
||||||
<activity
|
|
||||||
android:name="de.mindlib.sendIntent.SendIntentActivity"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:exported="true"
|
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
|
|
||||||
<!-- Depending on your project, you can add here the type of data you wish to receive -->
|
|
||||||
<data android:mimeType="image/*" />
|
|
||||||
<data android:mimeType="video/*" />
|
|
||||||
</intent-filter>
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.SEND_MULTIPLE" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<data android:mimeType="image/*" />
|
|
||||||
<data android:mimeType="video/*" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
|
|
||||||
<provider
|
|
||||||
android:name="androidx.core.content.FileProvider"
|
|
||||||
android:authorities="${applicationId}.fileprovider"
|
|
||||||
android:exported="false"
|
|
||||||
android:grantUriPermissions="true">
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
||||||
android:resource="@xml/file_paths" />
|
|
||||||
</provider>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
||||||
controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
|
controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
|
||||||
<source type="video/mp4" [src]="'data:video/mp4;base64,' + seleted.FileBase64">
|
<source type="video/mp4" [src]="seleted.FileBase64">
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
let fileObject = {
|
let fileObject = {
|
||||||
FileBase64: 'data:video/mp4;base64,'+content.data,
|
FileBase64: 'data:video/mp4;base64,' + content.data,
|
||||||
FileExtension: 'mp4',
|
FileExtension: 'mp4',
|
||||||
OriginalFileName: 'video'
|
OriginalFileName: 'video'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ export class PublicationsPage implements OnInit {
|
|||||||
|
|
||||||
this.hideRefreshButton();
|
this.hideRefreshButton();
|
||||||
this.intent = window["sharedContent"]
|
this.intent = window["sharedContent"]
|
||||||
|
window["refreshPublication"] = this.refreshing
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ export class PublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshing() {
|
refreshing = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getActions();
|
this.getActions();
|
||||||
}, 1500);
|
}, 1500);
|
||||||
@@ -300,6 +301,9 @@ export class PublicationsPage implements OnInit {
|
|||||||
const loader = this.toastService.loading();
|
const loader = this.toastService.loading();
|
||||||
try {
|
try {
|
||||||
await this.publications.DeletePresidentialAction(id).toPromise();
|
await this.publications.DeletePresidentialAction(id).toPromise();
|
||||||
|
if(window["refreshPublication"]) {
|
||||||
|
window["refreshPublication"]();
|
||||||
|
}
|
||||||
this.toastService._successMessage()
|
this.toastService._successMessage()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if(error.status == 0) {
|
if(error.status == 0) {
|
||||||
|
|||||||
@@ -270,6 +270,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
||||||
|
this.publicationFolderService.revertPublicationOrder(folderId)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
@@ -348,4 +349,25 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
await modal.present();
|
await modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getSortedPublications(): Publication[] {
|
||||||
|
const unsortedPublications = this.publicationFolderService.publicationList[this.folderId];
|
||||||
|
|
||||||
|
if (unsortedPublications) {
|
||||||
|
// Copiar a lista original para evitar alterações indesejadas
|
||||||
|
const publicationsCopy = [...unsortedPublications];
|
||||||
|
|
||||||
|
// Ordenar as publicações pelo DatePublication
|
||||||
|
publicationsCopy.sort((a, b) => {
|
||||||
|
const dateA = new Date(a.DatePublication).getTime();
|
||||||
|
const dateB = new Date(b.DatePublication).getTime();
|
||||||
|
return dateA - dateB;
|
||||||
|
});
|
||||||
|
|
||||||
|
return publicationsCopy;
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkTableDivice() == true" width="70" height="70"
|
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkTableDivice() == true" width="70" height="70"
|
||||||
preload="metadata" webkit-playsinline="webkit-playsinline">
|
preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||||
<source type="video/mp4" [src]="'data:video/mp4;base64,' +seleted.FileBase64">
|
<source type="video/mp4" [src]="seleted.FileBase64">
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -258,26 +258,26 @@ export class NewPublicationPage implements OnInit {
|
|||||||
multiple: true,
|
multiple: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(result)
|
console.log(result)
|
||||||
|
|
||||||
result.files.forEach(async blobFile => {
|
result.files.forEach(async blobFile => {
|
||||||
console.log(blobFile)
|
console.log(blobFile)
|
||||||
if (this.checkFileType.checkFileType(blobFile.mimeType) == 'image' || this.checkFileType.checkFileType(blobFile.mimeType) == 'video') {
|
if (this.checkFileType.checkFileType(blobFile.mimeType) == 'image' || this.checkFileType.checkFileType(blobFile.mimeType) == 'video') {
|
||||||
/* console.log('converte new way',this.getBase64(blobFile)) */
|
/* console.log('converte new way',this.getBase64(blobFile)) */
|
||||||
|
|
||||||
/* const blob = await fetch(
|
/* const blob = await fetch(
|
||||||
Capacitor.convertFileSrc(blobFile.path)
|
Capacitor.convertFileSrc(blobFile.path)
|
||||||
).then(r => r.blob()); */
|
).then(r => r.blob()); */
|
||||||
|
|
||||||
/* console.log(await blob.arrayBuffer());
|
/* console.log(await blob.arrayBuffer());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log("base64 :data:video/mp4;base64,",this.arrayBufferToBase64(await blob.arrayBuffer())) */
|
console.log("base64 :data:video/mp4;base64,",this.arrayBufferToBase64(await blob.arrayBuffer())) */
|
||||||
|
|
||||||
this.convertBlobToBase64(blobFile.blob).then((value) => {
|
this.convertBlobToBase64(blobFile.blob).then((value) => {
|
||||||
|
|
||||||
console.log(value)
|
console.log(this.removeTextBeforeSlash(value, ','))
|
||||||
|
|
||||||
this.filesSizeSum = this.filesSizeSum + blobFile.size
|
this.filesSizeSum = this.filesSizeSum + blobFile.size
|
||||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
||||||
@@ -288,7 +288,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
const newAttachment = new PublicationAttachmentEntity(
|
const newAttachment = new PublicationAttachmentEntity(
|
||||||
{
|
{
|
||||||
base64: value,
|
base64: this.removeTextBeforeSlash(value, ','),
|
||||||
extension: FileExtension,
|
extension: FileExtension,
|
||||||
blobFile: file,
|
blobFile: file,
|
||||||
FileType: this.checkFileType.checkFileType(FileExtension)
|
FileType: this.checkFileType.checkFileType(FileExtension)
|
||||||
@@ -347,7 +347,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
({
|
({
|
||||||
multiple: true,
|
multiple: true,
|
||||||
});
|
});
|
||||||
console.log(result.files)
|
console.log(result.files)
|
||||||
result.files.forEach(element => {
|
result.files.forEach(element => {
|
||||||
|
|
||||||
this.filesSizeSum = this.filesSizeSum + element.size
|
this.filesSizeSum = this.filesSizeSum + element.size
|
||||||
@@ -359,15 +359,16 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
console.log(result)
|
console.log(result)
|
||||||
console.log('load video tablet base64',content)
|
console.log('load video tablet base64', content)
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
let fileObject = new PublicationAttachmentEntity ({
|
let fileObject = new PublicationAttachmentEntity({
|
||||||
base64: content.data,
|
base64: content.data,
|
||||||
extension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
extension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||||
OriginalFileName: 'video',
|
OriginalFileName: 'video',
|
||||||
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/'))
|
FileType: this.checkFileType.checkFileType(this.removeTextBeforeSlash(element.mimeType, '/'))
|
||||||
})
|
})
|
||||||
this.seletedContent.push(fileObject)
|
this.seletedContent.push(fileObject)
|
||||||
|
console.log('Files array',this.seletedContent)
|
||||||
})
|
})
|
||||||
.catch((err) => console.error(err));
|
.catch((err) => console.error(err));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -607,17 +608,59 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
convertBlobToBase64(blob: Blob) {
|
convertBlobToBase64(blob: Blob) {
|
||||||
console.log('Convert blob ',blob)
|
try {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const reader = new FileReader;
|
const chunkSize = 5000000; // 5 MB
|
||||||
reader.onerror = reject;
|
const fileSize = blob.size;
|
||||||
reader.onload = () => {
|
const chunks = Math.ceil(fileSize / chunkSize);
|
||||||
resolve(reader.result)
|
let currentChunk = 0;
|
||||||
}
|
const base64Chunks = [];
|
||||||
reader.readAsDataURL(blob)
|
|
||||||
},)
|
const reader = new FileReader();
|
||||||
|
|
||||||
|
reader.onload = function () {
|
||||||
|
base64Chunks.push(reader.result);
|
||||||
|
currentChunk++;
|
||||||
|
|
||||||
|
if (currentChunk < chunks) {
|
||||||
|
loadNextChunk();
|
||||||
|
} else {
|
||||||
|
const base64Data = base64Chunks.join("");
|
||||||
|
resolve(base64Data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
reader.onerror = function (error) {
|
||||||
|
reject(error);
|
||||||
|
};
|
||||||
|
|
||||||
|
function loadNextChunk() {
|
||||||
|
const start = currentChunk * chunkSize;
|
||||||
|
const end = Math.min(start + chunkSize, fileSize);
|
||||||
|
const chunk = blob.slice(start, end);
|
||||||
|
reader.readAsDataURL(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadNextChunk();
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* convertBlobToBase64(blob: Blob) {
|
||||||
|
console.log('Convert blob ',blob)
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const reader = new FileReader;
|
||||||
|
reader.onerror = reject;
|
||||||
|
reader.onload = () => {
|
||||||
|
resolve(reader.result)
|
||||||
|
}
|
||||||
|
reader.readAsDataURL(blob)
|
||||||
|
},)
|
||||||
|
} */
|
||||||
|
|
||||||
getBase64(file) {
|
getBase64(file) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
@@ -625,7 +668,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
reader.onload = () => resolve(reader.result);
|
reader.onload = () => resolve(reader.result);
|
||||||
reader.onerror = error => reject(error);
|
reader.onerror = error => reject(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTextBeforeSlash(inputString, mark) {
|
removeTextBeforeSlash(inputString, mark) {
|
||||||
if (inputString.includes(mark)) {
|
if (inputString.includes(mark)) {
|
||||||
@@ -1002,7 +1045,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
.then(async (content) => {
|
.then(async (content) => {
|
||||||
this.filecontent = true;
|
this.filecontent = true;
|
||||||
console.log('',content)
|
console.log('', content)
|
||||||
let fileObject = new PublicationAttachmentEntity({
|
let fileObject = new PublicationAttachmentEntity({
|
||||||
base64: content.data,
|
base64: content.data,
|
||||||
extension: 'mp4',
|
extension: 'mp4',
|
||||||
@@ -1028,7 +1071,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkTableDivice() {
|
checkTableDivice() {
|
||||||
if (!this.platform.is('desktop'))
|
if (this.platform.is('tablet'))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
this.publicationFolderService.publicationList[folderId].push(publicationDetails)
|
||||||
|
this.publicationFolderService.revertPublicationOrder(folderId)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex])
|
let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex])
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import { PublicationPipe } from 'src/app/pipes/publication.pipe';
|
|||||||
})
|
})
|
||||||
export class PublicationFolderService {
|
export class PublicationFolderService {
|
||||||
|
|
||||||
publicationList: {[key: string]: Publication[] } = {};
|
publicationList: { [key: string]: Publication[] } = {};
|
||||||
FolderDetails: {[key: string]: PublicationFolder } = {};
|
FolderDetails: { [key: string]: PublicationFolder } = {};
|
||||||
|
|
||||||
restoreFolder: {} = {}
|
restoreFolder: {} = {}
|
||||||
|
|
||||||
@@ -25,14 +25,14 @@ export class PublicationFolderService {
|
|||||||
constructor(
|
constructor(
|
||||||
private storage: Storage,
|
private storage: Storage,
|
||||||
private publications: PublicationsService,
|
private publications: PublicationsService,
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
|
|
||||||
createPublicationList(folderId) {
|
createPublicationList(folderId) {
|
||||||
if(!this.publicationList[folderId]) {
|
if (!this.publicationList[folderId]) {
|
||||||
this.publicationList[folderId] = []
|
this.publicationList[folderId] = []
|
||||||
}
|
}
|
||||||
if(!this.FolderDetails[folderId]) {
|
if (!this.FolderDetails[folderId]) {
|
||||||
this.FolderDetails[folderId] = new PublicationFolder();
|
this.FolderDetails[folderId] = new PublicationFolder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,13 +40,13 @@ export class PublicationFolderService {
|
|||||||
getFromDB(folderId: any) {
|
getFromDB(folderId: any) {
|
||||||
|
|
||||||
|
|
||||||
if(!this.restoreFolder[folderId]) {
|
if (!this.restoreFolder[folderId]) {
|
||||||
|
|
||||||
this.storage.get(folderId).then((viewPublications) => {
|
this.storage.get(folderId).then((viewPublications) => {
|
||||||
this.publicationList[folderId] = viewPublications
|
this.publicationList[folderId] = viewPublications
|
||||||
})
|
})
|
||||||
|
|
||||||
this.storage.get(folderId+"name").then((viewPublications) => {
|
this.storage.get(folderId + "name").then((viewPublications) => {
|
||||||
this.FolderDetails[folderId] = viewPublications
|
this.FolderDetails[folderId] = viewPublications
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -56,29 +56,30 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
updateFolderDetails(folderId, res) {
|
updateFolderDetails(folderId, res) {
|
||||||
this.FolderDetails[folderId] = res
|
this.FolderDetails[folderId] = res
|
||||||
this.storage.set(folderId+"name", res)
|
this.storage.set(folderId + "name", res)
|
||||||
}
|
}
|
||||||
|
|
||||||
save(folderId) {
|
save(folderId) {
|
||||||
this.storage.set(folderId+"name", this.FolderDetails)
|
this.storage.set(folderId + "name", this.FolderDetails)
|
||||||
this.storage.set(folderId, this.publicationList[folderId]);
|
this.storage.set(folderId, this.publicationList[folderId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
publicationIsPresent(publicationId, folderId) {
|
publicationIsPresent(publicationId, folderId) {
|
||||||
return this.publicationList[folderId].find( e => e.DocumentId == publicationId )
|
return this.publicationList[folderId].find(e => e.DocumentId == publicationId)
|
||||||
}
|
}
|
||||||
publicationFind(publicationId, folderId) {
|
publicationFind(publicationId, folderId) {
|
||||||
return this.publicationList[folderId].find( e => e.DocumentId == publicationId )
|
return this.publicationList[folderId].find(e => e.DocumentId == publicationId)
|
||||||
}
|
}
|
||||||
publicationFindIndex(publicationId, folderId) {
|
publicationFindIndex(publicationId, folderId) {
|
||||||
return this.publicationList[folderId].findIndex( e => e.DocumentId == publicationId )
|
return this.publicationList[folderId].findIndex(e => e.DocumentId == publicationId)
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicationAddOrUpdate(folderId, publicationId, Publication: Publication) {
|
PublicationAddOrUpdate(folderId, publicationId, Publication: Publication) {
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
if(!found) {
|
if (!found) {
|
||||||
this.publicationList[folderId].push(Publication)
|
this.publicationList[folderId].push(Publication)
|
||||||
|
this.revertPublicationOrder(folderId);
|
||||||
} else {
|
} else {
|
||||||
this.publicationList[folderId][findIndex] = Publication
|
this.publicationList[folderId][findIndex] = Publication
|
||||||
}
|
}
|
||||||
@@ -86,9 +87,9 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
deletePost(folderId: any, DocumentId: any) {
|
deletePost(folderId: any, DocumentId: any) {
|
||||||
|
|
||||||
if(this.publicationList[folderId]) {
|
if (this.publicationList[folderId]) {
|
||||||
|
|
||||||
this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != DocumentId)
|
this.publicationList[folderId] = this.publicationList[folderId].filter(e => e.DocumentId != DocumentId)
|
||||||
|
|
||||||
this.save(folderId)
|
this.save(folderId)
|
||||||
}
|
}
|
||||||
@@ -99,7 +100,7 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
this.publications.GetPresidentialAction(folderId).subscribe(res => {
|
this.publications.GetPresidentialAction(folderId).subscribe(res => {
|
||||||
this.FolderDetails[folderId] = res
|
this.FolderDetails[folderId] = res
|
||||||
this.storage.set(folderId+"name", res)
|
this.storage.set(folderId + "name", res)
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
// this.httpErroHandle.httpStatusHandle(error)
|
// this.httpErroHandle.httpStatusHandle(error)
|
||||||
@@ -118,7 +119,7 @@ export class PublicationFolderService {
|
|||||||
let loadLater = []
|
let loadLater = []
|
||||||
for (let publicationId of publicationIds) {
|
for (let publicationId of publicationIds) {
|
||||||
|
|
||||||
if(!this.publicationIsPresent(publicationId, folderId)) {
|
if (!this.publicationIsPresent(publicationId, folderId)) {
|
||||||
await this.loadPublication(publicationId, folderId)
|
await this.loadPublication(publicationId, folderId)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -126,7 +127,7 @@ export class PublicationFolderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( let publicationId of loadLater) {
|
for (let publicationId of loadLater) {
|
||||||
await this.loadPublication(publicationId, folderId)
|
await this.loadPublication(publicationId, folderId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
this.storage.set(folderId, this.publicationList[folderId]);
|
this.storage.set(folderId, this.publicationList[folderId]);
|
||||||
this.getpublication = this.publicationList[folderId];
|
this.getpublication = this.publicationList[folderId];
|
||||||
} catch(error) {
|
} catch (error) {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,17 +148,18 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
if(!found) {
|
if (!found) {
|
||||||
this.publicationList[folderId].push(publicationDetails)
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
this.revertPublicationOrder(folderId);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let a: any = Object.assign({},this.publicationList[folderId][findIndex])
|
let a: any = Object.assign({}, this.publicationList[folderId][findIndex])
|
||||||
let b: any = Object.assign({}, publicationDetails)
|
let b: any = Object.assign({}, publicationDetails)
|
||||||
|
|
||||||
a.Files = a.Files.length
|
a.Files = a.Files.length
|
||||||
b.Files = b.Files.length
|
b.Files = b.Files.length
|
||||||
|
|
||||||
if(JSON.stringify(a) != JSON.stringify(b)) {
|
if (JSON.stringify(a) != JSON.stringify(b)) {
|
||||||
|
|
||||||
// console.log({a, b})
|
// console.log({a, b})
|
||||||
this.publicationList[folderId][findIndex] = publicationDetails
|
this.publicationList[folderId][findIndex] = publicationDetails
|
||||||
@@ -171,9 +173,10 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
|
|
||||||
async CreatePublication(folderId, publication: Publication) {
|
async CreatePublication(folderId, publication: Publication) {
|
||||||
const response = await this.publications.CreatePublication(folderId, publication).toPromise()
|
const response = await this.publications.CreatePublication(folderId, publication).toPromise()
|
||||||
let publicationDetails: Publication = this.publicationPipe.itemList(response)
|
let publicationDetails: Publication = this.publicationPipe.itemList(response)
|
||||||
this.publicationList[folderId].push(publicationDetails)
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
this.revertPublicationOrder(folderId)
|
||||||
return publicationDetails
|
return publicationDetails
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,8 +185,9 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
if(!found) {
|
if (!found) {
|
||||||
this.publicationList[folderId].push(publicationDetails)
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
this.revertPublicationOrder(folderId)
|
||||||
} else {
|
} else {
|
||||||
this.publicationList[folderId][findIndex] = publicationDetails
|
this.publicationList[folderId][findIndex] = publicationDetails
|
||||||
}
|
}
|
||||||
@@ -196,8 +200,10 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
const found = this.publicationIsPresent(publicationId, folderId)
|
const found = this.publicationIsPresent(publicationId, folderId)
|
||||||
if(!found) {
|
if (!found) {
|
||||||
this.publicationList[folderId].push(publicationDetails)
|
this.publicationList[folderId].push(publicationDetails)
|
||||||
|
this.revertPublicationOrder(folderId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return this.publicationList[folderId][findIndex]
|
return this.publicationList[folderId][findIndex]
|
||||||
}
|
}
|
||||||
@@ -205,10 +211,10 @@ export class PublicationFolderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getLocalPublication (folderId, DocumentId) {
|
getLocalPublication(folderId, DocumentId) {
|
||||||
|
|
||||||
if(this.publicationList[folderId]) {
|
if (this.publicationList[folderId]) {
|
||||||
return this.publicationList[folderId].find( e => e.DocumentId == DocumentId )
|
return this.publicationList[folderId].find(e => e.DocumentId == DocumentId)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -217,11 +223,22 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
|
|
||||||
PublicationHasImage(Publication: Publication) {
|
PublicationHasImage(Publication: Publication) {
|
||||||
return Publication?.Files?.[0]?.FileBase64 != '' && Publication?.Files?.[0]?.FileBase64 != "data:image/jpg;base64,null"
|
return Publication?.Files?.[0]?.FileBase64 != '' && Publication?.Files?.[0]?.FileBase64 != "data:image/jpg;base64,null"
|
||||||
}
|
}
|
||||||
|
|
||||||
hasCapturedImage(Publication: Publication) {
|
hasCapturedImage(Publication: Publication) {
|
||||||
return Publication?.Files?.[0]?.FileBase64 != '' && Publication?.Files?.[0]?.FileBase64 != "data:image/jpg;base64,null"
|
return Publication?.Files?.[0]?.FileBase64 != '' && Publication?.Files?.[0]?.FileBase64 != "data:image/jpg;base64,null"
|
||||||
|
}
|
||||||
|
|
||||||
|
revertPublicationOrder(folderId) {
|
||||||
|
//Revert order of the list
|
||||||
|
if (this.publicationList[folderId]) {
|
||||||
|
this.publicationList[folderId] = this.publicationList[folderId].sort((a, b) => {
|
||||||
|
const dateA = new Date(a.DatePublication).getTime();
|
||||||
|
const dateB = new Date(b.DatePublication).getTime();
|
||||||
|
return dateB - dateA; // Revertendo a ordem aqui
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-45
@@ -1,6 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
<modules>
|
||||||
|
|
||||||
|
<remove name="WebDAVModule"/>
|
||||||
|
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<handlers>
|
||||||
|
|
||||||
|
<remove name="WebDAV"/>
|
||||||
|
|
||||||
|
</handlers>
|
||||||
<rewrite>
|
<rewrite>
|
||||||
<rules>
|
<rules>
|
||||||
<rule name="AngularRewrite" stopProcessing="true">
|
<rule name="AngularRewrite" stopProcessing="true">
|
||||||
@@ -16,49 +27,7 @@
|
|||||||
<httpProtocol>
|
<httpProtocol>
|
||||||
<customHeaders>
|
<customHeaders>
|
||||||
<!-- Iframe on the same host only -->
|
<!-- Iframe on the same host only -->
|
||||||
<add name="X-Frame-Options" value="SAMEORIGIN" />
|
<add name="Content-Security-Policy" value="frame-ancestors https://gdqas.oapr.gov.ao/" />
|
||||||
<!-- HTTPS on -->
|
|
||||||
<add name="Strict-Transport-Security" value="max-age=31536000" />
|
|
||||||
<add name="Referrer-Policy" value="no-referrer" />
|
|
||||||
<add name="X-Content-Type-Options" value="nosniff" />
|
|
||||||
<!-- <add e="Expect-CT" value="enforce, max-age=86400" /> -->
|
|
||||||
<!-- Permision -->
|
|
||||||
<add name="Permissions-Policy" value="camera=(), microphone=*" />
|
|
||||||
<!-- same origin only -->
|
|
||||||
<add name="Cross-Origin-Embedder-Policy" value="require-corp" />
|
|
||||||
<!-- same origin only -->
|
|
||||||
<!-- <add name="Cross-Origin-Opener-Policy" value="same-origin" /> -->
|
|
||||||
</customHeaders>
|
|
||||||
</httpProtocol>
|
|
||||||
|
|
||||||
</system.webServer>
|
|
||||||
</configuration>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration>
|
|
||||||
<system.webServer>
|
|
||||||
<rewrite>
|
|
||||||
<rules>
|
|
||||||
<rule name="AngularRewrite" stopProcessing="true">
|
|
||||||
<match url=".*" />
|
|
||||||
<conditions logicalGrouping="MatchAll">
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
|
||||||
</conditions>
|
|
||||||
<action type="Rewrite" url="/" />
|
|
||||||
</rule>
|
|
||||||
</rules>
|
|
||||||
</rewrite>
|
|
||||||
<httpProtocol>
|
|
||||||
<customHeaders>
|
|
||||||
<!-- Iframe on the same host only -->
|
|
||||||
<add name="Content-Security-Policy" value="frame-ancestors https://gdviewer-dev.dyndns.info/" />
|
|
||||||
<!-- HTTPS on -->
|
<!-- HTTPS on -->
|
||||||
<add name="Strict-Transport-Security" value="max-age=31536000" />
|
<add name="Strict-Transport-Security" value="max-age=31536000" />
|
||||||
<add name="Referrer-Policy" value="no-referrer" />
|
<add name="Referrer-Policy" value="no-referrer" />
|
||||||
@@ -74,13 +43,13 @@
|
|||||||
</httpProtocol>
|
</httpProtocol>
|
||||||
|
|
||||||
|
|
||||||
<directoryBrowse enabled="false" />
|
<!-- <directoryBrowse enabled="false" />
|
||||||
<httpErrors>
|
<httpErrors>
|
||||||
<remove statusCode="404" subStatusCode="-1" />
|
<remove statusCode="404" subStatusCode="-1" />
|
||||||
<remove statusCode="403" subStatusCode="-1" />
|
<remove statusCode="403" subStatusCode="-1" />
|
||||||
<error statusCode="403" prefixLanguageFilePath="" path="/home/events" responseMode="ExecuteURL" />
|
<error statusCode="403" prefixLanguageFilePath="" path="/home/events" responseMode="ExecuteURL" />
|
||||||
<error statusCode="404" prefixLanguageFilePath="" path="/index.html" responseMode="ExecuteURL" />
|
<error statusCode="404" prefixLanguageFilePath="" path="/index.html" responseMode="ExecuteURL" />
|
||||||
</httpErrors>
|
</httpErrors> -->
|
||||||
|
|
||||||
|
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
|
|||||||
Reference in New Issue
Block a user