Skip to content

Commit 6379e5f

Browse files
authored
SFMU: Show error notice if QR code media deep link fails (#22577)
2 parents 148a905 + c64cd87 commit 6379e5f

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

WordPress/Classes/Utility/Universal Links/NavigationActionHelpers.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ extension NavigationAction {
2626
return nil
2727
}
2828

29-
func postFailureNotice(title: String) {
29+
func postFailureNotice(title: String, message: String? = nil) {
3030
let notice = Notice(title: title,
31+
message: message,
3132
feedbackType: .error,
3233
notificationInfo: nil)
3334
ActionDispatcher.dispatch(NoticeAction.post(notice))

WordPress/Classes/Utility/Universal Links/Routes+MySites.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ extension MySitesRoute: NavigationAction {
9393
}
9494
WPAppAnalytics.track(.deepLinkFailed, withProperties: properties)
9595

96+
if campaign.flatMap(AppBannerCampaign.init) == .qrCodeMedia {
97+
postFailureNotice(title: Strings.siteNotFound, message: Strings.checkAccount)
98+
return
99+
}
100+
96101
if failAndBounce(values) == false {
97102
coordinator.showRootViewController()
98103
postFailureNotice(title: NSLocalizedString("Site not found",
@@ -131,3 +136,16 @@ extension MySitesRoute: NavigationAction {
131136
}
132137
}
133138
}
139+
140+
private enum Strings {
141+
static let siteNotFound = NSLocalizedString(
142+
"universalLink.qrCodeMedia.error.title",
143+
value: "Site not found",
144+
comment: "Title for error notice shown if the app can't find a specific site belonging to the user"
145+
)
146+
static let checkAccount = NSLocalizedString(
147+
"universalLink.qrCodeMedia.error.message",
148+
value: "Check that you are logged into the correct account",
149+
comment: "Message for error notice shown if the app can't find a specific site belonging to the user"
150+
)
151+
}

0 commit comments

Comments
 (0)