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
8 changes: 4 additions & 4 deletions .github/scripts/conventions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -399,23 +399,23 @@ check_literals() {
}

# 1. Icons: `case a = "x"`, `case a` (raw value is the name), `case a, b = "y"`,
# read only directly inside an enum whose declaration (up to its "{", on one line
# a name in backticks (`case `public` = "x"`), read only directly inside an enum whose declaration (up to its "{", on one line
# or several) names DashIconAsset. Lines of any other shape (`case let …`,
# associated values) are not icons.
icon_values=$work/icon-values
awk -v f="$icons" '
function cases(text, ln, item, one, value) {
sub(/^[[:space:]]+/, "", text)
sub(/[[:space:]]*\}[[:space:]]*$/, "", text)
if (text !~ /^case[[:space:]]+[A-Za-z_]/) return
if (text !~ /^case[[:space:]]+`?[A-Za-z_]/) return
sub(/^case[[:space:]]+/, "", text)
item = "[A-Za-z_][A-Za-z0-9_]*([[:space:]]*=[[:space:]]*\"[^\"]*\")?"
item = "(`[A-Za-z_][A-Za-z0-9_]*`|[A-Za-z_][A-Za-z0-9_]*)([[:space:]]*=[[:space:]]*\"[^\"]*\")?"
if (text !~ ("^" item "([[:space:]]*,[[:space:]]*" item ")*[[:space:]]*$")) return
while (match(text, item)) {
one = substr(text, RSTART, RLENGTH)
text = substr(text, RSTART + RLENGTH)
if (match(one, /"[^"]*"/)) value = substr(one, RSTART + 1, RLENGTH - 2)
else value = one
else { value = one; gsub(/`/, "", value) }
print value "\t" f "\t" ln
}
}
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/tests/conventions-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fresh; printf '%s\n' 'enum FixtureIcon: String, CaseIterable, DashIconAsset {' \
' case ghost = "no-such-icon"' \
' case noSuchBare' \
' case listA = "nope-a", listB' \
" case \`default\` = \"no-such-ticked\", \`bareTicked\`" \
" case dup = \"${img}\"" \
' func f() { switch self { case let x where x == .ghost: break; default: break } }' \
'}' >> "$work/tree/$src/Foundation/Icon_DashUI.swift"
Expand All @@ -91,6 +92,8 @@ expect "enum cases without assets" fail \
'no imageset named "noSuchBare"' \
'no imageset named "nope-a"' \
'no imageset named "listB"' \
'no imageset named "no-such-ticked"' \
'no imageset named "bareTicked"' \
"\"${img}\" is declared more than once"

fresh; mkdir "$work/tree/$catalog/Fixture & Folder"; cp -R "$(first_set imageset)" "$work/tree/$catalog/Fixture & Folder/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,15 @@ final class SystemMessageViewSnapshotTests: XCTestCase {
}
try assertComponentSnapshots(of: view, named: "link-action")
}

/// The coloured public icon (no template tint), on the default surface.
func testPublicIcon() throws {
let view = SystemMessageView(
title: "This transaction will be public",
subtitle: "The amount and the destination address will be visible on the blockchain.",
icon: DashIcon.SystemMessage.public.source
)
try assertComponentSnapshots(of: view, named: "public-icon")
}
}
#endif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions Sources/DashUIKit/Components/SystemMessageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,13 @@ public struct SystemMessageView: View {
.padding()
}

#Preview("Public icon") {
SystemMessageView(
title: "This transaction will be public",
subtitle: "The amount and the destination address will be visible on the blockchain.",
icon: DashIcon.SystemMessage.public.source
)
.padding()
}

#endif // DEBUG
1 change: 1 addition & 0 deletions Sources/DashUIKit/Foundation/Icon_DashUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public enum DashIcon {
/// `System message`
public enum SystemMessage: String, CaseIterable, DashIconAsset {
case infoRectSmall = "system-message-info-rect-small"
case `public` = "system-message-public"
case shieldSmall = "system-message-shield-small"
case timerSmall = "system-message-timer-small"
case unmixedFunds = "system-message-unmixed-funds"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "system-message-public.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion docs/foundation.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ icons, text-field icons (`text-field-qr`, `text-field-clear`), menu icons
(`feature-shield`, `feature-timer`, `feature-identity`, `feature-platform`, each
with a `-purple` variant where one exists), segmented-control arrows
(`segmented-control-receive/transfer/send`, each with a grey `-disabled` twin for
the unselected segment), the vote thumb (`voting-thumb-up`), the list filter glyph (`filter-s`), and illustrations
the unselected segment), system-message icons (`system-message-info-rect-small`,
`system-message-public`, `system-message-shield-small`, `system-message-timer-small`,
`system-message-unmixed-funds`, `system-message-username-change`,
`system-message-warning-triangle`), the vote thumb (`voting-thumb-up`), the list
filter glyph (`filter-s`), and illustrations
(`illustration-dash-dex`, `illustration-xmark`, `checkmark`,
`crowdnode.warning`).

Expand Down
Loading