Prechádzať zdrojové kódy

Use own QueryPair implementation that supports serializable

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky 4 rokov pred
rodič
commit
4875b20c6c

+ 2 - 3
src/main/java/com/nextcloud/android/sso/InputStreamBinder.java

@@ -32,7 +32,6 @@ import android.os.Binder;
 import android.os.ParcelFileDescriptor;
 import android.text.TextUtils;
 import android.util.Log;
-import android.util.Pair;
 
 import com.nextcloud.android.sso.aidl.IInputStreamService;
 import com.nextcloud.android.sso.aidl.NextcloudRequest;
@@ -507,10 +506,10 @@ public class InputStreamBinder extends IInputStreamService.Stub {
     }
 
     @VisibleForTesting
-    public static NameValuePair[] convertListToNVP(Collection<Pair<String, String>> list) {
+    public static NameValuePair[] convertListToNVP(Collection<com.nextcloud.android.sso.api.QueryPair> list) {
         NameValuePair[] nvp = new NameValuePair[list.size()];
         int i = 0;
-        for (Pair<String, String> pair : list) {
+        for (com.nextcloud.android.sso.api.QueryPair pair : list) {
             nvp[i] = new NameValuePair(pair.first, pair.second);
             i++;
         }

+ 35 - 0
src/main/java/com/nextcloud/android/sso/QueryPair.java

@@ -0,0 +1,35 @@
+/*
+ *
+ * Nextcloud Android client application
+ *
+ * @author Tobias Kaminsky
+ * Copyright (C) 2021 Tobias Kaminsky
+ * Copyright (C) 2021 Nextcloud GmbH
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package com.nextcloud.android.sso.api;
+
+import java.io.Serializable;
+
+public class QueryPair implements Serializable {
+    public String first;
+    public String second;
+
+    public QueryPair(String first, String second) {
+        this.first = first;
+        this.second = second;
+    }
+}

+ 2 - 4
src/main/java/com/nextcloud/android/sso/aidl/NextcloudRequest.java

@@ -41,8 +41,6 @@
 
 package com.nextcloud.android.sso.aidl;
 
-import android.util.Pair;
-
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.HashMap;
@@ -57,7 +55,7 @@ public class NextcloudRequest implements Serializable {
     private String method;
     private Map<String, List<String>> header = new HashMap<>();
     private Map<String, String> parameter = new HashMap<>();
-    private final Collection<Pair<String, String>> parameterV2 = new LinkedList<>();
+    private final Collection<com.nextcloud.android.sso.api.QueryPair> parameterV2 = new LinkedList<>();
     private String requestBody;
     private String url;
     private String token;
@@ -172,7 +170,7 @@ public class NextcloudRequest implements Serializable {
         return this.followRedirects;
     }
 
-    public Collection<Pair<String, String>> getParameterV2() {
+    public Collection<com.nextcloud.android.sso.api.QueryPair> getParameterV2() {
         return parameterV2;
     }
 }