taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

OIMpayView.swift (1200B)


      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 import taler_swift
     10 
     11 // MARK: -
     12 @available(iOS 16.4, *)
     13 struct OIMpayView: View {
     14     let stack: CallStack
     15     let amount: Amount?
     16 //    let decimal: Int            // 0 for ¥,HUF;   2 for $,€,£;   3 for ﷼,₯ (arabic)
     17 
     18     @EnvironmentObject private var wrapper: NamespaceWrapper
     19 
     20     @StateObject private var cash = OIMcash(OIMeuros)
     21     @State private var amountVal: UInt64 = 0
     22 
     23     var body: some View {
     24 //        let _ = Self._printChanges()
     25         let currency = cash.currency
     26 
     27         OIMbackground() {
     28             VStack {
     29                 Spacer()
     30                 OIMlineView(stack: stack.push(),
     31                              cash: cash,
     32                         amountVal: $amountVal,
     33                           canEdit: true)
     34                 .matchedGeometryEffect(id: OIMLINE, in: wrapper.namespace, isSource: true)
     35                 Spacer()
     36             }
     37 #if DEBUG
     38             .border(.red)
     39 #endif
     40         }
     41         .task {
     42             amountVal = amount?.centValue ?? 0                                  // TODO: centValue factor
     43         }
     44 
     45     }
     46 }