diff --git a/app/build.gradle b/app/build.gradle
index c65b01d763b0d28230f03af8e2f0b82c8c54df46..6efc99a96ab7a13bf9f96309e83a5cfd218e4c5a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -53,6 +53,9 @@ android {
//includeAndroidResources = true
}
}
+ buildFeatures {
+ viewBinding true
+ }
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index be871995566a3c5de7fc4bbb8df3365b36fc9856..1578dbf997b881f1a20b69e2479a40364094300d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,95 +1,102 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/foundation/e/drive/operations/GetAliasOperation.java b/app/src/main/java/foundation/e/drive/operations/GetAliasOperation.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f67f76f95ff326c7810406b8ff375c97ecd5711
--- /dev/null
+++ b/app/src/main/java/foundation/e/drive/operations/GetAliasOperation.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright © ECORP SAS 2022.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Public License v3.0
+ * which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/gpl.html
+ */
+
+package foundation.e.drive.operations;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.operations.RemoteOperation;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.common.utils.Log_OC;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+
+/**
+ * @author TheScarastic
+ */
+
+public class GetAliasOperation extends RemoteOperation {
+
+ private static final String TAG = GetAliasOperation.class.getSimpleName();
+ private static final String ALIAS_PATH = "/ocs/v1.php/cloud/hide-my-email/";
+
+ // JSON Node names
+ private static final String NODE_OCS = "ocs";
+ private static final String NODE_DATA = "data";
+ private static final String NODE_ALIASES = "aliases";
+
+
+ private boolean isSuccess(int status) {
+ return (status == HttpStatus.SC_OK);
+ }
+
+ @Override
+ protected RemoteOperationResult run(OwnCloudClient client) {
+ RemoteOperationResult result;
+ GetMethod get = null;
+ final String uri = client.getBaseUri() + ALIAS_PATH + client.getCredentials().getUsername();
+
+ try {
+ get = new GetMethod(uri);
+ get.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE);
+ get.setQueryString(new NameValuePair[]{new NameValuePair("format", "json")});
+
+ if (isSuccess(client.executeMethod(get))) {
+ String response = get.getResponseBodyAsString();
+ // parse
+ final JSONArray aliases = new JSONObject(response).getJSONObject(NODE_OCS)
+ .getJSONObject(NODE_DATA).getJSONArray(NODE_ALIASES);
+ final ArrayList