From fadf6cd03737cf220c2b49de5f78657677fa5f64 Mon Sep 17 00:00:00 2001 From: Vladyslav Lysenko Date: Mon, 13 Jul 2026 12:23:04 +0300 Subject: [PATCH 1/7] tracks duplicated in visible tracks fixed --- .../MapSettingsGpxViewController.swift | 29 ++++++++++++++---- .../Map/Helpers/OASelectedGPXHelper.mm | 30 +++++++++++++++---- Sources/Helpers/OAGPXUIHelper.mm | 2 +- 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift index cdefe06b01..befb1352cf 100644 --- a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift +++ b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift @@ -208,6 +208,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { noVisibleTracksRow.setObj(localizedString("show_all_tracks"), forKey: "buttonTitle") } else { let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() ?? [] + let visibleGpxPathSet = normalizedGpxPathSet(visibleGpxFilePaths) let gpxListToShow = isSearchActive ? filteredGpxList : (isShowingVisibleTracks ? visibleGpxList : allGpxList) for gpx in gpxListToShow { let gpxRow = tracksSection.createNewRow() @@ -215,7 +216,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { gpxRow.title = gpx.gpxFileNameWithoutExtension gpxRow.setObj(gpx, forKey: "gpx") gpxRow.iconName = "ic_custom_trip" - gpxRow.iconTintColor = visibleGpxFilePaths.contains(gpx.gpxFilePath) ? .iconColorActive : .iconColorDisabled + gpxRow.iconTintColor = visibleGpxPathSet.contains(normalizedGpxPath(gpx.gpxFilePath)) ? .iconColorActive : .iconColorDisabled } } if isShowingVisibleTracks && !recentlyVisibleGpxList.isEmpty && !isSearchActive { @@ -581,9 +582,11 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { alert.addAction(UIAlertAction(title: localizedString("shared_string_yes"), style: .default) { [weak self] _ in guard let self else { return } guard let dataItem = track.dataItem else { return } - let isVisible = settings?.mapSettingVisibleGpx.contains(track.gpxFilePath) ?? false - if isVisible { - settings?.hideGpx([track.gpxFilePath]) + let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() ?? [] + let trackPath = normalizedGpxPath(track.gpxFilePath) + let visibleTrackPaths = visibleGpxFilePaths.filter { self.normalizedGpxPath($0) == trackPath } + if !visibleTrackPaths.isEmpty { + settings?.hideGpx(visibleTrackPaths) } self.gpxDB?.removeGpxItem(dataItem, withLocalRemove: true) @@ -617,16 +620,27 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { present(actionSheet, animated: true, completion: nil) } + + private func normalizedGpxPath(_ path: String) -> String { + (path as NSString).precomposedStringWithCanonicalMapping + } + + private func normalizedGpxPathSet(_ paths: [String]) -> Set { + Set(paths.map { normalizedGpxPath($0) }) + } private func loadGpxTracks() { + var loadedPaths = Set() allGpxList = OAGPXDatabase.sharedDb().getDataItems() + .filter { loadedPaths.insert(normalizedGpxPath($0.gpxFilePath)).inserted } .sorted { $0.fileLastUploadedTime > $1.fileLastUploadedTime } isTracksAvailable = !allGpxList.isEmpty } private func loadVisibleTracks() { guard let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() else { return } - visibleGpxList = allGpxList.filter { visibleGpxFilePaths.contains($0.gpxFilePath) } + let visibleGpxPathSet = normalizedGpxPathSet(visibleGpxFilePaths) + visibleGpxList = allGpxList.filter { visibleGpxPathSet.contains(normalizedGpxPath($0.gpxFilePath)) } isVisibleTracksAvailable = !visibleGpxList.isEmpty selectedGpxTracks = visibleGpxList } @@ -640,8 +654,11 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { guard let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() else { return } let previouslyHiddenTrackPaths = UserDefaults.standard.stringArray(forKey: previouslyVisibleTracksKey) ?? [] + let visibleGpxPathSet = normalizedGpxPathSet(visibleGpxFilePaths) + let previouslyHiddenTrackPathSet = normalizedGpxPathSet(previouslyHiddenTrackPaths) let recentlyVisibleTracks = allGpxList.filter { - previouslyHiddenTrackPaths.contains($0.gpxFilePath) && !visibleGpxFilePaths.contains($0.gpxFilePath) + let gpxPath = normalizedGpxPath($0.gpxFilePath) + return previouslyHiddenTrackPathSet.contains(gpxPath) && !visibleGpxPathSet.contains(gpxPath) } recentlyVisibleGpxList = recentlyVisibleTracks diff --git a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm index e9cae48702..dce72ed136 100644 --- a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm +++ b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm @@ -223,20 +223,38 @@ - (void)restoreSelectedGpxFiles + (void)renameVisibleTrack:(NSString *)oldPath newPath:(NSString *)newPath { OAAppSettings *settings = OAAppSettings.sharedManager; - NSMutableArray *visibleGpx = [NSMutableArray arrayWithArray:settings.mapSettingVisibleGpx.get]; - for (NSString *gpx in settings.mapSettingVisibleGpx.get) + NSArray *currentVisibleGpx = [settings.mapSettingVisibleGpx get]; + NSString *normalizedOldPath = [self normalizedGpxPath:oldPath]; + NSString *normalizedNewPath = [self normalizedGpxPath:newPath]; + BOOL foundOldPath = NO; + for (NSString *gpx in currentVisibleGpx) { - if ([gpx isEqualToString:oldPath]) + if ([[self normalizedGpxPath:gpx] isEqualToString:normalizedOldPath]) { - [visibleGpx removeObject:gpx]; - [visibleGpx addObject:newPath]; + foundOldPath = YES; break; } } - + + if (!foundOldPath) + return; + + NSMutableArray *visibleGpx = [NSMutableArray array]; + for (NSString *gpx in currentVisibleGpx) + { + NSString *normalizedPath = [self normalizedGpxPath:gpx]; + if (![normalizedPath isEqualToString:normalizedOldPath] && ![normalizedPath isEqualToString:normalizedNewPath]) + [visibleGpx addObject:gpx]; + } + [visibleGpx addObject:newPath]; [settings.mapSettingVisibleGpx set:[NSArray arrayWithArray:visibleGpx]]; } ++ (NSString *)normalizedGpxPath:(NSString *)path +{ + return path.precomposedStringWithCanonicalMapping; +} + - (NSString *)getSelectedGPXFilePath:(NSString *)fileName { NSString *suffix = [NSString stringWithFormat:@"/%@", fileName]; diff --git a/Sources/Helpers/OAGPXUIHelper.mm b/Sources/Helpers/OAGPXUIHelper.mm index f0577aff48..66ff644eed 100644 --- a/Sources/Helpers/OAGPXUIHelper.mm +++ b/Sources/Helpers/OAGPXUIHelper.mm @@ -663,7 +663,7 @@ - (void)renameTrack:(OASGpxDataItem *)gpx { NSString *oldFilePath = gpx.gpxFilePath; NSString *oldPath = [OsmAndApp.instance.gpxPath stringByAppendingPathComponent:oldFilePath]; - NSString *newFileName = [newName stringByAppendingPathExtension:@"gpx"]; + NSString *newFileName = [[newName stringByAppendingPathExtension:@"gpx"] decomposedStringWithCanonicalMapping]; NSString *newFilePath = [[gpx.gpxFilePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:newFileName]; // 2023-10-22_11-34_Sun 2.gpx NSString *newPath = [OsmAndApp.instance.gpxPath stringByAppendingPathComponent:newFilePath]; if (![NSFileManager.defaultManager fileExistsAtPath:newPath]) From dfd6ca90343406ac460962b9f59584e80e4934a6 Mon Sep 17 00:00:00 2001 From: Vladyslav Lysenko Date: Mon, 13 Jul 2026 19:12:42 +0300 Subject: [PATCH 2/7] refactored --- .../MapSettings/MapSettingsGpxViewController.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift index befb1352cf..d969185607 100644 --- a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift +++ b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift @@ -630,9 +630,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { } private func loadGpxTracks() { - var loadedPaths = Set() allGpxList = OAGPXDatabase.sharedDb().getDataItems() - .filter { loadedPaths.insert(normalizedGpxPath($0.gpxFilePath)).inserted } .sorted { $0.fileLastUploadedTime > $1.fileLastUploadedTime } isTracksAvailable = !allGpxList.isEmpty } From e624bd1b97a5130d3f6bb6b6294a85da81611f6a Mon Sep 17 00:00:00 2001 From: Vladyslav Lysenko Date: Tue, 14 Jul 2026 17:50:01 +0300 Subject: [PATCH 3/7] refactored --- .../MapSettingsGpxViewController.swift | 27 ++++-------------- .../Map/Helpers/OASelectedGPXHelper.mm | 28 ++++--------------- .../MyPlaces/TracksViewController.swift | 2 +- Sources/GPX/OAGPXDatabase.h | 4 +-- Sources/GPX/OAGPXDatabase.mm | 27 ++++++++++++++++++ Sources/Helpers/OAGPXUIHelper.mm | 4 +-- 6 files changed, 43 insertions(+), 49 deletions(-) diff --git a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift index d969185607..cdefe06b01 100644 --- a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift +++ b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift @@ -208,7 +208,6 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { noVisibleTracksRow.setObj(localizedString("show_all_tracks"), forKey: "buttonTitle") } else { let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() ?? [] - let visibleGpxPathSet = normalizedGpxPathSet(visibleGpxFilePaths) let gpxListToShow = isSearchActive ? filteredGpxList : (isShowingVisibleTracks ? visibleGpxList : allGpxList) for gpx in gpxListToShow { let gpxRow = tracksSection.createNewRow() @@ -216,7 +215,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { gpxRow.title = gpx.gpxFileNameWithoutExtension gpxRow.setObj(gpx, forKey: "gpx") gpxRow.iconName = "ic_custom_trip" - gpxRow.iconTintColor = visibleGpxPathSet.contains(normalizedGpxPath(gpx.gpxFilePath)) ? .iconColorActive : .iconColorDisabled + gpxRow.iconTintColor = visibleGpxFilePaths.contains(gpx.gpxFilePath) ? .iconColorActive : .iconColorDisabled } } if isShowingVisibleTracks && !recentlyVisibleGpxList.isEmpty && !isSearchActive { @@ -582,11 +581,9 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { alert.addAction(UIAlertAction(title: localizedString("shared_string_yes"), style: .default) { [weak self] _ in guard let self else { return } guard let dataItem = track.dataItem else { return } - let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() ?? [] - let trackPath = normalizedGpxPath(track.gpxFilePath) - let visibleTrackPaths = visibleGpxFilePaths.filter { self.normalizedGpxPath($0) == trackPath } - if !visibleTrackPaths.isEmpty { - settings?.hideGpx(visibleTrackPaths) + let isVisible = settings?.mapSettingVisibleGpx.contains(track.gpxFilePath) ?? false + if isVisible { + settings?.hideGpx([track.gpxFilePath]) } self.gpxDB?.removeGpxItem(dataItem, withLocalRemove: true) @@ -620,14 +617,6 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { present(actionSheet, animated: true, completion: nil) } - - private func normalizedGpxPath(_ path: String) -> String { - (path as NSString).precomposedStringWithCanonicalMapping - } - - private func normalizedGpxPathSet(_ paths: [String]) -> Set { - Set(paths.map { normalizedGpxPath($0) }) - } private func loadGpxTracks() { allGpxList = OAGPXDatabase.sharedDb().getDataItems() @@ -637,8 +626,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { private func loadVisibleTracks() { guard let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() else { return } - let visibleGpxPathSet = normalizedGpxPathSet(visibleGpxFilePaths) - visibleGpxList = allGpxList.filter { visibleGpxPathSet.contains(normalizedGpxPath($0.gpxFilePath)) } + visibleGpxList = allGpxList.filter { visibleGpxFilePaths.contains($0.gpxFilePath) } isVisibleTracksAvailable = !visibleGpxList.isEmpty selectedGpxTracks = visibleGpxList } @@ -652,11 +640,8 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { guard let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() else { return } let previouslyHiddenTrackPaths = UserDefaults.standard.stringArray(forKey: previouslyVisibleTracksKey) ?? [] - let visibleGpxPathSet = normalizedGpxPathSet(visibleGpxFilePaths) - let previouslyHiddenTrackPathSet = normalizedGpxPathSet(previouslyHiddenTrackPaths) let recentlyVisibleTracks = allGpxList.filter { - let gpxPath = normalizedGpxPath($0.gpxFilePath) - return previouslyHiddenTrackPathSet.contains(gpxPath) && !visibleGpxPathSet.contains(gpxPath) + previouslyHiddenTrackPaths.contains($0.gpxFilePath) && !visibleGpxFilePaths.contains($0.gpxFilePath) } recentlyVisibleGpxList = recentlyVisibleTracks diff --git a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm index dce72ed136..76fe81988a 100644 --- a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm +++ b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm @@ -223,38 +223,20 @@ - (void)restoreSelectedGpxFiles + (void)renameVisibleTrack:(NSString *)oldPath newPath:(NSString *)newPath { OAAppSettings *settings = OAAppSettings.sharedManager; - NSArray *currentVisibleGpx = [settings.mapSettingVisibleGpx get]; - NSString *normalizedOldPath = [self normalizedGpxPath:oldPath]; - NSString *normalizedNewPath = [self normalizedGpxPath:newPath]; - BOOL foundOldPath = NO; - for (NSString *gpx in currentVisibleGpx) + NSMutableArray *visibleGpx = [NSMutableArray arrayWithArray:settings.mapSettingVisibleGpx.get]; + for (NSString *gpx in [settings.mapSettingVisibleGpx get]) { - if ([[self normalizedGpxPath:gpx] isEqualToString:normalizedOldPath]) + if ([gpx isEqualToString:oldPath]) { - foundOldPath = YES; + [visibleGpx removeObject:gpx]; + [visibleGpx addObject:newPath]; break; } } - if (!foundOldPath) - return; - - NSMutableArray *visibleGpx = [NSMutableArray array]; - for (NSString *gpx in currentVisibleGpx) - { - NSString *normalizedPath = [self normalizedGpxPath:gpx]; - if (![normalizedPath isEqualToString:normalizedOldPath] && ![normalizedPath isEqualToString:normalizedNewPath]) - [visibleGpx addObject:gpx]; - } - [visibleGpx addObject:newPath]; [settings.mapSettingVisibleGpx set:[NSArray arrayWithArray:visibleGpx]]; } -+ (NSString *)normalizedGpxPath:(NSString *)path -{ - return path.precomposedStringWithCanonicalMapping; -} - - (NSString *)getSelectedGPXFilePath:(NSString *)fileName { NSString *suffix = [NSString stringWithFormat:@"/%@", fileName]; diff --git a/Sources/Controllers/MyPlaces/TracksViewController.swift b/Sources/Controllers/MyPlaces/TracksViewController.swift index fc8445c9b4..ea19a2de41 100644 --- a/Sources/Controllers/MyPlaces/TracksViewController.swift +++ b/Sources/Controllers/MyPlaces/TracksViewController.swift @@ -1930,7 +1930,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda } private func updateRenamedGpx(src: KFile, dest: KFile) { - GpxDbHelper.shared.rename(currentFile: src, newFile: dest) + gpxDB.renameCurrentFile(src, newFile: dest) handleDeletedGpxFile(gpxFile: src) let trackItem = TrackItem(file: dest) trackItem.dataItem = OAGPXDatabase.sharedDb().getGPXItem(dest.path()) diff --git a/Sources/GPX/OAGPXDatabase.h b/Sources/GPX/OAGPXDatabase.h index fc8accd768..8c7c769f7b 100644 --- a/Sources/GPX/OAGPXDatabase.h +++ b/Sources/GPX/OAGPXDatabase.h @@ -47,8 +47,7 @@ typedef NS_ENUM(NSInteger, EOAGPX3DLineVisualizationPositionType) { EOAGPX3DLineVisualizationPositionTypeTopBottom, }; -@class OASGpxTrackAnalysis; -@class OASWptPt, OASGpxDataItem; +@class OASWptPt, OASGpxDataItem, OASKFile, OASGpxTrackAnalysis; NS_ASSUME_NONNULL_BEGIN @@ -62,6 +61,7 @@ NS_ASSUME_NONNULL_BEGIN - (OASGpxDataItem *_Nullable)getGPXItem:(NSString *)filePath; - (BOOL)updateDataItem:(OASGpxDataItem *_Nonnull)item; +- (BOOL)renameCurrentFile:(OASKFile *)currentFile newFile:(OASKFile *)newFile; - (NSArray *)getDataItems; - (OASGpxDataItem *)getGPXItemByFileName:(NSString *)fileName; - (NSString *)getFileDir:(NSString *)filePath; diff --git a/Sources/GPX/OAGPXDatabase.mm b/Sources/GPX/OAGPXDatabase.mm index 90d4ccda41..b22326afa7 100644 --- a/Sources/GPX/OAGPXDatabase.mm +++ b/Sources/GPX/OAGPXDatabase.mm @@ -225,6 +225,33 @@ - (BOOL)updateDataItem:(OASGpxDataItem *)item return [[OASGpxDbHelper shared] updateDataItemItem:item]; } +- (BOOL)renameCurrentFile:(OASKFile *)currentFile newFile:(OASKFile *)newFile +{ + BOOL success = [[OASGpxDbHelper shared] renameCurrentFile:currentFile newFile:newFile]; + if (!success) + return NO; + + NSString *currentPath = currentFile.absolutePath; + NSString *newPath = newFile.absolutePath; + NSString *currentPathKey = currentPath.precomposedStringWithCanonicalMapping; + NSString *newPathKey = newPath.precomposedStringWithCanonicalMapping; + NSMutableArray *itemsToRemove = [NSMutableArray array]; + for (OASGpxDataItem *item in [[OASGpxDbHelper shared] getItems]) + { + NSString *itemPath = item.file.absolutePath; + NSString *itemPathKey = itemPath.precomposedStringWithCanonicalMapping; + BOOL isOldRenamedItem = [itemPathKey isEqualToString:currentPathKey] && ![item.file exists]; + BOOL isDuplicateNewItem = [itemPathKey isEqualToString:newPathKey] && ![itemPath isEqualToString:newPath]; + if (isOldRenamedItem || isDuplicateNewItem) + [itemsToRemove addObject:item]; + } + + for (OASGpxDataItem *item in itemsToRemove) + [[OASGpxDbHelper shared] removeItem:item]; + + return YES; +} + - (NSArray *)getDataItems { return [[OASGpxDbHelper shared] getItems]; diff --git a/Sources/Helpers/OAGPXUIHelper.mm b/Sources/Helpers/OAGPXUIHelper.mm index 66ff644eed..60b55384ef 100644 --- a/Sources/Helpers/OAGPXUIHelper.mm +++ b/Sources/Helpers/OAGPXUIHelper.mm @@ -578,7 +578,7 @@ - (void)copyGPXToNewFolder:(NSString *)newFolderName BOOL result = [trackItem.dataItem.file renameToToFile:newFile]; if (result) { - BOOL renameCurrentFileResult = [[OASGpxDbHelper shared] renameCurrentFile:trackItem.dataItem.file newFile:newFile]; + BOOL renameCurrentFileResult = [gpxDatabase renameCurrentFile:trackItem.dataItem.file newFile:newFile]; if (renameCurrentFileResult) { OASGpxDataItem *gpx = [[OAGPXDatabase sharedDb] getGPXItem:newStoringFullPath]; @@ -677,7 +677,7 @@ - (void)renameTrack:(OASGpxDataItem *)gpx NSLog(@"[ERROR] -> OAGPXUIHelper -> renameToFileResult is fail"); return; } - BOOL renameCurrentFileResult = [[OASGpxDbHelper shared] renameCurrentFile:gpx.file newFile:newFile]; + BOOL renameCurrentFileResult = [[OAGPXDatabase sharedDb] renameCurrentFile:gpx.file newFile:newFile]; if (!renameCurrentFileResult) { NSLog(@"[ERROR] -> OAGPXUIHelper -> renameCurrentFileResult is fail"); From d9c40be2a1a7af4bf0acd27d40ec10898c911033 Mon Sep 17 00:00:00 2001 From: Vladyslav Lysenko Date: Tue, 14 Jul 2026 17:50:35 +0300 Subject: [PATCH 4/7] Update OASelectedGPXHelper.mm --- Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm index 76fe81988a..0b63a127b7 100644 --- a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm +++ b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm @@ -233,7 +233,7 @@ + (void)renameVisibleTrack:(NSString *)oldPath newPath:(NSString *)newPath break; } } - + [settings.mapSettingVisibleGpx set:[NSArray arrayWithArray:visibleGpx]]; } From b65b5af988870f203829f2bb1021519c8d5e7f90 Mon Sep 17 00:00:00 2001 From: Vladyslav Lysenko Date: Tue, 14 Jul 2026 19:00:33 +0300 Subject: [PATCH 5/7] duplicated track after folder renaming fixed --- Sources/Controllers/MyPlaces/TracksViewController.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/Controllers/MyPlaces/TracksViewController.swift b/Sources/Controllers/MyPlaces/TracksViewController.swift index ea19a2de41..c59066d502 100644 --- a/Sources/Controllers/MyPlaces/TracksViewController.swift +++ b/Sources/Controllers/MyPlaces/TracksViewController.swift @@ -1938,21 +1938,22 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda } private func renameFolder(newName: String, oldName: String) { + let normalizedNewName = newName.decomposedStringWithCanonicalMapping if let smartFolder = smartFolderHelper.getSmartFolder(name: oldName) { let oldSmartFolderId = smartFolder.getId() - smartFolderHelper.renameSmartFolder(smartFolder: smartFolder, newName: newName) + smartFolderHelper.renameSmartFolder(smartFolder: smartFolder, newName: normalizedNewName) renameSortModeKey(from: oldSmartFolderId, to: smartFolder.getId()) updateData() } guard let trackFolder = getTrackFolderByPath(oldName) else { return } let oldFolderPath = currentFolderAbsolutePath().appendingPathComponent(oldName) - let newFolderPath = currentFolderAbsolutePath().appendingPathComponent(newName) + let newFolderPath = currentFolderAbsolutePath().appendingPathComponent(normalizedNewName) if !FileManager.default.fileExists(atPath: newFolderPath) { let oldDir = KFile(filePath: oldFolderPath) if let parentFile = oldDir.getParentFile() { - let newDir = KFile(file: parentFile, fileName: newName) + let newDir = KFile(file: parentFile, fileName: normalizedNewName) if oldDir.renameTo(toFile: newDir) { trackFolder.setDirFile(dirFile: newDir) trackFolder.resetCachedData() From c057b73898cab15e0dd4f318d5432b24963594cc Mon Sep 17 00:00:00 2001 From: Dmitry Svetlichny Date: Fri, 24 Jul 2026 15:12:54 +0300 Subject: [PATCH 6/7] showGpx hideGpx fixed --- .../Map/Helpers/OASelectedGPXHelper.mm | 4 +- .../MyPlaces/TracksViewController.swift | 6 +- Sources/Helpers/OAAppSettings.h | 1 - Sources/Helpers/OAAppSettings.m | 58 ++++++++----------- 4 files changed, 30 insertions(+), 39 deletions(-) diff --git a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm index 0b63a127b7..f486bcf3c4 100644 --- a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm +++ b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm @@ -226,10 +226,10 @@ + (void)renameVisibleTrack:(NSString *)oldPath newPath:(NSString *)newPath NSMutableArray *visibleGpx = [NSMutableArray arrayWithArray:settings.mapSettingVisibleGpx.get]; for (NSString *gpx in [settings.mapSettingVisibleGpx get]) { - if ([gpx isEqualToString:oldPath]) + if ([gpx compare:oldPath] == NSOrderedSame) { [visibleGpx removeObject:gpx]; - [visibleGpx addObject:newPath]; + [visibleGpx addObject:newPath.decomposedStringWithCanonicalMapping]; break; } } diff --git a/Sources/Controllers/MyPlaces/TracksViewController.swift b/Sources/Controllers/MyPlaces/TracksViewController.swift index 8161d37b93..47df5ba47a 100644 --- a/Sources/Controllers/MyPlaces/TracksViewController.swift +++ b/Sources/Controllers/MyPlaces/TracksViewController.swift @@ -1920,7 +1920,11 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda } private func updateRenamedGpx(src: KFile, dest: KFile) { - gpxDB.renameCurrentFile(src, newFile: dest) + guard gpxDB.renameCurrentFile(src, newFile: dest) else { + NSLog("updateRenamedGpx -> renameCurrentFile failed") + return + } + handleDeletedGpxFile(gpxFile: src) let trackItem = TrackItem(file: dest) trackItem.dataItem = OAGPXDatabase.sharedDb().getGPXItem(dest.path()) diff --git a/Sources/Helpers/OAAppSettings.h b/Sources/Helpers/OAAppSettings.h index 6e116304d3..3031de3e47 100644 --- a/Sources/Helpers/OAAppSettings.h +++ b/Sources/Helpers/OAAppSettings.h @@ -1323,7 +1323,6 @@ typedef NS_ENUM(NSInteger, EOAWikiDataSourceType) - (void) showGpx:(NSArray *)filePaths; - (void) showGpx:(NSArray *)filePaths update:(BOOL)update; -- (void) updateGpx:(NSArray *)filePaths; - (void) hideGpx:(NSArray *)filePaths; - (void) hideGpx:(NSArray *)filePaths update:(BOOL)update; - (void) hideRemovedGpx; diff --git a/Sources/Helpers/OAAppSettings.m b/Sources/Helpers/OAAppSettings.m index 2674e2fcfb..ca58c1837e 100644 --- a/Sources/Helpers/OAAppSettings.m +++ b/Sources/Helpers/OAAppSettings.m @@ -7493,9 +7493,18 @@ - (void) showGpx:(NSArray *)filePaths update:(BOOL)update NSMutableArray *arr = [NSMutableArray arrayWithArray:_mapSettingVisibleGpx.get]; for (NSString *filePath in filePaths) { - if (![arr containsObject:filePath]) + BOOL containsPath = NO; + for (NSString *visiblePath in arr) { - [arr addObject:filePath]; + if ([visiblePath compare:filePath] == NSOrderedSame) + { + containsPath = YES; + break; + } + } + if (!containsPath) + { + [arr addObject:filePath.decomposedStringWithCanonicalMapping]; added = YES; } } @@ -7515,35 +7524,6 @@ - (void) showGpx:(NSArray *)filePaths [self showGpx:filePaths update:YES]; } -- (void) updateGpx:(NSArray *)filePaths -{ - BOOL added = NO; - BOOL removed = NO; - NSMutableArray *arr = [NSMutableArray arrayWithArray:_mapSettingVisibleGpx.get]; - for (NSString *filePath in filePaths) - { - if (![arr containsObject:filePath]) - { - added = YES; - break; - } - } - for (NSString *visible in arr) - { - if (![filePaths containsObject:visible]) - { - removed = YES; - break; - } - } - - if (added || removed) - { - [self.mapSettingVisibleGpx set:[NSMutableArray arrayWithArray:filePaths]]; - [[[OsmAndApp instance] updateGpxTracksOnMapObservable] notifyEvent]; - } -} - - (void) hideGpx:(NSArray *)filePaths { [self hideGpx:filePaths update:YES]; @@ -7556,10 +7536,13 @@ - (void) hideGpx:(NSArray *)filePaths update:(BOOL)update NSMutableArray *arrToDelete = [NSMutableArray array]; for (NSString *filePath in filePaths) { - if ([arr containsObject:filePath]) + for (NSString *visiblePath in arr) { - [arrToDelete addObject:filePath]; - removed = YES; + if ([visiblePath compare:filePath] == NSOrderedSame) + { + [arrToDelete addObject:visiblePath]; + removed = YES; + } } } [arr removeObjectsInArray:arrToDelete]; @@ -7572,7 +7555,12 @@ - (void) hideGpx:(NSArray *)filePaths update:(BOOL)update - (void) hideRemovedGpx { OsmAndAppInstance app = [OsmAndApp instance]; - NSMutableArray *arr = [NSMutableArray arrayWithArray:_mapSettingVisibleGpx.get]; + NSMutableOrderedSet *visiblePaths = [NSMutableOrderedSet orderedSet]; + for (NSString *path in _mapSettingVisibleGpx.get) + { + [visiblePaths addObject:path.decomposedStringWithCanonicalMapping]; + } + NSMutableArray *arr = [NSMutableArray arrayWithArray:visiblePaths.array]; NSMutableArray *arrToDelete = [NSMutableArray array]; for (NSString *filepath in arr) { From 777d7fe36ebee61381fb3217ebace06d762282c4 Mon Sep 17 00:00:00 2001 From: Dmitry Svetlichny Date: Mon, 27 Jul 2026 15:11:07 +0300 Subject: [PATCH 7/7] Add isGpxVisible --- .../MapSettingsGpxViewController.swift | 13 ++++++------- .../Map/Helpers/OASelectedGPXHelper.mm | 8 ++++---- Sources/Controllers/Map/OAMapViewController.mm | 6 +++--- .../MyPlaces/TracksViewController.swift | 18 +++++++++--------- .../OARoutePlanningHudViewController.mm | 2 +- .../Search/OAQuickSearchTableController.mm | 2 +- Sources/Helpers/OAAppSettings.h | 1 + Sources/Helpers/OAAppSettings.m | 11 +++++++++++ Sources/Helpers/OAGPXUIHelper.mm | 2 +- Sources/Helpers/OAOsmAndContextImpl.mm | 2 +- 10 files changed, 38 insertions(+), 27 deletions(-) diff --git a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift index b89c0d7037..b51d85caed 100644 --- a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift +++ b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift @@ -207,7 +207,6 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { noVisibleTracksRow.iconTintColor = UIColor.iconColorDefault noVisibleTracksRow.setObj(localizedString("show_all_tracks"), forKey: "buttonTitle") } else { - let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() ?? [] let gpxListToShow = isSearchActive ? filteredGpxList : (isShowingVisibleTracks ? visibleGpxList : allGpxList) for gpx in gpxListToShow { let gpxRow = tracksSection.createNewRow() @@ -215,7 +214,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { gpxRow.title = gpx.gpxFileNameWithoutExtension gpxRow.setObj(gpx, forKey: "gpx") gpxRow.iconName = "ic_custom_trip" - gpxRow.iconTintColor = visibleGpxFilePaths.contains(gpx.gpxFilePath) ? .iconColorActive : .iconColorDisabled + gpxRow.iconTintColor = settings?.isGpxVisible(gpx.gpxFilePath) == true ? .iconColorActive : .iconColorDisabled } } if isShowingVisibleTracks && !recentlyVisibleGpxList.isEmpty && !isSearchActive { @@ -581,7 +580,7 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { alert.addAction(UIAlertAction(title: localizedString("shared_string_yes"), style: .default) { [weak self] _ in guard let self else { return } guard let dataItem = track.dataItem else { return } - let isVisible = settings?.mapSettingVisibleGpx.contains(track.gpxFilePath) ?? false + let isVisible = settings?.isGpxVisible(track.gpxFilePath) ?? false if isVisible { settings?.hideGpx([track.gpxFilePath]) } @@ -625,8 +624,8 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { } private func loadVisibleTracks() { - guard let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() else { return } - visibleGpxList = allGpxList.filter { visibleGpxFilePaths.contains($0.gpxFilePath) } + guard let settings else { return } + visibleGpxList = allGpxList.filter { settings.isGpxVisible($0.gpxFilePath) } isVisibleTracksAvailable = !visibleGpxList.isEmpty selectedGpxTracks = visibleGpxList } @@ -638,10 +637,10 @@ final class MapSettingsGpxViewController: OABaseNavbarSubviewViewController { return } - guard let visibleGpxFilePaths = settings?.mapSettingVisibleGpx.get() else { return } + guard let settings else { return } let previouslyHiddenTrackPaths = UserDefaults.standard.stringArray(forKey: previouslyVisibleTracksKey) ?? [] let recentlyVisibleTracks = allGpxList.filter { - previouslyHiddenTrackPaths.contains($0.gpxFilePath) && !visibleGpxFilePaths.contains($0.gpxFilePath) + previouslyHiddenTrackPaths.contains($0.gpxFilePath) && !settings.isGpxVisible($0.gpxFilePath) } recentlyVisibleGpxList = recentlyVisibleTracks diff --git a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm index f486bcf3c4..60ca4bc810 100644 --- a/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm +++ b/Sources/Controllers/Map/Helpers/OASelectedGPXHelper.mm @@ -98,7 +98,7 @@ - (BOOL)buildGpxList if (_loadingGPXPaths.count > 0) { - [self removeInactiveGpxFiles:mapSettingVisibleGpx]; + [self removeInactiveGpxFiles]; return YES; } @@ -131,12 +131,12 @@ - (BOOL)buildGpxList if (gpxLoadOperations.count > 0) [_operationQueue addOperations:gpxLoadOperations waitUntilFinished:NO]; - [self removeInactiveGpxFiles:mapSettingVisibleGpx]; + [self removeInactiveGpxFiles]; return _loadingGPXPaths.count > 0; } -- (void)removeInactiveGpxFiles:(NSSet *)mapSettingVisibleGpx +- (void)removeInactiveGpxFiles { NSMutableArray *keysToRemove = [NSMutableArray array]; @@ -144,7 +144,7 @@ - (void)removeInactiveGpxFiles:(NSSet *)mapSettingVisibleGpx { NSString *gpxFilePath = [OAUtilities getGpxShortPath:key]; - if (![mapSettingVisibleGpx containsObject:gpxFilePath]) + if (![_settings isGpxVisible:gpxFilePath]) [keysToRemove addObject:key]; } diff --git a/Sources/Controllers/Map/OAMapViewController.mm b/Sources/Controllers/Map/OAMapViewController.mm index 186b04806f..e12508c3ae 100644 --- a/Sources/Controllers/Map/OAMapViewController.mm +++ b/Sources/Controllers/Map/OAMapViewController.mm @@ -3241,7 +3241,7 @@ - (void) showTempGpxTrack:(NSString *)filePath update:(BOOL)update [self hideRecGpxTrack]; OAAppSettings *settings = [OAAppSettings sharedManager]; - if ([settings.mapSettingVisibleGpx.get containsObject:filePath]) + if ([settings isGpxVisible:filePath]) { [self runWithRenderSync:^{ [_gpxFilesTemp removeAllObjects]; @@ -3291,7 +3291,7 @@ - (void) showTempGpxTrackFromGpxFile:(OASGpxFile *)doc NSString *filePath = doc.path; OAAppSettings *settings = [OAAppSettings sharedManager]; - if ([settings.mapSettingVisibleGpx.get containsObject:filePath]) + if ([settings isGpxVisible:filePath]) { [self runWithRenderSync:^{ [_gpxFilesTemp removeAllObjects]; @@ -3410,7 +3410,7 @@ - (void) keepTempGpxTrackVisible OASGpxDataItem *gpx = [[OAGPXDatabase sharedDb] getGPXItem:tempGpxFilePath]; NSString *path = gpx.file.absolutePath; - if (![[OAAppSettings sharedManager].mapSettingVisibleGpx.get containsObject:tempGpxFilePath]) + if (![[OAAppSettings sharedManager] isGpxVisible:tempGpxFilePath]) { [_selectedGpxHelper addGpxFile:tempGpxFile for:path]; diff --git a/Sources/Controllers/MyPlaces/TracksViewController.swift b/Sources/Controllers/MyPlaces/TracksViewController.swift index 47df5ba47a..545f99482b 100644 --- a/Sources/Controllers/MyPlaces/TracksViewController.swift +++ b/Sources/Controllers/MyPlaces/TracksViewController.swift @@ -571,7 +571,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda trackRow.setObj(track.gpxFilePath as Any, forKey: pathKey) trackRow.setObj(fileName, forKey: fileNameKey) trackRow.iconName = "ic_custom_trip" - let isVisible = settings.mapSettingVisibleGpx.contains(track.gpxFilePath) + let isVisible = settings.isGpxVisible(track.gpxFilePath) trackRow.setObj(isVisible, forKey: isVisibleKey) trackRow.setObj(trackIconColor(for: track, isVisible: isVisible), forKey: colorKey) trackRow.setObj(TracksSortModeHelper.getTrackDescription(track: track, sortMode: isSearchActive || isSelectionModeInSearch ? sortModeForSearch : sortMode, includeFolderInfo: shouldShowFolderInfo), forKey: trackSortDescrKey) @@ -1198,15 +1198,15 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda if hasSelectedItems() { var tracksToShow: [String] = [] tracksToShow.append(contentsOf: selectedTracks.compactMap { - settings.mapSettingVisibleGpx.contains($0.gpxFilePath) ? nil : $0.gpxFilePath + settings.isGpxVisible($0.gpxFilePath) ? nil : $0.gpxFilePath }) for folderName in selectedFolders { if let folder = currentFolder.getSubFolders().first(where: { $0.getName() == folderName }) { - let folderTracksToShow = folder.getFlattenedTrackItems().compactMap { settings.mapSettingVisibleGpx.contains($0.gpxFilePath) ? nil : $0.gpxFilePath } + let folderTracksToShow = folder.getFlattenedTrackItems().compactMap { settings.isGpxVisible($0.gpxFilePath) ? nil : $0.gpxFilePath } tracksToShow.append(contentsOf: folderTracksToShow) } else if let smartFolder = smartFolderHelper.getSmartFolder(name: folderName) { - let folderTracksToShow = smartFolder.getTrackItems().compactMap { settings.mapSettingVisibleGpx.contains($0.gpxFilePath) ? nil : $0.gpxFilePath } + let folderTracksToShow = smartFolder.getTrackItems().compactMap { settings.isGpxVisible($0.gpxFilePath) ? nil : $0.gpxFilePath } tracksToShow.append(contentsOf: folderTracksToShow) } } @@ -1339,7 +1339,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda } for track in self.selectedTracks { - let isVisible = self.settings.mapSettingVisibleGpx.contains(track.gpxFilePath) + let isVisible = self.settings.isGpxVisible(track.gpxFilePath) if isVisible { self.settings.hideGpx([track.gpxFilePath]) } @@ -1751,7 +1751,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda updateData() } else { guard let dataItem = trackItem.dataItem else { return } - let isVisible = settings.mapSettingVisibleGpx.contains(trackItem.gpxFilePath) + let isVisible = settings.isGpxVisible(trackItem.gpxFilePath) if isVisible { settings.hideGpx([trackItem.gpxFilePath]) } @@ -1995,7 +1995,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda gpxDB.removeGpxItem($0, withLocalRemove: false) handleDeletedGpxFile(gpxFile: $0.file) let gpxFilePath = $0.gpxFilePath - let isVisible = settings.mapSettingVisibleGpx.contains(gpxFilePath) + let isVisible = settings.isGpxVisible(gpxFilePath) if isVisible { settings.hideGpx([gpxFilePath]) } @@ -2034,7 +2034,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda let newPathCount = oldPath.count let oldPathString = visibleGpx[i] let modifiedString = newPath + oldPathString.dropFirst(newPathCount) - visibleGpx[i] = modifiedString + visibleGpx[i] = modifiedString.decomposedStringWithCanonicalMapping } settings.mapSettingVisibleGpx.set(visibleGpx) } @@ -2514,7 +2514,7 @@ final class TracksViewController: UITableViewController, OATrackSavingHelperUpda guard let self else { return nil } let showOnMapAction = UIAction(title: localizedString("show_all_tracks_on_the_map"), image: .icCustomMapPinOutlined) { [weak self] _ in guard let self else { return } - let tracksToShow = group.getTrackItems().compactMap { $0.gpxFilePath }.filter { !self.settings.mapSettingVisibleGpx.contains($0) } + let tracksToShow = group.getTrackItems().compactMap { $0.gpxFilePath }.filter { !self.settings.isGpxVisible($0) } if !tracksToShow.isEmpty { self.settings.showGpx(tracksToShow, update: true) } diff --git a/Sources/Controllers/RoutePlanning/OARoutePlanningHudViewController.mm b/Sources/Controllers/RoutePlanning/OARoutePlanningHudViewController.mm index 07ccdb8fd2..5fa26acab7 100644 --- a/Sources/Controllers/RoutePlanning/OARoutePlanningHudViewController.mm +++ b/Sources/Controllers/RoutePlanning/OARoutePlanningHudViewController.mm @@ -1226,7 +1226,7 @@ - (void) onGpxSaved:(OASGpxFile *)savedGpxFile outFile:(NSString *)outFile final } OASelectedGPXHelper *helper = OASelectedGPXHelper.instance; NSString *gpxFilePath = [OAUtilities getGpxShortPath:outFile]; - if (gpxFilePath && [_settings.mapSettingVisibleGpx.get containsObject:gpxFilePath]) + if (gpxFilePath && [_settings isGpxVisible:gpxFilePath]) { // Refresh track if visible [_settings hideGpx:@[gpxFilePath] update:YES]; diff --git a/Sources/Controllers/TargetMenu/Search/OAQuickSearchTableController.mm b/Sources/Controllers/TargetMenu/Search/OAQuickSearchTableController.mm index ac464c9dbd..23f8931a11 100644 --- a/Sources/Controllers/TargetMenu/Search/OAQuickSearchTableController.mm +++ b/Sources/Controllers/TargetMenu/Search/OAQuickSearchTableController.mm @@ -682,7 +682,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } cell.descriptionLabel.text = nil; cell.descriptionLabel.attributedText = [TracksSortModeHelper getTrackDescriptionWithTrack:dataItem sortMode:TracksSortModeLastModified includeFolderInfo:YES]; - BOOL isVisible = [[OAAppSettings sharedManager].mapSettingVisibleGpx.get containsObject:dataItem.gpxFilePath]; + BOOL isVisible = [[OAAppSettings sharedManager] isGpxVisible:dataItem.gpxFilePath]; cell.leftIconView.tintColor = [UIColor colorNamed:isVisible ? ACColorNameIconColorActive : ACColorNameIconColorDefault]; return cell; } diff --git a/Sources/Helpers/OAAppSettings.h b/Sources/Helpers/OAAppSettings.h index 3031de3e47..2f650b28e5 100644 --- a/Sources/Helpers/OAAppSettings.h +++ b/Sources/Helpers/OAAppSettings.h @@ -1321,6 +1321,7 @@ typedef NS_ENUM(NSInteger, EOAWikiDataSourceType) - (BOOL) removeImpassableRoad:(CLLocation *)location; - (void) clearImpassableRoads; +- (BOOL)isGpxVisible:(NSString *)filePath; - (void) showGpx:(NSArray *)filePaths; - (void) showGpx:(NSArray *)filePaths update:(BOOL)update; - (void) hideGpx:(NSArray *)filePaths; diff --git a/Sources/Helpers/OAAppSettings.m b/Sources/Helpers/OAAppSettings.m index ca58c1837e..0f57bb110d 100644 --- a/Sources/Helpers/OAAppSettings.m +++ b/Sources/Helpers/OAAppSettings.m @@ -7487,6 +7487,17 @@ - (void)setApplicationModePref:(OAApplicationMode *)applicationMode markAsLastUs } } +- (BOOL)isGpxVisible:(NSString *)filePath +{ + for (NSString *visiblePath in _mapSettingVisibleGpx.get) + { + if ([visiblePath compare:filePath] == NSOrderedSame) + return YES; + } + + return NO; +} + - (void) showGpx:(NSArray *)filePaths update:(BOOL)update { BOOL added = NO; diff --git a/Sources/Helpers/OAGPXUIHelper.mm b/Sources/Helpers/OAGPXUIHelper.mm index a4fd65817a..95a53de73e 100644 --- a/Sources/Helpers/OAGPXUIHelper.mm +++ b/Sources/Helpers/OAGPXUIHelper.mm @@ -627,7 +627,7 @@ - (void)copyGPXToNewFolder:(NSString *)newFolderName } } - if ([OAAppSettings.sharedManager.mapSettingVisibleGpx.get containsObject:oldPath]) + if ([OAAppSettings.sharedManager isGpxVisible:oldPath]) [OAAppSettings.sharedManager showGpx:@[newStoringPath]]; } if (openTrack) diff --git a/Sources/Helpers/OAOsmAndContextImpl.mm b/Sources/Helpers/OAOsmAndContextImpl.mm index 6f7fe3c35c..10f8ce3359 100644 --- a/Sources/Helpers/OAOsmAndContextImpl.mm +++ b/Sources/Helpers/OAOsmAndContextImpl.mm @@ -333,7 +333,7 @@ - (OASAltitudeMetrics * _Nullable)getAltitudeMetric __attribute__((swift_name("g - (BOOL)isGpxFileVisiblePath:(NSString *)path __attribute__((swift_name("isGpxFileVisible(path:)"))) { NSString *gpxFilePath = [OAUtilities getGpxShortPath:path]; - return [OAAppSettings.sharedManager.mapSettingVisibleGpx.get containsObject:gpxFilePath]; + return [OAAppSettings.sharedManager isGpxVisible:gpxFilePath]; } - (OASGpxFile *)getSelectedFileByPathPath:(NSString *)path