Commits (3)
...@@ -5,6 +5,7 @@ ownCloud Android Library is available under MIT license ...@@ -5,6 +5,7 @@ ownCloud Android Library is available under MIT license
Copyright (C) 2016 Nextcloud Project Copyright (C) 2016 Nextcloud Project
Copyright (C) 2014-2016 ownCloud Inc. Copyright (C) 2014-2016 ownCloud Inc.
Copyright (C) 2012 Bartek Przybylski 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
# [/e/ NC/Dav Android Library](https://e.foundation/) # [/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 ## Introduction
Using Nextcloud Android library it will be the easiest way to communicate with Nextcloud servers. Using Nextcloud Android library it will be the easiest way to communicate with Nextcloud servers.
......
...@@ -4,7 +4,7 @@ buildscript { ...@@ -4,7 +4,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { 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' 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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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 { ...@@ -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. * Requests the received method.
* *
...@@ -224,9 +211,8 @@ public class OwnCloudClient extends HttpClient { ...@@ -224,9 +211,8 @@ public class OwnCloudClient extends HttpClient {
* With the specified userAgent * With the specified userAgent
* *
* @param method HTTP method request. * @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 { try {
// Update User Agent // Update User Agent
HttpParams params = method.getParams(); HttpParams params = method.getParams();
...@@ -237,6 +223,7 @@ public class OwnCloudClient extends HttpClient { ...@@ -237,6 +223,7 @@ public class OwnCloudClient extends HttpClient {
} else { } else {
userAgent = OwnCloudClientManagerFactory.getUserAgent(); userAgent = OwnCloudClientManagerFactory.getUserAgent();
}*/ }*/
String userAgent = OwnCloudClientManagerFactory.getUserAgent();
params.setParameter(HttpMethodParams.USER_AGENT, userAgent); params.setParameter(HttpMethodParams.USER_AGENT, userAgent);
Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " + Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " +
......
...@@ -92,7 +92,7 @@ public class CreateFolderRemoteOperation extends RemoteOperation { ...@@ -92,7 +92,7 @@ public class CreateFolderRemoteOperation extends RemoteOperation {
try { try {
mkCol = new MkColMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath)); mkCol = new MkColMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
client.setUseNextcloudUserAgent(true); client.setUseNextcloudUserAgent(false);
client.executeMethod(mkCol, READ_TIMEOUT, CONNECTION_TIMEOUT); client.executeMethod(mkCol, READ_TIMEOUT, CONNECTION_TIMEOUT);
if (HttpStatus.SC_METHOD_NOT_ALLOWED == mkCol.getStatusCode()) { if (HttpStatus.SC_METHOD_NOT_ALLOWED == mkCol.getStatusCode()) {
......
...@@ -85,7 +85,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation { ...@@ -85,7 +85,7 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
protected RemoteOperationResult run(OwnCloudClient client) { protected RemoteOperationResult run(OwnCloudClient client) {
RemoteOperationResult result = null; RemoteOperationResult result = null;
PropFindMethod propfind = null; PropFindMethod propfind = null;
String userAgent =""; //String userAgent ="";
try { try {
// remote request // remote request
if(allowGzip){ if(allowGzip){
...@@ -93,14 +93,14 @@ public class LightReadFolderRemoteOperation extends RemoteOperation { ...@@ -93,14 +93,14 @@ public class LightReadFolderRemoteOperation extends RemoteOperation {
WebdavUtils.getMinimumPropSet(), // PropFind Properties WebdavUtils.getMinimumPropSet(), // PropFind Properties
this.depth); this.depth);
propfind.setRequestHeader("Accept-Encoding", "gzip"); propfind.setRequestHeader("Accept-Encoding", "gzip");
userAgent = "gzipUserAgent"; //userAgent = "gzipUserAgent";
}else{ }else{
propfind = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath), propfind = new PropFindMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath),
WebdavUtils.getAllPropSet(), // PropFind Properties WebdavUtils.getAllPropSet(), // PropFind Properties
this.depth); this.depth);
} }
int status = client.executeMethod(propfind, userAgent); int status = client.executeMethod(propfind/*, userAgent*/);
// check and process response // check and process response
boolean isSuccess = (status == HttpStatus.SC_MULTI_STATUS || status == HttpStatus.SC_OK); boolean isSuccess = (status == HttpStatus.SC_MULTI_STATUS || status == HttpStatus.SC_OK);
......
...@@ -134,7 +134,7 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation { ...@@ -134,7 +134,7 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
private static final String NODE_RICHDOCUMENTS = "richdocuments"; private static final String NODE_RICHDOCUMENTS = "richdocuments";
private static final String NODE_MIMETYPES = "mimetypes"; private static final String NODE_MIMETYPES = "mimetypes";
private static final String NODE_RICHDOCUMENTS_DIRECT_EDITING = "direct_editing"; private static final String NODE_RICHDOCUMENTS_DIRECT_EDITING = "direct_editing";
private static final String NODE_RICHDOCUMENTS_TEMPLATES = "templates";
// activity // activity
private static final String NODE_ACTIVITY = "activity"; private static final String NODE_ACTIVITY = "activity";
...@@ -403,10 +403,10 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation { ...@@ -403,10 +403,10 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
} }
if (respCapabilities.has(NODE_RICHDOCUMENTS)) { if (respCapabilities.has(NODE_RICHDOCUMENTS)) {
JSONObject richDocumentsCapability = respCapabilities.getJSONObject(NODE_RICHDOCUMENTS);
capability.setRichDocuments(CapabilityBooleanType.TRUE); capability.setRichDocuments(CapabilityBooleanType.TRUE);
JSONArray mimeTypesArray = respCapabilities.getJSONObject(NODE_RICHDOCUMENTS) JSONArray mimeTypesArray = richDocumentsCapability.getJSONArray(NODE_MIMETYPES);
.getJSONArray(NODE_MIMETYPES);
ArrayList<String> mimeTypes = new ArrayList<>(); ArrayList<String> mimeTypes = new ArrayList<>();
...@@ -416,11 +416,25 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation { ...@@ -416,11 +416,25 @@ public class GetRemoteCapabilitiesOperation extends RemoteOperation {
capability.setRichDocumentsMimeTypeList(mimeTypes); capability.setRichDocumentsMimeTypeList(mimeTypes);
if (respCapabilities.has(NODE_RICHDOCUMENTS_DIRECT_EDITING)) { if (richDocumentsCapability.has(NODE_RICHDOCUMENTS_DIRECT_EDITING)) {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE); if (richDocumentsCapability.getBoolean(NODE_RICHDOCUMENTS_DIRECT_EDITING)) {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE);
} else {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE);
}
} else { } else {
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.FALSE); 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 { } else {
capability.setRichDocuments(CapabilityBooleanType.FALSE); capability.setRichDocuments(CapabilityBooleanType.FALSE);
} }
......
...@@ -91,6 +91,7 @@ public class OCCapability { ...@@ -91,6 +91,7 @@ public class OCCapability {
// Richdocuments // Richdocuments
private CapabilityBooleanType richdocuments; private CapabilityBooleanType richdocuments;
private CapabilityBooleanType richdocumentsDirectEditing; private CapabilityBooleanType richdocumentsDirectEditing;
private CapabilityBooleanType richdocumentsTemplatesAvailable;
private List<String> richdocumentsMimeTypeList; private List<String> richdocumentsMimeTypeList;
private CapabilityBooleanType activity; private CapabilityBooleanType activity;
...@@ -145,6 +146,7 @@ public class OCCapability { ...@@ -145,6 +146,7 @@ public class OCCapability {
richdocuments = CapabilityBooleanType.UNKNOWN; richdocuments = CapabilityBooleanType.UNKNOWN;
richdocumentsMimeTypeList = new ArrayList<>(); richdocumentsMimeTypeList = new ArrayList<>();
richdocumentsDirectEditing = CapabilityBooleanType.FALSE; richdocumentsDirectEditing = CapabilityBooleanType.FALSE;
richdocumentsTemplatesAvailable = CapabilityBooleanType.FALSE;
} }
...@@ -496,4 +498,13 @@ public class OCCapability { ...@@ -496,4 +498,13 @@ public class OCCapability {
public CapabilityBooleanType getRichDocumentsDirectEditing() { public CapabilityBooleanType getRichDocumentsDirectEditing() {
return richdocumentsDirectEditing; return richdocumentsDirectEditing;
} }
public CapabilityBooleanType getRichdocumentsTemplatesAvailable() {
return richdocumentsTemplatesAvailable;
}
public void setRichdocumentsTemplatesAvailable(CapabilityBooleanType richdocumentsTemplatesAvailable) {
this.richdocumentsTemplatesAvailable = richdocumentsTemplatesAvailable;
}
} }