Skip to content

Commit

Permalink
Merge pull request #15 from tinkoff-mobile-tech/design_update
Browse files Browse the repository at this point in the history
  • Loading branch information
daivlev authored Jul 25, 2022
2 parents 09ccf62 + b61c91f commit e42218f
Show file tree
Hide file tree
Showing 19 changed files with 771 additions and 136 deletions.
16 changes: 14 additions & 2 deletions Example/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,20 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
credentialsRefresher: tinkoffId,
signOutInitializer: tinkoffId
)

window?.rootViewController = authController
authController.tabBarItem = UITabBarItem(title: "Auth", image: nil, tag: 0)

let tinkoffButtonsController = TinkoffButtonsViewController()
tinkoffButtonsController.tabBarItem = UITabBarItem(title: "UI", image: nil, tag: 1)

let tabBarController = UITabBarController()

if #available(iOS 13.0, *) {
authController.tabBarItem.image = UIImage(systemName: "person")
tinkoffButtonsController.tabBarItem.image = UIImage(systemName: "pencil")
}
tabBarController.viewControllers = [authController, tinkoffButtonsController]

window?.rootViewController = tabBarController
window?.makeKeyAndVisible()
}

Expand Down
5 changes: 4 additions & 1 deletion Example/App/AuthViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ final class AuthViewController: UIViewController {

// MARK: - UI
lazy var credentialsLabel = UILabel()
lazy var signInButton = TinkoffIDButtonBuilder.build(.default)
lazy var signInButton = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(size: .large),
title: "Войти с "
)
lazy var signOutButton = UIButton()
lazy var refreshButton = UIButton()

Expand Down
131 changes: 131 additions & 0 deletions Example/App/TinkoffButtonsViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
//
// UIViewController.swift
// TinkoffIDExample
//
// Created by Margarita Shishkina on 14.07.2022.
// Copyright © 2022 Tinkoff. All rights reserved.
//

import UIKit
import TinkoffID

class TinkoffButtonsViewController: UIViewController {

private lazy var stackView: UIStackView = {
let stackView = UIStackView()
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.alignment = .leading
stackView.axis = .vertical
stackView.distribution = .fill
stackView.spacing = 4
return stackView
}()

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .white

let scrollView = UIScrollView()
scrollView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(scrollView)
NSLayoutConstraint.activate([
scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16),
scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -8),
scrollView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 8),
scrollView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -16)
])

scrollView.addSubview(stackView)
NSLayoutConstraint.activate([
stackView.topAnchor.constraint(equalTo: scrollView.topAnchor),
stackView.leftAnchor.constraint(equalTo: scrollView.leftAnchor),
stackView.rightAnchor.constraint(equalTo: scrollView.rightAnchor),
stackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
stackView.widthAnchor.constraint(equalTo: scrollView.widthAnchor)
])

setupButtons()
}

private func setupButtons() {
let buttonSmallDark = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(colorStyle: .alternativeDark, size: .small)
)
stackView.addArrangedSubview(createLabel(with: "Small, alternativeDark"))
stackView.addArrangedSubview(buttonSmallDark)
stackView.setCustomSpacing(15, after: buttonSmallDark)

let buttonSmall = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(size: .small),
title: "Войти с "
)
stackView.addArrangedSubview(createLabel(with: "Small, custom title"))
stackView.addArrangedSubview(buttonSmall)
stackView.setCustomSpacing(15, after: buttonSmall)

let buttonMedium = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(colorStyle: .alternativeLight)
)
stackView.addArrangedSubview(createLabel(with: "Medium, alternativeLight"))
stackView.addArrangedSubview(buttonMedium)
stackView.setCustomSpacing(15, after: buttonMedium)

let buttonLarge = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(
colorStyle: .alternativeDark,
size: .large,
font: UIFont(name: "Noteworthy", size: 15)!
),
title: "Войти с "
)
stackView.addArrangedSubview(createLabel(with: "Large, alternativeDark, custom font"))
stackView.addArrangedSubview(buttonLarge)
stackView.setCustomSpacing(15, after: buttonLarge)

let buttonSmallBadge = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(size: .small),
badge: "5% кэшбэк"
)
stackView.addArrangedSubview(createLabel(with: "Small, badge"))
stackView.addArrangedSubview(buttonSmallBadge)
stackView.setCustomSpacing(15, after: buttonSmallBadge)

let buttonCustomSizeBadge = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(colorStyle: .alternativeLight, cornerRadius: 20),
badge: "5% кэшбэк"
)
stackView.addArrangedSubview(createLabel(with: "Custom size, badge, alternativeLight, corner radius 20"))
stackView.addArrangedSubview(buttonCustomSizeBadge)
stackView.setCustomSpacing(15, after: buttonCustomSizeBadge)
buttonCustomSizeBadge.heightAnchor.constraint(equalToConstant: 80).isActive = true
buttonCustomSizeBadge.widthAnchor.constraint(equalTo: stackView.widthAnchor).isActive = true

