Add two separate modes to the Safety Tip screen
Co-authored-by: Max Radermacher <max@signal.org>
This commit is contained in:
parent
c6492caae7
commit
202d8a1f07
@ -1409,6 +1409,7 @@ extension ConversationViewController: CVComponentDelegate {
|
||||
|
||||
public func didTapSafetyTips() {
|
||||
let viewController = SafetyTipsViewController(
|
||||
mode: .messageRequest,
|
||||
primaryButton: SafetyTipsViewController.Button(
|
||||
title: CommonStrings.viewMoreButton,
|
||||
action: { [weak self] in
|
||||
|
||||
12
Signal/Images.xcassets/safety-tips/safetytip_48_04.imageset/Contents.json
vendored
Normal file
12
Signal/Images.xcassets/safety-tips/safetytip_48_04.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "safetytip_48_pin.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
Signal/Images.xcassets/safety-tips/safetytip_48_04.imageset/safetytip_48_pin.pdf
vendored
Normal file
BIN
Signal/Images.xcassets/safety-tips/safetytip_48_04.imageset/safetytip_48_pin.pdf
vendored
Normal file
Binary file not shown.
12
Signal/Images.xcassets/safety-tips/safetytip_48_05.imageset/Contents.json
vendored
Normal file
12
Signal/Images.xcassets/safety-tips/safetytip_48_05.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "safetytip_48_lock.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
Signal/Images.xcassets/safety-tips/safetytip_48_05.imageset/safetytip_48_lock.pdf
vendored
Normal file
BIN
Signal/Images.xcassets/safety-tips/safetytip_48_05.imageset/safetytip_48_lock.pdf
vendored
Normal file
Binary file not shown.
@ -50,6 +50,7 @@ enum SafetyTipsSheet {
|
||||
),
|
||||
handler: { [weak fromViewController] _ in
|
||||
let safetyTipsVC = SafetyTipsViewController(
|
||||
mode: .smsRequest,
|
||||
primaryButton: SafetyTipsViewController.Button(
|
||||
title: OWSLocalizedString(
|
||||
"SETTINGS_ACCOUNT_BUTTON",
|
||||
|
||||
@ -12,6 +12,11 @@ public enum SafetyTipsType {
|
||||
case group
|
||||
}
|
||||
|
||||
public enum SafetyTipsMode {
|
||||
case smsRequest
|
||||
case messageRequest
|
||||
}
|
||||
|
||||
public class SafetyTipsViewController: InteractiveSheetViewController, UIScrollViewDelegate {
|
||||
public struct Button {
|
||||
let title: String
|
||||
@ -20,15 +25,19 @@ public class SafetyTipsViewController: InteractiveSheetViewController, UIScrollV
|
||||
|
||||
override public var placeOnGlassIfAvailable: Bool { true }
|
||||
let primaryButton: Button
|
||||
let mode: SafetyTipsMode
|
||||
|
||||
init(primaryButton: Button) {
|
||||
init(mode: SafetyTipsMode, primaryButton: Button) {
|
||||
self.mode = mode
|
||||
self.primaryButton = primaryButton
|
||||
}
|
||||
|
||||
private enum SafetyTips: CaseIterable {
|
||||
private enum SafetyTips {
|
||||
case chatsFromSignal
|
||||
case reviewNames
|
||||
case scams
|
||||
case keepVerificationCodeSafe
|
||||
case enableReglock
|
||||
|
||||
var image: UIImage? {
|
||||
switch self {
|
||||
@ -38,6 +47,10 @@ public class SafetyTipsViewController: InteractiveSheetViewController, UIScrollV
|
||||
return UIImage(resource: .safetytip4802)
|
||||
case .scams:
|
||||
return UIImage(resource: .safetytip4803)
|
||||
case .keepVerificationCodeSafe:
|
||||
return UIImage(resource: .safetytip4804)
|
||||
case .enableReglock:
|
||||
return UIImage(resource: .safetytip4805)
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +71,16 @@ public class SafetyTipsViewController: InteractiveSheetViewController, UIScrollV
|
||||
"SAFETY_TIPS_LOOK_OUT_FOR_SCAMS_TITLE",
|
||||
comment: "Message title describing the scams safety tip.",
|
||||
)
|
||||
case .keepVerificationCodeSafe:
|
||||
return OWSLocalizedString(
|
||||
"SAFETY_TIPS_KEEP_CODE_SAFE_TITLE",
|
||||
comment: "Message title describing the keeping codes safe safety tip.",
|
||||
)
|
||||
case .enableReglock:
|
||||
return OWSLocalizedString(
|
||||
"SAFETY_TIPS_ENABLE_REGLOCK_TITLE",
|
||||
comment: "Message title describing the enable reglock safety tip.",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,6 +101,16 @@ public class SafetyTipsViewController: InteractiveSheetViewController, UIScrollV
|
||||
"SAFETY_TIPS_LOOK_OUT_FOR_SCAMS_BODY",
|
||||
comment: "Message body describing the scams safety tip.",
|
||||
)
|
||||
case .keepVerificationCodeSafe:
|
||||
return OWSLocalizedString(
|
||||
"SAFETY_TIPS_KEEP_CODE_SAFE_BODY",
|
||||
comment: "Message body describing the keeping codes safe safety tip.",
|
||||
)
|
||||
case .enableReglock:
|
||||
return OWSLocalizedString(
|
||||
"SAFETY_TIPS_ENABLE_REGLOCK_BODY",
|
||||
comment: "Message body describing the enable reglock safety tip.",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,7 +162,12 @@ public class SafetyTipsViewController: InteractiveSheetViewController, UIScrollV
|
||||
stackView.widthAnchor.constraint(equalTo: contentScrollView.frameLayoutGuide.widthAnchor, constant: -48),
|
||||
])
|
||||
|
||||
for bullet in SafetyTips.allCases {
|
||||
let cases: [SafetyTips] = switch mode {
|
||||
case .smsRequest: [.chatsFromSignal, .keepVerificationCodeSafe, .enableReglock]
|
||||
case .messageRequest: [.chatsFromSignal, .reviewNames, .scams]
|
||||
}
|
||||
|
||||
for bullet in cases {
|
||||
let bulletView = SafetyBulletView(bullet)
|
||||
stackView.addArrangedSubview(bulletView)
|
||||
}
|
||||
|
||||
@ -7993,6 +7993,12 @@
|
||||
/* Message title describing the crypto safety tip. */
|
||||
"SAFETY_TIPS_CRYPTO_TITLE" = "Crypto or money scams";
|
||||
|
||||
/* Message body describing the enable reglock safety tip. */
|
||||
"SAFETY_TIPS_ENABLE_REGLOCK_BODY" = "Protect your account by requiring your Signal PIN, in addition to your verification code, when registering with Signal.";
|
||||
|
||||
/* Message title describing the enable reglock safety tip. */
|
||||
"SAFETY_TIPS_ENABLE_REGLOCK_TITLE" = "Turn on registration lock in account settings";
|
||||
|
||||
/* Message contents for the safety tip concerning fake businesses. */
|
||||
"SAFETY_TIPS_FAKE_BUSINESS_BODY" = "Be careful of businesses or government agencies contacting you. Messages involving tax agencies, couriers, and more can be spam.";
|
||||
|
||||
@ -8002,6 +8008,12 @@
|
||||
/* Title for Safety Tips education screen. */
|
||||
"SAFETY_TIPS_HEADER_TITLE" = "Safety Tips";
|
||||
|
||||
/* Message body describing the keeping codes safe safety tip. */
|
||||
"SAFETY_TIPS_KEEP_CODE_SAFE_BODY" = "If you received a verification code you didn’t request, someone may be attempting to access your account. Do not share your code.";
|
||||
|
||||
/* Message title describing the keeping codes safe safety tip. */
|
||||
"SAFETY_TIPS_KEEP_CODE_SAFE_TITLE" = "Keep your verification code safe";
|
||||
|
||||
/* Message body describing the scams safety tip. */
|
||||
"SAFETY_TIPS_LOOK_OUT_FOR_SCAMS_BODY" = "Avoid vague messages that try to get you to reply. Be aware of financial tips and suspicious web links.";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user