diff --git a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java index a1394caa1..629747cce 100644 --- a/library/src/androidTest/java/com/owncloud/android/AbstractIT.java +++ b/library/src/androidTest/java/com/owncloud/android/AbstractIT.java @@ -80,10 +80,10 @@ public abstract class AbstractIT { @BeforeClass public static void beforeAll() throws InterruptedException, - CertificateException, - NoSuchAlgorithmException, - KeyStoreException, - IOException { + CertificateException, + NoSuchAlgorithmException, + KeyStoreException, + IOException { Bundle arguments = InstrumentationRegistry.getArguments(); context = InstrumentationRegistry.getInstrumentation().getTargetContext(); @@ -138,10 +138,10 @@ private static void waitForServer(OwnCloudClient client, Uri baseUrl) { } private static void testConnection() throws KeyStoreException, - CertificateException, - NoSuchAlgorithmException, - IOException, - InterruptedException { + CertificateException, + NoSuchAlgorithmException, + IOException, + InterruptedException { GetStatusRemoteOperation getStatus = new GetStatusRemoteOperation(context); RemoteOperationResult result = getStatus.execute(client); @@ -159,8 +159,8 @@ private static void testConnection() throws KeyStoreException, Thread.sleep(1000); assertEquals(certificate, - NetworkUtils.getKnownServersStore(context) - .getCertificate(Integer.toString(certificate.hashCode())) + NetworkUtils.getKnownServersStore(context) + .getCertificate(Integer.toString(certificate.hashCode())) ); // retry @@ -271,18 +271,18 @@ private void removeOnClient(OwnCloudClient client) { RemoteFile remoteFile = (RemoteFile) object; if (!"/".equals(remoteFile.getRemotePath()) && - remoteFile.getMountType() != WebdavEntry.MountType.GROUP) { + remoteFile.getMountType() != WebdavEntry.MountType.GROUP) { if (remoteFile.isEncrypted()) { assertTrue(new ToggleEncryptionRemoteOperation( - remoteFile.getLocalId(), - remoteFile.getRemotePath(), - false) - .execute(client) - .isSuccess()); + remoteFile.getLocalId(), + remoteFile.getRemotePath(), + false) + .execute(client) + .isSuccess()); } assertTrue("Failed to remove " + remoteFile.getRemotePath(), - new RemoveFileRemoteOperation(remoteFile.getRemotePath()).execute(client).isSuccess()); + new RemoveFileRemoteOperation(remoteFile.getRemotePath()).execute(client).isSuccess()); } } @@ -316,8 +316,8 @@ protected void longSleep() { protected void testOnlyOnServer(OwnCloudVersion version) { OCCapability ocCapability = (OCCapability) new GetCapabilitiesRemoteOperation() - .execute(nextcloudClient) - .getSingleData(); + .execute(nextcloudClient) + .getSingleData(); assumeTrue(ocCapability.getVersion().isNewerOrEqual(version)); } } diff --git a/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java index 240f573f7..5445234be 100644 --- a/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java @@ -143,6 +143,15 @@ private void checkCapability(OCCapability capability, String userId) { assertTrue(capability.getGroupfolders().isFalse()); } + // assistant + if (capability.getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_28)) { + if (userId.equals("test")) { + assertTrue(capability.getAssistant().isTrue()); + } else { + assertFalse(capability.getAssistant().isFalse()); + } + } + // e2e assertNotSame(capability.getEndToEndEncryptionApiVersion(), E2EVersion.UNKNOWN); } diff --git a/library/src/main/java/com/owncloud/android/lib/resources/status/GetCapabilitiesRemoteOperation.java b/library/src/main/java/com/owncloud/android/lib/resources/status/GetCapabilitiesRemoteOperation.java index 473966cf8..70f084145 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/status/GetCapabilitiesRemoteOperation.java +++ b/library/src/main/java/com/owncloud/android/lib/resources/status/GetCapabilitiesRemoteOperation.java @@ -85,6 +85,7 @@ public class GetCapabilitiesRemoteOperation extends RemoteOperation { private static final String PROPERTY_ENABLED = "enabled"; private static final String PROPERTY_ENFORCED = "enforced"; private static final String PROPERTY_DAYS = "days"; + private static final String PROPERTY_ASSISTANT = "assistant"; private static final String PROPERTY_SEND_MAIL = "send_mail"; private static final String PROPERTY_UPLOAD = "upload"; private static final String PROPERTY_RESHARING = "resharing"; @@ -669,6 +670,19 @@ private OCCapability parseResponse(String response) throws JSONException { capability.setGroupfolders(CapabilityBooleanType.FALSE); } + // assistant + if (respCapabilities.has(PROPERTY_ASSISTANT)) { + JSONObject assistantCapability = respCapabilities.getJSONObject(PROPERTY_ASSISTANT); + + if (assistantCapability.getBoolean(PROPERTY_ENABLED)) { + capability.setAssistant(CapabilityBooleanType.TRUE); + } else { + capability.setAssistant(CapabilityBooleanType.FALSE); + } + } else { + capability.setAssistant(CapabilityBooleanType.FALSE); + } + // drop-account if (respCapabilities.has(NODE_DROP_ACCOUNT)) { JSONObject dropAccountCapability = respCapabilities.getJSONObject(NODE_DROP_ACCOUNT); diff --git a/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt b/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt index d29a7a552..c990fb61a 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt +++ b/library/src/main/java/com/owncloud/android/lib/resources/status/OCCapability.kt @@ -96,6 +96,8 @@ class OCCapability { // Groupfolders var groupfolders = CapabilityBooleanType.UNKNOWN + var assistant = CapabilityBooleanType.UNKNOWN + // Drop-Account var dropAccount = CapabilityBooleanType.UNKNOWN