diff --git a/brainwallet.xcodeproj/project.pbxproj b/brainwallet.xcodeproj/project.pbxproj index 594f33fe..2b7098b7 100644 --- a/brainwallet.xcodeproj/project.pbxproj +++ b/brainwallet.xcodeproj/project.pbxproj @@ -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 */; }; @@ -475,6 +476,7 @@ 24618EE92D90435200A878AC /* BRCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRCore.swift; sourceTree = ""; }; 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 = ""; }; + 248E5C3C2DE765FD003F232F /* BrainwalletShapes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrainwalletShapes.swift; sourceTree = ""; }; 2492829B2DAC22B00088528E /* BIP39Words.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = BIP39Words.plist; sourceTree = ""; }; 249C450E2D936D5900E9C3B0 /* ax_jni_include_dir.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ax_jni_include_dir.m4; sourceTree = ""; }; 249C450F2D936D5900E9C3B0 /* ax_prog_cc_for_build.m4 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ax_prog_cc_for_build.m4; sourceTree = ""; }; @@ -1145,6 +1147,14 @@ path = Colors; sourceTree = ""; }; + 248E5C3B2DE765F1003F232F /* Custom Shapes */ = { + isa = PBXGroup; + children = ( + 248E5C3C2DE765FD003F232F /* BrainwalletShapes.swift */, + ); + path = "Custom Shapes"; + sourceTree = ""; + }; 249C45112D936D5900E9C3B0 /* m4 */ = { isa = PBXGroup; children = ( @@ -1660,6 +1670,7 @@ C312D2CD2D7DC27700BB97A4 /* brainwallet */ = { isa = PBXGroup; children = ( + 248E5C3B2DE765F1003F232F /* Custom Shapes */, 241B477E2DCEA05D00279954 /* Localizations */, 24D7AE522DCFF6350078252E /* New Onboarding */, 24A404212DC92F1F006CD076 /* New Buy Webview */, @@ -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 */, diff --git a/brainwallet/Custom Shapes/BrainwalletShapes.swift b/brainwallet/Custom Shapes/BrainwalletShapes.swift new file mode 100644 index 00000000..0975251a --- /dev/null +++ b/brainwallet/Custom Shapes/BrainwalletShapes.swift @@ -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 + } + } + + } + + } + } + } +}