Skip to content

Commit 68bef81

Browse files
committed
Add basic error view
1 parent 28be859 commit 68bef81

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import SwiftUI
2+
3+
/// Generic Store Picker error view that allows the user to contact support.
4+
///
5+
struct StorePickerError: View {
6+
var body: some View {
7+
VStack(alignment: .center) {
8+
// Title
9+
Text("We couldn't load your site")
10+
.headlineStyle()
11+
12+
// Main image
13+
Image(uiImage: .errorImage)
14+
15+
// Body text
16+
Text("Please try again or reach out to us and we'll be happy to assist you!")
17+
.bodyStyle()
18+
19+
// Primary Button
20+
Button("Read our Troubleshooting Tips") {
21+
print("Troubleshooting Tips tapped")
22+
}
23+
.buttonStyle(PrimaryButtonStyle())
24+
25+
// Secondary button
26+
Button("Contact Support") {
27+
print("Contact support tapped")
28+
}
29+
.buttonStyle(SecondaryButtonStyle())
30+
31+
// Dismiss button
32+
Button("Back to Sites") {
33+
print("Back to site")
34+
}
35+
.buttonStyle(LinkButtonStyle())
36+
}
37+
}
38+
}
39+
40+
// MARK: Previews
41+
42+
struct StorePickerError_Preview: PreviewProvider {
43+
static var previews: some View {
44+
StorePickerError()
45+
}
46+
}

WooCommerce/Classes/Authentication/Epilogue/StorePickerViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ private extension StorePickerViewController {
423423
RequirementsChecker.checkMinimumWooVersion(for: siteID) { [weak self] result in
424424
switch result {
425425
case .success(.validWCVersion):
426-
self?.updateUIForValidSite()
426+
//self?.updateUIForValidSite()
427+
self?.updateUIForEmptyOrErroredSite(named: siteName, with: siteID)
427428
case .success(.invalidWCVersion):
428429
self?.updateUIForInvalidSite(named: siteName)
429430
case .failure:

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@
390390
262A09A5262F65690033AD20 /* OrderAddOnTopBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262A09A4262F65690033AD20 /* OrderAddOnTopBanner.swift */; };
391391
262A2C2B2537A3330086C1BE /* MockRefunds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262A2C2A2537A3330086C1BE /* MockRefunds.swift */; };
392392
262C921F26EEF8B100011F92 /* Binding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262C921E26EEF8B100011F92 /* Binding.swift */; };
393+
262C922126F1370000011F92 /* StorePickerError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 262C922026F1370000011F92 /* StorePickerError.swift */; };
393394
263E37E12641AD8300260D3B /* Codegen in Frameworks */ = {isa = PBXBuildFile; productRef = 263E37E02641AD8300260D3B /* Codegen */; };
394395
263E37E22641AD8300260D3B /* Codegen in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 263E37E02641AD8300260D3B /* Codegen */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
395396
263E38462641FF3400260D3B /* Codegen in Frameworks */ = {isa = PBXBuildFile; productRef = 263E38452641FF3400260D3B /* Codegen */; };
@@ -1812,6 +1813,7 @@
18121813
262A09A4262F65690033AD20 /* OrderAddOnTopBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderAddOnTopBanner.swift; sourceTree = "<group>"; };
18131814
262A2C2A2537A3330086C1BE /* MockRefunds.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRefunds.swift; sourceTree = "<group>"; };
18141815
262C921E26EEF8B100011F92 /* Binding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Binding.swift; sourceTree = "<group>"; };
1816+
262C922026F1370000011F92 /* StorePickerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorePickerError.swift; sourceTree = "<group>"; };
18151817
263EB408242C58EA00F3A15F /* ProductFormActionsFactoryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFormActionsFactoryTests.swift; sourceTree = "<group>"; };
18161818
265284012624937600F91BA1 /* AddOnCrossreferenceUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOnCrossreferenceUseCase.swift; sourceTree = "<group>"; };
18171819
265284082624ACE900F91BA1 /* AddOnCrossreferenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddOnCrossreferenceTests.swift; sourceTree = "<group>"; };
@@ -5357,6 +5359,7 @@
53575359
B5D1AFC520BC7B7300DB0E8C /* StorePickerViewController.swift */,
53585360
B5D1AFC720BC7B9600DB0E8C /* StorePickerViewController.xib */,
53595361
74460D4122289C7A00D7316A /* StorePickerCoordinator.swift */,
5362+
262C922026F1370000011F92 /* StorePickerError.swift */,
53605363
45527A402472C6160078D609 /* SwitchStoreUseCase.swift */,
53615364
45A4221924ACC79C003B1E4C /* SwitchStoreNoticePresenter.swift */,
53625365
);
@@ -7807,6 +7810,7 @@
78077810
028FA46C257E0D9F00F88A48 /* PlainTextSectionHeaderView.swift in Sources */,
78087811
0235595924496D70004BE2B8 /* ProductsSortOrderBottomSheetListSelectorCommand.swift in Sources */,
78097812
57A25C7625ACE9BC00A54A62 /* OrderFulfillmentUseCase.swift in Sources */,
7813+
262C922126F1370000011F92 /* StorePickerError.swift in Sources */,
78107814
4515C89825D6C00E0099C8E3 /* ShippingLabelAddressFormViewModel.swift in Sources */,
78117815
CE24BCCF212DE8A6001CD12E /* HeadlineLabelTableViewCell.swift in Sources */,
78127816
0245465D24EE779D004F531C /* ProductFormEventLogger.swift in Sources */,

0 commit comments

Comments
 (0)