Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh 2588/what is safe screen #2611

Merged
merged 21 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Multisig.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -1748,6 +1750,8 @@
931AB80528808F3600264AAA /* TransactionPreviewRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionPreviewRequest.swift; sourceTree = "<group>"; };
935DCA4B27BD14C500F09EE4 /* WebConnectionDetailsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebConnectionDetailsViewController.swift; sourceTree = "<group>"; };
9388B98127C8DDE400AAB7F5 /* SafeDeploymentNotificationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafeDeploymentNotificationController.swift; sourceTree = "<group>"; };
93C38DBF28C74CAA005188EC /* WhatIsSafeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WhatIsSafeViewController.swift; path = Tutorial/WhatIsSafeViewController.swift; sourceTree = "<group>"; };
93C38DC028C74CAA005188EC /* WhatIsSafeViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = WhatIsSafeViewController.xib; path = Tutorial/WhatIsSafeViewController.xib; sourceTree = "<group>"; };
93EE3F6F2760EC7E00111F17 /* IntercomConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntercomConfig.swift; sourceTree = "<group>"; };
93EF2FA127C546330077BE95 /* InstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstructionsViewController.swift; sourceTree = "<group>"; };
93EF2FA227C546330077BE95 /* InstructionsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = InstructionsViewController.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2044,6 +2048,8 @@
0472B2B32869D5480049BA17 /* ClaimToken */ = {
isa = PBXGroup;
children = (
93C38DBF28C74CAA005188EC /* WhatIsSafeViewController.swift */,
93C38DC028C74CAA005188EC /* WhatIsSafeViewController.xib */,
6A6A105B2889A2B700B852D5 /* Views */,
0472B2B12869D3510049BA17 /* ClaimSafeTokenFlow.swift */,
0472B2B82869D66A0049BA17 /* ChooseDelegateIntroViewController.swift */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "ico-token.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Multisig/UI/App/Onboarding/OnboardingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 7 additions & 3 deletions Multisig/UI/App/ViewControllerFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion Multisig/UI/ClaimToken/ClaimSafeTokenFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Multisig/UI/ClaimToken/ClaimSuccessViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ClaimSuccessViewController: UIViewController {
textLabel.attributedText = text.highlightRange(
originalStyle: .secondary,
highlightStyle: .primary,
textToHightlight: amountString
textToHighlight: amountString
)

tweetBox.setTweet(
Expand Down
73 changes: 73 additions & 0 deletions Multisig/UI/ClaimToken/Tutorial/WhatIsSafeViewController.swift
Original file line number Diff line number Diff line change
@@ -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?()
}

}
Loading