[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-128.1.0esr-14.0-1] Bug 1908344 - Improve prompts showing a=dmeehan - BP, tor-browser#43005

ma1 (@ma1) git at gitlab.torproject.org
Mon Aug 5 22:35:35 UTC 2024



ma1 pushed to branch tor-browser-128.1.0esr-14.0-1 at The Tor Project / Applications / Tor Browser


Commits:
74a9682b by Arturo Mejia at 2024-08-06T00:32:39+02:00
Bug 1908344 - Improve prompts showing  a=dmeehan - BP, tor-browser#43005

Original Revision: https://phabricator.services.mozilla.com/D216996

Differential Revision: https://phabricator.services.mozilla.com/D217718

- - - - -


1 changed file:

- mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt


Changes:

=====================================
mobile/android/android-components/components/feature/prompts/src/main/java/mozilla/components/feature/prompts/PromptFeature.kt
=====================================
@@ -544,58 +544,71 @@ class PromptFeature private constructor(
      *
      * @param session The session which requested the dialog.
      */
-    @Suppress("NestedBlockDepth")
     @VisibleForTesting(otherwise = PRIVATE)
     internal fun onPromptRequested(session: SessionState) {
         // Some requests are handle with intents
         session.content.promptRequests.lastOrNull()?.let { promptRequest ->
-            store.state.findTabOrCustomTabOrSelectedTab(customTabId)?.let {
-                promptRequest.executeIfWindowedPrompt { exitFullscreenUsecase(it.id) }
+            if (session.content.permissionRequestsList.isNotEmpty()) {
+                onCancel(session.id, promptRequest.uid)
+            } else {
+                processPromptRequest(promptRequest, session)
             }
+        }
+    }
 
-            when (promptRequest) {
-                is File -> {
-                    emitPromptDisplayedFact(promptName = "FilePrompt")
-                    filePicker.handleFileRequest(promptRequest)
-                }
+    @Suppress("NestedBlockDepth")
+    private fun processPromptRequest(
+        promptRequest: PromptRequest,
+        session: SessionState,
+    ) {
+        store.state.findTabOrCustomTabOrSelectedTab(customTabId)?.let {
+            promptRequest.executeIfWindowedPrompt { exitFullscreenUsecase(it.id) }
+        }
 
-                is Share -> handleShareRequest(promptRequest, session)
-                is SelectCreditCard -> {
-                    emitSuccessfulCreditCardAutofillFormDetectedFact()
-                    if (isCreditCardAutofillEnabled() && promptRequest.creditCards.isNotEmpty()) {
-                        creditCardPicker?.handleSelectCreditCardRequest(promptRequest)
-                    }
+        when (promptRequest) {
+            is File -> {
+                emitPromptDisplayedFact(promptName = "FilePrompt")
+                filePicker.handleFileRequest(promptRequest)
+            }
+
+            is Share -> handleShareRequest(promptRequest, session)
+            is SelectCreditCard -> {
+                emitSuccessfulCreditCardAutofillFormDetectedFact()
+                if (isCreditCardAutofillEnabled() && promptRequest.creditCards.isNotEmpty()) {
+                    creditCardPicker?.handleSelectCreditCardRequest(promptRequest)
                 }
+            }
 
-                is SelectLoginPrompt -> {
-                    if (!isLoginAutofillEnabled()) {
-                        return
-                    }
-                    if (promptRequest.generatedPassword != null && isSuggestStrongPasswordEnabled) {
-                        val currentUrl =
-                            store.state.findTabOrCustomTabOrSelectedTab(customTabId)?.content?.url
-                        if (currentUrl != null) {
-                            strongPasswordPromptViewListener?.handleSuggestStrongPasswordRequest(
-                                promptRequest,
-                                currentUrl,
-                                onSaveLoginWithStrongPassword,
-                            )
-                        }
-                    } else {
-                        loginPicker?.handleSelectLoginRequest(promptRequest)
-                    }
-                    emitPromptDisplayedFact(promptName = "SelectLoginPrompt")
+            is SelectLoginPrompt -> {
+                if (!isLoginAutofillEnabled()) {
+                    return
                 }
 
-                is SelectAddress -> {
-                    emitSuccessfulAddressAutofillFormDetectedFact()
-                    if (isAddressAutofillEnabled() && promptRequest.addresses.isNotEmpty()) {
-                        addressPicker?.handleSelectAddressRequest(promptRequest)
+                if (promptRequest.generatedPassword != null && isSuggestStrongPasswordEnabled) {
+                    val currentUrl =
+                        store.state.findTabOrCustomTabOrSelectedTab(customTabId)?.content?.url
+                    if (currentUrl != null) {
+                        strongPasswordPromptViewListener?.handleSuggestStrongPasswordRequest(
+                            promptRequest,
+                            currentUrl,
+                            onSaveLoginWithStrongPassword,
+                        )
                     }
+                    strongPasswordPromptViewListener?.handleSuggestStrongPasswordRequest()
+                } else {
+                    loginPicker?.handleSelectLoginRequest(promptRequest)
                 }
+                emitPromptDisplayedFact(promptName = "SelectLoginPrompt")
+            }
 
-                else -> handleDialogsRequest(promptRequest, session)
+            is SelectAddress -> {
+                emitSuccessfulAddressAutofillFormDetectedFact()
+                if (isAddressAutofillEnabled() && promptRequest.addresses.isNotEmpty()) {
+                    addressPicker?.handleSelectAddressRequest(promptRequest)
+                }
             }
+
+            else -> handleDialogsRequest(promptRequest, session)
         }
     }
 



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/74a9682bbae1dc7c94e461e7616f1eed729e0c3c

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/74a9682bbae1dc7c94e461e7616f1eed729e0c3c
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240805/95c633b8/attachment-0001.htm>


More information about the tbb-commits mailing list