Compare commits
6 Commits
main
...
glass-moti
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75f8850115 | ||
|
|
dd8adb2c59 | ||
|
|
02336c04b8 | ||
|
|
6b19d78f53 | ||
|
|
79ce995af2 | ||
|
|
9a931e1b22 |
|
|
@ -292,12 +292,12 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 10;
|
||||
CURRENT_PROJECT_VERSION = 16;
|
||||
GENERATE_INFOPLIST_FILE = NO;
|
||||
INFOPLIST_FILE = Kasztelan/Info.plist;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.food-and-drink";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
MARKETING_VERSION = 1.0.8;
|
||||
MARKETING_VERSION = 1.0.9;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = uk.co.kasztelan.app.ios;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
|
|
@ -316,12 +316,12 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 10;
|
||||
CURRENT_PROJECT_VERSION = 16;
|
||||
GENERATE_INFOPLIST_FILE = NO;
|
||||
INFOPLIST_FILE = Kasztelan/Info.plist;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.food-and-drink";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
|
||||
MARKETING_VERSION = 1.0.8;
|
||||
MARKETING_VERSION = 1.0.9;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = uk.co.kasztelan.app.ios;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,19 @@ struct AuthView: View {
|
|||
}
|
||||
.padding(.bottom, 18)
|
||||
|
||||
if registering { registrationForm }
|
||||
else { loginForm }
|
||||
if registering {
|
||||
registrationForm
|
||||
.transition(.move(edge: .trailing).combined(with: .opacity))
|
||||
} else {
|
||||
loginForm
|
||||
.transition(.move(edge: .leading).combined(with: .opacity))
|
||||
}
|
||||
}
|
||||
.padding(22)
|
||||
.animation(.spring(response: 0.42, dampingFraction: 0.86), value: registering)
|
||||
}
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
.background(KTheme.background)
|
||||
.background(AmbientBackground())
|
||||
}
|
||||
|
||||
private var loginForm: some View {
|
||||
|
|
@ -55,9 +61,7 @@ struct AuthView: View {
|
|||
}
|
||||
.accessibilityLabel(model.text("Otwórz resetowanie hasła", "Open password reset"))
|
||||
Button(model.text("Załóż konto", "Create account")) { registering = true }
|
||||
.frame(maxWidth: .infinity, minHeight: 50)
|
||||
.background(KTheme.panel)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
||||
.buttonStyle(GlassButtonStyle())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -85,9 +89,7 @@ struct AuthView: View {
|
|||
}
|
||||
.buttonStyle(PrimaryButtonStyle())
|
||||
Button(model.text("Mam już konto", "I already have an account")) { registering = false }
|
||||
.frame(maxWidth: .infinity, minHeight: 50)
|
||||
.background(KTheme.panel)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
||||
.buttonStyle(GlassButtonStyle())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +122,9 @@ struct LanguageButton: View {
|
|||
.font(.subheadline.bold())
|
||||
.foregroundStyle(KTheme.orange)
|
||||
.frame(width: 44, height: 44, alignment: .center)
|
||||
.background(KTheme.panel, in: Circle())
|
||||
.background(.ultraThinMaterial, in: Circle())
|
||||
.overlay { Circle().stroke(.white.opacity(0.20), lineWidth: 1) }
|
||||
.shadow(color: KTheme.orange.opacity(0.18), radius: 12)
|
||||
.contentShape(Circle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ struct CardView: View {
|
|||
GeometryReader { geometry in
|
||||
let compact = geometry.size.height < 680
|
||||
|
||||
VStack(alignment: .leading, spacing: compact ? 10 : 18) {
|
||||
VStack(alignment: .leading, spacing: compact ? 8 : 12) {
|
||||
Text(model.text("Witaj, ", "Hello, ") + firstName)
|
||||
.font(compact ? .title.bold() : .largeTitle.bold())
|
||||
.lineLimit(1)
|
||||
|
|
@ -36,10 +36,10 @@ struct CardView: View {
|
|||
summary(compact: compact)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, compact ? 8 : 14)
|
||||
.padding(.top, compact ? 0 : 2)
|
||||
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .top)
|
||||
}
|
||||
.background(KTheme.background)
|
||||
.background(.clear)
|
||||
.fullScreenCover(isPresented: $cardScannerPresented) {
|
||||
CardScannerScreen(
|
||||
onScan: acceptScannedCard,
|
||||
|
|
@ -89,11 +89,17 @@ struct CardView: View {
|
|||
}
|
||||
|
||||
private func loyaltyCard(compact: Bool) -> some View {
|
||||
return VStack(spacing: compact ? 10 : 20) {
|
||||
GlassDepthDeck {
|
||||
loyaltyCardFace(compact: compact)
|
||||
}
|
||||
}
|
||||
|
||||
private func loyaltyCardFace(compact: Bool) -> some View {
|
||||
VStack(spacing: compact ? 10 : 20) {
|
||||
Image("Logo")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(maxHeight: compact ? 54 : 76)
|
||||
.frame(maxHeight: compact ? 66 : 88)
|
||||
if model.cardNumber.count == 13 {
|
||||
VStack(spacing: compact ? 4 : 8) {
|
||||
CardBarcodeView(digits: model.cardNumber)
|
||||
|
|
@ -120,8 +126,7 @@ struct CardView: View {
|
|||
.tint(.white)
|
||||
.padding(.horizontal, 14)
|
||||
.frame(minHeight: 50)
|
||||
.background(KTheme.panel.opacity(0.92))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
|
||||
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 12, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.stroke(Color.white.opacity(0.35), lineWidth: 1)
|
||||
|
|
@ -144,8 +149,7 @@ struct CardView: View {
|
|||
Label(model.text("Skanuj kartę", "Scan card"), systemImage: "camera.viewfinder")
|
||||
.frame(maxWidth: .infinity, minHeight: 22)
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.tint(.white)
|
||||
.buttonStyle(GlassButtonStyle())
|
||||
.font(.subheadline.weight(.semibold))
|
||||
Button {
|
||||
cardNumberFocused = false
|
||||
|
|
@ -154,17 +158,50 @@ struct CardView: View {
|
|||
Text(model.text("Nie mam karty — wygeneruj cyfrową", "I don't have a card — create a digital one"))
|
||||
.frame(maxWidth: .infinity, minHeight: 22)
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
.tint(.white)
|
||||
.buttonStyle(GlassButtonStyle())
|
||||
.font(.subheadline.weight(.semibold))
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(compact ? 14 : 22)
|
||||
.background(LinearGradient(colors: [KTheme.orange, KTheme.pink, KTheme.purple], startPoint: .topLeading, endPoint: .bottomTrailing))
|
||||
.background {
|
||||
ZStack {
|
||||
LinearGradient(
|
||||
colors: [KTheme.orange.opacity(0.94), KTheme.pink.opacity(0.90), KTheme.purple.opacity(0.94)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
Circle()
|
||||
.fill(.white.opacity(0.16))
|
||||
.frame(width: 210, height: 210)
|
||||
.blur(radius: 10)
|
||||
.offset(x: 150, y: -130)
|
||||
Circle()
|
||||
.fill(KTheme.cyan.opacity(0.14))
|
||||
.frame(width: 140, height: 140)
|
||||
.blur(radius: 16)
|
||||
.offset(x: -145, y: 150)
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.22), .clear, .black.opacity(0.12)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
}
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: 26, style: .continuous))
|
||||
.shadow(color: KTheme.pink.opacity(0.2), radius: 18, y: 8)
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 26, style: .continuous)
|
||||
.stroke(
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.72), .white.opacity(0.18), KTheme.pink.opacity(0.38)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
),
|
||||
lineWidth: 1.5
|
||||
)
|
||||
}
|
||||
.shadow(color: KTheme.pink.opacity(0.28), radius: 28, y: 16)
|
||||
}
|
||||
|
||||
private func acceptScannedCard(_ scan: ScannedCard) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<string>$(KASZTELAN_APP_KEY)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Aparat służy do skanowania kodów z kart rabatowych.</string>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import SwiftUI
|
||||
import UIKit
|
||||
import UserNotifications
|
||||
import BackgroundTasks
|
||||
import CoreSpotlight
|
||||
|
|
@ -119,6 +120,21 @@ struct KasztelanApp: App {
|
|||
@StateObject private var model = AppModel()
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
init() {
|
||||
let navigationAppearance = UINavigationBarAppearance()
|
||||
navigationAppearance.configureWithTransparentBackground()
|
||||
navigationAppearance.backgroundColor = .clear
|
||||
navigationAppearance.backgroundEffect = nil
|
||||
navigationAppearance.shadowColor = .clear
|
||||
|
||||
let navigationBar = UINavigationBar.appearance()
|
||||
navigationBar.standardAppearance = navigationAppearance
|
||||
navigationBar.scrollEdgeAppearance = navigationAppearance
|
||||
navigationBar.compactAppearance = navigationAppearance
|
||||
navigationBar.isTranslucent = true
|
||||
navigationBar.backgroundColor = .clear
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
RootView()
|
||||
|
|
@ -144,7 +160,7 @@ struct RootView: View {
|
|||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
KTheme.background.ignoresSafeArea()
|
||||
AmbientBackground()
|
||||
if model.isLoading {
|
||||
ProgressView(model.text("Sprawdzam konto…", "Checking your account…"))
|
||||
.tint(KTheme.orange)
|
||||
|
|
|
|||
|
|
@ -4,19 +4,44 @@ struct MainTabView: View {
|
|||
@EnvironmentObject private var model: AppModel
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $model.selectedTab) {
|
||||
NavigationStack { WalletView() }
|
||||
.tabItem { Label(model.text("Karta", "Card"), systemImage: "creditcard.fill") }
|
||||
.tag(0)
|
||||
NavigationStack { MessagesView() }
|
||||
.tabItem { Label(model.text("Wiadomości", "Messages"), systemImage: "envelope.fill") }
|
||||
.badge(model.messages.count)
|
||||
.tag(1)
|
||||
NavigationStack { ProfileView() }
|
||||
.tabItem { Label(model.text("Profil", "Profile"), systemImage: "person.crop.circle.fill") }
|
||||
.tag(2)
|
||||
ZStack {
|
||||
AmbientBackground()
|
||||
|
||||
TabView(selection: $model.selectedTab) {
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
AmbientBackground()
|
||||
WalletView()
|
||||
}
|
||||
}
|
||||
.toolbarBackground(.hidden, for: .navigationBar)
|
||||
.tabItem { Label(model.text("Karta", "Card"), systemImage: "creditcard.fill") }
|
||||
.tag(0)
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
AmbientBackground()
|
||||
MessagesView()
|
||||
}
|
||||
}
|
||||
.toolbarBackground(.hidden, for: .navigationBar)
|
||||
.tabItem { Label(model.text("Wiadomości", "Messages"), systemImage: "envelope.fill") }
|
||||
.badge(model.messages.count)
|
||||
.tag(1)
|
||||
NavigationStack {
|
||||
ZStack {
|
||||
AmbientBackground()
|
||||
ProfileView()
|
||||
}
|
||||
}
|
||||
.toolbarBackground(.hidden, for: .navigationBar)
|
||||
.tabItem { Label(model.text("Profil", "Profile"), systemImage: "person.crop.circle.fill") }
|
||||
.tag(2)
|
||||
}
|
||||
.background(.clear)
|
||||
}
|
||||
.tint(KTheme.orange)
|
||||
.toolbarBackground(.ultraThinMaterial, for: .tabBar)
|
||||
.toolbarBackground(.visible, for: .tabBar)
|
||||
.task { await NotificationService.requestPermission() }
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +54,8 @@ struct AppToolbar: ToolbarContent {
|
|||
Image("Logo")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 170, height: 44)
|
||||
.frame(width: 190, height: 46)
|
||||
.shadow(color: KTheme.pink.opacity(0.28), radius: 12)
|
||||
}
|
||||
ToolbarItem(placement: .topBarTrailing) { LanguageButton() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,9 @@ struct MessagesView: View {
|
|||
}
|
||||
.padding(20)
|
||||
}
|
||||
.background(KTheme.background)
|
||||
.background(.clear)
|
||||
.toolbar { AppToolbar() }
|
||||
.toolbarBackground(.hidden, for: .navigationBar)
|
||||
.refreshable { await model.refresh() }
|
||||
.task { await model.refresh() }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ struct ProfileView: View {
|
|||
if model.cardNumber.isEmpty { cardAssignment }
|
||||
|
||||
Button(model.text("Zmień hasło", "Change password")) { changingPassword = true }
|
||||
.frame(maxWidth: .infinity, minHeight: 52)
|
||||
.background(KTheme.panel)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
||||
.buttonStyle(GlassButtonStyle())
|
||||
Button(model.text("Wyloguj", "Sign out")) { Task { await model.logout() } }
|
||||
.buttonStyle(PrimaryButtonStyle())
|
||||
Button(model.text("Usuń konto", "Delete account"), role: .destructive) { deletingAccount = true }
|
||||
|
|
@ -53,8 +51,9 @@ struct ProfileView: View {
|
|||
}
|
||||
.padding(20)
|
||||
}
|
||||
.background(KTheme.background)
|
||||
.background(.clear)
|
||||
.toolbar { AppToolbar() }
|
||||
.toolbarBackground(.hidden, for: .navigationBar)
|
||||
.fullScreenCover(isPresented: $editingProfile) { EditProfileView() }
|
||||
.sheet(isPresented: $changingPassword) { ChangePasswordView() }
|
||||
.sheet(isPresented: $deletingAccount) {
|
||||
|
|
@ -69,7 +68,7 @@ struct ProfileView: View {
|
|||
Spacer()
|
||||
}
|
||||
.padding(20)
|
||||
.background(KTheme.background)
|
||||
.background(AmbientBackground())
|
||||
.navigationTitle(model.text("Usuń konto", "Delete account"))
|
||||
.toolbar { ToolbarItem(placement: .cancellationAction) { Button(model.text("Anuluj", "Cancel")) { deletingAccount = false } } }
|
||||
}
|
||||
|
|
@ -95,9 +94,7 @@ struct ProfileView: View {
|
|||
Button(model.text("Nie mam karty — wygeneruj cyfrową", "I don't have a card — create a digital one")) {
|
||||
Task { _ = await model.generateCard() }
|
||||
}
|
||||
.frame(maxWidth: .infinity, minHeight: 50)
|
||||
.background(KTheme.panel)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16))
|
||||
.buttonStyle(GlassButtonStyle())
|
||||
}
|
||||
.kasztelanPanel()
|
||||
}
|
||||
|
|
@ -138,7 +135,7 @@ struct EditProfileView: View {
|
|||
.frame(maxWidth: .infinity)
|
||||
.padding(20)
|
||||
}
|
||||
.background(KTheme.background)
|
||||
.background(AmbientBackground())
|
||||
.navigationTitle(model.text("Edytuj profil", "Edit profile"))
|
||||
.toolbar { ToolbarItem(placement: .cancellationAction) { Button(model.text("Anuluj", "Cancel")) { dismiss() } } }
|
||||
.onAppear { form = model.profileForm() }
|
||||
|
|
@ -174,7 +171,7 @@ struct ChangePasswordView: View {
|
|||
Spacer()
|
||||
}
|
||||
.padding(20)
|
||||
.background(KTheme.background)
|
||||
.background(AmbientBackground())
|
||||
.navigationTitle(model.text("Zmień hasło", "Change password"))
|
||||
.toolbar { ToolbarItem(placement: .cancellationAction) { Button(model.text("Anuluj", "Cancel")) { dismiss() } } }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,168 @@
|
|||
import SwiftUI
|
||||
|
||||
enum KTheme {
|
||||
static let background = Color(red: 11/255, green: 11/255, blue: 14/255)
|
||||
static let panel = Color(red: 28/255, green: 28/255, blue: 34/255)
|
||||
static let background = Color(red: 5/255, green: 6/255, blue: 12/255)
|
||||
static let panel = Color(red: 28/255, green: 28/255, blue: 38/255)
|
||||
static let orange = Color(red: 1, green: 106/255, blue: 0)
|
||||
static let pink = Color(red: 242/255, green: 29/255, blue: 167/255)
|
||||
static let purple = Color(red: 111/255, green: 60/255, blue: 1)
|
||||
static let cyan = Color(red: 41/255, green: 209/255, blue: 1)
|
||||
}
|
||||
|
||||
struct AmbientBackground: View {
|
||||
@Environment(\.accessibilityReduceMotion) private var reduceMotion
|
||||
@State private var isMoving = false
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
KTheme.background
|
||||
RadialGradient(
|
||||
colors: [KTheme.purple.opacity(0.32), .clear],
|
||||
center: .topLeading,
|
||||
startRadius: 10,
|
||||
endRadius: 420
|
||||
)
|
||||
.scaleEffect(isMoving ? 1.18 : 0.92)
|
||||
.offset(x: isMoving ? 36 : -28, y: isMoving ? 70 : -50)
|
||||
|
||||
Circle()
|
||||
.fill(KTheme.pink.opacity(0.22))
|
||||
.frame(width: 260, height: 260)
|
||||
.blur(radius: 42)
|
||||
.offset(x: isMoving ? 150 : 95, y: isMoving ? -250 : -190)
|
||||
|
||||
Circle()
|
||||
.fill(KTheme.orange.opacity(0.20))
|
||||
.frame(width: 220, height: 220)
|
||||
.blur(radius: 48)
|
||||
.offset(x: isMoving ? -150 : -90, y: isMoving ? 320 : 250)
|
||||
|
||||
Circle()
|
||||
.fill(KTheme.cyan.opacity(0.12))
|
||||
.frame(width: 180, height: 180)
|
||||
.blur(radius: 40)
|
||||
.offset(x: isMoving ? -120 : -165, y: isMoving ? -40 : 80)
|
||||
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.045), .clear, .black.opacity(0.25)],
|
||||
startPoint: .top,
|
||||
endPoint: .bottom
|
||||
)
|
||||
}
|
||||
.ignoresSafeArea()
|
||||
.onAppear {
|
||||
guard !reduceMotion else { return }
|
||||
withAnimation(.easeInOut(duration: 9).repeatForever(autoreverses: true)) {
|
||||
isMoving = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct GlassDepthDeck<Content: View>: View {
|
||||
private let cornerRadius: CGFloat
|
||||
private let content: Content
|
||||
|
||||
init(cornerRadius: CGFloat = 26, @ViewBuilder content: () -> Content) {
|
||||
self.cornerRadius = cornerRadius
|
||||
self.content = content()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
|
||||
.fill(.black.opacity(0.50))
|
||||
.scaleEffect(x: 0.94, y: 0.97)
|
||||
.offset(y: 18)
|
||||
.blur(radius: 18)
|
||||
|
||||
content
|
||||
.shadow(color: .black.opacity(0.66), radius: 30, y: 20)
|
||||
.shadow(color: KTheme.purple.opacity(0.30), radius: 24, x: -8, y: 8)
|
||||
.shadow(color: KTheme.pink.opacity(0.30), radius: 20, x: 10, y: 4)
|
||||
|
||||
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
|
||||
.fill(
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.20), .clear, .clear, .black.opacity(0.12)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
)
|
||||
.allowsHitTesting(false)
|
||||
|
||||
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
|
||||
.stroke(
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.92), .white.opacity(0.18), KTheme.purple.opacity(0.52)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
),
|
||||
lineWidth: 2.2
|
||||
)
|
||||
.allowsHitTesting(false)
|
||||
|
||||
RoundedRectangle(cornerRadius: cornerRadius - 3, style: .continuous)
|
||||
.inset(by: 3)
|
||||
.stroke(
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.34), .clear, .black.opacity(0.28)],
|
||||
startPoint: .top,
|
||||
endPoint: .bottom
|
||||
),
|
||||
lineWidth: 1
|
||||
)
|
||||
.allowsHitTesting(false)
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Capsule()
|
||||
.fill(.white.opacity(0.58))
|
||||
.frame(width: 112, height: 4)
|
||||
.blur(radius: 0.6)
|
||||
.padding(.top, 8)
|
||||
.padding(.leading, 22)
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.allowsHitTesting(false)
|
||||
}
|
||||
.compositingGroup()
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
}
|
||||
|
||||
struct PanelModifier: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.padding(18)
|
||||
.background(KTheme.panel)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 18, style: .continuous))
|
||||
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 22, style: .continuous)
|
||||
.stroke(
|
||||
LinearGradient(
|
||||
colors: [.white.opacity(0.30), .white.opacity(0.06), KTheme.pink.opacity(0.16)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
),
|
||||
lineWidth: 1
|
||||
)
|
||||
}
|
||||
.shadow(color: .black.opacity(0.22), radius: 24, y: 14)
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
func kasztelanPanel() -> some View { modifier(PanelModifier()) }
|
||||
|
||||
func glassSurface(cornerRadius: CGFloat = 18) -> some View {
|
||||
background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: cornerRadius, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
|
||||
.stroke(.white.opacity(0.20), lineWidth: 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PrimaryButtonStyle: ButtonStyle {
|
||||
|
|
@ -27,8 +171,37 @@ struct PrimaryButtonStyle: ButtonStyle {
|
|||
.font(.headline)
|
||||
.foregroundStyle(.white)
|
||||
.frame(maxWidth: .infinity, minHeight: 54)
|
||||
.background(KTheme.pink.opacity(configuration.isPressed ? 0.72 : 1))
|
||||
.background(
|
||||
LinearGradient(
|
||||
colors: [KTheme.pink, KTheme.purple, KTheme.orange],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
.opacity(configuration.isPressed ? 0.72 : 1)
|
||||
)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 16, style: .continuous)
|
||||
.stroke(.white.opacity(configuration.isPressed ? 0.12 : 0.30), lineWidth: 1)
|
||||
}
|
||||
.shadow(color: KTheme.pink.opacity(configuration.isPressed ? 0.10 : 0.30), radius: 18, y: 9)
|
||||
.scaleEffect(configuration.isPressed ? 0.975 : 1)
|
||||
.animation(.spring(response: 0.24, dampingFraction: 0.72), value: configuration.isPressed)
|
||||
}
|
||||
}
|
||||
|
||||
struct GlassButtonStyle: ButtonStyle {
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
configuration.label
|
||||
.foregroundStyle(.white)
|
||||
.frame(maxWidth: .infinity, minHeight: 52)
|
||||
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 16, style: .continuous)
|
||||
.stroke(.white.opacity(configuration.isPressed ? 0.10 : 0.24), lineWidth: 1)
|
||||
}
|
||||
.scaleEffect(configuration.isPressed ? 0.975 : 1)
|
||||
.animation(.spring(response: 0.24, dampingFraction: 0.72), value: configuration.isPressed)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,8 +229,12 @@ struct KasztelanField: View {
|
|||
.autocorrectionDisabled(keyboard == .emailAddress)
|
||||
.padding(.horizontal, 16)
|
||||
.frame(maxWidth: .infinity, minHeight: 54)
|
||||
.background(KTheme.panel)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous))
|
||||
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 14, style: .continuous)
|
||||
.stroke(isFocused ? KTheme.orange.opacity(0.75) : .white.opacity(0.18), lineWidth: 1)
|
||||
}
|
||||
.shadow(color: isFocused ? KTheme.orange.opacity(0.14) : .clear, radius: 12)
|
||||
.foregroundStyle(.white)
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .keyboard) {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ struct WalletView: View {
|
|||
|
||||
var body: some View {
|
||||
walletCarousel
|
||||
.background(KTheme.background)
|
||||
.background(.clear)
|
||||
.toolbar { walletToolbar }
|
||||
.toolbarBackground(.hidden, for: .navigationBar)
|
||||
.onAppear { selectedPage = 0 }
|
||||
.task(id: model.user?.id) { await store.sync(using: model) }
|
||||
.fullScreenCover(isPresented: $scannerPresented) { scannerView }
|
||||
|
|
@ -31,18 +32,27 @@ struct WalletView: View {
|
|||
|
||||
private var walletCarousel: some View {
|
||||
GeometryReader { geometry in
|
||||
AnyView(currentPage)
|
||||
.id(pageIdentity)
|
||||
.offset(x: dragOffset)
|
||||
.offset(y: carouselArc(width: geometry.size.width))
|
||||
.scaleEffect(carouselScale(width: geometry.size.width))
|
||||
.rotation3DEffect(carouselAngle(width: geometry.size.width), axis: (x: 0, y: 1, z: 0), perspective: 0.9)
|
||||
.opacity(carouselOpacity(width: geometry.size.width))
|
||||
.shadow(color: .black.opacity(carouselShadow), radius: 24, x: dragOffset < 0 ? 12 : -12)
|
||||
.contentShape(Rectangle())
|
||||
.simultaneousGesture(carouselGesture(width: geometry.size.width))
|
||||
.overlay(alignment: .bottom) { pageIndicator }
|
||||
.clipped()
|
||||
ZStack {
|
||||
WalletMotionBubbles(progress: carouselProgress(width: geometry.size.width))
|
||||
|
||||
AnyView(currentPage)
|
||||
.id(pageIdentity)
|
||||
.offset(x: dragOffset)
|
||||
.offset(y: carouselArc(width: geometry.size.width))
|
||||
.scaleEffect(carouselScale(width: geometry.size.width))
|
||||
.rotation3DEffect(
|
||||
carouselAngle(width: geometry.size.width),
|
||||
axis: (x: 0.08, y: 1, z: 0),
|
||||
perspective: 0.62
|
||||
)
|
||||
.rotationEffect(.degrees(Double(carouselProgress(width: geometry.size.width)) * -2.4))
|
||||
.opacity(carouselOpacity(width: geometry.size.width))
|
||||
.shadow(color: KTheme.purple.opacity(carouselShadow), radius: 32, x: dragOffset < 0 ? 16 : -16, y: 12)
|
||||
.contentShape(Rectangle())
|
||||
.simultaneousGesture(carouselGesture(width: geometry.size.width))
|
||||
}
|
||||
.safeAreaInset(edge: .bottom, spacing: 0) { pageIndicator }
|
||||
.clipped()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,23 +103,27 @@ struct WalletView: View {
|
|||
}
|
||||
|
||||
private func carouselScale(width: CGFloat) -> CGFloat {
|
||||
1 - min(abs(dragOffset) / max(width, 1), 1) * 0.14
|
||||
1 - min(abs(carouselProgress(width: width)), 1) * 0.10
|
||||
}
|
||||
|
||||
private func carouselAngle(width: CGFloat) -> Angle {
|
||||
.degrees(Double(dragOffset / max(width, 1)) * 68)
|
||||
.degrees(Double(carouselProgress(width: width)) * 54)
|
||||
}
|
||||
|
||||
private func carouselArc(width: CGFloat) -> CGFloat {
|
||||
let progress = min(abs(dragOffset) / max(width, 1), 1)
|
||||
return progress * progress * 34
|
||||
let progress = min(abs(carouselProgress(width: width)), 1)
|
||||
return progress * progress * 24
|
||||
}
|
||||
|
||||
private func carouselOpacity(width: CGFloat) -> Double {
|
||||
1 - min(Double(abs(dragOffset) / max(width, 1)), 1) * 0.28
|
||||
1 - min(Double(abs(carouselProgress(width: width))), 1) * 0.22
|
||||
}
|
||||
|
||||
private var carouselShadow: Double { min(Double(abs(dragOffset) / 520), 0.42) }
|
||||
private func carouselProgress(width: CGFloat) -> CGFloat {
|
||||
dragOffset / max(width, 1)
|
||||
}
|
||||
|
||||
private var carouselShadow: Double { 0.12 + min(Double(abs(dragOffset) / 520), 0.34) }
|
||||
|
||||
private func carouselGesture(width: CGFloat) -> some Gesture {
|
||||
DragGesture(minimumDistance: 18)
|
||||
|
|
@ -152,7 +166,11 @@ struct WalletView: View {
|
|||
}
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 8)
|
||||
.background(.black.opacity(0.35), in: Capsule())
|
||||
.background(.ultraThinMaterial, in: Capsule())
|
||||
.overlay {
|
||||
Capsule()
|
||||
.stroke(.white.opacity(0.18), lineWidth: 1)
|
||||
}
|
||||
.padding(.bottom, 2)
|
||||
.allowsHitTesting(false)
|
||||
}
|
||||
|
|
@ -163,8 +181,8 @@ struct WalletView: View {
|
|||
let predicted = value.predictedEndTranslation.width
|
||||
guard horizontal, max(abs(value.translation.width), abs(predicted)) > max(52, width * 0.15) else {
|
||||
changingPage = true
|
||||
withAnimation(.easeOut(duration: 0.14)) { dragOffset = 0 }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { changingPage = false }
|
||||
withAnimation(.spring(response: 0.34, dampingFraction: 0.82)) { dragOffset = 0 }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { changingPage = false }
|
||||
return
|
||||
}
|
||||
changingPage = true
|
||||
|
|
@ -174,15 +192,53 @@ struct WalletView: View {
|
|||
instant.disablesAnimations = true
|
||||
withTransaction(instant) {
|
||||
selectedPage = (selectedPage + direction + pageCount) % pageCount
|
||||
dragOffset = direction > 0 ? width * 0.72 : -width * 0.72
|
||||
dragOffset = direction > 0 ? width * 0.82 : -width * 0.82
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
withAnimation(.easeOut(duration: 0.26)) { dragOffset = 0 }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.27) { changingPage = false }
|
||||
withAnimation(.spring(response: 0.48, dampingFraction: 0.84, blendDuration: 0.08)) { dragOffset = 0 }
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.50) { changingPage = false }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct WalletMotionBubbles: View {
|
||||
let progress: CGFloat
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
bubble(size: 112, tint: KTheme.pink.opacity(0.20))
|
||||
.offset(x: -145 + progress * 90, y: -230 - abs(progress) * 24)
|
||||
bubble(size: 74, tint: KTheme.orange.opacity(0.22))
|
||||
.offset(x: 145 + progress * 55, y: -80 + progress * 42)
|
||||
bubble(size: 148, tint: KTheme.purple.opacity(0.17))
|
||||
.offset(x: 125 - progress * 100, y: 255)
|
||||
bubble(size: 48, tint: KTheme.cyan.opacity(0.18))
|
||||
.offset(x: -120 - progress * 50, y: 150 + progress * 30)
|
||||
}
|
||||
.blur(radius: abs(progress) * 1.5)
|
||||
.allowsHitTesting(false)
|
||||
}
|
||||
|
||||
private func bubble(size: CGFloat, tint: Color) -> some View {
|
||||
Circle()
|
||||
.fill(.ultraThinMaterial)
|
||||
.frame(width: size, height: size)
|
||||
.overlay {
|
||||
Circle()
|
||||
.fill(
|
||||
RadialGradient(
|
||||
colors: [.white.opacity(0.28), tint, .clear],
|
||||
center: .topLeading,
|
||||
startRadius: 1,
|
||||
endRadius: size
|
||||
)
|
||||
)
|
||||
}
|
||||
.overlay { Circle().stroke(.white.opacity(0.14), lineWidth: 1) }
|
||||
.shadow(color: tint, radius: 24)
|
||||
}
|
||||
}
|
||||
|
||||
private struct AddDiscountCardView: View {
|
||||
@EnvironmentObject private var model: AppModel
|
||||
let scan: () -> Void
|
||||
|
|
@ -209,7 +265,7 @@ private struct AddDiscountCardView: View {
|
|||
}
|
||||
.padding(.bottom, 34)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(KTheme.background)
|
||||
.background(.clear)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,28 +289,43 @@ private struct DiscountCardView: View {
|
|||
.accessibilityLabel(model.text("Usuń kartę", "Delete card"))
|
||||
}
|
||||
|
||||
VStack(spacing: 18) {
|
||||
StoredBarcodeView(value: card.payload, symbology: card.symbology)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: card.isTwoDimensional ? 220 : 132)
|
||||
.padding(14)
|
||||
.background(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous))
|
||||
Text(card.payload)
|
||||
.font(.system(.headline, design: .monospaced).weight(.bold))
|
||||
.multilineTextAlignment(.center)
|
||||
.textSelection(.enabled)
|
||||
.lineLimit(3)
|
||||
.minimumScaleFactor(0.65)
|
||||
GlassDepthDeck {
|
||||
VStack(spacing: 18) {
|
||||
StoredBarcodeView(value: card.payload, symbology: card.symbology)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: card.isTwoDimensional ? 220 : 132)
|
||||
.padding(14)
|
||||
.background(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous))
|
||||
Text(card.payload)
|
||||
.font(.system(.headline, design: .monospaced).weight(.bold))
|
||||
.multilineTextAlignment(.center)
|
||||
.textSelection(.enabled)
|
||||
.lineLimit(3)
|
||||
.minimumScaleFactor(0.65)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(22)
|
||||
.background(
|
||||
ZStack {
|
||||
LinearGradient(
|
||||
colors: [KTheme.purple.opacity(0.92), KTheme.pink.opacity(0.88), KTheme.orange.opacity(0.86)],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
)
|
||||
Circle()
|
||||
.fill(.white.opacity(0.15))
|
||||
.frame(width: 170, height: 170)
|
||||
.blur(radius: 8)
|
||||
.offset(x: 145, y: -100)
|
||||
}
|
||||
)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 26, style: .continuous))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 26, style: .continuous)
|
||||
.stroke(.white.opacity(0.28), lineWidth: 1)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(22)
|
||||
.background(LinearGradient(
|
||||
colors: [KTheme.purple, KTheme.pink, KTheme.orange],
|
||||
startPoint: .topLeading,
|
||||
endPoint: .bottomTrailing
|
||||
))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 26, style: .continuous))
|
||||
|
||||
Text(model.text("Dostępna offline • zaszyfrowana synchronizacja", "Available offline • encrypted sync"))
|
||||
.font(.footnote)
|
||||
|
|
@ -264,7 +335,7 @@ private struct DiscountCardView: View {
|
|||
}
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 14)
|
||||
.background(KTheme.background)
|
||||
.background(.clear)
|
||||
.alert(model.text("Usunąć kartę?", "Delete this card?"), isPresented: $confirmingDelete) {
|
||||
Button(model.text("Anuluj", "Cancel"), role: .cancel) {}
|
||||
Button(model.text("Usuń", "Delete"), role: .destructive, action: delete)
|
||||
|
|
@ -294,7 +365,7 @@ private struct CardNameSheet: View {
|
|||
Spacer()
|
||||
}
|
||||
.padding(20)
|
||||
.background(KTheme.background)
|
||||
.background(AmbientBackground())
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button(model.text("Anuluj", "Cancel")) { dismiss() }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user