[ios] implement support for the icloud sync and bookmarks reloading for CoreApi

Add methods:
- hasBookmark
- hasTrack
- hasCategory
- reloadCategoryAtFilePath
- deleteCategoryAtFilePath
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn 2024-05-15 19:54:14 +04:00 committed by Roman Tsisyk
parent 7b2ca3a65d
commit d0ec7bf149
2 changed files with 26 additions and 0 deletions

View file

@ -36,6 +36,8 @@ NS_SWIFT_NAME(BookmarksManager)
- (BOOL)areBookmarksLoaded;
- (void)loadBookmarks;
- (void)reloadCategoryAtFilePath:(NSString *)filePath;
- (void)deleteCategoryAtFilePath:(NSString *)filePath;
- (BOOL)areAllCategoriesEmpty;
- (BOOL)isCategoryEmpty:(MWMMarkGroupID)groupId;
@ -61,7 +63,9 @@ NS_SWIFT_NAME(BookmarksManager)
- (void)setUserCategoriesVisible:(BOOL)isVisible;
- (void)deleteCategory:(MWMMarkGroupID)groupId;
- (BOOL)checkCategoryName:(NSString *)name;
- (BOOL)hasCategory:(MWMMarkGroupID)groupId;
- (BOOL)hasBookmark:(MWMMarkID)bookmarkId;
- (BOOL)hasTrack:(MWMTrackID)trackId;
- (NSArray<NSNumber *> *)availableSortingTypes:(MWMMarkGroupID)groupId hasMyPosition:(BOOL)hasMyPosition;
- (void)sortBookmarks:(MWMMarkGroupID)groupId
sortingType:(MWMBookmarksSortingType)sortingType

View file

@ -203,6 +203,18 @@ static KmlFileType convertFileTypeToCore(MWMKmlFileType fileType) {
self.bm.LoadBookmarks();
}
- (void)reloadCategoryAtFilePath:(NSString *)filePath
{
self.bm.ReloadBookmark(filePath.UTF8String);
}
- (void)deleteCategoryAtFilePath:(NSString *)filePath
{
auto const groupId = self.bm.GetCategoryByFileName(filePath.UTF8String);
if (groupId)
[self deleteCategory:groupId];
}
#pragma mark - Categories
- (BOOL)areAllCategoriesEmpty
@ -350,11 +362,21 @@ static KmlFileType convertFileTypeToCore(MWMKmlFileType fileType) {
return !self.bm.IsUsedCategoryName(name.UTF8String);
}
- (BOOL)hasCategory:(MWMMarkGroupID)groupId
{
return self.bm.HasBmCategory(groupId);
}
- (BOOL)hasBookmark:(MWMMarkID)bookmarkId
{
return self.bm.HasBookmark(bookmarkId);
}
- (BOOL)hasTrack:(MWMTrackID)trackId
{
return self.bm.HasTrack(trackId);
}
- (NSArray<NSNumber *> *)availableSortingTypes:(MWMMarkGroupID)groupId hasMyPosition:(BOOL)hasMyPosition{
auto const availableTypes = self.bm.GetAvailableSortingTypes(groupId, hasMyPosition);
NSMutableArray *result = [NSMutableArray array];