LogViewerActivity: re-add error case to log export
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
0726b1b4d9
commit
a3a429bc41
@ -35,6 +35,7 @@ import com.wireguard.android.BuildConfig
|
|||||||
import com.wireguard.android.R
|
import com.wireguard.android.R
|
||||||
import com.wireguard.android.databinding.LogViewerActivityBinding
|
import com.wireguard.android.databinding.LogViewerActivityBinding
|
||||||
import com.wireguard.android.util.DownloadsFileSaver
|
import com.wireguard.android.util.DownloadsFileSaver
|
||||||
|
import com.wireguard.android.util.ErrorMessages
|
||||||
import com.wireguard.android.widget.EdgeToEdge.setUpFAB
|
import com.wireguard.android.widget.EdgeToEdge.setUpFAB
|
||||||
import com.wireguard.android.widget.EdgeToEdge.setUpRoot
|
import com.wireguard.android.widget.EdgeToEdge.setUpRoot
|
||||||
import com.wireguard.android.widget.EdgeToEdge.setUpScrollingContent
|
import com.wireguard.android.widget.EdgeToEdge.setUpScrollingContent
|
||||||
@ -169,17 +170,25 @@ class LogViewerActivity : AppCompatActivity() {
|
|||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
saveButton?.isEnabled = false
|
saveButton?.isEnabled = false
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val outputFile = DownloadsFileSaver.save(context, "wireguard-log.txt", "text/plain", true)
|
var exception: Throwable? = null
|
||||||
outputFile.outputStream.use {
|
var outputFile: DownloadsFileSaver.DownloadsFile? = null
|
||||||
it.write(rawLogLines.toString().toByteArray(Charsets.UTF_8))
|
try {
|
||||||
|
outputFile = DownloadsFileSaver.save(context, "wireguard-log.txt", "text/plain", true)
|
||||||
|
outputFile.outputStream.use {
|
||||||
|
it.write(rawLogLines.toString().toByteArray(Charsets.UTF_8))
|
||||||
|
}
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
outputFile?.delete()
|
||||||
|
exception = e
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
saveButton?.isEnabled = true
|
||||||
Snackbar.make(findViewById(android.R.id.content),
|
Snackbar.make(findViewById(android.R.id.content),
|
||||||
getString(R.string.log_export_success, outputFile.fileName),
|
if (exception == null) getString(R.string.log_export_success, outputFile?.fileName)
|
||||||
Snackbar.LENGTH_SHORT)
|
else getString(R.string.log_export_error, ErrorMessages.get(exception)),
|
||||||
|
if (exception == null) Snackbar.LENGTH_SHORT else Snackbar.LENGTH_LONG)
|
||||||
.setAnchorView(binding.shareFab)
|
.setAnchorView(binding.shareFab)
|
||||||
.show()
|
.show()
|
||||||
saveButton?.isEnabled = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
<string name="key_length_explanation_binary">: वायरगार्ड कीज 32 बाइट होनी चाहिए</string>
|
<string name="key_length_explanation_binary">: वायरगार्ड कीज 32 बाइट होनी चाहिए</string>
|
||||||
<string name="key_length_explanation_hex">: वायरगार्ड हेक्स कीज़ 64 अक्षरों की होनी चाहिए (32 बाइट्स)</string>
|
<string name="key_length_explanation_hex">: वायरगार्ड हेक्स कीज़ 64 अक्षरों की होनी चाहिए (32 बाइट्स)</string>
|
||||||
<string name="listen_port">पोर्ट सूने</string>
|
<string name="listen_port">पोर्ट सूने</string>
|
||||||
|
<string name="log_export_error">लॉग निर्यात करने में असमर्थ: %s</string>
|
||||||
<string name="log_export_success">“%s” में सहेजा गया</string>
|
<string name="log_export_success">“%s” में सहेजा गया</string>
|
||||||
<string name="log_export_title">लॉग फ़ाइल निर्यात करें</string>
|
<string name="log_export_title">लॉग फ़ाइल निर्यात करें</string>
|
||||||
<string name="logcat_error">लॉगकैट चलाने में असमर्थ: </string>
|
<string name="logcat_error">लॉगकैट चलाने में असमर्थ: </string>
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
<string name="key_length_explanation_binary">: Kunci WireGuard harus terdiri dari 32 bit</string>
|
<string name="key_length_explanation_binary">: Kunci WireGuard harus terdiri dari 32 bit</string>
|
||||||
<string name="key_length_explanation_hex">: Kunci hex WireGuard Harus terdiri dari 64 karakter (32 bit)</string>
|
<string name="key_length_explanation_hex">: Kunci hex WireGuard Harus terdiri dari 64 karakter (32 bit)</string>
|
||||||
<string name="listen_port">Isi port</string>
|
<string name="listen_port">Isi port</string>
|
||||||
|
<string name="log_export_error">Log tidak bisa diekspor: %s</string>
|
||||||
<string name="log_export_success">Simpan ke “%s”</string>
|
<string name="log_export_success">Simpan ke “%s”</string>
|
||||||
<string name="log_export_title">Ekspor file log</string>
|
<string name="log_export_title">Ekspor file log</string>
|
||||||
<string name="logcat_error">Tidak bisa menjalankan logcat: </string>
|
<string name="logcat_error">Tidak bisa menjalankan logcat: </string>
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
<string name="key_length_explanation_binary">: le chiavi di WireGuard devono essere di 32 byte</string>
|
<string name="key_length_explanation_binary">: le chiavi di WireGuard devono essere di 32 byte</string>
|
||||||
<string name="key_length_explanation_hex">: le chiavi hex di WireGuard devono essere di 64 caratteri (32 byte)</string>
|
<string name="key_length_explanation_hex">: le chiavi hex di WireGuard devono essere di 64 caratteri (32 byte)</string>
|
||||||
<string name="listen_port">Porta in ascolto</string>
|
<string name="listen_port">Porta in ascolto</string>
|
||||||
|
<string name="log_export_error">Impossibile esportare il registro: %s</string>
|
||||||
<string name="log_export_success">Salvato in “%s”</string>
|
<string name="log_export_success">Salvato in “%s”</string>
|
||||||
<string name="log_export_title">Esporta file registro</string>
|
<string name="log_export_title">Esporta file registro</string>
|
||||||
<string name="logcat_error">Impossibile eseguire logcat: </string>
|
<string name="logcat_error">Impossibile eseguire logcat: </string>
|
||||||
|
@ -84,6 +84,7 @@
|
|||||||
<string name="key_length_explanation_binary">: WireGuard 鍵は32バイトでなければなりません</string>
|
<string name="key_length_explanation_binary">: WireGuard 鍵は32バイトでなければなりません</string>
|
||||||
<string name="key_length_explanation_hex">: WireGuard hex 鍵は64文字(32バイト)でなければなりません</string>
|
<string name="key_length_explanation_hex">: WireGuard hex 鍵は64文字(32バイト)でなければなりません</string>
|
||||||
<string name="listen_port">Listen ポート</string>
|
<string name="listen_port">Listen ポート</string>
|
||||||
|
<string name="log_export_error">ログをエクスポートできません: %s</string>
|
||||||
<string name="log_export_success">“%s” に保存しました</string>
|
<string name="log_export_success">“%s” に保存しました</string>
|
||||||
<string name="log_export_title">ログのエクスポート</string>
|
<string name="log_export_title">ログのエクスポート</string>
|
||||||
<string name="logcat_error">logcat を実行できません: </string>
|
<string name="logcat_error">logcat を実行できません: </string>
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
<string name="key_length_explanation_binary">: Ключи WireGuard должны быть 32 байта</string>
|
<string name="key_length_explanation_binary">: Ключи WireGuard должны быть 32 байта</string>
|
||||||
<string name="key_length_explanation_hex">: HEX ключи WireGuard должны содержать 64 символа (32 байта)</string>
|
<string name="key_length_explanation_hex">: HEX ключи WireGuard должны содержать 64 символа (32 байта)</string>
|
||||||
<string name="listen_port">Порт</string>
|
<string name="listen_port">Порт</string>
|
||||||
|
<string name="log_export_error">Не удалось экспортировать логи: %s</string>
|
||||||
<string name="log_export_success">Сохранено в “%s”</string>
|
<string name="log_export_success">Сохранено в “%s”</string>
|
||||||
<string name="log_export_title">Экспорт логов в файл</string>
|
<string name="log_export_title">Экспорт логов в файл</string>
|
||||||
<string name="log_export_subject">Файл логов WireGuard Android</string>
|
<string name="log_export_subject">Файл логов WireGuard Android</string>
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
<string name="key_length_explanation_binary">:WireGuard 密钥大小必须为 32 字节</string>
|
<string name="key_length_explanation_binary">:WireGuard 密钥大小必须为 32 字节</string>
|
||||||
<string name="key_length_explanation_hex">:WireGuard 的十六进制密钥长度必须为 64 个字符(32 字节)</string>
|
<string name="key_length_explanation_hex">:WireGuard 的十六进制密钥长度必须为 64 个字符(32 字节)</string>
|
||||||
<string name="listen_port">监听端口</string>
|
<string name="listen_port">监听端口</string>
|
||||||
|
<string name="log_export_error">无法导出日志:%s</string>
|
||||||
<string name="log_export_success">已保存至 “%s”</string>
|
<string name="log_export_success">已保存至 “%s”</string>
|
||||||
<string name="log_export_title">导出日志文件</string>
|
<string name="log_export_title">导出日志文件</string>
|
||||||
<string name="logcat_error">无法运行 logcat:</string>
|
<string name="logcat_error">无法运行 logcat:</string>
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
</plurals>
|
</plurals>
|
||||||
<string name="add_peer">Add peer</string>
|
<string name="add_peer">Add peer</string>
|
||||||
<string name="addresses">Addresses</string>
|
<string name="addresses">Addresses</string>
|
||||||
<string name="allow_remote_control_intents_title">Allow remote control apps</string>
|
|
||||||
<string name="allow_remote_control_intents_summary_on">External apps may toggle tunnels (advanced)</string>
|
|
||||||
<string name="allow_remote_control_intents_summary_off">External apps may not toggle tunnels (recommended)</string>
|
<string name="allow_remote_control_intents_summary_off">External apps may not toggle tunnels (recommended)</string>
|
||||||
|
<string name="allow_remote_control_intents_summary_on">External apps may toggle tunnels (advanced)</string>
|
||||||
|
<string name="allow_remote_control_intents_title">Allow remote control apps</string>
|
||||||
<string name="allowed_ips">Allowed IPs</string>
|
<string name="allowed_ips">Allowed IPs</string>
|
||||||
<string name="app_name">WireGuard</string>
|
<string name="app_name">WireGuard</string>
|
||||||
<string name="bad_config_context">%1$s\'s %2$s</string>
|
<string name="bad_config_context">%1$s\'s %2$s</string>
|
||||||
@ -57,18 +57,17 @@
|
|||||||
<string name="config_save_success">Successfully saved configuration for “%s”</string>
|
<string name="config_save_success">Successfully saved configuration for “%s”</string>
|
||||||
<string name="create_activity_title">Create WireGuard Tunnel</string>
|
<string name="create_activity_title">Create WireGuard Tunnel</string>
|
||||||
<string name="create_bin_dir_error">Cannot create local binary directory</string>
|
<string name="create_bin_dir_error">Cannot create local binary directory</string>
|
||||||
|
<string name="create_downloads_file_error">Cannot create file in downloads directory</string>
|
||||||
<string name="create_empty">Create from scratch</string>
|
<string name="create_empty">Create from scratch</string>
|
||||||
<string name="create_from_file">Import from file or archive</string>
|
<string name="create_from_file">Import from file or archive</string>
|
||||||
<string name="create_from_qr_code">Scan from QR code</string>
|
<string name="create_from_qr_code">Scan from QR code</string>
|
||||||
<string name="create_output_dir_error">Cannot create output directory</string>
|
<string name="create_output_dir_error">Cannot create output directory</string>
|
||||||
<string name="create_downloads_file_error">Cannot create file in downloads directory</string>
|
|
||||||
<string name="create_temp_dir_error">Cannot create local temporary directory</string>
|
<string name="create_temp_dir_error">Cannot create local temporary directory</string>
|
||||||
<string name="create_tunnel">Create Tunnel</string>
|
<string name="create_tunnel">Create Tunnel</string>
|
||||||
<string name="dark_theme_summary_off">Currently using light (day) theme</string>
|
<string name="dark_theme_summary_off">Currently using light (day) theme</string>
|
||||||
<string name="dark_theme_summary_on">Currently using dark (night) theme</string>
|
<string name="dark_theme_summary_on">Currently using dark (night) theme</string>
|
||||||
<string name="dark_theme_title">Use dark theme</string>
|
<string name="dark_theme_title">Use dark theme</string>
|
||||||
<string name="delete">Delete</string>
|
<string name="delete">Delete</string>
|
||||||
<string name="toggle_all">Toggle All</string>
|
|
||||||
<string name="dns_servers">DNS servers</string>
|
<string name="dns_servers">DNS servers</string>
|
||||||
<string name="edit">Edit</string>
|
<string name="edit">Edit</string>
|
||||||
<string name="endpoint">Endpoint</string>
|
<string name="endpoint">Endpoint</string>
|
||||||
@ -89,29 +88,35 @@
|
|||||||
<string name="import_from_qr_code">Import Tunnel from QR Code</string>
|
<string name="import_from_qr_code">Import Tunnel from QR Code</string>
|
||||||
<string name="import_success">Imported “%s”</string>
|
<string name="import_success">Imported “%s”</string>
|
||||||
<string name="interface_title">Interface</string>
|
<string name="interface_title">Interface</string>
|
||||||
|
<string name="key_contents_error">Bad characters in key</string>
|
||||||
|
<string name="key_length_error">Incorrect key length</string>
|
||||||
<string name="key_length_explanation_base64">: WireGuard base64 keys must be 44 characters (32 bytes)</string>
|
<string name="key_length_explanation_base64">: WireGuard base64 keys must be 44 characters (32 bytes)</string>
|
||||||
<string name="key_length_explanation_binary">: WireGuard keys must be 32 bytes</string>
|
<string name="key_length_explanation_binary">: WireGuard keys must be 32 bytes</string>
|
||||||
<string name="key_length_explanation_hex">: WireGuard hex keys must be 64 characters (32 bytes)</string>
|
<string name="key_length_explanation_hex">: WireGuard hex keys must be 64 characters (32 bytes)</string>
|
||||||
<string name="listen_port">Listen port</string>
|
<string name="listen_port">Listen port</string>
|
||||||
|
<string name="log_export_error">Unable to export log: %s</string>
|
||||||
|
<string name="log_export_subject">WireGuard Android Log File</string>
|
||||||
<string name="log_export_success">Saved to “%s”</string>
|
<string name="log_export_success">Saved to “%s”</string>
|
||||||
<string name="log_export_title">Export log file</string>
|
<string name="log_export_title">Export log file</string>
|
||||||
<string name="log_export_subject">WireGuard Android Log File</string>
|
<string name="log_saver_activity_label">Save log</string>
|
||||||
|
<string name="log_viewer_pref_summary">Logs may assist with debugging</string>
|
||||||
|
<string name="log_viewer_pref_title">View application log</string>
|
||||||
|
<string name="log_viewer_title">Log</string>
|
||||||
<string name="logcat_error">Unable to run logcat: </string>
|
<string name="logcat_error">Unable to run logcat: </string>
|
||||||
<string name="module_version_error">Unable to determine kernel module version</string>
|
<string name="module_disabler_disabled_summary">The experimental kernel module can improve performance</string>
|
||||||
<string name="module_installer_not_found">No modules are available for your device</string>
|
<string name="module_disabler_disabled_title">Enable kernel module backend</string>
|
||||||
|
<string name="module_disabler_enabled_summary">The slower userspace backend may improve stability</string>
|
||||||
|
<string name="module_disabler_enabled_title">Disable kernel module backend</string>
|
||||||
|
<string name="module_installer_error">Something went wrong. Please try again</string>
|
||||||
<string name="module_installer_initial">The experimental kernel module can improve performance</string>
|
<string name="module_installer_initial">The experimental kernel module can improve performance</string>
|
||||||
|
<string name="module_installer_not_found">No modules are available for your device</string>
|
||||||
<string name="module_installer_title">Download and install kernel module</string>
|
<string name="module_installer_title">Download and install kernel module</string>
|
||||||
<string name="module_installer_working">Downloading and installing…</string>
|
<string name="module_installer_working">Downloading and installing…</string>
|
||||||
<string name="module_installer_error">Something went wrong. Please try again</string>
|
<string name="module_version_error">Unable to determine kernel module version</string>
|
||||||
<string name="module_disabler_disabled_title">Enable kernel module backend</string>
|
|
||||||
<string name="module_disabler_disabled_summary">The experimental kernel module can improve performance</string>
|
|
||||||
<string name="module_disabler_enabled_title">Disable kernel module backend</string>
|
|
||||||
<string name="module_disabler_enabled_summary">The slower userspace backend may improve stability</string>
|
|
||||||
<string name="success_application_will_restart">Success. The application will now restart…</string>
|
|
||||||
<string name="mtu">MTU</string>
|
<string name="mtu">MTU</string>
|
||||||
<string name="multiple_tunnels_title">Allow multiple simultaneous tunnels</string>
|
|
||||||
<string name="multiple_tunnels_summary_on">Multiple tunnels may be turned on simultaneously</string>
|
|
||||||
<string name="multiple_tunnels_summary_off">Turning on one tunnel will turn off others</string>
|
<string name="multiple_tunnels_summary_off">Turning on one tunnel will turn off others</string>
|
||||||
|
<string name="multiple_tunnels_summary_on">Multiple tunnels may be turned on simultaneously</string>
|
||||||
|
<string name="multiple_tunnels_title">Allow multiple simultaneous tunnels</string>
|
||||||
<string name="name">Name</string>
|
<string name="name">Name</string>
|
||||||
<string name="no_config_error">Trying to bring up a tunnel with no config</string>
|
<string name="no_config_error">Trying to bring up a tunnel with no config</string>
|
||||||
<string name="no_configs_error">No configurations found</string>
|
<string name="no_configs_error">No configurations found</string>
|
||||||
@ -131,8 +136,8 @@
|
|||||||
<string name="public_key">Public key</string>
|
<string name="public_key">Public key</string>
|
||||||
<string name="public_key_description">Public key</string>
|
<string name="public_key_description">Public key</string>
|
||||||
<string name="qr_code_hint">Tip: generate with `qrencode -t ansiutf8 < tunnel.conf`.</string>
|
<string name="qr_code_hint">Tip: generate with `qrencode -t ansiutf8 < tunnel.conf`.</string>
|
||||||
<string name="restore_on_boot_summary_on">Will bring up enabled tunnels at boot</string>
|
|
||||||
<string name="restore_on_boot_summary_off">Will not bring up enabled tunnels at boot</string>
|
<string name="restore_on_boot_summary_off">Will not bring up enabled tunnels at boot</string>
|
||||||
|
<string name="restore_on_boot_summary_on">Will bring up enabled tunnels at boot</string>
|
||||||
<string name="restore_on_boot_title">Restore on boot</string>
|
<string name="restore_on_boot_title">Restore on boot</string>
|
||||||
<string name="save">Save</string>
|
<string name="save">Save</string>
|
||||||
<string name="select_all">Select all</string>
|
<string name="select_all">Select all</string>
|
||||||
@ -141,6 +146,8 @@
|
|||||||
<string name="shell_exit_status_read_error">Shell cannot read exit status</string>
|
<string name="shell_exit_status_read_error">Shell cannot read exit status</string>
|
||||||
<string name="shell_marker_count_error">Shell expected 4 markers, received %d</string>
|
<string name="shell_marker_count_error">Shell expected 4 markers, received %d</string>
|
||||||
<string name="shell_start_error">Shell failed to start: %d</string>
|
<string name="shell_start_error">Shell failed to start: %d</string>
|
||||||
|
<string name="success_application_will_restart">Success. The application will now restart…</string>
|
||||||
|
<string name="toggle_all">Toggle All</string>
|
||||||
<string name="toggle_error">Error toggling WireGuard tunnel: %s</string>
|
<string name="toggle_error">Error toggling WireGuard tunnel: %s</string>
|
||||||
<string name="tools_installer_already">wg and wg-quick are already installed</string>
|
<string name="tools_installer_already">wg and wg-quick are already installed</string>
|
||||||
<string name="tools_installer_failure">Unable to install command-line tools (no root?)</string>
|
<string name="tools_installer_failure">Unable to install command-line tools (no root?)</string>
|
||||||
@ -153,11 +160,11 @@
|
|||||||
<string name="tools_installer_working">Installing wg and wg-quick</string>
|
<string name="tools_installer_working">Installing wg and wg-quick</string>
|
||||||
<string name="tools_unavailable_error">Required tools unavailable</string>
|
<string name="tools_unavailable_error">Required tools unavailable</string>
|
||||||
<string name="transfer">Transfer</string>
|
<string name="transfer">Transfer</string>
|
||||||
<string name="transfer_rx_tx">rx: %1$s, tx: %2$s</string>
|
|
||||||
<string name="transfer_bytes">%d B</string>
|
<string name="transfer_bytes">%d B</string>
|
||||||
|
<string name="transfer_gibibytes">%.2f GiB</string>
|
||||||
<string name="transfer_kibibytes">%.2f KiB</string>
|
<string name="transfer_kibibytes">%.2f KiB</string>
|
||||||
<string name="transfer_mibibytes">%.2f MiB</string>
|
<string name="transfer_mibibytes">%.2f MiB</string>
|
||||||
<string name="transfer_gibibytes">%.2f GiB</string>
|
<string name="transfer_rx_tx">rx: %1$s, tx: %2$s</string>
|
||||||
<string name="transfer_tibibytes">%.2f TiB</string>
|
<string name="transfer_tibibytes">%.2f TiB</string>
|
||||||
<string name="tun_create_error">Unable to create tun device</string>
|
<string name="tun_create_error">Unable to create tun device</string>
|
||||||
<string name="tunnel_config_error">Unable to configure tunnel (wg-quick returned %d)</string>
|
<string name="tunnel_config_error">Unable to configure tunnel (wg-quick returned %d)</string>
|
||||||
@ -183,10 +190,4 @@
|
|||||||
<string name="zip_export_success">Saved to “%s”</string>
|
<string name="zip_export_success">Saved to “%s”</string>
|
||||||
<string name="zip_export_summary">Zip file will be saved to downloads folder</string>
|
<string name="zip_export_summary">Zip file will be saved to downloads folder</string>
|
||||||
<string name="zip_export_title">Export tunnels to zip file</string>
|
<string name="zip_export_title">Export tunnels to zip file</string>
|
||||||
<string name="key_length_error">Incorrect key length</string>
|
|
||||||
<string name="key_contents_error">Bad characters in key</string>
|
|
||||||
<string name="log_viewer_title">Log</string>
|
|
||||||
<string name="log_viewer_pref_title">View application log</string>
|
|
||||||
<string name="log_viewer_pref_summary">Logs may assist with debugging</string>
|
|
||||||
<string name="log_saver_activity_label">Save log</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user