(Wallet) Connect unlock action from WebUI to native unlock (#24992)

When Wallet is locked, show a new page that will open native unlock screen when double tapped.
This commit is contained in:
Simone Arpe
2024-08-15 13:47:15 +02:00
committed by GitHub
parent 95e47c10f4
commit 8005b73488
23 changed files with 138 additions and 16 deletions
@@ -17,6 +17,9 @@ import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.settings.BraveWalletPreferences;
import org.chromium.content_public.browser.WebContents;
/**
* @noinspection unused
*/
@JNINamespace("brave_wallet")
public class BraveWalletProviderDelegateImplHelper {
private static final String TAG = "BraveWalletProvider";
@@ -27,7 +30,17 @@ public class BraveWalletProviderDelegateImplHelper {
BraveActivity activity = BraveActivity.getBraveActivity();
activity.showWalletPanel(false);
} catch (BraveActivity.BraveActivityNotFoundException e) {
Log.e(TAG, "showPanel " + e);
Log.e(TAG, "showPanel", e);
}
}
@CalledByNative
public static void unlockWallet() {
try {
BraveActivity activity = BraveActivity.getBraveActivity();
activity.openBraveWallet(false, false, false);
} catch (BraveActivity.BraveActivityNotFoundException e) {
Log.e(TAG, "unlockWallet", e);
}
}
@@ -47,7 +60,7 @@ public class BraveWalletProviderDelegateImplHelper {
BraveActivity activity = BraveActivity.getBraveActivity();
activity.showWalletOnboarding();
} catch (BraveActivity.BraveActivityNotFoundException e) {
Log.e(TAG, "showWalletOnboarding " + e);
Log.e(TAG, "showWalletOnboarding", e);
}
}
@@ -222,7 +222,9 @@ public abstract class BaseWalletNextPageFragment extends Fragment {
super.onAuthenticationError(errorCode, errString);
final Context context = getContext();
if (!TextUtils.isEmpty(errString) && context != null) {
// Error code 10 is when the user taps back to dismiss the dialog,
// there's no need to show a toast to log this action.
if (!TextUtils.isEmpty(errString) && context != null && errorCode != 10) {
Toast.makeText(context, errString, Toast.LENGTH_SHORT).show();
}
showBiometricAuthenticationButton(biometricUnlockButton);