commit bac9b6d3c61786206eff19cc22697aeb4edf71ce parent 69bce3cc045ab897345d9b9eba655743cca45d64 Author: FIGBERT <figbert@figbert.com> Date: Fri, 11 Dec 2020 11:33:22 -0800 Add progress view while tip jar is loading Diffstat:
M | Shared/Settings Views/DonationSection.swift | | | 21 | +++++++++++++-------- |
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/Shared/Settings Views/DonationSection.swift b/Shared/Settings Views/DonationSection.swift @@ -17,14 +17,19 @@ struct DonationSection: View { .multilineTextAlignment(.center) .padding() HStack { - ForEach(storeManager.myProducts.sorted(by: { first, second in return first.price.doubleValue < second.price.doubleValue }), id: \.self) { product in - Text(product.priceFormatted()) - .foregroundColor(Color.white) - .padding() - .background(Color.blue.opacity(self.colorScheme == .dark ? 0.3 : 0.75).cornerRadius(10)) - .onTapGesture { - self.storeManager.purchaseProduct(product: product) - } + if storeManager.myProducts.isEmpty { + ProgressView() + .progressViewStyle(CircularProgressViewStyle()) + } else { + ForEach(storeManager.myProducts.sorted(by: { first, second in return first.price.doubleValue < second.price.doubleValue }), id: \.self) { product in + Text(product.priceFormatted()) + .foregroundColor(Color.white) + .padding() + .background(Color.blue.opacity(self.colorScheme == .dark ? 0.3 : 0.75).cornerRadius(10)) + .onTapGesture { + self.storeManager.purchaseProduct(product: product) + } + } } } .padding(.bottom)