Merge pull request #513 from RyanRory/1.11.17-fixes

Bug fixes and Improvements for 1.11.17
This commit is contained in:
RyanZhao 2021-10-04 16:22:59 +11:00 committed by GitHub
commit bafb4f6e3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 282 additions and 51 deletions

View File

@ -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 = "<group>"; };
7B4C75CA26B37E0F0000AC89 /* UnsendRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsendRequest.swift; sourceTree = "<group>"; };
7B4C75CC26BB92060000AC89 /* DeletedMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeletedMessageView.swift; sourceTree = "<group>"; };
7B7CB18A270591630079FF93 /* ShareLogsModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareLogsModal.swift; sourceTree = "<group>"; };
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 = "<group>"; };
7BC01A3F241F40AB00BC7C55 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@ -2772,6 +2774,7 @@
B886B4A62398B23E00211ABE /* QRCodeVC.swift */,
B86BD08523399CEF000F5AE3 /* SeedModal.swift */,
B8CCF6422397711F0091D419 /* SettingsVC.swift */,
7B7CB18A270591630079FF93 /* ShareLogsModal.swift */,
);
path = Settings;
sourceTree = "<group>";
@ -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 */,

View File

@ -167,7 +167,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
Storage.read { transaction in
unreadCount = self.thread.unreadMessageCount(transaction: transaction)
}
let clampedUnreadCount = min(unreadCount, UInt(kConversationInitialMaxRangeSize))
let clampedUnreadCount = min(unreadCount, UInt(kConversationInitialMaxRangeSize), UInt(viewItems.endIndex))
unreadViewItems = clampedUnreadCount != 0 ? [ConversationViewItem](viewItems[viewItems.endIndex - Int(clampedUnreadCount) ..< viewItems.endIndex]) : []
}
@ -443,6 +443,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
func markAllAsRead() {
guard let lastSortID = viewItems.last?.interaction.sortId else { return }
OWSReadReceiptManager.shared().markAsReadLocally(beforeSortId: lastSortID, thread: thread)
SSKEnvironment.shared.disappearingMessagesJob.cleanupMessagesWhichFailedToStartExpiringFromNow()
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {

View File

@ -167,7 +167,7 @@ final class QuoteView : UIView {
if !hasAttachments {
mainStackView.addArrangedSubview(lineView)
} else {
let isAudio = MIMETypeUtil.isAudio(attachments.first!.contentType!)
let isAudio = MIMETypeUtil.isAudio(attachments.first!.contentType ?? "")
let fallbackImageName = isAudio ? "attachment_audio" : "actionsheet_document_black"
let fallbackImage = UIImage(named: fallbackImageName)?.withTint(.white)?.resizedImage(to: CGSize(width: iconSize, height: iconSize))
let imageView = UIImageView(image: thumbnail ?? fallbackImage)

View File

@ -37,6 +37,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
private var _userNotificationActionHandler: Any?
@ -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)
}
}

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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 Sessions-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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -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";

View File

@ -181,6 +181,7 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
let senderName = Storage.shared.getContact(with: incomingMessage.authorId, using: transaction)?.displayName(for: context) ?? incomingMessage.authorId
let notificationTitle: String?
let previewType = preferences.notificationPreviewType(with: transaction)
switch previewType {
case .noNameNoPreview:
notificationTitle = nil

View File

@ -108,15 +108,6 @@ extension UserNotificationPresenterAdaptee: NotificationPresenterAdaptee {
cancelNotification(identifier: notificationIdentifier)
}
let trigger: UNNotificationTrigger?
let checkForCancel = category == .incomingMessage
if checkForCancel {
assert(userInfo[AppNotificationUserInfoKey.threadId] != nil)
trigger = UNTimeIntervalNotificationTrigger(timeInterval: kNotificationDelayForRemoteRead, repeats: false)
} else {
trigger = nil
}
if shouldPresentNotification(category: category, userInfo: userInfo) {
if let displayableTitle = title?.filterForDisplay {
content.title = displayableTitle
@ -129,7 +120,7 @@ extension UserNotificationPresenterAdaptee: NotificationPresenterAdaptee {
Logger.debug("supressing notification body")
}
let request = UNNotificationRequest(identifier: notificationIdentifier, content: content, trigger: trigger)
let request = UNNotificationRequest(identifier: notificationIdentifier, content: content, trigger: nil)
Logger.debug("presenting notification with identifier: \(notificationIdentifier)")
notificationCenter.add(request)

View File

@ -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)

View File

@ -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)
})
}
}
}

