damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit a13efb7832453844389cf5561d437441d61328a8
parent e3b3c9dedd7a3d7a84efa043bf7157c649794998
Author: William Casarin <jb55@jb55.com>
Date:   Tue,  9 May 2023 18:13:33 -0700

ui: move gradient components to their own group

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 16++++++++++++++++
Adamus/Components/Gradients/AlbyGradient.swift | 15+++++++++++++++
Adamus/Components/Gradients/DamusGradient.swift | 26++++++++++++++++++++++++++
Mdamus/Views/SetupView.swift | 11-----------
4 files changed, 57 insertions(+), 11 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -140,6 +140,8 @@ 4C7D096D2A0AEA0400943473 /* CodeScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D096A2A0AEA0400943473 /* CodeScanner.swift */; }; 4C7D096E2A0AEA0400943473 /* ScannerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D096B2A0AEA0400943473 /* ScannerCoordinator.swift */; }; 4C7D096F2A0AEA0400943473 /* ScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D096C2A0AEA0400943473 /* ScannerViewController.swift */; }; + 4C7D09722A0AEF5E00943473 /* DamusGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D09712A0AEF5E00943473 /* DamusGradient.swift */; }; + 4C7D09742A0AEF9000943473 /* AlbyGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7D09732A0AEF9000943473 /* AlbyGradient.swift */; }; 4C7FF7D52823313F009601DB /* Mentions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C7FF7D42823313F009601DB /* Mentions.swift */; }; 4C8682872814DE470026224F /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8682862814DE470026224F /* ProfileView.swift */; }; 4C8D00C829DF791C0036AF10 /* CompatibleAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8D00C729DF791C0036AF10 /* CompatibleAttribute.swift */; }; @@ -551,6 +553,8 @@ 4C7D096A2A0AEA0400943473 /* CodeScanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeScanner.swift; sourceTree = "<group>"; }; 4C7D096B2A0AEA0400943473 /* ScannerCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScannerCoordinator.swift; sourceTree = "<group>"; }; 4C7D096C2A0AEA0400943473 /* ScannerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScannerViewController.swift; sourceTree = "<group>"; }; + 4C7D09712A0AEF5E00943473 /* DamusGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamusGradient.swift; sourceTree = "<group>"; }; + 4C7D09732A0AEF9000943473 /* AlbyGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbyGradient.swift; sourceTree = "<group>"; }; 4C7FF7D42823313F009601DB /* Mentions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mentions.swift; sourceTree = "<group>"; }; 4C8682862814DE470026224F /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; }; 4C8D00C729DF791C0036AF10 /* CompatibleAttribute.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompatibleAttribute.swift; sourceTree = "<group>"; }; @@ -1004,6 +1008,15 @@ path = CodeScanner; sourceTree = "<group>"; }; + 4C7D09702A0AEF4C00943473 /* Gradients */ = { + isa = PBXGroup; + children = ( + 4C7D09712A0AEF5E00943473 /* DamusGradient.swift */, + 4C7D09732A0AEF9000943473 /* AlbyGradient.swift */, + ); + path = Gradients; + sourceTree = "<group>"; + }; 4C7FF7D628233637009601DB /* Util */ = { isa = PBXGroup; children = ( @@ -1155,6 +1168,7 @@ 4CE4F9DF285287A000C00DD9 /* Components */ = { isa = PBXGroup; children = ( + 4C7D09702A0AEF4C00943473 /* Gradients */, 31D2E846295218AF006D67F8 /* Shimmer.swift */, 4CD7641A28A1641400B6928F /* EndBlock.swift */, 4C06670528FCB08600038D2A /* ImageCarousel.swift */, @@ -1569,6 +1583,7 @@ 4CA5588329F33F5B00DC6A45 /* StringCodable.swift in Sources */, 4C75EFB92804A2740006080F /* EventView.swift in Sources */, 4C8D00C829DF791C0036AF10 /* CompatibleAttribute.swift in Sources */, + 4C7D09742A0AEF9000943473 /* AlbyGradient.swift in Sources */, 3AA247FD297E3CFF0090C62D /* RepostsModel.swift in Sources */, 4C198DF229F88C6B004C165C /* BlurHashDecode.swift in Sources */, F75BA12F29A18EF500E10810 /* BookmarksView.swift in Sources */, @@ -1642,6 +1657,7 @@ 4C3BEFD22819DB9B00B3DE84 /* ProfileModel.swift in Sources */, 4C0A3F93280F66F5000448DE /* ReplyMap.swift in Sources */, 7C95CAEE299DCEF1009DCB67 /* KFOptionSetter+.swift in Sources */, + 4C7D09722A0AEF5E00943473 /* DamusGradient.swift in Sources */, 4CCEB7B029B5415A0078AA28 /* SearchingProfileView.swift in Sources */, BAB68BED29543FA3007BA466 /* SelectWalletView.swift in Sources */, 3169CAE6294E69C000EE4006 /* EmptyTimelineView.swift in Sources */, diff --git a/damus/Components/Gradients/AlbyGradient.swift b/damus/Components/Gradients/AlbyGradient.swift @@ -0,0 +1,15 @@ +// +// AlbyGradient.swift +// damus +// +// Created by William Casarin on 2023-05-09. +// + +import SwiftUI + +fileprivate let alby_grad_c1 = hex_col(r: 226, g: 168, b: 122) +fileprivate let alby_grad_c2 = hex_col(r: 249, g: 223, b: 127) +fileprivate let alby_grad = [alby_grad_c2, alby_grad_c1] + +let AlbyGradient: LinearGradient = + LinearGradient(colors: alby_grad, startPoint: .bottomLeading, endPoint: .topTrailing) diff --git a/damus/Components/Gradients/DamusGradient.swift b/damus/Components/Gradients/DamusGradient.swift @@ -0,0 +1,26 @@ +// +// DamusGradient.swift +// damus +// +// Created by William Casarin on 2023-05-09. +// + +import SwiftUI + +fileprivate let damus_grad_c1 = hex_col(r: 0x1c, g: 0x55, b: 0xff) +fileprivate let damus_grad_c2 = hex_col(r: 0x7f, g: 0x35, b: 0xab) +fileprivate let damus_grad_c3 = hex_col(r: 0xff, g: 0x0b, b: 0xd6) +fileprivate let damus_grad = [damus_grad_c1, damus_grad_c2, damus_grad_c3] + +struct DamusGradient: View { + var body: some View { + LinearGradient(colors: damus_grad, startPoint: .bottomLeading, endPoint: .topTrailing) + .edgesIgnoringSafeArea([.top,.bottom]) + } +} + +struct DamusGradient_Previews: PreviewProvider { + static var previews: some View { + DamusGradient() + } +} diff --git a/damus/Views/SetupView.swift b/damus/Views/SetupView.swift @@ -15,23 +15,12 @@ func hex_col(r: UInt8, g: UInt8, b: UInt8) -> Color { opacity: 1.0) } -let damus_grad_c1 = hex_col(r: 0x1c, g: 0x55, b: 0xff) -let damus_grad_c2 = hex_col(r: 0x7f, g: 0x35, b: 0xab) -let damus_grad_c3 = hex_col(r: 0xff, g: 0x0b, b: 0xd6) -let damus_grad = [damus_grad_c1, damus_grad_c2, damus_grad_c3] - enum SetupState { case home case create_account case login } -struct DamusGradient: View { - var body: some View { - LinearGradient(colors: damus_grad, startPoint: .bottomLeading, endPoint: .topTrailing) - .edgesIgnoringSafeArea([.top,.bottom]) - } -} struct SetupView: View { @State var state: SetupState? = .home