From 28471f1a424d16604d6d98ed4a2e0d18cc418050 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 27 Mar 2014 15:23:05 -0700 Subject: bring back the iOS net activity spinner --- ios/MBXViewController.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'ios') diff --git a/ios/MBXViewController.mm b/ios/MBXViewController.mm index f723d49edc..9f50ab4793 100644 --- a/ios/MBXViewController.mm +++ b/ios/MBXViewController.mm @@ -449,6 +449,8 @@ namespace llmr { NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@(url.c_str())] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil]; + Response res; if ( ! error && [response isKindOfClass:[NSHTTPURLResponse class]]) @@ -467,6 +469,8 @@ namespace llmr [task resume]; + [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil]; + Request *req = new Request(); req->identifier = task.taskIdentifier; @@ -480,8 +484,16 @@ namespace llmr [[NSURLSession sharedSession] getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { for (NSURLSessionDownloadTask *task in downloadTasks) + { if (task.taskIdentifier == request->identifier) - return [task cancel]; + { + [task cancel]; + + [[NSNotificationCenter defaultCenter] postNotificationName:MBXUpdateActivityNotification object:nil]; + + return; + } + } }]; } -- cgit v1.2.1