when I declare dialog var outside codePush.sync , dialog gets initialized. and it works
but,
user see dialog open without any action or callback
my second try:
async function createDialog(received,total){
this.received = received;
this.total = total;
var dialog = await app.dialog.progress("Downloading", 0);
return dialog;
}
...
//inside codePush.sync() callback
function downloadProgress(downloadProgress){
if(downloadProgress){
var received = downloadProgress.receivedBytes;
var total = downloadProgress.totalBytes;
createDialog.call(this,received,total).then((dialog)=>{
// getting dialog here !!!!
dialog.setProgress((received * 100) / total); // do not set progress
dialog.setText("Setting you up " + Math.trunc((received * 100) / total) + "%"); // do not set text
})
}
else {
app.dialog.close();}
}
It will be helpful, if anyone tell me how can we return received and total with dialog obj that we can receive those two params in .then callback