mirror of
https://github.com/etesync/android
synced 2024-11-22 16:08:13 +00:00
Don't require capabilities on home sets that MAY not be available on these collections (fixes #289)
This commit is contained in:
parent
bdee53b5ab
commit
1235a5e45a
@ -1,4 +1,4 @@
|
||||
package at.bitfire.davdroid.syncadapter;
|
||||
package at.bitfire.davdroid.resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
@ -40,7 +40,7 @@ public class DavResourceFinder {
|
||||
Log.i(TAG, "Found address book home set: " + pathAddressBooks);
|
||||
|
||||
WebDavResource homeSetAddressBooks = new WebDavResource(principal, pathAddressBooks);
|
||||
if (checkCapabilities(homeSetAddressBooks, "addressbook")) {
|
||||
if (checkHomesetCapabilities(homeSetAddressBooks, "addressbook")) {
|
||||
homeSetAddressBooks.propfind(Mode.CARDDAV_COLLECTIONS);
|
||||
|
||||
List<ServerInfo.ResourceInfo> addressBooks = new LinkedList<ServerInfo.ResourceInfo>();
|
||||
@ -80,7 +80,7 @@ public class DavResourceFinder {
|
||||
Log.i(TAG, "Found calendar home set: " + pathCalendars);
|
||||
|
||||
WebDavResource homeSetCalendars = new WebDavResource(principal, pathCalendars);
|
||||
if (checkCapabilities(homeSetCalendars, "calendar-access")) {
|
||||
if (checkHomesetCapabilities(homeSetCalendars, "calendar-access")) {
|
||||
homeSetCalendars.propfind(Mode.CALDAV_COLLECTIONS);
|
||||
|
||||
List<ServerInfo.ResourceInfo> calendars = new LinkedList<ServerInfo.ResourceInfo>();
|
||||
@ -147,16 +147,12 @@ public class DavResourceFinder {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean checkCapabilities(WebDavResource resource, String davCapability) throws IOException {
|
||||
private static boolean checkHomesetCapabilities(WebDavResource resource, String davCapability) throws IOException {
|
||||
// check for necessary capabilities
|
||||
try {
|
||||
resource.options();
|
||||
if (resource.supportsDAV(davCapability) &&
|
||||
resource.supportsMethod("PROPFIND") &&
|
||||
resource.supportsMethod("GET") &&
|
||||
resource.supportsMethod("REPORT") &&
|
||||
resource.supportsMethod("PUT") &&
|
||||
resource.supportsMethod("DELETE"))
|
||||
resource.supportsMethod("PROPFIND")) // check only for methods that MUST be available for home sets
|
||||
return true;
|
||||
} catch(HttpException e) {
|
||||
// for instance, 405 Method not allowed
|
@ -60,7 +60,6 @@ import android.provider.CalendarContract.Events;
|
||||
import android.provider.CalendarContract.Reminders;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
import at.bitfire.davdroid.syncadapter.ServerInfo;
|
||||
|
||||
/**
|
||||
* Represents a locally stored calendar, containing Events.
|
||||
|
@ -5,7 +5,7 @@
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
******************************************************************************/
|
||||
package at.bitfire.davdroid.syncadapter;
|
||||
package at.bitfire.davdroid.resource;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
@ -29,6 +29,7 @@ import at.bitfire.davdroid.Constants;
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.resource.LocalCalendar;
|
||||
import at.bitfire.davdroid.resource.LocalStorageException;
|
||||
import at.bitfire.davdroid.resource.ServerInfo;
|
||||
|
||||
public class AccountDetailsFragment extends Fragment implements TextWatcher {
|
||||
public static final String KEY_SERVER_INFO = "server_info";
|
||||
|
@ -23,6 +23,7 @@ import android.os.Bundle;
|
||||
import android.provider.CalendarContract;
|
||||
import android.provider.CalendarContract.Calendars;
|
||||
import android.util.Log;
|
||||
import at.bitfire.davdroid.resource.ServerInfo;
|
||||
import ezvcard.VCardVersion;
|
||||
|
||||
public class AccountSettings {
|
||||
|
@ -23,6 +23,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.resource.DavResourceFinder;
|
||||
import at.bitfire.davdroid.resource.ServerInfo;
|
||||
import at.bitfire.davdroid.webdav.DavException;
|
||||
import ch.boye.httpclientandroidlib.HttpException;
|
||||
|
||||
|
@ -17,6 +17,7 @@ import android.widget.BaseAdapter;
|
||||
import android.widget.CheckedTextView;
|
||||
import android.widget.ListAdapter;
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.resource.ServerInfo;
|
||||
|
||||
public class SelectCollectionsAdapter extends BaseAdapter implements ListAdapter {
|
||||
final static int TYPE_ADDRESS_BOOKS_HEADING = 0,
|
||||
|
@ -20,6 +20,7 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.resource.ServerInfo;
|
||||
|
||||
public class SelectCollectionsFragment extends ListFragment {
|
||||
public static final String KEY_SERVER_INFO = "server_info";
|
||||
|
@ -4,7 +4,9 @@ import java.util.List;
|
||||
|
||||
import ezvcard.VCardVersion;
|
||||
import android.test.InstrumentationTestCase;
|
||||
import at.bitfire.davdroid.syncadapter.ServerInfo.ResourceInfo;
|
||||
import at.bitfire.davdroid.resource.DavResourceFinder;
|
||||
import at.bitfire.davdroid.resource.ServerInfo;
|
||||
import at.bitfire.davdroid.resource.ServerInfo.ResourceInfo;
|
||||
import at.bitfire.davdroid.test.Constants;
|
||||
|
||||
public class DavResourceFinderTest extends InstrumentationTestCase {
|
||||
|
Loading…
Reference in New Issue
Block a user