Skip to main content

Reload Portals with Live Updates

When new Portal web content is downloaded from Appflow using Live Updates, the Portal will need to be reloaded before the app user sees the updated content. The default behavior of the Portals library is to continue displaying the existing web content to the user until the view is reloaded by the user. A Portal can be reloaded with code if you want the user to view the new content sooner.


Consider that a user may be in the middle of doing work inside the Portal as new web content is downlaoded through Live Updates and reloading the Portal may interrupt them.

The following examples show how an active Portal could be reloaded after a Live Update has finished downloading.

// Placed in an iOS View Controlleroverride fun viewDidLoad() {  // Get the current portal webview  let portalWebView = MyViewController.getPortalWebview()
  LiveUpdateManager.checkForUpdate(appId, channel) { checkResponse in    // code will only be called if there is an update available    LiveUpdateManager.sync(callbacks: MyLiveUpdateCallbacks())  }
// ...
private class MyLiveUpdateCallbacks: ISyncCallback {  private let portalWebView: PortalWebView
  init(_ portalWebView: PortalWebView) { self.portalWebView = portalWebView }  func onAppComplete() { print("App Complete!") }  func onSyncComplete() {    print("Sync complete! Reloading Portal")    portalWebView.reload()  }}