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 <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
#import "MatrixSDKHandler.h"
|
||||||
|
|
||||||
// Provide the download progress
|
// Provide the download progress
|
||||||
// object: URL
|
// object: URL
|
||||||
// userInfo: kMediaLoaderProgressRateKey : progress value nested in a NSNumber (range 0->1)
|
// userInfo: kMediaLoaderProgressRateKey : progress value nested in a NSNumber (range 0->1)
|
||||||
|
@ -66,7 +68,7 @@ typedef void (^blockMediaLoader_onError)(NSError *error);
|
||||||
NSString *uploadId;
|
NSString *uploadId;
|
||||||
CGFloat initialRange;
|
CGFloat initialRange;
|
||||||
CGFloat range;
|
CGFloat range;
|
||||||
NSOperation* operation;
|
MXHTTPOperation* operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (strong, readonly) NSMutableDictionary* statisticsDict;
|
@property (strong, readonly) NSMutableDictionary* statisticsDict;
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "MediaManager.h"
|
#import "MediaManager.h"
|
||||||
#import "MatrixSDKHandler.h"
|
|
||||||
#import "MXCTools.h"
|
#import "MXCTools.h"
|
||||||
|
|
||||||
NSString *const kMediaDownloadProgressNotification = @"kMediaDownloadProgressNotification";
|
NSString *const kMediaDownloadProgressNotification = @"kMediaDownloadProgressNotification";
|
||||||
|
@ -45,7 +44,7 @@ NSString *const kMediaLoaderProgressDownloadRateKey = @"kMediaLoaderProgressDown
|
||||||
downloadData = nil;
|
downloadData = nil;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (operation.executing) {
|
if (operation.operation.executing) {
|
||||||
NSLog(@"media upload has been cancelled (%@)", mediaURL);
|
NSLog(@"media upload has been cancelled (%@)", mediaURL);
|
||||||
[operation cancel];
|
[operation cancel];
|
||||||
operation = nil;
|
operation = nil;
|
||||||
|
|
|
@ -22,7 +22,7 @@ NSString *const kRecentRoomUpdatedByBackPagination = @"kRecentRoomUpdatedByBackP
|
||||||
@interface RecentRoom() {
|
@interface RecentRoom() {
|
||||||
MXRoom *mxRoom;
|
MXRoom *mxRoom;
|
||||||
id backPaginationListener;
|
id backPaginationListener;
|
||||||
NSOperation *backPaginationOperation;
|
MXHTTPOperation *backPaginationOperation;
|
||||||
|
|
||||||
// Keep reference on last event (used in case of redaction)
|
// Keep reference on last event (used in case of redaction)
|
||||||
MXEvent *lastEvent;
|
MXEvent *lastEvent;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
@interface AuthenticationViewController () {
|
@interface AuthenticationViewController () {
|
||||||
// Current request in progress
|
// 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)
|
// Array of flows supported by the home server and implemented by the app (for the current auth type)
|
||||||
NSMutableArray *supportedFlows;
|
NSMutableArray *supportedFlows;
|
||||||
|
|
|
@ -80,7 +80,7 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
|
||||||
BOOL isFirstPagination;
|
BOOL isFirstPagination;
|
||||||
NSUInteger backPaginationAddedMsgNb;
|
NSUInteger backPaginationAddedMsgNb;
|
||||||
NSUInteger backPaginationHandledEventsNb;
|
NSUInteger backPaginationHandledEventsNb;
|
||||||
NSOperation *backPaginationOperation;
|
MXHTTPOperation *backPaginationOperation;
|
||||||
CGFloat backPaginationSavedFirstMsgHeight;
|
CGFloat backPaginationSavedFirstMsgHeight;
|
||||||
|
|
||||||
// Members list
|
// Members list
|
||||||
|
|
Loading…
Reference in a new issue