|
@@ -53,6 +53,8 @@ static void initialize_tables() {
|
53
|
53
|
self.taskQueue = [[NSOperationQueue alloc] init];
|
54
|
54
|
self.taskQueue.qualityOfService = NSQualityOfServiceUtility;
|
55
|
55
|
self.taskQueue.maxConcurrentOperationCount = 10;
|
|
56
|
+ self.rebindProgressDict = [NSMutableDictionary dictionary];
|
|
57
|
+ self.rebindUploadProgressDict = [NSMutableDictionary dictionary];
|
56
|
58
|
}
|
57
|
59
|
|
58
|
60
|
return self;
|
|
@@ -87,14 +89,33 @@ static void initialize_tables() {
|
87
|
89
|
|
88
|
90
|
@synchronized([RNFetchBlobNetwork class]) {
|
89
|
91
|
[self.requestsTable setObject:request forKey:taskId];
|
|
92
|
+ [self checkProgressConfig];
|
90
|
93
|
}
|
91
|
94
|
}
|
92
|
95
|
|
|
96
|
+- (void) checkProgressConfig {
|
|
97
|
+ //reconfig progress
|
|
98
|
+ [self.rebindProgressDict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, RNFetchBlobProgress * _Nonnull config, BOOL * _Nonnull stop) {
|
|
99
|
+ [self enableProgressReport:key config:config];
|
|
100
|
+ }];
|
|
101
|
+ [self.rebindProgressDict removeAllObjects];
|
|
102
|
+
|
|
103
|
+ //reconfig uploadProgress
|
|
104
|
+ [self.rebindUploadProgressDict enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, RNFetchBlobProgress * _Nonnull config, BOOL * _Nonnull stop) {
|
|
105
|
+ [self enableUploadProgress:key config:config];
|
|
106
|
+ }];
|
|
107
|
+ [self.rebindUploadProgressDict removeAllObjects];
|
|
108
|
+}
|
|
109
|
+
|
93
|
110
|
- (void) enableProgressReport:(NSString *) taskId config:(RNFetchBlobProgress *)config
|
94
|
111
|
{
|
95
|
112
|
if (config) {
|
96
|
113
|
@synchronized ([RNFetchBlobNetwork class]) {
|
97
|
|
- [self.requestsTable objectForKey:taskId].progressConfig = config;
|
|
114
|
+ if (![self.requestsTable objectForKey:taskId]) {
|
|
115
|
+ [self.rebindProgressDict setValue:config forKey:taskId];
|
|
116
|
+ } else {
|
|
117
|
+ [self.requestsTable objectForKey:taskId].progressConfig = config;
|
|
118
|
+ }
|
98
|
119
|
}
|
99
|
120
|
}
|
100
|
121
|
}
|
|
@@ -103,7 +124,11 @@ static void initialize_tables() {
|
103
|
124
|
{
|
104
|
125
|
if (config) {
|
105
|
126
|
@synchronized ([RNFetchBlobNetwork class]) {
|
106
|
|
- [self.requestsTable objectForKey:taskId].uploadProgressConfig = config;
|
|
127
|
+ if (![self.requestsTable objectForKey:taskId]) {
|
|
128
|
+ [self.rebindUploadProgressDict setValue:config forKey:taskId];
|
|
129
|
+ } else {
|
|
130
|
+ [self.requestsTable objectForKey:taskId].uploadProgressConfig = config;
|
|
131
|
+ }
|
107
|
132
|
}
|
108
|
133
|
}
|
109
|
134
|
}
|