Skip to content

Commit

Permalink
IDPROD-3501: Tint icons on consent screen for dark mode (#936)
Browse files Browse the repository at this point in the history
Tint icons on consent screen with adaptive 
color so they're visible in dark mode.
  • Loading branch information
mludowise-stripe authored Mar 31, 2022
1 parent 7b454fa commit 647e23a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum VerificationSheetFlowControllerError: Error, Equatable, LocalizedError {
}
}

@available(iOS 13, *)
final class VerificationSheetFlowController {

let brandLogo: UIImage
Expand All @@ -60,6 +61,7 @@ final class VerificationSheetFlowController {
}()
}

@available(iOS 13, *)
@available(iOSApplicationExtension, unavailable)
extension VerificationSheetFlowController: VerificationSheetFlowControllerProtocol {
/// Transitions to the next view controller in the flow with a 'push' animation.
Expand Down Expand Up @@ -322,6 +324,7 @@ extension VerificationSheetFlowController: VerificationSheetFlowControllerProtoc

// MARK: - IdentityFlowNavigationControllerDelegate

@available(iOS 13, *)
extension VerificationSheetFlowController: IdentityFlowNavigationControllerDelegate {
func identityFlowNavigationControllerDidDismiss(_ navigationController: IdentityFlowNavigationController) {
delegate?.verificationSheetFlowControllerDidDismiss(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct IdentityUI {
return UILabel.appearance().textColor ?? CompatibleColor.label
}

static let iconColor = UIColor.systemGray

// MARK: Separator

static let separatorColor = CompatibleColor.separator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit
@_spi(STP) import StripeCore
@_spi(STP) import StripeUICore

@available(iOS 13, *)
@available(iOSApplicationExtension, unavailable)
final class BiometricConsentViewController: IdentityFlowViewController {

Expand Down Expand Up @@ -90,12 +91,12 @@ final class BiometricConsentViewController: IdentityFlowViewController {
try htmlView.configure(with: .init(
iconText: [
.init(
image: Image.iconClock.makeImage(),
image: Image.iconClock.makeImage().withTintColor(IdentityUI.iconColor),
text: consentContent.timeEstimate,
isTextHTML: false
),
.init(
image: Image.iconInfo.makeImage(),
image: Image.iconInfo.makeImage().withTintColor(IdentityUI.iconColor),
text: consentContent.privacyPolicy,
isTextHTML: true
),
Expand All @@ -116,6 +117,7 @@ final class BiometricConsentViewController: IdentityFlowViewController {

// MARK: - Private Helpers

@available(iOS 13, *)
@available(iOSApplicationExtension, unavailable)
private extension BiometricConsentViewController {

Expand All @@ -142,6 +144,7 @@ private extension BiometricConsentViewController {

// MARK: - IdentityDataCollecting

@available(iOS 13, *)
@available(iOSApplicationExtension, unavailable)
extension BiometricConsentViewController: IdentityDataCollecting {
var collectedFields: Set<VerificationPageFieldType> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class ErrorView: UIView {
static let errorTitleLabelSpacing: CGFloat = 12
static let contentInset: NSDirectionalEdgeInsets = .init(top: 132, leading: 16, bottom: 0, trailing: 16)
static let warningIconImageSpacing: CGFloat = 27
static let warningIconTintColor: UIColor = .systemGray
}

struct ViewModel {
Expand Down Expand Up @@ -52,7 +51,7 @@ class ErrorView: UIView {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.image = Image.iconWarning92.makeImage(template: true)
imageView.tintColor = Styling.warningIconTintColor
imageView.tintColor = IdentityUI.iconColor
return imageView
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation
import FBSnapshotTestCase
@testable import StripeIdentity

@available(iOS 13, *)
final class BiometricConsentViewControllerSnapshotTest: FBSnapshotTestCase {
static let mockVerificationPage = try! VerificationPageMock.response200.make()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Vision

private let mockError = NSError(domain: "", code: 0, userInfo: nil)

@available(iOS 13, *)
final class VerificationSheetFlowControllerTest: XCTestCase {

let flowController = VerificationSheetFlowController(brandLogo: UIImage())
Expand Down Expand Up @@ -307,6 +308,7 @@ final class VerificationSheetFlowControllerTest: XCTestCase {
}
}

@available(iOS 13, *)
private extension VerificationSheetFlowControllerTest {
func nextViewController(
missingRequirements: Set<VerificationPageFieldType>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation
import XCTest
@testable import StripeIdentity

@available(iOS 13, *)
final class BiometricConsentViewControllerTest: XCTestCase {

static let mockVerificationPage = try! VerificationPageMock.response200.make()
Expand Down
Binary file modified ...entViewControllerSnapshotTest/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 647e23a

Please sign in to comment.