diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index c1e4d9a1d..552d14f3d 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -85,7 +85,7 @@ 346129C91FD2072E00532771 /* NSString+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 346129C21FD2072D00532771 /* NSString+OWS.m */; }; 346129CA1FD2072E00532771 /* UIImage+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = 346129C31FD2072D00532771 /* UIImage+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 346129CB1FD2072E00532771 /* Promise+retainUntilComplete.swift in Sources */ = {isa = PBXBuildFile; fileRef = 346129C41FD2072D00532771 /* Promise+retainUntilComplete.swift */; }; - 346129CC1FD2072E00532771 /* NSAttributedString+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = 346129C51FD2072D00532771 /* NSAttributedString+OWS.h */; }; + 346129CC1FD2072E00532771 /* NSAttributedString+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = 346129C51FD2072D00532771 /* NSAttributedString+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 346129CD1FD2072E00532771 /* UIImage+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 346129C61FD2072D00532771 /* UIImage+OWS.m */; }; 346129D01FD207F300532771 /* OWSAlerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 346129CF1FD207F200532771 /* OWSAlerts.swift */; }; 346129D21FD2085A00532771 /* CommonStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 346129D11FD2085A00532771 /* CommonStrings.swift */; }; diff --git a/Signal/src/ViewControllers/OWS2FAReminderViewController.swift b/Signal/src/ViewControllers/OWS2FAReminderViewController.swift index 510088052..ca5246212 100644 --- a/Signal/src/ViewControllers/OWS2FAReminderViewController.swift +++ b/Signal/src/ViewControllers/OWS2FAReminderViewController.swift @@ -40,13 +40,20 @@ public class OWS2FAReminderViewController: UIViewController, PinEntryViewDelegat let pinEntryView = PinEntryView() self.pinEntryView = pinEntryView pinEntryView.delegate = self - let instructionsText = NSLocalizedString("REMINDER_2FA_BODY", comment: "Body text for when user is peridoically prompted to enter their registration lock PIN") - pinEntryView.instructionsText = instructionsText + + let instructionsTextHeader = NSLocalizedString("REMINDER_2FA_BODY_HEADER", comment: "Body header for when user is peridoically prompted to enter their registration lock PIN") + let instructionsTextBody = NSLocalizedString("REMINDER_2FA_BODY", comment: "Body text for when user is peridoically prompted to enter their registration lock PIN") + + let attributes = [NSFontAttributeName: pinEntryView.boldLabelFont] + + let attributedInstructionsText = NSAttributedString(string: instructionsTextHeader, attributes: attributes).rtlSafeAppend(" ", referenceView: pinEntryView).rtlSafeAppend(instructionsTextBody, referenceView: pinEntryView) + + pinEntryView.attributedInstructionsText = attributedInstructionsText view.addSubview(pinEntryView) pinEntryView.autoPinWidthToSuperview(withMargin: 20) - pinEntryView.autoPin(toTopLayoutGuideOf: self, withInset: 0) + pinEntryView.autoPin(toTopLayoutGuideOf: self, withInset: ScaleFromIPhone5(16)) pinEntryView.autoPin(toBottomLayoutGuideOf: self, withInset: 0) } diff --git a/Signal/src/views/PinEntryView.h b/Signal/src/views/PinEntryView.h index fd6c31a12..83b562abd 100644 --- a/Signal/src/views/PinEntryView.h +++ b/Signal/src/views/PinEntryView.h @@ -21,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak, nullable) id delegate; @property (nonatomic, readonly) BOOL hasValidPin; @property (nullable, nonatomic) NSString *instructionsText; +@property (nullable, nonatomic) NSAttributedString *attributedInstructionsText; +@property (nonatomic, readonly) UIFont *boldLabelFont; - (void)clearText; - (BOOL)makePinTextFieldFirstResponder; diff --git a/Signal/src/views/PinEntryView.m b/Signal/src/views/PinEntryView.m index f15de92f9..31bbfcd9c 100644 --- a/Signal/src/views/PinEntryView.m +++ b/Signal/src/views/PinEntryView.m @@ -34,13 +34,22 @@ NS_ASSUME_NONNULL_BEGIN } #pragma mark - view creation +- (UIFont *)labelFont +{ + return [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(14.f, 16.f)]; +} + +- (UIFont *)boldLabelFont +{ + return [UIFont ows_boldFontWithSize:ScaleFromIPhone5To7Plus(14.f, 16.f)]; +} - (UILabel *)createLabelWithText:(nullable NSString *)text { UILabel *label = [UILabel new]; label.textColor = [UIColor blackColor]; label.text = text; - label.font = [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(14.f, 16.f)]; + label.font = self.labelFont; label.numberOfLines = 0; label.lineBreakMode = NSLineBreakByWordWrapping; label.textAlignment = NSTextAlignmentCenter; @@ -114,9 +123,19 @@ NS_ASSUME_NONNULL_BEGIN self.instructionsLabel.text = instructionsText; } +- (nullable NSAttributedString *)attributedInstructionsText +{ + return self.instructionsLabel.attributedText; +} + +- (void)setAttributedInstructionsText:(nullable NSAttributedString *)attributedInstructionsText +{ + self.instructionsLabel.attributedText = attributedInstructionsText; +} + - (void)createContents { - const CGFloat kVSpacing = ScaleFromIPhone5(12); + const CGFloat kVSpacing = ScaleFromIPhone5To7Plus(12, 30); UILabel *instructionsLabel = [self createLabelWithText:nil]; self.instructionsLabel = instructionsLabel; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 2cffa2be6..1ee8ceb52 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -675,7 +675,7 @@ "ENABLE_2FA_VIEW_NEXT_BUTTON" = "Next"; /* Error indicating that the entered 'two-factor auth PINs' do not match. */ -"ENABLE_2FA_VIEW_PIN_DOES_NOT_MATCH" = "Pin does not match."; +"ENABLE_2FA_VIEW_PIN_DOES_NOT_MATCH" = "PIN does not match."; /* Indicates that user should select a 'two factor auth pin'. */ "ENABLE_2FA_VIEW_SELECT_PIN_INSTRUCTIONS" = "Enter a Registration Lock PIN. You will be asked to enter this PIN the next time you register this phone number with Signal."; @@ -1475,7 +1475,10 @@ "RELAY_REGISTERED_ERROR_RECOVERY" = "The phone number you are trying to register has already been registered on another server, please unregister from there and try again."; /* Body text for when user is peridoically prompted to enter their registration lock PIN */ -"REMINDER_2FA_BODY" = "Registration Lock is enabled for your phone number."; +"REMINDER_2FA_BODY" = "Registration Lock is enabled for your phone number. To help you memorize your Registration Lock PIN, Signal will periodically ask you to confirm it."; + +/* Body header for when user is peridoically prompted to enter their registration lock PIN */ +"REMINDER_2FA_BODY_HEADER" = "Reminder:"; /* Alert message explaining what happens if you forget your 'two-factor auth pin' */ "REMINDER_2FA_FORGOT_PIN_ALERT_MESSAGE" = "Registration Lock helps protect your phone number from unauthorized registration attempts. This feature can be disabled at any time in your Signal privacy settings."; diff --git a/SignalMessaging/SignalMessaging.h b/SignalMessaging/SignalMessaging.h index ccea401d5..4c01089d7 100644 --- a/SignalMessaging/SignalMessaging.h +++ b/SignalMessaging/SignalMessaging.h @@ -18,6 +18,7 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[]; #import #import #import +#import #import #import #import diff --git a/SignalShareExtension/ShareViewController.swift b/SignalShareExtension/ShareViewController.swift index a3d656314..ceb70fc6a 100644 --- a/SignalShareExtension/ShareViewController.swift +++ b/SignalShareExtension/ShareViewController.swift @@ -804,8 +804,6 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed // Perhaps the AVFoundation APIs require some extra file system permssion we don't have in the // passed through URL. private func isVideoNeedingRelocation(itemProvider: NSItemProvider, itemUrl: URL) -> Bool { - Logger.info("\(self.logTag) isVideoNeedingRelocation: \(itemProvider.registeredTypeIdentifiers), itemUrl: \(itemUrl)") - let pathExtension = itemUrl.pathExtension guard pathExtension.count > 0 else { Logger.verbose("\(self.logTag) in \(#function): item URL has no file extension: \(itemUrl).")