mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix open group
This commit is contained in:
@@ -390,7 +390,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 43;
|
||||
CURRENT_PROJECT_VERSION = 45;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
@@ -419,7 +419,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 43;
|
||||
CURRENT_PROJECT_VERSION = 45;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
|
||||
@@ -13,14 +13,14 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
styleUrls: ['./new-group.page.scss'],
|
||||
})
|
||||
export class NewGroupPage implements OnInit {
|
||||
isGroupCreated:boolean;
|
||||
isGroupCreated: boolean;
|
||||
showLoader: boolean;
|
||||
displayDuration: any;
|
||||
showDuration: boolean;
|
||||
selectedDuration = ['','',''];
|
||||
thedate:any;
|
||||
groupName:string;
|
||||
documents:any;
|
||||
selectedDuration = ['', '', ''];
|
||||
thedate: any;
|
||||
groupName: string;
|
||||
documents: any;
|
||||
loggedUserChat: any;
|
||||
|
||||
constructor(
|
||||
@@ -46,7 +46,7 @@ export class NewGroupPage implements OnInit {
|
||||
_ionChange(event) {
|
||||
this.showDuration = event.detail.checked;
|
||||
|
||||
if(event.detail.checked) {
|
||||
if (event.detail.checked) {
|
||||
this.thedate = new Date();
|
||||
}
|
||||
else {
|
||||
@@ -57,28 +57,28 @@ export class NewGroupPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async createGroup(){
|
||||
async createGroup() {
|
||||
|
||||
let name = this.groupName.split(' ').join('-');
|
||||
//Take out all special characters in string
|
||||
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||
|
||||
let customFields = {}
|
||||
let res:any;
|
||||
let res: any;
|
||||
|
||||
if(this.thedate) {
|
||||
if (this.thedate) {
|
||||
let customFields = {
|
||||
"countDownDate": this.thedate
|
||||
}
|
||||
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
|
||||
}
|
||||
|
||||
this.isGroupCreated = true;
|
||||
this.addContacts(res.result);
|
||||
this.ChatSystemService.getAllRooms();
|
||||
this.ChatSystemService.getRoom([res.result]);
|
||||
|
||||
setTimeout(() => {
|
||||
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
@@ -86,13 +86,13 @@ export class NewGroupPage implements OnInit {
|
||||
|
||||
|
||||
|
||||
if(res?.result?.rid) {
|
||||
if (res?.result?.rid) {
|
||||
|
||||
this.ChatSystemService.getAllRooms(() => {
|
||||
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
} else {
|
||||
setTimeout(()=> {
|
||||
setTimeout(() => {
|
||||
|
||||
this.createGroupWithAttachments(res)
|
||||
|
||||
@@ -112,8 +112,8 @@ export class NewGroupPage implements OnInit {
|
||||
|
||||
|
||||
createGroupWithAttachmentsCath(res: any) {
|
||||
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
setTimeout(()=>{
|
||||
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
setTimeout(() => {
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
}, 1500)
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ export class NewGroupPage implements OnInit {
|
||||
createGroupWithAttachments(res: any) {
|
||||
this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
|
||||
|
||||
if(this.documents) {
|
||||
if (this.documents) {
|
||||
this.documents.forEach(element => {
|
||||
this.ChatSystemService.getGroupRoom(res.result.rid).send({
|
||||
file: {
|
||||
@@ -196,62 +196,62 @@ export class NewGroupPage implements OnInit {
|
||||
const picker = await this.pickerController.create({
|
||||
cssClass: '',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancelar', role: 'cancel', cssClass: 'btn-cancel'
|
||||
},
|
||||
{
|
||||
text: 'Ok',
|
||||
cssClass: 'btn-cancel',
|
||||
handler:(value:any) => {
|
||||
{
|
||||
text: 'Cancelar', role: 'cancel', cssClass: 'btn-cancel'
|
||||
},
|
||||
{
|
||||
text: 'Ok',
|
||||
cssClass: 'btn-cancel',
|
||||
handler: (value: any) => {
|
||||
|
||||
let now = new Date();
|
||||
this.thedate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds());
|
||||
let now = new Date();
|
||||
this.thedate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds());
|
||||
|
||||
this.selectedDuration = [
|
||||
value.days.value,
|
||||
value.hours.value,
|
||||
value.minutes.value,
|
||||
]
|
||||
this.selectedDuration = [
|
||||
value.days.value,
|
||||
value.hours.value,
|
||||
value.minutes.value,
|
||||
]
|
||||
|
||||
if(value.days.value != null && value.hours.value != null && value.minutes.value != null){
|
||||
if(value.days.value > 0) {
|
||||
if(value.days.value == 1) {
|
||||
if(value.hours.value == 1) {
|
||||
this.displayDuration = value.days.value + " day " +
|
||||
if (value.days.value != null && value.hours.value != null && value.minutes.value != null) {
|
||||
if (value.days.value > 0) {
|
||||
if (value.days.value == 1) {
|
||||
if (value.hours.value == 1) {
|
||||
this.displayDuration = value.days.value + " day " +
|
||||
value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
else{
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(value.hours.value == 1){
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
else{
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
else {
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(value.hours.value == 1){
|
||||
this.displayDuration = value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
else {
|
||||
if (value.hours.value == 1) {
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
else{
|
||||
this.displayDuration = value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
else {
|
||||
this.displayDuration = value.days.value + " days " +
|
||||
value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
else {
|
||||
if (value.hours.value == 1) {
|
||||
this.displayDuration = value.hours.value + " hora " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
else {
|
||||
this.displayDuration = value.hours.value + " horas " +
|
||||
value.minutes.value + " minutos";
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
columns: [
|
||||
@@ -301,7 +301,7 @@ export class NewGroupPage implements OnInit {
|
||||
]
|
||||
});
|
||||
await picker.present();
|
||||
picker.onDidDismiss().then(async data =>{
|
||||
picker.onDidDismiss().then(async data => {
|
||||
let day = await picker.getColumn('days');
|
||||
let hour = await picker.getColumn('hours');
|
||||
let minutes = await picker.getColumn('minutes');
|
||||
|
||||
@@ -358,6 +358,111 @@ export class ChatSystemService {
|
||||
this.onRoomsLoad.executor()
|
||||
}
|
||||
|
||||
|
||||
async getRoom(_rooms: any) {
|
||||
this.loadingWholeList = true
|
||||
|
||||
|
||||
let index = 0
|
||||
|
||||
if (_rooms) {
|
||||
|
||||
_rooms = _rooms.map(e => {
|
||||
e["_updatedAt"] = e._updatedAt || e._updatedAt['$date']
|
||||
return e
|
||||
})
|
||||
|
||||
for (let roomData of this.sortArrayISODate(_rooms)) {
|
||||
|
||||
|
||||
const roomId = this.getRoomId(roomData);
|
||||
|
||||
if (roomData.t == 'd') {
|
||||
|
||||
let error = false
|
||||
let res;
|
||||
|
||||
try {
|
||||
res = await this.chatService.getMembers(roomId).toPromise();
|
||||
} catch (e) {
|
||||
await this.chatService.refreshtoken();
|
||||
error = true
|
||||
}
|
||||
|
||||
if (error) {
|
||||
res = await this.chatService.getMembers(roomId).toPromise();
|
||||
}
|
||||
|
||||
|
||||
const members = res['members'];
|
||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
||||
_rooms[index]['members'] = members
|
||||
_rooms[index]['membersExcludeMe'] = users
|
||||
|
||||
await this.prepareRoom(roomData);
|
||||
} else {
|
||||
if (roomData.t === 'p') {
|
||||
let error = false
|
||||
let res;
|
||||
|
||||
try {
|
||||
res = await this.chatService.getGroupMembers(roomId).toPromise()
|
||||
} catch (e) {
|
||||
await this.chatService.refreshtoken();
|
||||
error = true
|
||||
}
|
||||
|
||||
if (error) {
|
||||
res = await this.chatService.getGroupMembers(roomId).toPromise()
|
||||
}
|
||||
|
||||
const members = res['members'];
|
||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
||||
|
||||
_rooms[index]['members'] = members
|
||||
_rooms[index]['membersExcludeMe'] = users
|
||||
|
||||
await this.prepareRoom(roomData);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
let error = false
|
||||
let res;
|
||||
|
||||
try {
|
||||
res = await this.chatService.getChannelMembers(roomId).toPromise()
|
||||
|
||||
} catch (e) {
|
||||
await this.chatService.refreshtoken();
|
||||
error = true
|
||||
}
|
||||
|
||||
if (error) {
|
||||
res = await this.chatService.getChannelMembers(roomId).toPromise()
|
||||
}
|
||||
|
||||
|
||||
const members = res['members'];
|
||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
||||
|
||||
_rooms[index]['members'] = members
|
||||
_rooms[index]['membersExcludeMe'] = users
|
||||
await this.prepareRoom(roomData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
this.loadingWholeList = false
|
||||
this.sortRoomList()
|
||||
|
||||
this.onRoomsLoad.executor()
|
||||
}
|
||||
|
||||
/**
|
||||
* @description sort room list by last message date
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user