diff --git a/android/res/values-ar/strings.xml b/android/res/values-ar/strings.xml
index dcb1e8f3b1..79298f8c0d 100644
--- a/android/res/values-ar/strings.xml
+++ b/android/res/values-ar/strings.xml
@@ -818,6 +818,8 @@
تحديث (%s)
تحديث يدوياً في وقت لاحق
+
+ مسار
محطة تلفريك
diff --git a/android/res/values-cs/strings.xml b/android/res/values-cs/strings.xml
index 50c89065cc..f06bfc6a51 100644
--- a/android/res/values-cs/strings.xml
+++ b/android/res/values-cs/strings.xml
@@ -818,6 +818,8 @@
Aktualizace (%s)
Aktualizovat ručně později
+
+ Dráha
Stanice lanové dráhy
diff --git a/android/res/values-da/strings.xml b/android/res/values-da/strings.xml
index 9af0ab60f8..ed947329c1 100644
--- a/android/res/values-da/strings.xml
+++ b/android/res/values-da/strings.xml
@@ -819,6 +819,8 @@
Opdater (%s)
Opdater manuelt senere
+
+ Rute
Kabelbanestation
diff --git a/android/res/values-de/strings.xml b/android/res/values-de/strings.xml
index 097c19df48..bd89f2c658 100644
--- a/android/res/values-de/strings.xml
+++ b/android/res/values-de/strings.xml
@@ -821,6 +821,8 @@
Aktualisieren (%s)
Später manuell aktualisieren
+
+ Strecken
Seilbahn
diff --git a/android/res/values-el/strings.xml b/android/res/values-el/strings.xml
index 91b35d32bd..23b260e346 100644
--- a/android/res/values-el/strings.xml
+++ b/android/res/values-el/strings.xml
@@ -809,6 +809,8 @@
Ενημέρωση (%s)
Χειροκίνητη ενημέρωση αργότερα
+
+ Τροχιά
Σταθμός αερομεταφοράς
diff --git a/android/res/values-es/strings.xml b/android/res/values-es/strings.xml
index d66279c21c..85184b224a 100644
--- a/android/res/values-es/strings.xml
+++ b/android/res/values-es/strings.xml
@@ -815,6 +815,8 @@
Actualizar (%s)
Actualizar más tarde de forma manual
+
+ Ruta
Estación de teleférico
diff --git a/android/res/values-fa/strings.xml b/android/res/values-fa/strings.xml
index ab784dfc59..ae19ab7d0d 100644
--- a/android/res/values-fa/strings.xml
+++ b/android/res/values-fa/strings.xml
@@ -810,6 +810,8 @@
بروزرسانی (%s)
بعدا به صورت دستی به روزرسانی کنید
+
+ مسیر
فرودگاه
diff --git a/android/res/values-fi/strings.xml b/android/res/values-fi/strings.xml
index 3d9fa16c86..b502267da9 100644
--- a/android/res/values-fi/strings.xml
+++ b/android/res/values-fi/strings.xml
@@ -819,6 +819,8 @@
Päivitä (%s)
Päivitä manuaalisesti myöhemmin
+
+ Reitti
Köysirata-asema
diff --git a/android/res/values-fr/strings.xml b/android/res/values-fr/strings.xml
index e4df5c9423..fa423be8d0 100644
--- a/android/res/values-fr/strings.xml
+++ b/android/res/values-fr/strings.xml
@@ -827,6 +827,8 @@
Mettre à jour (%s)
Mettre à jour manuellement plus tard
+
+ Route
Remontées mécaniques
diff --git a/android/res/values-hu/strings.xml b/android/res/values-hu/strings.xml
index 9585786114..424c27bda9 100644
--- a/android/res/values-hu/strings.xml
+++ b/android/res/values-hu/strings.xml
@@ -816,6 +816,8 @@
Frissítés (%s)
Kézi frissítés később
+
+ Útvonal
Felvonóállomás
diff --git a/android/res/values-in/strings.xml b/android/res/values-in/strings.xml
index c30e81731a..f1f952e848 100644
--- a/android/res/values-in/strings.xml
+++ b/android/res/values-in/strings.xml
@@ -819,6 +819,8 @@
Pembaruan (%s)
Perbarui secara manual nanti
+
+ Trek
Stasiun kereta gantung
diff --git a/android/res/values-it/strings.xml b/android/res/values-it/strings.xml
index 468bc065a8..dab2e327b2 100644
--- a/android/res/values-it/strings.xml
+++ b/android/res/values-it/strings.xml
@@ -815,6 +815,8 @@
Aggiorna (%s)
Aggiorna manualmente più tardi
+
+ Traccia
Funivia
diff --git a/android/res/values-ja/strings.xml b/android/res/values-ja/strings.xml
index a1c16c0ec7..b6fed2bb85 100644
--- a/android/res/values-ja/strings.xml
+++ b/android/res/values-ja/strings.xml
@@ -814,6 +814,8 @@
更新 (%s)
あとで手動で更新
+
+ トラック
索道
diff --git a/android/res/values-ko/strings.xml b/android/res/values-ko/strings.xml
index 483df36ad8..6cbc639fde 100644
--- a/android/res/values-ko/strings.xml
+++ b/android/res/values-ko/strings.xml
@@ -816,6 +816,8 @@
업데이트(%s)
나중에 수동으로 업데이트
+
+ 길
케이블카 역
diff --git a/android/res/values-nb/strings.xml b/android/res/values-nb/strings.xml
index 7ffa597409..a05f314325 100644
--- a/android/res/values-nb/strings.xml
+++ b/android/res/values-nb/strings.xml
@@ -795,6 +795,8 @@
Oppdater (%s)
Oppdater manuelt senere
+
+ Rute
Kabelbanestasjon
diff --git a/android/res/values-nl/strings.xml b/android/res/values-nl/strings.xml
index 5f0e2e5cc7..4bf2cee641 100644
--- a/android/res/values-nl/strings.xml
+++ b/android/res/values-nl/strings.xml
@@ -814,6 +814,8 @@
Bijwerken (%s)
Later handmatig bijwerken
+
+ Track
Kabelwagenstation
diff --git a/android/res/values-pl/strings.xml b/android/res/values-pl/strings.xml
index 0bc13d5a15..36e3abef85 100644
--- a/android/res/values-pl/strings.xml
+++ b/android/res/values-pl/strings.xml
@@ -824,6 +824,8 @@
Zaktualizuj (%s)
Zaktualizuj ręcznie później
+
+ Trasa
Transport linowy
diff --git a/android/res/values-pt-rBR/strings.xml b/android/res/values-pt-rBR/strings.xml
index a39e590eeb..c75bd7ce7c 100644
--- a/android/res/values-pt-rBR/strings.xml
+++ b/android/res/values-pt-rBR/strings.xml
@@ -833,6 +833,8 @@
Atualizar (%s)
Atualizar manualmente mais tarde
+
+ Percurso
Estação de teleférico
diff --git a/android/res/values-pt/strings.xml b/android/res/values-pt/strings.xml
index 75755a0197..773ef696ff 100644
--- a/android/res/values-pt/strings.xml
+++ b/android/res/values-pt/strings.xml
@@ -835,6 +835,8 @@
Atualizar (%s)
Atualizar manualmente mais tarde
+
+ Percurso
Estação de teleférico
diff --git a/android/res/values-ro/strings.xml b/android/res/values-ro/strings.xml
index f7435dbe05..b9fe80a0dc 100644
--- a/android/res/values-ro/strings.xml
+++ b/android/res/values-ro/strings.xml
@@ -818,6 +818,8 @@
Actualizare (%s)
Actualizare manuală mai târziu
+
+ Rută
Stație de teleferic
diff --git a/android/res/values-ru/strings.xml b/android/res/values-ru/strings.xml
index c62d47b72d..0e26d1d1fe 100644
--- a/android/res/values-ru/strings.xml
+++ b/android/res/values-ru/strings.xml
@@ -846,6 +846,14 @@
Обновить (%s)
Обновить вручную позже
+
+ Удалить трек
+
+ Название трека
+
+ Переместить
+
+ Трек
Канатная дорога
diff --git a/android/res/values-sk/strings.xml b/android/res/values-sk/strings.xml
index 24e23b28c9..fb702a446f 100644
--- a/android/res/values-sk/strings.xml
+++ b/android/res/values-sk/strings.xml
@@ -816,6 +816,8 @@
Aktualizovať (%s)
Manuálne aktualizovať neskôr
+
+ Šľapaj Stopy
Lanovka
diff --git a/android/res/values-sv/strings.xml b/android/res/values-sv/strings.xml
index af8d23882f..b13f50a101 100644
--- a/android/res/values-sv/strings.xml
+++ b/android/res/values-sv/strings.xml
@@ -815,6 +815,8 @@
Uppdatera (%s)
Uppdatera senare manuellt
+
+ Rutt
Linbanestation
diff --git a/android/res/values-th/strings.xml b/android/res/values-th/strings.xml
index d9b06d82fd..e42fb83763 100644
--- a/android/res/values-th/strings.xml
+++ b/android/res/values-th/strings.xml
@@ -818,6 +818,8 @@
อัปเดต (%s)
อัปเดตด้วยตนเองภายหลัง
+
+ ติดตาม
สถานีกระเช้าลอยฟ้า
diff --git a/android/res/values-tr/strings.xml b/android/res/values-tr/strings.xml
index 005d387930..b6222024a1 100644
--- a/android/res/values-tr/strings.xml
+++ b/android/res/values-tr/strings.xml
@@ -818,6 +818,8 @@
Güncelle (%s)
Daha sonra manüel olarak güncelle
+
+ Rota
Remontées mécaniques
diff --git a/android/res/values-uk/strings.xml b/android/res/values-uk/strings.xml
index 644aa89ff8..e934bfed3a 100644
--- a/android/res/values-uk/strings.xml
+++ b/android/res/values-uk/strings.xml
@@ -821,6 +821,8 @@
Оновити (%s)
Оновити вручну пізніше
+
+ Маршрут
Канатна дорога
diff --git a/android/res/values-vi/strings.xml b/android/res/values-vi/strings.xml
index b389dd002d..1219590817 100644
--- a/android/res/values-vi/strings.xml
+++ b/android/res/values-vi/strings.xml
@@ -819,6 +819,8 @@
Cập nhật (%s)
Cập nhật thủ công sau
+
+ Dấu chân
Trạm Cáp Treo
diff --git a/android/res/values-zh-rTW/strings.xml b/android/res/values-zh-rTW/strings.xml
index 3515091da9..0ef590d69a 100644
--- a/android/res/values-zh-rTW/strings.xml
+++ b/android/res/values-zh-rTW/strings.xml
@@ -828,6 +828,8 @@
更新 (%s)
稍後手動更新
+
+ 追踪
纜車
diff --git a/android/res/values-zh/strings.xml b/android/res/values-zh/strings.xml
index 30ec41b9e1..f50407fd69 100644
--- a/android/res/values-zh/strings.xml
+++ b/android/res/values-zh/strings.xml
@@ -828,6 +828,8 @@
更新 (%s)
稍后手动更新
+
+ 追踪
缆车要素
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index 3cca6e5ed1..bc9f2e37d5 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -852,6 +852,14 @@
Update (%s)
Manually update later
+
+ Delete Track
+
+ Track Name
+
+ Move
+
+ Track
aerialway
diff --git a/data/strings/strings.txt b/data/strings/strings.txt
index cf54dfa1dd..fc6a5e4d9c 100644
--- a/data/strings/strings.txt
+++ b/data/strings/strings.txt
@@ -2756,7 +2756,7 @@
[edit]
comment = resource for context menu
- tags = android
+ tags = android, ios
en = Edit
ru = Редактировать
bg = Редакция
@@ -21593,3 +21593,57 @@
hi = बाद में मैनुअल रूप से अपडेट करें
sk = Manuálne aktualizovať neskôr
sw = Sasisha mwenyewe baadaye
+
+ [placepage_delete_track_button]
+ comment = Delete track button on track edit screen
+ tags = ios
+ en = Delete Track
+ ru = Удалить трек
+
+ [placepage_track_name_hint]
+ comment = Placeholder for track name input on track edit screen
+ tags = ios
+ en = Track Name
+ ru = Название трека
+
+ [move]
+ comment = move track or bookmark from the list button text
+ tags = ios
+ en = Move
+ ru = Переместить
+
+ [track_title]
+ comment = edit track screen title
+ tags = ios
+ en = Track
+ ru = Трек
+ bg = Пътека
+ ar = مسار
+ cs = Dráha
+ da = Rute
+ nl = Track
+ fi = Reitti
+ fr = Route
+ de = Strecken
+ hu = Útvonal
+ id = Trek
+ it = Traccia
+ ja = トラック
+ ko = 길
+ nb = Rute
+ pl = Trasa
+ pt = Percurso
+ pt-BR = Percurso
+ ro = Rută
+ es = Ruta
+ sv = Rutt
+ th = ติดตาม
+ tr = Rota
+ uk = Маршрут
+ vi = Dấu chân
+ zh-Hans = 追踪
+ zh-Hant = 追踪
+ el = Τροχιά
+ fa = مسیر
+ he = מַסלוּל
+ sk = Šľapaj Stopy
diff --git a/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.h b/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.h
index 155f5f34c9..e987ebc671 100644
--- a/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.h
+++ b/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.h
@@ -69,6 +69,9 @@ NS_SWIFT_NAME(BookmarksManager)
- (NSArray *)bookmarksForCategory:(MWMMarkGroupID)categoryId;
- (MWMMarkIDCollection)bookmarkIdsForCategory:(MWMMarkGroupID)categoryId;
- (void)deleteBookmark:(MWMMarkID)bookmarkId;
+- (void)deleteTrack:(MWMTrackID)trackId;
+- (MWMBookmark *)bookmarkWithId:(MWMMarkID)bookmarkId;
+- (MWMTrack *)trackWithId:(MWMTrackID)trackId;
- (NSArray *)bookmarksForGroup:(MWMMarkGroupID)groupId;
- (NSArray *)tracksForGroup:(MWMMarkGroupID)groupId;
- (NSArray *)collectionsForGroup:(MWMMarkGroupID)groupId;
@@ -88,12 +91,25 @@ NS_SWIFT_NAME(BookmarksManager)
- (NSArray *)userCategories;
- (MWMBookmarkGroup *)categoryWithId:(MWMMarkGroupID)groupId;
+- (MWMBookmarkGroup *)categoryForBookmarkId:(MWMMarkID)bookmarkId;
+- (MWMBookmarkGroup *)categoryForTrackId:(MWMTrackID)trackId;
+- (NSString *)descriptionForBookmarkId:(MWMMarkID)bookmarkId;
- (void)updateBookmark:(MWMMarkID)bookmarkId
setGroupId:(MWMMarkGroupID)groupId
title:(NSString *)title
color:(MWMBookmarkColor)color
description:(NSString *)description;
+- (void)moveBookmark:(MWMMarkID)bookmarkId
+ toGroupId:(MWMMarkGroupID)groupId;
+
+- (void)updateTrack:(MWMTrackID)trackId
+ setGroupId:(MWMMarkGroupID)groupId
+ title:(NSString *)title;
+
+- (void)moveTrack:(MWMTrackID)trackId
+ toGroupId:(MWMMarkGroupID)groupId;
+
- (instancetype)init __attribute__((unavailable("call +manager instead")));
- (instancetype)copy __attribute__((unavailable("call +manager instead")));
- (instancetype)copyWithZone:(NSZone *)zone __attribute__((unavailable("call +manager instead")));
diff --git a/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.mm b/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.mm
index 4b40fca596..f070a36349 100644
--- a/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.mm
+++ b/iphone/CoreApi/CoreApi/Bookmarks/MWMBookmarksManager.mm
@@ -459,6 +459,33 @@ static BookmarkManager::SortingType convertSortingTypeToCore(MWMBookmarksSorting
}];
}
+- (void)deleteTrack:(MWMTrackID)trackId {
+ self.bm.GetEditSession().DeleteTrack(trackId);
+}
+
+- (MWMBookmark *)bookmarkWithId:(MWMMarkID)bookmarkId {
+ return [[MWMBookmark alloc] initWithMarkId:bookmarkId bookmarkData:self.bm.GetBookmark(bookmarkId)];
+}
+
+- (MWMTrack *)trackWithId:(MWMTrackID)trackId {
+ return [[MWMTrack alloc] initWithTrackId:trackId trackData:self.bm.GetTrack(trackId)];
+}
+
+- (MWMBookmarkGroup *)categoryForBookmarkId:(MWMMarkID)bookmarkId {
+ auto const groupId = self.bm.GetBookmark(bookmarkId)->GetGroupId();
+ return [self categoryWithId:groupId];
+}
+
+- (MWMBookmarkGroup *)categoryForTrackId:(MWMTrackID)trackId {
+ auto const groupId = self.bm.GetTrack(trackId)->GetGroupId();
+ return [self categoryWithId:groupId];
+}
+
+- (NSString *)descriptionForBookmarkId:(MWMMarkID)bookmarkId {
+ auto const description = self.bm.GetBookmark(bookmarkId)->GetDescription();
+ return [NSString stringWithUTF8String:description.c_str()];
+}
+
- (NSArray *)bookmarksForGroup:(MWMMarkGroupID)groupId {
auto const &bookmarkIds = self.bm.GetUserMarkIds(groupId);
NSMutableArray *result = [NSMutableArray array];
@@ -640,6 +667,41 @@ static BookmarkManager::SortingType convertSortingTypeToCore(MWMBookmarksSorting
}
}
+- (void)moveBookmark:(MWMMarkID)bookmarkId
+ toGroupId:(MWMMarkGroupID)groupId {
+ auto const currentGroupId = self.bm.GetBookmark(bookmarkId)->GetGroupId();
+ auto editSession = self.bm.GetEditSession();
+ if (groupId != kml::kInvalidMarkGroupId) {
+ editSession.MoveBookmark(bookmarkId, currentGroupId, groupId);
+ }
+}
+
+- (void)updateTrack:(MWMTrackID)trackId
+ setGroupId:(MWMMarkGroupID)groupId
+ title:(NSString *)title {
+ auto const currentGroupId = self.bm.GetTrack(trackId)->GetGroupId();
+ auto editSession = self.bm.GetEditSession();
+ if (groupId != kml::kInvalidMarkGroupId) {
+ editSession.MoveTrack(trackId, currentGroupId, groupId);
+ }
+
+ auto track = editSession.GetTrackForEdit(trackId);
+ if (!track) {
+ return;
+ }
+
+ track->SetName(title.UTF8String);
+}
+
+- (void)moveTrack:(MWMTrackID)trackId
+ toGroupId:(MWMMarkGroupID)groupId {
+ auto const currentGroupId = self.bm.GetTrack(trackId)->GetGroupId();
+ auto editSession = self.bm.GetEditSession();
+ if (groupId != kml::kInvalidMarkGroupId) {
+ editSession.MoveTrack(trackId, currentGroupId, groupId);
+ }
+}
+
- (void)setCategory:(MWMMarkGroupID)groupId authorType:(MWMBookmarkGroupAuthorType)author
{
switch (author)
diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInteractor.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInteractor.swift
index 99620da747..352472be59 100644
--- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInteractor.swift
+++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInteractor.swift
@@ -140,6 +140,26 @@ extension BookmarksListInteractor: IBookmarksListInteractor {
bookmarksManager.deleteBookmark(bookmarkId)
}
+ func deleteTrack(_ trackId: MWMTrackID) {
+ bookmarksManager.deleteTrack(trackId)
+ }
+
+ func moveBookmark(_ bookmarkId: MWMMarkID, toGroupId groupId: MWMMarkGroupID) {
+ bookmarksManager.moveBookmark(bookmarkId, toGroupId: groupId)
+ }
+
+ func moveTrack(_ trackId: MWMTrackID, toGroupId groupId: MWMMarkGroupID) {
+ bookmarksManager.moveTrack(trackId, toGroupId: groupId)
+ }
+
+ func updateBookmark(_ bookmarkId: MWMMarkID, setGroupId groupId: MWMMarkGroupID, title: String, color: BookmarkColor, description: String) {
+ bookmarksManager.updateBookmark(bookmarkId, setGroupId: groupId, title: title, color: color, description: description)
+ }
+
+ func updateTrack(_ trackId: MWMTrackID, setGroupId groupId: MWMMarkGroupID) {
+ bookmarksManager.moveTrack(trackId, toGroupId: groupId)
+ }
+
func deleteBookmarksGroup() {
bookmarksManager.deleteCategory(markGroupId)
}
diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift
index 162e74be85..40afe1a9fa 100644
--- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift
+++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift
@@ -64,13 +64,16 @@ protocol IBookmarksListView: AnyObject {
protocol IBookmarksListPresenter {
func viewDidLoad()
+ func viewDidAppear()
func activateSearch()
func deactivateSearch()
func cancelSearch()
func search(_ text: String)
func sort()
func more()
- func deleteBookmark(in section: IBookmarksListSectionViewModel, at index: Int)
+ func deleteItem(in section: IBookmarksListSectionViewModel, at index: Int)
+ func moveItem(in section: IBookmarksListSectionViewModel, at index: Int)
+ func editItem(in section: IBookmarksListSectionViewModel, at index: Int)
func selectItem(in section: IBookmarksListSectionViewModel, at index: Int)
func checkItem(in section: IBookmarksListSectionViewModel, at index: Int, checked: Bool)
func toggleVisibility(in section: IBookmarksListSectionViewModel)
@@ -99,6 +102,11 @@ protocol IBookmarksListInteractor {
func resetSort()
func lastSortingType() -> BookmarksListSortingType?
func deleteBookmark(_ bookmarkId: MWMMarkID)
+ func deleteTrack(_ trackId: MWMTrackID)
+ func moveBookmark(_ bookmarkId: MWMMarkID, toGroupId: MWMMarkGroupID)
+ func moveTrack(_ trackId: MWMTrackID, toGroupId: MWMMarkGroupID)
+ func updateBookmark(_ bookmarkId: MWMMarkID, setGroupId groupId: MWMMarkGroupID, title: String, color: BookmarkColor, description: String)
+ func updateTrack(_ trackId: MWMTrackID, setGroupId groupId: MWMMarkGroupID)
func deleteBookmarksGroup()
func canDeleteGroup() -> Bool
func exportFile(_ completion: @escaping (URL?, ExportFileStatus) -> Void)
@@ -110,6 +118,11 @@ protocol IBookmarksListRouter {
func viewOnMap(_ bookmarkGroup: BookmarkGroup)
func showDescription(_ bookmarkGroup: BookmarkGroup)
func showSubgroup(_ subgroupId: MWMMarkGroupID)
+ func selectGroup(currentGroupName groupName: String,
+ currentGroupId groupId: MWMMarkGroupID,
+ delegate: SelectBookmarkGroupViewControllerDelegate?)
+ func editBookmark(bookmarkId: MWMMarkID, completion: @escaping (Bool) -> Void)
+ func editTrack(trackId: MWMTrackID, completion: @escaping (Bool) -> Void)
}
protocol IBookmakrsListInfoViewModel {
diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift
index 49b39c08e9..14b5f8f30b 100644
--- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift
+++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift
@@ -12,6 +12,12 @@ final class BookmarksListPresenter {
private let imperialUnits: Bool
private let bookmarkGroup: BookmarkGroup
+ private enum EditableItem {
+ case bookmark(MWMMarkID)
+ case track(MWMTrackID)
+ }
+ private var editingItem: EditableItem?
+
init(view: IBookmarksListView,
router: IBookmarksListRouter,
delegate: BookmarksListDelegate?,
@@ -182,6 +188,10 @@ extension BookmarksListPresenter: IBookmarksListPresenter {
view.setInfo(info)
}
+ func viewDidAppear() {
+ reload()
+ }
+
func activateSearch() {
interactor.prepareForSearch()
}
@@ -211,13 +221,52 @@ extension BookmarksListPresenter: IBookmarksListPresenter {
showSortMenu()
}
- func deleteBookmark(in section: IBookmarksListSectionViewModel, at index: Int) {
- guard let bookmarksSection = section as? BookmarksSectionViewModel else {
- fatalError("It's only possible to delete a bookmark")
+ func deleteItem(in section: IBookmarksListSectionViewModel, at index: Int) {
+ switch section {
+ case let bookmarksSection as IBookmarksSectionViewModel:
+ guard let bookmark = bookmarksSection.bookmarks[index] as? BookmarkViewModel else { fatalError() }
+ interactor.deleteBookmark(bookmark.bookmarkId)
+ reload()
+ case let tracksSection as ITracksSectionViewModel:
+ guard let track = tracksSection.tracks[index] as? TrackViewModel else { fatalError() }
+ interactor.deleteTrack(track.trackId)
+ reload()
+ default:
+ fatalError("Cannot delete item: unsupported section type: \(section.self)")
+ }
+ }
+
+ func moveItem(in section: IBookmarksListSectionViewModel, at index: Int) {
+ let group = interactor.getBookmarkGroup()
+ switch section {
+ case let bookmarksSection as IBookmarksSectionViewModel:
+ guard let bookmark = bookmarksSection.bookmarks[index] as? BookmarkViewModel else { fatalError() }
+ editingItem = .bookmark(bookmark.bookmarkId)
+ router.selectGroup(currentGroupName: group.title, currentGroupId: group.categoryId, delegate: self)
+ case let tracksSection as ITracksSectionViewModel:
+ guard let track = tracksSection.tracks[index] as? TrackViewModel else { fatalError() }
+ editingItem = .track(track.trackId)
+ router.selectGroup(currentGroupName: group.title, currentGroupId: group.categoryId, delegate: self)
+ default:
+ fatalError("Cannot move item: unsupported section type: \(section.self)")
+ }
+ }
+
+ func editItem(in section: IBookmarksListSectionViewModel, at index: Int) {
+ switch section {
+ case let bookmarksSection as IBookmarksSectionViewModel:
+ guard let bookmarkId = (bookmarksSection.bookmarks[index] as? BookmarkViewModel)?.bookmarkId else { fatalError() }
+ router.editBookmark(bookmarkId: bookmarkId) { [weak self] wasChanged in
+ if wasChanged { self?.reload() }
+ }
+ case let tracksSection as ITracksSectionViewModel:
+ guard let trackId = (tracksSection.tracks[index] as? TrackViewModel)?.trackId else { fatalError() }
+ router.editTrack(trackId: trackId) { [weak self] wasChanged in
+ if wasChanged { self?.reload() }
+ }
+ default:
+ fatalError("Cannot edit item: unsupported section type: \(section.self)")
}
- guard let bookmark = bookmarksSection.bookmarks[index] as? BookmarkViewModel else { fatalError() }
- interactor.deleteBookmark(bookmark.bookmarkId)
- reload()
}
func selectItem(in section: IBookmarksListSectionViewModel, at index: Int) {
@@ -296,6 +345,37 @@ extension BookmarksListPresenter: CategorySettingsViewControllerDelegate {
}
}
+extension BookmarksListPresenter: SelectBookmarkGroupViewControllerDelegate {
+ func bookmarkGroupViewController(_ viewController: SelectBookmarkGroupViewController,
+ didSelect groupTitle: String,
+ groupId: MWMMarkGroupID) {
+
+ let nc = viewController.navigationController
+ defer { nc?.popViewController(animated: true) }
+
+ guard groupId != bookmarkGroup.categoryId else { return }
+
+ switch editingItem {
+ case .bookmark(let bookmarkId):
+ interactor.moveBookmark(bookmarkId, toGroupId: groupId)
+ case .track(let trackId):
+ interactor.moveTrack(trackId, toGroupId: groupId)
+ case .none:
+ break
+ }
+
+ editingItem = nil
+
+ if bookmarkGroup.bookmarksCount > 0 || bookmarkGroup.trackCount > 0 {
+ reload()
+ } else {
+ // if there are no bookmarks or tracks in current group no need to show this group
+ // e.g. popping view controller 2 times
+ nc?.popViewController(animated: false)
+ }
+ }
+}
+
extension IBookmarksSectionViewModel {
var numberOfItems: Int { bookmarks.count }
var visibilityButtonState: BookmarksListVisibilityButtonState { .hidden }
diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListRouter.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListRouter.swift
index 2d749bc5a8..89d6ec5f6d 100644
--- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListRouter.swift
+++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListRouter.swift
@@ -29,4 +29,23 @@ extension BookmarksListRouter: IBookmarksListRouter {
bookmarksCoordinator: coordinator)
mapViewController.navigationController?.pushViewController(bookmarksListViewController, animated: true)
}
+
+ func selectGroup(currentGroupName groupName: String,
+ currentGroupId groupId: MWMMarkGroupID,
+ delegate: SelectBookmarkGroupViewControllerDelegate?) {
+ let groupViewController = SelectBookmarkGroupViewController(groupName: groupName, groupId: groupId)
+ groupViewController.delegate = delegate
+ mapViewController.navigationController?.pushViewController(groupViewController, animated: true)
+ }
+
+ func editBookmark(bookmarkId: MWMMarkID, completion: @escaping (Bool) -> Void) {
+ let editBookmarkController = UIStoryboard.instance(.main).instantiateViewController(withIdentifier: "MWMEditBookmarkController") as! EditBookmarkViewController
+ editBookmarkController.configure(with: bookmarkId, editCompletion: completion)
+ mapViewController.navigationController?.pushViewController(editBookmarkController, animated: true)
+ }
+
+ func editTrack(trackId: MWMTrackID, completion: @escaping (Bool) -> Void) {
+ let editTrackController = EditTrackViewController(trackId: trackId, editCompletion: completion)
+ mapViewController.navigationController?.pushViewController(editTrackController, animated: true)
+ }
}
diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift
index 08d990ad07..c27518bae1 100644
--- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift
+++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift
@@ -41,6 +41,11 @@ final class BookmarksListViewController: MWMViewController {
presenter.viewDidLoad()
MWMKeyboard.add(self);
}
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+ presenter.viewDidAppear()
+ }
deinit {
MWMKeyboard.remove(self);
@@ -122,12 +127,30 @@ extension BookmarksListViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didEndEditingRowAt indexPath: IndexPath?) {
isEditing = false
}
+
+ func tableView(_ tableView: UITableView,
+ leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
+ let moveAction = UIContextualAction(style: .normal, title: L("move")) { [weak self] (_, _, completion) in
+ guard let section = self?.sections?[indexPath.section] else { fatalError() }
+ self?.presenter.moveItem(in: section, at: indexPath.row)
+ completion(true)
+ }
+ return UISwipeActionsConfiguration(actions: [moveAction])
+ }
func tableView(_ tableView: UITableView,
- commit editingStyle: UITableViewCell.EditingStyle,
- forRowAt indexPath: IndexPath) {
- guard let section = sections?[indexPath.section] else { fatalError() }
- presenter.deleteBookmark(in: section, at: indexPath.row)
+ trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
+ let deleteAction = UIContextualAction(style: .destructive, title: L("delete")) { [weak self] (_, _, completion) in
+ guard let section = self?.sections?[indexPath.section] else { fatalError() }
+ self?.presenter.deleteItem(in: section, at: indexPath.row)
+ completion(true)
+ }
+ let editAction = UIContextualAction(style: .normal, title: L("edit")) { [weak self] (_, _, completion) in
+ guard let section = self?.sections?[indexPath.section] else { fatalError() }
+ self?.presenter.editItem(in: section, at: indexPath.row)
+ completion(true)
+ }
+ return UISwipeActionsConfiguration(actions: [deleteAction, editAction])
}
}
diff --git a/iphone/Maps/LocalizedStrings/ar.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/ar.lproj/Localizable.strings
index e6f9a3ead9..d8f1ff1783 100644
--- a/iphone/Maps/LocalizedStrings/ar.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/ar.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "تحديث يدوياً في وقت لاحق";
+/* edit track screen title */
+"track_title" = "مسار";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/bg.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/bg.lproj/Localizable.strings
index 197136bda9..3dc396d425 100644
--- a/iphone/Maps/LocalizedStrings/bg.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/bg.lproj/Localizable.strings
@@ -1249,3 +1249,6 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Ръчно актуализиране по-късно";
+
+/* edit track screen title */
+"track_title" = "Пътека";
diff --git a/iphone/Maps/LocalizedStrings/cs.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/cs.lproj/Localizable.strings
index e5df264c78..88bd7e4fb7 100644
--- a/iphone/Maps/LocalizedStrings/cs.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/cs.lproj/Localizable.strings
@@ -1409,6 +1409,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Aktualizovat ručně později";
+/* edit track screen title */
+"track_title" = "Dráha";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/da.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/da.lproj/Localizable.strings
index a1b960e806..8a8047a570 100644
--- a/iphone/Maps/LocalizedStrings/da.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/da.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Opdater manuelt senere";
+/* edit track screen title */
+"track_title" = "Rute";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings
index ac844c8f25..5af1414feb 100644
--- a/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/de.lproj/Localizable.strings
@@ -1415,6 +1415,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Später manuell aktualisieren";
+/* edit track screen title */
+"track_title" = "Strecken";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/el.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/el.lproj/Localizable.strings
index fb85afa52f..f170ab4682 100644
--- a/iphone/Maps/LocalizedStrings/el.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/el.lproj/Localizable.strings
@@ -1391,6 +1391,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Χειροκίνητη ενημέρωση αργότερα";
+/* edit track screen title */
+"track_title" = "Τροχιά";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings
index f49a2132a8..57565fbbd7 100644
--- a/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/en.lproj/Localizable.strings
@@ -1459,6 +1459,18 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Manually update later";
+/* Delete track button on track edit screen */
+"placepage_delete_track_button" = "Delete Track";
+
+/* Placeholder for track name input on track edit screen */
+"placepage_track_name_hint" = "Track Name";
+
+/* move track or bookmark from the list button text */
+"move" = "Move";
+
+/* edit track screen title */
+"track_title" = "Track";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/es.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/es.lproj/Localizable.strings
index 54395f0857..26e50f5f38 100644
--- a/iphone/Maps/LocalizedStrings/es.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/es.lproj/Localizable.strings
@@ -1406,6 +1406,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Actualizar más tarde de forma manual";
+/* edit track screen title */
+"track_title" = "Ruta";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/fa.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/fa.lproj/Localizable.strings
index b3d66266e9..f8e75181ae 100644
--- a/iphone/Maps/LocalizedStrings/fa.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/fa.lproj/Localizable.strings
@@ -1392,6 +1392,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "بعدا به صورت دستی به روزرسانی کنید";
+/* edit track screen title */
+"track_title" = "مسیر";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/fi.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/fi.lproj/Localizable.strings
index 529210d1ee..c351dcd2a4 100644
--- a/iphone/Maps/LocalizedStrings/fi.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/fi.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Päivitä manuaalisesti myöhemmin";
+/* edit track screen title */
+"track_title" = "Reitti";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/fr.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/fr.lproj/Localizable.strings
index 7ad8cd55e6..766b8de466 100644
--- a/iphone/Maps/LocalizedStrings/fr.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/fr.lproj/Localizable.strings
@@ -1423,6 +1423,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Mettre à jour manuellement plus tard";
+/* edit track screen title */
+"track_title" = "Route";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/hu.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/hu.lproj/Localizable.strings
index 9497c1be8a..e172f59778 100644
--- a/iphone/Maps/LocalizedStrings/hu.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/hu.lproj/Localizable.strings
@@ -1407,6 +1407,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Kézi frissítés később";
+/* edit track screen title */
+"track_title" = "Útvonal";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/id.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/id.lproj/Localizable.strings
index e54fbef0eb..4dadc39949 100644
--- a/iphone/Maps/LocalizedStrings/id.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/id.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Perbarui secara manual nanti";
+/* edit track screen title */
+"track_title" = "Trek";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/it.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/it.lproj/Localizable.strings
index 4c7d5e5824..5eb7176362 100644
--- a/iphone/Maps/LocalizedStrings/it.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/it.lproj/Localizable.strings
@@ -1406,6 +1406,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Aggiorna manualmente più tardi";
+/* edit track screen title */
+"track_title" = "Traccia";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/ja.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/ja.lproj/Localizable.strings
index 7a7dec0a17..3668c32e68 100644
--- a/iphone/Maps/LocalizedStrings/ja.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/ja.lproj/Localizable.strings
@@ -1406,6 +1406,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "あとで手動で更新";
+/* edit track screen title */
+"track_title" = "トラック";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/ko.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/ko.lproj/Localizable.strings
index a9dc116119..18ef86251e 100644
--- a/iphone/Maps/LocalizedStrings/ko.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/ko.lproj/Localizable.strings
@@ -1409,6 +1409,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "나중에 수동으로 업데이트";
+/* edit track screen title */
+"track_title" = "길";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/nb.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/nb.lproj/Localizable.strings
index 876a0e581f..016b2619ca 100644
--- a/iphone/Maps/LocalizedStrings/nb.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/nb.lproj/Localizable.strings
@@ -1382,6 +1382,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Oppdater manuelt senere";
+/* edit track screen title */
+"track_title" = "Rute";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/nl.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/nl.lproj/Localizable.strings
index a9d705aa6c..8e46e96369 100644
--- a/iphone/Maps/LocalizedStrings/nl.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/nl.lproj/Localizable.strings
@@ -1404,6 +1404,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Later handmatig bijwerken";
+/* edit track screen title */
+"track_title" = "Track";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/pl.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/pl.lproj/Localizable.strings
index de9710db14..4ca1cbe982 100644
--- a/iphone/Maps/LocalizedStrings/pl.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/pl.lproj/Localizable.strings
@@ -1418,6 +1418,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Zaktualizuj ręcznie później";
+/* edit track screen title */
+"track_title" = "Trasa";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/pt-BR.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/pt-BR.lproj/Localizable.strings
index 08862499b8..76822651bb 100644
--- a/iphone/Maps/LocalizedStrings/pt-BR.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/pt-BR.lproj/Localizable.strings
@@ -1428,6 +1428,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Atualizar manualmente mais tarde";
+/* edit track screen title */
+"track_title" = "Percurso";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/pt.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/pt.lproj/Localizable.strings
index 462653d7a5..66aca51eb2 100644
--- a/iphone/Maps/LocalizedStrings/pt.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/pt.lproj/Localizable.strings
@@ -1432,6 +1432,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Atualizar manualmente mais tarde";
+/* edit track screen title */
+"track_title" = "Percurso";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/ro.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/ro.lproj/Localizable.strings
index ff519bfad9..1f1c6a290b 100644
--- a/iphone/Maps/LocalizedStrings/ro.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/ro.lproj/Localizable.strings
@@ -1410,6 +1410,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Actualizare manuală mai târziu";
+/* edit track screen title */
+"track_title" = "Rută";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/ru.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/ru.lproj/Localizable.strings
index 89c469bb83..b614ac110f 100644
--- a/iphone/Maps/LocalizedStrings/ru.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/ru.lproj/Localizable.strings
@@ -1438,6 +1438,18 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Обновить вручную позже";
+/* Delete track button on track edit screen */
+"placepage_delete_track_button" = "Удалить трек";
+
+/* Placeholder for track name input on track edit screen */
+"placepage_track_name_hint" = "Название трека";
+
+/* move track or bookmark from the list button text */
+"move" = "Переместить";
+
+/* edit track screen title */
+"track_title" = "Трек";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/sk.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/sk.lproj/Localizable.strings
index adaffc3129..af0adefb6e 100644
--- a/iphone/Maps/LocalizedStrings/sk.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/sk.lproj/Localizable.strings
@@ -1406,6 +1406,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Manuálne aktualizovať neskôr";
+/* edit track screen title */
+"track_title" = "Šľapaj Stopy";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/sv.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/sv.lproj/Localizable.strings
index 467f2b5364..435e0ec9b2 100644
--- a/iphone/Maps/LocalizedStrings/sv.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/sv.lproj/Localizable.strings
@@ -1406,6 +1406,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Uppdatera senare manuellt";
+/* edit track screen title */
+"track_title" = "Rutt";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/th.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/th.lproj/Localizable.strings
index efb8fe741a..c320fe119d 100644
--- a/iphone/Maps/LocalizedStrings/th.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/th.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "อัปเดตด้วยตนเองภายหลัง";
+/* edit track screen title */
+"track_title" = "ติดตาม";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/tr.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/tr.lproj/Localizable.strings
index a3e46207e6..d6516b0276 100644
--- a/iphone/Maps/LocalizedStrings/tr.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/tr.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Daha sonra manüel olarak güncelle";
+/* edit track screen title */
+"track_title" = "Rota";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/uk.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/uk.lproj/Localizable.strings
index d86f930010..0c3e1e2491 100644
--- a/iphone/Maps/LocalizedStrings/uk.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/uk.lproj/Localizable.strings
@@ -1414,6 +1414,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Оновити вручну пізніше";
+/* edit track screen title */
+"track_title" = "Маршрут";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/vi.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/vi.lproj/Localizable.strings
index 2ddf8a70f3..e1d8443146 100644
--- a/iphone/Maps/LocalizedStrings/vi.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/vi.lproj/Localizable.strings
@@ -1412,6 +1412,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "Cập nhật thủ công sau";
+/* edit track screen title */
+"track_title" = "Dấu chân";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/zh-Hans.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/zh-Hans.lproj/Localizable.strings
index 1c0f7715f9..4639877504 100644
--- a/iphone/Maps/LocalizedStrings/zh-Hans.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/zh-Hans.lproj/Localizable.strings
@@ -1427,6 +1427,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "稍后手动更新";
+/* edit track screen title */
+"track_title" = "追踪";
+
/********** Types **********/
diff --git a/iphone/Maps/LocalizedStrings/zh-Hant.lproj/Localizable.strings b/iphone/Maps/LocalizedStrings/zh-Hant.lproj/Localizable.strings
index 486e46ef9e..42bd6714cc 100644
--- a/iphone/Maps/LocalizedStrings/zh-Hant.lproj/Localizable.strings
+++ b/iphone/Maps/LocalizedStrings/zh-Hant.lproj/Localizable.strings
@@ -1427,6 +1427,9 @@
/* Autoupdate dialog on start */
"whats_new_auto_update_button_later" = "稍後手動更新";
+/* edit track screen title */
+"track_title" = "追踪";
+
/********** Types **********/
diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj
index 3fd4aa74ef..62561bb0ff 100644
--- a/iphone/Maps/Maps.xcodeproj/project.pbxproj
+++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj
@@ -498,6 +498,7 @@
99F9A0E52462CA0E00AE21E0 /* DownloadAllView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99F9A0E42462CA0E00AE21E0 /* DownloadAllView.swift */; };
99F9A0E72462CA1700AE21E0 /* DownloadAllView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 99F9A0E62462CA1700AE21E0 /* DownloadAllView.xib */; };
A630D1EA207CA95900976DEA /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = A630D1E8207CA95900976DEA /* Localizable.stringsdict */; };
+ AA1C7E3E269A2DD600BAADF2 /* EditTrackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1C7E3D269A2DD600BAADF2 /* EditTrackViewController.swift */; };
B33D21AF20DAF9F000BAD749 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B33D21AE20DAF9F000BAD749 /* Toast.swift */; };
B33D21B820E130D000BAD749 /* BookmarksTabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B33D21B720E130D000BAD749 /* BookmarksTabViewController.swift */; };
B3E3B4FD20D463B700DA8C13 /* BMCCategoriesHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = B3E3B4FC20D463B700DA8C13 /* BMCCategoriesHeader.xib */; };
@@ -1332,6 +1333,7 @@
A630D204207CAA3400976DEA /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = vi; path = vi.lproj/Localizable.stringsdict; sourceTree = ""; };
A630D205207CAA3A00976DEA /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.stringsdict"; sourceTree = ""; };
A630D206207CAA5800976DEA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.stringsdict"; sourceTree = ""; };
+ AA1C7E3D269A2DD600BAADF2 /* EditTrackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditTrackViewController.swift; sourceTree = ""; };
AC79F11E1E534D0B00B7D954 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
AC79F1201E534D4000B7D954 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; };
AC79F1221E534DFA00B7D954 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
@@ -3230,6 +3232,7 @@
471A7BBF2481C82500A0D4C1 /* BookmarkTitleCell.swift */,
471A7BC12481C9B700A0D4C1 /* BookmarkTitleCell.xib */,
471A7BBD2481A3D000A0D4C1 /* EditBookmarkViewController.swift */,
+ AA1C7E3D269A2DD600BAADF2 /* EditTrackViewController.swift */,
471A7BC3248471BE00A0D4C1 /* BookmarkUIUtils.swift */,
4715273424907F8200E91BBA /* BookmarkColorViewController.swift */,
471527362491C20500E91BBA /* SelectBookmarkGroupViewController.swift */,
@@ -3951,6 +3954,7 @@
34F742321E0834F400AC1FD6 /* UIViewController+Navigation.m in Sources */,
340475811E081B3300C92850 /* iosOGLContextFactory.mm in Sources */,
99F3EB0623F418A200C713F8 /* PlacePagePresenter.swift in Sources */,
+ AA1C7E3E269A2DD600BAADF2 /* EditTrackViewController.swift in Sources */,
34AB66561FC5AA330078E451 /* TransportTransitPedestrian.swift in Sources */,
993DF0C823F6BD0600AC231A /* ElevationDetailsViewController.swift in Sources */,
BB8123D62130427E00ADE512 /* MetalContextFactory.mm in Sources */,
diff --git a/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift b/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift
index e4a9e8914c..90f474a6e5 100644
--- a/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift
+++ b/iphone/Maps/UI/EditBookmark/EditBookmarkViewController.swift
@@ -15,8 +15,10 @@ final class EditBookmarkViewController: MWMTableViewController {
case bookmarkGroup
case count
}
+
+ private var editingCompleted: ((Bool) -> Void)?
- @objc var placePageData: PlacePageData!
+ private var placePageData: PlacePageData?
private var noteCell: MWMNoteCell?
private var bookmarkTitle: String?
@@ -30,17 +32,10 @@ final class EditBookmarkViewController: MWMTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
- guard placePageData != nil, let bookmarkData = placePageData.bookmarkData else {
- fatalError("placePageData and bookmarkData can't be nil")
+ guard bookmarkId != FrameworkHelper.invalidBookmarkId() || placePageData != nil else {
+ fatalError("controller should be configured with placePageData or bookmarkId first")
}
- bookmarkTitle = placePageData.previewData.title
- bookmarkDescription = bookmarkData.bookmarkDescription
- bookmarkGroupTitle = bookmarkData.bookmarkCategory
- bookmarkId = bookmarkData.bookmarkId
- bookmarkGroupId = bookmarkData.bookmarkGroupId
- bookmarkColor = bookmarkData.color
-
title = L("bookmark").capitalized
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save,
target: self,
@@ -50,6 +45,39 @@ final class EditBookmarkViewController: MWMTableViewController {
tableView.registerNib(cell: MWMButtonCell.self)
tableView.registerNib(cell: MWMNoteCell.self)
}
+
+ func configure(with bookmarkId: MWMMarkID, editCompletion completion: @escaping (Bool) -> Void) {
+ self.bookmarkId = bookmarkId
+
+ let bm = BookmarksManager.shared()
+ let bookmark = bm.bookmark(withId: bookmarkId)
+
+ bookmarkTitle = bookmark.bookmarkName
+ bookmarkColor = bookmark.bookmarkColor
+
+ bookmarkDescription = bm.description(forBookmarkId: bookmarkId)
+
+ let bookmarkGroup = bm.category(forBookmarkId: bookmarkId)
+ bookmarkGroupId = bookmarkGroup.categoryId
+ bookmarkGroupTitle = bookmarkGroup.title
+
+ editingCompleted = completion
+ }
+
+ @objc(configureWithPlacePageData:)
+ func configure(with placePageData: PlacePageData) {
+ guard let bookmarkData = placePageData.bookmarkData else { fatalError("placePageData and bookmarkData can't be nil") }
+ self.placePageData = placePageData
+
+ bookmarkTitle = placePageData.previewData.title
+ bookmarkDescription = bookmarkData.bookmarkDescription
+ bookmarkGroupTitle = bookmarkData.bookmarkCategory
+ bookmarkId = bookmarkData.bookmarkId
+ bookmarkGroupId = bookmarkData.bookmarkGroupId
+ bookmarkColor = bookmarkData.color
+
+ editingCompleted = nil
+ }
// MARK: - Table view data source
@@ -135,8 +163,11 @@ final class EditBookmarkViewController: MWMTableViewController {
title: bookmarkTitle ?? "",
color: bookmarkColor,
description: bookmarkDescription ?? "")
- FrameworkHelper.updatePlacePageData()
- placePageData.updateBookmarkStatus()
+ if let placePageData = placePageData {
+ FrameworkHelper.updatePlacePageData()
+ placePageData.updateBookmarkStatus()
+ }
+ editingCompleted?(true)
goBack()
}
}
@@ -165,8 +196,10 @@ extension EditBookmarkViewController: MWMNoteCellDelegate {
extension EditBookmarkViewController: MWMButtonCellDelegate {
func cellDidPressButton(_ cell: UITableViewCell) {
BookmarksManager.shared().deleteBookmark(bookmarkId)
- FrameworkHelper.updatePlacePageData()
- placePageData.updateBookmarkStatus()
+ if let placePageData = placePageData {
+ FrameworkHelper.updatePlacePageData()
+ placePageData.updateBookmarkStatus()
+ }
goBack()
}
}
diff --git a/iphone/Maps/UI/EditBookmark/EditTrackViewController.swift b/iphone/Maps/UI/EditBookmark/EditTrackViewController.swift
new file mode 100644
index 0000000000..a046622114
--- /dev/null
+++ b/iphone/Maps/UI/EditBookmark/EditTrackViewController.swift
@@ -0,0 +1,171 @@
+import UIKit
+
+final class EditTrackViewController: MWMTableViewController {
+ private enum Sections: Int {
+ case info
+ case delete
+ case count
+ }
+
+ private enum InfoSectionRows: Int {
+ case title
+ //case color // TODO: need to know which layer color should be changed in track
+ //case lineWidth // TODO: possible new section & ability - edit track line width
+ case bookmarkGroup
+ case count
+ }
+
+ private var editingCompleted: (Bool) -> Void
+
+ private let trackId: MWMTrackID
+ private var trackTitle: String?
+ private var trackGroupTitle: String?
+ private var trackGroupId = FrameworkHelper.invalidCategoryId()
+ //private var trackColor: BookmarkColor // or add TrackColor type
+
+ private let bookmarksManager = BookmarksManager.shared()
+
+ init(trackId: MWMTrackID, editCompletion completion: @escaping (Bool) -> Void) {
+ self.trackId = trackId
+
+ let bm = BookmarksManager.shared()
+ let track = bm.track(withId: trackId)
+
+ trackTitle = track.trackName
+ //trackColor = ....
+
+ let category = bm.category(forTrackId: trackId)
+ trackGroupId = category.categoryId
+ trackGroupTitle = category.title
+
+
+ editingCompleted = completion
+
+ super.init(style: .grouped)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ title = L("track_title")
+ navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .save,
+ target: self,
+ action: #selector(onSave))
+
+ tableView.registerNib(cell: BookmarkTitleCell.self)
+ tableView.registerNib(cell: MWMButtonCell.self)
+ }
+
+ // MARK: - Table view data source
+
+ override func numberOfSections(in tableView: UITableView) -> Int {
+ Sections.count.rawValue
+ }
+
+ override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ switch Sections(rawValue: section) {
+ case .info:
+ return InfoSectionRows.count.rawValue
+ case .delete:
+ return 1
+ default:
+ fatalError()
+ }
+ }
+
+ override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ switch Sections(rawValue: indexPath.section) {
+ case .info:
+ switch InfoSectionRows(rawValue: indexPath.row) {
+ case .title:
+ let cell = tableView.dequeueReusableCell(cell: BookmarkTitleCell.self, indexPath: indexPath)
+ cell.configure(name: trackTitle ?? "", delegate: self, hint: L("placepage_track_name_hint"))
+ return cell
+// case .color:
+// let cell = tableView.dequeueDefaultCell(for: indexPath)
+// cell.accessoryType = .disclosureIndicator
+// cell.textLabel?.text = trackColor.title
+// cell.imageView?.image = circleImageForColor(trackColor.color, frameSize: 28, diameter: 22, iconName: "ic_bm_none")
+// return cell
+ case .bookmarkGroup:
+ let cell = tableView.dequeueDefaultCell(for: indexPath)
+ cell.textLabel?.text = trackGroupTitle
+ cell.imageView?.image = UIImage(named: "ic_folder")
+ cell.imageView?.styleName = "MWMBlack";
+ cell.accessoryType = .disclosureIndicator;
+ return cell;
+ default:
+ fatalError()
+ }
+ case .delete:
+ let cell = tableView.dequeueReusableCell(cell: MWMButtonCell.self, indexPath: indexPath)
+ cell.configure(with: self, title: L("placepage_delete_track_button"), enabled: true)
+ return cell
+ default:
+ fatalError()
+ }
+ }
+
+ override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ switch InfoSectionRows(rawValue: indexPath.row) {
+// case .color:
+// let colorViewController = BookmarkColorViewController(bookmarkColor: trackColor)
+// colorViewController.delegate = self
+// navigationController?.pushViewController(colorViewController, animated: true)
+ case .bookmarkGroup:
+ let groupViewController = SelectBookmarkGroupViewController(groupName: trackGroupTitle ?? "", groupId: trackGroupId)
+ groupViewController.delegate = self
+ navigationController?.pushViewController(groupViewController, animated: true)
+ default:
+ break
+ }
+ }
+
+ // MARK: - Private
+
+ @objc private func onSave() {
+ view.endEditing(true)
+
+ BookmarksManager.shared().updateTrack(trackId, setGroupId: trackGroupId, title: trackTitle ?? "")
+ editingCompleted(true)
+ goBack()
+ }
+}
+
+extension EditTrackViewController: BookmarkTitleCellDelegate {
+ func didFinishEditingTitle(_ title: String) {
+ trackTitle = title
+ }
+}
+
+extension EditTrackViewController: MWMButtonCellDelegate {
+ func cellDidPressButton(_ cell: UITableViewCell) {
+ bookmarksManager.deleteTrack(trackId)
+ goBack()
+ }
+}
+
+//extension EditTrackViewController: BookmarkColorViewControllerDelegate {
+// func bookmarkColorViewController(_ viewController: BookmarkColorViewController, didSelect color: BookmarkColor) {
+// goBack()
+// trackColor = color
+// tableView.reloadRows(at: [IndexPath(row: InfoSectionRows.color.rawValue, section: Sections.info.rawValue)],
+// with: .none)
+// }
+//}
+
+extension EditTrackViewController: SelectBookmarkGroupViewControllerDelegate {
+ func bookmarkGroupViewController(_ viewController: SelectBookmarkGroupViewController,
+ didSelect groupTitle: String,
+ groupId: MWMMarkGroupID) {
+ goBack()
+ trackGroupTitle = groupTitle
+ trackGroupId = groupId
+ tableView.reloadRows(at: [IndexPath(row: InfoSectionRows.bookmarkGroup.rawValue, section: Sections.info.rawValue)],
+ with: .none)
+ }
+}
diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift
index 1b2bacb92f..c00ca493aa 100644
--- a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift
+++ b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift
@@ -9,7 +9,7 @@ protocol PlacePageHeaderViewProtocol: AnyObject {
class PlacePageHeaderViewController: UIViewController {
var presenter: PlacePageHeaderPresenterProtocol?
- @IBOutlet private var titleLabel: UILabel!
+ @IBOutlet private var titleLabel: UILabel?
@IBOutlet private var expandView: UIView!
@IBOutlet private var shadowView: UIView!
@@ -49,6 +49,6 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol {
}
func setTitle(_ title: String) {
- titleLabel.text = title
+ titleLabel?.text = title
}
}
diff --git a/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageCommonLayout.swift b/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageCommonLayout.swift
index 478a1dc4ef..db4d738bb5 100644
--- a/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageCommonLayout.swift
+++ b/iphone/Maps/UI/PlacePage/PlacePageLayout/Layouts/PlacePageCommonLayout.swift
@@ -205,6 +205,10 @@ extension PlacePageCommonLayout {
bookmarkViewController.bookmarkData = bookmarkData
isBookmark = true
}
+ if let title = placePageData.previewData.title {
+ header?.setTitle(title)
+ placePageNavigationViewController.setTitle(title)
+ }
self.presenter?.layoutIfNeeded()
UIView.animate(withDuration: kDefaultAnimationDuration) { [unowned self] in
self.bookmarkViewController.view.isHidden = !isBookmark
diff --git a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm
index ba218a43ff..a941215db0 100644
--- a/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm
+++ b/iphone/Maps/UI/PlacePage/PlacePageManager/MWMPlacePageManager.mm
@@ -204,7 +204,7 @@ using namespace storage;
- (void)editBookmark:(PlacePageData *)data {
MWMEditBookmarkController *editBookmarkController = [[UIStoryboard instance:MWMStoryboardMain]
instantiateViewControllerWithIdentifier:@"MWMEditBookmarkController"];
- editBookmarkController.placePageData = data;
+ [editBookmarkController configureWithPlacePageData:data];
[[MapViewController sharedController].navigationController pushViewController:editBookmarkController animated:YES];
}
diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp
index 7fa8ff1874..4c5cfed03e 100644
--- a/map/bookmark_manager.cpp
+++ b/map/bookmark_manager.cpp
@@ -359,6 +359,23 @@ Track const * BookmarkManager::GetTrack(kml::TrackId trackId) const
return (it != m_tracks.end()) ? it->second.get() : nullptr;
}
+Track * BookmarkManager::GetTrackForEdit(kml::TrackId trackId)
+{
+ CHECK_THREAD_CHECKER(m_threadChecker, ());
+ auto it = m_tracks.find(trackId);
+ if (it == m_tracks.end())
+ return nullptr;
+
+ return it->second.get();
+}
+
+void BookmarkManager::MoveTrack(kml::TrackId trackID, kml::MarkGroupId curGroupID, kml::MarkGroupId newGroupID)
+{
+ CHECK_THREAD_CHECKER(m_threadChecker, ());
+ DetachTrack(trackID, curGroupID);
+ AttachTrack(trackID, newGroupID);
+}
+
void BookmarkManager::AttachTrack(kml::TrackId trackId, kml::MarkGroupId groupId)
{
CHECK_THREAD_CHECKER(m_threadChecker, ());
@@ -370,6 +387,8 @@ void BookmarkManager::AttachTrack(kml::TrackId trackId, kml::MarkGroupId groupId
void BookmarkManager::DetachTrack(kml::TrackId trackId, kml::MarkGroupId groupId)
{
CHECK_THREAD_CHECKER(m_threadChecker, ());
+ auto it = m_tracks.find(trackId);
+ it->second->Detach();
GetBmCategory(groupId)->DetachTrack(trackId);
}
@@ -3375,6 +3394,11 @@ void BookmarkManager::EditSession::DeleteBookmark(kml::MarkId bmId)
m_bmManager.DeleteBookmark(bmId);
}
+Track * BookmarkManager::EditSession::GetTrackForEdit(kml::TrackId trackId)
+{
+ return m_bmManager.GetTrackForEdit(trackId);
+}
+
void BookmarkManager::EditSession::DeleteTrack(kml::TrackId trackId)
{
m_bmManager.DeleteTrack(trackId);
@@ -3411,6 +3435,11 @@ void BookmarkManager::EditSession::DetachBookmark(kml::MarkId bmId, kml::MarkGro
m_bmManager.DetachBookmark(bmId, groupId);
}
+void BookmarkManager::EditSession::MoveTrack(kml::TrackId trackID, kml::MarkGroupId curGroupID, kml::MarkGroupId newGroupID)
+{
+ m_bmManager.MoveTrack(trackID, curGroupID, newGroupID);
+}
+
void BookmarkManager::EditSession::AttachTrack(kml::TrackId trackId, kml::MarkGroupId groupId)
{
m_bmManager.AttachTrack(trackId, groupId);
diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp
index 6401ced6aa..1f586b668a 100644
--- a/map/bookmark_manager.hpp
+++ b/map/bookmark_manager.hpp
@@ -152,7 +152,10 @@ public:
void AttachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId);
void DetachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId);
+
+ Track * GetTrackForEdit(kml::TrackId trackId);
+ void MoveTrack(kml::TrackId trackID, kml::MarkGroupId curGroupID, kml::MarkGroupId newGroupID);
void AttachTrack(kml::TrackId trackId, kml::MarkGroupId groupId);
void DetachTrack(kml::TrackId trackId, kml::MarkGroupId groupId);
@@ -566,9 +569,11 @@ private:
Track * CreateTrack(kml::TrackData && trackData);
+ Track * GetTrackForEdit(kml::TrackId trackId);
void AttachTrack(kml::TrackId trackId, kml::MarkGroupId groupId);
void DetachTrack(kml::TrackId trackId, kml::MarkGroupId groupId);
void DeleteTrack(kml::TrackId trackId);
+ void MoveTrack(kml::TrackId trackID, kml::MarkGroupId curGroupID, kml::MarkGroupId newGroupID);
void ClearGroup(kml::MarkGroupId groupId);
void SetIsVisible(kml::MarkGroupId groupId, bool visible);
diff --git a/map/track.cpp b/map/track.cpp
index 1e5f4c95a8..3503a438f5 100644
--- a/map/track.cpp
+++ b/map/track.cpp
@@ -118,6 +118,11 @@ std::string Track::GetName() const
return GetPreferredBookmarkStr(m_data.m_name);
}
+void Track::SetName(std::string const & name)
+{
+ kml::SetDefaultStr(m_data.m_name, name);
+}
+
m2::RectD Track::GetLimitRect() const
{
if (m_interactionData)
diff --git a/map/track.hpp b/map/track.hpp
index 3720d7f856..bb5c49997f 100644
--- a/map/track.hpp
+++ b/map/track.hpp
@@ -20,6 +20,8 @@ public:
kml::TrackData const & GetData() const { return m_data; }
std::string GetName() const;
+ void SetName(std::string const & name);
+
m2::RectD GetLimitRect() const;
double GetLengthMeters() const;
double GetLengthMeters(size_t pointIndex) const;