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