mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-09 07:29:52 +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() {
|
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(
|
override fun onSubscribe(d: Disposable) {
|
||||||
credentials,
|
}
|
||||||
ApiUtils.getUrlForSetPredefinedStatus(currentUser?.baseUrl),
|
|
||||||
selectedPredefinedMessageId,
|
|
||||||
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 onNext(t: GenericOverall) {
|
override fun onError(e: Throwable) {
|
||||||
Log.d(TAG, "PredefinedStatusMessage successfully set")
|
Log.d(TAG, "failed to set CustomStatusMessage", e)
|
||||||
dismiss()
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(e: Throwable) {
|
override fun onComplete() {}
|
||||||
Log.d(TAG, "failed to set PredefinedStatusMessage", e)
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
@ -445,7 +417,6 @@ class SetStatusDialogFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(predefinedStatus: PredefinedStatus) {
|
override fun onClick(predefinedStatus: PredefinedStatus) {
|
||||||
selectedPredefinedMessageId = predefinedStatus.id
|
|
||||||
clearAt = clearAtToUnixTime(predefinedStatus.clearAt)
|
clearAt = clearAtToUnixTime(predefinedStatus.clearAt)
|
||||||
binding.emoji.setText(predefinedStatus.icon)
|
binding.emoji.setText(predefinedStatus.icon)
|
||||||
binding.customStatusInput.text?.clear()
|
binding.customStatusInput.text?.clear()
|
||||||
|
@ -437,11 +437,6 @@ public class ApiUtils {
|
|||||||
return getUrlForStatus(baseUrl) + "/message";
|
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) {
|
public static String getUrlForSetCustomStatus(String baseUrl) {
|
||||||
return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status/message/custom";
|
return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status/message/custom";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user