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

Retrieve map style url from .well-known #5176

Merged
merged 2 commits into from
Feb 8, 2022

Conversation

onurays
Copy link
Contributor

@onurays onurays commented Feb 7, 2022

Fixes #5175.

MSC

@onurays onurays requested a review from bmarty February 7, 2022 10:40
@github-actions
Copy link

github-actions bot commented Feb 7, 2022

Unit Test Results

  76 files  ±0    76 suites  ±0   53s ⏱️ -11s
144 tests ±0  144 ✔️ ±0  0 💤 ±0  0 ±0 
452 runs  ±0  452 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 22a03ab. ± Comparison against base commit 4438d51.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 7, 2022

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
    passed="25" failures="17" errors="0" skipped="2"
  • [org.matrix.android.sdk.account]
    passed="5" failures="0" errors="0" skipped="2"
  • [org.matrix.android.sdk.internal]
    passed="158" failures="1" errors="0" skipped="38"
  • [org.matrix.android.sdk.ordering]
    passed="16" failures="0" errors="0" skipped="0"
  • [org.matrix.android.sdk.PermalinkParserTest]
    passed="2" failures="0" errors="0" skipped="0"

@onurays onurays requested a review from ouchadam February 7, 2022 16:10
val mapUrl = buildString {
append(MAP_BASE_URL)
append(keyParam)
suspend fun getMapUrl(): String {
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit: this might be easier to parse if we separate the fallback with its own variable

private val fallbackMapUrl = buildString {
    append(MAP_BASE_URL)
    append(keyParam)
}

suspend fun getMapUrl(): String {
    val upstreamMapUrl = tryOrNull { rawService.getElementWellknown(session.sessionParams) }
            ?.mapTileServerConfig
            ?.mapStyleUrl
    return upstreamMapUrl ?: fallbackMapUrl
}

what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much easier to read! I will commit, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@ouchadam ouchadam left a comment

Choose a reason for hiding this comment

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

LGTM 💯

@ganfra ganfra merged commit 49a0555 into develop Feb 8, 2022
@ganfra ganfra deleted the feature/ons/map_wellknown_support branch February 8, 2022 10:57
?.mapStyleUrl
return upstreamMapUrl ?: fallbackMapUrl
}

fun buildStaticMapUrl(locationData: LocationData,
Copy link
Member

Choose a reason for hiding this comment

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

I think this fun should also be impacted by the url set up in the .well-known file, since AFAIU, it can contain another API key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch.

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.

Retrieve map style url from .well-known
4 participants