diff --git a/Multisig.xcodeproj/project.pbxproj b/Multisig.xcodeproj/project.pbxproj index 27686b149..384e60afa 100644 --- a/Multisig.xcodeproj/project.pbxproj +++ b/Multisig.xcodeproj/project.pbxproj @@ -827,6 +827,8 @@ 931AB80628808F3600264AAA /* TransactionPreviewRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931AB80528808F3600264AAA /* TransactionPreviewRequest.swift */; }; 935DCA4C27BD14C600F09EE4 /* WebConnectionDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935DCA4B27BD14C500F09EE4 /* WebConnectionDetailsViewController.swift */; }; 9388B98227C8DDE400AAB7F5 /* SafeDeploymentNotificationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9388B98127C8DDE400AAB7F5 /* SafeDeploymentNotificationController.swift */; }; + 93C38DC128C74CAA005188EC /* WhatIsSafeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93C38DBF28C74CAA005188EC /* WhatIsSafeViewController.swift */; }; + 93C38DC228C74CAA005188EC /* WhatIsSafeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93C38DC028C74CAA005188EC /* WhatIsSafeViewController.xib */; }; 93EE3F702760EC7E00111F17 /* IntercomConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EE3F6F2760EC7E00111F17 /* IntercomConfig.swift */; }; 93EE3F752760F49800111F17 /* Intercom in Frameworks */ = {isa = PBXBuildFile; productRef = 93EE3F742760F49800111F17 /* Intercom */; }; 93EF2FA327C546330077BE95 /* InstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EF2FA127C546330077BE95 /* InstructionsViewController.swift */; }; @@ -1748,6 +1750,8 @@ 931AB80528808F3600264AAA /* TransactionPreviewRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionPreviewRequest.swift; sourceTree = ""; }; 935DCA4B27BD14C500F09EE4 /* WebConnectionDetailsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebConnectionDetailsViewController.swift; sourceTree = ""; }; 9388B98127C8DDE400AAB7F5 /* SafeDeploymentNotificationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafeDeploymentNotificationController.swift; sourceTree = ""; }; + 93C38DBF28C74CAA005188EC /* WhatIsSafeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WhatIsSafeViewController.swift; path = Tutorial/WhatIsSafeViewController.swift; sourceTree = ""; }; + 93C38DC028C74CAA005188EC /* WhatIsSafeViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = WhatIsSafeViewController.xib; path = Tutorial/WhatIsSafeViewController.xib; sourceTree = ""; }; 93EE3F6F2760EC7E00111F17 /* IntercomConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntercomConfig.swift; sourceTree = ""; }; 93EF2FA127C546330077BE95 /* InstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstructionsViewController.swift; sourceTree = ""; }; 93EF2FA227C546330077BE95 /* InstructionsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = InstructionsViewController.xib; sourceTree = ""; }; @@ -2044,6 +2048,8 @@ 0472B2B32869D5480049BA17 /* ClaimToken */ = { isa = PBXGroup; children = ( + 93C38DBF28C74CAA005188EC /* WhatIsSafeViewController.swift */, + 93C38DC028C74CAA005188EC /* WhatIsSafeViewController.xib */, 6A6A105B2889A2B700B852D5 /* Views */, 0472B2B12869D3510049BA17 /* ClaimSafeTokenFlow.swift */, 0472B2B82869D66A0049BA17 /* ChooseDelegateIntroViewController.swift */, @@ -4476,6 +4482,7 @@ 0AE8C05D2579354C00E62B34 /* TokenInfoView.xib in Resources */, 0A8AEB1925A4726E002A3FE1 /* ActionDetailExpandableCell.xib in Resources */, 04C5DF6C26FB451B0072476C /* KeyTypeTableViewCell.xib in Resources */, + 93C38DC228C74CAA005188EC /* WhatIsSafeViewController.xib in Resources */, 6A1CFA5028081A1200B2C340 /* BackupSeedPhraseViewController.xib in Resources */, 6A7A48A12823A297003278C8 /* SafeOwnerCell.xib in Resources */, 0A68869F2588FAFB0045CAB5 /* EnterENSNameViewController.xib in Resources */, @@ -4740,6 +4747,7 @@ 0A616B9B26AEFD4B00FCEDB9 /* MultisigNotification.swift in Sources */, 048B3B0E25A5E7AB0005219B /* EditSafeNameViewController.swift in Sources */, 0AF2733D24DABAAF007E4012 /* AppDelegate+Messaging.swift in Sources */, + 93C38DC128C74CAA005188EC /* WhatIsSafeViewController.swift in Sources */, 0A5C0C5628191F400061D96F /* PasscodeProtecting.swift in Sources */, 0ADD19C0265EA23200EB0F2B /* PrivateKeyViewController.swift in Sources */, 0AADCDC42858E8A100A0139B /* ValidateRequestToAddOwnerViewController.swift in Sources */, diff --git a/Multisig/Assets.xcassets/Claim Token/ico-token.imageset/Contents.json b/Multisig/Assets.xcassets/Claim Token/ico-token.imageset/Contents.json new file mode 100644 index 000000000..71b971cf4 --- /dev/null +++ b/Multisig/Assets.xcassets/Claim Token/ico-token.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "ico-token.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Multisig/Assets.xcassets/Claim Token/ico-token.imageset/ico-token.pdf b/Multisig/Assets.xcassets/Claim Token/ico-token.imageset/ico-token.pdf new file mode 100644 index 000000000..d59c4316c Binary files /dev/null and b/Multisig/Assets.xcassets/Claim Token/ico-token.imageset/ico-token.pdf differ diff --git a/Multisig/UI/App/Onboarding/OnboardingStepCollectionViewCell.swift b/Multisig/UI/App/Onboarding/OnboardingStepCollectionViewCell.swift index d6cbdfa91..b14e078d4 100644 --- a/Multisig/UI/App/Onboarding/OnboardingStepCollectionViewCell.swift +++ b/Multisig/UI/App/Onboarding/OnboardingStepCollectionViewCell.swift @@ -20,11 +20,11 @@ class OnboardingStepCollectionViewCell: UICollectionViewCell { titleLabel.text = step.title titleLabel.setStyle(.Updated.title) - if let hightlightedText = step.description.highlightedText { + if let highlightedText = step.description.highlightedText { descriptionLabel.attributedText = step.description.text.highlightRange( originalStyle: .secondary, highlightStyle: .primary.weight(.semibold), - textToHightlight: hightlightedText + textToHighlight: highlightedText ) } else { descriptionLabel.text = step.description.text diff --git a/Multisig/UI/App/Onboarding/OnboardingViewController.swift b/Multisig/UI/App/Onboarding/OnboardingViewController.swift index 79d61a2c9..6d5f20986 100644 --- a/Multisig/UI/App/Onboarding/OnboardingViewController.swift +++ b/Multisig/UI/App/Onboarding/OnboardingViewController.swift @@ -120,7 +120,6 @@ class OnboardingViewController: UIViewController { @IBAction func pageChanged(_ sender: Any) { let pc = sender as! UIPageControl - collectionView.scrollToItem(at: IndexPath(item: pc.currentPage, section: 0), at: .centeredHorizontally, animated: true) bindCurrentStep(page: pc.currentPage) diff --git a/Multisig/UI/App/ViewControllerFactory.swift b/Multisig/UI/App/ViewControllerFactory.swift index fd4661167..4420f2a05 100644 --- a/Multisig/UI/App/ViewControllerFactory.swift +++ b/Multisig/UI/App/ViewControllerFactory.swift @@ -85,14 +85,18 @@ enum ViewControllerFactory { UIBarButtonItem(barButtonSystemItem: .close, target: vc, action: #selector(CloseModal.closeModal)) } - static func makeTransparentNavigationBar(_ vc: UIViewController) { - // remove underline from navigationItem + static func removeUnderlineFromNavigationBar(_ vc: UIViewController) { let navigationBarAppearance = UINavigationBarAppearance() navigationBarAppearance.configureWithTransparentBackground() navigationBarAppearance.backgroundColor = .backgroundSecondary navigationBarAppearance.shadowColor = .clear - vc.navigationItem.hidesBackButton = true vc.navigationItem.scrollEdgeAppearance = navigationBarAppearance + } + + static func makeTransparentNavigationBar(_ vc: UIViewController) { + // remove underline from navigationItem + removeUnderlineFromNavigationBar(vc) + vc.navigationItem.hidesBackButton = true // disable swipe back vc.navigationController?.interactivePopGestureRecognizer?.isEnabled = false diff --git a/Multisig/UI/ClaimToken/ClaimSafeTokenFlow.swift b/Multisig/UI/ClaimToken/ClaimSafeTokenFlow.swift index dfc9241cb..f0b704f36 100644 --- a/Multisig/UI/ClaimToken/ClaimSafeTokenFlow.swift +++ b/Multisig/UI/ClaimToken/ClaimSafeTokenFlow.swift @@ -37,7 +37,8 @@ class ClaimSafeTokenFlow: UIFlow { func showIntro() { let vc = factory.claimGetStarted { [unowned self] in - chooseDelegateIntro() // TODO: Jump to Tutorial +// chooseDelegateIntro() // TODO: Jump to Tutorial + chooseTutorial() } show(vc) } @@ -56,6 +57,11 @@ class ClaimSafeTokenFlow: UIFlow { show(vc) } + func chooseTutorial() { + let vc = factory.chooseTutorial() + show(vc) + } + func chooseGuardian() { let vc = factory.chooseGuardian() { [unowned self] guardian in selectAmount(guardian: guardian) @@ -147,6 +153,11 @@ class ClaimSafeTokenFlowFactory { return vc } + func chooseTutorial() -> WhatIsSafeViewController { + let vc = WhatIsSafeViewController() + return vc + } + func selectAmount(safe: Safe, guardian: Guardian, onClaim: @escaping (Guardian, String) -> ()) -> ClaimingAmountViewController { let vc = ClaimingAmountViewController(guardian: guardian, safe: safe, onClaim: onClaim) return vc diff --git a/Multisig/UI/ClaimToken/ClaimSuccessViewController.swift b/Multisig/UI/ClaimToken/ClaimSuccessViewController.swift index ec99a1a2c..e469ee357 100644 --- a/Multisig/UI/ClaimToken/ClaimSuccessViewController.swift +++ b/Multisig/UI/ClaimToken/ClaimSuccessViewController.swift @@ -35,7 +35,7 @@ class ClaimSuccessViewController: UIViewController { textLabel.attributedText = text.highlightRange( originalStyle: .secondary, highlightStyle: .primary, - textToHightlight: amountString + textToHighlight: amountString ) tweetBox.setTweet( diff --git a/Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.swift b/Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.swift new file mode 100644 index 000000000..3b46ff988 --- /dev/null +++ b/Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.swift @@ -0,0 +1,73 @@ +// +// WhatIsSafeViewController.swift +// Multisig +// +// Created by Dirk Jäckel on 02.09.22. +// Copyright © 2022 Gnosis Ltd. All rights reserved. +// + +import UIKit + +class WhatIsSafeViewController: UIViewController { + + @IBOutlet weak var firstParagraph: UILabel! + @IBOutlet weak var screenTitle: UILabel! + @IBOutlet weak var totalSafesCreatedLabel: UILabel! + @IBOutlet weak var totalValueProtected: UILabel! + @IBOutlet weak var paragraphTitle: UILabel! + @IBOutlet weak var secondParagraph: UILabel! + @IBOutlet weak var nextButton: UIButton! + + @IBOutlet weak var totalValueProtectedStackView: UIStackView! + @IBOutlet weak var totalSafesCreatedStackView: UIStackView! + + private var stepLabel: UILabel! + + private var onNext: (() -> ())? + private var stepNumber: Int = 1 + private var maxSteps: Int = 4 + + private var completion: (() -> Void)? + + convenience init(stepNumber: Int = 1, maxSteps: Int = 4, completion: @escaping () -> ()) { + self.init(namedClass: WhatIsSafeViewController.self) + self.stepNumber = stepNumber + self.maxSteps = maxSteps + self.completion = completion + } + + override func viewDidLoad() { + super.viewDidLoad() + ViewControllerFactory.removeUnderlineFromNavigationBar(self) + + screenTitle.text = "What is Safe?" + screenTitle.setStyle(.claimTitle) + + firstParagraph.setStyle(.secondary) + firstParagraph.text = "Safe is critical infrastructure for web3. It is a programmable account standard that enables secure management of digital assets, data and identity.\nWith this token launch, Safe is now a community-driven ownership platform." + + paragraphTitle.text = "Why are we launching a token?" + paragraphTitle.setStyle(.title5) + + secondParagraph.setStyle(.secondary) + secondParagraph.text = "As critical web3 infrastructure, Safe needs to be a community-owned, censorship resistant project, with a committed ecosystem stewarding its decisions. A governance token is needed to help coordinate this effort." + + nextButton.setText("Next", .filled) + + stepLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 50, height: 21)) + stepLabel.textAlignment = .right + navigationItem.rightBarButtonItem = UIBarButtonItem(customView: stepLabel) + stepLabel.setStyle(.tertiary) + stepLabel.text = "\(stepNumber) of \(maxSteps)" + + totalSafesCreatedLabel.setStyle(.callout) + totalValueProtected.setStyle(.callout) + totalValueProtectedStackView.layer.cornerRadius = 10 + totalSafesCreatedStackView.layer.cornerRadius = 10 + } + + @IBAction func nextClicked(_ sender: Any) { + completion?() + } + +} diff --git a/Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.xib b/Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.xib new file mode 100644 index 000000000..090bef53c --- /dev/null +++ b/Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.xib @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Multisig/UI/ClaimToken/Views/TweetBox.swift b/Multisig/UI/ClaimToken/Views/TweetBox.swift index d72c22332..75a8a70af 100644 --- a/Multisig/UI/ClaimToken/Views/TweetBox.swift +++ b/Multisig/UI/ClaimToken/Views/TweetBox.swift @@ -37,7 +37,7 @@ class TweetBox: UINibView { tweetLabel.attributedText = "\(text) \(hashtagsString)".highlightRange( originalStyle: .secondary.color(.labelPrimary), highlightStyle: .primary.color(.primary), - textToHightlight: hashtagsString + textToHighlight: hashtagsString ) } diff --git a/Multisig/UI/UI Library/String+Highlight.swift b/Multisig/UI/UI Library/String+Highlight.swift index dc8088e25..64df44e0c 100644 --- a/Multisig/UI/UI Library/String+Highlight.swift +++ b/Multisig/UI/UI Library/String+Highlight.swift @@ -36,7 +36,7 @@ extension String { func highlightRange(originalStyle: GNOTextStyle = .secondary, highlightStyle: GNOTextStyle = .primary, - textToHightlight: String? = nil) -> NSAttributedString { + textToHighlight: String? = nil) -> NSAttributedString { let attributedString = NSMutableAttributedString( string: self, attributes: [ @@ -46,7 +46,7 @@ extension String { ] ) - if let textToHightlight = textToHightlight { + if let textToHightlight = textToHighlight { let rangeToHightlight = (attributedString.string as NSString).range(of: textToHightlight) attributedString.addAttributes([ .font: UIFont.gnoFont(forTextStyle: highlightStyle),