首先通过导航到 IBM Mobile 中的本机页面来处理直接更新
Handling Direct Update with navigation to native page in IBM Mobile first
我正在开发一个项目,其中我需要在 wlCommonInit() 中调用原生页面
function wlCommonInit(){
WL.NativePage.show(nativePageClassName, backFromNativePage, params);
}
我希望我的项目以 persession 模式接收 direct update。因此,为了连接移动优先服务器,我调用了 WL.Client.connect()
function wlCommonInit(){
busyind = new WL.BusyIndicator;
busyind.show();
WL.Client.connect({onSuccess: connectSuccess, onFailure: connectFail});
WL.NativePage.show(nativePageClassName, backFromNativePage, params);
}
此外,我想处理直接更新,所以我添加了所需的代码。
wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData,
directUpdateContext) {
// custom WL.SimpleDialog for Direct Update
var customDialogTitle = 'Custom Title Text';
var customDialogMessage = 'Custom Message Text';
var customButtonText1 = 'Update Application';
var customButtonText2 = 'Not Now';
WL.SimpleDialog.show(customDialogTitle, customDialogMessage, [{
text: customButtonText1,
handler: function() {
directUpdateContext.start(directUpdateCustomListener);
}
}, {
text: customButtonText2,
handler: function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]);
};
var directUpdateCustomListener = {
onStart: function(totalSize) {},
onProgress: function(status, totalSize, completeSize) {},
onFinish: function(status) {
WL.SimpleDialog.show('New Update Available', 'Press reload button to update to new version', [{
text: WL.ClientMessages.reload,
handler: WL.Client.reloadApp
}]);
}
};
Here the problem is, the application is navigating to the native page
before it can go to the direct update handler function when the direct
update is available.
有什么办法可以解决吗?
我认为如果使用 API [WL.Client.checkForDirectUpdate.
你应该怎么做
这样你就可以先检查直接更新——如果有更新就处理,然后执行打开原生页面的函数。
运行的代码是异步的,所以如果你不按照上面的建议,你就无法控制它。
我正在开发一个项目,其中我需要在 wlCommonInit() 中调用原生页面
function wlCommonInit(){
WL.NativePage.show(nativePageClassName, backFromNativePage, params);
}
我希望我的项目以 persession 模式接收 direct update。因此,为了连接移动优先服务器,我调用了 WL.Client.connect()
function wlCommonInit(){
busyind = new WL.BusyIndicator;
busyind.show();
WL.Client.connect({onSuccess: connectSuccess, onFailure: connectFail});
WL.NativePage.show(nativePageClassName, backFromNativePage, params);
}
此外,我想处理直接更新,所以我添加了所需的代码。
wl_directUpdateChallengeHandler.handleDirectUpdate = function(directUpdateData,
directUpdateContext) {
// custom WL.SimpleDialog for Direct Update
var customDialogTitle = 'Custom Title Text';
var customDialogMessage = 'Custom Message Text';
var customButtonText1 = 'Update Application';
var customButtonText2 = 'Not Now';
WL.SimpleDialog.show(customDialogTitle, customDialogMessage, [{
text: customButtonText1,
handler: function() {
directUpdateContext.start(directUpdateCustomListener);
}
}, {
text: customButtonText2,
handler: function() {
wl_directUpdateChallengeHandler.submitFailure();
}
}]);
};
var directUpdateCustomListener = {
onStart: function(totalSize) {},
onProgress: function(status, totalSize, completeSize) {},
onFinish: function(status) {
WL.SimpleDialog.show('New Update Available', 'Press reload button to update to new version', [{
text: WL.ClientMessages.reload,
handler: WL.Client.reloadApp
}]);
}
};
Here the problem is, the application is navigating to the native page before it can go to the direct update handler function when the direct update is available.
有什么办法可以解决吗?
我认为如果使用 API [WL.Client.checkForDirectUpdate.
你应该怎么做这样你就可以先检查直接更新——如果有更新就处理,然后执行打开原生页面的函数。
运行的代码是异步的,所以如果你不按照上面的建议,你就无法控制它。