@@ -1094,16 +1094,15 @@ private void startFileUpload() {
10941094 }
10951095
10961096 @ NonNull
1097- private MultipartBody .Part prepareFilePart (String partName , File file ) {
1097+ private MultipartBody .Part prepareFilePart (String partName , File file , int notificationId ) {
10981098 // create UploadProgressRequest instance from file
1099- // TODO: change for multiple uploads
11001099 UploadProgressRequest request = new UploadProgressRequest (file , new UploadProgressRequest .UploadCallbacks () {
11011100 @ Override
11021101 public void onProgressUpdate (int percentage , String progress , int notificationId ) {
11031102 // update notification
11041103 progressNotification (notificationId , percentage , progress );
11051104 }
1106- }, 100 );
1105+ }, notificationId );
11071106
11081107 // MultipartBody.Part is used to send also the actual file name
11091108 return MultipartBody .Part .createFormData (partName , file .getName (), request );
@@ -1175,15 +1174,15 @@ private void endNotification(int notificationId, String content) {
11751174 * @param file on local storage
11761175 */
11771176 private void uploadFile (final File file ) {
1177+ final int notifId = (int ) ((new Date ().getTime () / 1000L ) % Integer .MAX_VALUE );
11781178
11791179 // MultipartBody.Part is used to send also the actual file name
1180- MultipartBody .Part body = prepareFilePart ("file" , file );
1180+ MultipartBody .Part body = prepareFilePart ("file" , file , notifId );
11811181
11821182 final String loadingMsg = getResources ().getString (R .string .uploading_message );
11831183
11841184 // start notification
1185- // TODO: handle different notif ids
1186- setNotification (100 , getString (R .string .init_notif_title ));
1185+ setNotification (notifId , getString (R .string .init_notif_title ));
11871186
11881187 // finally, execute the request
11891188 // create upload service client
@@ -1195,7 +1194,7 @@ public void onSuccess(Call<UploadResponse> call, Response<UploadResponse> respon
11951194 UploadResponse uploadResponse = response .body ();
11961195 filePathOnServer = uploadResponse .getUri ();
11971196 if (!filePathOnServer .equals ("" )) {
1198- endNotification (100 , getString (R .string .finish_notif_title ));
1197+ endNotification (notifId , getString (R .string .finish_notif_title ));
11991198 // remove loading message from the screen
12001199 sendingMessage (false , loadingMsg );
12011200
0 commit comments