mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Add copy button feedback
This commit is contained in:
parent
ca0f58c6b4
commit
8d0c3b0f97
2 changed files with 15 additions and 0 deletions
|
@ -16,6 +16,12 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
|
|||
result.font = UIFont(descriptor: result.font.fontDescriptor.withSymbolicTraits(fontTraits)!, size: result.font.pointSize)
|
||||
return result
|
||||
}()
|
||||
|
||||
private lazy var copyButton: OWSFlatButton = {
|
||||
let result = createLinkButton(title: NSLocalizedString("Copy", comment: ""), selector: #selector(copyMnemonic))
|
||||
result.accessibilityIdentifier = "onboarding.publicKeyStep.copyButton"
|
||||
return result
|
||||
}()
|
||||
|
||||
init(onboardingController: OnboardingController, userName: String?) {
|
||||
super.init(onboardingController: onboardingController)
|
||||
|
@ -76,6 +82,14 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
|
|||
|
||||
@objc private func copyMnemonic() {
|
||||
UIPasteboard.general.string = mnemonic
|
||||
copyButton.isUserInteractionEnabled = false
|
||||
copyButton.setTitle(title: NSLocalizedString("Copied ✓", comment: ""), font: .ows_dynamicTypeBodyClamped, titleColor: .ows_materialBlue)
|
||||
Timer.scheduledTimer(timeInterval: 4, target: self, selector: #selector(enableCopyButton), userInfo: nil, repeats: false)
|
||||
}
|
||||
|
||||
@objc private func enableCopyButton() {
|
||||
copyButton.isUserInteractionEnabled = true
|
||||
copyButton.setTitle(title: NSLocalizedString("Copy", comment: ""), font: .ows_dynamicTypeBodyClamped, titleColor: .ows_materialBlue)
|
||||
}
|
||||
|
||||
@objc private func register() {
|
||||
|
|
|
@ -2553,4 +2553,5 @@
|
|||
"Password (Optional)" = "Password (Optional)";
|
||||
"Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device." = "Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device.";
|
||||
"Copy" = "Copy";
|
||||
"Copied ✓" = "Copied ✓";
|
||||
"Register" = "Register";
|
||||
|
|
Loading…
Reference in a new issue