Commit 0112d0ff authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch '113-issue-o-v1' into 'v1-oreo'

Resolve "add /e/ userAgent in request"-oreo

See merge request e/apps/eDrive!35
parents c1c7cacb fce75e14
Pipeline #63739 passed with stage
in 2 minutes and 10 seconds
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/nextcloud-android-lib" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="$USER_HOME$/Android/Sdk/extras/google/m2repository" />
<option name="name" value="$USER_HOME$/Android/Sdk/extras/google/m2repository" />
<option name="url" value="file:$USER_HOME$/Android/Sdk/extras/google/m2repository" />
</remote-repository>
<remote-repository>
<option name="id" value="$USER_HOME$/Android/Sdk/extras/android/m2repository" />
<option name="name" value="$USER_HOME$/Android/Sdk/extras/android/m2repository" />
<option name="url" value="file:$USER_HOME$/Android/Sdk/extras/android/m2repository" />
</remote-repository>
<remote-repository>
<option name="id" value="$USER_HOME$/Android/Sdk/extras/m2repository" />
<option name="name" value="$USER_HOME$/Android/Sdk/extras/m2repository" />
<option name="url" value="file:$USER_HOME$/Android/Sdk/extras/m2repository" />
</remote-repository>
</component>
</project>
\ No newline at end of file
......@@ -6,10 +6,18 @@
* http://www.gnu.org/licenses/gpl.html
*/
package foundation.e.drive.utils;
import android.os.Build;
import foundation.e.drive.BuildConfig;
import java.text.SimpleDateFormat;
import java.util.Locale;
import foundation.e.drive.BuildConfig;
/**
* @author Vincent Bourgmayer
*/
......@@ -33,4 +41,18 @@ public abstract class AppConstants {
public final static String notificationChannelID ="3310";
public final static String notificationChannelName="eDrive channel";
public final static String USER_AGENT = "eos("+getBuildTime()+")-eDrive("+ BuildConfig.VERSION_NAME +")";
/**
* Get a readable OS's build date String
* @return Os'build date
*/
private static String getBuildTime(){
long ts = Build.TIME;
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
return sdf.format(ts);
}
}
......@@ -26,6 +26,7 @@ import android.webkit.MimeTypeMap;
import com.owncloud.android.lib.common.OwnCloudBasicCredentials;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.OwnCloudClientFactory;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.resources.files.FileUtils;
......@@ -159,6 +160,11 @@ public abstract class CommonUtils {
oc = OwnCloudClientFactory.createOwnCloudClient(serverUri, context, true);
oc.setCredentials(new OwnCloudBasicCredentials(account.name, AccountManager.get(context).getPassword(account)));
Log.d(TAG, "user agent: "+AppConstants.USER_AGENT);
if(!AppConstants.USER_AGENT.equals(OwnCloudClientManagerFactory.getUserAgent())) {
OwnCloudClientManagerFactory.setUserAgent(AppConstants.USER_AGENT);
}
} catch (Exception e) {
Log.e(TAG, "Can\'t parse serverPath to Uri : " + e.toString());
oc = null;
......@@ -167,6 +173,7 @@ public abstract class CommonUtils {
}
/** methods relative to file **/
/**
......
Subproject commit c6b717a01c2f84015357cd9dfa8b48155ff01045
Subproject commit 880099c889253f30969b81c5e07750f070bfb65c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment