Skip to content

Commit

Permalink
Merge branch 'main' into anh/pir/resubmit-opt-outs
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhdo committed Nov 15, 2024
2 parents 8d0d4ea + 9e4e472 commit ba1964b
Show file tree
Hide file tree
Showing 45 changed files with 1,143 additions and 127 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build_notarized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ on:
description: "Branch name"
required: false
type: string
skip-notify:
description: "Skip Mattermost notification"
required: false
default: false
type: boolean
secrets:
APPLE_API_KEY_BASE64:
required: true
Expand Down Expand Up @@ -360,7 +365,7 @@ jobs:
name: Send Mattermost message

needs: [export-notarized-app, create-dmg]
if: always()
if: ${{ always() && inputs.skip-notify == false }}

runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sync_end_to_end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
release-type: review
create-dmg: false
branch: ${{ github.sha }}
skip-notify: true
secrets:
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
Expand Down Expand Up @@ -153,6 +154,7 @@ jobs:
with:
check_name: "Test Report ${{ matrix.runner }}"
report_paths: ui-tests.xml
check_retries: true

- name: Upload logs when workflow failed
uses: actions/upload-artifact@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
release-type: review
create-dmg: false
branch: ${{ github.sha }}
skip-notify: true
secrets:
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
Expand Down Expand Up @@ -64,6 +65,9 @@ jobs:

- name: Set up fastlane
run: bundle install

- name: Create Default Keychain
run: bundle exec fastlane create_keychain_ui_tests

- name: Sync code signing assets
env:
Expand Down Expand Up @@ -141,6 +145,7 @@ jobs:
with:
check_name: "Test Report ${{ matrix.runner }}"
report_paths: ui-tests.xml
check_retries: true

- name: Upload logs when workflow failed
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 305
CURRENT_PROJECT_VERSION = 307
24 changes: 23 additions & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,8 @@
37F19A6728E1B43200740DC6 /* DuckPlayerPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F19A6628E1B43200740DC6 /* DuckPlayerPreferences.swift */; };
37F19A6A28E2F2D000740DC6 /* DuckPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F19A6928E2F2D000740DC6 /* DuckPlayer.swift */; };
37F44A5F298C17830025E7FE /* Navigation in Frameworks */ = {isa = PBXBuildFile; productRef = 37F44A5E298C17830025E7FE /* Navigation */; };
37F8ABD32CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F8ABD22CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift */; };
37F8ABD42CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37F8ABD22CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift */; };
37FD78112A29EBD100B36DB1 /* SyncErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */; };
37FD78122A29EBD100B36DB1 /* SyncErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */; };
4B0135CE2729F1AA00D54834 /* NSPasteboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0135CD2729F1AA00D54834 /* NSPasteboardExtension.swift */; };
Expand Down Expand Up @@ -2809,6 +2811,7 @@
BB470EBC2C5A66D6002EE91D /* BookmarkManagementDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB470EBA2C5A66D6002EE91D /* BookmarkManagementDetailViewModel.swift */; };
BB5789722B2CA70F0009DFE2 /* DataBrokerProtectionSubscriptionEventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5789712B2CA70F0009DFE2 /* DataBrokerProtectionSubscriptionEventHandler.swift */; };
BB5F46A32C8751F6005F72DF /* BookmarkSortTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB5F46A22C8751F6005F72DF /* BookmarkSortTests.swift */; };
BB731F312CDBA6360023D2E4 /* FireWindowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB731F302CDBA6320023D2E4 /* FireWindowTests.swift */; };
BB7B5F982C4ED73800BA4AF8 /* BookmarksSearchAndSortMetrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7B5F972C4ED73800BA4AF8 /* BookmarksSearchAndSortMetrics.swift */; };
BB7B5F992C4ED73800BA4AF8 /* BookmarksSearchAndSortMetrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7B5F972C4ED73800BA4AF8 /* BookmarksSearchAndSortMetrics.swift */; };
BBB881882C4029BA001247C6 /* BookmarkListTreeControllerSearchDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBB881872C4029BA001247C6 /* BookmarkListTreeControllerSearchDataSource.swift */; };
Expand Down Expand Up @@ -3000,6 +3003,10 @@
D64A5FF92AEA5C2B00B6D6E7 /* HomeButtonMenuFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64A5FF72AEA5C2B00B6D6E7 /* HomeButtonMenuFactory.swift */; };
D6BC8AC62C5A95AA0025375B /* DuckPlayer in Frameworks */ = {isa = PBXBuildFile; productRef = D6BC8AC52C5A95AA0025375B /* DuckPlayer */; };
D6BC8AC82C5A95B10025375B /* DuckPlayer in Frameworks */ = {isa = PBXBuildFile; productRef = D6BC8AC72C5A95B10025375B /* DuckPlayer */; };
D6E0ACB12CE36DCA005D3486 /* DuckPlayerOverlayPixels.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0ACB02CE36DC4005D3486 /* DuckPlayerOverlayPixels.swift */; };
D6E0ACB22CE36DCA005D3486 /* DuckPlayerOverlayPixels.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0ACB02CE36DC4005D3486 /* DuckPlayerOverlayPixels.swift */; };
D6E0ACB42CE36FB0005D3486 /* DuckPlayerOverlayPixelsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0ACB32CE36FA8005D3486 /* DuckPlayerOverlayPixelsTests.swift */; };
D6E0ACB52CE36FB0005D3486 /* DuckPlayerOverlayPixelsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6E0ACB32CE36FA8005D3486 /* DuckPlayerOverlayPixelsTests.swift */; };
EA0BA3A9272217E6002A0B6C /* ClickToLoadUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0BA3A8272217E6002A0B6C /* ClickToLoadUserScript.swift */; };
EA18D1CA272F0DC8006DC101 /* social_images in Resources */ = {isa = PBXBuildFile; fileRef = EA18D1C9272F0DC8006DC101 /* social_images */; };
EA8AE76A279FBDB20078943E /* ClickToLoadTDSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA8AE769279FBDB20078943E /* ClickToLoadTDSTests.swift */; };
Expand Down Expand Up @@ -3707,6 +3714,7 @@
37F19A6428E1B3FB00740DC6 /* PreferencesDuckPlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesDuckPlayerView.swift; sourceTree = "<group>"; };
37F19A6628E1B43200740DC6 /* DuckPlayerPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayerPreferences.swift; sourceTree = "<group>"; };
37F19A6928E2F2D000740DC6 /* DuckPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayer.swift; sourceTree = "<group>"; };
37F8ABD22CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlagOverridesMenu.swift; sourceTree = "<group>"; };
37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncErrorHandler.swift; sourceTree = "<group>"; };
4B0135CD2729F1AA00D54834 /* NSPasteboardExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSPasteboardExtension.swift; sourceTree = "<group>"; };
4B02197F25E05FAC00ED7DEA /* FireproofingURLExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FireproofingURLExtensions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4760,6 +4768,7 @@
BB470EBA2C5A66D6002EE91D /* BookmarkManagementDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkManagementDetailViewModel.swift; sourceTree = "<group>"; };
BB5789712B2CA70F0009DFE2 /* DataBrokerProtectionSubscriptionEventHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataBrokerProtectionSubscriptionEventHandler.swift; sourceTree = "<group>"; };
BB5F46A22C8751F6005F72DF /* BookmarkSortTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSortTests.swift; sourceTree = "<group>"; };
BB731F302CDBA6320023D2E4 /* FireWindowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireWindowTests.swift; sourceTree = "<group>"; };
BB7B5F972C4ED73800BA4AF8 /* BookmarksSearchAndSortMetrics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksSearchAndSortMetrics.swift; sourceTree = "<group>"; };
BBB881872C4029BA001247C6 /* BookmarkListTreeControllerSearchDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkListTreeControllerSearchDataSource.swift; sourceTree = "<group>"; };
BBBB653F2C77BB9400E69AC6 /* BookmarkSearchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSearchTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4846,6 +4855,8 @@
CDE248A62C821FFE00F9399D /* filterSet.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = filterSet.json; sourceTree = "<group>"; };
CDE248A72C821FFE00F9399D /* PhishingDetectionStateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhishingDetectionStateManager.swift; sourceTree = "<group>"; };
D64A5FF72AEA5C2B00B6D6E7 /* HomeButtonMenuFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeButtonMenuFactory.swift; sourceTree = "<group>"; };
D6E0ACB02CE36DC4005D3486 /* DuckPlayerOverlayPixels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayerOverlayPixels.swift; sourceTree = "<group>"; };
D6E0ACB32CE36FA8005D3486 /* DuckPlayerOverlayPixelsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayerOverlayPixelsTests.swift; sourceTree = "<group>"; };
EA0BA3A8272217E6002A0B6C /* ClickToLoadUserScript.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClickToLoadUserScript.swift; sourceTree = "<group>"; };
EA18D1C9272F0DC8006DC101 /* social_images */ = {isa = PBXFileReference; lastKnownFileType = folder; path = social_images; sourceTree = "<group>"; };
EA8AE769279FBDB20078943E /* ClickToLoadTDSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClickToLoadTDSTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5294,6 +5305,7 @@
1D36E651298A84F600AA485D /* InternalUserDecider */ = {
isa = PBXGroup;
children = (
37F8ABD22CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift */,
1D36E657298AA3BA00AA485D /* InternalUserDeciderStore.swift */,
);
path = InternalUserDecider;
Expand Down Expand Up @@ -5617,6 +5629,7 @@
315AA06F28CA5CC800200030 /* YoutubePlayerNavigationHandler.swift */,
31F28C4C28C8EEC500119F70 /* YoutubePlayerUserScript.swift */,
31F28C4E28C8EEC500119F70 /* YoutubeOverlayUserScript.swift */,
D6E0ACB02CE36DC4005D3486 /* DuckPlayerOverlayPixels.swift */,
);
path = YoutubePlayer;
sourceTree = "<group>";
Expand Down Expand Up @@ -5708,6 +5721,7 @@
376718FE28E58504003A2A15 /* YoutubePlayer */ = {
isa = PBXGroup;
children = (
D6E0ACB32CE36FA8005D3486 /* DuckPlayerOverlayPixelsTests.swift */,
3199AF812C80736B003AEBDC /* DuckPlayerOnboardingLocationValidatorTests.swift */,
3714B1E828EDBAAB0056C57A /* DuckPlayerTests.swift */,
567DA94429E95C3F008AC5EE /* YoutubeOverlayUserScriptTests.swift */,
Expand Down Expand Up @@ -6972,6 +6986,7 @@
7B4CE8DB26F02108009134B1 /* UITests */ = {
isa = PBXGroup;
children = (
BB731F302CDBA6320023D2E4 /* FireWindowTests.swift */,
376E708D2BD686260082B7EB /* UI Tests.xctestplan */,
EEBCE6802BA444FA00B9DF00 /* Common */,
EEC7BE2D2BC6C09400F86835 /* AddressBarKeyboardShortcutsTests.swift */,
Expand Down Expand Up @@ -11293,6 +11308,7 @@
3706FB13293F65D500E42796 /* Bookmark.swift in Sources */,
3706FB14293F65D500E42796 /* ConnectBitwardenViewModel.swift in Sources */,
3706FB15293F65D500E42796 /* NSNotificationName+DataImport.swift in Sources */,
37F8ABD42CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift in Sources */,
EE6666702B56EDE4001D898D /* VPNLocationsHostingViewController.swift in Sources */,
3706FB16293F65D500E42796 /* StoredPermission.swift in Sources */,
3706FB17293F65D500E42796 /* FirePopoverCollectionViewHeader.swift in Sources */,
Expand Down Expand Up @@ -11333,6 +11349,7 @@
3706FB2F293F65D500E42796 /* HomePageRecentlyVisitedModel.swift in Sources */,
C1935A152C88F958001AD72D /* SyncPromoView.swift in Sources */,
C126B35B2C820924005DC2A3 /* FreemiumDebugMenu.swift in Sources */,
D6E0ACB22CE36DCA005D3486 /* DuckPlayerOverlayPixels.swift in Sources */,
3707C718294B5D0F00682A9F /* AdClickAttributionTabExtension.swift in Sources */,
31EF1E812B63FFB800E6DB17 /* DataBrokerProtectionManager.swift in Sources */,
3706FEBA293F6EFF00E42796 /* BWStatus.swift in Sources */,
Expand Down Expand Up @@ -12155,6 +12172,7 @@
3706FE27293F661700E42796 /* AppPrivacyConfigurationTests.swift in Sources */,
B626A7652992506A00053070 /* SerpHeadersNavigationResponderTests.swift in Sources */,
9F6434712BECBA2800D2D8A0 /* SubscriptionRedirectManagerTests.swift in Sources */,
D6E0ACB52CE36FB0005D3486 /* DuckPlayerOverlayPixelsTests.swift in Sources */,
9F26060C2B85C20B00819292 /* AddEditBookmarkDialogViewModelTests.swift in Sources */,
567A23DF2C89980A0010F66C /* OnboardingNavigationDelegateTests.swift in Sources */,
562532A12BC069190034D316 /* ZoomPopoverViewModelTests.swift in Sources */,
Expand Down Expand Up @@ -12628,6 +12646,7 @@
EEC7BE2E2BC6C09500F86835 /* AddressBarKeyboardShortcutsTests.swift in Sources */,
EE54F7B32BBFEA49006218DB /* BookmarksAndFavoritesTests.swift in Sources */,
EE02D4222BB4611A00DBE6B3 /* TestsURLExtension.swift in Sources */,
BB731F312CDBA6360023D2E4 /* FireWindowTests.swift in Sources */,
EE42CBCC2BC8004700AD411C /* PermissionsTests.swift in Sources */,
7B4CE8E726F02135009134B1 /* TabBarTests.swift in Sources */,
EEBCE6832BA463DD00B9DF00 /* NSImageExtensions.swift in Sources */,
Expand Down Expand Up @@ -13041,6 +13060,7 @@
37F19A6A28E2F2D000740DC6 /* DuckPlayer.swift in Sources */,
AA5FA69A275F91C700DCE9C9 /* Favicon.swift in Sources */,
AABEE69A24A902A90043105B /* SuggestionContainerViewModel.swift in Sources */,
37F8ABD32CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift in Sources */,
AA840A9827319D1600E63CDD /* FirePopoverWrapperViewController.swift in Sources */,
4B85A48028821CC500FC4C39 /* NSPasteboardItemExtension.swift in Sources */,
37CD54CA27F2FDD100F1F7B9 /* AutofillPreferencesModel.swift in Sources */,
Expand Down Expand Up @@ -13368,6 +13388,7 @@
EE66666F2B56EDE4001D898D /* VPNLocationsHostingViewController.swift in Sources */,
37CC53EC27E8A4D10028713D /* PreferencesDataClearingView.swift in Sources */,
4B0135CE2729F1AA00D54834 /* NSPasteboardExtension.swift in Sources */,
D6E0ACB12CE36DCA005D3486 /* DuckPlayerOverlayPixels.swift in Sources */,
85707F31276A7DCA00DC0649 /* OnboardingViewModel.swift in Sources */,
85AC3B0525D6B1D800C7D2AA /* ScriptSourceProviding.swift in Sources */,
848648A12C76F4B20082282D /* BookmarksBarMenuViewController.swift in Sources */,
Expand Down Expand Up @@ -13697,6 +13718,7 @@
B630E7FE29C887ED00363609 /* NSErrorAdditionalInfo.swift in Sources */,
370270C02C78EB13002E44E4 /* HomePageSettingsModelTests.swift in Sources */,
4B9292BB2667103100AD2C21 /* BookmarkNodeTests.swift in Sources */,
D6E0ACB42CE36FB0005D3486 /* DuckPlayerOverlayPixelsTests.swift in Sources */,
4B0219A825E0646500ED7DEA /* WebsiteDataStoreTests.swift in Sources */,
AAC9C01E24CB6BEB00AD1325 /* TabCollectionViewModelTests.swift in Sources */,
56CE77612C7DFCF800AC1ED2 /* OnboardingSuggestedSearchesProviderTests.swift in Sources */,
Expand Down Expand Up @@ -15050,7 +15072,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 209.1.0;
version = 210.0.1;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "948420e704ea4d9412a4fc3e2c2ab0d5ea5fe5d7",
"version" : "209.1.0"
"revision" : "183b9c111176fd7821cd17d01c01ddb38486c9ac",
"version" : "210.0.1"
}
},
{
Expand Down Expand Up @@ -75,7 +75,7 @@
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-spm",
"location" : "https://github.com/airbnb/lottie-spm.git",
"state" : {
"revision" : "1d29eccc24cc8b75bff9f6804155112c0ffc9605",
"version" : "4.4.3"
Expand Down
8 changes: 7 additions & 1 deletion DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Configuration
import CoreData
import Crashes
import DDGSync
import FeatureFlags
import History
import MetricKit
import Networking
Expand Down Expand Up @@ -264,7 +265,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

featureFlagger = DefaultFeatureFlagger(
internalUserDecider: internalUserDecider,
privacyConfigManager: AppPrivacyFeatures.shared.contentBlocking.privacyConfigurationManager
privacyConfigManager: AppPrivacyFeatures.shared.contentBlocking.privacyConfigurationManager,
localOverrides: FeatureFlagLocalOverrides(
keyValueStore: UserDefaults.appConfiguration,
actionHandler: FeatureFlagOverridesPublishingHandler<FeatureFlag>()
),
for: FeatureFlag.self
)

onboardingStateMachine = ContextualOnboardingStateMachine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ final class BookmarkOutlineViewDataSource: NSObject, BookmarksOutlineViewDataSou
private var outlineView: BookmarksOutlineView?

private let contentMode: ContentMode
private var sortMode: BookmarksSortMode
private(set) var expandedNodesIDs = Set<String>()
@Published private(set) var isSearching = false

Expand Down Expand Up @@ -95,18 +96,21 @@ final class BookmarkOutlineViewDataSource: NSObject, BookmarksOutlineViewDataSou
self.dragDropManager = dragDropManager
self.treeController = treeController
self.presentFaviconsFetcherOnboarding = presentFaviconsFetcherOnboarding
self.sortMode = sortMode

super.init()
}

func reloadData(with sortMode: BookmarksSortMode, withRootFolder rootFolder: BookmarkFolder? = nil) {
isSearching = false
dragDestinationFolder = nil
self.sortMode = sortMode
treeController.rebuild(for: sortMode, withRootFolder: rootFolder)
}

func reloadData(forSearchQuery searchQuery: String, sortMode: BookmarksSortMode) {
isSearching = true
self.sortMode = sortMode
treeController.rebuild(forSearchQuery: searchQuery, sortMode: sortMode)
}

Expand Down Expand Up @@ -260,6 +264,8 @@ final class BookmarkOutlineViewDataSource: NSObject, BookmarksOutlineViewDataSou
}

func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {
if !sortMode.isReorderingEnabled { return .none }

let destinationNode = nodeForItem(item)

if contentMode == .foldersOnly, destinationNode.isRoot {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ extension BookmarkManagementDetailViewController: NSTableViewDelegate, NSTableVi
validateDrop info: NSDraggingInfo,
proposedRow row: Int,
proposedDropOperation dropOperation: NSTableView.DropOperation) -> NSDragOperation {
if !sortBookmarksViewModel.selectedSortMode.isReorderingEnabled { return .none }
let destination = destination(for: dropOperation, at: row)

guard !isSearching || destination is BookmarkFolder else { return .none }
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/Bookmarks/ViewModel/SortBookmarksViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ enum BookmarksSortMode: Codable {
return self == .nameAscending || self == .nameDescending
}

var isReorderingEnabled: Bool{
return self == .manual
}

func menu(target: AnyObject) -> NSMenu {
switch self {
case .manual:
Expand Down
Loading

0 comments on commit ba1964b

Please sign in to comment.