mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix open pdf and member list
This commit is contained in:
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { File, IWriteOptions } from '@awesome-cordova-plugins/file/ngx';
|
import { File, IWriteOptions } from '@awesome-cordova-plugins/file/ngx';
|
||||||
import { err, ok, Result } from 'neverthrow';
|
import { err, ok, Result } from 'neverthrow';
|
||||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||||
|
import { Logger } from 'src/app/services/logger/main/service';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -29,7 +30,12 @@ export class FileSystemMobileService {
|
|||||||
const result = await this.file.writeFile(path, fileName, context, { replace: true })
|
const result = await this.file.writeFile(path, fileName, context, { replace: true })
|
||||||
return ok(result)
|
return ok(result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error writing file', e)
|
Logger.error('Error writing file', {
|
||||||
|
path,
|
||||||
|
fileName,
|
||||||
|
context
|
||||||
|
})
|
||||||
|
console.error('Error writing file', e)
|
||||||
return err(e)
|
return err(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,6 +45,10 @@ export class FileSystemMobileService {
|
|||||||
const result = this.FileOpener.open(filePath, mimetype)
|
const result = this.FileOpener.open(filePath, mimetype)
|
||||||
return ok(result)
|
return ok(result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Logger.error('Error opening file', {
|
||||||
|
filePath,
|
||||||
|
mimetype
|
||||||
|
})
|
||||||
console.error('Error opening file', e)
|
console.error('Error opening file', e)
|
||||||
return err(e)
|
return err(e)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export class RoomUpdateNameSyncService {
|
|||||||
|
|
||||||
private watch() {
|
private watch() {
|
||||||
this.roomSocketRepository.listenToRoomUpdate().subscribe((event) => {
|
this.roomSocketRepository.listenToRoomUpdate().subscribe((event) => {
|
||||||
|
console.log('listenToRoomUpdate')
|
||||||
this.GetRoomByIdUseCaseService.execute(event.data.id)
|
this.GetRoomByIdUseCaseService.execute(event.data.id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { ModalController } from '@ionic/angular';
|
|||||||
import { GroupMessagesPage } from './modal/group-messages/group-messages.page';
|
import { GroupMessagesPage } from './modal/group-messages/group-messages.page';
|
||||||
import { ContactsPage } from './modal/./messages/contacts/contacts.page';
|
import { ContactsPage } from './modal/./messages/contacts/contacts.page';
|
||||||
import { MessagesPage } from './modal/./messages/messages.page';
|
import { MessagesPage } from './modal/./messages/messages.page';
|
||||||
import { NewGroupPage } from './modal/./new-group/new-group.page';
|
import { INewGroupModalOutPut, NewGroupPage } from './modal/./new-group/new-group.page';
|
||||||
import { Observable, Subject } from "rxjs/Rx";
|
import { Observable, Subject } from "rxjs/Rx";
|
||||||
import { Router, NavigationEnd } from '@angular/router';
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
import { TimeService } from 'src/app/services/functions/time.service';
|
import { TimeService } from 'src/app/services/functions/time.service';
|
||||||
@@ -476,7 +476,17 @@ export class ChatPage implements OnInit {
|
|||||||
cssClass: 'modal modal-desktop',
|
cssClass: 'modal modal-desktop',
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss<INewGroupModalOutPut>().then((event) => {
|
||||||
|
if(event.data?.roomId) {
|
||||||
|
const room = this.rooms.find(e => e.id == (event.data.roomId))
|
||||||
|
|
||||||
|
if(room) {
|
||||||
|
this.openMessagesPage(room.$id)
|
||||||
|
} else {
|
||||||
|
Logger.error('Cant find room after creating chat.page.ts/newGroup')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async editGroup(roomId) {
|
async editGroup(roomId) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<ion-list class="header-bottom-contacts" *ngIf="roomMembers$ | async as memberList" >
|
<ion-list class="header-bottom-contacts" *ngIf="roomMembers$ | async as memberList" >
|
||||||
<ng-container *ngFor="let user of memberList; let i = index">
|
<ng-container *ngFor="let user of memberList; let i = index">
|
||||||
<span > {{ user.wxFullName }}<ng-container *ngIf="i < memberList.length - 1">, </ng-container> </span>
|
<span *ngIf="roomType == RoomTypeEnum.Group"> {{ user.wxFullName }}<ng-container *ngIf="i < memberList.length - 1">, </ng-container> </span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,18 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
this.messageReceiveSubject?.unsubscribe();
|
||||||
|
this.messageDeleteSubject?.unsubscribe();
|
||||||
|
this.messageUpdateSubject?.unsubscribe();
|
||||||
|
this.messageSendSubject?.unsubscribe();
|
||||||
|
this.messageTypingSubject?.unsubscribe();
|
||||||
|
this.messageOnReconnectSubject?.unsubscribe();
|
||||||
|
this.messageOnSetRoomId?.unsubscribe();
|
||||||
|
this.newMessagesStream?.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
subscribeToChanges() {
|
subscribeToChanges() {
|
||||||
this.listenToIncomingMessage();
|
this.listenToIncomingMessage();
|
||||||
this.listenToDeleteMessage();
|
this.listenToDeleteMessage();
|
||||||
@@ -479,6 +491,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this.sendReadMessage()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
@@ -695,6 +709,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
// window.addEventListener('scroll', this.scrollChangeCallback, true);
|
// window.addEventListener('scroll', this.scrollChangeCallback, true);
|
||||||
}
|
}
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
// this.stop()
|
||||||
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
||||||
this.handleClickActive = false; // Disable the listener before component destruction
|
this.handleClickActive = false; // Disable the listener before component destruction
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,9 @@
|
|||||||
|
|
||||||
.buttons{
|
.buttons{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.solid {
|
.solid {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { HttpErrorResponse } from '@angular/common/http';
|
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ModalController, NavParams, PickerController } from '@ionic/angular';
|
import { ModalController, NavParams, PickerController } from '@ionic/angular';
|
||||||
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
|
||||||
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
import { ThemeService } from 'src/app/services/theme.service'
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
import { ZodError } from 'zod';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-edit-group',
|
selector: 'app-edit-group',
|
||||||
@@ -21,7 +25,10 @@ export class EditGroupPage implements OnInit {
|
|||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
private pickerController: PickerController,
|
private pickerController: PickerController,
|
||||||
private navParams: NavParams,
|
private navParams: NavParams,
|
||||||
public ThemeService: ThemeService
|
public ThemeService: ThemeService,
|
||||||
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
|
private toastService: ToastService,
|
||||||
|
private chatServiceService: ChatServiceService,
|
||||||
) {
|
) {
|
||||||
this.roomId = this.navParams.get('roomId');
|
this.roomId = this.navParams.get('roomId');
|
||||||
}
|
}
|
||||||
@@ -39,17 +46,27 @@ export class EditGroupPage implements OnInit {
|
|||||||
this.modalController.dismiss();
|
this.modalController.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
changeGroupName(){
|
async changeGroupName() {
|
||||||
if(this.groupName.trim().length > 1){
|
this.showLoader = true
|
||||||
let name = this.groupName.split(' ').join('-');
|
const result = await this.chatServiceService.updateRoomById({
|
||||||
let body = {
|
roomId: this.roomId,
|
||||||
"roomId": this.room._id,
|
roomName: this.groupName,
|
||||||
"name": name,
|
roomType: 0
|
||||||
}
|
})
|
||||||
}
|
|
||||||
else{
|
|
||||||
|
|
||||||
|
if(result.isOk()) {
|
||||||
|
this.modalController.dismiss();
|
||||||
|
} else if (result.error instanceof HttpResponse) {
|
||||||
|
this.httpErrorHandle.httpStatusHandle(result.error)
|
||||||
|
} else if (result.error instanceof ZodError) {
|
||||||
|
this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.")
|
||||||
|
console.log(result.error.errors)
|
||||||
|
} else {
|
||||||
|
this.toastService._badRequest("Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.")
|
||||||
|
console.log(result.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.showLoader = false
|
||||||
}
|
}
|
||||||
_ionChange(event){
|
_ionChange(event){
|
||||||
this.showDuration = event.detail.checked;
|
this.showDuration = event.detail.checked;
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse }
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ModalController, NavParams } from '@ionic/angular';
|
import { ModalController, NavParams } from '@ionic/angular';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
|
||||||
import { GroupMessagesPage } from '../group-messages.page';
|
|
||||||
import { ThemeService } from 'src/app/services/theme.service'
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
@@ -12,7 +10,12 @@ import { MemberListLocalRepository } from 'src/app/module/chat/data/repository/m
|
|||||||
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
|
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service';
|
||||||
import { ZodError } from 'zod';
|
import { z, ZodError } from 'zod';
|
||||||
|
|
||||||
|
const GroupContactsPageOutPutSchema = z.object({
|
||||||
|
roomId: z.string().optional()
|
||||||
|
})
|
||||||
|
export type IGroupContactsPageOutPutSchema = z.infer<typeof GroupContactsPageOutPutSchema>
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="div-title">
|
<div class="div-title">
|
||||||
<!-- MOBILE -->
|
<!-- MOBILE -->
|
||||||
<ion-label class="title">Nova Conversa ..</ion-label>
|
<ion-label class="title">Nova Conversa</ion-label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<fa-icon (click)="deleteMessage(selectedMsgId)" icon="trash" class="middle-container-options-icons"></fa-icon>
|
<fa-icon (click)="deleteMessage(selectedMsgId)" icon="trash" class="middle-container-options-icons"></fa-icon>
|
||||||
<!-- <ion-icon name="trash"></ion-icon> -->
|
<!-- <ion-icon name="trash"></ion-icon> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="right" *ngIf="roomType == RoomTypeEnum.Group">
|
<div class="right" *ngIf="RoomStore.room.roomType == RoomTypeEnum.Group">
|
||||||
<button class="btn-no-color" (click)="openMessagesOptions()">
|
<button class="btn-no-color" (click)="openMessagesOptions()">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-bottom">
|
<div class="header-bottom d-flex">
|
||||||
<div class="header-bottom-icon" *ngIf="roomType == RoomTypeEnum.Group">
|
<div class="header-bottom-icon" *ngIf="RoomStore.room.roomType == RoomTypeEnum.Group">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/icon/icons-user.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/icon/icons-user.svg"></ion-icon>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/icon/theme/gov/icons-user.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/icon/theme/gov/icons-user.svg"></ion-icon>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
|||||||
import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service';
|
import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service';
|
||||||
import { RoomViewModel } from '../../store/model/room';
|
import { RoomViewModel } from '../../store/model/room';
|
||||||
import { RoomStore } from '../../store/roomStore'
|
import { RoomStore } from '../../store/roomStore'
|
||||||
|
import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-messages/group-contacts/group-contacts.page';
|
||||||
|
import { EditGroupPage } from '../edit-group/edit-group.page';
|
||||||
|
|
||||||
const IMAGE_DIR = 'stored-images';
|
const IMAGE_DIR = 'stored-images';
|
||||||
|
|
||||||
@@ -101,7 +103,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
selectedMessage: any = null;
|
selectedMessage: any = null;
|
||||||
emojis: string[] = ['😊', '😂', '❤️', '👍', '😢']; // Add more emojis as needed
|
emojis: string[] = ['😊', '😂', '❤️', '👍', '😢']; // Add more emojis as needed
|
||||||
textField = ''
|
textField = ''
|
||||||
roomType!: RoomType
|
|
||||||
|
|
||||||
MessageAttachmentFileType = MessageAttachmentFileType
|
MessageAttachmentFileType = MessageAttachmentFileType
|
||||||
MessageAttachmentFileSource = MessageAttachmentSource
|
MessageAttachmentFileSource = MessageAttachmentSource
|
||||||
@@ -140,6 +141,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.RoomStore.start(this.room)
|
this.RoomStore.start(this.room)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@HostListener('document:click', ['$event'])
|
@HostListener('document:click', ['$event'])
|
||||||
handleClickOutside(event: Event) {
|
handleClickOutside(event: Event) {
|
||||||
if (!this.handleClickActive) return;
|
if (!this.handleClickActive) return;
|
||||||
@@ -360,6 +362,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
this.RoomStore.stop()
|
||||||
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
window.removeEventListener('scroll', this.scrollChangeCallback, true);
|
||||||
this.handleClickActive = false; // Disable the listener before component destruction
|
this.handleClickActive = false; // Disable the listener before component destruction
|
||||||
}
|
}
|
||||||
@@ -512,29 +515,73 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
roomId: this.room.id,
|
roomId: this.room.id,
|
||||||
members: [],
|
members: [],
|
||||||
isAdmin: this.RoomStore.isAdmin,
|
isAdmin: this.RoomStore.isAdmin,
|
||||||
roomType: this.roomType
|
roomType: this.RoomStore.room.roomType
|
||||||
},
|
},
|
||||||
cssClass: 'messages-options',
|
cssClass: 'messages-options',
|
||||||
event: ev,
|
event: ev,
|
||||||
translucent: true,
|
translucent: true,
|
||||||
});
|
});
|
||||||
return await popover.present();
|
await popover.present();
|
||||||
|
popover.onDidDismiss().then(res => {
|
||||||
|
|
||||||
|
if (res.data == 'leave') {
|
||||||
|
this.modalController.dismiss()
|
||||||
|
}
|
||||||
|
else if (res.data == 'delete') {
|
||||||
|
this.modalController.dismiss()
|
||||||
|
}
|
||||||
|
else if (res.data == 'cancel') {
|
||||||
|
this.modalController.dismiss()
|
||||||
|
}
|
||||||
|
else if (res.data == 'edit') {
|
||||||
|
|
||||||
|
//this.closeAllDesktopComponents.emit();
|
||||||
|
this.editGroup()
|
||||||
|
} else if (res.data == 'addUser') {
|
||||||
|
|
||||||
|
this.addContacts();
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async addContacts() {
|
async addContacts() {
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: ContactsPage,
|
component: GroupContactsPage,
|
||||||
componentProps: {},
|
componentProps: {
|
||||||
|
roomId: this.RoomStore.room.id,
|
||||||
|
},
|
||||||
cssClass: 'contacts',
|
cssClass: 'contacts',
|
||||||
backdropDismiss: false
|
backdropDismiss: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
modal.onDidDismiss<IGroupContactsPageOutPutSchema>().then(result => {
|
||||||
|
|
||||||
modal.onDidDismiss();
|
// this.modalController.dismiss({roomId})
|
||||||
|
|
||||||
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async editGroup() {
|
||||||
|
const modal = await this.modalController.create({
|
||||||
|
component: EditGroupPage,
|
||||||
|
cssClass: 'modal modal-desktop',
|
||||||
|
componentProps: {
|
||||||
|
roomId: this.RoomStore.room.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await modal.present();
|
||||||
|
modal.onDidDismiss().then((res) => {
|
||||||
|
|
||||||
|
this.RoomStore.updateRoomDetails()
|
||||||
|
// this.getRoomInfo();
|
||||||
|
//this.modalController.dismiss(res.data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async onImageError() {}
|
async onImageError() {}
|
||||||
async onImageLoad(message: MessageViewModal, index:number) {
|
async onImageLoad(message: MessageViewModal, index:number) {
|
||||||
@@ -717,7 +764,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
const fileName = file.value.name
|
const fileName = file.value.name
|
||||||
|
|
||||||
const validation = await allowedDocExtension(fileName)
|
const validation = await allowedDocExtension(file.value.type)
|
||||||
|
|
||||||
if (validation.isOk()) {
|
if (validation.isOk()) {
|
||||||
|
|
||||||
@@ -730,12 +777,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
fileName: file.value.name,
|
fileName: file.value.name,
|
||||||
source: MessageAttachmentSource.Device,
|
source: MessageAttachmentSource.Device,
|
||||||
fileType: MessageAttachmentFileType.Doc,
|
fileType: MessageAttachmentFileType.Doc,
|
||||||
mimeType: file.value.type
|
mimeType: file.value.type,
|
||||||
|
description: file.value.name
|
||||||
}])
|
}])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
console.log({fileName})
|
||||||
this.toastService._badRequest("Ficheiro inválido")
|
this.toastService._badRequest("Ficheiro inválido")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -904,7 +953,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
modal.present();
|
modal.present();
|
||||||
} else {
|
} else {
|
||||||
this.openFile(msg.attachments[0].safeFile, msg.attachments[0].description, msg.attachments[0].mimeType);
|
this.openFile(msg.attachments[0].safeFile, msg.attachments[0].fileName || msg.attachments[0].description, msg.attachments[0].mimeType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
|
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
|
||||||
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
|
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
|
||||||
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
|
import { GroupContactsPage, IGroupContactsPageOutPutSchema } from '../group-messages/group-contacts/group-contacts.page';
|
||||||
import { ThemeService } from 'src/app/services/theme.service';
|
import { ThemeService } from 'src/app/services/theme.service';
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
@@ -9,8 +9,14 @@ import { catchError } from 'rxjs/operators';
|
|||||||
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
||||||
import { UDate } from 'src/app/utils/date';
|
import { UDate } from 'src/app/utils/date';
|
||||||
import { HttpErrorResponse } from '@angular/common/http';
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
|
||||||
|
const NewGroupModalOutPutSchema = z.object({
|
||||||
|
roomId: z.string().optional()
|
||||||
|
})
|
||||||
|
export type INewGroupModalOutPut = z.infer<typeof NewGroupModalOutPutSchema>
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-new-group',
|
selector: 'app-new-group',
|
||||||
templateUrl: './new-group.page.html',
|
templateUrl: './new-group.page.html',
|
||||||
@@ -82,12 +88,10 @@ export class NewGroupPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
async addContacts(roomId) {
|
async addContacts(roomId:string) {
|
||||||
this.close();
|
|
||||||
|
|
||||||
let name = this.groupName.split(' ').join('-');
|
let name = this.groupName.split(' ').join('-');
|
||||||
|
|
||||||
|
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: GroupContactsPage,
|
component: GroupContactsPage,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -98,7 +102,11 @@ export class NewGroupPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
modal.onDidDismiss();
|
modal.onDidDismiss<IGroupContactsPageOutPutSchema>().then(result => {
|
||||||
|
|
||||||
|
this.modalController.dismiss({roomId})
|
||||||
|
|
||||||
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<div class="d-flex justify-content-between">
|
||||||
<ion-title class="title" *ngIf="roomData$ | async as roomData"> {{ roomData.roomName }}</ion-title>
|
<ion-toolbar>
|
||||||
</ion-toolbar>
|
<ion-title class="title" *ngIf="roomData$ | async as roomData"> {{ roomData.roomName }}</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
<div class="btn-close d-flex cursor-pointer pr-20" >
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon"
|
||||||
|
src="assets/images/icons-search-close.svg"></ion-icon>
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon"
|
||||||
|
src="assets/images/theme/gov/icons-search-close.svg"></ion-icon>
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="icon"
|
||||||
|
src="assets/images/theme/{{ThemeService.currentTheme}}/icons-search-close.svg"></ion-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content class="px-20">
|
<ion-content class="px-20">
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { RoomTable } from 'src/app/infra/database/dexie/instance/chat/schema/roo
|
|||||||
import { map, tap } from 'rxjs/operators';
|
import { map, tap } from 'rxjs/operators';
|
||||||
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
||||||
import { MemberEntity } from 'src/app/core/chat/entity/member';
|
import { MemberEntity } from 'src/app/core/chat/entity/member';
|
||||||
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-room-info',
|
selector: 'app-room-info',
|
||||||
templateUrl: './room-info.page.html',
|
templateUrl: './room-info.page.html',
|
||||||
@@ -23,7 +25,8 @@ export class RoomInfoPage implements OnInit {
|
|||||||
private navParams: NavParams,
|
private navParams: NavParams,
|
||||||
private MemberListLocalRepository: MemberListLocalRepository,
|
private MemberListLocalRepository: MemberListLocalRepository,
|
||||||
private RoomLocalRepository: RoomLocalRepository,
|
private RoomLocalRepository: RoomLocalRepository,
|
||||||
private ChatServiceService: ChatServiceService
|
private ChatServiceService: ChatServiceService,
|
||||||
|
public ThemeService: ThemeService,
|
||||||
) {
|
) {
|
||||||
this.roomId = this.navParams.get('roomId');
|
this.roomId = this.navParams.get('roomId');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<div *virtualItem="let user" class="item-checkbox">
|
<div *virtualItem="let user" class="item-checkbox">
|
||||||
<div class="cursor-pointer d-flex width-100" (click)="setRoomOwner(user)" (ionChange)="setRoomOwner(user)">
|
<div class="cursor-pointer d-flex width-100" (click)="setRoomOwner(user)" (ionChange)="setRoomOwner(user)">
|
||||||
<p class="flex-1">{{user.wxFullName}}</p>
|
<p class="flex-1">{{user.wxFullName}}</p>
|
||||||
<ion-icon slot="end" class="{{user.status}}" name="ellipse"></ion-icon>
|
<!-- <ion-icon slot="end" class="{{user.status}}" name="ellipse"></ion-icon> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ export class RoomStore {
|
|||||||
messageTypingSubject: Subscription
|
messageTypingSubject: Subscription
|
||||||
messageOnReconnectSubject: Subscription
|
messageOnReconnectSubject: Subscription
|
||||||
messageOnSetRoomId: Subscription
|
messageOnSetRoomId: Subscription
|
||||||
|
messageRoomData: Subscription
|
||||||
newMessagesStream!: Subscription
|
newMessagesStream!: Subscription
|
||||||
|
|
||||||
roomData$: Observable<RoomTable | undefined>
|
|
||||||
roomStatus$: DexieObservable<Boolean >
|
roomStatus$: DexieObservable<Boolean >
|
||||||
roomMessage$: DexieObservable<MessageTable[]>
|
roomMessage$: DexieObservable<MessageTable[]>
|
||||||
roomMembers$: Observable<MemberTable[] | undefined>
|
roomMembers$: Observable<MemberTable[] | undefined>
|
||||||
@@ -71,10 +71,41 @@ export class RoomStore {
|
|||||||
} else {
|
} else {
|
||||||
await this.getMessages()
|
await this.getMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.messageRoomData?.unsubscribe();
|
||||||
|
|
||||||
|
this.messageRoomData = this.RoomLocalRepository.getRoomByIdLive(this.room.$id).subscribe(e => {
|
||||||
|
if(e) {
|
||||||
|
this.room = new RoomViewModel(e)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.messageOnSetRoomId?.unsubscribe()
|
||||||
|
|
||||||
|
if(this.room.local == IDBoolean.true) {
|
||||||
|
this.messageOnSetRoomId = this.chatServiceService.roomDirectOnSetId({$roomId: this.room.$id}).subscribe((data) => {
|
||||||
|
this.messageOnSetRoomId?.unsubscribe()
|
||||||
|
|
||||||
|
this.room = new RoomViewModel(data)
|
||||||
|
|
||||||
|
const hasMyMessage = this.messages1[this.room.$id].find(e => e.sender.wxUserId == SessionStore.user.UserId)
|
||||||
|
|
||||||
|
if(!hasMyMessage) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.getMessages()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.subscribeToChanges()
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
this.messageReceiveSubject?.unsubscribe();
|
|
||||||
this.messageReceiveSubject?.unsubscribe();
|
this.messageReceiveSubject?.unsubscribe();
|
||||||
this.messageDeleteSubject?.unsubscribe();
|
this.messageDeleteSubject?.unsubscribe();
|
||||||
this.messageUpdateSubject?.unsubscribe();
|
this.messageUpdateSubject?.unsubscribe();
|
||||||
@@ -194,6 +225,8 @@ export class RoomStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendReadMessage()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
export let versionData = {
|
export let versionData = {
|
||||||
"shortSHA": "9e7a8b6cb",
|
"shortSHA": "1f08eb551",
|
||||||
"SHA": "9e7a8b6cb6c099d0b1d828ea61aea1bb4599830e",
|
"SHA": "1f08eb5514d617f4e0dbe6e691d740a883c869d0",
|
||||||
"branch": "feature/chat-new-api-peter",
|
"branch": "feature/chat-new-api-peter",
|
||||||
"lastCommitAuthor": "'Peter Maquiran'",
|
"lastCommitAuthor": "'Peter Maquiran'",
|
||||||
"lastCommitTime": "'Wed Sep 18 19:13:59 2024 +0100'",
|
"lastCommitTime": "'Thu Sep 19 09:16:14 2024 +0100'",
|
||||||
"lastCommitMessage": "fix error",
|
"lastCommitMessage": "mobile create grupo and contact",
|
||||||
"lastCommitNumber": "6083",
|
"lastCommitNumber": "6084",
|
||||||
"changeStatus": "On branch feature/chat-new-api-peter\nYour branch is up to date with 'origin/feature/chat-new-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/ui/chat/modal/messages/messages.page.html\n\tmodified: src/app/ui/chat/modal/messages/messages.page.ts\n\tmodified: src/app/ui/chat/modal/new-group/new-group.page.ts\n\tmodified: version/git-version.ts",
|
"changeStatus": "On branch feature/chat-new-api-peter\nYour branch is ahead of 'origin/feature/chat-new-api-peter' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/infra/file-system/mobile/file-system-mobile.service.ts\n\tmodified: src/app/module/chat/domain/use-case/room/room-update-name-sync.service.ts\n\tmodified: src/app/ui/chat/chat.page.ts\n\tmodified: src/app/ui/chat/component/messages/messages.page.html\n\tmodified: src/app/ui/chat/component/messages/messages.page.ts\n\tmodified: src/app/ui/chat/modal/chat-popover/chat-popover.page.scss\n\tmodified: src/app/ui/chat/modal/edit-group/edit-group.page.html\n\tmodified: src/app/ui/chat/modal/edit-group/edit-group.page.ts\n\tmodified: src/app/ui/chat/modal/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/ui/chat/modal/messages/contacts/contacts.page.html\n\tmodified: src/app/ui/chat/modal/messages/messages.page.html\n\tmodified: src/app/ui/chat/modal/messages/messages.page.ts\n\tmodified: src/app/ui/chat/modal/new-group/new-group.page.ts\n\tmodified: src/app/ui/chat/modal/room-info/room-info.page.html\n\tmodified: src/app/ui/chat/modal/room-info/room-info.page.ts\n\tmodified: src/app/ui/chat/modal/set-room-owner/set-room-owner.page.html\n\tmodified: src/app/ui/chat/store/roomStore.ts",
|
||||||
"changeAuthor": "peter.maquiran"
|
"changeAuthor": "peter.maquiran"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user