unclean SPARC
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
'use strict'
|
||||
/**
|
||||
* @category MyEic
|
||||
* @subcategory Libraries
|
||||
*/
|
||||
class MBRendezVous {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} appctrl
|
||||
*/
|
||||
constructor(appctrl){
|
||||
if(!app.MessageBus) return
|
||||
this.activeMeetChans = {}
|
||||
this.myUserNotifChan = app.config.messageBus.userNotifChan.replace(/\{uid\}/g, app.User.identity.uuid)
|
||||
app.MessageBus.addBusListener(
|
||||
'rendezVous',
|
||||
[ this.myUserNotifChan ],
|
||||
this.onRendezVousRequest.bind(this)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} chan
|
||||
* @param {*} payload
|
||||
* @param {*} sender
|
||||
*/
|
||||
async onRendezVousRequest(chan, payload, sender){
|
||||
if(! await this.userConfirmation(sender, payload.userMessage)) return
|
||||
let rdvzchan = payload.chanPrefix + crypto.randomUUID()
|
||||
//this.activeMeetChans[] = chan
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} sender
|
||||
* @param {*} userMessage
|
||||
*/
|
||||
async userConfirmation(sender, userMessage){
|
||||
let options = {
|
||||
title: 'Connexion request',
|
||||
message: `<p>The user <b>${sender}</b> invites you to ${userMessage}.</p>
|
||||
`,
|
||||
cancelLabel: 'Refuse',
|
||||
okLabel: 'Accept',
|
||||
severity: 'danger',
|
||||
okPromise: () => new Promise((ok,ko)=>ok())
|
||||
}
|
||||
await this.mainCtrl.loadContent('templates/dialogs/ConfirmDialog', options, options)
|
||||
/*
|
||||
let result = await this.mainView.confirmDialog({
|
||||
title: 'Connexion request',
|
||||
message: `<p>The user <b>${sender}</b> invites you to ${userMessage}.</p>
|
||||
`,
|
||||
cancelLabel: 'Refuse',
|
||||
okLabel: 'Accept',
|
||||
severity: 'danger',
|
||||
okPromise: () => new Promise((ok,ko)=>ok())
|
||||
})
|
||||
|
||||
if(result) {
|
||||
console.log('you said YES')
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} hisUid
|
||||
* @param {*} userMessage
|
||||
* @param {*} timeout
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getRendezVousChan(hisUid, userMessage, timeout){
|
||||
if(!app.MessageBus) return(
|
||||
|
||||
new Promise((resolve, reject) => reject('Cannot rendez-vous without messageBus !'))
|
||||
)
|
||||
|
||||
return(
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.registerClass('MBRendezVous', MBRendezVous);
|
||||
Reference in New Issue
Block a user