diff --git a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift index c6836db569..0a653cee26 100644 --- a/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift +++ b/Sources/Controllers/DashboardOnMap/MapSettings/MapSettingsGpxViewController.swift @@ -1130,6 +1130,7 @@ extension MapSettingsGpxViewController: OASelectTrackFolderDelegate { if let newFolderPath = app?.gpxPath.appendingPathComponent(addedFolderName), !FileManager.default.fileExists(atPath: newFolderPath) { do { try FileManager.default.createDirectory(atPath: newFolderPath, withIntermediateDirectories: true) + onFolderSelected(addedFolderName) updateData() delegate?.onVisibleTracksUpdate() } catch let error { diff --git a/Sources/Controllers/MyPlaces/TracksViewController.swift b/Sources/Controllers/MyPlaces/TracksViewController.swift index badb7adfaa..b252718141 100644 --- a/Sources/Controllers/MyPlaces/TracksViewController.swift +++ b/Sources/Controllers/MyPlaces/TracksViewController.swift @@ -118,8 +118,8 @@ final class TracksViewController: OACompoundViewController, UITableViewDelegate, } private func onLoadFinished(folder: TrackFolder) { - self.rootFolder = folder - self.currentFolder = getTrackFolderByPath(currentFolderPath) ?? rootFolder + rootFolder = folder + currentFolder = getTrackFolderByPath(currentFolderPath) ?? rootFolder onRefreshEnd() updateNavigationBarTitle() generateData() @@ -1717,7 +1717,7 @@ final class TracksViewController: OACompoundViewController, UITableViewDelegate, if !FileManager.default.fileExists(atPath: newFolderPath) { do { try FileManager.default.createDirectory(atPath: newFolderPath, withIntermediateDirectories: true) - updateAllFoldersVCData(forceLoad: true) + onFolderSelected(addedFolderName) } catch let error { debugPrint(error) } diff --git a/Sources/Controllers/RoutePlanning/OASelectTrackFolderViewController.m b/Sources/Controllers/RoutePlanning/OASelectTrackFolderViewController.m index 485b8c827e..c3dbdeb145 100644 --- a/Sources/Controllers/RoutePlanning/OASelectTrackFolderViewController.m +++ b/Sources/Controllers/RoutePlanning/OASelectTrackFolderViewController.m @@ -256,14 +256,11 @@ - (void)onRowSelected:(NSIndexPath *)indexPath #pragma mark - OAAddTrackFolderDelegate -- (void)onTrackFolderAdded:(NSString *)folderName +- (void)onTrackFolderAdded:(NSString *)folderName { - dispatch_async(dispatch_get_main_queue(), ^{ - UIViewController *controllerToDismiss = self.presentingViewController ?: self; - [controllerToDismiss dismissViewControllerAnimated:YES completion:^{ - [_delegate onFolderAdded:folderName]; - }]; - }); + [_delegate onFolderAdded:folderName]; + UIViewController *controllerToDismiss = self.presentingViewController ?: self; + [controllerToDismiss dismissViewControllerAnimated:YES completion:nil]; } #pragma mark - OASTrackFolderLoaderTaskLoadTracksListener