Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 508a68d

Browse files
committed
Merge branch 'release/7.145.0'
2 parents 67449e1 + 45cda43 commit 508a68d

7 files changed

+91
-47
lines changed

DuckDuckGo.xcodeproj/project.pbxproj

+28-28
Original file line numberDiff line numberDiff line change
@@ -9207,7 +9207,7 @@
92079207
CODE_SIGN_ENTITLEMENTS = PacketTunnelProvider/PacketTunnelProvider.entitlements;
92089208
CODE_SIGN_IDENTITY = "Apple Development";
92099209
CODE_SIGN_STYLE = Automatic;
9210-
CURRENT_PROJECT_VERSION = 1;
9210+
CURRENT_PROJECT_VERSION = 2;
92119211
DEVELOPMENT_TEAM = HKE973VLUW;
92129212
GCC_C_LANGUAGE_STANDARD = gnu11;
92139213
GENERATE_INFOPLIST_FILE = YES;
@@ -9244,7 +9244,7 @@
92449244
CODE_SIGN_IDENTITY = "iPhone Distribution";
92459245
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
92469246
CODE_SIGN_STYLE = Manual;
9247-
CURRENT_PROJECT_VERSION = 1;
9247+
CURRENT_PROJECT_VERSION = 2;
92489248
DEVELOPMENT_TEAM = "";
92499249
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
92509250
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -9334,7 +9334,7 @@
93349334
CODE_SIGN_IDENTITY = "iPhone Developer";
93359335
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
93369336
CODE_SIGN_STYLE = Automatic;
9337-
CURRENT_PROJECT_VERSION = 1;
9337+
CURRENT_PROJECT_VERSION = 2;
93389338
GCC_C_LANGUAGE_STANDARD = gnu11;
93399339
INFOPLIST_FILE = ShareExtension/Info.plist;
93409340
LD_RUNPATH_SEARCH_PATHS = (
@@ -9361,7 +9361,7 @@
93619361
CODE_SIGN_IDENTITY = "iPhone Developer";
93629362
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
93639363
CODE_SIGN_STYLE = Manual;
9364-
CURRENT_PROJECT_VERSION = 1;
9364+
CURRENT_PROJECT_VERSION = 2;
93659365
DEVELOPMENT_TEAM = "";
93669366
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
93679367
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -9510,7 +9510,7 @@
95109510
CODE_SIGN_ENTITLEMENTS = DuckDuckGo/DuckDuckGo.entitlements;
95119511
CODE_SIGN_IDENTITY = "iPhone Distribution";
95129512
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
9513-
CURRENT_PROJECT_VERSION = 1;
9513+
CURRENT_PROJECT_VERSION = 2;
95149514
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
95159515
DEVELOPMENT_ASSET_PATHS = "";
95169516
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
@@ -9535,7 +9535,7 @@
95359535
CODE_SIGN_ENTITLEMENTS = DuckDuckGo/DuckDuckGo.entitlements;
95369536
CODE_SIGN_IDENTITY = "iPhone Distribution";
95379537
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
9538-
CURRENT_PROJECT_VERSION = 1;
9538+
CURRENT_PROJECT_VERSION = 2;
95399539
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
95409540
INFOPLIST_FILE = DuckDuckGo/Info.plist;
95419541
LD_RUNPATH_SEARCH_PATHS = (
@@ -9604,7 +9604,7 @@
96049604
CODE_SIGN_IDENTITY = "iPhone Developer";
96059605
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
96069606
CODE_SIGN_STYLE = Automatic;
9607-
CURRENT_PROJECT_VERSION = 1;
9607+
CURRENT_PROJECT_VERSION = 2;
96089608
DEAD_CODE_STRIPPING = NO;
96099609
GCC_C_LANGUAGE_STANDARD = gnu11;
96109610
INFOPLIST_FILE = Widgets/Info.plist;
@@ -9638,7 +9638,7 @@
96389638
CODE_SIGN_IDENTITY = "iPhone Developer";
96399639
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
96409640
CODE_SIGN_STYLE = Manual;
9641-
CURRENT_PROJECT_VERSION = 1;
9641+
CURRENT_PROJECT_VERSION = 2;
96429642
DEAD_CODE_STRIPPING = NO;
96439643
DEVELOPMENT_TEAM = "";
96449644
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
@@ -9671,7 +9671,7 @@
96719671
CODE_SIGN_IDENTITY = "iPhone Developer";
96729672
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
96739673
CODE_SIGN_STYLE = Automatic;
9674-
CURRENT_PROJECT_VERSION = 1;
9674+
CURRENT_PROJECT_VERSION = 2;
96759675
GCC_C_LANGUAGE_STANDARD = gnu11;
96769676
INFOPLIST_FILE = OpenAction/Info.plist;
96779677
LD_RUNPATH_SEARCH_PATHS = (
@@ -9701,7 +9701,7 @@
97019701
CODE_SIGN_IDENTITY = "iPhone Developer";
97029702
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
97039703
CODE_SIGN_STYLE = Manual;
9704-
CURRENT_PROJECT_VERSION = 1;
9704+
CURRENT_PROJECT_VERSION = 2;
97059705
DEVELOPMENT_TEAM = "";
97069706
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
97079707
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -10011,7 +10011,7 @@
1001110011
CODE_SIGN_ENTITLEMENTS = DuckDuckGo/DuckDuckGoAlpha.entitlements;
1001210012
CODE_SIGN_IDENTITY = "iPhone Distribution";
1001310013
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
10014-
CURRENT_PROJECT_VERSION = 1;
10014+
CURRENT_PROJECT_VERSION = 2;
1001510015
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1001610016
DEVELOPMENT_ASSET_PATHS = "";
1001710017
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
@@ -10042,7 +10042,7 @@
1004210042
CODE_SIGN_IDENTITY = "iPhone Developer";
1004310043
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1004410044
CODE_SIGN_STYLE = Automatic;
10045-
CURRENT_PROJECT_VERSION = 1;
10045+
CURRENT_PROJECT_VERSION = 2;
1004610046
GCC_C_LANGUAGE_STANDARD = gnu11;
1004710047
INFOPLIST_FILE = ShareExtension/Info.plist;
1004810048
LD_RUNPATH_SEARCH_PATHS = (
@@ -10070,7 +10070,7 @@
1007010070
CODE_SIGN_IDENTITY = "iPhone Developer";
1007110071
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1007210072
CODE_SIGN_STYLE = Automatic;
10073-
CURRENT_PROJECT_VERSION = 1;
10073+
CURRENT_PROJECT_VERSION = 2;
1007410074
GCC_C_LANGUAGE_STANDARD = gnu11;
1007510075
INFOPLIST_FILE = OpenAction/Info.plist;
1007610076
LD_RUNPATH_SEARCH_PATHS = (
@@ -10103,7 +10103,7 @@
1010310103
CODE_SIGN_IDENTITY = "iPhone Developer";
1010410104
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1010510105
CODE_SIGN_STYLE = Automatic;
10106-
CURRENT_PROJECT_VERSION = 1;
10106+
CURRENT_PROJECT_VERSION = 2;
1010710107
DEAD_CODE_STRIPPING = NO;
1010810108
GCC_C_LANGUAGE_STANDARD = gnu11;
1010910109
INFOPLIST_FILE = Widgets/Info.plist;
@@ -10133,7 +10133,7 @@
1013310133
CODE_SIGN_ENTITLEMENTS = PacketTunnelProvider/PacketTunnelProviderAlpha.entitlements;
1013410134
CODE_SIGN_IDENTITY = "Apple Development";
1013510135
CODE_SIGN_STYLE = Automatic;
10136-
CURRENT_PROJECT_VERSION = 1;
10136+
CURRENT_PROJECT_VERSION = 2;
1013710137
DEVELOPMENT_TEAM = HKE973VLUW;
1013810138
GCC_C_LANGUAGE_STANDARD = gnu11;
1013910139
GENERATE_INFOPLIST_FILE = YES;
@@ -10166,11 +10166,11 @@
1016610166
CLANG_ENABLE_MODULES = YES;
1016710167
CODE_SIGN_IDENTITY = "";
1016810168
CODE_SIGN_STYLE = Automatic;
10169-
CURRENT_PROJECT_VERSION = 1;
10169+
CURRENT_PROJECT_VERSION = 2;
1017010170
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1017110171
DEFINES_MODULE = YES;
1017210172
DYLIB_COMPATIBILITY_VERSION = 1;
10173-
DYLIB_CURRENT_VERSION = 1;
10173+
DYLIB_CURRENT_VERSION = 2;
1017410174
DYLIB_INSTALL_NAME_BASE = "@rpath";
1017510175
INFOPLIST_FILE = Core/Info.plist;
1017610176
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -10403,7 +10403,7 @@
1040310403
CODE_SIGN_ENTITLEMENTS = DuckDuckGo/DuckDuckGoAlpha.entitlements;
1040410404
CODE_SIGN_IDENTITY = "iPhone Distribution";
1040510405
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
10406-
CURRENT_PROJECT_VERSION = 1;
10406+
CURRENT_PROJECT_VERSION = 2;
1040710407
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1040810408
DEVELOPMENT_ASSET_PATHS = "";
1040910409
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
@@ -10430,7 +10430,7 @@
1043010430
CODE_SIGN_IDENTITY = "Apple Development";
1043110431
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1043210432
CODE_SIGN_STYLE = Manual;
10433-
CURRENT_PROJECT_VERSION = 1;
10433+
CURRENT_PROJECT_VERSION = 2;
1043410434
DEVELOPMENT_TEAM = "";
1043510435
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
1043610436
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -10462,7 +10462,7 @@
1046210462
CODE_SIGN_IDENTITY = "iPhone Developer";
1046310463
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1046410464
CODE_SIGN_STYLE = Manual;
10465-
CURRENT_PROJECT_VERSION = 1;
10465+
CURRENT_PROJECT_VERSION = 2;
1046610466
DEVELOPMENT_TEAM = "";
1046710467
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
1046810468
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -10499,7 +10499,7 @@
1049910499
CODE_SIGN_IDENTITY = "iPhone Developer";
1050010500
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1050110501
CODE_SIGN_STYLE = Manual;
10502-
CURRENT_PROJECT_VERSION = 1;
10502+
CURRENT_PROJECT_VERSION = 2;
1050310503
DEAD_CODE_STRIPPING = NO;
1050410504
DEVELOPMENT_TEAM = "";
1050510505
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
@@ -10534,7 +10534,7 @@
1053410534
CODE_SIGN_IDENTITY = "Apple Development";
1053510535
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1053610536
CODE_SIGN_STYLE = Manual;
10537-
CURRENT_PROJECT_VERSION = 1;
10537+
CURRENT_PROJECT_VERSION = 2;
1053810538
DEVELOPMENT_TEAM = "";
1053910539
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = HKE973VLUW;
1054010540
GCC_C_LANGUAGE_STANDARD = gnu11;
@@ -10569,11 +10569,11 @@
1056910569
CLANG_ENABLE_MODULES = YES;
1057010570
CODE_SIGN_IDENTITY = "";
1057110571
CODE_SIGN_STYLE = Automatic;
10572-
CURRENT_PROJECT_VERSION = 1;
10572+
CURRENT_PROJECT_VERSION = 2;
1057310573
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1057410574
DEFINES_MODULE = YES;
1057510575
DYLIB_COMPATIBILITY_VERSION = 1;
10576-
DYLIB_CURRENT_VERSION = 1;
10576+
DYLIB_CURRENT_VERSION = 2;
1057710577
DYLIB_INSTALL_NAME_BASE = "@rpath";
1057810578
INFOPLIST_FILE = Core/Info.plist;
1057910579
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -10746,11 +10746,11 @@
1074610746
CLANG_ENABLE_MODULES = YES;
1074710747
CODE_SIGN_IDENTITY = "";
1074810748
CODE_SIGN_STYLE = Automatic;
10749-
CURRENT_PROJECT_VERSION = 1;
10749+
CURRENT_PROJECT_VERSION = 2;
1075010750
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
1075110751
DEFINES_MODULE = YES;
1075210752
DYLIB_COMPATIBILITY_VERSION = 1;
10753-
DYLIB_CURRENT_VERSION = 1;
10753+
DYLIB_CURRENT_VERSION = 2;
1075410754
DYLIB_INSTALL_NAME_BASE = "@rpath";
1075510755
INFOPLIST_FILE = Core/Info.plist;
1075610756
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -10779,10 +10779,10 @@
1077910779
CLANG_ENABLE_MODULES = YES;
1078010780
CODE_SIGN_IDENTITY = "";
1078110781
CODE_SIGN_STYLE = Automatic;
10782-
CURRENT_PROJECT_VERSION = 1;
10782+
CURRENT_PROJECT_VERSION = 2;
1078310783
DEFINES_MODULE = YES;
1078410784
DYLIB_COMPATIBILITY_VERSION = 1;
10785-
DYLIB_CURRENT_VERSION = 1;
10785+
DYLIB_CURRENT_VERSION = 2;
1078610786
DYLIB_INSTALL_NAME_BASE = "@rpath";
1078710787
INFOPLIST_FILE = Core/Info.plist;
1078810788
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";

DuckDuckGo/EditableShortcutsView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct EditableShortcutsView: View {
2828
private let haptics = UIImpactFeedbackGenerator()
2929

3030
var body: some View {
31-
NewTabPageGridView(geometry: geometry) { _ in
31+
NewTabPageGridView(geometry: geometry, isUsingDynamicSpacing: true) { _ in
3232
ReorderableForEach(model.itemsSettings, id: \.item.id, isReorderingEnabled: true) { setting in
3333
let isEnabled = model.enabledItems.contains(setting.item)
3434
Button {

DuckDuckGo/FavoritesView.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ struct FavoritesView<Model: FavoritesViewModel>: View {
3636
var body: some View {
3737
VStack(alignment: .center, spacing: 24) {
3838

39-
let columns = NewTabPageGrid.columnsCount(for: horizontalSizeClass, isLandscape: isLandscape)
39+
let columns = NewTabPageGrid.columnsCount(for: horizontalSizeClass,
40+
isLandscape: isLandscape,
41+
isDynamic: model.isNewTabPageCustomizationEnabled)
4042
let result = model.prefixedFavorites(for: columns)
4143

42-
NewTabPageGridView(geometry: geometry) { _ in
44+
NewTabPageGridView(geometry: geometry, isUsingDynamicSpacing: model.isNewTabPageCustomizationEnabled) { _ in
4345
ReorderableForEach(result.items) { item in
4446
viewFor(item)
4547
.previewShape()

DuckDuckGo/FavoritesViewModel.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ class FavoritesViewModel: ObservableObject {
5454
private let favoriteDataSource: NewTabPageFavoriteDataSource
5555
private let pixelFiring: PixelFiring.Type
5656
private let dailyPixelFiring: DailyPixelFiring.Type
57-
private let isNewTabPageCustomizationEnabled: Bool
57+
58+
let isNewTabPageCustomizationEnabled: Bool
5859

5960
var isEmpty: Bool {
6061
allFavorites.filter(\.isFavorite).isEmpty

DuckDuckGo/NewTabPageGridView.swift

+46-10
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ struct NewTabPageGridView<Content: View>: View {
2424
@Environment(\.isLandscapeOrientation) var isLandscape
2525

2626
let geometry: GeometryProxy?
27+
let isUsingDynamicSpacing: Bool
2728
@ViewBuilder var content: (_ columnsCount: Int) -> Content
2829

2930
@State private var width: CGFloat = .zero
3031

3132
var body: some View {
32-
let columnsCount = NewTabPageGrid.columnsCount(for: horizontalSizeClass, isLandscape: isLandscape)
33+
let columnsCount = NewTabPageGrid.columnsCount(for: horizontalSizeClass, isLandscape: isLandscape, isDynamic: isUsingDynamicSpacing)
3334

34-
LazyVGrid(columns: flexibleColumns(columnsCount, width: width), spacing: 24, content: {
35+
LazyVGrid(columns: createColumns(columnsCount), spacing: 24, content: {
3536
content(columnsCount)
3637
})
3738
.frame(maxWidth: .infinity)
@@ -41,12 +42,14 @@ struct NewTabPageGridView<Content: View>: View {
4142
return geometry[anchor].width
4243
})
4344
.onPreferenceChange(FramePreferenceKey.self, perform: { value in
44-
width = value
45+
if isUsingDynamicSpacing {
46+
width = value
47+
}
4548
})
4649
.padding(0)
4750
}
4851

49-
private func flexibleColumns(_ count: Int, width: CGFloat) -> [GridItem] {
52+
private func flexibleColumns(_ count: Int) -> [GridItem] {
5053
let spacing: CGFloat?
5154
if width != .zero {
5255
let columnsWidth = NewTabPageGrid.Item.edgeSize * Double(count)
@@ -62,6 +65,17 @@ struct NewTabPageGridView<Content: View>: View {
6265
alignment: .top),
6366
count: count)
6467
}
68+
69+
private func staticColumns(_ count: Int) -> [GridItem] {
70+
return Array(repeating: GridItem(.fixed(NewTabPageGrid.Item.edgeSize),
71+
spacing: NewTabPageGrid.Item.staticSpacing,
72+
alignment: .top),
73+
count: count)
74+
}
75+
76+
private func createColumns(_ count: Int) -> [GridItem] {
77+
isUsingDynamicSpacing ? flexibleColumns(count) : staticColumns(count)
78+
}
6579
}
6680

6781
private struct FramePreferenceKey: PreferenceKey {
@@ -72,17 +86,39 @@ private struct FramePreferenceKey: PreferenceKey {
7286
}
7387

7488
enum NewTabPageGrid {
75-
enum ColumnCount {
76-
static let compact = 4
77-
static let regular = 6
89+
static func columnsCount(for sizeClass: UserInterfaceSizeClass?, isLandscape: Bool, isDynamic: Bool) -> Int {
90+
if isDynamic {
91+
let usesWideLayout = isLandscape || sizeClass == .regular
92+
return usesWideLayout ? ColumnCount.regular : ColumnCount.compact
93+
} else {
94+
return staticGridColumnsCount(for: sizeClass)
95+
}
96+
}
97+
98+
static func staticGridWidth(for sizeClass: UserInterfaceSizeClass?) -> CGFloat {
99+
let columnsCount = CGFloat(staticGridColumnsCount(for: sizeClass))
100+
return columnsCount * Item.edgeSize + (columnsCount - 1) * Item.staticSpacing
101+
}
102+
103+
private static func staticGridColumnsCount(for sizeClass: UserInterfaceSizeClass?) -> Int {
104+
let isPad = UIDevice.current.userInterfaceIdiom == .pad
105+
106+
return isPad && sizeClass == .regular ? ColumnCount.staticWideLayout : ColumnCount.compact
78107
}
79108

80109
enum Item {
81110
static let edgeSize = 64.0
82111
}
112+
}
83113

84-
static func columnsCount(for sizeClass: UserInterfaceSizeClass?, isLandscape: Bool) -> Int {
85-
let usesWideLayout = isLandscape || sizeClass == .regular
86-
return usesWideLayout ? ColumnCount.regular : ColumnCount.compact
114+
private extension NewTabPageGrid {
115+
enum ColumnCount {
116+
static let compact = 4
117+
static let regular = 6
118+
static let staticWideLayout = 5
87119
}
88120
}
121+
122+
private extension NewTabPageGrid.Item {
123+
static let staticSpacing = 32.0
124+
}

DuckDuckGo/ShortcutsView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct ShortcutsView: View {
2626
let proxy: GeometryProxy?
2727

2828
var body: some View {
29-
NewTabPageGridView(geometry: proxy) { _ in
29+
NewTabPageGridView(geometry: proxy, isUsingDynamicSpacing: true) { _ in
3030
ForEach(shortcuts) { shortcut in
3131
Button {
3232
model.openShortcut(shortcut)

0 commit comments

Comments
 (0)