Merge branch 'feature/viewer-attachment' of bitbucket.org:equilibriumito/gabinete-digital-fo into feature/viewer-attachment

This commit is contained in:
Peter Maquiran
2024-04-02 11:15:54 +01:00
4 changed files with 20 additions and 30 deletions
@@ -805,18 +805,8 @@ export class NewPublicationPage implements OnInit {
try { try {
console.log('shared base', content.data) console.log('shared base', content.data)
this.capturedImage = 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ',');
const newAttachment = new PublicationAttachmentEntity( this.showCroppModal()
{
base64: this.removeTextBeforeSlash(content.data, ','),
extension: FileExtension,
FileType: this.checkFileType.checkFileType(FileExtension) as any,
OriginalFileName: 'shared'
}
)
this.PublicationFromMvService.form.Files.push(newAttachment)
} catch (error) { } catch (error) {
console.log('error shared filesystem', error) console.log('error shared filesystem', error)
} }
@@ -842,7 +832,7 @@ export class NewPublicationPage implements OnInit {
const newAttachment = new PublicationAttachmentEntity( const newAttachment = new PublicationAttachmentEntity(
{ {
base64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','), base64: content.data,
extension: 'mp4', extension: 'mp4',
FileType: this.checkFileType.checkFileType('mp4') as any, FileType: this.checkFileType.checkFileType('mp4') as any,
OriginalFileName: 'shared' OriginalFileName: 'shared'
@@ -882,16 +872,8 @@ export class NewPublicationPage implements OnInit {
Filesystem.readFile({ path: resultUrl }).then(async (content) => { Filesystem.readFile({ path: resultUrl }).then(async (content) => {
try { try {
if (this.checkFileType.checkFileType(FileExtension) == 'image') { if (this.checkFileType.checkFileType(FileExtension) == 'image') {
let newAttachment = new PublicationAttachmentEntity( this.capturedImage = 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ',');
{ this.showCroppModal()
base64: 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ','),
extension: FileExtension,
FileType: this.checkFileType.checkFileType(FileExtension) as any,
OriginalFileName: 'shared'
}
)
this.PublicationFromMvService.form.Files.push(newAttachment)
} else if (this.checkFileType.checkFileType(FileExtension) == 'video') { } else if (this.checkFileType.checkFileType(FileExtension) == 'video') {
+4 -2
View File
@@ -6,7 +6,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { capitalizeTxt } from 'src/plugin/text'; import { capitalizeTxt } from 'src/plugin/text';
import { Update as room } from 'src/app/models/chatMethod'; import { Update as room } from 'src/app/models/chatMethod';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { Platform } from '@ionic/angular'; import { ModalController, NavController, Platform } from '@ionic/angular';
import { SqliteService } from 'src/app/services/sqlite.service'; import { SqliteService } from 'src/app/services/sqlite.service';
import { ChatService } from 'src/app/services/chat.service'; import { ChatService } from 'src/app/services/chat.service';
import { NativeNotificationService } from 'src/app/services/native-notification.service'; import { NativeNotificationService } from 'src/app/services/native-notification.service';
@@ -68,6 +68,8 @@ export class ChatSystemService {
private NetworkServiceService: NetworkServiceService, private NetworkServiceService: NetworkServiceService,
private ViewedMessageService: ViewedMessageService, private ViewedMessageService: ViewedMessageService,
private notificationService: NotificationsService, private notificationService: NotificationsService,
private modalController: ModalController,
private navController: NavController
) { ) {
@@ -482,7 +484,7 @@ export class ChatSystemService {
if (setData.name != 'Rocket Cat' && setData.name != 'general' && chat == false) { if (setData.name != 'Rocket Cat' && setData.name != 'general' && chat == false) {
// create room // create room
if (!this.roomExist(roomId)) { if (!this.roomExist(roomId)) {
let room: RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.notificationService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService, this.notificationService) let room: RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.notificationService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService, this.notificationService,this.modalController,this.navController)
room.setData(setData) room.setData(setData)
room.receiveMessage() room.receiveMessage()
room.getAllUsers = this.getUsers room.getAllUsers = this.getUsers
+10 -4
View File
@@ -4,7 +4,7 @@ import { MessageService, MessageServiceDateLabel } from 'src/app/services/chat/m
import { showDateDuration } from 'src/plugin/showDateDuration'; import { showDateDuration } from 'src/plugin/showDateDuration';
import { chatHistory } from 'src/app/models/chatMethod'; import { chatHistory } from 'src/app/models/chatMethod';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { Platform } from '@ionic/angular'; import { ModalController, NavController, Platform } from '@ionic/angular';
import { SqliteService } from 'src/app/services/sqlite.service'; import { SqliteService } from 'src/app/services/sqlite.service';
import { NativeNotificationService } from 'src/app/services/native-notification.service'; import { NativeNotificationService } from 'src/app/services/native-notification.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
@@ -101,7 +101,9 @@ export class RoomService {
private NetworkServiceService: NetworkServiceService, private NetworkServiceService: NetworkServiceService,
private ChatSystemService: ChatSystemService, private ChatSystemService: ChatSystemService,
private ViewedMessageService: ViewedMessageService, private ViewedMessageService: ViewedMessageService,
private notificationService: NotificationsService private notificationService: NotificationsService,
private modalController: ModalController,
private navController: NavController
) { ) {
/* this.NativeNotificationService.askForPermission() */ /* this.NativeNotificationService.askForPermission() */
@@ -219,8 +221,8 @@ export class RoomService {
if (difference < 0) { if (difference < 0) {
this.deleteRoom(); this.deleteRoom();
if(this.chatOpen) { if(this.chatOpen && window.location.pathname.includes('chat')) {
this.closeModal()
} }
} else { } else {
@@ -1290,4 +1292,8 @@ export class RoomService {
this.members = members this.members = members
this.membersExcludeMe = users this.membersExcludeMe = users
} }
async closeModal() {
await this.modalController.dismiss();
}
} }
@@ -240,7 +240,7 @@ export class NewPublicationPage implements OnInit {
this.convertBlobToBase64(blobFile.blob).then((value: string) => { this.convertBlobToBase64(blobFile.blob).then((value: string) => {
this.filesSizeSum = this.filesSizeSum + blobFile.size this.filesSizeSum = this.filesSizeSum + blobFile.size
this.capturedImage = this.removeTextBeforeSlash(value, ','), this.capturedImage = 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(value, ','),
this.showCroppModal(); this.showCroppModal();
this.filecontent = true; this.filecontent = true;