Commits (3)
......@@ -5,6 +5,7 @@ ownCloud Android Library is available under MIT license
Copyright (C) 2016 Nextcloud Project
Copyright (C) 2014-2016 ownCloud Inc.
Copyright (C) 2012 Bartek Przybylski
Copyright (C) 2019 ECORP SAS - Author: Vincent Bourgmayer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
# [/e/ NC/Dav Android Library](https://e.foundation/)
# ~~[Nextcloud](https://nextcloud.com) Android Library~~ [![Build Status](https://drone.nextcloud.com/api/badges/nextcloud/android-library/status.svg)](https://drone.nextcloud.com/nextcloud/android-library) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d9f94f04e0f447a6b21c0ae08f6f7594)](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com&utm_medium=referral&utm_content=nextcloud/android-library&utm_campaign=Badge_Grade)
~~[Nextcloud](https://nextcloud.com) Android Library~~ [![Build Status](https://drone.nextcloud.com/api/badges/nextcloud/android-library/status.svg)](https://drone.nextcloud.com/nextcloud/android-library) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d9f94f04e0f447a6b21c0ae08f6f7594)](https://www.codacy.com/app/Nextcloud/android-library?utm_source=github.com&utm_medium=referral&utm_content=nextcloud/android-library&utm_campaign=Badge_Grade)
## Introduction
Using Nextcloud Android library it will be the easiest way to communicate with Nextcloud servers.
......
......@@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
......
#Thu Oct 25 12:00:00 CET 2018
#Tue Mar 05 13:55:31 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
......@@ -204,19 +204,6 @@ public class OwnCloudClient extends HttpClient {
}
}
/**
* Requests the received method.
*
* Executes the method through the inherited HttpClient.executedMethod(method).
*
* @param method HTTP method request.
*/
@Override
public int executeMethod(HttpMethod method) throws IOException{
return executeMethod(method,
mUseNextcloudUserAgent ? OwnCloudClientManagerFactory.getNextcloudUserAgent() : OwnCloudClientManagerFactory.getUserAgent());
}
/**
* Requests the received method.
*
......@@ -224,9 +211,8 @@ public class OwnCloudClient extends HttpClient {
* With the specified userAgent
*
* @param method HTTP method request.
* @param userAgent value of user agent parameters.
*/
public int executeMethod(HttpMethod method, String userAgent) throws IOException {
public int executeMethod(HttpMethod method) throws IOException {
try {
// Update User Agent
HttpParams params = method.getParams();
......@@ -237,6 +223,7 @@ public class OwnCloudClient extends HttpClient {
} else {
userAgent = OwnCloudClientManagerFactory.getUserAgent();
}*/
String userAgent = OwnCloudClientManagerFactory.getUserAgent();
params.setParameter(HttpMethodParams.USER_AGENT, userAgent);
Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " +
......
......@@ -92,7 +92,7 @@ public class CreateFolderRemoteOperation extends RemoteOperation {
try {
mkCol = new MkColMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
client.setUseNextcloudUserAgent(true);
client.setUseNextcloudUserAgent(false);
client.executeMethod(mkCol, READ_TIMEOUT, CONNECTION_TIMEOUT);
if (HttpStatus.SC_METHOD_NOT_ALLOWED == mkCol.getStatusCode()) {
......
......@@ -85,7 +85,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = null;
PropFindMethod propfind = null;
String userAgent ="";
//String userAgent ="";
try {
// remote request
if(allowGzip){
......@@ -93,14 +93,14 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
WebdavUtils.getMinimumPropSet(), // PropFind Properties
this.depth);
propfind.setRequestHeader("Accept-Encoding", "gzip");
userAgent = "gzipUserAgent";
//userAgent = "gzipUserAgent";
}else{
propfind = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
WebdavUtils.getAllPropSet(), // PropFind Properties
this.depth);
}
int status = client.executeMethod(propfind, userAgent);
int status = client.executeMethod(propfind/*, userAgent*/);
// check and process response
boolean isSuccess = (status == HttpStatus.SC_MULTI_STATUS || status == HttpStatus.SC_OK);
......
......@@ -134,7 +134,7 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
private static final String NODE_RICHDOCUMENTS = "richdocuments";
private static final String NODE_MIMETYPES = "mimetypes";
private static final String NODE_RICHDOCUMENTS_DIRECT_EDITING = "direct_editing";
private static final String NODE_RICHDOCUMENTS_TEMPLATES = "templates";
// activity
private static final String NODE_ACTIVITY = "activity";
......@@ -403,10 +403,10 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
}
if (respCapabilities.has(NODE_RICHDOCUMENTS)) {
JSONObject richDocumentsCapability = respCapabilities.getJSONObject(NODE_RICHDOCUMENTS);
capability.setRichDocuments(CapabilityBooleanType.TRUE);
JSONArray mimeTypesArray = respCapabilities.getJSONObject(NODE_RICHDOCUMENTS)
.getJSONArray(NODE_MIMETYPES);
JSONArray mimeTypesArray = richDocumentsCapability.getJSONArray(NODE_MIMETYPES);
ArrayList<String> mimeTypes = new ArrayList<>();
......@@ -416,11 +416,25 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
capability.setRichDocumentsMimeTypeList(mimeTypes);
if (respCapabilities.has(NODE_RICHDOCUMENTS_DIRECT_EDITING)) {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE);
if (richDocumentsCapability.has(NODE_RICHDOCUMENTS_DIRECT_EDITING)) {
if (richDocumentsCapability.getBoolean(NODE_RICHDOCUMENTS_DIRECT_EDITING)) {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE);
} else {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE);
}
} else {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE);
}
if (richDocumentsCapability.has(NODE_RICHDOCUMENTS_TEMPLATES)) {
if (richDocumentsCapability.getBoolean(NODE_RICHDOCUMENTS_TEMPLATES)) {
capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.TRUE);
} else {
capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.FALSE);
}
} else {
capability.setRichdocumentsTemplatesAvailable(CapabilityBooleanType.FALSE);
}
} else {
capability.setRichDocuments(CapabilityBooleanType.FALSE);
}
......
......@@ -91,6 +91,7 @@ public class OCCapability {
// Richdocuments
private CapabilityBooleanType richdocuments;
private CapabilityBooleanType richdocumentsDirectEditing;
private CapabilityBooleanType richdocumentsTemplatesAvailable;
private List<String> richdocumentsMimeTypeList;
private CapabilityBooleanType activity;
......@@ -145,6 +146,7 @@ public class OCCapability {
richdocuments = CapabilityBooleanType.UNKNOWN;
richdocumentsMimeTypeList = new ArrayList<>();
richdocumentsDirectEditing = CapabilityBooleanType.FALSE;
richdocumentsTemplatesAvailable = CapabilityBooleanType.FALSE;
}
......@@ -496,4 +498,13 @@ public class OCCapability {
public CapabilityBooleanType getRichDocumentsDirectEditing() {
return richdocumentsDirectEditing;
}
public CapabilityBooleanType getRichdocumentsTemplatesAvailable() {
return richdocumentsTemplatesAvailable;
}
public void setRichdocumentsTemplatesAvailable(CapabilityBooleanType richdocumentsTemplatesAvailable) {
this.richdocumentsTemplatesAvailable = richdocumentsTemplatesAvailable;
}
}