forked from organicmaps/organicmaps
[iOS] minor fixes after review
This commit is contained in:
parent
da41558057
commit
e5475e3b45
9 changed files with 21 additions and 32 deletions
|
@ -220,6 +220,7 @@ extension BMCViewController: UITableViewDataSource {
|
|||
func dequeCell<Cell>(_ cell: Cell.Type) -> Cell where Cell: UITableViewCell {
|
||||
return tableView.dequeueReusableCell(cell: cell, indexPath: indexPath)
|
||||
}
|
||||
|
||||
switch viewModel.sectionType(section: indexPath.section) {
|
||||
case .permissions:
|
||||
let permission = viewModel.permission(at: indexPath.row)
|
||||
|
|
|
@ -148,8 +148,7 @@ extension BMCDefaultViewModel {
|
|||
}
|
||||
|
||||
func deleteCategory(at index: Int) {
|
||||
guard let section = sections.index(of: .categories)
|
||||
else {
|
||||
guard let section = sections.index(of: .categories) else {
|
||||
assertionFailure()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ final class BMCCategoryCell: MWMTableViewCell {
|
|||
case .other:
|
||||
assert(false, "We don't expect category with .other status here")
|
||||
accessImageView.image = nil
|
||||
accessString = "Other"
|
||||
accessString = ""
|
||||
}
|
||||
|
||||
let placesString = String(format: L("bookmarks_places"), category.bookmarksCount + category.trackCount)
|
||||
|
|
|
@ -27,11 +27,11 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
private let publishUpdateRowIndex = 2
|
||||
|
||||
private var rowsInPublicSection: Int {
|
||||
return category.accessStatus == .public ? (uploadAndPublishCell.cellState == .updating ? 2 : 3) : 2
|
||||
return (category.accessStatus == .public && uploadAndPublishCell.cellState != .updating) ? 3 : 2
|
||||
}
|
||||
|
||||
private var rowsInPrivateSection: Int {
|
||||
return category.accessStatus == .private ? (getDirectLinkCell.cellState == .updating ? 2 : 3) : 2
|
||||
return (category.accessStatus == .private && getDirectLinkCell.cellState != .updating) ? 3 : 2
|
||||
}
|
||||
|
||||
@IBOutlet weak var uploadAndPublishCell: UploadActionCell!
|
||||
|
@ -59,14 +59,11 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
assert(category != nil, "We can't share nothing")
|
||||
|
||||
title = L("sharing_options")
|
||||
configureActionCells()
|
||||
|
||||
guard category != nil else {
|
||||
assert(false, "We can't share nothing")
|
||||
return
|
||||
}
|
||||
|
||||
switch category.accessStatus {
|
||||
case .local:
|
||||
|
@ -187,8 +184,8 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
private func uploadAndPublish(update: Bool) {
|
||||
if !update {
|
||||
guard let tags = sharingTags, let userStatus = sharingUserStatus else {
|
||||
assert(false, "not enough data for public sharing")
|
||||
return
|
||||
assert(false, "not enough data for public sharing")
|
||||
return
|
||||
}
|
||||
|
||||
manager.setCategory(category.categoryId, authorType: userStatus)
|
||||
|
@ -202,8 +199,7 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
with: .automatic)
|
||||
}
|
||||
|
||||
manager.uploadAndPublishCategory(withId: category.categoryId, progress: { (progress) in
|
||||
}) { (_, error) in
|
||||
manager.uploadAndPublishCategory(withId: category.categoryId, progress: nil) { (_, error) in
|
||||
if let error = error as NSError? {
|
||||
self.uploadAndPublishCell.cellState = .normal
|
||||
self.showErrorAlert(error)
|
||||
|
@ -247,8 +243,7 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
section: s.privateSectionIndex)],
|
||||
with: .automatic)
|
||||
}
|
||||
s.manager.uploadAndGetDirectLinkCategory(withId: s.category.categoryId, progress: { (progress) in
|
||||
}, completion: { (_, error) in
|
||||
s.manager.uploadAndGetDirectLinkCategory(withId: s.category.categoryId, progress: nil) { (_, error) in
|
||||
if let error = error as NSError? {
|
||||
s.getDirectLinkCell.cellState = .normal
|
||||
s.showErrorAlert(error)
|
||||
|
@ -265,7 +260,7 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
Toast.toast(withText: L("direct_link_updating_success")).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,7 @@ final class EditOnWebViewController: MWMViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
guard category != nil else {
|
||||
assert(false, "Category must be set")
|
||||
}
|
||||
assert(category != nil, "Category must be set")
|
||||
}
|
||||
|
||||
override var hasNavigationBar: Bool {
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated {
|
||||
[viewControllers enumerateObjectsUsingBlock:^(UIViewController * vc, NSUInteger idx, BOOL * stop) {
|
||||
if (idx == viewControllers.count - 1)
|
||||
*stop = YES;
|
||||
return;
|
||||
|
||||
vc.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@""
|
||||
style:UIBarButtonItemStylePlain
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMActivityIndicator : UIView
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -78,15 +78,15 @@ typedef void (^LoadTagsCompletionBlock)(NSArray<MWMTagGroup *> * _Nullable tags,
|
|||
- (void)setCategory:(MWMMarkGroupID)groupId authorType:(MWMCategoryAuthorType)author;
|
||||
|
||||
- (void)uploadAndGetDirectLinkCategoryWithId:(MWMMarkGroupID)itemId
|
||||
progress:(ProgressBlock)progress
|
||||
progress:(_Nullable ProgressBlock)progress
|
||||
completion:(UploadCompletionBlock)completion;
|
||||
|
||||
- (void)uploadAndPublishCategoryWithId:(MWMMarkGroupID)itemId
|
||||
progress:(ProgressBlock)progress
|
||||
progress:(_Nullable ProgressBlock)progress
|
||||
completion:(UploadCompletionBlock)completion;
|
||||
|
||||
- (void)uploadCategoryWithId:(MWMMarkGroupID)itemId
|
||||
progress:(ProgressBlock)progress
|
||||
progress:(_Nullable ProgressBlock)progress
|
||||
completion:(UploadCompletionBlock)completion;
|
||||
|
||||
@end
|
||||
|
|
|
@ -555,7 +555,7 @@ NSString * const CloudErrorToString(Cloud::SynchronizationResult result)
|
|||
auto serverId = self.bm.GetCategoryServerId(groupId);
|
||||
auto language = [[AppInfo sharedInfo] twoLetterLanguageId].UTF8String;
|
||||
NSString * urlString = @(self.bm.GetCatalog().GetWebEditorUrl(serverId, language).c_str());
|
||||
return urlString ? [NSURL URLWithString:urlString] : nil;
|
||||
return [NSURL URLWithString:urlString];
|
||||
}
|
||||
|
||||
- (void)downloadItemWithId:(NSString *)itemId
|
||||
|
@ -613,7 +613,7 @@ NSString * const CloudErrorToString(Cloud::SynchronizationResult result)
|
|||
|
||||
- (NSArray<MWMCategory *> *)userCategories
|
||||
{
|
||||
NSMutableArray * result = [NSMutableArray array];
|
||||
NSMutableArray<MWMCategory *> * result = [NSMutableArray array];
|
||||
auto const & list = self.bm.GetBmGroupsIdList();
|
||||
for (auto const & groupId : list)
|
||||
{
|
||||
|
@ -625,7 +625,7 @@ NSString * const CloudErrorToString(Cloud::SynchronizationResult result)
|
|||
|
||||
- (NSArray<MWMCategory *> *)categoriesFromCatalog
|
||||
{
|
||||
NSMutableArray * result = [NSMutableArray array];
|
||||
NSMutableArray<MWMCategory *> * result = [NSMutableArray array];
|
||||
auto const & list = self.bm.GetBmGroupsIdList();
|
||||
for (auto const & groupId : list)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue