From 0bac9fefc667b98372fa2b6532c228f73dc25516 Mon Sep 17 00:00:00 2001 From: hogliux Date: Fri, 17 Apr 2015 17:44:56 +0100 Subject: [PATCH] Add URL stream progress support on OSX/iOS --- modules/juce_core/native/juce_mac_Network.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/juce_core/native/juce_mac_Network.mm b/modules/juce_core/native/juce_mac_Network.mm index a0ddef5729..7754e0ba31 100644 --- a/modules/juce_core/native/juce_mac_Network.mm +++ b/modules/juce_core/native/juce_mac_Network.mm @@ -128,7 +128,8 @@ public: hasFailed (false), hasFinished (false), numRedirectsToFollow (maxRedirects), - numRedirects (0) + numRedirects (0), + latestTotalBytes (0) { static DelegateClass cls; delegate = [cls.createInstance() init]; @@ -152,7 +153,7 @@ public: while (isThreadRunning() && ! initialised) { if (callback != nullptr) - callback (context, -1, (int) [[request HTTPBody] length]); + callback (context, latestTotalBytes, (int) [[request HTTPBody] length]); Thread::sleep (1); } @@ -245,8 +246,9 @@ public: initialised = true; } - void didSendBodyData (NSInteger /*totalBytesWritten*/, NSInteger /*totalBytesExpected*/) + void didSendBodyData (NSInteger totalBytesWritten, NSInteger /*totalBytesExpected*/) { + latestTotalBytes = totalBytesWritten; } void finishedLoading() @@ -280,6 +282,7 @@ public: bool initialised, hasFailed, hasFinished; const int numRedirectsToFollow; int numRedirects; + int latestTotalBytes; private: //==============================================================================