在自定义 DirectUpdate 之后调用 WL.Client.invokeProcedure
Call WL.Client.invokeProcedure after custom DirectUpdate
我遇到了与 MobileFirst Direct update customization using adapter 类似的问题
但我没有使用适配器来修改 DirectUpdate,我试图在 DirectUpdate 完成时记录它的状态,但似乎对适配器的调用不起作用。 DirectUpdate 完成后在 main.js 上调用 WL.Client.invokeProcedure 有任何限制吗?
更新,我的源代码:
/**
* Busy indicator
*/
var busyInd;
/**
* Custom listener for MobileFirst DirectUpdate
*/
var directUpdateCustomListener = {
/**
* Call when DirectUpdate starts
* @param totalSize
*/
onStart: function(totalSize){
console.log(JSON.stringify(totalSize));
busyInd = new WL.BusyIndicator("ion-side-menu-content", {text: MENSAJE_DIRECT_UPDATE});
busyInd.show();
},
/**
* Call on every DirectUpdate step
* @param status
* @param totalSize
* @param completedSize
*/
onProgress: function(status,totalSize,completedSize){
console.log('DirectUpdate-'+status+': -------- -------- ---------- ------------- PROGRESS: '+completedSize+' of '+totalSize);
},
/**
* Call when DirectUpdate finish
* @param status Status of the finished DirectUpdate
*/
onFinish: function(status){
console.log(JSON.stringify(status));
busyInd.hide();
var options = {
onSuccess: success,
onFailure: fail
};
function success(data) {
var dataDirectUpdate = new Object();
dataDirectUpdate.device = data.deviceID;
dataDirectUpdate.version = window.device.version;
dataDirectUpdate.model = window.device.model;
dataDirectUpdate.platform = window.device.platform;
dataDirectUpdate.appVersion = WL.Client.getAppProperty(WL.AppProperty.APP_VERSION);
dataDirectUpdate.status = status;
console.log(JSON.stringify(dataDirectUpdate));
var invocationData = {
adapter:"OracleAdapter",
procedure:"directUpdateData",
parameters: [dataDirectUpdate]
};
function ProcSuccess(dataSuccess) {
console.log('insert OK'+JSON.stringify(dataSuccess));
if (status == 'SUCCESS'){
WL.SimpleDialog.show('Title', 'Success',
[{
text : 'OK',
handler : function() {
WL.Client.reloadApp();
}
}]
);
}
else {
WL.SimpleDialog.show(TITULO_DIRECT_UPDATE, ERROR_DIRECT_UPDATE,
[{
text : 'OK',
handler : function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]
);
}
}
function ProcFail() {
console.log('insert fail');
WL.SimpleDialog.show(TITULO_DIRECT_UPDATE, ERROR_DIRECT_UPDATE,
[{
text : 'OK',
handler : function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]
);
}
WL.Client.connect({
onSuccess: function(){
WL.Client.invokeProcedure(invocationData, {
onSuccess: ProcSuccess,
onFailure: ProcFail
});
},
onFailure: ProcFail
});
}
function fail() {
WL.SimpleDialog.show('Title', 'Error',
[{
text : 'OK',
handler : function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]
);
}
WL.Device.getID(options);
}
};
/**
* Handler override to control MobileFirst DirectUpdate
* @param directUpdateData Data from the DirectUpdate
* @param directUpdateContext Java Object with context of the DirectUpdate
*/
wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData,directUpdateContext) {
// custom WL.SimpleDialog for Direct Update
console.log(JSON.stringify(directUpdateData));
WL.SimpleDialog.show('Title', 'Question',
[{
text : 'OK',
handler : function() {
directUpdateContext.start(directUpdateCustomListener);
// Additional code here.
}
},
{
text : 'NO',
handler : function() {
//wl_directUpdateChallengeHandler.submitFailure();
// Additional code here.
}
}]
);
};
已确认,按照我尝试的方式无法做到这一点。
感谢 Idan Adar 尝试帮助我。
我遇到了与 MobileFirst Direct update customization using adapter 类似的问题 但我没有使用适配器来修改 DirectUpdate,我试图在 DirectUpdate 完成时记录它的状态,但似乎对适配器的调用不起作用。 DirectUpdate 完成后在 main.js 上调用 WL.Client.invokeProcedure 有任何限制吗?
更新,我的源代码:
/**
* Busy indicator
*/
var busyInd;
/**
* Custom listener for MobileFirst DirectUpdate
*/
var directUpdateCustomListener = {
/**
* Call when DirectUpdate starts
* @param totalSize
*/
onStart: function(totalSize){
console.log(JSON.stringify(totalSize));
busyInd = new WL.BusyIndicator("ion-side-menu-content", {text: MENSAJE_DIRECT_UPDATE});
busyInd.show();
},
/**
* Call on every DirectUpdate step
* @param status
* @param totalSize
* @param completedSize
*/
onProgress: function(status,totalSize,completedSize){
console.log('DirectUpdate-'+status+': -------- -------- ---------- ------------- PROGRESS: '+completedSize+' of '+totalSize);
},
/**
* Call when DirectUpdate finish
* @param status Status of the finished DirectUpdate
*/
onFinish: function(status){
console.log(JSON.stringify(status));
busyInd.hide();
var options = {
onSuccess: success,
onFailure: fail
};
function success(data) {
var dataDirectUpdate = new Object();
dataDirectUpdate.device = data.deviceID;
dataDirectUpdate.version = window.device.version;
dataDirectUpdate.model = window.device.model;
dataDirectUpdate.platform = window.device.platform;
dataDirectUpdate.appVersion = WL.Client.getAppProperty(WL.AppProperty.APP_VERSION);
dataDirectUpdate.status = status;
console.log(JSON.stringify(dataDirectUpdate));
var invocationData = {
adapter:"OracleAdapter",
procedure:"directUpdateData",
parameters: [dataDirectUpdate]
};
function ProcSuccess(dataSuccess) {
console.log('insert OK'+JSON.stringify(dataSuccess));
if (status == 'SUCCESS'){
WL.SimpleDialog.show('Title', 'Success',
[{
text : 'OK',
handler : function() {
WL.Client.reloadApp();
}
}]
);
}
else {
WL.SimpleDialog.show(TITULO_DIRECT_UPDATE, ERROR_DIRECT_UPDATE,
[{
text : 'OK',
handler : function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]
);
}
}
function ProcFail() {
console.log('insert fail');
WL.SimpleDialog.show(TITULO_DIRECT_UPDATE, ERROR_DIRECT_UPDATE,
[{
text : 'OK',
handler : function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]
);
}
WL.Client.connect({
onSuccess: function(){
WL.Client.invokeProcedure(invocationData, {
onSuccess: ProcSuccess,
onFailure: ProcFail
});
},
onFailure: ProcFail
});
}
function fail() {
WL.SimpleDialog.show('Title', 'Error',
[{
text : 'OK',
handler : function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]
);
}
WL.Device.getID(options);
}
};
/**
* Handler override to control MobileFirst DirectUpdate
* @param directUpdateData Data from the DirectUpdate
* @param directUpdateContext Java Object with context of the DirectUpdate
*/
wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData,directUpdateContext) {
// custom WL.SimpleDialog for Direct Update
console.log(JSON.stringify(directUpdateData));
WL.SimpleDialog.show('Title', 'Question',
[{
text : 'OK',
handler : function() {
directUpdateContext.start(directUpdateCustomListener);
// Additional code here.
}
},
{
text : 'NO',
handler : function() {
//wl_directUpdateChallengeHandler.submitFailure();
// Additional code here.
}
}]
);
};
已确认,按照我尝试的方式无法做到这一点。 感谢 Idan Adar 尝试帮助我。