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 WebXR quick permission regression. Unify permission messages. #3070

Merged
merged 1 commit into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ public void onPopUpButtonClicked() {
public void onWebXRButtonClicked() {
toggleQuickPermission(mBinding.navigationBarNavigation.urlBar.getWebxRButton(),
SitePermission.SITE_PERMISSION_WEBXR,
!mViewModel.getIsWebXRBlocked().getValue().get());
mViewModel.getIsWebXRBlocked().getValue().get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public QuickPermissionWidget(Context aContext) {
private void initialize() {
LayoutInflater inflater = LayoutInflater.from(getContext());
mBinding = DataBindingUtil.inflate(inflater, R.layout.quick_permission_dialog, this, true);
mBinding.setBlocked(false);
mBinding.setBlockButtonVisible(false);
mBinding.allowButton.setOnClickListener(v -> {
if (mDelegate != null) {
mDelegate.onAllow();
Expand All @@ -52,20 +52,27 @@ private void initialize() {
public void setData(String uri, int aCategory, boolean aBlocked) {
mCategory = aCategory;
mDomain = uri;
mBinding.setBlocked(aBlocked);
mBinding.setBlockButtonVisible(aBlocked);
updateUI();
}

public void updateUI() {
switch (mCategory) {
case SitePermission.SITE_PERMISSION_WEBXR: {
mBinding.message.setText(getResources().getString(R.string.webxr_block_dialog_message, mDomain));
mBinding.message.setText(
getResources().getString(R.string.webxr_permission_dialog_message,
mBinding.getBlockButtonVisible() ?
getResources().getString(R.string.off).toUpperCase() :
getResources().getString(R.string.on).toUpperCase(),
getResources().getString(R.string.sumo_webxr_url)));
mBinding.allowButton.setText(R.string.permission_allow);
mBinding.blockButton.setText(R.string.pop_up_site_switch_block);
break;
}
case SitePermission.SITE_PERMISSION_TRACKING: {
mBinding.message.setText(
getResources().getString(R.string.tracking_dialog_message,
mBinding.getBlocked() ?
mBinding.getBlockButtonVisible() ?
getResources().getString(R.string.on).toUpperCase() :
getResources().getString(R.string.off).toUpperCase(),
getResources().getString(R.string.sumo_etp_url)));
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/quick_permission_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="blocked"
name="blockButtonVisible"
type="Boolean" />
</data>
<LinearLayout
Expand Down Expand Up @@ -32,7 +32,7 @@
android:gravity="center_horizontal"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text="@string/webxr_block_dialog_message"
android:text="@string/webxr_permission_dialog_message"
android:textStyle="bold"
android:textColor="@color/fog"
android:textSize="@dimen/text_bigger_size" />
Expand All @@ -50,7 +50,7 @@
android:text="@string/pop_up_site_switch_allow"
android:textColor="@drawable/dialog_button_text_color"
android:textStyle="bold"
visibleGone="@{blocked}"/>
visibleGone="@{blockButtonVisible}"/>

<Button
android:id="@+id/blockButton"
Expand All @@ -65,7 +65,7 @@
android:text="@string/pop_up_site_switch_block"
android:textColor="@drawable/dialog_button_text_color"
android:textStyle="bold"
visibleGone="@{!blocked}"/>
visibleGone="@{!blockButtonVisible}"/>
</RelativeLayout>
<FrameLayout
android:layout_width="wrap_content"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/non_L10n.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<string name="sumo_language_display_url" translatable="false">https://support.mozilla.org/kb/use-firefox-another-language?as=u&amp;utm_source=inproduct</string>
<string name="sumo_language_content_url" translatable="false">https://support.mozilla.org/kb/choose-display-languages-multilingual-web-pages?as=u&amp;utm_source=inproduct</string>
<string name="sumo_etp_url" translatable="false">https://support.mozilla.org/kb/enhanced-tracking-protection-firefox-desktop</string>
<string name="sumo_webxr_url" translatable="false">https://support.mozilla.org/en-US/kb/webxr-permission-info-page</string>
<string name="list_item_view_tag" translatable="false">view</string>
<string name="position_tag" translatable="false">position</string>
<string name="view_id_tag" translatable="false">view_id</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ the Select` button. When clicked it closes all the previously selected tabs -->

<!-- This string is displayed in the title of the quick WebXR blocking dialog, accessed from the VR icon in the URL bar.
'%1$s' will be replaced at runtime with the app's name. -->
<string name="webxr_block_dialog_message">‘%1$s’ wants to access WebXR API</string>
<string name="webxr_permission_dialog_message">WebXR is %1$s for this site. (&lt;a href="%2$s">Learn More&lt;/a>)</string>
Copy link

Choose a reason for hiding this comment

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

Two questions:

  1. What does WebXR is Firefox for this site. mean? Because that's what the comment implies
  2. Is the HTML supposed to look like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ups, the comment is wrong. The real text will be: WebXR is "on/off" for this site

Copy link

Choose a reason for hiding this comment

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

And where do "ON" and "OFF" come from? Note that they're adjectives, so they need to be adapted to the name, and you can't reuse generic ones.

Copy link

Choose a reason for hiding this comment

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

Any update on this? We can't expose for localization any strings until this is fixed.


<!-- This string is displayed in the title of the quick Tracking Protection dialog, accessed from the Tracking Protection icon in the URL bar. -->
<string name="tracking_dialog_message">Enhanced Tracking Protection is %1$s for this site. (&lt;a href="%2$s">Learn More&lt;/a>)</string>
Expand Down