Skip to content

Commit b36361b

Browse files
committed
Merge branch 'main' into accessibility/ACC-1027-BPKDynamicStack-using-AnyLayout
2 parents 5834d8e + 2ff0e6c commit b36361b

22 files changed

+221
-168
lines changed

.github/workflows/_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
run: Pods/SwiftLint/swiftlint lint --strict --config .swiftlint.yml
8787
working-directory: Example
8888

89-
- uses: actions/create-github-app-token@v1
89+
- uses: actions/create-github-app-token@v2
9090
id: app-token
9191
with:
9292
app-id: ${{ vars.GH_APP_ID }}

.github/workflows/_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
outputs:
2323
changed-files: ${{ steps.checkSnapshotChanges.outputs.didChangeFiles }}
2424
steps:
25-
- uses: actions/create-github-app-token@v1
25+
- uses: actions/create-github-app-token@v2
2626
id: app-token
2727
with:
2828
app-id: ${{ vars.GH_APP_ID }}
@@ -95,7 +95,7 @@ jobs:
9595
needs: [TestPods]
9696
if: ${{ needs.TestPods.outputs.changed-files != '' && inputs.retake_snapshots}}
9797
steps:
98-
- uses: actions/create-github-app-token@v1
98+
- uses: actions/create-github-app-token@v2
9999
id: app-token
100100
with:
101101
app-id: ${{ vars.GH_APP_ID }}

.github/workflows/label-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-22.04
1010

1111
steps:
12-
- uses: actions/create-github-app-token@v1
12+
- uses: actions/create-github-app-token@v2
1313
id: app-token
1414
with:
1515
app-id: ${{ vars.GH_APP_ID }}

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
contents: write
3232
pull-requests: read
3333
steps:
34-
- uses: actions/create-github-app-token@v1
34+
- uses: actions/create-github-app-token@v2
3535
id: app-token
3636
with:
3737
app-id: ${{ vars.GH_APP_ID }}

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
pull-requests: write
3636
if: ${{ github.actor == 'dependabot[bot]' }}
3737
steps:
38-
- uses: actions/create-github-app-token@v1
38+
- uses: actions/create-github-app-token@v2
3939
id: app-token
4040
with:
4141
app-id: ${{ vars.GH_APP_ID }}

