diff --git a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift index 8813f25677..cce2bd4371 100644 --- a/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/Category settings/CategorySettingsViewController.swift @@ -41,11 +41,11 @@ class CategorySettingsViewController: MWMTableViewController { func configureAccessStatus() { switch MWMBookmarksManager.shared().getCategoryAccessStatus(categoryId!) { case .local: - accessStatusLabel.text = "Not shared" + accessStatusLabel.text = L("not_shared") case .public: - accessStatusLabel.text = "Public" + accessStatusLabel.text = L("bookmarks_public_access") case .private: - accessStatusLabel.text = "Private" + accessStatusLabel.text = L("bookmarks_link_access") case .other: assert(false, "it's not ok that this category has such access status") } diff --git a/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingFlow.storyboard b/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingFlow.storyboard index f69b5cf546..3cf979cbf7 100644 --- a/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingFlow.storyboard +++ b/iphone/Maps/Bookmarks/Categories/Sharing/BookmarksSharingFlow.storyboard @@ -83,7 +83,7 @@ - + @@ -97,6 +97,8 @@ + + @@ -108,7 +110,7 @@ - + @@ -118,6 +120,7 @@ + @@ -139,7 +142,7 @@ - + @@ -244,7 +247,7 @@ - + @@ -258,6 +261,8 @@ + + @@ -310,6 +315,8 @@ + + @@ -320,7 +327,7 @@ - + @@ -349,10 +356,12 @@ + + - + @@ -366,7 +375,7 @@ - + @@ -406,6 +415,7 @@ + @@ -431,6 +441,10 @@ + + + + @@ -449,7 +463,7 @@ - + @@ -458,6 +472,7 @@ + @@ -468,6 +483,9 @@ + + + @@ -498,7 +516,7 @@ - + diff --git a/iphone/Maps/Bookmarks/Categories/Sharing/Tags/SharingTagsViewController.swift b/iphone/Maps/Bookmarks/Categories/Sharing/Tags/SharingTagsViewController.swift index 801021c137..e54fd7d72c 100644 --- a/iphone/Maps/Bookmarks/Categories/Sharing/Tags/SharingTagsViewController.swift +++ b/iphone/Maps/Bookmarks/Categories/Sharing/Tags/SharingTagsViewController.swift @@ -34,14 +34,25 @@ final class SharingTagsViewController: MWMViewController { collectionView.allowsMultipleSelection = true collectionView.contentInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16) + loadTags() + } + + func loadTags() { progress.state = .spinner + self.loadingTagsView.isHidden = false + dataSource.loadTags { success in - self.progress.state = .completed + self.progress.state = .normal self.loadingTagsView.isHidden = true + if success { self.collectionView.reloadData() } else { - //TODO: handle errors + MWMAlertViewController.activeAlert().presentTagsLoadingErrorAlert(okBlock: { [weak self] in + self?.loadTags() + }, cancel: { [weak self] in + self?.onCancel() + }) } } } diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h index 6e7951c7b9..b6d7693dc9 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h @@ -57,6 +57,9 @@ rightButtonAction:(nonnull MWMVoidBlock)rightButton leftButtonAction:(nonnull MWMVoidBlock)leftButton; +- (void)presentTagsLoadingErrorAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock + cancelBlock:(nonnull MWMVoidBlock)cancelBlock; + - (void)presentDefaultAlertWithTitle:(nonnull NSString *)title message:(nullable NSString *)message rightButtonTitle:(nonnull NSString *)rightButtonTitle diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index 235e38e1de..1c0e85dfa4 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -255,6 +255,13 @@ static NSString * const kAlertControllerNibIdentifier = @"MWMAlertViewController leftButtonAction:leftButton]]; } +- (void)presentTagsLoadingErrorAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock + cancelBlock:(nonnull MWMVoidBlock)cancelBlock +{ + [self displayAlert:[MWMAlert tagsLoadingErrorAlertWithOkBlock:okBlock + cancelBlock:cancelBlock]]; +} + - (void)presentDefaultAlertWithTitle:(nonnull NSString *)title message:(nullable NSString *)message rightButtonTitle:(nonnull NSString *)rightButtonTitle diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h index dfa2baeb75..e6c0c2b255 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.h @@ -44,6 +44,7 @@ + (MWMAlert *)restoreBookmarkAlertWithMessage:(NSString *)message rightButtonAction:(MWMVoidBlock)rightButton leftButtonAction:(MWMVoidBlock)leftButton; ++ (MWMAlert *)tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock; + (MWMAlert *)defaultAlertWithTitle:(NSString *)title message:(NSString *)message diff --git a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm index 44e00e34c9..46fb5d94b7 100644 --- a/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/BaseAlert/MWMAlert.mm @@ -192,6 +192,11 @@ leftButtonAction:leftButton]; } ++ (MWMAlert *)tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock +{ + return [MWMDefaultAlert tagsLoadingErrorAlertWithOkBlock:okBlock cancelBlock:cancelBlock]; +} + + (MWMAlert *)defaultAlertWithTitle:(NSString *)title message:(NSString *)message rightButtonTitle:(NSString *)rightButtonTitle diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h index e84ea62119..c0381a3a78 100644 --- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h +++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.h @@ -44,6 +44,8 @@ rightButtonAction:(MWMVoidBlock)rightButton leftButtonAction:(MWMVoidBlock)leftButton; ++ (instancetype)tagsLoadingErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock; + + (instancetype)defaultAlertWithTitle:(NSString *)title message:(NSString *)message rightButtonTitle:(NSString *)rightButtonTitle diff --git a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm index e666e1656e..6441a2a269 100644 --- a/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm +++ b/iphone/Maps/Classes/CustomAlert/DefaultAlert/MWMDefaultAlert.mm @@ -450,6 +450,20 @@ static NSString * const kDefaultAlertNibName = @"MWMDefaultAlert"; statisticsEvent:nil]; } ++ (instancetype)tagsLoadingErrorAlertWithOkBlock:(MWMVoidBlock)okBlock cancelBlock:(MWMVoidBlock)cancelBlock +{ + MWMDefaultAlert * alert = + [self defaultAlertWithTitle:L(@"title_error_downloading_bookmarks") + message:L(@"tags_loading_error_subtitle") + rightButtonTitle:L(@"downloader_retry") + leftButtonTitle:L(@"cancel") + rightButtonAction:okBlock + statisticsEvent:nil]; + alert.leftButtonAction = cancelBlock; + [alert setNeedsCloseAlertAfterEnterBackground]; + return alert; +} + + (instancetype)defaultAlertWithTitle:(NSString *)title message:(NSString *)message rightButtonTitle:(NSString *)rightButtonTitle