mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-30 14:23:55 +01:00
CommonsApplication instance is null
This commit is contained in:
parent
7b746ffed2
commit
08f18ff4b3
1 changed files with 13 additions and 5 deletions
|
|
@ -409,14 +409,17 @@ class UploadWorker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StashUploadState.PAUSED -> {
|
StashUploadState.PAUSED -> {
|
||||||
showPausedNotification(contribution)
|
showPausedNotification(contribution)
|
||||||
contribution.state = Contribution.STATE_PAUSED
|
contribution.state = Contribution.STATE_PAUSED
|
||||||
contributionDao.saveSynchronous(contribution)
|
contributionDao.saveSynchronous(contribution)
|
||||||
}
|
}
|
||||||
|
|
||||||
StashUploadState.CANCELLED -> {
|
StashUploadState.CANCELLED -> {
|
||||||
showCancelledNotification(contribution)
|
showCancelledNotification(contribution)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
Timber.e("""upload file to stash failed with status: ${stashUploadResult.state}""")
|
Timber.e("""upload file to stash failed with status: ${stashUploadResult.state}""")
|
||||||
|
|
||||||
|
|
@ -438,9 +441,12 @@ class UploadWorker(
|
||||||
appContext.getString(R.string.invalid_login_message),
|
appContext.getString(R.string.invalid_login_message),
|
||||||
username,
|
username,
|
||||||
)
|
)
|
||||||
CommonsApplication
|
CommonsApplication.instance?.clearApplicationData(
|
||||||
.instance!!
|
appContext,
|
||||||
.clearApplicationData(appContext, logoutListener)
|
logoutListener
|
||||||
|
)
|
||||||
|
?: Timber.e("CommonsApplication instance is null.")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -534,7 +540,8 @@ class UploadWorker(
|
||||||
private fun saveIntoUploadedStatus(contribution: Contribution) {
|
private fun saveIntoUploadedStatus(contribution: Contribution) {
|
||||||
contribution.contentUri?.let {
|
contribution.contentUri?.let {
|
||||||
val imageSha1 = contribution.imageSHA1.toString()
|
val imageSha1 = contribution.imageSHA1.toString()
|
||||||
val modifiedSha1 = fileUtilsWrapper.getSHA1(fileUtilsWrapper.getFileInputStream(contribution.localUri?.path))
|
val modifiedSha1 =
|
||||||
|
fileUtilsWrapper.getSHA1(fileUtilsWrapper.getFileInputStream(contribution.localUri?.path))
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
uploadedStatusDao.insertUploaded(
|
uploadedStatusDao.insertUploaded(
|
||||||
UploadedStatus(
|
UploadedStatus(
|
||||||
|
|
@ -559,7 +566,8 @@ class UploadWorker(
|
||||||
"File:%s",
|
"File:%s",
|
||||||
sequenceFileName,
|
sequenceFileName,
|
||||||
),
|
),
|
||||||
).blockingGet()) {
|
).blockingGet()
|
||||||
|
) {
|
||||||
|
|
||||||
// Generate a random 5-character alphanumeric string
|
// Generate a random 5-character alphanumeric string
|
||||||
val randomHash = (random.nextInt(90000) + 10000).toString()
|
val randomHash = (random.nextInt(90000) + 10000).toString()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue