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

(Wallet) Fix Dapps dialog not dismissed when creating a new tab #27249

Merged
merged 1 commit into from
Jan 15, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/brave_java_resources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ brave_java_resources = [
"java/res/drawable/crypto_wallet_hollow_button.xml",
"java/res/drawable/crypto_wallet_onboarding_blue_button.xml",
"java/res/drawable/custodian_text_background.xml",
"java/res/drawable/dapps_permission_dialog_background.xml",
"java/res/drawable/default_dot.xml",
"java/res/drawable/default_indicator.xml",
"java/res/drawable/ellipse_217.xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

Expand Down Expand Up @@ -60,6 +61,7 @@ public class BraveDappPermissionPromptDialog
private final ModalDialogManager mModalDialogManager;
private final int mCoinType;
private final Context mContext;
private final Window mWindow;
private long mNativeDialogController;
private PropertyModel mPropertyModel;
private String mFavIconURL;
Expand All @@ -85,13 +87,13 @@ private static BraveDappPermissionPromptDialog create(

public BraveDappPermissionPromptDialog(
long nativeDialogController,
WindowAndroid windowAndroid,
@NonNull WindowAndroid windowAndroid,
String favIconURL,
@CoinType.EnumType int coinType) {
mNativeDialogController = nativeDialogController;
mFavIconURL = favIconURL;
mContext = windowAndroid.getActivity().get();

mWindow = windowAndroid.getWindow();
mModalDialogManager = windowAndroid.getModalDialogManager();
mCoinType = coinType;
mMojoServicesClosed = false;
Expand All @@ -113,7 +115,7 @@ public BraveDappPermissionPromptDialog(
void show() {
View customView =
LayoutInflaterUtils.inflate(
mContext, R.layout.brave_permission_prompt_dialog, null);
mWindow, R.layout.brave_permission_prompt_dialog, null, false);

mFavIconImage = customView.findViewById(R.id.favicon);
mCvFavContainer = customView.findViewById(R.id.permission_prompt_fav_container);
Expand Down Expand Up @@ -142,7 +144,7 @@ void show() {
R.string.permissions_connect_brave_wallet_back_button_text))
.with(ModalDialogProperties.FILTER_TOUCH_FOR_SECURITY, true)
.build();
mModalDialogManager.showDialog(mPropertyModel, ModalDialogType.APP);
mModalDialogManager.showDialog(mPropertyModel, ModalDialogType.TAB);
initKeyringService();
try {
BraveActivity activity = BraveActivity.getBraveActivity();
Expand All @@ -160,7 +162,7 @@ void show() {
mPermissionDialogPositiveButton.setEnabled(false);
}
} catch (BraveActivity.BraveActivityNotFoundException e) {
Log.e(TAG, "show " + e);
Log.e(TAG, "show", e);
}
initAccounts();
}
Expand All @@ -172,7 +174,7 @@ int getPermissionLifetimeOption() {

@NonNull
private ViewGroup getPermissionModalViewContainer(@NonNull View customView) {
ViewParent viewParent = customView.getParent();
ViewParent viewParent = (ViewParent) customView;
while (viewParent.getParent() != null) {
viewParent = viewParent.getParent();
if (viewParent instanceof ModalDialogView) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--* Copyright (c) 2025 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/brave_wallet_dn_panel_bg" />
<corners
android:topLeftRadius="24dp"
android:topRightRadius="24dp"
/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AlertDialogContent"
android:background="@color/brave_wallet_dn_panel_bg"
android:background="@drawable/dapps_permission_dialog_background"
android:gravity="start">

<TextView
Expand Down
Loading