Skip to content

Commit 36cb565

Browse files
authored
Merge branch 'trunk' into issue/14004-better-application-password-disabled-note-take-2
2 parents 9a84317 + f5ccde0 commit 36cb565

File tree

111 files changed

+2686
-508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2686
-508
lines changed

.buildkite/pipeline.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,29 @@ steps:
4444
- github_commit_status:
4545
context: Unit Tests
4646

47+
- label: ":microscope: Standalone WordPressAuthenticator Unit Tests"
48+
command: |
49+
echo "--- :rubygems: Setting up Gems"
50+
install_gems
51+
52+
echo "--- :cocoapods: Setting up Pods"
53+
install_cocoapods
54+
55+
echo "--- :swift: Setting up Swift Packages"
56+
install_swiftpm_dependencies
57+
58+
echo "--- 🧪 Testing"
59+
bundle exec fastlane run scan \
60+
scheme:WordPressAuthenticator \
61+
prelaunch_simulator:true \
62+
device:'iPhone 16'
63+
plugins: [$CI_TOOLKIT]
64+
artifact_paths:
65+
- fastlane/test_output/*
66+
notify:
67+
- github_commit_status:
68+
context: WordPressAuthenticator Unit Tests
69+
4770
#################
4871
# Linters
4972
#################
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
2+
---
3+
4+
agents:
5+
queue: mac
6+
7+
env:
8+
IMAGE_ID: $IMAGE_ID
9+
10+
steps:
11+
- label: Download Release Translations
12+
plugins: [$CI_TOOLKIT]
13+
command: |
14+
echo '--- :robot_face: Use bot for Git operations'
15+
source use-bot-for-git
16+
17+
.buildkite/commands/checkout-release-branch.sh "$RELEASE_VERSION"
18+
19+
echo '--- :ruby: Setup Ruby Tools'
20+
install_gems
21+
22+
echo '--- :closed_lock_with_key: Access Secrets'
23+
bundle exec fastlane run configure_apply
24+
25+
echo '--- :globe_with_meridians: Download Release Translations'
26+
bundle exec fastlane download_release_translations skip_confirm:true
27+
retry:
28+
manual:
29+
# If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite
30+
allowed: false

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
8989
return true
9090
case .sendReceiptsForPointOfSale:
9191
return true
92-
case .acceptCashForPointOfSale:
93-
return true
9492
case .hideSitesInStorePicker:
9593
return true
9694
case .filterHistoryOnOrderAndProductLists:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,6 @@ public enum FeatureFlag: Int {
193193
///
194194
case sendReceiptsForPointOfSale
195195

196-
/// Adds support for accepting cash as payment for POS
197-
///
198-
case acceptCashForPointOfSale
199-
200196
/// Supports hiding sites from the store picker
201197
///
202198
case hideSitesInStorePicker

Fakes/Fakes/Networking.generated.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,8 @@ extension Networking.Site {
22192219
visibility: .fake(),
22202220
canBlaze: .fake(),
22212221
isAdmin: .fake(),
2222-
wasEcommerceTrial: .fake()
2222+
wasEcommerceTrial: .fake(),
2223+
hasSSOEnabled: .fake()
22232224
)
22242225
}
22252226
}

Networking/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,7 +3311,8 @@ extension Networking.Site {
33113311
visibility: CopiableProp<SiteVisibility> = .copy,
33123312
canBlaze: CopiableProp<Bool> = .copy,
33133313
isAdmin: CopiableProp<Bool> = .copy,
3314-
wasEcommerceTrial: CopiableProp<Bool> = .copy
3314+
wasEcommerceTrial: CopiableProp<Bool> = .copy,
3315+
hasSSOEnabled: CopiableProp<Bool> = .copy
33153316
) -> Networking.Site {
33163317
let siteID = siteID ?? self.siteID
33173318
let name = name ?? self.name
@@ -3334,6 +3335,7 @@ extension Networking.Site {
33343335
let canBlaze = canBlaze ?? self.canBlaze
33353336
let isAdmin = isAdmin ?? self.isAdmin
33363337
let wasEcommerceTrial = wasEcommerceTrial ?? self.wasEcommerceTrial
3338+
let hasSSOEnabled = hasSSOEnabled ?? self.hasSSOEnabled
33373339

33383340
return Networking.Site(
33393341
siteID: siteID,
@@ -3356,7 +3358,8 @@ extension Networking.Site {
33563358
visibility: visibility,
33573359
canBlaze: canBlaze,
33583360
isAdmin: isAdmin,
3359-
wasEcommerceTrial: wasEcommerceTrial
3361+
wasEcommerceTrial: wasEcommerceTrial,
3362+
hasSSOEnabled: hasSSOEnabled
33603363
)
33613364
}
33623365
}

Networking/Networking/Model/Site.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ public struct Site: Decodable, Equatable, Hashable, GeneratedFakeable, Generated
8888
///
8989
public let wasEcommerceTrial: Bool
9090

91+
/// Whether Jetpack SSO is enabled for the site
92+
///
93+
public let hasSSOEnabled: Bool
94+
9195
/// Decodable Conformance.
9296
///
9397
public init(from decoder: Decoder) throws {
@@ -126,6 +130,11 @@ public struct Site: Decodable, Equatable, Hashable, GeneratedFakeable, Generated
126130
return activeFeatures.contains { $0 == Constants.aiAssistantFeature }
127131
}()
128132

133+
let hasSSOEnabled: Bool = {
134+
let jetpackModules = (try? siteContainer.decodeIfPresent([String].self, forKey: SiteKeys.jetpackModules)) ?? []
135+
return jetpackModules.contains(OptionKeys.sso.rawValue) == true
136+
}()
137+
129138
self.init(siteID: siteID,
130139
name: name,
131140
description: description,
@@ -146,7 +155,8 @@ public struct Site: Decodable, Equatable, Hashable, GeneratedFakeable, Generated
146155
visibility: visibility,
147156
canBlaze: canBlaze,
148157
isAdmin: isAdmin,
149-
wasEcommerceTrial: wasEcommerceTrial)
158+
wasEcommerceTrial: wasEcommerceTrial,
159+
hasSSOEnabled: hasSSOEnabled)
150160
}
151161

152162
/// Designated Initializer.
@@ -171,7 +181,8 @@ public struct Site: Decodable, Equatable, Hashable, GeneratedFakeable, Generated
171181
visibility: SiteVisibility,
172182
canBlaze: Bool,
173183
isAdmin: Bool,
174-
wasEcommerceTrial: Bool) {
184+
wasEcommerceTrial: Bool,
185+
hasSSOEnabled: Bool) {
175186
self.siteID = siteID
176187
self.name = name
177188
self.description = description
@@ -193,6 +204,7 @@ public struct Site: Decodable, Equatable, Hashable, GeneratedFakeable, Generated
193204
self.canBlaze = canBlaze
194205
self.isAdmin = isAdmin
195206
self.wasEcommerceTrial = wasEcommerceTrial
207+
self.hasSSOEnabled = hasSSOEnabled
196208
}
197209
}
198210

@@ -239,6 +251,7 @@ private extension Site {
239251
case isJetpackThePluginInstalled = "jetpack"
240252
case isJetpackConnected = "jetpack_connection"
241253
case wasEcommerceTrial = "was_ecommerce_trial"
254+
case jetpackModules = "jetpack_modules"
242255
}
243256

244257
enum PlanInfo: String, CodingKey {
@@ -266,6 +279,7 @@ private extension Site {
266279
case frameNonce = "frame_nonce"
267280
case visibility = "blog_public"
268281
case canBlaze = "can_blaze"
282+
case sso = "sso"
269283
}
270284

271285
enum PlanKeys: String, CodingKey {

Networking/Networking/Model/WordPressSite.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public extension WordPressSite {
108108
visibility: .publicSite,
109109
canBlaze: false,
110110
isAdmin: false,
111-
wasEcommerceTrial: false)
111+
wasEcommerceTrial: false,
112+
hasSSOEnabled: false)
112113
}
113114

114115
struct Authentication: Decodable {

Networking/Networking/Remote/SiteRemote.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ extension SiteRemote {
292292
enum SiteParameter {
293293
enum Fields {
294294
static let key = "fields"
295-
static let value = "ID,name,description,URL,options,jetpack,jetpack_connection,capabilities,was_ecommerce_trial,plan"
295+
static let value = "ID,name,description,URL,options,jetpack,jetpack_connection,capabilities,was_ecommerce_trial,plan,jetpack_modules"
296296
}
297297
enum Options {
298298
static let key = "options"

Networking/NetworkingTests/Mapper/SiteListMapperTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ final class SiteListMapperTests: XCTestCase {
2424
XCTAssertFalse(site.wasEcommerceTrial)
2525
XCTAssertEqual(site.plan, "business-bundle")
2626
}
27+
28+
func test_site_hasSSOEnabled_is_parsed_successfully() throws {
29+
// Given
30+
let sites = mapLoadSiteListResponse()
31+
32+
// Then
33+
let first = try XCTUnwrap(sites[safe: 0])
34+
XCTAssertTrue(first.hasSSOEnabled)
35+
36+
let second = try XCTUnwrap(sites[safe: 1])
37+
XCTAssertFalse(second.hasSSOEnabled)
38+
}
2739
}
2840

2941
private extension SiteListMapperTests {

0 commit comments

Comments
 (0)