From 74e8a8368db991ee511c216a298c4ff5201f41de Mon Sep 17 00:00:00 2001 From: Soren Stoutner <soren@stoutner.com> Date: Wed, 27 Mar 2024 16:10:48 -0700 Subject: [PATCH] Fix displaying HTTP Authentication dialogs crashing when the app has been stopped. https://redmine.stoutner.com/issues/1178 --- .../activities/MainWebViewActivity.kt | 12 +++++++--- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 22 ++++++++++++++++++- app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 22 ++++++++++++++++++- app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 22 ++++++++++++++++++- app/src/main/res/values-zh-rCN/strings.xml | 1 - 8 files changed, 72 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index b56a02f0..75aa38be 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -5455,8 +5455,14 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Instantiate an HTTP authentication dialog. val httpAuthenticationDialogFragment = HttpAuthenticationDialog.displayDialog(host, realm, nestedScrollWebView.webViewFragmentId) - // Show the HTTP authentication dialog. - httpAuthenticationDialogFragment.show(supportFragmentManager, getString(R.string.http_authentication)) + // Try to show the dialog. WebView can receive an HTTP authentication request even after the app has been paused. Attempting to display a dialog in that state leads to a crash. + try { + // Show the HTTP authentication dialog. + httpAuthenticationDialogFragment.show(supportFragmentManager, getString(R.string.http_authentication)) + } catch (exception: Exception) { // The dialog could not be shown. + // Add the dialog to the pending dialog array list. It will be displayed in `onStart()`. + pendingDialogsArrayList.add(PendingDialogDataClass(httpAuthenticationDialogFragment, getString(R.string.http_authentication))) + } } override fun onPageStarted(webView: WebView, url: String, favicon: Bitmap?) { @@ -5694,7 +5700,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Instantiate an SSL certificate error alert dialog. val sslCertificateErrorDialogFragment = SslCertificateErrorDialog.displayDialog(error, nestedScrollWebView.webViewFragmentId) - // Try to show the dialog. The SSL error handler continues to function even when the WebView is paused. Attempting to display a dialog in that state leads to a crash. + // Try to show the dialog. The SSL error handler continues to function even when the app has been stopped. Attempting to display a dialog in that state leads to a crash. try { // Show the SSL certificate error dialog. sslCertificateErrorDialogFragment.show(supportFragmentManager, getString(R.string.ssl_certificate_error)) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0830c64b..614b620b 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -643,7 +643,6 @@ <string name="open_intents_in_new_tab_summary">Intents sind Links, die von anderen Apps übergeben werden.</string> <string name="swipe_to_refresh">Herunterziehen zum Aktualisieren</string> <string name="swipe_to_refresh_summary">Einige Websites funktionieren nicht, wenn "Herunterziehen zum Aktualisieren" eingeschaltet ist.</string> - <string name="download_with_external_app">Mit einer externen App herunterladen</string> <string name="scroll_app_bar">App-Leiste scrollen</string> <string name="scroll_app_bar_summary">Scrollt die App-Leiste mit der URL nach oben, wenn die Webseite gescrollt wird.</string> <string name="bottom_app_bar">Untere Anwendungs-Leiste</string> diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index c8dec3c7..98c7c554 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -203,6 +203,12 @@ <string name="bytes">bytes</string> <string name="unknown_size">Tamaño desconocido</string> <string name="invalid_url">URL inválida</string> + <string name="blob_url_warning">Actualmente Navegador privado no puede descargar URLs de blobs.</string> + <string name="data_url_warning">El gestor de descargas de Android no puede gestionar las URLs de datos.</string> + <string name="download_directory">Directorio de descargas</string> + <string name="documents">Documentos</string> + <string name="pictures">Imágenes</string> + <string name="music">Música</string> <string name="saving_file">Guardando archivo:\u0020 %1$d%% - %2$s</string> <string name="saving_file_progress">Guardando archivo:\u0020 %1$s bytes - %2$s</string> <string name="saving_file_percentage_progress">Guardando archivo:\u0020 %1$d%% - %2$s bytes / %3$s bytes - %4$s</string> @@ -254,6 +260,8 @@ <string name="create_folder">Crear carpeta</string> <string name="current_bookmark_icon">Icono de favorito actual</string> <string name="current_folder_icon">Icono de carpeta actual</string> + <string name="custom_bookmark_icon">Icono de favorito personalizado</string> + <string name="custom_folder_icon">Icono de carpeta personalizado</string> <string name="default_folder_icon">Icono de carpeta por defecto</string> <string name="webpage_favorite_icon">Icono favorito de página Web</string> <string name="bookmark_name">Nombre de favorito</string> @@ -263,6 +271,7 @@ <string name="edit_folder">Editar carpeta</string> <string name="move_to_folder">Mover a carpeta</string> <string name="move">Mover</string> + <string name="cannot_use_svg">Actualmente no puede usarse un SVG como icono preferido de un favorito.</string> <!-- Bookmarks Contextual App Bar. Android removes double spaces, but extra spaces can be manually specified with the Unicode `\u0020` formatting. The `%1$d` code inserts variables into the displayed text and should be preserved in translation. <https://developer.android.com/reference/kotlin/java/util/Formatter> --> @@ -646,7 +655,18 @@ <string name="open_intents_in_new_tab_summary">Los contenidos son enlaces enviados desde otras apps.</string> <string name="swipe_to_refresh">Deslizar para actualizar</string> <string name="swipe_to_refresh_summary">Algunas webs no funcionan bien si la opción deslizar para actualizar está habilitada.</string> - <string name="download_with_external_app">Descargar con una app externa</string> + <string name="download_provider">Proveedor de descargas</string> + <string-array name="download_provider_entries"> + <item>Navegador Privado</item> + <item>Gestor de descargas de Android</item> + <item>Aplicación externa</item> + </string-array> + <string name="download_with_privacy_browser">Navegador Privado - El descargador integrado de Navegador Privado es sencillo, pero tiene la ventaja de respetar el proxy y usar cookies (si están habilitadas), + asà como la posibilidad de guardar datos: URLs.</string> + <string name="download_with_android_download_manager">Gestor de descargas de Android - El gestor de descargas de Android no respeta la configuración proxy de Navegador Privado, + pero sà tiene acceso a las cookies (lo que significa que los archivos descargados de sitios que requieren hacer login probablemente funcionarán).</string> + <string name="download_with_external_app">Aplicación externa - Las aplicaciones externas no respetan la configuración proxy de Navegador Privado y no tienen acceso a las cookies + (lo que significa que es poco probable que funcionen los archivos descargados de sitios que requieren hacer login).</string> <string name="scroll_app_bar">Desplazar la barra de aplicaciones</string> <string name="scroll_app_bar_summary">Desplazar la barra de aplicaciones desde la parte superior de la pantalla cuando el WebView se desplaza hacia abajo.</string> <string name="bottom_app_bar">Barra inferior de la app</string> diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d9bd0976..ae6d75c1 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -643,7 +643,6 @@ <string name="open_intents_in_new_tab_summary">Les intentions sont des liens envoyés à partir d\'autres applications.</string> <string name="swipe_to_refresh">Glisser pour rafraîchir</string> <string name="swipe_to_refresh_summary">Certains sites Web ne fonctionnent pas bien lorsque "Glisser pour rafraîchir" est activé.</string> - <string name="download_with_external_app">Téléchargement avec une app externe</string> <string name="scroll_app_bar">Défilement barre d\'applications</string> <string name="scroll_app_bar_summary">Faites défiler la barre d\'applications en haut de l\'écran lorsque WebView défile vers le bas.</string> <string name="bottom_app_bar">Barre d\'application en bas</string> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e1bcff0f..07d8d8d3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -203,6 +203,12 @@ <string name="bytes">byte</string> <string name="unknown_size">Dimensione sconosciuta</string> <string name="invalid_url">URL non valida</string> + <string name="blob_url_warning">In questo momento Privacy Browser non può scaricare blob URL.</string> + <string name="data_url_warning">Il gestore dei download di Android non può gestire le URL dati.</string> + <string name="download_directory">Cartella dei Download</string> + <string name="documents">Documenti</string> + <string name="pictures">Immagini</string> + <string name="music">Musica</string> <string name="saving_file">Salvataggio file:\u0020 %1$d%% - %2$s</string> <string name="saving_file_progress">Salvataggio file:\u0020 %1$s byte - %2$s</string> <string name="saving_file_percentage_progress">Salvataggio file:\u0020 %1$d%% - %2$s byte / %3$s byte - %4$s</string> @@ -253,6 +259,8 @@ <string name="create_folder">Crea Cartella</string> <string name="current_bookmark_icon">Icona Segnalibro</string> <string name="current_folder_icon">Icona Cartella</string> + <string name="custom_bookmark_icon">Icona segnalibro personalizzata</string> + <string name="custom_folder_icon">Icona cartella personalizzata</string> <string name="default_folder_icon">Icona predefinita cartella</string> <string name="webpage_favorite_icon">Icona preferita pagina web</string> <string name="bookmark_name">Nome Segnalibro</string> @@ -262,6 +270,7 @@ <string name="edit_folder">Modifica Cartella</string> <string name="move_to_folder">Sposta nella Cartella</string> <string name="move">Sposta</string> + <string name="cannot_use_svg">Al momento i file SVG non possono essere utilizzati come icona dei segnalibri.</string> <!-- Bookmarks Contextual App Bar. Android removes double spaces, but extra spaces can be manually specified with the Unicode `\u0020` formatting. The `%1$d` code inserts variables into the displayed text and should be preserved in translation. <https://developer.android.com/reference/kotlin/java/util/Formatter> --> @@ -646,7 +655,18 @@ <string name="open_intents_in_new_tab_summary">Gli intenti sono link inviati da altre app.</string> <string name="swipe_to_refresh">Swipe per aggiornare</string> <string name="swipe_to_refresh_summary">Alcuni siti non funzionano correttamente se questa opzione è abilitata.</string> - <string name="download_with_external_app">Scarica con una applicazione esterna</string> + <string name="download_provider">Provider dei Download</string> + <string-array name="download_provider_entries"> + <item>Privacy Browser</item> + <item>Download manager di Android</item> + <item>Applicazione esterna</item> + </string-array> + <string name="download_with_privacy_browser">Privacy Browser - Il gestore dei download incluso in Privacy Browser è semplice ma ha il vantaggio di rispettare i proxy e di utilizzare i cookie (se abilitati), + oltre che la capacità di salvare le URL dati.</string> + <string name="download_with_android_download_manager">Gestore dei download di Android - Il gestore dei download di Android non rispetta le impostazioni dei proxy di Privacy Browser ma ha accesso ai cookies + (per cui i lo scaricamento di file da siti che richiedono il login probabilmente dovrebbe funzionare).</string> + <string name="download_with_external_app">Applicazione esterna - Le applicazioni esterne non rispettano le impostazioni dei proxy di Privacy Browser e non hanno accesso ai cookie + (per cui i lo scaricamento di file da siti che richiedono il login difficilmente funzionerà ).</string> <string name="scroll_app_bar">Permetti lo scrolling della barra dell\'applicazione</string> <string name="scroll_app_bar_summary">Permette lo scorrere della barra dell\'applicazione dalla parte alta dello schermo quando si effettua lo scrolling.</string> <string name="bottom_app_bar">Barra dell\'app in basso</string> diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d50014b7..cf80c4f4 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -529,7 +529,6 @@ <string name="open_intents_in_new_tab_summary">Conteúdos são links enviados de outros aplicativos.</string> <string name="swipe_to_refresh">Deslize para atualizar</string> <string name="swipe_to_refresh_summary">Alguns sites não funcionam bem se deslizar para atualizar estiver habilitado.</string> - <string name="download_with_external_app">Download com aplicativo externo</string> <string name="scroll_app_bar">Role a barra de aplicativos</string> <string name="scroll_app_bar_summary">Role a barra de aplicativos para fora da parte superior da tela quando o WebView rola para baixo.</string> <string name="bottom_app_bar">Barra de aplicativos inferior</string> diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 19b25cc6..ece18585 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -200,6 +200,12 @@ <string name="bytes">байÑов</string> <string name="unknown_size">неизвеÑÑнÑй ÑазмеÑ</string> <string name="invalid_url">непÑавилÑнÑй URL</string> + <string name="blob_url_warning">РнаÑÑоÑÑее вÑÐµÐ¼Ñ Privacy Browser не Ð¼Ð¾Ð¶ÐµÑ Ð·Ð°Ð³ÑÑжаÑÑ blob URL.</string> + <string name="data_url_warning">ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ Ð·Ð°Ð³ÑÑзок Android не Ð¼Ð¾Ð¶ÐµÑ Ð¾Ð±ÑабаÑÑваÑÑ URL даннÑÑ .</string> + <string name="download_directory">ÐаÑалог загÑÑзки</string> + <string name="documents">ÐокÑменÑÑ</string> + <string name="pictures">ÐзобÑажениÑ</string> + <string name="music">ÐÑзÑка</string> <string name="saving_file">Ð¡Ð¾Ñ Ñанение Ñайла:\u0020 %1$d%% - %2$s</string> <string name="saving_file_progress">Ð¡Ð¾Ñ Ñанение Ñайла:\u0020 %1$s байÑов - %2$s</string> <string name="saving_file_percentage_progress">Ð¡Ð¾Ñ Ñанение Ñайла:\u0020 %1$d%% - %2$s байÑов / %3$s байÑов - %4$s</string> @@ -250,6 +256,8 @@ <string name="create_folder">Создание папки</string> <string name="current_bookmark_icon">ТекÑÑий знаÑок закладки</string> <string name="current_folder_icon">ТекÑÑий знаÑок папки</string> + <string name="custom_bookmark_icon">ÐаÑÑÑаиваемÑй знаÑок закладки</string> + <string name="custom_folder_icon">ÐаÑÑÑаиваемÑй знаÑок папки</string> <string name="default_folder_icon">ÐнаÑок папки по ÑмолÑаниÑ</string> <string name="webpage_favorite_icon">ÐнаÑок избÑанной веб-ÑÑÑаниÑÑ</string> <string name="bookmark_name">ÐÐ¼Ñ Ð·Ð°ÐºÐ»Ð°Ð´ÐºÐ¸</string> @@ -259,6 +267,7 @@ <string name="edit_folder">ÐзмениÑÑ Ð¿Ð°Ð¿ÐºÑ</string> <string name="move_to_folder">ÐеÑемеÑÑиÑÑ Ð² папкÑ</string> <string name="move">ÐеÑемеÑÑиÑÑ</string> + <string name="cannot_use_svg">РнаÑÑоÑÑее вÑÐµÐ¼Ñ SVG нелÑÐ·Ñ Ð¸ÑполÑзоваÑÑ Ð² каÑеÑÑве знаÑка избÑаннÑÑ Ð·Ð°ÐºÐ»Ð°Ð´Ð¾Ðº.</string> <!-- Bookmarks Contextual App Bar. Android removes double spaces, but extra spaces can be manually specified with the Unicode `\u0020` formatting. The `%1$d` code inserts variables into the displayed text and should be preserved in translation. <https://developer.android.com/reference/kotlin/java/util/Formatter> --> @@ -642,7 +651,18 @@ <string name="open_intents_in_new_tab_summary">Цели - ÑÑо ÑÑÑлки, оÑпÑавленнÑе из дÑÑÐ³Ð¸Ñ Ð¿Ñиложений.</string> <string name="swipe_to_refresh">ÐоÑÑнÑÑÑ Ð´Ð»Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ</string> <string name="swipe_to_refresh_summary">ÐекоÑоÑÑе веб-ÑайÑÑ Ð¼Ð¾Ð³ÑÑ ÑабоÑаÑÑ Ð½ÐµÐºÐ¾ÑÑекÑно пÑи вклÑÑении данной опÑии.</string> - <string name="download_with_external_app">ÐагÑÑзка во внеÑнем пÑиложении</string> + <string name="download_provider">ÐÑÐ¾Ð²Ð°Ð¹Ð´ÐµÑ Ð·Ð°Ð³ÑÑзки</string> + <string-array name="download_provider_entries"> + <item>Privacy Browser</item> + <item>ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ Ð·Ð°Ð³ÑÑзок Android</item> + <item>ÐнеÑнее пÑиложение</item> + </string-array> + <string name="download_with_privacy_browser">Privacy Browser - ÐÑÑÑоеннÑй загÑÑзÑик Privacy Browser пÑоÑÑ, но его пÑеимÑÑеÑÑво в Ñом, + ÑÑо он поддеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð¿ÑокÑи и иÑполÑзÑÐµÑ cookie (еÑли они вклÑÑенÑ), а Ñакже позволÑÐµÑ ÑÐ¾Ñ ÑанÑÑÑ Ð´Ð°Ð½Ð½Ñе: URL.</string> + <string name="download_with_android_download_manager">ÐÐµÐ½ÐµÐ´Ð¶ÐµÑ Ð·Ð°Ð³ÑÑзки Android - Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑ Ð·Ð°Ð³ÑÑзки Android не поддеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð½Ð°ÑÑÑойки пÑокÑи Privacy Browser, + но Ñ Ð½ÐµÐ³Ð¾ еÑÑÑ Ð´Ð¾ÑÑÑп к Ñайлам cookie (ÑÑо ознаÑаеÑ, ÑÑо ÑайлÑ, загÑÑженнÑе Ñ ÑайÑов, ÑÑебÑÑÑÐ¸Ñ Ð°Ð²ÑоÑизаÑии, бÑдÑÑ ÑабоÑаÑÑ).</string> + <string name="download_with_external_app">ÐнеÑнее пÑиложение - внеÑние пÑÐ¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ поддеÑживаÑÑ Ð½Ð°ÑÑÑойки пÑокÑи Privacy Browser и не имеÑÑ Ð´Ð¾ÑÑÑпа к Ñайлам cookie + (ÑÑо ознаÑаеÑ, ÑÑо ÑайлÑ, загÑÑженнÑе Ñ ÑайÑов, ÑÑебÑÑÑÐ¸Ñ Ð°Ð²ÑоÑизаÑии, вÑÑд ли бÑдÑÑ ÑабоÑаÑÑ).</string> <string name="scroll_app_bar">ÐÑокÑÑÑиваÑÑ Ð¿Ð°Ð½ÐµÐ»Ñ Ð¿ÑиложениÑ</string> <string name="scroll_app_bar_summary">ÐÑокÑÑÑÐ¸Ð²Ð°ÐµÑ Ð¿Ð°Ð½ÐµÐ»Ñ Ð¿ÑÐ¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð²Ð²ÐµÑÑ Ñ ÑкÑана пÑи пÑокÑÑÑке WebView вниз.</string> <string name="bottom_app_bar">ÐижнÑÑ Ð¿Ð°Ð½ÐµÐ»Ñ Ð¿ÑиложениÑ</string> diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 47c69780..441a17b3 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -531,7 +531,6 @@ <string name="open_intents_in_new_tab_summary">æç®æ é¾æ¥åéå°å ¶ä»åºç¨</string> <string name="swipe_to_refresh">ä¸æå·æ°</string> <string name="swipe_to_refresh_summary">ä¸æå·æ°å¼å¯æ¶é¨åç½é¡µä¸ä¼å·¥ä½</string> - <string name="download_with_external_app">ç±å¤é¨åºç¨ä¸è½½</string> <string name="scroll_app_bar">æ»å¨åºç¨æ </string> <string name="scroll_app_bar_summary">åä¸æ»å¨ç½é¡µæ¶ï¼éè顶é¨ç¶ææ </string> <string name="bottom_app_bar">åºé¨ç¶ææ </string> -- 2.47.2