Repository Public
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project : SP ID & Card Vault7// File : SPVault/Features/Shell/ScreenshotNoticeBanner.swift8// Module : SPVault9// Repository : https://git.spboucher.ai/sp-id-card-vault10// Project Website : Not specified11// Created : 2026-12-0212// Last Modified : 2026-12-0213//14// Author : Simon-Pierre Boucher15// Position : Professor of Finance16// Institution : Université du Québec en Outaouais (UQO)17// Organization : SP Boucher18// Website : https://spboucher.ai19// Git : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development : dev@spboucher.ai23// Support : support@spboucher.ai24// Security/Admin : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License : None specified (no license file in this repository)33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI4243/// Shown at the top of the shell right after iOS reports a screenshot. It states44/// what happened; it does not pretend the screenshot was prevented.45struct ScreenshotNoticeBanner: View {46 @Environment(AppEnvironment.self) private var environment47 @Environment(\.accessibilityReduceMotion) private var reduceMotion4849 var body: some View {50 let privacy = environment.privacy51 VStack {52 if privacy.pendingScreenshotNotice {53 HStack(spacing: SP.Space.s) {54 Image(systemName: "camera.viewfinder").font(.system(size: 17, weight: .semibold)).foregroundStyle(SP.Palette.warning)55 VStack(alignment: .leading, spacing: 2) {56 Text("Screenshot taken").font(.spCallout.weight(.semibold)).foregroundStyle(SP.Palette.textPrimary)57 Text("Delete it from Photos if it shows a card.").font(.spCaption).foregroundStyle(SP.Palette.textSecondary)58 }59 Spacer(minLength: 0)60 Button {61 privacy.pendingScreenshotNotice = false62 } label: {63 Image(systemName: "xmark").font(.system(size: 12, weight: .bold)).foregroundStyle(SP.Palette.textSecondary)64 .frame(width: 32, height: 32).contentShape(Circle())65 }66 .buttonStyle(.plain)67 .accessibilityLabel("Dismiss")68 }69 .padding(.horizontal, SP.Space.m).padding(.vertical, SP.Space.s)70 .spGlass(in: RoundedRectangle(cornerRadius: SP.Radius.l, style: .continuous), interactive: false)71 .padding(.horizontal, SP.Space.page)72 .padding(.top, SP.Space.xs)73 .transition(reduceMotion ? .opacity : .move(edge: .top).combined(with: .opacity))74 .accessibilityElement(children: .combine)75 .accessibilityIdentifier("banner.screenshot")76 .task {77 try? await Task.sleep(for: .seconds(5))78 privacy.pendingScreenshotNotice = false79 }80 }81 Spacer(minLength: 0)82 }83 .animation(reduceMotion ? SP.Motion.reduced : SP.Motion.quick, value: privacy.pendingScreenshotNotice)84 .allowsHitTesting(privacy.pendingScreenshotNotice)85 }86}87