Skip to content

Commit cbd106a

Browse files
authored
Merge branch 'trunk' into fix/subscription-search-performance
2 parents caf128e + 642e124 commit cbd106a

File tree

129 files changed

+661
-216
lines changed

Some content is hidden

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

129 files changed

+661
-216
lines changed

.xcode-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
26.0-rc.1-v2
1+
26.0

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ GEM
301301
trailblazer-option (>= 0.1.1, < 0.2.0)
302302
uber (< 0.2.0)
303303
retriable (3.1.2)
304-
rexml (3.4.1)
304+
rexml (3.4.2)
305305
rmagick (6.1.4)
306306
observer (~> 0.1)
307307
pkg-config (~> 1.4)

Modules/Package.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ let package = Package(
173173
resources: [.process("Resources")],
174174
swiftSettings: [.swiftLanguageMode(.v5)]
175175
),
176-
.target(name: "WordPressKitObjCUtils"),
176+
.target(
177+
name: "WordPressKitObjCUtils",
178+
cSettings: [
179+
.define("NS_BLOCK_ASSERTIONS", to: "1", .when(configuration: .release))
180+
]
181+
),
177182
.target(
178183
name: "WordPressKitModels",
179184
dependencies: [
@@ -189,7 +194,10 @@ let package = Package(
189194
"WordPressKitModels",
190195
"WordPressKitObjCUtils",
191196
],
192-
publicHeadersPath: "include"
197+
publicHeadersPath: "include",
198+
cSettings: [
199+
.define("NS_BLOCK_ASSERTIONS", to: "1", .when(configuration: .release))
200+
],
193201
),
194202
.target(
195203
name: "WordPressKit",

Modules/Sources/DesignSystem/Components/FAB.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ public struct FAB: View {
99
self.action = action
1010
}
1111

12-
#if compiler(>=6.2)
1312
public var body: some View {
1413
if #available(iOS 26, *) {
1514
Button(action: action ?? {}) {
@@ -25,11 +24,6 @@ public struct FAB: View {
2524
legacy
2625
}
2726
}
28-
#else
29-
public var body: some View {
30-
legacy
31-
}
32-
#endif
3327

3428
@ViewBuilder
3529
private var legacy: some View {

Modules/Sources/DesignSystem/Foundation/AppColor.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ import BuildSettingsKit
55

66
public enum UIAppColor {
77
/// A tint color used in places like navigation bars.
8-
///
9-
/// - note: The Jetpack app uses
108
public static var tint: UIColor {
11-
switch AppBrand.current {
12-
case .wordpress: primary
13-
case .jetpack: UIColor.label
14-
case .reader: primary
15-
}
9+
UIColor.label
1610
}
1711

1812
public static var primary: UIColor {

Modules/Sources/JetpackStats/Cards/StandaloneChartCard.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ struct StandaloneChartCard: View {
197197
}
198198

199199
private var dateRangeControls: some View {
200-
HStack(spacing: Constants.step1) {
200+
HStack {
201201
// Date range menu button
202202
Menu {
203203
StatsDateRangePickerMenu(selection: $dateRange, isShowingCustomRangePicker: $isShowingDatePicker)
@@ -216,14 +216,15 @@ struct StandaloneChartCard: View {
216216
}
217217
.tint(Color.primary)
218218

219-
Spacer()
219+
Spacer(minLength: Constants.step1)
220220

221221
// Navigation controls
222222
HStack(spacing: 4) {
223223
navigationButton(direction: .backward)
224224
navigationButton(direction: .forward)
225225
}
226226
}
227+
.lineLimit(1)
227228
}
228229

229230
@ViewBuilder

Modules/Sources/ShareExtensionCore/Data/SharedCoreDataStack.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ final class SharedPersistentContainer: NSPersistentContainer {
1616
}
1717
}
1818

19-
#if compiler(>=6)
2019
extension SharedPersistentContainer: @unchecked Sendable {}
21-
#endif
2220

2321
public final class SharedCoreDataStack {
2422

Modules/Sources/WordPressKit/StatsFileDownloadsTimeIntervalData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extension StatsFileDownloadsTimeIntervalData: StatsTimeIntervalData {
4444
public init?(date: Date, period: StatsPeriodUnit, jsonDictionary: [String: AnyObject]) {
4545
guard
4646
let unwrappedDays = type(of: self).unwrapDaysDictionary(jsonDictionary: jsonDictionary),
47-
let fileDownloadsDict = unwrappedDays["files"] as? [[String: AnyObject]]
47+
let fileDownloadsDict = Bamboozled.parseArray(unwrappedDays["files"])
4848
else {
4949
return nil
5050
}

Modules/Sources/WordPressKit/StatsSearchTermTimeIntervalData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension StatsSearchTermTimeIntervalData: StatsTimeIntervalData {
4545
let totalSearchTerms = unwrappedDays["total_search_terms"] as? Int,
4646
let hiddenSearchTerms = unwrappedDays["encrypted_search_terms"] as? Int,
4747
let otherSearchTerms = unwrappedDays["other_search_terms"] as? Int,
48-
let searchTermsDict = unwrappedDays["search_terms"] as? [[String: AnyObject]]
48+
let searchTermsDict = Bamboozled.parseArray(unwrappedDays["search_terms"])
4949
else {
5050
return nil
5151
}

Modules/Sources/WordPressKit/StatsServiceRemoteV2.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,37 @@ extension StatsTimeIntervalData {
444444
}
445445
return nil
446446
}
447+
}
447448

449+
enum Bamboozled {
450+
/// Sometimes PHP returns a dictionary with numbers as keys instead of an
451+
/// actual array. This fixes it.
452+
static func parseArray(_ object: AnyObject?) -> [[String: AnyObject]]? {
453+
guard let object else {
454+
return nil
455+
}
456+
if let array = object as? [[String: AnyObject]] {
457+
return array
458+
}
459+
if let dictionary = object as? [String: [String: AnyObject]] {
460+
return dictionary.sorted { lhs, rhs in
461+
if let lhs = Int(lhs.key), let rhs = Int(rhs.key) {
462+
return lhs < rhs
463+
}
464+
return lhs.key.compare(rhs.key, options: .numeric) == .orderedAscending
465+
}.map {
466+
$0.value
467+
}
468+
}
469+
if let dictionary = object as? [Int: [String: AnyObject]] {
470+
return dictionary.sorted { lhs, rhs in
471+
lhs.key < rhs.key
472+
}.map {
473+
$0.value
474+
}
475+
}
476+
return nil
477+
}
448478
}
449479

450480
// We'll bring `StatsPeriodUnit` into this file when the "old" `WPStatsServiceRemote` gets removed.

0 commit comments

Comments
 (0)