mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 15:05:44 +03:00
add ability to set status type
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
19060bddbd
commit
45cfbc7257
3 changed files with 24 additions and 13 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue