Sync improvements
This commit is contained in:
@@ -1029,12 +1029,14 @@ class CowspentServerSyncHelper private constructor(private val dbHelper: Cowspen
|
||||
var status = LoginStatus.OK
|
||||
try {
|
||||
// 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(
|
||||
project!!,
|
||||
newName ?: project.name,
|
||||
newEmail ?: project.email,
|
||||
currentProj,
|
||||
finalName,
|
||||
newEmail ?: currentProj.email,
|
||||
newPassword,
|
||||
newMainCurrencyName ?: project.currencyName,
|
||||
newMainCurrencyName ?: currentProj.currencyName,
|
||||
newArchivedTs
|
||||
)
|
||||
if (BillsListViewActivity.DEBUG) {
|
||||
|
||||
@@ -86,7 +86,7 @@ class NextcloudClient(
|
||||
}
|
||||
|
||||
@Throws(TokenMismatchException::class, NextcloudHttpRequestFailedException::class)
|
||||
private fun requestServerWithSSO(
|
||||
internal fun requestServerWithSSO(
|
||||
nextcloudAPI: NextcloudAPI,
|
||||
target: String,
|
||||
method: String,
|
||||
@@ -141,7 +141,7 @@ class NextcloudClient(
|
||||
}
|
||||
|
||||
@Throws(TokenMismatchException::class, NextcloudHttpRequestFailedException::class)
|
||||
private fun imageRequestServerWithSSO(
|
||||
internal fun imageRequestServerWithSSO(
|
||||
nextcloudAPI: NextcloudAPI,
|
||||
target: String,
|
||||
method: String,
|
||||
@@ -182,7 +182,7 @@ class NextcloudClient(
|
||||
}
|
||||
|
||||
@Throws(IOException::class, NextcloudHttpRequestFailedException::class)
|
||||
private fun requestServer(
|
||||
internal fun requestServer(
|
||||
target: String,
|
||||
method: String, params: JSONObject?, lastETag: String?, needLogin: Boolean, isOCSRequest: Boolean
|
||||
): VersatileProjectSyncClient.ResponseData {
|
||||
@@ -248,7 +248,7 @@ class NextcloudClient(
|
||||
}
|
||||
|
||||
@Throws(IOException::class, NextcloudHttpRequestFailedException::class)
|
||||
private fun imageRequestServer(
|
||||
internal fun imageRequestServer(
|
||||
target: String,
|
||||
method: String, params: JSONObject?, lastETag: String?, needLogin: Boolean, isOCSRequest: Boolean
|
||||
): VersatileProjectSyncClient.ResponseData {
|
||||
|
||||
@@ -163,11 +163,10 @@ class VersatileProjectSyncClient(
|
||||
paramValues.add(newEmail)
|
||||
}
|
||||
if (newMainCurrencyName != null) {
|
||||
paramKeys.add("currencyname")
|
||||
paramValues.add(newMainCurrencyName)
|
||||
paramKeys.add("currencyName")
|
||||
}
|
||||
if (newArchivedTs != null) {
|
||||
paramKeys.add("archived_ts")
|
||||
paramKeys.add("archivedTs")
|
||||
paramValues.add(newArchivedTs.toString())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user