mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix crash on device linking failure
This commit is contained in:
parent
f53b00b36a
commit
661795bd00
3 changed files with 8 additions and 2 deletions
|
@ -306,9 +306,14 @@ final class SeedVC : OnboardingBaseViewController, DeviceLinkingModalDelegate, O
|
|||
let linkingRequestMessage = DeviceLinkingUtilities.getLinkingRequestMessage(for: masterHexEncodedPublicKey)
|
||||
ThreadUtil.enqueue(linkingRequestMessage)
|
||||
}.catch(on: DispatchQueue.main) { [weak self] _ in
|
||||
TSAccountManager.sharedInstance().resetForReregistration()
|
||||
DispatchQueue.main.async {
|
||||
// FIXME: For some reason resetForRegistration() complains about not being on the main queue
|
||||
// without this (even though the catch closure should be executed on the main queue)
|
||||
TSAccountManager.sharedInstance().resetForReregistration()
|
||||
}
|
||||
guard let self = self else { return }
|
||||
let alert = UIAlertController(title: NSLocalizedString("Couldn't Link Device", comment: ""), message: NSLocalizedString("Please check your internet connection and try again", comment: ""), preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", accessibilityIdentifier: nil, style: .default, handler: nil))
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
self.setUserInteractionEnabled(true)
|
||||
}
|
||||
|
|
|
@ -2670,3 +2670,4 @@
|
|||
"Please check your internet connection and try again" = "Please check your internet connection and try again";
|
||||
"Device Unlinked" = "Device Unlinked";
|
||||
"Your device was unlinked successfully" = "Your device was unlinked successfully";
|
||||
"Unnamed Device" = "Unnamed Device";
|
||||
|
|
|
@ -21,7 +21,7 @@ public final class DeviceLink : NSObject, NSCoding {
|
|||
if let customDisplayName = UserDefaults.standard.string(forKey: "\(hexEncodedPublicKey)_display_name") {
|
||||
return customDisplayName
|
||||
} else {
|
||||
return Mnemonic.encode(hexEncodedString: hexEncodedPublicKey.removing05PrefixIfNeeded()).split(separator: " ")[0..<3].joined(separator: " ")
|
||||
return NSLocalizedString("Unnamed Device", comment: "")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue