++Strette di Mano

This commit is contained in:
Surya Paolo
2023-01-08 02:17:15 +01:00
parent 865e1ad738
commit 4d40efc73a
19 changed files with 309 additions and 186 deletions

View File

@@ -5601,7 +5601,7 @@ export const tools = {
// console.log('OUT', res)
if (res && res.userprofile) {
// console.log('updateMyData')
console.log('updateMyData', res.userprofile)
userStore.my.profile = res.userprofile
if (res.listcircuits) {
@@ -6599,24 +6599,26 @@ export const tools = {
tools.refuseReqGroup($q, username, dest)
} else if (cmd === shared_consts.GROUPSCMD.CANCEL_REQ_GROUP) {
tools.cancelReqGroups($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS) {
tools.removeFromMyFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.BLOCK_USER) {
tools.blockUser($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) {
tools.addToMyFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.REQFRIEND) {
tools.setRequestFriendship($q, username, dest, value)
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS) {
tools.removeFromMyFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.REFUSE_REQ_FRIEND) {
tools.refuseReqFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) {
tools.cancelReqFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.SETHANDSHAKE) {
tools.addToMyHandShake($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.REQHANDSHAKE) {
tools.setRequestHandShake($q, username, dest, value)
} else if (cmd === shared_consts.FRIENDSCMD.REFUSE_REQ_FRIEND) {
tools.refuseReqFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.REMOVE_FROM_MYHANDSHAKE) {
tools.removeFromMyHandShake($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.REFUSE_REQ_HANDSHAKE) {
tools.refuseReqHandShake($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND) {
tools.cancelReqFriends($q, username, dest)
} else if (cmd === shared_consts.FRIENDSCMD.CANCEL_REQ_HANDSHAKE) {
tools.cancelReqHandShake($q, username, dest)
} else if (cmd === shared_consts.CIRCUITCMD.SET) {
@@ -7282,6 +7284,35 @@ export const tools = {
return common
},
// Function to return commonElements
getCommonAllRecord(arr1: any, arr2: any, field: string): any[] {
// @ts-ignore
arr1.sort((a: any, b: any) => (a[field] > b[field]) - (a[field] < b[field])) // Sort both the arrays
// @ts-ignore
arr2.sort((a: any, b: any) => (a[field] > b[field]) - (a[field] < b[field]))
// console.log('arr1', arr1)
// console.log('arr2', arr2)
let common = [] // Array to contain common elements
let i = 0, j = 0 // i points to arr1 and j to arr2
// Break if one of them runs out
while (i < arr1.length && j < arr2.length) {
if (arr1[i][field] == arr2[j][field]) { // If both are same, add it to result
common.push(arr1[i])
i++
j++
} else if (arr1[i][field] < arr2[j][field]) { // Increment the smaller value so that
i++ // it could be matched with the larger
} // element
else {
j++
}
}
return common
},
isTypeByRecMov(rec: IMovVisu) {
let type = costanti.TypeMov.Nessuno