簡體   English   中英

首先在IBM Mobile中導航到本機頁面來處理直接更新

[英]Handling Direct Update with navigation to native page in IBM Mobile first

我正在開發一個項目,其中需要在wlCommonInit()中調用本機頁面

function wlCommonInit(){
    WL.NativePage.show(nativePageClassName, backFromNativePage, params);
}

我希望我的項目以Persession模式接收直接更新 因此,為了與Mobile First Server連接,我調用了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
      }]);
  }
};

這里的問題是,在有直接更新可用時,應用程序先導航到本機頁面,然后才能進入直接更新處理程序功能。

有什么辦法解決嗎?

我認為如果使用API​​ [WL.Client.checkForDirectUpdate,應該怎么做。

這樣,您將能夠首先檢查直接更新-如果有更新,則進行處理,然后執行打開本機頁面的功能。

正在運行的代碼是異步的,因此如果您不遵循上述建議,則無法控制它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM