ToSButtonView.swift (1670B)
1 /* 2 * This file is part of GNU Taler, ©2022-25 Taler Systems S.A. 3 * See LICENSE.md 4 */ 5 /** 6 * @author Marc Stibane 7 */ 8 import SwiftUI 9 10 struct ToSButtonView: View { 11 let stack: CallStack 12 let exchangeBaseUrl: String? 13 let viewID: Int // either VIEW_WITHDRAW_TOS or SHEET_WITHDRAW_TOS 14 let p2p: Bool 15 let acceptAction: (() async -> Void)? 16 17 @AppStorage("minimalistic") var minimalistic: Bool = false 18 19 var body: some View { 20 let hint = minimalistic ? String(localized: "You must first accept the payment service's terms of service.") 21 : p2p ? String(localized: "You must first accept the payment service's terms of service before you can receive digital cash in your wallet.", comment: "P2P Receive") 22 : String(localized: "You must first accept the payment service's terms of service before you can withdraw digital cash to your wallet.") 23 Text(hint) 24 .talerFont(.body) 25 .multilineTextAlignment(.leading) 26 .padding() 27 let destination = WithdrawTOSView(stack: stack.push(), 28 exchangeBaseUrl: exchangeBaseUrl, 29 viewID: viewID, 30 acceptAction: acceptAction) // pop back to here 31 NavigationLink(destination: destination) { 32 Text("Terms of Service") // VIEW_WITHDRAW_TOS 33 }.buttonStyle(TalerButtonStyle(type: .prominent)) 34 .padding(.horizontal) 35 } 36 } 37 38 #Preview { 39 ToSButtonView(stack: CallStack("Preview"), exchangeBaseUrl: nil, viewID: 0, p2p: false, acceptAction: nil) 40 }