From 7e825648efd8e5e80c7310d9738187c49aec73ba Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 1 Feb 2017 19:22:25 -0500 Subject: [PATCH] Show alert when trying to call a non-signal contact from Contacts. // FREEBIE --- Podfile.lock | 2 +- Signal/src/call/OutboundCallInitiator.swift | 8 +++++++- Signal/translations/en.lproj/Localizable.strings | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 6bd95ac67..2257d84d4 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -141,7 +141,7 @@ CHECKOUT OPTIONS: :commit: 919d541d6b8a8802a94f943026b8f68394e2c0b8 :git: https://github.com/WhisperSystems/SignalProtocolKit.git SignalServiceKit: - :commit: 7ca1d5e8a62273b524281d905c560b08c7c22039 + :commit: c68073fdb13e917b2977dc17b928dd515123c21b :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 41b57bb2fc292a814f758441a05243eb38457027 diff --git a/Signal/src/call/OutboundCallInitiator.swift b/Signal/src/call/OutboundCallInitiator.swift index f7d27d68f..b20cd445b 100644 --- a/Signal/src/call/OutboundCallInitiator.swift +++ b/Signal/src/call/OutboundCallInitiator.swift @@ -65,7 +65,13 @@ import Foundation }, failure: { error in Logger.warn("\(self.TAG) looking up recipientId: \(recipientId) failed with error \(error)") - // TODO fail with alert. e.g. when someone tries to call a non signal user from their contacts we should inform them. + + let alertTitle = NSLocalizedString("UNABLE_TO_PLACE_CALL", comment:"Alert Title") + let alertController = UIAlertController(title: alertTitle, message: error.localizedDescription, preferredStyle: .alert) + + let dismissAction = UIAlertAction(title: NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Generic short text for button to dismiss a dialog"), style: .default) + alertController.addAction(dismissAction) + UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true, completion: nil) }) // Since we've already dispatched async to make sure we have fresh webrtc preference data diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index f5bd472fc..4a8d2dc9a 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -248,7 +248,7 @@ "ERROR_DESCRIPTION_UNKNOWN_ERROR" = "An unkown error occurred."; /* Error message when attempting to send message */ -"ERROR_DESCRIPTION_UNREGISTERED_RECIPIENT" = "Recipient is no longer a Signal user."; +"ERROR_DESCRIPTION_UNREGISTERED_RECIPIENT" = "Contact is not a Signal user."; /* No comment provided by engineer. */ "ERROR_MESSAGE_DUPLICATE_MESSAGE" = "Received a duplicated message.";