mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 22:29:09 +00:00
fix to be able to modify status message after predefined status was selected
so api to set a predefined status is not used at all.. Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c87940e115
commit
bce0d276f3
@ -385,59 +385,31 @@ class SetStatusDialogFragment :
|
||||
}
|
||||
|
||||
private fun setStatusMessage() {
|
||||
if (selectedPredefinedMessageId != null) {
|
||||
ncApi.setCustomStatusMessage(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl),
|
||||
binding.emoji.text.toString(),
|
||||
binding.customStatusInput.text.toString(),
|
||||
clearAt)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<GenericOverall> {
|
||||
|
||||
ncApi.setPredefinedStatusMessage(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSetPredefinedStatus(currentUser?.baseUrl),
|
||||
selectedPredefinedMessageId,
|
||||
clearAt)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
override fun onNext(t: GenericOverall) {
|
||||
Log.d(TAG, "CustomStatusMessage successfully set")
|
||||
dismiss()
|
||||
}
|
||||
|
||||
override fun onNext(t: GenericOverall) {
|
||||
Log.d(TAG, "PredefinedStatusMessage successfully set")
|
||||
dismiss()
|
||||
}
|
||||
override fun onError(e: Throwable) {
|
||||
Log.d(TAG, "failed to set CustomStatusMessage", e)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
Log.d(TAG, "failed to set PredefinedStatusMessage", e)
|
||||
}
|
||||
override fun onComplete() {}
|
||||
|
||||
override fun onComplete() {}
|
||||
|
||||
})
|
||||
} else {
|
||||
ncApi.setCustomStatusMessage(
|
||||
credentials,
|
||||
ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl),
|
||||
binding.emoji.text.toString(),
|
||||
binding.customStatusInput.text.toString(),
|
||||
clearAt)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<GenericOverall> {
|
||||
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
|
||||
override fun onNext(t: GenericOverall) {
|
||||
Log.d(TAG, "CustomStatusMessage successfully set")
|
||||
dismiss()
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
Log.d(TAG, "failed to set CustomStatusMessage", e)
|
||||
}
|
||||
|
||||
override fun onComplete() {}
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
@ -445,7 +417,6 @@ class SetStatusDialogFragment :
|
||||
}
|
||||
|
||||
override fun onClick(predefinedStatus: PredefinedStatus) {
|
||||
selectedPredefinedMessageId = predefinedStatus.id
|
||||
clearAt = clearAtToUnixTime(predefinedStatus.clearAt)
|
||||
binding.emoji.setText(predefinedStatus.icon)
|
||||
binding.customStatusInput.text?.clear()
|
||||
|
@ -437,11 +437,6 @@ public class ApiUtils {
|
||||
return getUrlForStatus(baseUrl) + "/message";
|
||||
}
|
||||
|
||||
|
||||
public static String getUrlForSetPredefinedStatus(String baseUrl) {
|
||||
return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status/message/predefined";
|
||||
}
|
||||
|
||||
public static String getUrlForSetCustomStatus(String baseUrl) {
|
||||
return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status/message/custom";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user