use of com.owncloud.android.lib.resources.users.GetPredefinedStatusesRemoteOperation in project android by nextcloud.
the class RefreshFolderOperation method updatePredefinedStatus.
private void updatePredefinedStatus(ArbitraryDataProvider arbitraryDataProvider) {
NextcloudClient client;
try {
client = OwnCloudClientFactory.createNextcloudClient(user.toPlatformAccount(), mContext);
} catch (AccountUtils.AccountNotFoundException | NullPointerException e) {
Log_OC.e(this, "Update of predefined status not possible!");
return;
}
RemoteOperationResult<ArrayList<PredefinedStatus>> result = new GetPredefinedStatusesRemoteOperation().execute(client);
if (result.isSuccess()) {
ArrayList<PredefinedStatus> predefinedStatuses = result.getResultData();
String json = new Gson().toJson(predefinedStatuses);
arbitraryDataProvider.storeOrUpdateKeyValue(user.getAccountName(), ArbitraryDataProvider.PREDEFINED_STATUS, json);
} else {
arbitraryDataProvider.deleteKeyForAccount(user.getAccountName(), ArbitraryDataProvider.PREDEFINED_STATUS);
}
}
Aggregations