Skip to content

Commit

Permalink
Colors moved to assets to get automatic dark mode support
Browse files Browse the repository at this point in the history
Fixed snapshot tests - now we force French language via xctestplan
Added snapshot tests to aggregated plan, so that they are run on CI too.
  • Loading branch information
VilemKurz committed Jan 31, 2024
1 parent 766a0cd commit bfefedb
Show file tree
Hide file tree
Showing 70 changed files with 1,204 additions and 185 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ jobs:
- name: Checkout repository
uses: actions/[email protected]
- name: Cache packages
uses: actions/cache@v3
uses: actions/cache@v4
id: packages-cache
with:
path: packages_cache
key: ${{ runner.os }}-packages-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-packages-
save-always: true
- name: Enable macros
run: defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
- name: Run tests
Expand Down
23 changes: 23 additions & 0 deletions NodeCrypto/NodeCrypto.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
isa = PBXNativeTarget;
buildConfigurationList = E75E1A622B0A8E760053C9E9 /* Build configuration list for PBXNativeTarget "NodeCrypto" */;
buildPhases = (
7A19B1A92B665853006CFE1A /* Swiftlint */,
E75E1A502B0A8E750053C9E9 /* Sources */,
E75E1A512B0A8E750053C9E9 /* Frameworks */,
E75E1A522B0A8E750053C9E9 /* Resources */,
Expand Down Expand Up @@ -168,6 +169,28 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
7A19B1A92B665853006CFE1A /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = Swiftlint;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
E75E1A502B0A8E750053C9E9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"location" : "https://github.com/Frameio/swift-snapshot-testing",
"state" : {
"revision" : "59b663f68e69f27a87b45de48cb63264b8194605",
"version" : "1.15.1"
"branch" : "image-colorspace-coversions",
"revision" : "2465c86a9f2166205ae3989e6909dfeb1d1b08a2"
}
},
{
Expand Down
9 changes: 9 additions & 0 deletions NodeCrypto/NodeCrypto/Aggregated.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
],
"defaultOptions" : {
"codeCoverage" : false,
"language" : "fr",
"region" : "FR",
"targetForVariableExpansion" : {
"containerPath" : "container:NodeCrypto.xcodeproj",
"identifier" : "E75E1A532B0A8E750053C9E9",
Expand Down Expand Up @@ -48,6 +50,13 @@
"identifier" : "OnboardingFeatureTests",
"name" : "OnboardingFeatureTests"
}
},
{
"target" : {
"containerPath" : "container:..\/Packages",
"identifier" : "SnapshotsTests",
"name" : "SnapshotsTests"
}
}
],
"version" : 1
Expand Down
3 changes: 2 additions & 1 deletion Packages/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", branch: "main"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.1.2"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.15.1"),
//.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.15.2"),
.package(url: "https://github.com/Frameio/swift-snapshot-testing", branch: "image-colorspace-coversions"),
.package(url: "https://github.com/tgrapperon/swift-dependencies-additions", from: "1.0.1"),
.package(url: "https://github.com/pointfreeco/swift-tagged", from: "0.10.0"),
.package(url: "https://github.com/oliverfoggin/swift-composable-analytics", from: "1.1.0"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ import Foundation
import SwiftUI

struct BackgroundLinearGradient: View {
@Environment(\.colorScheme) var colorScheme

var body: some View {
LinearGradient(
stops: colorScheme == .light
? [
Gradient.Stop(color: Color.hex(0xA4A8FF), location: 0.50),
Gradient.Stop(color: Color.hex(0xFFA4E0), location: 1.00)
]
: [
Gradient.Stop(color: Color(red: 0.08, green: 0.08, blue: 0.09), location: 0.00),
Gradient.Stop(color: Color(red: 0.08, green: 0.08, blue: 0.09).opacity(0.7), location: 1.00)
stops: [
Gradient.Stop(color: .connectWalletGradient1, location: 0.50),
Gradient.Stop(color: .connectWalletGradient2, location: 1)
],
startPoint: UnitPoint(x: 1, y: 0),
endPoint: UnitPoint(x: 0, y: 1)
Expand Down
15 changes: 7 additions & 8 deletions Packages/Sources/ConnectWalletFeature/ConnectWalletFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ extension BindingViewStore<ConnectWalletReducer.State> {
public struct ConnectWalletView: View {
var store: StoreOf<ConnectWalletReducer>

@Environment(\.colorScheme) var colorScheme

public init(store: StoreOf<ConnectWalletReducer>) {
self.store = store
}
Expand Down Expand Up @@ -133,7 +131,7 @@ public struct ConnectWalletView: View {
Text("Connect Wallet", bundle: .module)
.multilineTextAlignment(.center)
.font(Font(FontName.poppinsBold, size: 24))
.foregroundStyle(colorScheme == .light ? Color.neutral2 : Color.neutral8)
.foregroundStyle(Color.neutral2)

Spacer()

Expand Down Expand Up @@ -192,26 +190,27 @@ extension View {
}

struct PopUpModifier: ViewModifier {

let isPresented: Bool
let confirmAction: () -> Void
let cancelAction: () -> Void
@Environment(\.colorScheme) var colorScheme

func body(content: Content) -> some View {
ZStack {
content
.zIndex(0)

if isPresented {
Color.neutral1.opacity(0.7)
Color.neutral1
.opacity(colorScheme == .dark ? 0.75 : 0.5)
.ignoresSafeArea()
.transition(.opacity.animation(.easeInOut))
.zIndex(1)

VStack {
Text("This page will open another application.", bundle: .module)
.multilineTextAlignment(.center)
.foregroundStyle(colorScheme == .light ? Color.neutral2 : Color.neutral8)
.foregroundStyle(Color.neutral2)
.font(Font(FontName.poppinsRegular, size: 12))
.padding(.bottom, 20)

Expand All @@ -225,7 +224,7 @@ struct PopUpModifier: ViewModifier {
)
.clipShape(Capsule())
.buttonStyle(.borderedProminent)
.foregroundStyle(Color.neutral8)
.foregroundStyle(.white)
.tint(Color.primary1)
.frame(minHeight: 40)

Expand All @@ -251,7 +250,7 @@ struct PopUpModifier: ViewModifier {
.padding(20)
.frame(width: 270)
.background(
(colorScheme == .light ? Color.neutral8 : Color.neutral2)
Color.neutral8
.clipShape(RoundedRectangle(cornerRadius: 32))
)
.animation(.easeInOut, value: self.isPresented)
Expand Down
10 changes: 3 additions & 7 deletions Packages/Sources/ConnectWalletFeature/ConnectingWalletView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import SwiftUI
import StyleGuide

public struct ConnectingWalletView: View {
@Environment (\.colorScheme) var colorScheme

let selectedWallet: WalletType
let cancelPressed: () -> Void

Expand All @@ -34,11 +32,11 @@ public struct ConnectingWalletView: View {

HStack(spacing: 8) {
ProgressView()
.tint(colorScheme == .light ? Color.neutral2 : Color.neutral8)
.tint(Color.neutral2)

Text("Opening \(selectedWallet.rawValue)")
.font(Font.init(FontName.poppinsRegular, size: 14))
.foregroundStyle(colorScheme == .light ? Color.neutral2 : Color.neutral8)
.foregroundStyle(Color.neutral2)
}
}
}
Expand All @@ -54,7 +52,6 @@ public struct ConnectingWalletView: View {

struct CancelButton: View {
let action: () -> Void
@Environment(\.colorScheme) var colorScheme

var body: some View {
Button(action: { action() }) {
Expand All @@ -63,8 +60,7 @@ struct CancelButton: View {
}
.foregroundStyle(Color.neutral2)
.buttonStyle(.borderedProminent)
.tint(colorScheme == .light ? Color.neutral6 : Color.neutral8
)
.tint(Color.neutral6)
.clipShape(Capsule())
}
}
Expand Down
9 changes: 3 additions & 6 deletions Packages/Sources/ConnectWalletFeature/LabelsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import SwiftUI
import StyleGuide

struct LabelsView: View {

@Environment(\.colorScheme) var colorScheme

var message1: AttributedString {
var result = AttributedString(
String(localized: "By connecting your wallet, you agree to our", bundle: .module))
Expand All @@ -25,22 +22,22 @@ struct LabelsView: View {
var result = AttributedString(String(localized: "Terms of Service", bundle: .module))
result.link = URL(string: "https://stackoverflow.com")
result.font = Font(FontName.poppinsRegular, size: 12)
result.foregroundColor = colorScheme == .light ? Color.neutral3 : Color.neutral6
result.foregroundColor = Color.neutral3
return result
}

var message3: AttributedString {
var result = AttributedString(String(localized: "and our", bundle: .module))
result.font = Font(FontName.poppinsRegular, size: 12)
result.foregroundColor = Color.neutral4
result.foregroundColor = Color.neutral4
return result
}

var message4: AttributedString {
var result = AttributedString(String(localized: "Privacy and Policy", bundle: .module))
result.link = URL(string: "https://google.com")
result.font = Font(FontName.poppinsRegular, size: 12)
result.foregroundColor = colorScheme == .light ? Color.neutral3 : Color.neutral6
result.foregroundColor = Color.neutral3
return result
}

Expand Down
13 changes: 6 additions & 7 deletions Packages/Sources/ConnectWalletFeature/ListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,39 @@ import SwiftUI
import StyleGuide

public struct ListView: View {

let didSelectButton: (WalletType) -> Void
@Environment(\.colorScheme) var colorScheme

init(didSelectButton: @escaping (WalletType) -> Void) {
self.didSelectButton = didSelectButton
}

public var body: some View {
RoundedRectangle(cornerRadius: 32)
.foregroundStyle(colorScheme == .light ? .white.opacity(0.6) : Color.neutral3)
.foregroundStyle(Color.neutral8)
.overlay(
VStack {
Text("Choose your wallet", bundle: .module)
.foregroundStyle( colorScheme == .light ? Color.neutral2 : .neutral8)
.foregroundStyle(Color.neutral2)
.font(Font(FontName.poppinsRegular, size: 16))

LabelsView()

ScrollView {

VStack(spacing: 8) {
ListLabel(
WalletListRow(
title: "Rainbow",
walletType: .rainbow,
didSelectButton: didSelectButton(.rainbow)
)

ListLabel(
WalletListRow(
title: "Coinbase",
walletType: .coinbase,
didSelectButton: didSelectButton(.coinbase)
)

ListLabel(
WalletListRow(
title: "Metamasak",
walletType: .metamask,
didSelectButton: didSelectButton(.metamask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import Foundation
import SwiftUI
import StyleGuide

struct ListLabel: View {

struct WalletListRow: View {
let title: LocalizedStringKey
let walletType: WalletType
let didSelectButton: () -> Void
@Environment(\.colorScheme) var colorScheme

init(
title: LocalizedStringKey,
walletType: WalletType,
Expand All @@ -35,20 +34,18 @@ struct ListLabel: View {
title: {
Text(title, bundle: .module)
.font(Font(FontName.poppinsBold, size: 18))
.foregroundStyle(colorScheme == .light ? Color.neutral2 : Color.neutral8)
.foregroundStyle(Color.neutral2)
},
icon: { Image(walletType.rawValue, bundle: .module) }
)
Spacer()
Image(systemName: "chevron.right")
.foregroundStyle(colorScheme == .light ? Color.neutral2 : Color.neutral8)
Image(systemName: "chevron.right")
.foregroundStyle(Color.neutral2)
}
.frame(maxWidth: .infinity)
}
)
.frame(height: 65)
.foregroundStyle(.white.opacity(0.0001), colorScheme == .light ? Color.white.opacity(1) : Color.hex(0xFCFCDD).opacity(0.1))
.buttonStyle(.highlighted)
.foregroundStyle(Color.invisibleColor, Color.highlightedButtonSelected)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public struct OnboardingStepperReducer {
}

struct OnboardingStepper: View {
@Environment(\.colorScheme) var colorScheme
let store: StoreOf<OnboardingStepperReducer>
let disabledColor = Color.neutral5

Expand Down Expand Up @@ -124,7 +123,7 @@ struct OnboardingStepper: View {
)
}
.frame(width: 154, height: 64)
.background(colorScheme == .dark ? Color.neutral1 : Color.neutral8)
.background(Color.neutral8)
.clipShape(RoundedRectangle(cornerRadius: 16))
}
}
Expand Down
Loading

0 comments on commit bfefedb

Please sign in to comment.