mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
Move constants and utils to proper files
This commit is contained in:
parent
4f07187fa2
commit
1536a455a6
@ -53,6 +53,7 @@ import static com.owncloud.android.lib.common.http.HttpConstants.OC_X_REQUEST_ID
|
||||
public class OwnCloudClient extends HttpClient {
|
||||
|
||||
public static final String WEBDAV_FILES_PATH_4_0 = "/remote.php/dav/files/";
|
||||
public static final String WEBDAV_PATH_4_0_AND_LATER = "/remote.php/dav";
|
||||
private static final String WEBDAV_UPLOADS_PATH_4_0 = "/remote.php/dav/uploads/";
|
||||
public static final String STATUS_PATH = "/status.php";
|
||||
|
||||
|
@ -329,7 +329,5 @@ public class AccountUtils {
|
||||
* OAuth2 scope
|
||||
*/
|
||||
public static final String KEY_OAUTH2_SCOPE = "oc_oauth2_scope";
|
||||
|
||||
public static final String WEBDAV_PATH_4_0_AND_LATER = "/remote.php/dav";
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.owncloud.android.lib.common.OwnCloudClient.WEBDAV_PATH_4_0_AND_LATER;
|
||||
|
||||
public class WebdavUtils {
|
||||
public static final SimpleDateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat(
|
||||
"dd.MM.yyyy hh:mm");
|
||||
@ -120,4 +122,31 @@ public class WebdavUtils {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String trimWebdavSuffix(String url) {
|
||||
if (url == null) {
|
||||
url = "";
|
||||
} else {
|
||||
if (url.endsWith("/")) {
|
||||
url = url.substring(0, url.length() - 1);
|
||||
}
|
||||
if (url.toLowerCase().endsWith(WEBDAV_PATH_4_0_AND_LATER)) {
|
||||
url = url.substring(0, url.length() - WEBDAV_PATH_4_0_AND_LATER.length());
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public static String normalizeProtocolPrefix(String url, boolean isSslConn) {
|
||||
if (!url.toLowerCase().startsWith("http://") &&
|
||||
!url.toLowerCase().startsWith("https://")) {
|
||||
if (isSslConn) {
|
||||
return "https://" + url;
|
||||
} else {
|
||||
return "http://" + url;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
@ -25,6 +25,8 @@ package com.owncloud.android.lib.resources
|
||||
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
// Response retrieved by OCS Rest API, used to obtain capabilities, shares and user info among others.
|
||||
// More info: https://doc.owncloud.com/server/developer_manual/core/apis/ocs-capabilities.html
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class CommonOcsResponse<T>(
|
||||
val ocs: OCSResponse<T>
|
||||
|
@ -46,7 +46,7 @@ import javax.net.ssl.SSLException
|
||||
* @author David González Verdugo
|
||||
* @author Abel García de Prada
|
||||
*/
|
||||
class GetStatusRemoteOperation : RemoteOperation<OwnCloudVersion>() {
|
||||
class GetRemoteStatusOperation : RemoteOperation<OwnCloudVersion>() {
|
||||
private lateinit var latestResult: RemoteOperationResult<OwnCloudVersion>
|
||||
|
||||
override fun run(client: OwnCloudClient): RemoteOperationResult<OwnCloudVersion> {
|
@ -45,7 +45,7 @@ import java.net.URL
|
||||
* @author David González Verdugo
|
||||
* @author Abel García de Prada
|
||||
*/
|
||||
class GetUserInfoRemoteOperation : RemoteOperation<RemoteUserInfo>() {
|
||||
class GetRemoteUserInfoOperation : RemoteOperation<RemoteUserInfo>() {
|
||||
override fun run(client: OwnCloudClient): RemoteOperationResult<RemoteUserInfo> {
|
||||
var result: RemoteOperationResult<RemoteUserInfo>
|
||||
//Get the user
|
Loading…
x
Reference in New Issue
Block a user