From 6e35852a9c0ecb6ec46a230f494ad6144e42ea13 Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Tue, 13 Aug 2024 14:31:21 +0400 Subject: [PATCH 1/6] android upload duration logic --- src/android/AckDatabase.java | 16 ++++++++++++++-- src/android/FileTransferBackground.java | 6 ++++-- src/android/UploadEvent.java | 10 ++++++++++ src/android/UploadEventDao.java | 4 ++++ src/android/UploadTask.java | 12 +++++++++++- 5 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/android/AckDatabase.java b/src/android/AckDatabase.java index ac4cc3ed..283ab98a 100644 --- a/src/android/AckDatabase.java +++ b/src/android/AckDatabase.java @@ -2,22 +2,34 @@ import android.content.Context; +import androidx.annotation.NonNull; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import androidx.room.TypeConverters; +import androidx.room.migration.Migration; +import androidx.sqlite.db.SupportSQLiteDatabase; import androidx.work.Data; -@Database(entities = {UploadEvent.class}, version = 5) +@Database(entities = {UploadEvent.class}, version = 6) @TypeConverters(value = {Data.class}) public abstract class AckDatabase extends RoomDatabase { private static AckDatabase instance; - public static AckDatabase getInstance(final Context context) { + static final Migration MIGRATION_5_6 = new Migration(5, 6) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + // Add the new column to the existing table + database.execSQL("ALTER TABLE upload_events ADD COLUMN uploadDuration INTEGER NOT NULL DEFAULT 0"); + } + }; + + public static synchronized AckDatabase getInstance(final Context context) { if (instance == null) { instance = Room .databaseBuilder(context, AckDatabase.class, "cordova-plugin-background-upload.db") .fallbackToDestructiveMigration() + .addMigrations(MIGRATION_5_6) .build(); } return instance; diff --git a/src/android/FileTransferBackground.java b/src/android/FileTransferBackground.java index 8cb6c393..cf0d55e1 100644 --- a/src/android/FileTransferBackground.java +++ b/src/android/FileTransferBackground.java @@ -81,7 +81,7 @@ private void sendProgress(final String id, int progressPercent) { } } - private void sendSuccess(final String id, final String response, int statusCode) { + private void sendSuccess(final String id, final String response, int statusCode, long uploadDuration) { if (response != null && !response.isEmpty()) { logMessage("eventLabel='Uploader onSuccess' uploadId='" + id + "' response='" + response.substring(0, Math.min(2000, response.length() - 1)) + "'"); } else { @@ -95,6 +95,7 @@ private void sendSuccess(final String id, final String response, int statusCode) .put("state", "UPLOADED") .put("serverResponse", response) .put("statusCode", statusCode) + .put("uploadDuration", uploadDuration) ); } catch (JSONException e) { // Can't really happen but just in case @@ -412,7 +413,8 @@ private void handleAck(final Data ackData) { sendSuccess( ackData.getString(UploadTask.KEY_OUTPUT_ID), response, - ackData.getInt(UploadTask.KEY_OUTPUT_STATUS_CODE, -1 /* If this is sent, something is really wrong */) + ackData.getInt(UploadTask.KEY_OUTPUT_STATUS_CODE, -1 /* If this is sent, something is really wrong */), + ackData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_DURATION, 0) ); } else { diff --git a/src/android/UploadEvent.java b/src/android/UploadEvent.java index 33cf12f7..be079e02 100644 --- a/src/android/UploadEvent.java +++ b/src/android/UploadEvent.java @@ -11,6 +11,7 @@ public class UploadEvent { @PrimaryKey @NonNull private String id; + private long uploadDuration; @ColumnInfo(name = "output_data") @NonNull @@ -19,6 +20,7 @@ public class UploadEvent { public UploadEvent(@NonNull final String id, @NonNull final Data outputData) { this.id = id; this.outputData = outputData; + this.uploadDuration = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_DURATION, 0); } @NonNull @@ -30,4 +32,12 @@ public String getId() { public Data getOutputData() { return outputData; } + + public long getUploadDuration() { + return uploadDuration; + } + + public void setUploadDuration(long uploadDuration) { + this.uploadDuration = uploadDuration; + } } diff --git a/src/android/UploadEventDao.java b/src/android/UploadEventDao.java index fade69d9..f7023939 100644 --- a/src/android/UploadEventDao.java +++ b/src/android/UploadEventDao.java @@ -5,6 +5,7 @@ import androidx.room.Insert; import androidx.room.OnConflictStrategy; import androidx.room.Query; +import androidx.room.Update; import java.util.List; @@ -32,4 +33,7 @@ default void delete(final String id) { delete(ack); } } + + @Update + void update(UploadEvent uploadEvent); } diff --git a/src/android/UploadTask.java b/src/android/UploadTask.java index 919f6e9f..e5058895 100644 --- a/src/android/UploadTask.java +++ b/src/android/UploadTask.java @@ -79,6 +79,8 @@ public final class UploadTask extends Worker { public static final String KEY_OUTPUT_STATUS_CODE = "output_status_code"; public static final String KEY_OUTPUT_FAILURE_REASON = "output_failure_reason"; public static final String KEY_OUTPUT_FAILURE_CANCELED = "output_failure_canceled"; + public static final String KEY_OUTPUT_UPLOAD_DURATION = "output_upload_duration"; + // private static UploadNotification uploadNotification = null; @@ -96,6 +98,9 @@ public void release() { } private static int concurrency = 1; private static Semaphore concurrentUploads = new Semaphore(concurrency, true); private static Mutex concurrencyLock = new Mutex(); + private long startUploadTime; + private long endUploadTime; + private long uploadDuration; public UploadTask(@NonNull Context context, @NonNull WorkerParameters workerParams) { @@ -189,6 +194,8 @@ public Result doWork() { return Result.retry(); } + startUploadTime = System.currentTimeMillis(); + // Register me uploadForegroundNotification.progress(getId(), 0f); handleNotification(); @@ -246,6 +253,8 @@ public Result doWork() { return Result.retry(); } } finally { + endUploadTime = System.currentTimeMillis(); + uploadDuration = endUploadTime - startUploadTime; // Always remove ourselves from the notification uploadForegroundNotification.done(getId()); } @@ -254,7 +263,8 @@ public Result doWork() { final Data.Builder outputData = new Data.Builder() .putString(KEY_OUTPUT_ID, id) .putBoolean(KEY_OUTPUT_IS_ERROR, false) - .putInt(KEY_OUTPUT_STATUS_CODE, (!DEBUG_SKIP_UPLOAD) ? response.code() : 200); + .putInt(KEY_OUTPUT_STATUS_CODE, (!DEBUG_SKIP_UPLOAD) ? response.code() : 200) + .putLong(KEY_OUTPUT_UPLOAD_DURATION, uploadDuration); // Try read the response body, if any try { From db50edbd7dd0a8f5eb40555584f8d409f4df11be Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Tue, 20 Aug 2024 12:27:02 +0400 Subject: [PATCH 2/6] upload duration logic ios --- src/ios/FileUploader.m | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ios/FileUploader.m b/src/ios/FileUploader.m index 6471a3c4..ce2eae50 100644 --- a/src/ios/FileUploader.m +++ b/src/ios/FileUploader.m @@ -1,6 +1,7 @@ #import "FileUploader.h" @interface FileUploader() -@property (nonatomic, strong) NSMutableDictionary* responsesData; +@property (nonatomic, strong) NSMutableDictionary *uploadStartTimes; +@property (nonatomic, strong) NSMutableDictionary *responsesData; @property (nonatomic, strong) AFURLSessionManager *manager; @end @@ -20,6 +21,7 @@ -(id)init{ return nil; [UploadEvent setupStorage]; self.responsesData = [[NSMutableDictionary alloc] init]; + self.uploadStartTimes = [[NSMutableDictionary alloc] init]; NSURLSessionConfiguration* configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:[[NSBundle mainBundle] bundleIdentifier]]; configuration.HTTPMaximumConnectionsPerHost = FileUploader.parallelUploadsLimit; configuration.sessionSendsLaunchEvents = NO; @@ -27,6 +29,8 @@ -(id)init{ __weak FileUploader *weakSelf = self; [self.manager setTaskDidCompleteBlock:^(NSURLSession * _Nonnull session, NSURLSessionTask * _Nonnull task, NSError * _Nullable error) { NSString* uploadId = [NSURLProtocol propertyForKey:kUploadUUIDStrPropertyKey inRequest:task.originalRequest]; + NSDate *startTime = weakSelf.uploadStartTimes[uploadId]; + NSTimeInterval duration = [[NSDate date] timeIntervalSinceDate:startTime]; NSLog(@"[BackgroundUpload] Task %@ completed with error %@", uploadId, error); if (!error){ NSData* serverData = weakSelf.responsesData[@(task.taskIdentifier)]; @@ -36,16 +40,18 @@ -(id)init{ @"id" : uploadId, @"state" : @"UPLOADED", @"statusCode" : @(((NSHTTPURLResponse *)task.response).statusCode), - @"serverResponse" : serverResponse + @"serverResponse" : serverResponse, + @"uploadDuration" : @(duration) }]; } else { [weakSelf saveAndSendEvent:@{ @"id" : uploadId, @"state" : @"FAILED", @"error" : error.localizedDescription, - @"errorCode" : @(error.code) + @"errorCode" : @(error.code), }]; } + [weakSelf.uploadStartTimes removeObjectForKey:uploadId]; // Clean up }]; [self.manager setDataTaskDidReceiveDataBlock:^(NSURLSession * _Nonnull session, NSURLSessionDataTask * _Nonnull dataTask, NSData * _Nonnull data) { @@ -60,7 +66,7 @@ -(id)init{ } -(void)saveAndSendEvent:(NSDictionary*)data{ - UploadEvent*event = [UploadEvent create:data]; + UploadEvent* event = [UploadEvent create:data]; [self sendEvent:[event dataRepresentation]]; } @@ -89,6 +95,9 @@ -(void)addUpload:(NSDictionary *)payload completionHandler:(void (^)(NSError* er completionHandler:^(NSError *error, NSMutableURLRequest *request) { if (error) return handler(error); + + weakSelf.uploadStartTimes[payload[@"id"]] = [NSDate date]; + __block double lastProgressTimeStamp = 0; [[weakSelf.manager uploadTaskWithRequest:request From f9225cd038a1b7b2e63ca221d25d1c7e4140d764 Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Tue, 20 Aug 2024 14:28:07 +0400 Subject: [PATCH 3/6] fix migration crash --- src/ios/FileUploader.h | 1 + src/ios/FileUploader.m | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/ios/FileUploader.h b/src/ios/FileUploader.h index aa17e3b0..139e321c 100644 --- a/src/ios/FileUploader.h +++ b/src/ios/FileUploader.h @@ -1,6 +1,7 @@ #import #import "UploadEvent.h" #import +#import NS_ASSUME_NONNULL_BEGIN @protocol FileUploaderDelegate @optional diff --git a/src/ios/FileUploader.m b/src/ios/FileUploader.m index ce2eae50..76bc9f85 100644 --- a/src/ios/FileUploader.m +++ b/src/ios/FileUploader.m @@ -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", From 5005ce3af4dca74f733194404a5ee7e4b06ca306 Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Wed, 21 Aug 2024 18:35:36 +0400 Subject: [PATCH 4/6] save start and end upload time --- src/android/AckDatabase.java | 4 +++- src/android/FileTransferBackground.java | 8 ++++++-- src/android/UploadEvent.java | 21 +++++++++++++++++++++ src/android/UploadTask.java | 6 +++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/android/AckDatabase.java b/src/android/AckDatabase.java index 283ab98a..1b4c116e 100644 --- a/src/android/AckDatabase.java +++ b/src/android/AckDatabase.java @@ -19,11 +19,13 @@ public abstract class AckDatabase extends RoomDatabase { static final Migration MIGRATION_5_6 = new Migration(5, 6) { @Override public void migrate(@NonNull SupportSQLiteDatabase database) { - // Add the new column to the existing table database.execSQL("ALTER TABLE upload_events ADD COLUMN uploadDuration INTEGER NOT NULL DEFAULT 0"); + database.execSQL("ALTER TABLE upload_events ADD COLUMN startUploadTime INTEGER NOT NULL DEFAULT 0"); + database.execSQL("ALTER TABLE upload_events ADD COLUMN endUploadTime INTEGER NOT NULL DEFAULT 0"); } }; + public static synchronized AckDatabase getInstance(final Context context) { if (instance == null) { instance = Room diff --git a/src/android/FileTransferBackground.java b/src/android/FileTransferBackground.java index cf0d55e1..caf4c038 100644 --- a/src/android/FileTransferBackground.java +++ b/src/android/FileTransferBackground.java @@ -81,7 +81,7 @@ private void sendProgress(final String id, int progressPercent) { } } - private void sendSuccess(final String id, final String response, int statusCode, long uploadDuration) { + private void sendSuccess(final String id, final String response, int statusCode, long uploadDuration, long uploadStartTime, long uploadEndTime) { if (response != null && !response.isEmpty()) { logMessage("eventLabel='Uploader onSuccess' uploadId='" + id + "' response='" + response.substring(0, Math.min(2000, response.length() - 1)) + "'"); } else { @@ -96,6 +96,8 @@ private void sendSuccess(final String id, final String response, int statusCode, .put("serverResponse", response) .put("statusCode", statusCode) .put("uploadDuration", uploadDuration) + .put("uploadStartTime", uploadStartTime) + .put("uploadEndTime", uploadEndTime) ); } catch (JSONException e) { // Can't really happen but just in case @@ -414,7 +416,9 @@ private void handleAck(final Data ackData) { ackData.getString(UploadTask.KEY_OUTPUT_ID), response, ackData.getInt(UploadTask.KEY_OUTPUT_STATUS_CODE, -1 /* If this is sent, something is really wrong */), - ackData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_DURATION, 0) + ackData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_DURATION, 0), + ackData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_START_TIME, 0), + ackData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_END_TIME, 0) ); } else { diff --git a/src/android/UploadEvent.java b/src/android/UploadEvent.java index be079e02..d02b70ca 100644 --- a/src/android/UploadEvent.java +++ b/src/android/UploadEvent.java @@ -12,6 +12,9 @@ public class UploadEvent { @NonNull private String id; private long uploadDuration; + private long uploadStartTime; + private long uploadEndTime; + @ColumnInfo(name = "output_data") @NonNull @@ -21,6 +24,8 @@ public UploadEvent(@NonNull final String id, @NonNull final Data outputData) { this.id = id; this.outputData = outputData; this.uploadDuration = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_DURATION, 0); + this.uploadStartTime = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_START_TIME, 0); + this.uploadEndTime = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_END_TIME, 0); } @NonNull @@ -40,4 +45,20 @@ public long getUploadDuration() { public void setUploadDuration(long uploadDuration) { this.uploadDuration = uploadDuration; } + + public long getUploadStartTime() { + return uploadStartTime; + } + + public void setUploadStartTime(long uploadStartTime) { + this.uploadStartTime = uploadStartTime; + } + + public long getUploadEndTime() { + return uploadEndTime; + } + + public void setUploadEndTime(long uploadEndTime) { + this.uploadEndTime = uploadEndTime; + } } diff --git a/src/android/UploadTask.java b/src/android/UploadTask.java index e5058895..652001d7 100644 --- a/src/android/UploadTask.java +++ b/src/android/UploadTask.java @@ -80,6 +80,8 @@ public final class UploadTask extends Worker { public static final String KEY_OUTPUT_FAILURE_REASON = "output_failure_reason"; public static final String KEY_OUTPUT_FAILURE_CANCELED = "output_failure_canceled"; public static final String KEY_OUTPUT_UPLOAD_DURATION = "output_upload_duration"; + public static final String KEY_OUTPUT_UPLOAD_START_TIME = "output_upload_start_time"; + public static final String KEY_OUTPUT_UPLOAD_END_TIME = "output_upload_end_time"; // @@ -264,7 +266,9 @@ public Result doWork() { .putString(KEY_OUTPUT_ID, id) .putBoolean(KEY_OUTPUT_IS_ERROR, false) .putInt(KEY_OUTPUT_STATUS_CODE, (!DEBUG_SKIP_UPLOAD) ? response.code() : 200) - .putLong(KEY_OUTPUT_UPLOAD_DURATION, uploadDuration); + .putLong(KEY_OUTPUT_UPLOAD_DURATION, uploadDuration) + .putLong(KEY_OUTPUT_UPLOAD_START_TIME, startUploadTime) + .putLong(KEY_OUTPUT_UPLOAD_END_TIME, endUploadTime); // Try read the response body, if any try { From ae1617051451628d99d988dacc90b1ad1ae6480e Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Thu, 22 Aug 2024 10:56:45 +0400 Subject: [PATCH 5/6] refactor android side plugin --- src/android/AckDatabase.java | 2 +- src/android/FileTransferBackground.java | 6 +++--- src/android/UploadEvent.java | 20 ++++++++++---------- src/android/UploadTask.java | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/android/AckDatabase.java b/src/android/AckDatabase.java index 1b4c116e..b6173f3d 100644 --- a/src/android/AckDatabase.java +++ b/src/android/AckDatabase.java @@ -21,7 +21,7 @@ public abstract class AckDatabase extends RoomDatabase { public void migrate(@NonNull SupportSQLiteDatabase database) { database.execSQL("ALTER TABLE upload_events ADD COLUMN uploadDuration INTEGER NOT NULL DEFAULT 0"); database.execSQL("ALTER TABLE upload_events ADD COLUMN startUploadTime INTEGER NOT NULL DEFAULT 0"); - database.execSQL("ALTER TABLE upload_events ADD COLUMN endUploadTime INTEGER NOT NULL DEFAULT 0"); + database.execSQL("ALTER TABLE upload_events ADD COLUMN finishUploadTime INTEGER NOT NULL DEFAULT 0"); } }; diff --git a/src/android/FileTransferBackground.java b/src/android/FileTransferBackground.java index caf4c038..ed8d62f1 100644 --- a/src/android/FileTransferBackground.java +++ b/src/android/FileTransferBackground.java @@ -81,7 +81,7 @@ private void sendProgress(final String id, int progressPercent) { } } - private void sendSuccess(final String id, final String response, int statusCode, long uploadDuration, long uploadStartTime, long uploadEndTime) { + private void sendSuccess(final String id, final String response, int statusCode, long uploadDuration, long startUploadTime, long finishUploadTime) { if (response != null && !response.isEmpty()) { logMessage("eventLabel='Uploader onSuccess' uploadId='" + id + "' response='" + response.substring(0, Math.min(2000, response.length() - 1)) + "'"); } else { @@ -96,8 +96,8 @@ private void sendSuccess(final String id, final String response, int statusCode, .put("serverResponse", response) .put("statusCode", statusCode) .put("uploadDuration", uploadDuration) - .put("uploadStartTime", uploadStartTime) - .put("uploadEndTime", uploadEndTime) + .put("startUploadTime", startUploadTime) + .put("finishUploadTime", finishUploadTime) ); } catch (JSONException e) { // Can't really happen but just in case diff --git a/src/android/UploadEvent.java b/src/android/UploadEvent.java index d02b70ca..5a23b72f 100644 --- a/src/android/UploadEvent.java +++ b/src/android/UploadEvent.java @@ -24,8 +24,8 @@ public UploadEvent(@NonNull final String id, @NonNull final Data outputData) { this.id = id; this.outputData = outputData; this.uploadDuration = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_DURATION, 0); - this.uploadStartTime = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_START_TIME, 0); - this.uploadEndTime = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_END_TIME, 0); + this.startUploadTime = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_START_TIME, 0); + this.finishUploadTime = outputData.getLong(UploadTask.KEY_OUTPUT_UPLOAD_END_TIME, 0); } @NonNull @@ -46,19 +46,19 @@ public void setUploadDuration(long uploadDuration) { this.uploadDuration = uploadDuration; } - public long getUploadStartTime() { - return uploadStartTime; + public long getStartUploadTime() { + return startUploadTime; } - public void setUploadStartTime(long uploadStartTime) { - this.uploadStartTime = uploadStartTime; + public void setStartUploadTime(long startUploadTime) { + this.startUploadTime = startUploadTime; } - public long getUploadEndTime() { - return uploadEndTime; + public long getFinishUploadTime() { + return finishUploadTime; } - public void setUploadEndTime(long uploadEndTime) { - this.uploadEndTime = uploadEndTime; + public void setFinishUploadTime(long finishUploadTime) { + this.finishUploadTime = finishUploadTime; } } diff --git a/src/android/UploadTask.java b/src/android/UploadTask.java index 652001d7..3bda10b8 100644 --- a/src/android/UploadTask.java +++ b/src/android/UploadTask.java @@ -101,7 +101,7 @@ public void release() { } private static Semaphore concurrentUploads = new Semaphore(concurrency, true); private static Mutex concurrencyLock = new Mutex(); private long startUploadTime; - private long endUploadTime; + private long finishUploadTime; private long uploadDuration; public UploadTask(@NonNull Context context, @NonNull WorkerParameters workerParams) { @@ -255,8 +255,8 @@ public Result doWork() { return Result.retry(); } } finally { - endUploadTime = System.currentTimeMillis(); - uploadDuration = endUploadTime - startUploadTime; + finishUploadTime = System.currentTimeMillis(); + uploadDuration = finishUploadTime - startUploadTime; // Always remove ourselves from the notification uploadForegroundNotification.done(getId()); } @@ -268,7 +268,7 @@ public Result doWork() { .putInt(KEY_OUTPUT_STATUS_CODE, (!DEBUG_SKIP_UPLOAD) ? response.code() : 200) .putLong(KEY_OUTPUT_UPLOAD_DURATION, uploadDuration) .putLong(KEY_OUTPUT_UPLOAD_START_TIME, startUploadTime) - .putLong(KEY_OUTPUT_UPLOAD_END_TIME, endUploadTime); + .putLong(KEY_OUTPUT_UPLOAD_END_TIME, finishUploadTime); // Try read the response body, if any try { From 318075cd8cc9c0b815d9d59e65bfbe7fa4849258 Mon Sep 17 00:00:00 2001 From: parveshneedhoo Date: Thu, 22 Aug 2024 11:54:54 +0400 Subject: [PATCH 6/6] refactor --- src/android/UploadEvent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/UploadEvent.java b/src/android/UploadEvent.java index 5a23b72f..1ad87e92 100644 --- a/src/android/UploadEvent.java +++ b/src/android/UploadEvent.java @@ -12,8 +12,8 @@ public class UploadEvent { @NonNull private String id; private long uploadDuration; - private long uploadStartTime; - private long uploadEndTime; + private long startUploadTime; + private long finishUploadTime; @ColumnInfo(name = "output_data")