Skip to content

Commit 623c015

Browse files
committed
Show an alert when the it times out while waiting for the newly created site to become a Jetpack site.
1 parent cddcea4 commit 623c015

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

WooCommerce/Classes/Authentication/Store Creation/StoreCreationCoordinator.swift

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,14 @@ private extension StoreCreationCoordinator {
484484
.replaceError(with: nil)
485485
.receive(on: DispatchQueue.main)
486486
.sink { [weak self] site in
487-
guard let self, let site else { return }
487+
guard let self else { return }
488+
guard let site else {
489+
navigationController.dismiss(animated: true) { [weak self] in
490+
guard let self else { return }
491+
self.showJetpackSiteTimeoutAlert(from: self.navigationController)
492+
}
493+
return
494+
}
488495
self.showSuccessView(from: navigationController, site: site)
489496
}
490497
}
@@ -538,6 +545,16 @@ private extension StoreCreationCoordinator {
538545
}
539546
navigationController.pushViewController(successView, animated: true)
540547
}
548+
549+
@MainActor
550+
func showJetpackSiteTimeoutAlert(from navigationController: UINavigationController) {
551+
let alertController = UIAlertController(title: Localization.WaitingForJetpackSite.TimeoutAlert.title,
552+
message: Localization.WaitingForJetpackSite.TimeoutAlert.message,
553+
preferredStyle: .alert)
554+
alertController.view.tintColor = .text
555+
_ = alertController.addCancelActionWithTitle(Localization.WaitingForJetpackSite.TimeoutAlert.cancelActionTitle) { _ in }
556+
navigationController.present(alertController, animated: true)
557+
}
541558
}
542559

543560
private extension StoreCreationCoordinator {
@@ -621,6 +638,21 @@ private extension StoreCreationCoordinator {
621638
comment: "Title of the in-progress view when waiting for the site to become a Jetpack site " +
622639
"after WPCOM plan purchase in the store creation flow."
623640
)
641+
642+
enum TimeoutAlert {
643+
static let title = NSLocalizedString(
644+
"Store creation still in progress",
645+
comment: "Title of the alert when the created store never becomes a Jetpack site in the store creation flow."
646+
)
647+
static let message = NSLocalizedString(
648+
"The new store will be available soon in the store picker. If you have any issues, please contact support.",
649+
comment: "Message of the alert when the created store never becomes a Jetpack site in the store creation flow."
650+
)
651+
static let cancelActionTitle = NSLocalizedString(
652+
"OK",
653+
comment: "Button title to dismiss the alert when the created store never becomes a Jetpack site in the store creation flow."
654+
)
655+
}
624656
}
625657
}
626658

0 commit comments

Comments
 (0)