Before

…lines 1–18 unchanged (18 lines)
19import com.nextcloud.client.device.PowerManagementService
20import com.nextcloud.client.jobs.BackgroundJobManager
21import com.nextcloud.client.jobs.BackgroundJobManagerImpl
22import com.nextcloud.client.jobs.utils.UploadErrorNotificationManager
23import com.nextcloud.client.network.ConnectivityService
24import com.nextcloud.client.preferences.AppPreferences
25import com.nextcloud.model.WorkerState
26import com.nextcloud.model.WorkerStateObserver
27import com.nextcloud.utils.ForegroundServiceHelper
28import com.nextcloud.utils.extensions.getPercent
29import com.nextcloud.utils.extensions.updateStatus
30import com.owncloud.android.R
31import com.owncloud.android.datamodel.FileDataStorageManager
32import com.owncloud.android.datamodel.ForegroundServiceType
…lines 33–73 unchanged (41 lines)
74 const val CURRENT_BATCH_INDEX = "batch_index"
75 const val TOTAL_UPLOAD_SIZE = "total_upload_size"
76 const val SHOW_SAME_FILE_ALREADY_EXISTS_NOTIFICATION = "show_same_file_already_exists_notification"
77
78 var currentUploadFileOperation: UploadFileOperation? = null
79
80 private const val UPLOADS_ADDED_MESSAGE = "UPLOADS_ADDED"
81 private const val UPLOAD_START_MESSAGE = "UPLOAD_START"
82 private const val UPLOAD_FINISH_MESSAGE = "UPLOAD_FINISH"
83
84 private const val BATCH_SIZE = 100
85
86 const val EXTRA_UPLOAD_RESULT = "RESULT"
87 const val EXTRA_REMOTE_PATH = "REMOTE_PATH"
88 const val EXTRA_OLD_REMOTE_PATH = "OLD_REMOTE_PATH"
…lines 89–92 unchanged (4 lines)
93 const val ACTION_CANCEL_BROADCAST = "CANCEL"
94 const val LOCAL_BEHAVIOUR_COPY = 0
95 const val LOCAL_BEHAVIOUR_MOVE = 1
96 const val LOCAL_BEHAVIOUR_FORGET = 2
97 const val LOCAL_BEHAVIOUR_DELETE = 3
98
99 fun getUploadsAddedMessage(): String = FileUploadWorker::class.java.name + UPLOADS_ADDED_MESSAGE
100
101 fun getUploadStartMessage(): String = FileUploadWorker::class.java.name + UPLOAD_START_MESSAGE
102
103 fun getUploadFinishMessage(): String = FileUploadWorker::class.java.name + UPLOAD_FINISH_MESSAGE
104
105 fun cancelCurrentUpload(remotePath: String, accountName: String, onCompleted: () -> Unit) {
106 currentUploadFileOperation?.let {
107 if (it.remotePath == remotePath && it.user.accountName == accountName) {
108 it.cancel(ResultCode.USER_CANCELLED)
109 onCompleted()
…lines 110–139 unchanged (30 lines)
140
141 trySetForeground()
142
143 val result = uploadFiles()
144 backgroundJobManager.logEndOfWorker(workerName, result)
145 notificationManager.dismissNotification()
146 if (result == Result.success()) {
147 setIdleWorkerState()
148 }
149 result
150 } catch (t: Throwable) {
151 Log_OC.e(TAG, "Error caught at FileUploadWorker $t")
152 cleanup()
153 Result.failure()
154 }
…lines 155–197 unchanged (43 lines)
198 .setSilent(true)
199 .build()
200
201 private fun cleanup() {
202 Log_OC.e(TAG, "FileUploadWorker stopped")
203
204 setIdleWorkerState()
205 currentUploadFileOperation?.cancel(null)
206 notificationManager.dismissNotification()
207 }
208
209 private fun setIdleWorkerState() {
210 WorkerStateObserver.send(WorkerState.FileUploadCompleted(currentUploadFileOperation?.file))
211 }
212
213 @Suppress("ReturnCount", "LongMethod", "DEPRECATION")
214 private suspend fun uploadFiles(): Result = withContext(Dispatchers.IO) {
215 val accountName = inputData.getString(ACCOUNT)
216 if (accountName == null) {
217 Log_OC.e(TAG, "accountName is null")
…lines 218–260 unchanged (43 lines)
261 }
262
263 if (canExitEarly()) {
264 notificationManager.showConnectionErrorNotification()
265 return@withContext Result.failure()
266 }
267
268 val operation = createUploadFileOperation(upload, user)
269 currentUploadFileOperation = operation
270 fileUploadBroadcastManager.sendStarted(operation, context)
271
272 val currentIndex = (index + 1)
273 val currentUploadIndex = (currentIndex + previouslyUploadedFileSize)
…lines 274–303 unchanged (30 lines)
304 result: RemoteOperationResult<*>
305 ) {
306 val shouldBroadcast =
307 (totalUploadSize > BATCH_SIZE && currentUploadIndex > 0) && currentUploadIndex % BATCH_SIZE == 0
308
309 if (shouldBroadcast) {
310 // delay broadcast
311 fileUploadBroadcastManager.sendFinished(
312 operation,
313 result,
314 operation.oldFile?.storagePath,
315 context
316 )
…lines 317–439 unchanged (123 lines)

After

…lines 1–18 unchanged (18 lines)
19import com.nextcloud.client.device.PowerManagementService
20import com.nextcloud.client.jobs.BackgroundJobManager
21import com.nextcloud.client.jobs.BackgroundJobManagerImpl
22import com.nextcloud.client.jobs.utils.UploadErrorNotificationManager
23import com.nextcloud.client.network.ConnectivityService
24import com.nextcloud.client.preferences.AppPreferences
25import com.nextcloud.utils.ForegroundServiceHelper
26import com.nextcloud.utils.extensions.getPercent
27import com.nextcloud.utils.extensions.updateStatus
28import com.owncloud.android.R
29import com.owncloud.android.datamodel.FileDataStorageManager
30import com.owncloud.android.datamodel.ForegroundServiceType
31import com.owncloud.android.datamodel.ThumbnailsCacheManager
…lines 32–70 unchanged (39 lines)
71 const val UPLOAD_IDS = "uploads_ids"
72 const val CURRENT_BATCH_INDEX = "batch_index"
73 const val TOTAL_UPLOAD_SIZE = "total_upload_size"
74 const val SHOW_SAME_FILE_ALREADY_EXISTS_NOTIFICATION = "show_same_file_already_exists_notification"
75
76 var currentUploadFileOperation: UploadFileOperation? = null
77
78 private const val BATCH_SIZE = 100
79
80 const val EXTRA_UPLOAD_RESULT = "RESULT"
81 const val EXTRA_REMOTE_PATH = "REMOTE_PATH"
82 const val EXTRA_OLD_REMOTE_PATH = "OLD_REMOTE_PATH"
83 const val EXTRA_OLD_FILE_PATH = "OLD_FILE_PATH"
84 const val EXTRA_LINKED_TO_PATH = "LINKED_TO"
85 const val ACCOUNT_NAME = "ACCOUNT_NAME"
86 const val EXTRA_ACCOUNT_NAME = "ACCOUNT_NAME"
87 const val ACTION_CANCEL_BROADCAST = "CANCEL"
88 const val LOCAL_BEHAVIOUR_COPY = 0
89 const val LOCAL_BEHAVIOUR_MOVE = 1
90 const val LOCAL_BEHAVIOUR_FORGET = 2
91 const val LOCAL_BEHAVIOUR_DELETE = 3
92
93 fun cancelCurrentUpload(remotePath: String, accountName: String, onCompleted: () -> Unit) {
94 currentUploadFileOperation?.let {
95 if (it.remotePath == remotePath && it.user.accountName == accountName) {
96 it.cancel(ResultCode.USER_CANCELLED)
97 onCompleted()
98 }
…lines 99–127 unchanged (29 lines)
128
129 trySetForeground()
130
131 val result = uploadFiles()
132 backgroundJobManager.logEndOfWorker(workerName, result)
133 notificationManager.dismissNotification()
134 result
135 } catch (t: Throwable) {
136 Log_OC.e(TAG, "Error caught at FileUploadWorker $t")
137 cleanup()
138 Result.failure()
139 }
140
…lines 141–181 unchanged (41 lines)
182 .setPriority(NotificationCompat.PRIORITY_LOW)
183 .setSilent(true)
184 .build()
185
186 private fun cleanup() {
187 Log_OC.e(TAG, "FileUploadWorker stopped")
188
189 currentUploadFileOperation?.cancel(null)
190 notificationManager.dismissNotification()
191 }
192
193 @Suppress("ReturnCount", "LongMethod", "DEPRECATION")
194 private suspend fun uploadFiles(): Result = withContext(Dispatchers.IO) {
195 val accountName = inputData.getString(ACCOUNT)
196 if (accountName == null) {
197 Log_OC.e(TAG, "accountName is null")
198 return@withContext Result.failure()
…lines 199–241 unchanged (43 lines)
242
243 if (canExitEarly()) {
244 notificationManager.showConnectionErrorNotification()
245 return@withContext Result.failure()
246 }
247
248 fileUploadBroadcastManager.sendAdded(context)
249 val operation = createUploadFileOperation(upload, user)
250 currentUploadFileOperation = operation
251 fileUploadBroadcastManager.sendStarted(operation, context)
252
253 val currentIndex = (index + 1)
254 val currentUploadIndex = (currentIndex + previouslyUploadedFileSize)
…lines 255–284 unchanged (30 lines)
285 result: RemoteOperationResult<*>
286 ) {
287 val shouldBroadcast =
288 (totalUploadSize > BATCH_SIZE && currentUploadIndex > 0) && currentUploadIndex % BATCH_SIZE == 0
289
290 if (shouldBroadcast) {
291 fileUploadBroadcastManager.sendFinished(
292 operation,
293 result,
294 operation.oldFile?.storagePath,
295 context
296 )
297 }
…lines 298–419 unchanged (122 lines)

Before

source_file
block_comment "/*\n * Nextcloud - Android Client\n *\n * SPDX-FileCopyrightTex"...
package_header
package "package"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "upload"
import
import "import"
qualified_identifier
identifier "android"
. "."
identifier "app"
. "."
identifier "Notification"
import
import "import"
qualified_identifier
identifier "android"
. "."
identifier "content"
. "."
identifier "Context"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "core"
. "."
identifier "app"
. "."
identifier "NotificationCompat"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "localbroadcastmanager"
. "."
identifier "content"
. "."
identifier "LocalBroadcastManager"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "work"
. "."
identifier "CoroutineWorker"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "work"
. "."
identifier "ForegroundInfo"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "work"
. "."
identifier "WorkerParameters"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "account"
. "."
identifier "User"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "account"
. "."
identifier "UserAccountManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "device"
. "."
identifier "PowerManagementService"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "BackgroundJobManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "BackgroundJobManagerImpl"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "utils"
. "."
identifier "UploadErrorNotificationManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "network"
. "."
identifier "ConnectivityService"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "preferences"
. "."
identifier "AppPreferences"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "model"
. "."
identifier "WorkerState"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "model"
. "."
identifier "WorkerStateObserver"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "utils"
. "."
identifier "ForegroundServiceHelper"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "utils"
. "."
identifier "extensions"
. "."
identifier "getPercent"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "utils"
. "."
identifier "extensions"
. "."
identifier "updateStatus"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "R"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "FileDataStorageManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "ForegroundServiceType"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "ThumbnailsCacheManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "UploadsStorageManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "db"
. "."
identifier "OCUpload"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "OwnCloudAccount"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "OwnCloudClient"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "OwnCloudClientManagerFactory"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "network"
. "."
identifier "OnDatatransferProgressListener"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "operations"
. "."
identifier "RemoteOperationResult"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "operations"
. "."
identifier "RemoteOperationResult"
. "."
identifier "ResultCode"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "utils"
. "."
identifier "Log_OC"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "operations"
. "."
identifier "UploadFileOperation"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "ui"
. "."
identifier "notifications"
. "."
identifier "NotificationUtils"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "utils"
. "."
identifier "theme"
. "."
identifier "ViewThemeUtils"
import
import "import"
qualified_identifier
identifier "kotlinx"
. "."
identifier "coroutines"
. "."
identifier "Dispatchers"
import
import "import"
qualified_identifier
identifier "kotlinx"
. "."
identifier "coroutines"
. "."
identifier "ensureActive"
import
import "import"
qualified_identifier
identifier "kotlinx"
. "."
identifier "coroutines"
. "."
identifier "withContext"
import
import "import"
qualified_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "File"
import
import "import"
qualified_identifier
identifier "kotlin"
. "."
identifier "random"
. "."
identifier "Random"
class_declaration
modifiers
annotation
@ "@"
constructor_invocation
user_type
identifier "Suppress"
value_arguments
( "("
value_argument
string_literal
" "\""
string_content "LongParameterList"
" "\""
, ","
value_argument
string_literal
" "\""
string_content "TooGenericExceptionCaught"
" "\""
) ")"
class "class"
identifier "FileUploadWorker"
primary_constructor (+75 nodes collapsed)
: ":"
delegation_specifiers
delegation_specifier
constructor_invocation
user_type
identifier "CoroutineWorker"
value_arguments
( "("
value_argument
identifier "context"
, ","
value_argument
identifier "params"
) ")"
, ","
delegation_specifier
user_type
identifier "OnDatatransferProgressListener"
class_body
{ "{"
companion_object
companion "companion"
object "object"
class_body
{ "{"
property_declaration
val "val"
variable_declaration
identifier "TAG"
: ":"
user_type
identifier "String"
= "="
navigation_expression
navigation_expression
navigation_expression
identifier "FileUploadWorker"
:: "::"
identifier "class"
. "."
identifier "java"
. "."
identifier "simpleName"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "NOTIFICATION_ERROR_ID"
: ":"
user_type
identifier "Int"
= "="
number_literal "413"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "ACCOUNT"
= "="
string_literal
" "\""
string_content "data_account"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "UPLOAD_IDS"
= "="
string_literal
" "\""
string_content "uploads_ids"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "CURRENT_BATCH_INDEX"
= "="
string_literal
" "\""
string_content "batch_index"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "TOTAL_UPLOAD_SIZE"
= "="
string_literal
" "\""
string_content "total_upload_size"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "SHOW_SAME_FILE_ALREADY_EXISTS_NOTIFICATION"
= "="
string_literal
" "\""
string_content "show_same_file_already_exists_notification"
" "\""
property_declaration
var "var"
variable_declaration
identifier "currentUploadFileOperation"
: ":"
nullable_type
user_type
identifier "UploadFileOperation"
? "?"
= "="
identifier "null"
property_declaration
modifiers
visibility_modifier
private "private"
property_modifier
const "const"
val "val"
variable_declaration
identifier "UPLOADS_ADDED_MESSAGE"
= "="
string_literal
" "\""
string_content "UPLOADS_ADDED"
" "\""
property_declaration
modifiers
visibility_modifier
private "private"
property_modifier
const "const"
val "val"
variable_declaration
identifier "UPLOAD_START_MESSAGE"
= "="
string_literal
" "\""
string_content "UPLOAD_START"
" "\""
property_declaration
modifiers
visibility_modifier
private "private"
property_modifier
const "const"
val "val"
variable_declaration
identifier "UPLOAD_FINISH_MESSAGE"
= "="
string_literal
" "\""
string_content "UPLOAD_FINISH"
" "\""
property_declaration
modifiers
visibility_modifier
private "private"
property_modifier
const "const"
val "val"
variable_declaration
identifier "BATCH_SIZE"
= "="
number_literal "100"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_UPLOAD_RESULT"
= "="
string_literal
" "\""
string_content "RESULT"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_REMOTE_PATH"
= "="
string_literal
" "\""
string_content "REMOTE_PATH"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_OLD_REMOTE_PATH"
= "="
string_literal
" "\""
string_content "OLD_REMOTE_PATH"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_OLD_FILE_PATH"
= "="
string_literal
" "\""
string_content "OLD_FILE_PATH"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_LINKED_TO_PATH"
= "="
string_literal
" "\""
string_content "LINKED_TO"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "ACCOUNT_NAME"
= "="
string_literal
" "\""
string_content "ACCOUNT_NAME"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_ACCOUNT_NAME"
= "="
string_literal
" "\""
string_content "ACCOUNT_NAME"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "ACTION_CANCEL_BROADCAST"
= "="
string_literal
" "\""
string_content "CANCEL"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_COPY"
= "="
number_literal "0"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_MOVE"
= "="
number_literal "1"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_FORGET"
= "="
number_literal "2"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_DELETE"
= "="
number_literal "3"
function_declaration
fun "fun"
identifier "getUploadsAddedMessage"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "String"
function_body
= "="
binary_expression
navigation_expression
navigation_expression
navigation_expression
identifier "FileUploadWorker"
:: "::"
identifier "class"
. "."
identifier "java"
. "."
identifier "name"
+ "+"
identifier "UPLOADS_ADDED_MESSAGE"
function_declaration
fun "fun"
identifier "getUploadStartMessage"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "String"
function_body
= "="
binary_expression
navigation_expression
navigation_expression
navigation_expression
identifier "FileUploadWorker"
:: "::"
identifier "class"
. "."
identifier "java"
. "."
identifier "name"
+ "+"
identifier "UPLOAD_START_MESSAGE"
function_declaration
fun "fun"
identifier "getUploadFinishMessage"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "String"
function_body
= "="
binary_expression
navigation_expression
navigation_expression
navigation_expression
identifier "FileUploadWorker"
:: "::"
identifier "class"
. "."
identifier "java"
. "."
identifier "name"
+ "+"
identifier "UPLOAD_FINISH_MESSAGE"
function_declaration (+85 nodes collapsed)
function_declaration (+61 nodes collapsed)
function_declaration (+49 nodes collapsed)
} "}"
property_declaration
modifiers
visibility_modifier
private "private"
var "var"
variable_declaration
identifier "lastPercent"
= "="
number_literal "0"
property_declaration
modifiers
visibility_modifier
private "private"
val "val"
variable_declaration
identifier "notificationId"
= "="
call_expression
navigation_expression
identifier "Random"
. "."
identifier "nextInt"
value_arguments
( "("
) ")"
property_declaration (+21 nodes collapsed)
property_declaration
modifiers
visibility_modifier
private "private"
val "val"
variable_declaration
identifier "intents"
= "="
call_expression
identifier "FileUploaderIntents"
value_arguments
( "("
value_argument
identifier "context"
) ")"
property_declaration
modifiers
visibility_modifier
private "private"
val "val"
variable_declaration
identifier "fileUploadBroadcastManager"
= "="
call_expression
identifier "FileUploadBroadcastManager"
value_arguments
( "("
value_argument
identifier "localBroadcastManager"
) ")"
function_declaration
modifiers
member_modifier
override "override"
function_modifier
suspend "suspend"
fun "fun"
identifier "doWork"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "Result"
function_body
= "="
try_expression
try "try"
block
{ "{"
call_expression
navigation_expression
identifier "Log_OC"
. "."
identifier "d"
value_arguments
( "("
value_argument
identifier "TAG"
, ","
value_argument
string_literal
" "\""
string_content "FileUploadWorker started"
" "\""
) ")"
property_declaration
val "val"
variable_declaration
identifier "workerName"
= "="
call_expression
navigation_expression
identifier "BackgroundJobManagerImpl"
. "."
identifier "formatClassTag"
value_arguments
( "("
value_argument
navigation_expression
this_expression
this "this"
:: "::"
identifier "class"
) ")"
call_expression
navigation_expression
identifier "backgroundJobManager"
. "."
identifier "logStartOfWorker"
value_arguments
( "("
value_argument
identifier "workerName"
) ")"
call_expression
identifier "trySetForeground"
value_arguments
( "("
) ")"
property_declaration
val "val"
variable_declaration
identifier "result"
= "="
call_expression
identifier "uploadFiles"
value_arguments
( "("
) ")"
call_expression
navigation_expression
identifier "backgroundJobManager"
. "."
identifier "logEndOfWorker"
value_arguments
( "("
value_argument
identifier "workerName"
, ","
value_argument
identifier "result"
) ")"
call_expression
navigation_expression
identifier "notificationManager"
. "."
identifier "dismissNotification"
value_arguments
( "("
) ")"
if_expression
if "if"
( "("
binary_expression
identifier "result"
== "=="
call_expression
navigation_expression
identifier "Result"
. "."
identifier "success"
value_arguments
( "("
) ")"
) ")"
block
{ "{"
call_expression
identifier "setIdleWorkerState"
value_arguments
( "("
) ")"
} "}"
identifier "result"
} "}"
catch_block (+42 nodes collapsed)
function_declaration (+101 nodes collapsed)
function_declaration (+78 nodes collapsed)
function_declaration (+51 nodes collapsed)
function_declaration (+123 nodes collapsed)
function_declaration
modifiers
visibility_modifier
private "private"
fun "fun"
identifier "cleanup"
function_value_parameters
( "("
) ")"
function_body
block
{ "{"
call_expression
navigation_expression
identifier "Log_OC"
. "."
identifier "e"
value_arguments
( "("
value_argument
identifier "TAG"
, ","
value_argument
string_literal
" "\""
string_content "FileUploadWorker stopped"
" "\""
) ")"
call_expression
identifier "setIdleWorkerState"
value_arguments
( "("
) ")"
call_expression
navigation_expression
identifier "currentUploadFileOperation"
?. "?."
identifier "cancel"
value_arguments
( "("
value_argument
identifier "null"
) ")"
call_expression
navigation_expression
identifier "notificationManager"
. "."
identifier "dismissNotification"
value_arguments
( "("
) ")"
} "}"
function_declaration
modifiers
visibility_modifier
private "private"
fun "fun"
identifier "setIdleWorkerState"
function_value_parameters
( "("
) ")"
function_body
block
{ "{"
call_expression
navigation_expression
identifier "WorkerStateObserver"
. "."
identifier "send"
value_arguments
( "("
value_argument
call_expression
navigation_expression
identifier "WorkerState"
. "."
identifier "FileUploadCompleted"
value_arguments
( "("
value_argument
navigation_expression
identifier "currentUploadFileOperation"
?. "?."
identifier "file"
) ")"
) ")"
} "}"
function_declaration
modifiers (+30 nodes collapsed)
fun "fun"
identifier "uploadFiles"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "Result"
function_body
= "="
call_expression
call_expression
identifier "withContext"
value_arguments
( "("
value_argument
navigation_expression
identifier "Dispatchers"
. "."
identifier "IO"
) ")"
annotated_lambda
lambda_literal
{ "{"
property_declaration
val "val"
variable_declaration
identifier "accountName"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getString"
value_arguments
( "("
value_argument
identifier "ACCOUNT"
) ")"
if_expression (+38 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "uploadIds"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getLongArray"
value_arguments
( "("
value_argument
identifier "UPLOAD_IDS"
) ")"
if_expression (+38 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "currentBatchIndex"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getInt"
value_arguments
( "("
value_argument
identifier "CURRENT_BATCH_INDEX"
, ","
value_argument
unary_expression
- "-"
number_literal "1"
) ")"
if_expression (+40 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "totalUploadSize"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getInt"
value_arguments
( "("
value_argument
identifier "TOTAL_UPLOAD_SIZE"
, ","
value_argument
unary_expression
- "-"
number_literal "1"
) ")"
if_expression (+40 nodes collapsed)
line_comment "// since worker's policy is append or replace and account na"...
property_declaration
val "val"
variable_declaration
identifier "optionalUser"
= "="
call_expression
navigation_expression
identifier "userAccountManager"
. "."
identifier "getUser"
value_arguments
( "("
value_argument
identifier "accountName"
) ")"
if_expression (+42 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "user"
= "="
call_expression
navigation_expression
identifier "optionalUser"
. "."
identifier "get"
value_arguments
( "("
) ")"
property_declaration
val "val"
variable_declaration
identifier "previouslyUploadedFileSize"
= "="
binary_expression
identifier "currentBatchIndex"
* "*"
navigation_expression
identifier "FileUploadHelper"
. "."
identifier "MAX_FILE_COUNT"
property_declaration
val "val"
variable_declaration
identifier "uploads"
= "="
call_expression
navigation_expression
identifier "uploadsStorageManager"
. "."
identifier "getUploadsByIds"
value_arguments
( "("
value_argument
identifier "uploadIds"
, ","
value_argument
identifier "accountName"
) ")"
property_declaration (+22 nodes collapsed)
property_declaration (+25 nodes collapsed)
for_statement
for "for"
( "("
multi_variable_declaration
( "("
variable_declaration
identifier "index"
, ","
variable_declaration
identifier "upload"
) ")"
in "in"
call_expression
navigation_expression
identifier "uploads"
. "."
identifier "withIndex"
value_arguments
( "("
) ")"
) ")"
block
{ "{"
call_expression
identifier "ensureActive"
value_arguments
( "("
) ")"
if_expression (+57 nodes collapsed)
if_expression (+31 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "operation"
= "="
call_expression
identifier "createUploadFileOperation"
value_arguments
( "("
value_argument
identifier "upload"
, ","
value_argument
identifier "user"
) ")"
assignment
identifier "currentUploadFileOperation"
= "="
identifier "operation"
call_expression
navigation_expression
identifier "fileUploadBroadcastManager"
. "."
identifier "sendStarted"
value_arguments
( "("
value_argument
identifier "operation"
, ","
value_argument
identifier "context"
) ")"
property_declaration
val "val"
variable_declaration
identifier "currentIndex"
= "="
parenthesized_expression
( "("
binary_expression
identifier "index"
+ "+"
number_literal "1"
) ")"
property_declaration
val "val"
variable_declaration
identifier "currentUploadIndex"
= "="
parenthesized_expression
( "("
binary_expression
identifier "currentIndex"
+ "+"
identifier "previouslyUploadedFileSize"
) ")"
call_expression (+34 nodes collapsed)
property_declaration (+33 nodes collapsed)
property_declaration (+24 nodes collapsed)
call_expression
navigation_expression
identifier "uploadsStorageManager"
. "."
identifier "updateStatus"
value_arguments
( "("
value_argument
identifier "entity"
, ","
value_argument
navigation_expression
identifier "result"
. "."
identifier "isSuccess"
) ")"
assignment
identifier "currentUploadFileOperation"
= "="
identifier "null"
if_expression (+44 nodes collapsed)
call_expression
identifier "sendUploadFinishEvent"
value_arguments
( "("
value_argument
identifier "totalUploadSize"
, ","
value_argument
identifier "currentUploadIndex"
, ","
value_argument
identifier "operation"
, ","
value_argument
identifier "result"
) ")"
} "}"
return_expression
return@ "return@"
identifier "withContext"
call_expression
navigation_expression
identifier "Result"
. "."
identifier "success"
value_arguments
( "("
) ")"
} "}"
function_declaration
modifiers
visibility_modifier
private "private"
fun "fun"
identifier "sendUploadFinishEvent"
function_value_parameters (+31 nodes collapsed)
function_body
block
{ "{"
property_declaration (+27 nodes collapsed)
if_expression
if "if"
( "("
identifier "shouldBroadcast"
) ")"
block
{ "{"
line_comment "// delay broadcast"
call_expression (+25 nodes collapsed)
} "}"
} "}"
function_declaration (+75 nodes collapsed)
function_declaration (+109 nodes collapsed)
function_declaration (+352 nodes collapsed)
property_declaration (+22 nodes collapsed)
property_declaration
modifiers
visibility_modifier
private "private"
var "var"
variable_declaration
identifier "lastUpdateTime"
= "="
number_literal "0L"
block_comment "/**\n * Receives from [com.owncloud.android.operations.Up"...
function_declaration (+239 nodes collapsed)
} "}"

After

source_file
block_comment "/*\n * Nextcloud - Android Client\n *\n * SPDX-FileCopyrightTex"...
package_header
package "package"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "upload"
import
import "import"
qualified_identifier
identifier "android"
. "."
identifier "app"
. "."
identifier "Notification"
import
import "import"
qualified_identifier
identifier "android"
. "."
identifier "content"
. "."
identifier "Context"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "core"
. "."
identifier "app"
. "."
identifier "NotificationCompat"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "localbroadcastmanager"
. "."
identifier "content"
. "."
identifier "LocalBroadcastManager"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "work"
. "."
identifier "CoroutineWorker"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "work"
. "."
identifier "ForegroundInfo"
import
import "import"
qualified_identifier
identifier "androidx"
. "."
identifier "work"
. "."
identifier "WorkerParameters"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "account"
. "."
identifier "User"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "account"
. "."
identifier "UserAccountManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "device"
. "."
identifier "PowerManagementService"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "BackgroundJobManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "BackgroundJobManagerImpl"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "jobs"
. "."
identifier "utils"
. "."
identifier "UploadErrorNotificationManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "network"
. "."
identifier "ConnectivityService"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "client"
. "."
identifier "preferences"
. "."
identifier "AppPreferences"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "utils"
. "."
identifier "ForegroundServiceHelper"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "utils"
. "."
identifier "extensions"
. "."
identifier "getPercent"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "nextcloud"
. "."
identifier "utils"
. "."
identifier "extensions"
. "."
identifier "updateStatus"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "R"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "FileDataStorageManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "ForegroundServiceType"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "ThumbnailsCacheManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "datamodel"
. "."
identifier "UploadsStorageManager"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "db"
. "."
identifier "OCUpload"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "OwnCloudAccount"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "OwnCloudClient"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "OwnCloudClientManagerFactory"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "network"
. "."
identifier "OnDatatransferProgressListener"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "operations"
. "."
identifier "RemoteOperationResult"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "operations"
. "."
identifier "RemoteOperationResult"
. "."
identifier "ResultCode"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "lib"
. "."
identifier "common"
. "."
identifier "utils"
. "."
identifier "Log_OC"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "operations"
. "."
identifier "UploadFileOperation"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "ui"
. "."
identifier "notifications"
. "."
identifier "NotificationUtils"
import
import "import"
qualified_identifier
identifier "com"
. "."
identifier "owncloud"
. "."
identifier "android"
. "."
identifier "utils"
. "."
identifier "theme"
. "."
identifier "ViewThemeUtils"
import
import "import"
qualified_identifier
identifier "kotlinx"
. "."
identifier "coroutines"
. "."
identifier "Dispatchers"
import
import "import"
qualified_identifier
identifier "kotlinx"
. "."
identifier "coroutines"
. "."
identifier "ensureActive"
import
import "import"
qualified_identifier
identifier "kotlinx"
. "."
identifier "coroutines"
. "."
identifier "withContext"
import
import "import"
qualified_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "File"
import
import "import"
qualified_identifier
identifier "kotlin"
. "."
identifier "random"
. "."
identifier "Random"
class_declaration
modifiers
annotation
@ "@"
constructor_invocation
user_type
identifier "Suppress"
value_arguments
( "("
value_argument
string_literal
" "\""
string_content "LongParameterList"
" "\""
, ","
value_argument
string_literal
" "\""
string_content "TooGenericExceptionCaught"
" "\""
) ")"
class "class"
identifier "FileUploadWorker"
primary_constructor (+75 nodes collapsed)
: ":"
delegation_specifiers
delegation_specifier
constructor_invocation
user_type
identifier "CoroutineWorker"
value_arguments
( "("
value_argument
identifier "context"
, ","
value_argument
identifier "params"
) ")"
, ","
delegation_specifier
user_type
identifier "OnDatatransferProgressListener"
class_body
{ "{"
companion_object
companion "companion"
object "object"
class_body
{ "{"
property_declaration
val "val"
variable_declaration
identifier "TAG"
: ":"
user_type
identifier "String"
= "="
navigation_expression
navigation_expression
navigation_expression
identifier "FileUploadWorker"
:: "::"
identifier "class"
. "."
identifier "java"
. "."
identifier "simpleName"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "NOTIFICATION_ERROR_ID"
: ":"
user_type
identifier "Int"
= "="
number_literal "413"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "ACCOUNT"
= "="
string_literal
" "\""
string_content "data_account"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "UPLOAD_IDS"
= "="
string_literal
" "\""
string_content "uploads_ids"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "CURRENT_BATCH_INDEX"
= "="
string_literal
" "\""
string_content "batch_index"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "TOTAL_UPLOAD_SIZE"
= "="
string_literal
" "\""
string_content "total_upload_size"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "SHOW_SAME_FILE_ALREADY_EXISTS_NOTIFICATION"
= "="
string_literal
" "\""
string_content "show_same_file_already_exists_notification"
" "\""
property_declaration
var "var"
variable_declaration
identifier "currentUploadFileOperation"
: ":"
nullable_type
user_type
identifier "UploadFileOperation"
? "?"
= "="
identifier "null"
property_declaration
modifiers
visibility_modifier
private "private"
property_modifier
const "const"
val "val"
variable_declaration
identifier "BATCH_SIZE"
= "="
number_literal "100"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_UPLOAD_RESULT"
= "="
string_literal
" "\""
string_content "RESULT"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_REMOTE_PATH"
= "="
string_literal
" "\""
string_content "REMOTE_PATH"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_OLD_REMOTE_PATH"
= "="
string_literal
" "\""
string_content "OLD_REMOTE_PATH"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_OLD_FILE_PATH"
= "="
string_literal
" "\""
string_content "OLD_FILE_PATH"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_LINKED_TO_PATH"
= "="
string_literal
" "\""
string_content "LINKED_TO"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "ACCOUNT_NAME"
= "="
string_literal
" "\""
string_content "ACCOUNT_NAME"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "EXTRA_ACCOUNT_NAME"
= "="
string_literal
" "\""
string_content "ACCOUNT_NAME"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "ACTION_CANCEL_BROADCAST"
= "="
string_literal
" "\""
string_content "CANCEL"
" "\""
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_COPY"
= "="
number_literal "0"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_MOVE"
= "="
number_literal "1"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_FORGET"
= "="
number_literal "2"
property_declaration
modifiers
property_modifier
const "const"
val "val"
variable_declaration
identifier "LOCAL_BEHAVIOUR_DELETE"
= "="
number_literal "3"
function_declaration (+85 nodes collapsed)
function_declaration (+61 nodes collapsed)
function_declaration (+49 nodes collapsed)
} "}"
property_declaration
modifiers
visibility_modifier
private "private"
var "var"
variable_declaration
identifier "lastPercent"
= "="
number_literal "0"
property_declaration
modifiers
visibility_modifier
private "private"
val "val"
variable_declaration
identifier "notificationId"
= "="
call_expression
navigation_expression
identifier "Random"
. "."
identifier "nextInt"
value_arguments
( "("
) ")"
property_declaration (+21 nodes collapsed)
property_declaration
modifiers
visibility_modifier
private "private"
val "val"
variable_declaration
identifier "intents"
= "="
call_expression
identifier "FileUploaderIntents"
value_arguments
( "("
value_argument
identifier "context"
) ")"
property_declaration
modifiers
visibility_modifier
private "private"
val "val"
variable_declaration
identifier "fileUploadBroadcastManager"
= "="
call_expression
identifier "FileUploadBroadcastManager"
value_arguments
( "("
value_argument
identifier "localBroadcastManager"
) ")"
function_declaration
modifiers
member_modifier
override "override"
function_modifier
suspend "suspend"
fun "fun"
identifier "doWork"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "Result"
function_body
= "="
try_expression
try "try"
block
{ "{"
call_expression
navigation_expression
identifier "Log_OC"
. "."
identifier "d"
value_arguments
( "("
value_argument
identifier "TAG"
, ","
value_argument
string_literal
" "\""
string_content "FileUploadWorker started"
" "\""
) ")"
property_declaration
val "val"
variable_declaration
identifier "workerName"
= "="
call_expression
navigation_expression
identifier "BackgroundJobManagerImpl"
. "."
identifier "formatClassTag"
value_arguments
( "("
value_argument
navigation_expression
this_expression
this "this"
:: "::"
identifier "class"
) ")"
call_expression
navigation_expression
identifier "backgroundJobManager"
. "."
identifier "logStartOfWorker"
value_arguments
( "("
value_argument
identifier "workerName"
) ")"
call_expression
identifier "trySetForeground"
value_arguments
( "("
) ")"
property_declaration
val "val"
variable_declaration
identifier "result"
= "="
call_expression
identifier "uploadFiles"
value_arguments
( "("
) ")"
call_expression
navigation_expression
identifier "backgroundJobManager"
. "."
identifier "logEndOfWorker"
value_arguments
( "("
value_argument
identifier "workerName"
, ","
value_argument
identifier "result"
) ")"
call_expression
navigation_expression
identifier "notificationManager"
. "."
identifier "dismissNotification"
value_arguments
( "("
) ")"
identifier "result"
} "}"
catch_block (+42 nodes collapsed)
function_declaration (+101 nodes collapsed)
function_declaration (+78 nodes collapsed)
function_declaration (+51 nodes collapsed)
function_declaration (+123 nodes collapsed)
function_declaration
modifiers
visibility_modifier
private "private"
fun "fun"
identifier "cleanup"
function_value_parameters
( "("
) ")"
function_body
block
{ "{"
call_expression
navigation_expression
identifier "Log_OC"
. "."
identifier "e"
value_arguments
( "("
value_argument
identifier "TAG"
, ","
value_argument
string_literal
" "\""
string_content "FileUploadWorker stopped"
" "\""
) ")"
call_expression
navigation_expression
identifier "currentUploadFileOperation"
?. "?."
identifier "cancel"
value_arguments
( "("
value_argument
identifier "null"
) ")"
call_expression
navigation_expression
identifier "notificationManager"
. "."
identifier "dismissNotification"
value_arguments
( "("
) ")"
} "}"
function_declaration
modifiers (+30 nodes collapsed)
fun "fun"
identifier "uploadFiles"
function_value_parameters
( "("
) ")"
: ":"
user_type
identifier "Result"
function_body
= "="
call_expression
call_expression
identifier "withContext"
value_arguments
( "("
value_argument
navigation_expression
identifier "Dispatchers"
. "."
identifier "IO"
) ")"
annotated_lambda
lambda_literal
{ "{"
property_declaration
val "val"
variable_declaration
identifier "accountName"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getString"
value_arguments
( "("
value_argument
identifier "ACCOUNT"
) ")"
if_expression (+38 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "uploadIds"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getLongArray"
value_arguments
( "("
value_argument
identifier "UPLOAD_IDS"
) ")"
if_expression (+38 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "currentBatchIndex"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getInt"
value_arguments
( "("
value_argument
identifier "CURRENT_BATCH_INDEX"
, ","
value_argument
unary_expression
- "-"
number_literal "1"
) ")"
if_expression (+40 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "totalUploadSize"
= "="
call_expression
navigation_expression
identifier "inputData"
. "."
identifier "getInt"
value_arguments
( "("
value_argument
identifier "TOTAL_UPLOAD_SIZE"
, ","
value_argument
unary_expression
- "-"
number_literal "1"
) ")"
if_expression (+40 nodes collapsed)
line_comment "// since worker's policy is append or replace and account na"...
property_declaration
val "val"
variable_declaration
identifier "optionalUser"
= "="
call_expression
navigation_expression
identifier "userAccountManager"
. "."
identifier "getUser"
value_arguments
( "("
value_argument
identifier "accountName"
) ")"
if_expression (+42 nodes collapsed)
property_declaration
val "val"
variable_declaration
identifier "user"
= "="
call_expression
navigation_expression
identifier "optionalUser"
. "."
identifier "get"
value_arguments
( "("
) ")"
property_declaration
val "val"
variable_declaration
identifier "previouslyUploadedFileSize"
= "="
binary_expression
identifier "currentBatchIndex"
* "*"
navigation_expression
identifier "FileUploadHelper"
. "."
identifier "MAX_FILE_COUNT"
property_declaration
val "val"
variable_declaration
identifier "uploads"
= "="
call_expression
navigation_expression
identifier "uploadsStorageManager"
. "."
identifier "getUploadsByIds"
value_arguments
( "("
value_argument
identifier "uploadIds"
, ","
value_argument
identifier "accountName"
) ")"
property_declaration (+22 nodes collapsed)
property_declaration (+25 nodes collapsed)
for_statement
for "for"
( "("
multi_variable_declaration
( "("
variable_declaration
identifier "index"
, ","
variable_declaration
identifier "upload"
) ")"
in "in"
call_expression
navigation_expression
identifier "uploads"
. "."
identifier "withIndex"
value_arguments
( "("
) ")"
) ")"
block
{ "{"
call_expression
identifier "ensureActive"
value_arguments
( "("
) ")"
if_expression (+57 nodes collapsed)
if_expression (+31 nodes collapsed)
call_expression
navigation_expression
identifier "fileUploadBroadcastManager"
. "."
identifier "sendAdded"
value_arguments
( "("
value_argument
identifier "context"
) ")"
property_declaration
val "val"
variable_declaration
identifier "operation"
= "="
call_expression
identifier "createUploadFileOperation"
value_arguments
( "("
value_argument
identifier "upload"
, ","
value_argument
identifier "user"
) ")"
assignment
identifier "currentUploadFileOperation"
= "="
identifier "operation"
call_expression
navigation_expression
identifier "fileUploadBroadcastManager"
. "."
identifier "sendStarted"
value_arguments
( "("
value_argument
identifier "operation"
, ","
value_argument
identifier "context"
) ")"
property_declaration
val "val"
variable_declaration
identifier "currentIndex"
= "="
parenthesized_expression
( "("
binary_expression
identifier "index"
+ "+"
number_literal "1"
) ")"
property_declaration
val "val"
variable_declaration
identifier "currentUploadIndex"
= "="
parenthesized_expression
( "("
binary_expression
identifier "currentIndex"
+ "+"
identifier "previouslyUploadedFileSize"
) ")"
call_expression (+34 nodes collapsed)
property_declaration (+33 nodes collapsed)
property_declaration (+24 nodes collapsed)
call_expression
navigation_expression
identifier "uploadsStorageManager"
. "."
identifier "updateStatus"
value_arguments
( "("
value_argument
identifier "entity"
, ","
value_argument
navigation_expression
identifier "result"
. "."
identifier "isSuccess"
) ")"
assignment
identifier "currentUploadFileOperation"
= "="
identifier "null"
if_expression (+44 nodes collapsed)
call_expression
identifier "sendUploadFinishEvent"
value_arguments
( "("
value_argument
identifier "totalUploadSize"
, ","
value_argument
identifier "currentUploadIndex"
, ","
value_argument
identifier "operation"
, ","
value_argument
identifier "result"
) ")"
} "}"
return_expression
return@ "return@"
identifier "withContext"
call_expression
navigation_expression
identifier "Result"
. "."
identifier "success"
value_arguments
( "("
) ")"
} "}"
function_declaration
modifiers
visibility_modifier
private "private"
fun "fun"
identifier "sendUploadFinishEvent"
function_value_parameters (+31 nodes collapsed)
function_body
block
{ "{"
property_declaration (+27 nodes collapsed)
if_expression
if "if"
( "("
identifier "shouldBroadcast"
) ")"
block
{ "{"
call_expression (+25 nodes collapsed)
} "}"
} "}"
function_declaration (+75 nodes collapsed)
function_declaration (+109 nodes collapsed)
function_declaration (+352 nodes collapsed)
property_declaration (+22 nodes collapsed)
property_declaration
modifiers
visibility_modifier
private "private"
var "var"
variable_declaration
identifier "lastUpdateTime"
= "="
number_literal "0L"
block_comment "/**\n * Receives from [com.owncloud.android.operations.Up"...
function_declaration (+239 nodes collapsed)
} "}"