Loading src/main/aidl/com/nextcloud/android/sso/helper/IInputStreamService.aidldeleted 100644 → 0 +0 −22 Original line number Diff line number Diff line /*** Copyright (c) 2008-2011 CommonsWare, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. From _The Busy Coder's Guide to Advanced Android Development_ http://commonsware.com/AdvAndroid More information here: https://github.com/abeluck/android-streams-ipc */ package com.nextcloud.android.sso.helper; interface IInputStreamService { ParcelFileDescriptor performNextcloudRequest(in ParcelFileDescriptor input); } src/main/java/com/nextcloud/android/sso/api/NextcloudAPI.java +0 −9 Original line number Diff line number Diff line Loading @@ -148,15 +148,6 @@ public class NextcloudAPI { return networkRequest.performNetworkRequestV2(request, null); } /* public static <T> T deserializeObjectAndCloseStream(InputStream is) throws IOException, ClassNotFoundException { try (ObjectInputStream ois = new ObjectInputStream(is)) { return (T) ois.readObject(); } } */ protected Gson getGson() { return gson; } Loading src/main/java/com/nextcloud/android/sso/api/NextcloudRetrofitServiceMethod.java +2 −53 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ package com.nextcloud.android.sso.api; import android.util.Log; import androidx.annotation.Nullable; import com.nextcloud.android.sso.aidl.NextcloudRequest; import com.nextcloud.android.sso.helper.Okhttp3Helper; import com.nextcloud.android.sso.helper.ReactivexHelper; Loading @@ -29,6 +27,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import androidx.annotation.Nullable; import io.reactivex.Completable; import io.reactivex.Observable; import okhttp3.Headers; Loading Loading @@ -57,7 +56,6 @@ public class NextcloudRetrofitServiceMethod<T> { // Upper and lower characters, digits, underscores, and hyphens, starting with a character. private static final String PARAM = "[a-zA-Z][a-zA-Z0-9_-]*"; private static final Pattern PARAM_URL_REGEX = Pattern.compile("\\{(" + PARAM + ")\\}"); //private static final Pattern PARAM_NAME_REGEX = Pattern.compile(PARAM); private Method method; private String httpMethod; Loading @@ -66,7 +64,6 @@ public class NextcloudRetrofitServiceMethod<T> { private Type returnType; private boolean followRedirects = false; private Map<String, String> queryParameters; //private boolean formUrlEncoded = false; private final NextcloudRequest.Builder requestBuilder; Loading @@ -75,7 +72,6 @@ public class NextcloudRetrofitServiceMethod<T> { this.method = method; this.returnType = method.getGenericReturnType(); Annotation[] methodAnnotations = method.getAnnotations(); //Type[] parameterTypes = method.getGenericParameterTypes(); this.parameterAnnotationsArray = method.getParameterAnnotations(); for (Annotation annotation : methodAnnotations) { Loading Loading @@ -104,7 +100,6 @@ public class NextcloudRetrofitServiceMethod<T> { throw new InvalidParameterException("Expected: " + parameterAnnotationsArray.length + " params - were: " + args.length); } //NextcloudRequest.Builder rBuilder = (NextcloudRequest.Builder) requestBuilder.clone(); NextcloudRequest.Builder rBuilder = cloneSerializable(requestBuilder); Loading Loading @@ -146,7 +141,7 @@ public class NextcloudRetrofitServiceMethod<T> { parameters.put(((Field)annotation).value(), field); } } else { throw new UnsupportedOperationException("don't know this type yet.. [" + String.valueOf(annotation) + "]"); throw new UnsupportedOperationException("don't know this type yet.. [" + annotation + "]"); } } Loading Loading @@ -181,10 +176,6 @@ public class NextcloudRetrofitServiceMethod<T> { return nextcloudAPI.performRequest(this.returnType, request); } private void parseMethodAnnotation(Annotation annotation) { if (annotation instanceof DELETE) { parseHttpMethodAndPath("DELETE", ((DELETE) annotation).value(), false); Loading @@ -210,29 +201,6 @@ public class NextcloudRetrofitServiceMethod<T> { } else { throw new UnsupportedOperationException(String.valueOf(annotation)); } /* else if (annotation instanceof HEAD) { parseHttpMethodAndPath("HEAD", ((HEAD) annotation).value(), false); } else if (annotation instanceof PATCH) { parseHttpMethodAndPath("PATCH", ((PATCH) annotation).value(), true); } else if (annotation instanceof OPTIONS) { parseHttpMethodAndPath("OPTIONS", ((OPTIONS) annotation).value(), false); } else if (annotation instanceof HTTP) { HTTP http = (HTTP) annotation; parseHttpMethodAndPath(http.method(), http.path(), http.hasBody()); } else if (annotation instanceof Multipart) { if (isFormEncoded) { throw methodError(method, "Only one encoding annotation is allowed."); } isMultipart = true; } else if (annotation instanceof FormUrlEncoded) { if (isMultipart) { throw methodError(method, "Only one encoding annotation is allowed."); } isFormEncoded = true; } */ } private void parseHttpMethodAndPath(String httpMethod, String value, boolean hasBody) { Loading Loading @@ -262,8 +230,6 @@ public class NextcloudRetrofitServiceMethod<T> { if ("Content-Type".equalsIgnoreCase(headerName)) { try { MediaType.parse(headerValue); //MediaType contentType = MediaType.parse(headerValue); //Log.v(TAG, contentType.toString()); } catch (IllegalArgumentException e) { throw methodError(method, e, "Malformed content type: %s", headerValue); } Loading Loading @@ -310,10 +276,6 @@ public class NextcloudRetrofitServiceMethod<T> { return queryPairs; } private static RuntimeException methodError(Method method, String message, Object... args) { return methodError(method, null, message, args); } Loading @@ -328,19 +290,6 @@ public class NextcloudRetrofitServiceMethod<T> { + method.getName(), cause); } /* private static RuntimeException parameterError(Method method, Throwable cause, int p, String message, Object... args) { return methodError(method, cause, message + " (parameter #" + (p + 1) + ")", args); } private static RuntimeException parameterError(Method method, int p, String message, Object... args) { return methodError(method, message + " (parameter #" + (p + 1) + ")", args); } */ private static <T extends Serializable> T cloneSerializable(T o) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( baos ); Loading src/main/java/com/nextcloud/android/sso/exceptions/AccountImportCancelledException.java +7 −7 Original line number Diff line number Diff line package com.nextcloud.android.sso.exceptions; import android.content.Context; import com.nextcloud.android.sso.R; import com.nextcloud.android.sso.model.ExceptionMessage; /** * Nextcloud SingleSignOn * Loading @@ -24,6 +17,13 @@ import com.nextcloud.android.sso.model.ExceptionMessage; * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.nextcloud.android.sso.exceptions; import android.content.Context; import com.nextcloud.android.sso.R; import com.nextcloud.android.sso.model.ExceptionMessage; public class AccountImportCancelledException extends SSOException { @Override Loading src/main/java/com/nextcloud/android/sso/exceptions/AndroidGetAccountsPermissionNotGranted.java +21 −2 Original line number Diff line number Diff line /* * Nextcloud SingleSignOn * * @author David Luhmer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.nextcloud.android.sso.exceptions; import android.content.Context; Loading Loading
src/main/aidl/com/nextcloud/android/sso/helper/IInputStreamService.aidldeleted 100644 → 0 +0 −22 Original line number Diff line number Diff line /*** Copyright (c) 2008-2011 CommonsWare, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. From _The Busy Coder's Guide to Advanced Android Development_ http://commonsware.com/AdvAndroid More information here: https://github.com/abeluck/android-streams-ipc */ package com.nextcloud.android.sso.helper; interface IInputStreamService { ParcelFileDescriptor performNextcloudRequest(in ParcelFileDescriptor input); }
src/main/java/com/nextcloud/android/sso/api/NextcloudAPI.java +0 −9 Original line number Diff line number Diff line Loading @@ -148,15 +148,6 @@ public class NextcloudAPI { return networkRequest.performNetworkRequestV2(request, null); } /* public static <T> T deserializeObjectAndCloseStream(InputStream is) throws IOException, ClassNotFoundException { try (ObjectInputStream ois = new ObjectInputStream(is)) { return (T) ois.readObject(); } } */ protected Gson getGson() { return gson; } Loading
src/main/java/com/nextcloud/android/sso/api/NextcloudRetrofitServiceMethod.java +2 −53 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ package com.nextcloud.android.sso.api; import android.util.Log; import androidx.annotation.Nullable; import com.nextcloud.android.sso.aidl.NextcloudRequest; import com.nextcloud.android.sso.helper.Okhttp3Helper; import com.nextcloud.android.sso.helper.ReactivexHelper; Loading @@ -29,6 +27,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import androidx.annotation.Nullable; import io.reactivex.Completable; import io.reactivex.Observable; import okhttp3.Headers; Loading Loading @@ -57,7 +56,6 @@ public class NextcloudRetrofitServiceMethod<T> { // Upper and lower characters, digits, underscores, and hyphens, starting with a character. private static final String PARAM = "[a-zA-Z][a-zA-Z0-9_-]*"; private static final Pattern PARAM_URL_REGEX = Pattern.compile("\\{(" + PARAM + ")\\}"); //private static final Pattern PARAM_NAME_REGEX = Pattern.compile(PARAM); private Method method; private String httpMethod; Loading @@ -66,7 +64,6 @@ public class NextcloudRetrofitServiceMethod<T> { private Type returnType; private boolean followRedirects = false; private Map<String, String> queryParameters; //private boolean formUrlEncoded = false; private final NextcloudRequest.Builder requestBuilder; Loading @@ -75,7 +72,6 @@ public class NextcloudRetrofitServiceMethod<T> { this.method = method; this.returnType = method.getGenericReturnType(); Annotation[] methodAnnotations = method.getAnnotations(); //Type[] parameterTypes = method.getGenericParameterTypes(); this.parameterAnnotationsArray = method.getParameterAnnotations(); for (Annotation annotation : methodAnnotations) { Loading Loading @@ -104,7 +100,6 @@ public class NextcloudRetrofitServiceMethod<T> { throw new InvalidParameterException("Expected: " + parameterAnnotationsArray.length + " params - were: " + args.length); } //NextcloudRequest.Builder rBuilder = (NextcloudRequest.Builder) requestBuilder.clone(); NextcloudRequest.Builder rBuilder = cloneSerializable(requestBuilder); Loading Loading @@ -146,7 +141,7 @@ public class NextcloudRetrofitServiceMethod<T> { parameters.put(((Field)annotation).value(), field); } } else { throw new UnsupportedOperationException("don't know this type yet.. [" + String.valueOf(annotation) + "]"); throw new UnsupportedOperationException("don't know this type yet.. [" + annotation + "]"); } } Loading Loading @@ -181,10 +176,6 @@ public class NextcloudRetrofitServiceMethod<T> { return nextcloudAPI.performRequest(this.returnType, request); } private void parseMethodAnnotation(Annotation annotation) { if (annotation instanceof DELETE) { parseHttpMethodAndPath("DELETE", ((DELETE) annotation).value(), false); Loading @@ -210,29 +201,6 @@ public class NextcloudRetrofitServiceMethod<T> { } else { throw new UnsupportedOperationException(String.valueOf(annotation)); } /* else if (annotation instanceof HEAD) { parseHttpMethodAndPath("HEAD", ((HEAD) annotation).value(), false); } else if (annotation instanceof PATCH) { parseHttpMethodAndPath("PATCH", ((PATCH) annotation).value(), true); } else if (annotation instanceof OPTIONS) { parseHttpMethodAndPath("OPTIONS", ((OPTIONS) annotation).value(), false); } else if (annotation instanceof HTTP) { HTTP http = (HTTP) annotation; parseHttpMethodAndPath(http.method(), http.path(), http.hasBody()); } else if (annotation instanceof Multipart) { if (isFormEncoded) { throw methodError(method, "Only one encoding annotation is allowed."); } isMultipart = true; } else if (annotation instanceof FormUrlEncoded) { if (isMultipart) { throw methodError(method, "Only one encoding annotation is allowed."); } isFormEncoded = true; } */ } private void parseHttpMethodAndPath(String httpMethod, String value, boolean hasBody) { Loading Loading @@ -262,8 +230,6 @@ public class NextcloudRetrofitServiceMethod<T> { if ("Content-Type".equalsIgnoreCase(headerName)) { try { MediaType.parse(headerValue); //MediaType contentType = MediaType.parse(headerValue); //Log.v(TAG, contentType.toString()); } catch (IllegalArgumentException e) { throw methodError(method, e, "Malformed content type: %s", headerValue); } Loading Loading @@ -310,10 +276,6 @@ public class NextcloudRetrofitServiceMethod<T> { return queryPairs; } private static RuntimeException methodError(Method method, String message, Object... args) { return methodError(method, null, message, args); } Loading @@ -328,19 +290,6 @@ public class NextcloudRetrofitServiceMethod<T> { + method.getName(), cause); } /* private static RuntimeException parameterError(Method method, Throwable cause, int p, String message, Object... args) { return methodError(method, cause, message + " (parameter #" + (p + 1) + ")", args); } private static RuntimeException parameterError(Method method, int p, String message, Object... args) { return methodError(method, message + " (parameter #" + (p + 1) + ")", args); } */ private static <T extends Serializable> T cloneSerializable(T o) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( baos ); Loading
src/main/java/com/nextcloud/android/sso/exceptions/AccountImportCancelledException.java +7 −7 Original line number Diff line number Diff line package com.nextcloud.android.sso.exceptions; import android.content.Context; import com.nextcloud.android.sso.R; import com.nextcloud.android.sso.model.ExceptionMessage; /** * Nextcloud SingleSignOn * Loading @@ -24,6 +17,13 @@ import com.nextcloud.android.sso.model.ExceptionMessage; * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.nextcloud.android.sso.exceptions; import android.content.Context; import com.nextcloud.android.sso.R; import com.nextcloud.android.sso.model.ExceptionMessage; public class AccountImportCancelledException extends SSOException { @Override Loading
src/main/java/com/nextcloud/android/sso/exceptions/AndroidGetAccountsPermissionNotGranted.java +21 −2 Original line number Diff line number Diff line /* * Nextcloud SingleSignOn * * @author David Luhmer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.nextcloud.android.sso.exceptions; import android.content.Context; Loading