Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Flipcash/Core/Controllers/Deep Links/ExternalLinkOpener.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ExternalLinkOpener {
/// Where the warning is drawn.
let session: Session

/// Opens `url` now if ``ExternalLinkCheck`` allows it, otherwise once the user picks Open Link.
/// Opens `url` now if ``ExternalLinkCheck`` allows it, otherwise once the user picks Open Website.
func open(_ url: URL) {
switch ExternalLinkCheck(url: url) {
case .open:
Expand All @@ -79,15 +79,15 @@ extension DialogItem {

/// The warning in front of a link to `host`, matching Android's copy word for word.
///
/// Cancel is the primary button. The body is not emphasised around the host as Android's is:
/// the dialog sets its whole subtitle in bold already.
/// Open Website is the primary button. The body is not emphasised around the host as Android's
/// is: the dialog sets its whole subtitle in bold already.
static func leavingFlipcash(host: String, open: @escaping () -> Void) -> DialogItem {
.alert(
title: "You're leaving Flipcash",
subtitle: "This link opens \(host). Flipcash will never ask for your Access Key on a website"
.info(
title: "You're Leaving Flipcash",
subtitle: "This will open \(host). Never share your Access Key with a website"
) {
DialogAction.standard("Cancel") {}
DialogAction.subtle("Open Link", action: open)
DialogAction.standard("Open Website", action: open)
DialogAction.cancel()
}
}
}
7 changes: 4 additions & 3 deletions FlipcashTests/ExternalLinkCheckTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ import FlipcashUI

@Test func warningNamesTheHost() {
let item = DialogItem.leavingFlipcash(host: "x.com") {}
#expect(item.title == "You're leaving Flipcash")
#expect(item.subtitle == "This link opens x.com. Flipcash will never ask for your Access Key on a website")
#expect(item.actions.map(\.title) == ["Cancel", "Open Link"])
#expect(item.style == .standard)
#expect(item.title == "You're Leaving Flipcash")
#expect(item.subtitle == "This will open x.com. Never share your Access Key with a website")
#expect(item.actions.map(\.title) == ["Open Website", "Cancel"])
#expect(item.actions.map(\.kind) == [.standard, .subtle])
}
}
Expand Down
Loading