Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue 162] iOS: Add footer to info reference asset #194

Merged
merged 5 commits into from
Oct 20, 2023
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
60 changes: 60 additions & 0 deletions ios/packages/demo/Sources/MockFlows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,65 @@ static let collectionBasic: String = """
}
}
"""
static let infoFooter: String = """
{
"id": "generated-flow",
"views": [
{
"id": "info-view",
"type": "info",
"title": {
"asset": {
"id": "info-title",
"type": "text",
"value": "View Title"
}
},
"actions": [
{
"asset": {
"id": "next-action",
"value": "Next",
"type": "action",
"label": {
"asset": {
"id": "next-action-label",
"type": "text",
"value": "Continue"
}
}
}
}
],
"footer": {
"asset": {
"id": "info-footer",
"type": "text",
"value": "Footer text"
}
}
}
],
"data": {},
"navigation": {
"BEGIN": "FLOW_1",
"FLOW_1": {
"startState": "VIEW_1",
"VIEW_1": {
"state_type": "VIEW",
"ref": "info-view",
"transitions": {
"*": "END_Done"
}
},
"END_Done": {
"state_type": "END",
"outcome": "done"
}
}
}
}
"""
static let infoDynamicFlow: String = """
{
"id": "modal-flow",
Expand Down Expand Up @@ -968,6 +1027,7 @@ static let textWithLink: String = """
(name: "basic", flow: MockFlows.collectionBasic)
]),
(title: "info", flows: [
(name: "footer", flow: MockFlows.infoFooter),
(name: "dynamic flow", flow: MockFlows.infoDynamicFlow),
(name: "basic", flow: MockFlows.infoBasic),
(name: "modal flow", flow: MockFlows.infoModalFlow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ struct InfoData: AssetData {
var primaryInfo: WrappedAsset?
/// Assets to use as actions in this asset
var actions: [WrappedAsset]?
/// An asset to use as a footer for this asset
var footer: WrappedAsset?
}

/**
Expand Down Expand Up @@ -44,6 +46,7 @@ struct InfoAssetView: View {
action.view
}
}
model.data.footer?.asset?.view.font(.subheadline).padding(.top, 12)
}
.accessibilityElement(children: .contain)
.accessibility(identifier: model.data.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class InfoAssetTests: SwiftUIAssetUnitTestCase {

let stack = try view.inspect().vStack()

XCTAssertEqual(stack.count, 4)
XCTAssertEqual(stack.count, 5)

let forEach = try stack.forEach(3)

Expand Down
34 changes: 34 additions & 0 deletions plugins/reference-assets/mocks/info/info-footer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"id": "info-view",
"type": "info",
"title": {
"asset": {
"id": "info-title",
"type": "text",
"value": "View Title"
}
},
"actions": [
{
"asset": {
"id": "next-action",
"value": "Next",
"type": "action",
"label": {
"asset": {
"id": "next-action-label",
"type": "text",
"value": "Continue"
}
}
}
}
],
"footer": {
"asset": {
"id": "info-footer",
"type": "text",
"value": "Footer text"
}
}
}