View File

@ -25,8 +25,8 @@ extension Storage {
@objc(setContact:usingTransaction:)
public func setContact(_ contact: Contact, using transaction: Any) {
let oldContact = getContact(with: contact.sessionID)
let transaction = transaction as! YapDatabaseReadWriteTransaction
let oldContact = getContact(with: contact.sessionID, using: transaction)
if contact.sessionID == getUserHexEncodedPublicKey() {
contact.isTrusted = true // Always trust ourselves
}

View File

@ -32,8 +32,9 @@ extension Storage {
var recipients: [String] = []
if let syncTarget = message.syncTarget {
recipients.append(syncTarget)
} else if let thread = thread as? TSGroupThread, thread.isClosedGroup {
recipients = thread.groupModel.groupMemberIds
} else if let thread = thread as? TSGroupThread {
if thread.isClosedGroup { recipients = thread.groupModel.groupMemberIds }
else { recipients.append(LKGroupUtilities.getDecodedGroupID(thread.groupModel.groupId)) }
}
recipients.forEach { recipient in
tsOutgoingMessage.update(withSentRecipient: recipient, wasSentByUD: true, transaction: transaction)

View File

@ -39,7 +39,7 @@ extension Storage {
guard let userPublicKey = getUserPublicKey() else { return nil }
var result: Contact?
Storage.read { transaction in
result = Storage.shared.getContact(with: userPublicKey)
result = Storage.shared.getContact(with: userPublicKey, using: transaction)
}
return result
}

View File

@ -278,15 +278,8 @@ NSString *const TSLazyRestoreAttachmentsGroup = @"TSLazyRestoreAttachmentsGroup"
TSThread *thread1 = (TSThread *)object1;
TSThread *thread2 = (TSThread *)object2;
if ([group isEqualToString:TSArchiveGroup] || [group isEqualToString:TSInboxGroup]) {
TSInteraction *_Nullable lastInteractionForInbox1 =
[thread1 lastInteractionForInboxWithTransaction:transaction];
NSDate *date1 = lastInteractionForInbox1 ? lastInteractionForInbox1.receivedAtDate : thread1.creationDate;
TSInteraction *_Nullable lastInteractionForInbox2 =
[thread2 lastInteractionForInboxWithTransaction:transaction];
NSDate *date2 = lastInteractionForInbox2 ? lastInteractionForInbox2.receivedAtDate : thread2.creationDate;
NSDate *date1 = thread1.lastInteractionDate ?: thread1.creationDate;
NSDate *date2 = thread2.lastInteractionDate ?: thread2.creationDate;
return [date1 compare:date2];
}

View File

@ -7,6 +7,8 @@ public final class JobQueue : NSObject, JobDelegate {
internal static var currentlyExecutingJobs: Set<String> = []
private let internalQueue: DispatchQueue = DispatchQueue(label:"executingJobQueue")
@objc public static let shared = JobQueue()
@objc public func add(_ job: Job, using transaction: Any) {
@ -47,7 +49,7 @@ public final class JobQueue : NSObject, JobDelegate {
}
public func handleJobSucceeded(_ job: Job) {
given(job.id) { JobQueue.currentlyExecutingJobs.remove($0) }
given(job.id) { removeExecutingJob($0) }
SNMessagingKitConfiguration.shared.storage.write(with: { transaction in
SNMessagingKitConfiguration.shared.storage.markJobAsSucceeded(job, using: transaction)
}, completion: {
@ -56,7 +58,7 @@ public final class JobQueue : NSObject, JobDelegate {
}
public func handleJobFailed(_ job: Job, with error: Error) {
given(job.id) { JobQueue.currentlyExecutingJobs.remove($0) }
given(job.id) { removeExecutingJob($0) }
job.failureCount += 1
let storage = SNMessagingKitConfiguration.shared.storage
guard !storage.isJobCanceled(job) else { return SNLog("\(type(of: job)) canceled.") }
@ -78,7 +80,7 @@ public final class JobQueue : NSObject, JobDelegate {
}
public func handleJobFailedPermanently(_ job: Job, with error: Error) {
given(job.id) { JobQueue.currentlyExecutingJobs.remove($0) }
given(job.id) { removeExecutingJob($0) }
job.failureCount += 1
let storage = SNMessagingKitConfiguration.shared.storage
storage.write(with: { transaction in
@ -92,6 +94,10 @@ public final class JobQueue : NSObject, JobDelegate {
})
}
private func removeExecutingJob(_ jobID: String) {
let _ = internalQueue.sync { JobQueue.currentlyExecutingJobs.remove(jobID) }
}
private func getRetryInterval(for job: Job) -> TimeInterval {
// Arbitrary backoff factor...
// try 1 delay: 0.5s

View File

@ -243,6 +243,6 @@ extension ConfigurationMessage {
}
}
public override var description: String { displayName! }
public override var description: String { displayName ?? "" }
}
}

View File

@ -49,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
// and continue cleaning in the background.
- (void)startIfNecessary;
- (void)cleanupMessagesWhichFailedToStartExpiringFromNow;
- (void)cleanupMessagesWhichFailedToStartExpiringWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
@end

View File

@ -329,6 +329,17 @@ void AssertIsOnDisappearingMessagesQueue()
#pragma mark - Cleanup
- (void)cleanupMessagesWhichFailedToStartExpiringFromNow
{
[LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.disappearingMessagesFinder
enumerateMessagesWhichFailedToStartExpiringWithBlock:^(TSMessage *_Nonnull message) {
[self startAnyExpirationForMessage:message expirationStartedAt:[NSDate millisecondTimestamp] transaction:transaction];
}
transaction:transaction];
}];
}
- (void)cleanupMessagesWhichFailedToStartExpiringWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
[self.disappearingMessagesFinder

View File

@ -189,10 +189,10 @@ extension MessageReceiver {
let storage = SNMessagingKitConfiguration.shared.storage
let transaction = transaction as! YapDatabaseReadWriteTransaction
// Profile
var userProfileKy: OWSAES256Key? = nil
if let profileKey = message.profileKey { userProfileKy = OWSAES256Key(data: profileKey) }
var userProfileKey: OWSAES256Key? = nil
if let profileKey = message.profileKey { userProfileKey = OWSAES256Key(data: profileKey) }
updateProfileIfNeeded(publicKey: userPublicKey, name: message.displayName, profilePictureURL: message.profilePictureURL,
profileKey: userProfileKy, sentTimestamp: message.sentTimestamp!, transaction: transaction)
profileKey: userProfileKey, sentTimestamp: message.sentTimestamp!, transaction: transaction)
// Initial configuration sync
if !UserDefaults.standard[.hasSyncedInitialConfiguration] {
UserDefaults.standard[.hasSyncedInitialConfiguration] = true
@ -280,8 +280,10 @@ extension MessageReceiver {
// Update profile if needed
if let profile = message.profile {
let sessionID = message.sender!
var contactProfileKey: OWSAES256Key? = nil
if let profileKey = profile.profileKey { contactProfileKey = OWSAES256Key(data: profileKey) }
updateProfileIfNeeded(publicKey: sessionID, name: profile.displayName, profilePictureURL: profile.profilePictureURL,
profileKey: given(profile.profileKey) { OWSAES256Key(data: $0)! }, sentTimestamp: message.sentTimestamp!, transaction: transaction)
profileKey: contactProfileKey, sentTimestamp: message.sentTimestamp!, transaction: transaction)
}
// Get or create thread
guard let threadID = storage.getOrCreateThread(for: message.syncTarget ?? message.sender!, groupPublicKey: message.groupPublicKey, openGroupID: openGroupID, using: transaction) else { throw Error.noThread }
@ -330,8 +332,6 @@ extension MessageReceiver {
let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) {
// Mark previous messages as read if there is a sync message
OWSReadReceiptManager.shared().markAsReadLocally(beforeSortId: tsOutgoingMessage.sortId, thread: thread)
// Start expiration for sync messages
OWSDisappearingMessagesJob.shared().startAnyExpiration(for: tsOutgoingMessage, expirationStartedAt: NSDate.millisecondTimestamp(), transaction: transaction)
}
// Notify the user if needed
guard (isMainAppAndActive || isBackgroundPoll), let tsIncomingMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) as? TSIncomingMessage,

View File

@ -18,6 +18,7 @@ BOOL IsNoteToSelfEnabled(void);
@property (nonatomic) BOOL shouldBeVisible;
@property (nonatomic, readonly) NSDate *creationDate;
@property (nonatomic, readonly, nullable) NSDate *lastInteractionDate;
@property (nonatomic, readonly) TSInteraction *lastInteraction;
@property (atomic, readonly) BOOL isMuted;
@property (atomic, readonly, nullable) NSDate *mutedUntilDate;

View File

@ -21,6 +21,7 @@ BOOL IsNoteToSelfEnabled(void)
@interface TSThread ()
@property (nonatomic) NSDate *creationDate;
@property (nonatomic, nullable) NSDate *lastInteractionDate;
@property (nonatomic, nullable) NSNumber *archivedAsOfMessageSortId;
@property (nonatomic, copy, nullable) NSString *messageDraft;
@property (atomic, nullable) NSDate *mutedUntilDate;
@ -356,6 +357,8 @@ BOOL IsNoteToSelfEnabled(void)
return;
}
_lastInteractionDate = lastMessage.receivedAtDate;
if (!self.shouldBeVisible) {
self.shouldBeVisible = YES;
[self saveWithTransaction:transaction];

View File

@ -3,6 +3,10 @@
//
#import <Foundation/Foundation.h>
#import <SessionMessagingKit/SSKEnvironment.h>
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
#import <SessionMessagingKit/YapDatabaseTransaction+OWS.h>
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
NS_ASSUME_NONNULL_BEGIN
@ -47,6 +51,7 @@ extern NSString *const OWSPreferencesCallLoggingDidChangeNotification;
- (void)setScreenSecurity:(BOOL)flag;
- (NotificationType)notificationPreviewType;
- (NotificationType)notificationPreviewTypeWithTransaction:(YapDatabaseReadTransaction *)transaction;
- (void)setNotificationPreviewType:(NotificationType)type;
- (NSString *)nameForNotificationPreviewType:(NotificationType)notificationType;

View File

@ -3,10 +3,6 @@
//
#import "OWSPreferences.h"
#import <SessionMessagingKit/SSKEnvironment.h>
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
#import <SessionMessagingKit/YapDatabaseTransaction+OWS.h>
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
NS_ASSUME_NONNULL_BEGIN
@ -384,6 +380,17 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
}
}
- (NotificationType)notificationPreviewTypeWithTransaction:(YapDatabaseReadTransaction *)transaction
{
NSNumber *preference = [self tryGetValueForKey:OWSPreferencesKeyNotificationPreviewType transaction:transaction];
if (preference) {
return [preference unsignedIntegerValue];
} else {
return NotificationNamePreview;
}
}
- (NSString *)nameForNotificationPreviewType:(NotificationType)notificationType
{
switch (notificationType) {

View File

@ -36,6 +36,7 @@ final class ThreadPickerVC : UIViewController, UITableViewDataSource, UITableVie
// MARK: Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
setupNavBar()
// Gradient
view.backgroundColor = .clear
let gradient = Gradients.defaultBackground
@ -68,6 +69,17 @@ final class ThreadPickerVC : UIViewController, UITableViewDataSource, UITableVie
reload()
}
private func setupNavBar() {
guard let navigationBar = navigationController?.navigationBar else { return }
if #available(iOS 15.0, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = Colors.navigationBarBackground
navigationBar.standardAppearance = appearance;
navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance
}
}
// MARK: Table View Data Source
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Int(threadCount)
@ -109,16 +121,14 @@ final class ThreadPickerVC : UIViewController, UITableViewDataSource, UITableVie
}
shareVC!.dismiss(animated: true, completion: nil)
ModalActivityIndicatorViewController.present(fromViewController: shareVC!, canCancel: false, message: NSLocalizedString("vc_share_sending_message", comment: "")) { activityIndicator in
Storage.write { transaction in
MessageSender.sendNonDurably(message, with: attachments, in: self.selectedThread!, using: transaction).done { [weak self] _ in
guard let self = self else { return }
activityIndicator.dismiss { }
self.shareVC!.shareViewWasCompleted()
}.catch { [weak self] error in
guard let self = self else { return }
activityIndicator.dismiss { }
self.shareVC!.shareViewFailed(error: error)
}
MessageSender.sendNonDurably(message, with: attachments, in: self.selectedThread!).done { [weak self] _ in
guard let self = self else { return }
activityIndicator.dismiss { }
self.shareVC!.shareViewWasCompleted()
}.catch { [weak self] error in
guard let self = self else { return }
activityIndicator.dismiss { }
self.shareVC!.shareViewFailed(error: error)
}
}
}

View File

@ -269,7 +269,7 @@ public class MediaMessageView: UIView, OWSAudioPlayerDelegate {
private func createGenericPreview() {
var subviews = [UIView]()
let imageView = createHeroImageView(imageName: "file-thin-black-filled-large")
let imageView = createHeroImageView(imageName: "actionsheet_document_black")
subviews.append(imageView)
let fileNameLabel = createFileNameLabel()

View File

@ -67,4 +67,38 @@ extension MessageSender {
let destination = Message.Destination.from(thread)
return MessageSender.send(message, to: destination, using: transaction)
}
public static func sendNonDurably(_ message: VisibleMessage, with attachments: [SignalAttachment], in thread: TSThread) -> Promise<Void> {
Storage.writeSync{ transaction in
prep(attachments, for: message, using: transaction)
}
let attachments = message.attachmentIDs.compactMap { TSAttachment.fetch(uniqueId: $0) as? TSAttachmentStream }
let attachmentsToUpload = attachments.filter { !$0.isUploaded }
let attachmentUploadPromises: [Promise<Void>] = attachmentsToUpload.map { stream in
let storage = SNMessagingKitConfiguration.shared.storage
if let v2OpenGroup = storage.getV2OpenGroup(for: thread.uniqueId!) {
let (promise, seal) = Promise<Void>.pending()
AttachmentUploadJob.upload(stream, using: { data in return OpenGroupAPIV2.upload(data, to: v2OpenGroup.room, on: v2OpenGroup.server) }, encrypt: false, onSuccess: { seal.fulfill(()) }, onFailure: { seal.reject($0) })
return promise
} else {
let (promise, seal) = Promise<Void>.pending()
AttachmentUploadJob.upload(stream, using: FileServerAPIV2.upload, encrypt: true, onSuccess: { seal.fulfill(()) }, onFailure: { seal.reject($0) })
return promise
}
}
let (promise, seal) = Promise<Void>.pending()
let results = when(resolved: attachmentUploadPromises).wait()
let errors = results.compactMap { result -> Swift.Error? in
if case .rejected(let error) = result { return error } else { return nil }
}
if let error = errors.first { seal.reject(error) }
Storage.write{ transaction in
sendNonDurably(message, in: thread, using: transaction).done {
seal.fulfill(())
}.catch { error in
seal.reject(error)
}
}
return promise
}
}