Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Mage/CoreData/Feed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ import CoreData
return json[FeedKey.id.key] as? String;
}

@objc public static func operationToPullFeeds(eventId: NSNumber, context: NSManagedObjectContext) -> URLSessionDataTask? {
@objc public static func operationToPullFeeds(eventId: NSNumber, context: NSManagedObjectContext, completion: (() -> Void)? = nil) -> URLSessionDataTask? {
guard let baseURL = MageServer.baseURL() else {
return nil
}
Expand Down Expand Up @@ -141,8 +141,10 @@ import CoreData
}
}
try? context.save()
completion?()
}
}, failure: { task, error in
NSLog("Error: operationToPullFeeds: \(error.localizedDescription)")
});
return task;
}
Expand Down Expand Up @@ -171,9 +173,9 @@ import CoreData
return task;
}

@objc public static func refreshFeeds(eventId: NSNumber, context: NSManagedObjectContext) {
@objc public static func refreshFeeds(eventId: NSNumber, context: NSManagedObjectContext, completion: (() -> Void)? = nil) {
let manager = MageSessionManager.shared();
let task = Feed.operationToPullFeeds(eventId: eventId, context: context);
let task = Feed.operationToPullFeeds(eventId: eventId, context: context, completion: completion);
manager?.addTask(task);
}

Expand Down
4 changes: 3 additions & 1 deletion Mage/Mixins/HasMapSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class HasMapSettingsMixin: NSObject, MapMixin {
@objc func mapSettingsButtonTapped(_ sender: UIButton) {
settingsCoordinator = MapSettingsCoordinator(rootViewController: hasMapSettings.navigationController, scheme: hasMapSettings.scheme, context: context)
settingsCoordinator?.delegate = self
settingsCoordinator?.start()
if let eventId = Server.currentEventId(), let context = self.context {
Feed.refreshFeeds(eventId: eventId, context: context, completion: self.settingsCoordinator?.start)
}
}

func setupMapSettingsButton() {
Expand Down