fix API v1 path and rename classes

This commit is contained in:
korelstar 2020-04-24 23:07:29 +02:00
parent 940a4f4d56
commit 7f1e2d50e5
3 changed files with 11 additions and 12 deletions

View file

@ -6,7 +6,6 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.annotation.WorkerThread;
import com.nextcloud.android.sso.aidl.NextcloudRequest;
@ -71,17 +70,17 @@ public abstract class NotesClient {
public static NotesClient newInstance(@Nullable ApiVersion preferredApiVersion,
@NonNull Context appContext) {
if (preferredApiVersion == null) {
Log.i(TAG, "apiVersion is null, using " + NotesClient_0_2.class.getSimpleName());
return new NotesClient_0_2(appContext);
Log.i(TAG, "apiVersion is null, using " + NotesClientV02.class.getSimpleName());
return new NotesClientV02(appContext);
// } else if (preferredApiVersion.compareTo(SUPPORTED_API_VERSIONS[0]) == 0) {
// Log.i(TAG, "Using " + NotesClient_1_0.class.getSimpleName());
// return new NotesClient_1_0(appContext);
} else if (preferredApiVersion.compareTo(SUPPORTED_API_VERSIONS[1]) == 0) {
Log.i(TAG, "Using " + NotesClient_0_2.class.getSimpleName());
return new NotesClient_0_2(appContext);
Log.i(TAG, "Using " + NotesClientV02.class.getSimpleName());
return new NotesClientV02(appContext);
}
Log.w(TAG, "Unsupported API version " + preferredApiVersion + " - try using " + NotesClient_0_2.class.getSimpleName());
return new NotesClient_0_2(appContext);
Log.w(TAG, "Unsupported API version " + preferredApiVersion + " - try using " + NotesClientV02.class.getSimpleName());
return new NotesClientV02(appContext);
}
@SuppressWarnings("WeakerAccess")

View file

@ -17,11 +17,11 @@ import it.niedermann.owncloud.notes.util.ServerResponse.NoteResponse;
import it.niedermann.owncloud.notes.util.ServerResponse.NotesResponse;
@WorkerThread
public class NotesClient_0_2 extends NotesClient {
public class NotesClientV02 extends NotesClient {
private static final String API_PATH = "/index.php/apps/notes/api/v0.2/";
NotesClient_0_2(@NonNull Context appContext) {
NotesClientV02(@NonNull Context appContext) {
super(appContext);
}

View file

@ -12,11 +12,11 @@ import it.niedermann.owncloud.notes.util.ServerResponse.NoteResponse;
import it.niedermann.owncloud.notes.util.ServerResponse.NotesResponse;
@WorkerThread
public class NotesClient_1_0 extends NotesClient {
public class NotesClientV1 extends NotesClient {
private static final String API_PATH = "/index.php/apps/notes/api/v1.0/";
private static final String API_PATH = "/index.php/apps/notes/api/v1/";
NotesClient_1_0(@NonNull Context appContext) {
NotesClientV1(@NonNull Context appContext) {
super(appContext);
throw new UnsupportedOperationException("Not implemented yet.");
}