Skip to content

Commit

Permalink
fix migration crash
Browse files Browse the repository at this point in the history
  • Loading branch information
parveshneedhoo committed Aug 20, 2024
1 parent db50edb commit f9225cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/ios/FileUploader.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import "UploadEvent.h"
#import <AFNetworking/AFNetworking.h>
#import <math.h>
NS_ASSUME_NONNULL_BEGIN
@protocol FileUploaderDelegate <NSObject>
@optional
Expand Down
25 changes: 18 additions & 7 deletions src/ios/FileUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ -(id)init{
NSData* serverData = weakSelf.responsesData[@(task.taskIdentifier)];
NSString* serverResponse = serverData ? [[NSString alloc] initWithData:serverData encoding:NSUTF8StringEncoding] : @"";
[weakSelf.responsesData removeObjectForKey:@(task.taskIdentifier)];
[weakSelf saveAndSendEvent:@{
@"id" : uploadId,
@"state" : @"UPLOADED",
@"statusCode" : @(((NSHTTPURLResponse *)task.response).statusCode),
@"serverResponse" : serverResponse,
@"uploadDuration" : @(duration)
}];
if (isnumber(duration)) {
[weakSelf saveAndSendEvent:@{
@"id" : uploadId,
@"state" : @"UPLOADED",
@"statusCode" : @(((NSHTTPURLResponse *)task.response).statusCode),
@"serverResponse" : serverResponse,
@"uploadDuration" : @(duration)
}];
} else {
[weakSelf saveAndSendEvent:@{
@"id" : uploadId,
@"state" : @"UPLOADED",
@"statusCode" : @(((NSHTTPURLResponse *)task.response).statusCode),
@"serverResponse" : serverResponse,
@"uploadDuration" : @"N/A"
}];
}
} else {
[weakSelf.responsesData removeObjectForKey:@(task.taskIdentifier)];
[weakSelf saveAndSendEvent:@{
@"id" : uploadId,
@"state" : @"FAILED",
Expand Down

0 comments on commit f9225cd

Please sign in to comment.