can post with boolean replaced by int

This commit is contained in:
Andrea Clement 2020-05-22 11:59:13 +02:00
parent be4b9e748f
commit 4b66d62930
2 changed files with 8 additions and 5 deletions

View File

@ -45,7 +45,7 @@ class PostCreationActivity : AppCompatActivity() {
private var user: UserDatabaseEntity? = null
private var maxLength: Int = Instance.DEFAULT_MAX_TOOT_CHARS
private var isSensitive = false
private var isSensitive = 0
private var description: String = ""
@ -87,7 +87,7 @@ class PostCreationActivity : AppCompatActivity() {
// Listen to sensitive checkBox
findViewById<CheckBox>(R.id.checkSensitive).setOnClickListener {
isSensitive = !isSensitive
isSensitive = (isSensitive + 1) % 2
}
// get the description and send the post to PixelFed
@ -159,12 +159,15 @@ class PostCreationActivity : AppCompatActivity() {
private fun post(id: String) {
if (id.isEmpty()) return
pixelfedAPI.postStatus(
val post = pixelfedAPI.postStatus(
authorization = "Bearer $accessToken",
statusText = description,
media_ids = listOf(id),
sensitive = isSensitive
).enqueue(object: Callback<Status> {
)
Log.e(TAG, post.request().toString())
post.enqueue(object: Callback<Status> {
override fun onFailure(call: Call<Status>, t: Throwable) {
Toast.makeText(applicationContext,"Post upload failed",Toast.LENGTH_SHORT).show()
Log.e(TAG, t.message + call.request())

View File

@ -98,7 +98,7 @@ interface PixelfedAPI {
@Field("poll[expires_in]") poll_expires : List<String>? = null,
@Field("poll[multiple]") poll_multiple : List<String>? = null,
@Field("poll[hide_totals]") poll_hideTotals : List<String>? = null,
@Field("sensitive") sensitive : Boolean? = null,
@Field("sensitive") sensitive : Int? = null,
@Field("spoiler_text") spoiler_text : String? = null,
@Field("visibility") visibility : String = "public",
@Field("scheduled_at") scheduled_at : String? = null,