Skip to content
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
12 changes: 12 additions & 0 deletions brainwallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
247D74F32DA907FB00855B14 /* BRSet.c in Sources */ = {isa = PBXBuildFile; fileRef = 249C45972D936D5900E9C3B0 /* BRSet.c */; };
247D74F42DA907FB00855B14 /* BRTransaction.c in Sources */ = {isa = PBXBuildFile; fileRef = 249C45992D936D5900E9C3B0 /* BRTransaction.c */; };
247D74F52DA907FB00855B14 /* BRWallet.c in Sources */ = {isa = PBXBuildFile; fileRef = 249C459B2D936D5900E9C3B0 /* BRWallet.c */; };
248E5C3D2DE76612003F232F /* BrainwalletShapes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 248E5C3C2DE765FD003F232F /* BrainwalletShapes.swift */; };
2492829C2DAC22B00088528E /* BIP39Words.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2492829B2DAC22B00088528E /* BIP39Words.plist */; };
249C45DC2D93F23F00E9C3B0 /* service-data.plist in Resources */ = {isa = PBXBuildFile; fileRef = 249C45DB2D93F23F00E9C3B0 /* service-data.plist */; };
249C45E02D9415D900E9C3B0 /* AppsFlyerLib in Frameworks */ = {isa = PBXBuildFile; productRef = 249C45DF2D9415D900E9C3B0 /* AppsFlyerLib */; };
Expand Down Expand Up @@ -475,6 +476,7 @@
24618EE92D90435200A878AC /* BRCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRCore.swift; sourceTree = "<group>"; };
2465873623A5AAD000A32E9E /* brainwalletTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = brainwalletTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2473D44E2DB991D90076746A /* PasscodeGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasscodeGridView.swift; sourceTree = "<group>"; };
248E5C3C2DE765FD003F232F /* BrainwalletShapes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrainwalletShapes.swift; sourceTree = "<group>"; };
2492829B2DAC22B00088528E /* BIP39Words.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = BIP39Words.plist; sourceTree = "<group>"; };
249C450E2D936D5900E9C3B0 /* ax_jni_include_dir.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ax_jni_include_dir.m4; sourceTree = "<group>"; };
249C450F2D936D5900E9C3B0 /* ax_prog_cc_for_build.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ax_prog_cc_for_build.m4; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1145,6 +1147,14 @@
path = Colors;
sourceTree = "<group>";
};
248E5C3B2DE765F1003F232F /* Custom Shapes */ = {
isa = PBXGroup;
children = (
248E5C3C2DE765FD003F232F /* BrainwalletShapes.swift */,
);
path = "Custom Shapes";
sourceTree = "<group>";
};
249C45112D936D5900E9C3B0 /* m4 */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1660,6 +1670,7 @@
C312D2CD2D7DC27700BB97A4 /* brainwallet */ = {
isa = PBXGroup;
children = (
248E5C3B2DE765F1003F232F /* Custom Shapes */,
241B477E2DCEA05D00279954 /* Localizations */,
24D7AE522DCFF6350078252E /* New Onboarding */,
24A404212DC92F1F006CD076 /* New Buy Webview */,
Expand Down Expand Up @@ -2438,6 +2449,7 @@
C312D3492D7DC27700BB97A4 /* StartNavigationDelegate.swift in Sources */,
C312D34C2D7DC27700BB97A4 /* AssociatedObject.swift in Sources */,
C312D34D2D7DC27700BB97A4 /* StartViewController.swift in Sources */,
248E5C3D2DE76612003F232F /* BrainwalletShapes.swift in Sources */,
C312D34F2D7DC27700BB97A4 /* DispatchQueue+Additions.swift in Sources */,
C312D3512D7DC27700BB97A4 /* DataValidation.swift in Sources */,
C312D3532D7DC27700BB97A4 /* TransactionModalView.swift in Sources */,
Expand Down
99 changes: 99 additions & 0 deletions brainwallet/Custom Shapes/BrainwalletShapes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
//
// BrainwalletShapes.swift
// brainwallet
//
// Created by Kerry Washington on 28/05/2025.
// Copyright © 2025 Grunt Software, LTD. All rights reserved.
//
import SwiftUI

struct BrainwalletHexagon: Shape {

func path(in rect: CGRect) -> Path {
let width = rect.width
let height = rect.height
let centerX = rect.midX
let centerY = rect.midY

// Calculate hexagon points (flat-top orientation)
let radius = min(width, height) / 2

var path = Path()

// Start from top vertex and go clockwise (pointy-top orientation)
path.move(to: CGPoint(x: centerX, y: centerY - radius))
path.addLine(to: CGPoint(x: centerX + radius * sin(π/3), y: centerY - radius * cos(π/3)))
path.addLine(to: CGPoint(x: centerX + radius * sin(π/3), y: centerY + radius * cos(π/3)))
path.addLine(to: CGPoint(x: centerX, y: centerY + radius))
path.addLine(to: CGPoint(x: centerX - radius * sin(π/3), y: centerY + radius * cos(π/3)))
path.addLine(to: CGPoint(x: centerX - radius * sin(π/3), y: centerY - radius * cos(π/3)))
path.closeSubpath()
return path

}
}



struct TestShapeView: View {

@State
private var progress = 0.0

var body: some View {
GeometryReader { geometry in

let width = geometry.size.width
let height = geometry.size.height

ZStack {
BrainwalletColor.surface.edgesIgnoringSafeArea(.all)

VStack {


ZStack {
BrainwalletHexagon()
.fill(BrainwalletColor.affirm)

BrainwalletHexagon()
.trim(from: 0, to: progress)
.stroke(BrainwalletColor.affirm.opacity(0.5),
style: StrokeStyle(lineWidth: 3, lineCap: .round))
}
.frame(width: 30, height: 30)
.onAppear {
withAnimation(.easeInOut(duration: 1.0).repeatForever(autoreverses: false)) {
progress = 1.0
}
}

BrainwalletHexagon()
.fill(.red)
.overlay(
BrainwalletHexagon()
.stroke(Color.blue, lineWidth: 2)
)

ZStack {
BrainwalletHexagon()
.fill(BrainwalletColor.background)

BrainwalletHexagon()
.trim(from: 0, to: progress)
.stroke(BrainwalletColor.content.opacity(0.5),
style: StrokeStyle(lineWidth: 3, lineCap: .round))
}
.frame(width: 100, height: 100)
.onAppear {
withAnimation(.easeInOut(duration: 1.0).repeatForever(autoreverses: false)) {
progress = 1.0
}
}

}

}
}
}
}