From 7aa751ca45ad17a93647c5d5530b1ea0937bf90f Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Fri, 1 Oct 2021 09:18:40 +1000 Subject: [PATCH] share log files in settings vc --- Session.xcodeproj/project.pbxproj | 4 ++ Session/Meta/AppEnvironment.swift | 11 +++ .../Translations/de.lproj/Localizable.strings | 3 + .../Translations/en.lproj/Localizable.strings | 3 + .../Translations/es.lproj/Localizable.strings | 3 + .../Translations/fa.lproj/Localizable.strings | 3 + .../Translations/fi.lproj/Localizable.strings | 3 + .../Translations/fr.lproj/Localizable.strings | 3 + .../Translations/hi.lproj/Localizable.strings | 3 + .../Translations/hr.lproj/Localizable.strings | 3 + .../id-ID.lproj/Localizable.strings | 3 + .../Translations/it.lproj/Localizable.strings | 3 + .../Translations/ja.lproj/Localizable.strings | 3 + .../Translations/nl.lproj/Localizable.strings | 3 + .../Translations/pl.lproj/Localizable.strings | 3 + .../pt_BR.lproj/Localizable.strings | 3 + .../Translations/ru.lproj/Localizable.strings | 3 + .../Translations/si.lproj/Localizable.strings | 3 + .../Translations/sk.lproj/Localizable.strings | 3 + .../Translations/sv.lproj/Localizable.strings | 3 + .../Translations/th.lproj/Localizable.strings | 3 + .../vi-VN.lproj/Localizable.strings | 3 + .../zh-Hant.lproj/Localizable.strings | 3 + .../zh_CN.lproj/Localizable.strings | 3 + Session/Settings/SettingsVC.swift | 19 +++++- Session/Settings/ShareLogsModal.swift | 68 +++++++++++++++++++ 26 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 Session/Settings/ShareLogsModal.swift diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 3bc7bd3d4..d2a18306b 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ 76EB054018170B33006006FC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB03C318170B33006006FC /* AppDelegate.m */; }; 7B4C75CB26B37E0F0000AC89 /* UnsendRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4C75CA26B37E0F0000AC89 /* UnsendRequest.swift */; }; 7B4C75CD26BB92060000AC89 /* DeletedMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4C75CC26BB92060000AC89 /* DeletedMessageView.swift */; }; + 7B7CB18B270591630079FF93 /* ShareLogsModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B7CB18A270591630079FF93 /* ShareLogsModal.swift */; }; 7BC01A3E241F40AB00BC7C55 /* NotificationServiceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC01A3D241F40AB00BC7C55 /* NotificationServiceExtension.swift */; }; 7BC01A42241F40AB00BC7C55 /* SessionNotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 7BC01A3B241F40AB00BC7C55 /* SessionNotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 7BDCFC08242186E700641C39 /* NotificationServiceExtensionContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BDCFC07242186E700641C39 /* NotificationServiceExtensionContext.swift */; }; @@ -1103,6 +1104,7 @@ 7B2DB2AD26F1B0FF0035B509 /* si */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = si; path = si.lproj/Localizable.strings; sourceTree = ""; }; 7B4C75CA26B37E0F0000AC89 /* UnsendRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsendRequest.swift; sourceTree = ""; }; 7B4C75CC26BB92060000AC89 /* DeletedMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeletedMessageView.swift; sourceTree = ""; }; + 7B7CB18A270591630079FF93 /* ShareLogsModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareLogsModal.swift; sourceTree = ""; }; 7BC01A3B241F40AB00BC7C55 /* SessionNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SessionNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 7BC01A3D241F40AB00BC7C55 /* NotificationServiceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationServiceExtension.swift; sourceTree = ""; }; 7BC01A3F241F40AB00BC7C55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -2772,6 +2774,7 @@ B886B4A62398B23E00211ABE /* QRCodeVC.swift */, B86BD08523399CEF000F5AE3 /* SeedModal.swift */, B8CCF6422397711F0091D419 /* SettingsVC.swift */, + 7B7CB18A270591630079FF93 /* ShareLogsModal.swift */, ); path = Settings; sourceTree = ""; @@ -4767,6 +4770,7 @@ 3496955D219B605E00DCFE74 /* PhotoCollectionPickerController.swift in Sources */, 34B0796D1FCF46B100E248C2 /* MainAppContext.m in Sources */, 34A8B3512190A40E00218A25 /* MediaAlbumView.swift in Sources */, + 7B7CB18B270591630079FF93 /* ShareLogsModal.swift in Sources */, 4C4AEC4520EC343B0020E72B /* DismissableTextField.swift in Sources */, 3496955E219B605E00DCFE74 /* PhotoLibrary.swift in Sources */, C3A76A8D25DB83F90074CB90 /* PermissionMissingModal.swift in Sources */, diff --git a/Session/Meta/AppEnvironment.swift b/Session/Meta/AppEnvironment.swift index 2aa581a91..805df0d81 100644 --- a/Session/Meta/AppEnvironment.swift +++ b/Session/Meta/AppEnvironment.swift @@ -36,6 +36,9 @@ import SignalUtilitiesKit @objc public var backup: OWSBackup + + @objc + public var fileLogger: DDFileLogger // Stored properties cannot be marked as `@available`, only classes and functions. // Instead, store a private `Any` and wrap it with a public `@available` getter @@ -56,6 +59,7 @@ import SignalUtilitiesKit self.backup = OWSBackup() self.backupLazyRestore = BackupLazyRestore() self._userNotificationActionHandler = UserNotificationActionHandler() + self.fileLogger = DDFileLogger() super.init() @@ -66,5 +70,12 @@ import SignalUtilitiesKit public func setup() { // Hang certain singletons on SSKEnvironment too. SSKEnvironment.shared.notificationsManager = notificationPresenter + setupLogFiles() + } + + private func setupLogFiles() { + fileLogger.rollingFrequency = kDayInterval // Refresh everyday + fileLogger.logFileManager.maximumNumberOfLogFiles = 3 // Save 3 days' log files + DDLog.add(fileLogger) } } diff --git a/Session/Meta/Translations/de.lproj/Localizable.strings b/Session/Meta/Translations/de.lproj/Localizable.strings index 50b71fb77..75a37c6a9 100644 --- a/Session/Meta/Translations/de.lproj/Localizable.strings +++ b/Session/Meta/Translations/de.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Link-Vorschau aktivieren?"; "modal_link_previews_explanation" = "Das Aktivieren von Link-Vorschauen zeigt Vorschaubilder für URLs, die Sie senden und empfangen. Dies kann nützlich sein, aber Session muss verlinkte Webseiten kontaktieren, um Vorschaubilder zu generieren. Du kannst die Link-Vorschau in den Session-Einstellungen immer deaktivieren."; "modal_link_previews_button_title" = "Aktivieren"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Mit Session teilen"; "vc_share_loading_message" = "Anlagen werden vorbereitet..."; "vc_share_sending_message" = "Wird gesendet ..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Mitglieder hinzufügen"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index d5f10cc5b..86277878a 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Enable Link Previews?"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "Enable"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Share to Session"; "vc_share_loading_message" = "Preparing attachments..."; "vc_share_sending_message" = "Sending..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Add Members"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/es.lproj/Localizable.strings b/Session/Meta/Translations/es.lproj/Localizable.strings index 4317d8ca7..11726392c 100644 --- a/Session/Meta/Translations/es.lproj/Localizable.strings +++ b/Session/Meta/Translations/es.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "¿Habilitar Previsualizaciones de Enlace?"; "modal_link_previews_explanation" = "Activar vista previa de enlaces mostrará las vistas previas para las URL que envíe y reciba. Esto puede ser útil, pero Session tendrá que ponerse en contacto con los sitios web enlazados para generar vistas previas. Siempre puedes desactivar las vistas previas de enlaces en la configuración de Session."; "modal_link_previews_button_title" = "Activar"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Compartir en Session"; "vc_share_loading_message" = "Preparando archivos adjuntos..."; "vc_share_sending_message" = "Enviando..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Añadir Miembros"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/fa.lproj/Localizable.strings b/Session/Meta/Translations/fa.lproj/Localizable.strings index 7f2645bbe..eb1e06929 100644 --- a/Session/Meta/Translations/fa.lproj/Localizable.strings +++ b/Session/Meta/Translations/fa.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "فعال‌سازی پیش‌نمایش لینک؟"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "فعال سازی"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "اشتراک گذاری با Session"; "vc_share_loading_message" = "آماده سازی پیوست‌ها..."; "vc_share_sending_message" = "در حال ارسال..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Add Members"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/fi.lproj/Localizable.strings b/Session/Meta/Translations/fi.lproj/Localizable.strings index 319c43001..630a92fc6 100644 --- a/Session/Meta/Translations/fi.lproj/Localizable.strings +++ b/Session/Meta/Translations/fi.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Ota linkkien esikatselu käyttöön?"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "Ota käyttöön"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Jaa Sessioniin"; "vc_share_loading_message" = "Valmistellaan liitteitä..."; "vc_share_sending_message" = "Lähetetään..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Lisää jäseniä"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/fr.lproj/Localizable.strings b/Session/Meta/Translations/fr.lproj/Localizable.strings index 81a7d62d9..3904fc388 100644 --- a/Session/Meta/Translations/fr.lproj/Localizable.strings +++ b/Session/Meta/Translations/fr.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Activer les aperçus de lien?"; "modal_link_previews_explanation" = "L'activation des aperçus de lien affichera des aperçus pour les URL que vous envoyez et recevez. Cela peut être utile, mais Session devra contacter les sites Web liés pour générer des aperçus. Vous pouvez toujours désactiver les aperçus de lien dans les paramètres de Session."; "modal_link_previews_button_title" = "Activer"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Partager en Session"; "vc_share_loading_message" = "Préparation des pièces jointes ..."; "vc_share_sending_message" = "Envoi..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Ajouter des membres"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/hi.lproj/Localizable.strings b/Session/Meta/Translations/hi.lproj/Localizable.strings index 01a613910..5fb80be9c 100644 --- a/Session/Meta/Translations/hi.lproj/Localizable.strings +++ b/Session/Meta/Translations/hi.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "लिंक पूर्वावलोकन सक्षम करें?"; "modal_link_previews_explanation" = "लिंक पूर्वावलोकन सक्षम करने से आपके द्वारा भेजे और प्राप्त किए जाने वाले URL के पूर्वावलोकन दिखाई देंगे. यह उपयोगी हो सकता है, लेकिन Session को पूर्वावलोकन उत्पन्न करने के लिए लिंक की गई वेबसाइटों से संपर्क करने की आवश्यकता होगी। आप कभी भी Session की सेटिंग में लिंक पूर्वावलोकन अक्षम कर सकते हैं।"; "modal_link_previews_button_title" = "सक्षम करें"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "सत्र में साझा करें"; "vc_share_loading_message" = "अटैचमेंट तैयार किए जा रहे हैं..."; "vc_share_sending_message" = "भेजा जा रहा है..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "सदस्य जोड़ें"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/hr.lproj/Localizable.strings b/Session/Meta/Translations/hr.lproj/Localizable.strings index 67906feec..f00a6d2b1 100644 --- a/Session/Meta/Translations/hr.lproj/Localizable.strings +++ b/Session/Meta/Translations/hr.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Omogući preglede poveznica?"; "modal_link_previews_explanation" = "Omogućavanjem pregleda poveznica prikazat će se pregledi za URL-ove koje šaljete i primate. To može biti korisno, ali Session će trebati kontaktirati povezane web stranice kako bi generirao preglede. Uvijek možete onemogućiti preglede poveznica u postavkama Session-a."; "modal_link_previews_button_title" = "Uključi"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Podijeli sa Session-om"; "vc_share_loading_message" = "Priprema privitaka..."; "vc_share_sending_message" = "Slanje..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Dodaj članove"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/id-ID.lproj/Localizable.strings b/Session/Meta/Translations/id-ID.lproj/Localizable.strings index 24b7fbfb7..27f04eb17 100644 --- a/Session/Meta/Translations/id-ID.lproj/Localizable.strings +++ b/Session/Meta/Translations/id-ID.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Enable Link Previews?"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "Enable"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Share to Session"; "vc_share_loading_message" = "Preparing attachments..."; "vc_share_sending_message" = "Sending..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Add Members"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/it.lproj/Localizable.strings b/Session/Meta/Translations/it.lproj/Localizable.strings index fdce7ea5a..8d98bbe76 100644 --- a/Session/Meta/Translations/it.lproj/Localizable.strings +++ b/Session/Meta/Translations/it.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Abilitare Anteprima Link?"; "modal_link_previews_explanation" = "Abilitando le anteprime dei collegamenti Session mostrerà le anteprime degli URL che invii e ricevi. Questo può essere utile, ma Session dovrà contattare i siti web collegati per generare le anteprime. Puoi sempre disabilitare le anteprime dei link nelle impostazioni di Session."; "modal_link_previews_button_title" = "Abilita"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Condividi con Session"; "vc_share_loading_message" = "Preparazione allegati..."; "vc_share_sending_message" = "Invio..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Aggiungi membri"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/ja.lproj/Localizable.strings b/Session/Meta/Translations/ja.lproj/Localizable.strings index b5392771a..aa668b546 100644 --- a/Session/Meta/Translations/ja.lproj/Localizable.strings +++ b/Session/Meta/Translations/ja.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "リンクプレビューを有効にしますか?"; "modal_link_previews_explanation" = "リンクプレビューを有効すると、URLを送受信する場合にプレビューが表示されます。これは便利ですが、プレビューを作成するのにSessionはそのウェブサイトに接続する必要があります。Sessionの設定から、リンクプレビューをいつでも無効にできます。"; "modal_link_previews_button_title" = "有効にする"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Sessionと共有"; "vc_share_loading_message" = "添付ファイルを準備しています..."; "vc_share_sending_message" = "送信中…"; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "メンバーを追加する"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/nl.lproj/Localizable.strings b/Session/Meta/Translations/nl.lproj/Localizable.strings index c47613ed3..256148640 100644 --- a/Session/Meta/Translations/nl.lproj/Localizable.strings +++ b/Session/Meta/Translations/nl.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Linkvoorbeeld inschakelen?"; "modal_link_previews_explanation" = "Link previews inschakelen zal previews tonen voor URLs die u verstuurt en ontvangt. Dit kan nuttig zijn, maar Session moet contact opnemen met gekoppelde websites om previews te genereren. U kunt links altijd uitschakelen in de Session’s-instellingen."; "modal_link_previews_button_title" = "Inschakelen"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Delen naar de Session"; "vc_share_loading_message" = "Bijlagen voorbereiden..."; "vc_share_sending_message" = "Aan het verzenden..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Voeg deelnemers toe"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/pl.lproj/Localizable.strings b/Session/Meta/Translations/pl.lproj/Localizable.strings index 560858e0f..bcfe6f24f 100644 --- a/Session/Meta/Translations/pl.lproj/Localizable.strings +++ b/Session/Meta/Translations/pl.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Włączyć podgląd linków?"; "modal_link_previews_explanation" = "Włączanie podglądów linków wyświetli podgląd dla adresów URL które wysyłasz i otrzymujesz. Może to być użyteczne, ale Session będzie musiał się połączyć ze stronami których linki wysyłasz aby wygenerować podgląd. Możesz zawsze wyłączyć podgląd linków w ustawieniach Session."; "modal_link_previews_button_title" = "Włącz"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Udostępnij w Session"; "vc_share_loading_message" = "Przygotowywanie załączników..."; "vc_share_sending_message" = "Wysyłanie..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Dodaj użytkowników"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings index e315fbc08..d01dc8ae8 100644 --- a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings +++ b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Ativar pré-visualizações de link?"; "modal_link_previews_explanation" = "Ativar a pré-visualização de links irá mostrar as URLs que você receber e enviar. Isto pode ser útil, o Session precisa se conectar aos sites vinculados gerar as prévias. Você poderá desabiliatar esta opção nas configurações do Session."; "modal_link_previews_button_title" = "Ativar"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Compartilhar no Session"; "vc_share_loading_message" = "Preparando anexos..."; "vc_share_sending_message" = "Enviando..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Adicionar Membros"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/ru.lproj/Localizable.strings b/Session/Meta/Translations/ru.lproj/Localizable.strings index 56b90b7ef..7638277bf 100644 --- a/Session/Meta/Translations/ru.lproj/Localizable.strings +++ b/Session/Meta/Translations/ru.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Включить предварительный просмотр ссылок?"; "modal_link_previews_explanation" = "Включение предпросмотра ссылок покажет превью для отправляемых и получаемых ссылок. Это может быть полезно, но Session нужно будет соединиться с сайтами, связанными с ссылками, чтобы сгенерировать предпросмотр. Вы всегда можете отключить предпросмотр ссылок в настройках Session."; "modal_link_previews_button_title" = "Включить"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Поделиться в Session"; "vc_share_loading_message" = "Подготовка вложений..."; "vc_share_sending_message" = "Отправка..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Добавить участников"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/si.lproj/Localizable.strings b/Session/Meta/Translations/si.lproj/Localizable.strings index d5f10cc5b..86277878a 100644 --- a/Session/Meta/Translations/si.lproj/Localizable.strings +++ b/Session/Meta/Translations/si.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Enable Link Previews?"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "Enable"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Share to Session"; "vc_share_loading_message" = "Preparing attachments..."; "vc_share_sending_message" = "Sending..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Add Members"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/sk.lproj/Localizable.strings b/Session/Meta/Translations/sk.lproj/Localizable.strings index f7f2222d1..a576bf501 100644 --- a/Session/Meta/Translations/sk.lproj/Localizable.strings +++ b/Session/Meta/Translations/sk.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Povoliť náhľad odkazov?"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "Povoliť"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Share to Session"; "vc_share_loading_message" = "Pripravujú sa prílohy..."; "vc_share_sending_message" = "Odosiela sa..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Pridať členov"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/sv.lproj/Localizable.strings b/Session/Meta/Translations/sv.lproj/Localizable.strings index 8a36b41ff..9cb625b39 100644 --- a/Session/Meta/Translations/sv.lproj/Localizable.strings +++ b/Session/Meta/Translations/sv.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Aktivera förhandsgranskningar av länkar?"; "modal_link_previews_explanation" = "Om du aktiverar länkförhandsvisningar visas förhandsvisningar för URL: er du skickar och tar emot. Detta kan vara användbart, men sessionen måste kontakta länkade webbplatser för att generera förhandsvisningar. Du kan alltid inaktivera länkförhandsvisningar i sessionsinställningarna."; "modal_link_previews_button_title" = "Aktivera"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Dela i Session"; "vc_share_loading_message" = "Förbereder bilagor..."; "vc_share_sending_message" = "Skickar..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Lägg till medlemmar"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/th.lproj/Localizable.strings b/Session/Meta/Translations/th.lproj/Localizable.strings index aeb9632f3..154ddbf7f 100644 --- a/Session/Meta/Translations/th.lproj/Localizable.strings +++ b/Session/Meta/Translations/th.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "เปิดใช้งานการแสดงตัวอย่างลิงค์"; "modal_link_previews_explanation" = "การเปิดใช้งานการแสดงตัวอย่างลิงค์จะแสดงตัวอย่างสำหรับ URL ที่คุณส่งและรับ สิ่งนี้มีประโยชน์ แต่Sessionจะต้องติดต่อเว็บไซต์ที่เชื่อมโยงเพื่อสร้างตัวอย่าง คุณสามารถปิดการแสดงตัวอย่างลิงก์ได้ตลอดเวลาในการตั้งค่าของSession"; "modal_link_previews_button_title" = "เปิดใช้งาน"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "เชิญมาใช้ Session"; "vc_share_loading_message" = "รวบรวมสิ่งแนบ..."; "vc_share_sending_message" = "กำลังส่ง..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "เพิ่มสมาชิก"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings index de5deaede..fe322da91 100644 --- a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings +++ b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "Enable Link Previews?"; "modal_link_previews_explanation" = "Enabling link previews will show previews for URLs you send and receive. This can be useful, but Session will need to contact linked websites to generate previews. You can always disable link previews in Session's settings."; "modal_link_previews_button_title" = "Enable"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "Share to Session"; "vc_share_loading_message" = "Preparing attachments..."; "vc_share_sending_message" = "Sending..."; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "Add Members"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings index e337ac3bf..25e63d471 100644 --- a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "是否要啟用連結預覽?"; "modal_link_previews_explanation" = "啟用連結預覽將會讓您送出與接收的 URLs 啟用預覽,這是一項好用的功能,但是 Session 會需要連結這些網站來產生預覽,您可以隨時關閉連結預覽功能。"; "modal_link_previews_button_title" = "啟用"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "分享至 Session"; "vc_share_loading_message" = "準備附件中⋯"; "vc_share_sending_message" = "傳送中⋯"; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "新增成員"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings index 2e01912ef..810a534ad 100644 --- a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings @@ -538,6 +538,8 @@ "modal_link_previews_title" = "是否启用链接预览?"; "modal_link_previews_explanation" = "链接预览将为您发送或收到的URL生成预览内容。 该功能非常实用,但Session需要访问该链接指向的网站以生成预览。您可以随后在会话设置中禁用该功能。"; "modal_link_previews_button_title" = "启用"; +"modal_share_logs_title" = "Share Logs"; +"modal_share_logs_explanation" = "Would you like to export your application logs to be able to share for troubleshooting?"; "vc_share_title" = "分享到 Session"; "vc_share_loading_message" = "正在准备附件......"; "vc_share_sending_message" = "正在发送…"; @@ -545,6 +547,7 @@ "vc_conversation_settings_invite_button_title" = "添加成员"; "vc_settings_faq_button_title" = "FAQ"; "vc_settings_survey_button_title" = "Feedback / Survey"; +"vc_settings_support_button_title" = "Support"; "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; diff --git a/Session/Settings/SettingsVC.swift b/Session/Settings/SettingsVC.swift index 45eb282c3..53febc939 100644 --- a/Session/Settings/SettingsVC.swift +++ b/Session/Settings/SettingsVC.swift @@ -1,3 +1,4 @@ +import UIKit final class SettingsVC : BaseVC, AvatarViewHelperDelegate { private var profilePictureToBeUploaded: UIImage? @@ -90,6 +91,15 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { return result }() + private lazy var supportButton: UIButton = { + let result = UIButton() + result.setTitle(NSLocalizedString("vc_settings_support_button_title", comment: ""), for: UIControl.State.normal) + result.setTitleColor(Colors.text, for: UIControl.State.normal) + result.titleLabel!.font = .boldSystemFont(ofSize: Values.smallFontSize) + result.addTarget(self, action: #selector(shareLogs), for: UIControl.Event.touchUpInside) + return result + }() + private lazy var helpTranslateButton: UIButton = { let result = UIButton() result.setTitle(NSLocalizedString("vc_settings_help_us_translate_button_title", comment: ""), for: UIControl.State.normal) @@ -187,7 +197,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { logoContainer.pin(.bottom, to: .bottom, of: logoImageView) logoImageView.centerXAnchor.constraint(equalTo: logoContainer.centerXAnchor, constant: -2).isActive = true // Main stack view - let stackView = UIStackView(arrangedSubviews: [ topStackView, settingButtonsStackView, inviteButton, faqButton, surveyButton, helpTranslateButton, logoContainer, versionLabel ]) + let stackView = UIStackView(arrangedSubviews: [ topStackView, settingButtonsStackView, inviteButton, faqButton, surveyButton, supportButton, helpTranslateButton, logoContainer, versionLabel ]) stackView.axis = .vertical stackView.spacing = Values.largeSpacing stackView.alignment = .fill @@ -487,6 +497,13 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { UIApplication.shared.open(url) } + @objc private func shareLogs() { + let shareLogsModal = ShareLogsModal() + shareLogsModal.modalPresentationStyle = .overFullScreen + shareLogsModal.modalTransitionStyle = .crossDissolve + present(shareLogsModal, animated: true, completion: nil) + } + @objc private func helpTranslate() { let url = URL(string: "https://crowdin.com/project/session-ios")! UIApplication.shared.open(url) diff --git a/Session/Settings/ShareLogsModal.swift b/Session/Settings/ShareLogsModal.swift new file mode 100644 index 000000000..9e8408528 --- /dev/null +++ b/Session/Settings/ShareLogsModal.swift @@ -0,0 +1,68 @@ +import SignalUtilitiesKit + +final class ShareLogsModal : Modal { + + // MARK: Lifecycle + init() { + super.init(nibName: nil, bundle: nil) + } + + override init(nibName: String?, bundle: Bundle?) { + preconditionFailure("Use init(url:) instead.") + } + + required init?(coder: NSCoder) { + preconditionFailure("Use init(url:) instead.") + } + + override func populateContentView() { + // Title + let titleLabel = UILabel() + titleLabel.textColor = Colors.text + titleLabel.font = .boldSystemFont(ofSize: Values.largeFontSize) + titleLabel.text = NSLocalizedString("modal_share_logs_title", comment: "") + titleLabel.textAlignment = .center + // Message + let messageLabel = UILabel() + messageLabel.textColor = Colors.text.withAlphaComponent(Values.mediumOpacity) + messageLabel.font = .systemFont(ofSize: Values.smallFontSize) + messageLabel.text = NSLocalizedString("modal_share_logs_explanation", comment: "") + messageLabel.numberOfLines = 0 + messageLabel.lineBreakMode = .byWordWrapping + messageLabel.textAlignment = .center + // Open button + let shareButton = UIButton() + shareButton.set(.height, to: Values.mediumButtonHeight) + shareButton.layer.cornerRadius = Modal.buttonCornerRadius + shareButton.backgroundColor = Colors.buttonBackground + shareButton.titleLabel!.font = .systemFont(ofSize: Values.smallFontSize) + shareButton.setTitleColor(Colors.text, for: UIControl.State.normal) + shareButton.setTitle(NSLocalizedString("share", comment: ""), for: UIControl.State.normal) + shareButton.addTarget(self, action: #selector(shareLogs), for: UIControl.Event.touchUpInside) + // Button stack view + let buttonStackView = UIStackView(arrangedSubviews: [ cancelButton, shareButton ]) + buttonStackView.axis = .horizontal + buttonStackView.spacing = Values.mediumSpacing + buttonStackView.distribution = .fillEqually + // Main stack view + let mainStackView = UIStackView(arrangedSubviews: [ titleLabel, messageLabel, buttonStackView ]) + mainStackView.axis = .vertical + mainStackView.spacing = Values.largeSpacing + contentView.addSubview(mainStackView) + mainStackView.pin(.leading, to: .leading, of: contentView, withInset: Values.largeSpacing) + mainStackView.pin(.top, to: .top, of: contentView, withInset: Values.largeSpacing) + contentView.pin(.trailing, to: .trailing, of: mainStackView, withInset: Values.largeSpacing) + contentView.pin(.bottom, to: .bottom, of: mainStackView, withInset: Values.largeSpacing) + } + + // MARK: Interaction + @objc private func shareLogs() { + let logFilePaths = AppEnvironment.shared.fileLogger.logFileManager.sortedLogFilePaths + if let latestLogFilePath = logFilePaths.last { + let latestLogFileURL = URL(fileURLWithPath: latestLogFilePath) + self.dismiss(animated: true, completion: { + AttachmentSharing.showShareUI(for: latestLogFileURL) + }) + } + } +}