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 copyright attributions of map views [PSF-1058] - [PSF-1072] #6247

Merged
merged 9 commits into from
Jun 10, 2022

Conversation

onurays
Copy link
Contributor

@onurays onurays commented Jun 7, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Static map copyright text on the timeline item was not readable because of the font size
  • Static map copyright text on the timeline item of live location sharing was behind the informative tile
  • Mapbox copyright attribution items on the maximized map were behind the user list bottom sheet
  • This PR suggests to use custom copyright text on the timeline item and to fix the position of attribution items

Motivation and context

  • Required copyright attributes should always be visible and readible

Screenshots / GIFs

Before After Maximized
copyright_before copyright_after copyright_maximized

Tests

  • Share static location and you should see copyright text on timeline location item
  • Share live location (after enabling from labs flag) and you should see the copyright icon in maximized screen

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@onurays onurays changed the title Fix copyright attributions of map views Fix copyright attributions of map views [PSF-1058] - [PSF-1072] Jun 7, 2022
@onurays onurays requested review from a team, yostyle and mnaturel and removed request for a team June 7, 2022 13:25
Comment on lines 101 to 102
setLogoMargins(dimensionConverter.dpToPx(8), 0, 0, dimensionConverter.dpToPx(208))
setAttributionMargins(dimensionConverter.dpToPx(96), 0, 0, dimensionConverter.dpToPx(208))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use the size of the view that these values ​​depend on instead of using static values ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done. Although it is not possible to calculate the width of the "mapbox" logo.

@onurays onurays requested a review from yostyle June 7, 2022 15:23
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

One remark about the new string.

@@ -3036,6 +3036,7 @@
<string name="labs_enable_live_location_summary">Temporary implementation: locations persist in room history</string>
<string name="live_location_bottom_sheet_stop_sharing">Stop sharing</string>
<string name="live_location_bottom_sheet_last_updated_at">Updated %1$s ago</string>
<string name="location_map_view_copyright">© MapTiler © OpenStreetMap contributors</string>
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want this string to be translated? I think this is not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, moved.

Copy link
Contributor

@mnaturel mnaturel left a comment

Choose a reason for hiding this comment

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

I have just added some small remarks.

@@ -111,5 +113,6 @@ abstract class AbsMessageLocationItem<H : AbsMessageLocationItem.Holder> : AbsMe
val staticMapImageView by bind<ImageView>(R.id.staticMapImageView)
val staticMapPinImageView by bind<ImageView>(R.id.staticMapPinImageView)
val staticMapErrorTextView by bind<TextView>(R.id.staticMapErrorTextView)
val mapCopyrightTextView by bind<TextView>(R.id.mapCopyrightTextView)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we follow the same convention as for other ids by starting by staticMap prefix?

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.

@@ -63,10 +62,8 @@ class UrlMapProvider @Inject constructor(
append(height)
append(".png")
append(keyParam)
if (!localeProvider.isRTL()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The localeProvider dependency can be removed from this class since it is no longer used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, done.

append("&attribution=bottomleft")
}
// Since the default copyright font is too small we put a custom one on map
append("&attribution=0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use attribution=false if it works: the intention may be clearer with a boolean.

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, works, done.

mapboxMap.uiSettings.apply {
// Place copyright above the user list bottom sheet
setLogoMargins(dimensionConverter.dpToPx(8), 0, 0, bottomSheetHeight + dimensionConverter.dpToPx(8))
setAttributionMargins(dimensionConverter.dpToPx(96), 0, 0, bottomSheetHeight + dimensionConverter.dpToPx(8))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also add this setAttributionMargins in MapTilerMapView? In this view, we only call setLogoMargins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is working well with default margins. Since I moved the position of attribution here I also needed re-set all the margins.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant is what you have done is great (we see the logo + information icon). But I have seen in MapTilerMapView, we only call the setLogoMargins implying we only see the logo but not the information icon. I know it is out of the scope of this PR but we could align this behaviour and add the call to setAttributionMargins in MapTilerMapView so that we can see the information icon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We actually see both logo and the info icon in MapTilerMapView. You can see it in maximized static location sharing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the info icon is missing in the screen where user selects location sharing option. It is hidden under the options view. This is due to missing call to setAttributionMargins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I missed this screen!

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, done!

@onurays onurays requested review from bmarty and mnaturel June 8, 2022 09:38
@@ -42,4 +42,6 @@
<string name="ftue_auth_email_verification_subtitle">To confirm your email address, tap the button in the email we just sent to %s</string>
<string name="ftue_auth_email_verification_footer">Did not receive an email?</string>
<string name="ftue_auth_email_resend_email">Resend email</string>

<string name="location_map_view_copyright">© MapTiler © OpenStreetMap contributors</string>
Copy link
Member

Choose a reason for hiding this comment

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

Can you add translatable="false" please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know that, done.

@onurays onurays requested a review from bmarty June 8, 2022 12:18
@sonarcloud
Copy link

sonarcloud bot commented Jun 9, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@onurays onurays requested review from a team and removed request for yostyle and a team June 10, 2022 10:46
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM

@bmarty bmarty merged commit 990a683 into develop Jun 10, 2022
@bmarty bmarty deleted the feature/ons/fix_static_map_copyright_size branch June 10, 2022 11:56
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.

None yet

4 participants