mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-17 01:35:03 +01:00
Fix file uploads
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
d5abcc01a3
commit
23bc417ba4
@ -197,9 +197,7 @@ dependencies {
|
|||||||
implementation "android.arch.work:work-rxjava2:${work_version}"
|
implementation "android.arch.work:work-rxjava2:${work_version}"
|
||||||
implementation 'com.google.android:flexbox:1.1.0'
|
implementation 'com.google.android:flexbox:1.1.0'
|
||||||
androidTestImplementation "android.arch.work:work-testing:${work_version}"
|
androidTestImplementation "android.arch.work:work-testing:${work_version}"
|
||||||
implementation ('com.gitlab.bitfireAT:dav4jvm:f2078bc846', {
|
implementation 'com.gitlab.bitfireAT:dav4jvm:ee66e8e5'
|
||||||
exclude group: 'org.ogce', module: 'xpp3' // Android comes with its own XmlPullParser
|
|
||||||
})
|
|
||||||
implementation 'org.conscrypt:conscrypt-android:2.2.1'
|
implementation 'org.conscrypt:conscrypt-android:2.2.1'
|
||||||
|
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
||||||
@ -219,9 +217,9 @@ dependencies {
|
|||||||
implementation 'com.bluelinelabs:conductor-autodispose:3.0.0-rc2'
|
implementation 'com.bluelinelabs:conductor-autodispose:3.0.0-rc2'
|
||||||
implementation "com.github.miquelbeltran:conductor-viewmodel:1.0.3"
|
implementation "com.github.miquelbeltran:conductor-viewmodel:1.0.3"
|
||||||
|
|
||||||
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
|
implementation 'com.squareup.okhttp3:okhttp:3.14.4'
|
||||||
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.2.2'
|
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.14.4'
|
||||||
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
|
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.4'
|
||||||
|
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
|
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
|
||||||
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'
|
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.6.2'
|
||||||
|
@ -22,12 +22,12 @@ package com.nextcloud.talk.components.filebrowser.models;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.Response;
|
import at.bitfire.dav4jvm.Response;
|
||||||
import at.bitfire.dav4android.property.DisplayName;
|
import at.bitfire.dav4jvm.property.DisplayName;
|
||||||
import at.bitfire.dav4android.property.GetContentType;
|
import at.bitfire.dav4jvm.property.GetContentType;
|
||||||
import at.bitfire.dav4android.property.GetLastModified;
|
import at.bitfire.dav4jvm.property.GetLastModified;
|
||||||
import at.bitfire.dav4android.property.ResourceType;
|
import at.bitfire.dav4jvm.property.ResourceType;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
import com.bluelinelabs.logansquare.annotation.JsonObject;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.NCEncrypted;
|
import com.nextcloud.talk.components.filebrowser.models.properties.NCEncrypted;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.NCPreview;
|
import com.nextcloud.talk.components.filebrowser.models.properties.NCPreview;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
package com.nextcloud.talk.components.filebrowser.models;
|
package com.nextcloud.talk.components.filebrowser.models;
|
||||||
|
|
||||||
import at.bitfire.dav4android.Response;
|
import at.bitfire.dav4jvm.Response;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
package com.nextcloud.talk.components.filebrowser.models.properties;
|
package com.nextcloud.talk.components.filebrowser.models.properties;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.PropertyFactory;
|
import at.bitfire.dav4jvm.PropertyFactory;
|
||||||
import at.bitfire.dav4android.XmlUtils;
|
import at.bitfire.dav4jvm.XmlUtils;
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
package com.nextcloud.talk.components.filebrowser.models.properties;
|
package com.nextcloud.talk.components.filebrowser.models.properties;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.PropertyFactory;
|
import at.bitfire.dav4jvm.PropertyFactory;
|
||||||
import at.bitfire.dav4android.XmlUtils;
|
import at.bitfire.dav4jvm.XmlUtils;
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
package com.nextcloud.talk.components.filebrowser.models.properties;
|
package com.nextcloud.talk.components.filebrowser.models.properties;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.PropertyFactory;
|
import at.bitfire.dav4jvm.PropertyFactory;
|
||||||
import at.bitfire.dav4android.XmlUtils;
|
import at.bitfire.dav4jvm.XmlUtils;
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
package com.nextcloud.talk.components.filebrowser.models.properties;
|
package com.nextcloud.talk.components.filebrowser.models.properties;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.PropertyFactory;
|
import at.bitfire.dav4jvm.PropertyFactory;
|
||||||
import at.bitfire.dav4android.XmlUtils;
|
import at.bitfire.dav4jvm.XmlUtils;
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
package com.nextcloud.talk.components.filebrowser.models.properties;
|
package com.nextcloud.talk.components.filebrowser.models.properties;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.PropertyFactory;
|
import at.bitfire.dav4jvm.PropertyFactory;
|
||||||
import at.bitfire.dav4android.XmlUtils;
|
import at.bitfire.dav4jvm.XmlUtils;
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
import com.nextcloud.talk.components.filebrowser.webdav.DavUtils;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -20,26 +20,23 @@
|
|||||||
|
|
||||||
package com.nextcloud.talk.components.filebrowser.webdav;
|
package com.nextcloud.talk.components.filebrowser.webdav;
|
||||||
|
|
||||||
import at.bitfire.dav4android.Property;
|
import at.bitfire.dav4jvm.Property;
|
||||||
import at.bitfire.dav4android.PropertyFactory;
|
import at.bitfire.dav4jvm.PropertyFactory;
|
||||||
import at.bitfire.dav4android.PropertyRegistry;
|
import at.bitfire.dav4jvm.PropertyRegistry;
|
||||||
import at.bitfire.dav4android.property.CreationDate;
|
import at.bitfire.dav4jvm.property.CreationDate;
|
||||||
import at.bitfire.dav4android.property.DisplayName;
|
import at.bitfire.dav4jvm.property.DisplayName;
|
||||||
import at.bitfire.dav4android.property.GetContentLength;
|
import at.bitfire.dav4jvm.property.GetContentLength;
|
||||||
import at.bitfire.dav4android.property.GetContentType;
|
import at.bitfire.dav4jvm.property.GetContentType;
|
||||||
import at.bitfire.dav4android.property.GetETag;
|
import at.bitfire.dav4jvm.property.GetETag;
|
||||||
import at.bitfire.dav4android.property.GetLastModified;
|
import at.bitfire.dav4jvm.property.GetLastModified;
|
||||||
import at.bitfire.dav4android.property.ResourceType;
|
import at.bitfire.dav4jvm.property.ResourceType;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.NCEncrypted;
|
import com.nextcloud.talk.components.filebrowser.models.properties.NCEncrypted;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.NCPreview;
|
import com.nextcloud.talk.components.filebrowser.models.properties.NCPreview;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.OCFavorite;
|
import com.nextcloud.talk.components.filebrowser.models.properties.OCFavorite;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.OCId;
|
import com.nextcloud.talk.components.filebrowser.models.properties.OCId;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.properties.OCSize;
|
import com.nextcloud.talk.components.filebrowser.models.properties.OCSize;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class DavUtils {
|
public class DavUtils {
|
||||||
public static final String OC_NAMESPACE = "http://owncloud.org/ns";
|
public static final String OC_NAMESPACE = "http://owncloud.org/ns";
|
||||||
@ -95,23 +92,13 @@ public class DavUtils {
|
|||||||
|
|
||||||
public static void registerCustomFactories() {
|
public static void registerCustomFactories() {
|
||||||
PropertyRegistry propertyRegistry = PropertyRegistry.INSTANCE;
|
PropertyRegistry propertyRegistry = PropertyRegistry.INSTANCE;
|
||||||
try {
|
List<PropertyFactory> propertyFactories = new ArrayList<>();
|
||||||
Field factories = propertyRegistry.getClass().getDeclaredField("factories");
|
propertyFactories.add(new OCId.Factory());
|
||||||
factories.setAccessible(true);
|
propertyFactories.add(new NCPreview.Factory());
|
||||||
Map<Property.Name, PropertyFactory> reflectionMap = (HashMap<Property.Name,
|
propertyFactories.add(new NCEncrypted.Factory());
|
||||||
PropertyFactory>) factories.get(propertyRegistry);
|
propertyFactories.add(new OCFavorite.Factory());
|
||||||
|
propertyFactories.add(new OCSize.Factory());
|
||||||
|
|
||||||
reflectionMap.put(OCId.NAME, new OCId.Factory());
|
propertyRegistry.register(propertyFactories);
|
||||||
reflectionMap.put(NCPreview.NAME, new NCPreview.Factory());
|
|
||||||
reflectionMap.put(NCEncrypted.NAME, new NCEncrypted.Factory());
|
|
||||||
reflectionMap.put(OCFavorite.NAME, new OCFavorite.Factory());
|
|
||||||
reflectionMap.put(OCSize.NAME, new OCSize.Factory());
|
|
||||||
|
|
||||||
factories.set(propertyRegistry, reflectionMap);
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
package com.nextcloud.talk.components.filebrowser.webdav;
|
package com.nextcloud.talk.components.filebrowser.webdav;
|
||||||
|
|
||||||
import at.bitfire.dav4android.DavResource;
|
import at.bitfire.dav4jvm.DavResource;
|
||||||
import at.bitfire.dav4android.Response;
|
import at.bitfire.dav4jvm.Response;
|
||||||
import at.bitfire.dav4android.exception.DavException;
|
import at.bitfire.dav4jvm.exception.DavException;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.BrowserFile;
|
import com.nextcloud.talk.components.filebrowser.models.BrowserFile;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
|
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
|
||||||
import com.nextcloud.talk.dagger.modules.RestModule;
|
import com.nextcloud.talk.dagger.modules.RestModule;
|
||||||
|
@ -1137,7 +1137,7 @@ class ChatController(args: Bundle) : BaseController(), MessagesListAdapter
|
|||||||
) {
|
) {
|
||||||
val xChatLastGivenHeader: String? = response.headers()
|
val xChatLastGivenHeader: String? = response.headers()
|
||||||
.get("X-Chat-Last-Given")
|
.get("X-Chat-Last-Given")
|
||||||
if (response.headers().size > 0 && !TextUtils.isEmpty(xChatLastGivenHeader)) {
|
if (response.headers().size() > 0 && !TextUtils.isEmpty(xChatLastGivenHeader)) {
|
||||||
|
|
||||||
val header = Integer.parseInt(xChatLastGivenHeader!!)
|
val header = Integer.parseInt(xChatLastGivenHeader!!)
|
||||||
if (header > 0) {
|
if (header > 0) {
|
||||||
|
@ -112,7 +112,7 @@ fun createOkHttpClient(
|
|||||||
// Trust own CA and all self-signed certs
|
// Trust own CA and all self-signed certs
|
||||||
httpClient.sslSocketFactory(sslSocketFactoryCompat, magicTrustManager)
|
httpClient.sslSocketFactory(sslSocketFactoryCompat, magicTrustManager)
|
||||||
httpClient.retryOnConnectionFailure(true)
|
httpClient.retryOnConnectionFailure(true)
|
||||||
httpClient.hostnameVerifier(magicTrustManager.getHostnameVerifier(OkHostnameVerifier))
|
httpClient.hostnameVerifier(magicTrustManager.getHostnameVerifier(OkHostnameVerifier.INSTANCE))
|
||||||
|
|
||||||
httpClient.dispatcher(dispatcher)
|
httpClient.dispatcher(dispatcher)
|
||||||
if (Proxy.NO_PROXY != proxy) {
|
if (Proxy.NO_PROXY != proxy) {
|
||||||
|
@ -45,14 +45,14 @@ class NetworkUtils {
|
|||||||
.header("User-Agent", ApiUtils.getUserAgent())
|
.header("User-Agent", ApiUtils.getUserAgent())
|
||||||
.header("Accept", "application/json")
|
.header("Accept", "application/json")
|
||||||
.header("OCS-APIRequest", "true")
|
.header("OCS-APIRequest", "true")
|
||||||
.method(original.method, original.body)
|
.method(original.method(), original.body())
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val response = chain.proceed(request)
|
val response = chain.proceed(request)
|
||||||
|
|
||||||
if (request.url.encodedPath.contains("/avatar/")) {
|
if (request.url().encodedPath().contains("/avatar/")) {
|
||||||
AvatarStatusCodeHolder.getInstance()
|
AvatarStatusCodeHolder.getInstance()
|
||||||
.statusCode = response.code
|
.statusCode = response.code()
|
||||||
}
|
}
|
||||||
|
|
||||||
return response
|
return response
|
||||||
@ -68,7 +68,7 @@ class NetworkUtils {
|
|||||||
route: Route?,
|
route: Route?,
|
||||||
response: Response
|
response: Response
|
||||||
): Request? {
|
): Request? {
|
||||||
if (response.request.header(authenticatorType) != null) {
|
if (response.request().header(authenticatorType) != null) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,13 +77,13 @@ class NetworkUtils {
|
|||||||
var attemptsCount = 0
|
var attemptsCount = 0
|
||||||
|
|
||||||
|
|
||||||
while ({ countedResponse = countedResponse?.priorResponse; countedResponse }() != null) {
|
while ({ countedResponse = countedResponse?.priorResponse(); countedResponse }() != null) {
|
||||||
attemptsCount++
|
attemptsCount++
|
||||||
if (attemptsCount == 3) {
|
if (attemptsCount == 3) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return response.request.newBuilder()
|
return response.request().newBuilder()
|
||||||
.header(authenticatorType, credentials)
|
.header(authenticatorType, credentials)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user