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

Add Fallback URLs (for #1203) #1348

Merged
merged 7 commits into from
Sep 17, 2022

Conversation

TesteurManiak
Copy link
Collaborator

Fix #1203

  • Updated NetworkTileProvider and NetworkNoRetryTileProvider from tile_provider_io.dart & tile_provider_web.dart to support a fallbackUrl
    • Replaced references to RetryClient by a simple Client class as I think it is not needed to enforce a retry client, we should simply be able to use any Client class we want (+ allows to use FMNetworkImageProvider inside tile_provider_web.NetworkNoRetryTileProvider.getImage)
  • Putted back AssetTileProvider which was missing for some unknown reasons and added support for fallbackUrl by implementing a private class _FlutterMapAssetBundle which will try to load an asset in the same way as the default PlatformAssetBundle, but will also try to load a fallback asset if the first one wasn't found.
  • 2 examples have been added: FallbackUrlNetworkPage & FallbackUrlOfflinePage

Changes have been tested on Android and Chrome, no regressions were found.

@JaffaKetchup
Copy link
Member

Thanks @TesteurManiak! I'll have a look at this for v3.1.0 :)

@JaffaKetchup JaffaKetchup self-requested a review September 4, 2022 19:41
@TesteurManiak
Copy link
Collaborator Author

Hi, @JaffaKetchup I've merged the latest changes from master on the branch.
I kept the AssetTileProvider implementation inside it's own separated file with the _FlutterMapAssetBundle. (Seemed better for readability)

Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the changes I suggested below.
Can you also bring this up to date with v3 if needs be? For example, I know the AssetTileProvider was added back and this might cause problems.

example/lib/pages/fallback_url_network_page.dart Outdated Show resolved Hide resolved
lib/src/layer/tile_layer/tile_layer.dart Outdated Show resolved Hide resolved
@TesteurManiak
Copy link
Collaborator Author

@JaffaKetchup everything should be ok now 👍

@JaffaKetchup JaffaKetchup changed the title Fix/issue 1203 Add Fallback URLs (for #1203) Sep 17, 2022
Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks.

@JaffaKetchup JaffaKetchup merged commit a56b2b3 into fleaflet:master Sep 17, 2022
@TesteurManiak TesteurManiak deleted the fix/issue_1203 branch September 17, 2022 14:15
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.

[FEATURE] Fallback tile URLs in-case of HTTP error
2 participants