1. On devices less than xhdpi request a 1x image from MapTiler (such devices are generally old, slower and with little memory so avoiding to get the 2x image only to have to shrink it later could help).
2. Coerce too big width/height combos within the API limits keeping the aspect ratio (this will allow requests on big horizontal displays to succeed).
3. Don't crash when given weird width/height combos (i.e. zero or negative).
4. Introduce interfaces to hide this whole logic and make it easier for forks to implement their own.
Related to:
- https://github.com/vector-im/element-meta/issues/1678
Maptiler custom map ids are only useable by the account that create them. So if we hardcode them forkers won't be able to use the maps even if the bring in their own api key (because they can't access our maps with their api key).
Requires to set our map ids in `local.properties` for local development:
```
services.maptiler.lightMapId=9bc819c8-e627-474a-a348-ec144fe3d810
services.maptiler.darkMapId=dea61faf-292b-4774-9660-58fcef89a7f3
```
In an effort to make it easier for forks to (a) use their own
API keys (b) change map styles or maybe even providers, move
the MapTiler key out of the source code and pass it in via
env var or property.
Also refactor the utility classes slightly to keep all the URL
related functions together, to reduce the chance of collisions
when maintaining such forks.
* Use @DayNightPreviews for static map
To properly screenshot the dark pin.
* Update screenshots
---------
Co-authored-by: ElementBot <benoitm+elementbot@element.io>
With this change, composable previews and screenshots should be created with just:
```
@ElementPreviews@Composable
fun MyViewPreview() {
ElementPreview {
MyView()
}
}
```
- Adds `@ElementPreviews` which is a shorthand for:
```
@Preview(name = "D")
@Preview(name = "N", uiMode = Configuration.UI_MODE_NIGHT_YES)
```
Should be used in connection with the now public `fun ElementPreview()` composable.
- Adds ElementPreviews to previewAnnotations in dangerfile
- Screenshots of night mode previews are now rendered with night mode
- Replaces `ElementPreviewLight` and `ElementThemedPreview` with `ElementPreview`
- Deprecates `ElementPreviewDark` which should be removed.
- Remaining usages of `ElementPreviewDark` are now ignored during screenshot tests
Show a fully-featured MapView, centered on the dropped pin,
which allows panning/zooming. Share button allows opening
in a map application.
Supports showing a description at the top of the screen,
if one is supplied with the event.
Out of scope: showing the local user's location (being
done as a separate story).
Includes some minor tidying: remove duplicate Location,
and make GeoURI parsing a method on that class; fix the
pointer location in MapView (I broke it earlier, whoops!)
* Link Compound's `TypographyTokens` to `ElementTheme`.
Also add some docs about when we should use each set of tokens.
* Renamed `LocalColors` to `LocalLegacyColors`.
Made both `LocalLegacyColors` and `LocalCompoundColors` internal. This means it will need to always be used through `ElementTheme.`
Also, removed any usages of `LocalColors.current` accross the project, they're now used through `ElementTheme.legacyColors`.
* Added tokens.
* Apply color to MaterialTheme, also add typography.
* Map colors to the right ones in the themes.
* Create and improve previews of some components
* More preview improvements
* Add `tertiary` and `onTertiary` colors, remove some unused ones.
* Fix usage of deleted color token
* Fix bug in Switch previews
* Create a separate `:libraries:theme` module to keep everything related to colors, typography and Compound in general.
* Fix `DatePickerPreview`
* Add missing Compound generated files by fixing their package name
* Move `ElementTheme` to the `:libraries:theme` module, make some variables internal.
---------
Co-authored-by: ElementBot <benoitm+elementbot@element.io>