forked from organicmaps/organicmaps
[ios] no need to use url into upload bookmark completion block
This commit is contained in:
parent
a57b39e2c7
commit
0c7444e7ff
6 changed files with 11 additions and 14 deletions
|
@ -233,7 +233,7 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
with: .automatic)
|
||||
}
|
||||
|
||||
manager.uploadAndPublishCategory(withId: category.categoryId, progress: nil) { (_, error) in
|
||||
manager.uploadAndPublishCategory(withId: category.categoryId, progress: nil) { (error) in
|
||||
if let error = error as NSError? {
|
||||
self.uploadAndPublishCell.cellState = .normal
|
||||
self.showErrorAlert(error)
|
||||
|
@ -277,7 +277,7 @@ final class BookmarksSharingViewController: MWMTableViewController {
|
|||
section: s.privateSectionIndex)],
|
||||
with: .automatic)
|
||||
}
|
||||
s.manager.uploadAndGetDirectLinkCategory(withId: s.category.categoryId, progress: nil) { (_, 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)
|
||||
|
|
|
@ -63,7 +63,7 @@ final class EditOnWebViewController: MWMViewController {
|
|||
sendMeLinkButton.setTitle(nil, for: .normal)
|
||||
MWMBookmarksManager.shared().uploadCategory(withId: category.categoryId, progress: { (progress) in
|
||||
|
||||
}) { [weak self] (url, error) in
|
||||
}) { [weak self] (error) in
|
||||
guard let self = self else { return }
|
||||
self.activityIndicator.isHidden = true
|
||||
self.sendMeLinkButton.isEnabled = true
|
||||
|
|
|
@ -179,8 +179,7 @@ NSString * const CloudErrorToString(Cloud::SynchronizationResult result)
|
|||
auto observer = self.catalogObservers[[NSString stringWithFormat:@"%lld", originCategoryId]];
|
||||
if (observer)
|
||||
{
|
||||
NSURL * url = [self sharingUrlForCategoryId:resultCategoryId];
|
||||
[observer onUploadComplete:uploadResult withUrl:url];
|
||||
[observer onUploadComplete:uploadResult];
|
||||
[self.catalogObservers removeObjectForKey:observer.categoryId];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -37,5 +37,4 @@ static NSString * const kCategoryUploadStatusKey = @"kCategoryUploadStatusKey";
|
|||
|
||||
typedef void (^ProgressBlock)(MWMCategoryProgress progress);
|
||||
typedef void (^DownloadCompletionBlock)(UInt64 categoryId, NSError * error);
|
||||
typedef void (^UploadCompletionBlock)(NSURL * url, NSError * error);
|
||||
|
||||
typedef void (^UploadCompletionBlock)(NSError* error);
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
- (void)onImportStart;
|
||||
- (void)onImportCompleteSuccessful:(BOOL)success forCategoryId:(UInt64)categoryId;
|
||||
- (void)onUploadStart;
|
||||
- (void)onUploadComplete:(BookmarkCatalog::UploadResult)result withUrl:(NSURL *)categoryUrl;
|
||||
- (void)onUploadComplete:(BookmarkCatalog::UploadResult)result;
|
||||
|
||||
@end
|
||||
|
|
|
@ -61,14 +61,13 @@
|
|||
self.progressBlock(MWMCategoryProgressUploadStarted);
|
||||
}
|
||||
|
||||
- (void)onUploadComplete:(BookmarkCatalog::UploadResult)result withUrl:(NSURL *)categoryUrl
|
||||
{
|
||||
- (void)onUploadComplete:(BookmarkCatalog::UploadResult)result {
|
||||
MWMCategoryUploadStatus uploadStatus;
|
||||
switch (result)
|
||||
{
|
||||
case BookmarkCatalog::UploadResult::Success:
|
||||
if (self.uploadCompletionBlock)
|
||||
self.uploadCompletionBlock(categoryUrl, nil);
|
||||
self.uploadCompletionBlock(nil);
|
||||
return;
|
||||
case BookmarkCatalog::UploadResult::NetworkError:
|
||||
uploadStatus = MWMCategoryUploadStatusNetworkError;
|
||||
|
@ -90,9 +89,9 @@
|
|||
break;
|
||||
}
|
||||
if (self.uploadCompletionBlock)
|
||||
self.uploadCompletionBlock(nil, [[NSError alloc] initWithDomain:kCatalogErrorDomain
|
||||
code:kCategoryUploadFailedCode
|
||||
userInfo:@{kCategoryUploadStatusKey : @(uploadStatus)}]);
|
||||
self.uploadCompletionBlock([[NSError alloc] initWithDomain:kCatalogErrorDomain
|
||||
code:kCategoryUploadFailedCode
|
||||
userInfo:@{kCategoryUploadStatusKey: @(uploadStatus)}]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue