mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
SYIOS-40: Any HTTP request can fail due to rate-limiting on the server, and need to be retried.
SDK: Introduced MXHTTPOperation. It replaces NSOperation objects returned by all MXRestClient methods. MXHTTPOperation will help to manage request retries.
This commit is contained in:
parent
21de5f2800
commit
736e2fe4e4
5 changed files with 7 additions and 6 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "MatrixSDKHandler.h"
|
||||
|
||||
// Provide the download progress
|
||||
// object: URL
|
||||
// userInfo: kMediaLoaderProgressRateKey : progress value nested in a NSNumber (range 0->1)
|
||||
|
@ -66,7 +68,7 @@ typedef void (^blockMediaLoader_onError)(NSError *error);
|
|||
NSString *uploadId;
|
||||
CGFloat initialRange;
|
||||
CGFloat range;
|
||||
NSOperation* operation;
|
||||
MXHTTPOperation* operation;
|
||||
}
|
||||
|
||||
@property (strong, readonly) NSMutableDictionary* statisticsDict;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
|
||||
#import "MediaManager.h"
|
||||
#import "MatrixSDKHandler.h"
|
||||
#import "MXCTools.h"
|
||||
|
||||
NSString *const kMediaDownloadProgressNotification = @"kMediaDownloadProgressNotification";
|
||||
|
@ -45,7 +44,7 @@ NSString *const kMediaLoaderProgressDownloadRateKey = @"kMediaLoaderProgressDown
|
|||
downloadData = nil;
|
||||
}
|
||||
else {
|
||||
if (operation.executing) {
|
||||
if (operation.operation.executing) {
|
||||
NSLog(@"media upload has been cancelled (%@)", mediaURL);
|
||||
[operation cancel];
|
||||
operation = nil;
|
||||
|
|
|
@ -22,7 +22,7 @@ NSString *const kRecentRoomUpdatedByBackPagination = @"kRecentRoomUpdatedByBackP
|
|||
@interface RecentRoom() {
|
||||
MXRoom *mxRoom;
|
||||
id backPaginationListener;
|
||||
NSOperation *backPaginationOperation;
|
||||
MXHTTPOperation *backPaginationOperation;
|
||||
|
||||
// Keep reference on last event (used in case of redaction)
|
||||
MXEvent *lastEvent;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
@interface AuthenticationViewController () {
|
||||
// Current request in progress
|
||||
NSOperation *mxAuthFlowRequest;
|
||||
MXHTTPOperation *mxAuthFlowRequest;
|
||||
|
||||
// Array of flows supported by the home server and implemented by the app (for the current auth type)
|
||||
NSMutableArray *supportedFlows;
|
||||
|
|
|
@ -80,7 +80,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
|||
BOOL isFirstPagination;
|
||||
NSUInteger backPaginationAddedMsgNb;
|
||||
NSUInteger backPaginationHandledEventsNb;
|
||||
NSOperation *backPaginationOperation;
|
||||
MXHTTPOperation *backPaginationOperation;
|
||||
CGFloat backPaginationSavedFirstMsgHeight;
|
||||
|
||||
// Members list
|
||||
|
|
Loading…
Reference in a new issue