Sync improvements
This commit is contained in:
@@ -1029,12 +1029,14 @@ class CowspentServerSyncHelper private constructor(private val dbHelper: Cowspen
|
|||||||
var status = LoginStatus.OK
|
var status = LoginStatus.OK
|
||||||
try {
|
try {
|
||||||
// Pass current project values if the new ones are null to ensure a complete project object is sent to the server
|
// Pass current project values if the new ones are null to ensure a complete project object is sent to the server
|
||||||
|
val currentProj = project!!
|
||||||
|
val finalName = (newName ?: currentProj.name).let { if (it.isBlank() || it == "null") currentProj.remoteId else it }
|
||||||
val response = client!!.editRemoteProject(
|
val response = client!!.editRemoteProject(
|
||||||
project!!,
|
currentProj,
|
||||||
newName ?: project.name,
|
finalName,
|
||||||
newEmail ?: project.email,
|
newEmail ?: currentProj.email,
|
||||||
newPassword,
|
newPassword,
|
||||||
newMainCurrencyName ?: project.currencyName,
|
newMainCurrencyName ?: currentProj.currencyName,
|
||||||
newArchivedTs
|
newArchivedTs
|
||||||
)
|
)
|
||||||
if (BillsListViewActivity.DEBUG) {
|
if (BillsListViewActivity.DEBUG) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class NextcloudClient(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Throws(TokenMismatchException::class, NextcloudHttpRequestFailedException::class)
|
@Throws(TokenMismatchException::class, NextcloudHttpRequestFailedException::class)
|
||||||
private fun requestServerWithSSO(
|
internal fun requestServerWithSSO(
|
||||||
nextcloudAPI: NextcloudAPI,
|
nextcloudAPI: NextcloudAPI,
|
||||||
target: String,
|
target: String,
|
||||||
method: String,
|
method: String,
|
||||||
@@ -141,7 +141,7 @@ class NextcloudClient(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Throws(TokenMismatchException::class, NextcloudHttpRequestFailedException::class)
|
@Throws(TokenMismatchException::class, NextcloudHttpRequestFailedException::class)
|
||||||
private fun imageRequestServerWithSSO(
|
internal fun imageRequestServerWithSSO(
|
||||||
nextcloudAPI: NextcloudAPI,
|
nextcloudAPI: NextcloudAPI,
|
||||||
target: String,
|
target: String,
|
||||||
method: String,
|
method: String,
|
||||||
@@ -182,7 +182,7 @@ class NextcloudClient(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Throws(IOException::class, NextcloudHttpRequestFailedException::class)
|
@Throws(IOException::class, NextcloudHttpRequestFailedException::class)
|
||||||
private fun requestServer(
|
internal fun requestServer(
|
||||||
target: String,
|
target: String,
|
||||||
method: String, params: JSONObject?, lastETag: String?, needLogin: Boolean, isOCSRequest: Boolean
|
method: String, params: JSONObject?, lastETag: String?, needLogin: Boolean, isOCSRequest: Boolean
|
||||||
): VersatileProjectSyncClient.ResponseData {
|
): VersatileProjectSyncClient.ResponseData {
|
||||||
@@ -248,7 +248,7 @@ class NextcloudClient(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Throws(IOException::class, NextcloudHttpRequestFailedException::class)
|
@Throws(IOException::class, NextcloudHttpRequestFailedException::class)
|
||||||
private fun imageRequestServer(
|
internal fun imageRequestServer(
|
||||||
target: String,
|
target: String,
|
||||||
method: String, params: JSONObject?, lastETag: String?, needLogin: Boolean, isOCSRequest: Boolean
|
method: String, params: JSONObject?, lastETag: String?, needLogin: Boolean, isOCSRequest: Boolean
|
||||||
): VersatileProjectSyncClient.ResponseData {
|
): VersatileProjectSyncClient.ResponseData {
|
||||||
|
|||||||
@@ -163,11 +163,10 @@ class VersatileProjectSyncClient(
|
|||||||
paramValues.add(newEmail)
|
paramValues.add(newEmail)
|
||||||
}
|
}
|
||||||
if (newMainCurrencyName != null) {
|
if (newMainCurrencyName != null) {
|
||||||
paramKeys.add("currencyname")
|
paramKeys.add("currencyName")
|
||||||
paramValues.add(newMainCurrencyName)
|
|
||||||
}
|
}
|
||||||
if (newArchivedTs != null) {
|
if (newArchivedTs != null) {
|
||||||
paramKeys.add("archived_ts")
|
paramKeys.add("archivedTs")
|
||||||
paramValues.add(newArchivedTs.toString())
|
paramValues.add(newArchivedTs.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user