Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync form factor specific favorites #2029

Merged
merged 57 commits into from
Nov 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1a82668
[WIP] Support for form factor specific favorites
ayoy Sep 8, 2023
3522cc7
Add favorites display mode switcher to settings
ayoy Sep 10, 2023
8cd0f21
Update BSK ref
ayoy Sep 10, 2023
997e861
Reload Home view collection view when favorites display mode changes
ayoy Sep 10, 2023
bc9d688
Apply most recent designs to favorites display mode settings screen
ayoy Sep 11, 2023
e00562c
Implement migration to form-factor-specific favorites
ayoy Sep 11, 2023
0ee52ce
Reload widgets on update to favorites display mode
ayoy Sep 11, 2023
a3420f6
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Sep 14, 2023
698d23a
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Sep 14, 2023
557cf9a
Add Sync options to Sync view
ayoy Sep 14, 2023
8586145
Revert changes to Settings.storyboard
ayoy Sep 14, 2023
754fe12
Revert changes to SettingsViewController
ayoy Sep 14, 2023
a1f1f33
Add FavoritesDisplayModeSyncHandler
ayoy Sep 15, 2023
c6ee017
Update BSK ref
ayoy Sep 15, 2023
52d6d69
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Sep 18, 2023
30815c8
Update BSK ref
ayoy Sep 18, 2023
21be09d
Fix unit tests to compile and pass
ayoy Sep 19, 2023
d9288ca
Update BSK ref
ayoy Sep 20, 2023
baafc69
Implement handling favorites after disabling Sync
ayoy Sep 20, 2023
2f55c18
Make app responsive to favorites display mode changes
ayoy Sep 20, 2023
8f58d3b
Properly share favorites display mode setting with the Widget
ayoy Sep 20, 2023
a701352
Update BSK ref
ayoy Sep 21, 2023
0da5324
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Sep 21, 2023
9297e19
Update BSK ref
ayoy Sep 21, 2023
f5fafe4
Update BSK ref
ayoy Sep 21, 2023
e70d33e
Fix tests compilation
ayoy Sep 21, 2023
3e123f5
Remove unnecessary changes
ayoy Sep 21, 2023
b331786
Address review feedback, part 1
ayoy Sep 21, 2023
d9b7b8b
Use FavoritesDisplayModeSyncHandlerBase
ayoy Sep 21, 2023
46c2b80
Use prepareLegacyFoldersStructure for legacy migration
ayoy Sep 21, 2023
160e49e
Initialize EmailProtectionSyncHandler in SyncSettingsAdapter
ayoy Sep 21, 2023
3581ee0
Fire pixel before crashing when migration to FFS favorites fails'
ayoy Sep 21, 2023
e6caba6
Handle favorites after disabling sync as part of 'cleaning up databas…
ayoy Sep 21, 2023
380cc92
Parametrize BookmarksExporter with favorites display mode
ayoy Sep 21, 2023
297a170
Parametrize AddOrEditBookmarkViewController with appSettings
ayoy Sep 21, 2023
451d815
Use favorites display mode in BookmarkFoldersTableViewController
ayoy Sep 21, 2023
da018f4
Parametrize appSettings in more places
ayoy Sep 21, 2023
26db43b
Use favoritesDisplayMode in BookmarksDataSource
ayoy Sep 21, 2023
8cd0a4e
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Sep 21, 2023
38f7738
Update bookmark delete undo for FFS favorites
ayoy Sep 21, 2023
253cadc
Prepare legacy folders structure also in another place in LegacyBookm…
ayoy Sep 21, 2023
eebdd48
Update BSK ref
ayoy Sep 23, 2023
4d3c3d6
Refresh bookmarks views on display mode change
bwaresiak Sep 26, 2023
77cb4c0
new sync flow (#2071)
SabrinaTardio Oct 11, 2023
afa6102
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Oct 11, 2023
1c278a5
Update BSK ref
ayoy Oct 11, 2023
9f2fb8a
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Oct 13, 2023
bb2834c
Update BSK ref
ayoy Oct 13, 2023
dc23f73
Sync limit exceeded (#2105)
SabrinaTardio Oct 20, 2023
707b6c6
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Oct 29, 2023
dcd4704
Reset bookmarks sync timestamp after migrating to FFS favorites (#2091)
ayoy Nov 3, 2023
efbb57b
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Nov 7, 2023
f054600
Sync paused alert (#2129)
SabrinaTardio Nov 10, 2023
cda7497
Update BSK ref
ayoy Nov 10, 2023
cbe2ed9
Merge branch 'develop' into dominik/sync-ffs-favorites
ayoy Nov 10, 2023
63d855c
Fix compilation for when APPTP is disabled
ayoy Nov 10, 2023
4a5dded
Set BSK version to 83.0.0
ayoy Nov 10, 2023
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
Prev Previous commit
Next Next commit
Reset bookmarks sync timestamp after migrating to FFS favorites (#2091)
Task/Issue URL: https://app.asana.com/0/0/1205710208879158/f

Description:
After migration to form-factor specific favorites is done, reset the timestamp
of bookmarks syncable model to force full remote data fetch to populate
FFS favorites folders that may have previously been skipped.
ayoy authored Nov 3, 2023
commit dcd4704cc636869809498090e1279ba9c7987c70
11 changes: 10 additions & 1 deletion Core/SyncBookmarksAdapter.swift
Original file line number Diff line number Diff line change
@@ -35,7 +35,12 @@ public final class SyncBookmarksAdapter {
public private(set) var provider: BookmarksProvider?
public let databaseCleaner: BookmarkDatabaseCleaner
public let syncDidCompletePublisher: AnyPublisher<Void, Never>
public let widgetRefreshCancellable: AnyCancellable
public var shouldResetBookmarksSyncTimestamp: Bool = false {
willSet {
assert(provider == nil, "Setting this value has no effect after provider has been instantiated")
}
}

public static let syncBookmarksPausedStateChanged = Notification.Name("com.duckduckgo.app.SyncPausedStateChanged")

@UserDefaultsWrapper(key: .syncBookmarksPaused, defaultValue: false)
@@ -82,6 +87,9 @@ public final class SyncBookmarksAdapter {
Self.isSyncBookmarksPaused = false
}
)
if shouldResetBookmarksSyncTimestamp {
provider.lastSyncTimestamp = nil
}

syncErrorCancellable = provider.syncErrorPublisher
.sink { error in
@@ -135,6 +143,7 @@ public final class SyncBookmarksAdapter {

private var syncDidCompleteSubject = PassthroughSubject<Void, Never>()
private var syncErrorCancellable: AnyCancellable?
private var widgetRefreshCancellable: AnyCancellable
private let database: CoreDataDatabase
private let favoritesDisplayModeStorage: FavoritesDisplayModeStoring
}
11 changes: 10 additions & 1 deletion DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -149,7 +149,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
DatabaseMigration.migrate(to: context)
}

bookmarksDatabase.loadStore { context, error in
var shouldResetBookmarksSyncTimestamp = false

bookmarksDatabase.loadStore { [weak self] context, error in
guard let context = context else {
if let error = error {
Pixel.fire(pixel: .bookmarksCouldNotLoadDatabase,
@@ -172,6 +174,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
BookmarkUtils.migrateToFormFactorSpecificFavorites(byCopyingExistingTo: .mobile, in: context)
if context.hasChanges {
try context.save(onErrorFire: .bookmarksMigrationCouldNotPrepareMultipleFavoriteFolders)
if let syncDataProviders = self?.syncDataProviders {
syncDataProviders.bookmarksAdapter.shouldResetBookmarksSyncTimestamp = true
} else {
shouldResetBookmarksSyncTimestamp = true
}
}
} catch {
Thread.sleep(forTimeInterval: 1)
ayoy marked this conversation as resolved.
Show resolved Hide resolved
@@ -229,6 +236,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
settingHandlers: [FavoritesDisplayModeSyncHandler()],
favoritesDisplayModeStorage: FavoritesDisplayModeStorage()
)
syncDataProviders.bookmarksAdapter.shouldResetBookmarksSyncTimestamp = shouldResetBookmarksSyncTimestamp

let syncService = DDGSync(dataProvidersSource: syncDataProviders, errorEvents: SyncErrorHandler(), log: .syncLog, environment: environment)
syncService.initializeIfNeeded()
self.syncService = syncService