Skip to content

Commit

Permalink
Add restore button to registration splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
marissa-signal authored Nov 18, 2024
1 parent 4de9951 commit 53966a5
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ extension RegistrationNavigationController: RegistrationSplashPresenter {
pushNextController(coordinator.continueFromSplash())
}

public func restoreOrTransfer() {
// TODO: Enter "Restore or Transfer" flow.
}

public func switchToDeviceLinkingMode() {
Logger.info("Pushing device linking")
let controller = RegistrationConfirmModeSwitchViewController(presenter: self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public import SignalUI

public protocol RegistrationSplashPresenter: AnyObject {
func continueFromSplash()
func restoreOrTransfer()

func switchToDeviceLinkingMode()
func transferDevice()
Expand Down Expand Up @@ -149,6 +150,27 @@ public class RegistrationSplashViewController: OWSViewController {
continueButton.autoPinEdge(toSuperviewEdge: .leading)
continueButton.autoPinEdge(toSuperviewEdge: .trailing)
}

if FeatureFlags.messageBackupQuickRestoreFlow {
stackView.setCustomSpacing(16, after: continueButton)

let restoreOrTransferButton = OWSFlatButton.secondaryButtonForRegistration(
title: OWSLocalizedString(
"ONBOARDING_SPLASH_RESTORE_OR_TRANSFER_BUTTON_TITLE",
comment: "Button for restoring or transferring account in the 'onboarding splash' view."
),
target: self,
selector: #selector(didTapRestoreOrTransfer)
)
restoreOrTransferButton.accessibilityIdentifier = "registration.splash.continueButton"
stackView.addArrangedSubview(restoreOrTransferButton)
restoreOrTransferButton.autoSetDimension(.width, toSize: 280)
restoreOrTransferButton.autoHCenterInSuperview()
NSLayoutConstraint.autoSetPriority(.defaultLow) {
restoreOrTransferButton.autoPinEdge(toSuperviewEdge: .leading)
restoreOrTransferButton.autoPinEdge(toSuperviewEdge: .trailing)
}
}
}

// MARK: - Events
Expand Down Expand Up @@ -178,4 +200,10 @@ public class RegistrationSplashViewController: OWSViewController {
Logger.info("")
presenter?.continueFromSplash()
}

@objc
private func didTapRestoreOrTransfer() {
Logger.info("")
presenter?.restoreOrTransfer()
}
}
13 changes: 13 additions & 0 deletions Signal/Registration/UserInterface/RegistrationViewUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ extension OWSFlatButton {
return result
}

static func secondaryButtonForRegistration(title: String, target: Any, selector: Selector) -> OWSFlatButton {
let result = insetButton(
title: title,
font: UIFont.dynamicTypeBodyClamped.semibold(),
titleColor: .ows_accentBlue,
backgroundColor: .clear,
target: target,
selector: selector
)
result.contentEdgeInsets = UIEdgeInsets(hMargin: 4, vMargin: 14)
return result
}

static func linkButtonForRegistration(title: String, target: Any, selector: Selector) -> OWSFlatButton {
let button = OWSFlatButton.button(
title: title,
Expand Down
3 changes: 3 additions & 0 deletions Signal/translations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4951,6 +4951,9 @@
/* Explanation of the 'onboarding pin attempts exhausted' view when it is unknown if reglock is enabled. */
"ONBOARDING_PIN_ATTEMPTS_EXHAUSTED_WITH_UNKNOWN_REGLOCK_EXPLANATION" = "You’ve run out of PIN guesses, but you can still try and access your Signal account by verifying your phone number. For your privacy and security your account will be restored without any saved profile information or settings.";

/* Button for restoring or transferring account in the 'onboarding splash' view. */
"ONBOARDING_SPLASH_RESTORE_OR_TRANSFER_BUTTON_TITLE" = "Restore or Transfer Account";

/* Link to the 'terms and privacy policy' in the 'onboarding splash' view. */
"ONBOARDING_SPLASH_TERM_AND_PRIVACY_POLICY" = "Terms & Privacy Policy";

Expand Down
1 change: 1 addition & 0 deletions SignalServiceKit/Util/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public enum FeatureFlags {
public static let linkAndSync = build.includes(.internal)
public static let linkAndSyncTimeoutSeconds: UInt32 = 60 * (build.includes(.internal) ? 5 : 1)
public static let backupsMemorySamplerRatio: Float = build.includes(.internal) ? 0.1 : 0
public static let messageBackupQuickRestoreFlow = false

public static let callLinkCreate = true
public static let callLinkSync = true
Expand Down

0 comments on commit 53966a5

Please sign in to comment.