add ability to set status type

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-02-08 12:25:30 +01:00
parent 19060bddbd
commit 45cfbc7257
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
3 changed files with 24 additions and 13 deletions

View file

@ -472,4 +472,10 @@ public interface NcApi {
@Field("statusIcon") String statusIcon, @Field("statusIcon") String statusIcon,
@Field("message") String message, @Field("message") String message,
@Field("clearAt") Long clearAt); @Field("clearAt") Long clearAt);
@FormUrlEncoded
@PUT
Observable<GenericOverall> setStatusType(@Header("Authorization") String authorization,
@Url String url,
@Field("statusType") String statusType);
} }

View file

@ -352,19 +352,20 @@ class SetStatusDialogFragment :
private fun setStatus(statusType: StatusType) { private fun setStatus(statusType: StatusType) {
visualizeStatus(statusType) visualizeStatus(statusType)
// asyncRunner.postQuickTask( ncApi.setStatusType(credentials, ApiUtils.getUrlForSetStatusType(currentUser?.baseUrl), statusType.string)
// SetStatusTask( .subscribeOn(Schedulers
// statusType, .io())
// accountManager.currentOwnCloudAccount?.savedAccount, .observeOn(AndroidSchedulers.mainThread()).subscribe(object : Observer<GenericOverall> {
// context override fun onSubscribe(d: Disposable) {}
// ), override fun onNext(statusOverall: GenericOverall) {
// { Log.d(TAG, "statusType successfully set")
// if (!it) { }
// clearTopStatus() override fun onError(e: Throwable) {
// } Log.e(logTag, "Failed to set statusType", e)
// }, clearTopStatus()
// { clearTopStatus() } }
// ) override fun onComplete() {}
})
} }
private fun visualizeStatus(statusType: String) { private fun visualizeStatus(statusType: String) {

View file

@ -425,6 +425,10 @@ public class ApiUtils {
return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status"; return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/user_status";
} }
public static String getUrlForSetStatusType(String baseUrl) {
return getUrlForStatus(baseUrl) + "/status";
}
public static String getUrlForPredefinedStatuses(String baseUrl) { public static String getUrlForPredefinedStatuses(String baseUrl) {
return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/predefined_statuses"; return baseUrl + ocsApiVersion + "/apps/user_status/api/v1/predefined_statuses";
} }