Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
11 changes: 10 additions & 1 deletion Modules/Sources/JetpackStats/Charts/BarChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ struct BarChartView: View {
@State private var tappedDataPoint: DataPoint?

@Environment(\.context) var context
@Environment(\.colorScheme) var colorScheme

private var valueFormatter: StatsValueFormatter {
StatsValueFormatter(metric: data.metric)
Expand Down Expand Up @@ -60,7 +61,7 @@ struct BarChartView: View {
LinearGradient(
colors: [
data.metric.primaryColor,
data.metric.primaryColor.opacity(0.5)
lighten(data.metric.primaryColor)
],
startPoint: .top,
endPoint: .bottom
Expand All @@ -71,6 +72,14 @@ struct BarChartView: View {
}
}

private func lighten(_ color: Color) -> Color {
if #available(iOS 18, *) {
color.mix(with: Color(.systemBackground), by: colorScheme == .light ? 0.5 : 0.25)
} else {
color.opacity(0.5)
}
}

private func getOpacityForCurrentPeriodBar(for point: DataPoint) -> CGFloat {
if let tappedDataPoint, tappedDataPoint.id == point.id {
return 1.0
Expand Down
10 changes: 3 additions & 7 deletions Modules/Sources/JetpackStats/StatsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ final class StatsViewModel: ObservableObject, CardConfigurationDelegate {
self.context = context
self.userDefaults = userDefaults

// Try to load the saved preset, otherwise use the initial date range
if let savedPreset = Self.loadDateRangePreset(from: userDefaults, key: dateRangePresetKey) {
self.dateRange = context.calendar.makeDateRange(for: savedPreset)
} else {
self.dateRange = context.calendar.makeDateRange(for: .last7Days)
}
let preset = Self.loadDateRangePreset(from: userDefaults, key: dateRangePresetKey)
self.dateRange = context.calendar.makeDateRange(for: preset ?? .last7Days)

self.trafficCardConfiguration = Self.loadConfiguration(
from: userDefaults,
Expand Down Expand Up @@ -273,7 +269,7 @@ final class StatsViewModel: ObservableObject, CardConfigurationDelegate {
if let preset = dateRange.preset {
userDefaults.set(preset.rawValue, forKey: dateRangePresetKey)
} else {
userDefaults.removeObject(forKey: dateRangePresetKey)
// Do nothing – remember last used preset-based period
}
}

Expand Down
34 changes: 19 additions & 15 deletions Modules/Sources/JetpackStats/Views/LegacyFloatingDateControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ struct LegacyFloatingDateControl: View {
Spacer(minLength: 8)
navigationControls
}
.modifier(MinimumBottomSafeArea(minPadding: 16))
.modifier(MinimumBottomSafeArea(minPadding: 8))
.dynamicTypeSize(...DynamicTypeSize.xLarge)
.padding(.horizontal, 24)
.background {
LinearGradient(
gradient: Gradient(colors: [
Color(uiColor: .systemBackground).opacity(0.1),
Color(uiColor: .systemBackground).opacity(0.8),
Color(uiColor: .systemBackground).opacity(0),
Color(uiColor: .systemBackground).opacity(1)
]),
startPoint: .top,
Expand All @@ -51,14 +50,14 @@ struct LegacyFloatingDateControl: View {
)
} label: {
dateRangeButtonContent
.contentShape(Rectangle())
.frame(height: buttonHeight)
.floatingStyle()
.contentShape(Rectangle())
}
.tint(Color.primary)
.menuOrder(.fixed)
.buttonStyle(.plain)
.popoverTip(StatsDateRangeTip(), arrowEdge: .bottom)
.floatingStyle()
}

private var dateRangeButtonContent: some View {
Expand Down Expand Up @@ -128,16 +127,21 @@ private struct FloatingStyle: ViewModifier {
}

func body(content: Content) -> some View {
content
.background(Color(.systemBackground).opacity(0.2))
.background(Material.thin)
.overlay {
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color(.separator).opacity(0.2), lineWidth: 1)
}
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
.shadow(color: Constants.Colors.shadowColor, radius: 8, x: 0, y: 4)
.shadow(color: Constants.Colors.shadowColor.opacity(0.5), radius: 4, x: 0, y: 2)
if #available(iOS 26, *) {
content
.glassEffect(.regular.interactive(), in: RoundedRectangle(cornerRadius: 26, style: .continuous))
} else {
content
.background(Color(.systemBackground).opacity(0.2))
.background(Material.thin)
.overlay {
RoundedRectangle(cornerRadius: cornerRadius)
.stroke(Color(.separator).opacity(0.2), lineWidth: 1)
}
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
.shadow(color: Constants.Colors.shadowColor, radius: 8, x: 0, y: 4)
.shadow(color: Constants.Colors.shadowColor.opacity(0.5), radius: 4, x: 0, y: 2)
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
26.4
-----
* [*] Fix a few minor visual issues on iOS 26 [#24863], [#24863], [#24901], [#24865], [#24866], [#24867], [#24890]
* [*] Fix a few minor visual issues on iOS 26 [#24863], [#24863], [#24901], [#24865], [#24866], [#24867], [#24890], [#24899]
* [*] [Intelligence] Add support for generating excerpts for posts [#24852]
* [*] [Intelligence] Add auto-suggested tags for posts [#24886]
* [*] [Intelligence] Add "Summarize Post" features in Reader [#24892]
Expand All @@ -10,6 +10,7 @@
* [*] Fix performance issues with search in Reader Subscriptions [#24841]
* [*] Fix rare crash in Stats / Subscribers [#24907]
* [*] Improve performance and animations when showing a full Top List with a large number of items [#24868]
* [*] Fix an issue with New Stats resetting the preferred preset after selecting a custom range [#24899]
* [*] Show the Top 10 and 50 items in the Top List screen in a dedicated section [#24868]

26.3.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,9 @@ private enum Strings {
)

static let switchToClassic = NSLocalizedString(
"stats.menu.switchToClassic",
value: "Switch to Classic Stats",
comment: "Menu item to switch back to classic stats experience"
"stats.menu.disableNewStats",
value: "Disable New Stats",
comment: "Menu item to disable the new stats"
)

static let tryNewStats = NSLocalizedString(
Expand Down