Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 678e7bd

Browse files
authored
Fix WebXR quick permission regression. Unify permission message. (#3070)
1 parent 01415eb commit 678e7bd

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ public void onPopUpButtonClicked() {
961961
public void onWebXRButtonClicked() {
962962
toggleQuickPermission(mBinding.navigationBarNavigation.urlBar.getWebxRButton(),
963963
SitePermission.SITE_PERMISSION_WEBXR,
964-
!mViewModel.getIsWebXRBlocked().getValue().get());
964+
mViewModel.getIsWebXRBlocked().getValue().get());
965965
}
966966

967967
@Override

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/dialogs/QuickPermissionWidget.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public QuickPermissionWidget(Context aContext) {
3535
private void initialize() {
3636
LayoutInflater inflater = LayoutInflater.from(getContext());
3737
mBinding = DataBindingUtil.inflate(inflater, R.layout.quick_permission_dialog, this, true);
38-
mBinding.setBlocked(false);
38+
mBinding.setBlockButtonVisible(false);
3939
mBinding.allowButton.setOnClickListener(v -> {
4040
if (mDelegate != null) {
4141
mDelegate.onAllow();
@@ -52,20 +52,27 @@ private void initialize() {
5252
public void setData(String uri, int aCategory, boolean aBlocked) {
5353
mCategory = aCategory;
5454
mDomain = uri;
55-
mBinding.setBlocked(aBlocked);
55+
mBinding.setBlockButtonVisible(aBlocked);
5656
updateUI();
5757
}
5858

5959
public void updateUI() {
6060
switch (mCategory) {
6161
case SitePermission.SITE_PERMISSION_WEBXR: {
62-
mBinding.message.setText(getResources().getString(R.string.webxr_block_dialog_message, mDomain));
62+
mBinding.message.setText(
63+
getResources().getString(R.string.webxr_permission_dialog_message,
64+
mBinding.getBlockButtonVisible() ?
65+
getResources().getString(R.string.off).toUpperCase() :
66+
getResources().getString(R.string.on).toUpperCase(),
67+
getResources().getString(R.string.sumo_webxr_url)));
68+
mBinding.allowButton.setText(R.string.permission_allow);
69+
mBinding.blockButton.setText(R.string.pop_up_site_switch_block);
6370
break;
6471
}
6572
case SitePermission.SITE_PERMISSION_TRACKING: {
6673
mBinding.message.setText(
6774
getResources().getString(R.string.tracking_dialog_message,
68-
mBinding.getBlocked() ?
75+
mBinding.getBlockButtonVisible() ?
6976
getResources().getString(R.string.on).toUpperCase() :
7077
getResources().getString(R.string.off).toUpperCase(),
7178
getResources().getString(R.string.sumo_etp_url)));

app/src/main/res/layout/quick_permission_dialog.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:app="http://schemas.android.com/apk/res-auto">
55
<data>
66
<variable
7-
name="blocked"
7+
name="blockButtonVisible"
88
type="Boolean" />
99
</data>
1010
<LinearLayout
@@ -32,7 +32,7 @@
3232
android:gravity="center_horizontal"
3333
android:paddingStart="20dp"
3434
android:paddingEnd="20dp"
35-
android:text="@string/webxr_block_dialog_message"
35+
android:text="@string/webxr_permission_dialog_message"
3636
android:textStyle="bold"
3737
android:textColor="@color/fog"
3838
android:textSize="@dimen/text_bigger_size" />
@@ -50,7 +50,7 @@
5050
android:text="@string/pop_up_site_switch_allow"
5151
android:textColor="@drawable/dialog_button_text_color"
5252
android:textStyle="bold"
53-
visibleGone="@{blocked}"/>
53+
visibleGone="@{blockButtonVisible}"/>
5454

5555
<Button
5656
android:id="@+id/blockButton"
@@ -65,7 +65,7 @@
6565
android:text="@string/pop_up_site_switch_block"
6666
android:textColor="@drawable/dialog_button_text_color"
6767
android:textStyle="bold"
68-
visibleGone="@{!blocked}"/>
68+
visibleGone="@{!blockButtonVisible}"/>
6969
</RelativeLayout>
7070
<FrameLayout
7171
android:layout_width="wrap_content"

app/src/main/res/values/non_L10n.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<string name="sumo_language_display_url" translatable="false">https://support.mozilla.org/kb/use-firefox-another-language?as=u&amp;utm_source=inproduct</string>
6161
<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>
6262
<string name="sumo_etp_url" translatable="false">https://support.mozilla.org/kb/enhanced-tracking-protection-firefox-desktop</string>
63+
<string name="sumo_webxr_url" translatable="false">https://support.mozilla.org/en-US/kb/webxr-permission-info-page</string>
6364
<string name="list_item_view_tag" translatable="false">view</string>
6465
<string name="position_tag" translatable="false">position</string>
6566
<string name="view_id_tag" translatable="false">view_id</string>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ the Select` button. When clicked it closes all the previously selected tabs -->
14531453

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

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

0 commit comments

Comments
 (0)