let buttonBadge = TinkoffIDButtonBuilder.build(
configuration: TinkoffIDButtonConfiguration(colorStyle: .alternativeDark),
badge: "500000% кэшбэк"
)
stackView.addArrangedSubview(createLabel(with: "badge, alternativeDark"))
stackView.addArrangedSubview(buttonBadge)
stackView.setCustomSpacing(15, after: buttonBadge)

let compactButton = TinkoffIDButtonBuilder.buildCompact()
stackView.addArrangedSubview(createLabel(with: "Compact button"))
stackView.addArrangedSubview(compactButton)
stackView.setCustomSpacing(15, after: compactButton)

let compactButtonLight = TinkoffIDButtonBuilder.buildCompact(colorStyle: .alternativeLight)
stackView.addArrangedSubview(createLabel(with: "Compact button, alternativeLight, custom size"))
stackView.addArrangedSubview(compactButtonLight)
compactButtonLight.heightAnchor.constraint(equalToConstant: 70).isActive = true
compactButtonLight.widthAnchor.constraint(equalToConstant: 70).isActive = true
}

private func createLabel(with text: String) -> UILabel {
let label = UILabel()
label.textColor = .black
label.font = UIFont.systemFont(ofSize: 14)
label.text = text
return label
}
}
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- SnapKit (5.0.1)
- TinkoffID (0.0.1)
- TinkoffID/Tests (0.0.1)
- TinkoffID (1.1.0)
- TinkoffID/Tests (1.1.0)

DEPENDENCIES:
- SnapKit
Expand All @@ -18,7 +18,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
TinkoffID: ac03552becea632de0f13d9461621770444ae0b8
TinkoffID: 5f8c16ed1ec6ab3c055d76b162d5770a324ad3db

PODFILE CHECKSUM: ebbf3aa204a2c47033aee78dc783acf8bc5423bd

