Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): added ServerPath object and building options for setting initial load from portals #6005

Merged
merged 2 commits into from
Oct 19, 2022

Conversation

carlpoole
Copy link
Member

@carlpoole carlpoole commented Oct 18, 2022

Adds a ServerPath object and mechanics for Portals and live updates to load directly instead of after the webview has already loaded. Fixes issue with observable flash or Page Not Found error before content loading.

Will port this to 4.x when upgrading Portals for Cap 4 support.

Example use

var bridgeBuilder = Bridge.Builder(this)
.setInstanceState(savedInstanceState)
.setPlugins(initialPlugins)
.setConfig(config)
.addWebViewListeners(webViewListeners);

if (portal?.liveUpdateConfig != null) {
liveUpdateFiles = LiveUpdateManager.getLatestAppDirectory(requireContext(), portal?.liveUpdateConfig?.appId!!)
bridgeBuilder = if (liveUpdateFiles != null) {
    bridgeBuilder.setServerPath(ServerPath(ServerPath.PathType.BASE_PATH, liveUpdateFiles!!.path))
} else {
    bridgeBuilder.setServerPath(ServerPath(ServerPath.PathType.ASSET_PATH, startDir))
}
} else {
  bridgeBuilder = bridgeBuilder.setServerPath(ServerPath(ServerPath.PathType.ASSET_PATH, startDir))
}

bridge = bridgeBuilder.create()```

@carlpoole carlpoole self-assigned this Oct 18, 2022
@Steven0351
Copy link
Contributor

Looks great!

@Steven0351
Copy link
Contributor

@carlpoole Is there a reason to not add this to main as well? That would give us a jump on Cap 4 support for Portals without having to wait for a native cap release to potentially get worked on next sprint.

@carlpoole
Copy link
Member Author

@carlpoole Is there a reason to not add this to main as well? That would give us a jump on Cap 4 support for Portals without having to wait for a native cap release to potentially get worked on next sprint.

No I was just going to wait for this PR to be approved/merged and then open a copy on 4.x

@Steven0351
Copy link
Contributor

@carlpoole Is there a reason to not add this to main as well? That would give us a jump on Cap 4 support for Portals without having to wait for a native cap release to potentially get worked on next sprint.

No I was just going to wait for this PR to be approved/merged and then open a copy on 4.x

Oh okay, I misunderstood what you meant in the comment. Sounds good! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants