Update UI my places favorite i os#5469
Conversation
… update_ui_my_places_favorite_iOS
… update_ui_my_places_favorite_iOS
… update_ui_my_places_favorite_iOS
…i_my_places_favorite_iOS
… update_ui_my_places_favorite_iOS
| import UniformTypeIdentifiers | ||
|
|
||
| extension FavoriteListViewController { | ||
| func areAllSelectableItemsSelected() -> Bool { |
There was a problem hiding this comment.
Consider whether SelectionManager can be used here
| self.groupController = groupController | ||
| favoriteItemsToMove = favoriteItems | ||
| groupController.delegate = self | ||
| let modalNavigationController = UINavigationController(rootViewController: groupController) |
| addToTrackGroupName = groupName | ||
| addToTrackFavoriteItems = nil | ||
| viewController.delegate = self | ||
| let modalNavigationController = UINavigationController(rootViewController: viewController) |
| addToTrackGroupName = nil | ||
| viewController.delegate = self | ||
| let modalNavigationController = UINavigationController(rootViewController: viewController) | ||
| navigationController.present(modalNavigationController, animated: true) |
| return UIMenu(title: "", children: [addFolderSection, importSection]) | ||
| } | ||
|
|
||
| func setEdit(_ isEdit: Bool) { |
| format.scale = image.scale | ||
| format.opaque = false | ||
| let renderer = UIGraphicsImageRenderer(size: image.size, format: format) | ||
| return renderer.image { context in |
There was a problem hiding this comment.
1)Are we sure the rotated image won't be clipped? The renderer size remains unchanged after rotation.
2) Move to extension
| } | ||
|
|
||
| var snapshot = Snapshot() | ||
| if allFolders.isEmpty { |
There was a problem hiding this comment.
if allFolders.isEmpty {
applyEmptyStateSnapshot(animatingDifferences: animatingDifferences)
return
}
| // | ||
|
|
||
| import CoreLocation | ||
| import UniformTypeIdentifiers |
| } | ||
|
|
||
| struct FavoriteFolderRow: Hashable, FavoriteSortableFolder { | ||
| static let subtitleDateFormatter: DateFormatter = { |
| struct FavoriteFolderRow: Hashable, FavoriteSortableFolder { | ||
| static let subtitleDateFormatter: DateFormatter = { | ||
| let formatter = DateFormatter() | ||
| formatter.dateFormat = "d MMM" |
There was a problem hiding this comment.
Consider using setLocalizedDateFormatFromTemplate("dMMM") instead of a hardcoded date format to better support different locales
tigrim
left a comment
There was a problem hiding this comment.
Folder actions omit nested favorites
- FavoriteListViewController+ContextMenu.swift:52-67, OAFavoritesBridgeHelper.mm:599, 662, 714, 798
If a folder has direct points, “Add to markers/track/navigation” processes only those points and silently ignores its subfolders. Bulk actions have the same problem.
Resolve folder bridge items recursively inside the helper and deduplicate points there.
Distance updates rebuild expensive snapshots every 300 ms
- FavoriteListViewController.swift:161-189, OAFavoritesBridgeHelper.mm:44-58
Each heading/location update recreates bridge objects, icons, filesystem attributes, subtree counts, and performs repeated nested scans. Large favorite collections will cause UI stalls and battery usage.
Cache structural metadata and update only visible point distance/direction cells.
Current folder becomes stale after being renamed
- FavoriteListViewController+Delegates.swift:196-203, FavoriteListViewController+DataSource.swift:225
ScreenMode.folder retains the old bridge item/group name. Renaming from the appearance editor then reloads the deleted path, producing an empty screen and stale title.
Store a mutable group identifier or replace/pop the controller after rename.
Import notification may mutate UIKit off-main
- FavoriteListViewController+Actions.swift:232
favoriteDataDidChange() calls diffable data-source APIs without enforcing the main thread.
Dispatch to the main queue, as already done in productPurchased()
| return YES; | ||
| } | ||
|
|
||
| + (void)renameFavoriteGroup:(NSString *)groupName newName:(NSString *)newName |
There was a problem hiding this comment.
Rename/move can silently merge folders and corrupt
- hierarchyFavoriteListViewController+Actions.swift:93, OAFavoritesBridgeHelper.mm:192, 983, OAFavoritesHelper.mm:540
- Duplicate destination names are not rejected. updateGroup silently merges points into an existing group. Names containing / can also restructure the hierarchy unexpectedly.
- Validate every destination path before mutation, reject /, and require explicit confirmation for merges.
No description provided.