diff --git a/Signal/src/Loki/Onboarding/SeedVC.swift b/Signal/src/Loki/Onboarding/SeedVC.swift index 8972c5406..9cc4838a6 100644 --- a/Signal/src/Loki/Onboarding/SeedVC.swift +++ b/Signal/src/Loki/Onboarding/SeedVC.swift @@ -308,7 +308,7 @@ final class SeedVC : OnboardingBaseViewController, DeviceLinkingModalDelegate, O }.catch(on: DispatchQueue.main) { [weak self] _ in TSAccountManager.sharedInstance().resetForReregistration() guard let self = self else { return } - let alert = UIAlertController(title: NSLocalizedString("Couldn't Link Device", comment: ""), message: NSLocalizedString("Please check your connection and try again.", comment: ""), preferredStyle: .alert) + let alert = UIAlertController(title: NSLocalizedString("Couldn't Link Device", comment: ""), message: NSLocalizedString("Please check your internet connection and try again", comment: ""), preferredStyle: .alert) self.present(alert, animated: true, completion: nil) self.setUserInteractionEnabled(true) } diff --git a/Signal/src/Loki/Settings/DeviceLinksVC.swift b/Signal/src/Loki/Settings/DeviceLinksVC.swift index 557231b39..b757c9dbb 100644 --- a/Signal/src/Loki/Settings/DeviceLinksVC.swift +++ b/Signal/src/Loki/Settings/DeviceLinksVC.swift @@ -135,9 +135,14 @@ final class DeviceLinksVC : UIViewController, UITableViewDataSource, UITableView private func removeDeviceLink(_ deviceLink: DeviceLink) { LokiStorageAPI.removeDeviceLink(deviceLink).done { [weak self] in - guard let thread = TSContactThread.fetch(uniqueId: TSContactThread.threadId(fromContactId: deviceLink.other.hexEncodedPublicKey)) else { return } + let linkedDeviceHexEncodedPublicKey = deviceLink.other.hexEncodedPublicKey + guard let thread = TSContactThread.fetch(uniqueId: TSContactThread.threadId(fromContactId: linkedDeviceHexEncodedPublicKey)) else { return } let unlinkDeviceMessage = UnlinkDeviceMessage(thread: thread)! ThreadUtil.enqueue(unlinkDeviceMessage) + let storage = OWSPrimaryStorage.shared() + storage.dbReadWriteConnection.readWrite { transaction in + storage.archiveAllSessions(forContact: linkedDeviceHexEncodedPublicKey, protocolContext: transaction) + } self?.updateDeviceLinks() }.catch { [weak self] _ in let alert = UIAlertController(title: NSLocalizedString("Couldn't Unlink Device", comment: ""), message: NSLocalizedString("Please check your internet connection and try again", comment: ""), preferredStyle: .alert) diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 6fbba7f00..525f1f3cb 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2665,6 +2665,7 @@ "Enter a Name" = "Enter a Name"; "Error" = "Error"; "Please pick a name" = "Please pick a name"; +"Couldn't Link Device" = "Couldn't Link Device"; "Couldn't Unlink Device" = "Couldn't Unlink Device"; "Please check your internet connection and try again" = "Please check your internet connection and try again"; "Device Unlinked" = "Device Unlinked";