mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
refactor code
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
99d73e15e0
commit
9f3bbf6ebf
2 changed files with 17 additions and 12 deletions
|
@ -121,14 +121,14 @@ interface NcApiCoroutines {
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
suspend fun setReadStatusPrivacy(
|
suspend fun setReadStatusPrivacy(
|
||||||
@Header("Authorization") authorization: String?,
|
@Header("Authorization") authorization: String,
|
||||||
@Url url: String,
|
@Url url: String,
|
||||||
@Body body: RequestBody
|
@Body body: RequestBody
|
||||||
): GenericOverall
|
): GenericOverall
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
suspend fun setTypingStatusPrivacy(
|
suspend fun setTypingStatusPrivacy(
|
||||||
@Header("Authorization") authorization: String?,
|
@Header("Authorization") authorization: String,
|
||||||
@Url url: String,
|
@Url url: String,
|
||||||
@Body body: RequestBody
|
@Body body: RequestBody
|
||||||
): GenericOverall
|
): GenericOverall
|
||||||
|
|
|
@ -1285,11 +1285,13 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
|
||||||
val booleanValue = if (newBoolean) "0" else "1"
|
val booleanValue = if (newBoolean) "0" else "1"
|
||||||
val json = "{\"key\": \"read_status_privacy\", \"value\" : $booleanValue}"
|
val json = "{\"key\": \"read_status_privacy\", \"value\" : $booleanValue}"
|
||||||
try {
|
try {
|
||||||
ncApiCoroutines.setReadStatusPrivacy(
|
credentials?.let { credentials ->
|
||||||
ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token),
|
ncApiCoroutines.setReadStatusPrivacy(
|
||||||
ApiUtils.getUrlForUserSettings(currentUser!!.baseUrl!!),
|
credentials,
|
||||||
json.toRequestBody("application/json".toMediaTypeOrNull())
|
ApiUtils.getUrlForUserSettings(currentUser!!.baseUrl!!),
|
||||||
)
|
json.toRequestBody("application/json".toMediaTypeOrNull())
|
||||||
|
)
|
||||||
|
}
|
||||||
Log.i(TAG, "reading status set")
|
Log.i(TAG, "reading status set")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
appPreferences.setReadPrivacy(!newBoolean)
|
appPreferences.setReadPrivacy(!newBoolean)
|
||||||
|
@ -1310,11 +1312,14 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
|
||||||
val json = "{\"key\": \"typing_privacy\", \"value\" : $booleanValue}"
|
val json = "{\"key\": \"typing_privacy\", \"value\" : $booleanValue}"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ncApiCoroutines.setTypingStatusPrivacy(
|
credentials?.let { credentials ->
|
||||||
ApiUtils.getCredentials(currentUser!!.username, currentUser!!.token),
|
ncApiCoroutines.setTypingStatusPrivacy(
|
||||||
ApiUtils.getUrlForUserSettings(currentUser!!.baseUrl!!),
|
credentials,
|
||||||
json.toRequestBody("application/json".toMediaTypeOrNull())
|
ApiUtils.getUrlForUserSettings(currentUser!!.baseUrl!!),
|
||||||
)
|
json.toRequestBody("application/json".toMediaTypeOrNull())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
loadCapabilitiesAndUpdateSettings()
|
loadCapabilitiesAndUpdateSettings()
|
||||||
Log.i(TAG, "typing status set")
|
Log.i(TAG, "typing status set")
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
Loading…
Reference in a new issue