Backpack-SwiftUI/Calendar/Classes/CalendarDayCells/DisabledHighlightedDayCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct DisabledHighlightedDayCell: View {
2525
var body: some View {
2626
BPKText("\(calendar.component(.day, from: date))", style: .label1)
2727
.lineLimit(1)
28-
.foregroundColor(.textSecondaryColor)
28+
.foregroundColor(.textDisabledColor)
2929
.frame(maxWidth: .infinity)
3030
.padding(.vertical, .md)
3131
.overlay {

Backpack-SwiftUI/CardList/Classes/BPKCardList.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,15 @@ public struct BPKCardList<Element: Identifiable, Content: View>: View {
121121
.buttonStyle(.primary)
122122
.stretchable()
123123
}
124-
if case .expand(let expandingText, let collapsingText, _) = accessory {
124+
// swiftlint:disable:next line_length
125+
if case .expand(let expandingText, let collapsingText, _, let action) = accessory, initiallyShownCardsCount < elements.count {
125126
BPKButton(
126127
(showingAllCards) ? collapsingText : expandingText,
127128
icon: .trailing(icon: BPKIcon(name: (showingAllCards) ? "chevron-up" : "chevron-down"))
128129
) {
129130
withAnimation {
130131
showingAllCards.toggle()
132+
action?(showingAllCards)
131133
}
132134
}
133135
.buttonStyle(.link)

Backpack-SwiftUI/CardList/Classes/BPKCardListAccessory.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ import SwiftUI
2121
extension BPKCardListLayout {
2222
public enum Accessory {
2323
case sectionHeaderButton(SectionHeaderAction)
24-
case expand(expandText: String, collapseText: String, sectionHeaderButton: SectionHeaderAction? = nil)
24+
// swiftlint:disable:next line_length
25+
case expand(expandText: String, collapseText: String, sectionHeaderButton: SectionHeaderAction? = nil, onExpansionChange: ((Bool) -> Void)? = nil)
2526
case footerButton(AccessoryAction)
2627

2728
var sectionHeaderAction: SectionHeaderAction? {
2829
switch self {
29-
case .expand(_, _, let sectionHeaderAction):
30+
case .expand(_, _, let sectionHeaderAction, _):
3031
return sectionHeaderAction
3132
case .sectionHeaderButton(let sectionHeaderAction):
3233
return sectionHeaderAction

Backpack-SwiftUI/Tests/Calendar/BPKCalendarTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ class BPKCalendarTests: XCTestCase {
167167
let highlightedDates = Set([
168168
calendar.date(byAdding: .day, value: 5, to: testDate),
169169
calendar.date(byAdding: .day, value: 10, to: testDate),
170-
calendar.date(byAdding: .day, value: -10, to: testDate)
170+
calendar.date(byAdding: .day, value: -10, to: testDate),
171+
calendar.date(byAdding: .day, value: -25, to: testDate)
171172
].compactMap({ $0 }))
172173
assertSnapshot(
173174
BPKCalendar(

Backpack-SwiftUI/Tests/CardList/BPKCardListViewTests.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ import SwiftUI
2222
import Backpack_SwiftUI
2323

2424
class BPKCardListViewTests: XCTestCase {
25+
26+
override func setUp() {
27+
super.setUp()
28+
isRecording = false
29+
}
30+
2531
func testCardListRail() {
2632
assertSnapshot(
2733
BPKCardList(
@@ -109,6 +115,21 @@ class BPKCardListViewTests: XCTestCase {
109115
.frame(width: 375)
110116
)
111117
}
118+
119+
func testCardListStackWithoutExpandAccessory() {
120+
assertSnapshot(
121+
BPKCardList(
122+
title: "Popular right now",
123+
description: "Other travellers are loving these destinations. " +
124+
"Search flights, hotels and car hire and join them on the adventure.",
125+
layout: .stack(accessory: .expand(expandText: "Show more", collapseText: "Show less")),
126+
initiallyShownCardsCount: 3,
127+
elements: Array(TestLocation.placeholders[0..<2]),
128+
cardForElement: locationStackCard(element:))
129+
.padding()
130+
.frame(width: 375)
131+
)
132+
}
112133

113134
func testCardListStackWithSectionHeaderButton() {
114135
assertSnapshot(

Example/Backpack.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,7 @@
16641664
6003F588195388D20070C39A /* Resources */,
16651665
84EFE62BE1534CD46CAFBDBF /* [CP] Embed Pods Frameworks */,
16661666
D68AF8FA2174CB9C00BA743D /* Run Script */,
1667+
534AFA87B973437651692B38 /* [CP] Copy Pods Resources */,
16671668
);
16681669
buildRules = (
16691670
);
@@ -1820,6 +1821,21 @@
18201821
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
18211822
showEnvVarsInLog = 0;
18221823
};
1824+
534AFA87B973437651692B38 /* [CP] Copy Pods Resources */ = {
1825+
isa = PBXShellScriptBuildPhase;
1826+
buildActionMask = 2147483647;
1827+
files = (
1828+
);
1829+
inputPaths = (
1830+
);
1831+
name = "[CP] Copy Pods Resources";
1832+
outputPaths = (
1833+
);
1834+
runOnlyForDeploymentPostprocessing = 0;
1835+
shellPath = /bin/sh;
1836+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Backpack-Native/Pods-Backpack-Native-resources.sh\"\n";
1837+
showEnvVarsInLog = 0;
1838+
};
18231839
84EFE62BE1534CD46CAFBDBF /* [CP] Embed Pods Frameworks */ = {
18241840
isa = PBXShellScriptBuildPhase;
18251841
buildActionMask = 2147483647;

Example/Backpack/Utils/FeatureStories/Groups/CardListGroups.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import Backpack_SwiftUI
2727
struct CardListGroupsProvider {
2828
let showPresentable: (Presentable) -> Void
2929

30+
// swiftlint:disable:next function_body_length
3031
func swiftUIGroups() -> [Components.Group] {
3132
SingleGroupProvider(
3233
cellDataSources: [
@@ -51,9 +52,25 @@ struct CardListGroupsProvider {
5152
view: CardListExampleView(layout: .stack(
5253
accessory: .expand(
5354
expandText: "Show more",
54-
collapseText: "Show less")
55+
collapseText: "Show less",
56+
onExpansionChange: { action in
57+
print("Expand button toggle is: \(action)")
58+
}
59+
)
5560
), totalElements: 9)
5661
),
62+
presentable(
63+
"Stack - Accessory Expand Hidden",
64+
view: CardListExampleView(layout: .stack(
65+
accessory: .expand(
66+
expandText: "Show more",
67+
collapseText: "Show less",
68+
onExpansionChange: { action in
69+
print("Expand button toggle is: \(action)")
70+
}
71+
)
72+
), totalElements: 3)
73+
),
5774
presentable(
5875
"Stack - Accessory Button",
5976
view: CardListExampleView(layout: .stack(accessory: .footerButton(.example)), totalElements: 9)

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

33
gem 'cocoapods', '~> 1.16.2'
4-
gem 'fastlane', '~> 2.227.0'
4+
gem 'fastlane', '~> 2.227.1'
55
gem 'jazzy', '~> 0.15.1'
66
gem 'xcpretty'

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ GEM
1919
artifactory (3.0.17)
2020
atomos (0.1.3)
2121
aws-eventstream (1.3.2)
22-
aws-partitions (1.1075.0)
23-
aws-sdk-core (3.221.0)
22+
aws-partitions (1.1090.0)
23+
aws-sdk-core (3.222.2)
2424
aws-eventstream (~> 1, >= 1.3.0)
2525
aws-partitions (~> 1, >= 1.992.0)
2626
aws-sigv4 (~> 1.9)
@@ -30,7 +30,7 @@ GEM
3030
aws-sdk-kms (1.99.0)
3131
aws-sdk-core (~> 3, >= 3.216.0)
3232
aws-sigv4 (~> 1.5)
33-
aws-sdk-s3 (1.182.0)
33+
aws-sdk-s3 (1.183.0)
3434
aws-sdk-core (~> 3, >= 3.216.0)
3535
aws-sdk-kms (~> 1)
3636
aws-sigv4 (~> 1.5)
@@ -120,7 +120,7 @@ GEM
120120
faraday_middleware (1.2.1)
121121
faraday (~> 1.0)
122122
fastimage (2.4.0)
123-
fastlane (2.227.0)
123+
fastlane (2.227.1)
124124
CFPropertyList (>= 2.3, < 4.0.0)
125125
addressable (>= 2.8, < 3.0.0)
126126
artifactory (~> 3.0)
@@ -160,7 +160,7 @@ GEM
160160
tty-spinner (>= 0.8.0, < 1.0.0)
161161
word_wrap (~> 1.0.0)
162162
xcodeproj (>= 1.13.0, < 2.0.0)
163-
xcpretty (~> 0.4.0)
163+
xcpretty (~> 0.4.1)
164164
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
165165
fastlane-sirp (1.0.0)
166166
sysrandom (~> 1.0)
@@ -308,7 +308,7 @@ PLATFORMS
308308

309309
DEPENDENCIES
310310
cocoapods (~> 1.16.2)
311-
fastlane (~> 2.227.0)
311+
fastlane (~> 2.227.1)
312312
jazzy (~> 0.15.1)
313313
xcpretty
314314

0 commit comments

Comments
 (0)