Expand Down
52 changes: 26 additions & 26 deletions Example/TinkoffIDExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,44 @@
0A65BBBC2590E8F000F613D5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0A65BBB92590E8F000F613D5 /* LaunchScreen.storyboard */; };
0A65BBBD2590E8F000F613D5 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0A65BBBA2590E8F000F613D5 /* Images.xcassets */; };
0ABFC7892590E86000168951 /* TinkoffID.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 0ABFC7882590E85F00168951 /* TinkoffID.podspec */; };
51600987FEAC3FA656A81460 /* Pods_TinkoffIDExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F2A6E6CE33587FF27858033 /* Pods_TinkoffIDExample.framework */; };
40741E50BFF4B766A19FC37A /* Pods_TinkoffIDExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 035CA265801E31090C779B3B /* Pods_TinkoffIDExample.framework */; };
B8B1F7102880026C008EAB8E /* TinkoffButtonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8B1F70F2880026C008EAB8E /* TinkoffButtonsViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
02D6235BCEC7A72B88084B7A /* Pods-TinkoffIDExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TinkoffIDExample.release.xcconfig"; path = "Target Support Files/Pods-TinkoffIDExample/Pods-TinkoffIDExample.release.xcconfig"; sourceTree = "<group>"; };
035CA265801E31090C779B3B /* Pods_TinkoffIDExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TinkoffIDExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
0A65BBAE2590E8D300F613D5 /* AuthViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthViewController.swift; sourceTree = "<group>"; };
0A65BBB12590E8D300F613D5 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
0A65BBB92590E8F000F613D5 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
0A65BBBA2590E8F000F613D5 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
0A65BBBB2590E8F000F613D5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0ABFC7882590E85F00168951 /* TinkoffID.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = TinkoffID.podspec; path = ../TinkoffID.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
25F4E23B300426AEB76132F3 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
44F9956D4542D8782CD4C3D8 /* Pods-TinkoffIDExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TinkoffIDExample.release.xcconfig"; path = "Target Support Files/Pods-TinkoffIDExample/Pods-TinkoffIDExample.release.xcconfig"; sourceTree = "<group>"; };
5C61E8899896A5A3B2571A79 /* Pods-TinkoffIDExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TinkoffIDExample.debug.xcconfig"; path = "Target Support Files/Pods-TinkoffIDExample/Pods-TinkoffIDExample.debug.xcconfig"; sourceTree = "<group>"; };
607FACD01AFB9204008FA782 /* TinkoffIDExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TinkoffIDExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
7F2A6E6CE33587FF27858033 /* Pods_TinkoffIDExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TinkoffIDExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
86F49E1AE66946E513814F6E /* Pods-TinkoffIDExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TinkoffIDExample.debug.xcconfig"; path = "Target Support Files/Pods-TinkoffIDExample/Pods-TinkoffIDExample.debug.xcconfig"; sourceTree = "<group>"; };
93A7498398FBAC5533C5966F /* Pods-TinkoffSignIn_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TinkoffSignIn_Example.debug.xcconfig"; path = "Target Support Files/Pods-TinkoffSignIn_Example/Pods-TinkoffSignIn_Example.debug.xcconfig"; sourceTree = "<group>"; };
B8B1F70F2880026C008EAB8E /* TinkoffButtonsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TinkoffButtonsViewController.swift; sourceTree = "<group>"; };
BA3AB1A1BD565FCA6D3E2744 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
E32A0480955749A2CEF75FC4 /* Pods-TinkoffSignIn_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TinkoffSignIn_Example.release.xcconfig"; path = "Target Support Files/Pods-TinkoffSignIn_Example/Pods-TinkoffSignIn_Example.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
607FACCD1AFB9204008FA782 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
51600987FEAC3FA656A81460 /* Pods_TinkoffIDExample.framework in Frameworks */,
40741E50BFF4B766A19FC37A /* Pods_TinkoffIDExample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
05689BF3C94E278BB77E91B9 /* Frameworks */ = {
isa = PBXGroup;
children = (
7F2A6E6CE33587FF27858033 /* Pods_TinkoffIDExample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
0A65BBAD2590E8D300F613D5 /* App */ = {
isa = PBXGroup;
children = (
0A65BBB12590E8D300F613D5 /* AppDelegate.swift */,
0A65BBAE2590E8D300F613D5 /* AuthViewController.swift */,
B8B1F70F2880026C008EAB8E /* TinkoffButtonsViewController.swift */,
0A65BBB82590E8F000F613D5 /* Resources */,
);
path = App;
Expand All @@ -72,14 +65,22 @@
path = Resources;
sourceTree = "<group>";
};
4EAEDD680A06A0C99D9474AF /* Frameworks */ = {
isa = PBXGroup;
children = (
035CA265801E31090C779B3B /* Pods_TinkoffIDExample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
607FACC71AFB9204008FA782 = {
isa = PBXGroup;
children = (
607FACF51AFB993E008FA782 /* Podspec Metadata */,
0A65BBAD2590E8D300F613D5 /* App */,
607FACD11AFB9204008FA782 /* Products */,
D4A376ECE1B32FFCA6022572 /* Pods */,
05689BF3C94E278BB77E91B9 /* Frameworks */,
4EAEDD680A06A0C99D9474AF /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -104,10 +105,8 @@
D4A376ECE1B32FFCA6022572 /* Pods */ = {
isa = PBXGroup;
children = (
93A7498398FBAC5533C5966F /* Pods-TinkoffSignIn_Example.debug.xcconfig */,
E32A0480955749A2CEF75FC4 /* Pods-TinkoffSignIn_Example.release.xcconfig */,
86F49E1AE66946E513814F6E /* Pods-TinkoffIDExample.debug.xcconfig */,
44F9956D4542D8782CD4C3D8 /* Pods-TinkoffIDExample.release.xcconfig */,
5C61E8899896A5A3B2571A79 /* Pods-TinkoffIDExample.debug.xcconfig */,
02D6235BCEC7A72B88084B7A /* Pods-TinkoffIDExample.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand All @@ -119,11 +118,11 @@
isa = PBXNativeTarget;
buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "TinkoffIDExample" */;
buildPhases = (
37CFEEDB18E1B7B1ED595B67 /* [CP] Check Pods Manifest.lock */,
4AAE7DBEBDBA13C7FC4C7236 /* [CP] Check Pods Manifest.lock */,
607FACCC1AFB9204008FA782 /* Sources */,
607FACCD1AFB9204008FA782 /* Frameworks */,
607FACCE1AFB9204008FA782 /* Resources */,
7C076F48CF4E01832D45CFB4 /* [CP] Embed Pods Frameworks */,
82A91C430F311D4F3A9538D0 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -183,7 +182,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
37CFEEDB18E1B7B1ED595B67 /* [CP] Check Pods Manifest.lock */ = {
4AAE7DBEBDBA13C7FC4C7236 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -205,7 +204,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
7C076F48CF4E01832D45CFB4 /* [CP] Embed Pods Frameworks */ = {
82A91C430F311D4F3A9538D0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -231,6 +230,7 @@
files = (
0A65BBB62590E8D300F613D5 /* AppDelegate.swift in Sources */,
0A65BBB32590E8D300F613D5 /* AuthViewController.swift in Sources */,
B8B1F7102880026C008EAB8E /* TinkoffButtonsViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -345,7 +345,7 @@
};
607FACF01AFB9204008FA782 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 86F49E1AE66946E513814F6E /* Pods-TinkoffIDExample.debug.xcconfig */;
baseConfigurationReference = 5C61E8899896A5A3B2571A79 /* Pods-TinkoffIDExample.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
Expand All @@ -370,7 +370,7 @@
};
607FACF11AFB9204008FA782 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 44F9956D4542D8782CD4C3D8 /* Pods-TinkoffIDExample.release.xcconfig */;
baseConfigurationReference = 02D6235BCEC7A72B88084B7A /* Pods-TinkoffIDExample.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
Expand Down
Loading

0 comments on commit e42218f

Please sign in to comment.