projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #366 from owncloud/bug_handling_failure_in_request_for_remote_username
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
syncadapter
/
FileSyncAdapter.java
diff --git
a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
index
7a00b2e
..
c47a251
100644
(file)
--- a/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@
-26,17
+26,17
@@
import java.util.Map;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavException;
-import com.owncloud.android.Log_OC;
-import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.
operations
.RemoteOperationResult;
+import com.owncloud.android.
lib.operations.common
.RemoteOperationResult;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
-import com.owncloud.android.
operations
.RemoteOperationResult.ResultCode;
+import com.owncloud.android.
lib.operations.common
.RemoteOperationResult.ResultCode;
import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
+import com.owncloud.android.utils.DisplayUtils;
+import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.Account;
@@
-98,7
+98,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
/**
/**
- * Creates a
n
{@link FileSyncAdapter}
+ * Creates a {@link FileSyncAdapter}
*
* {@inheritDoc}
*/
*
* {@inheritDoc}
*/
@@
-108,11
+108,21
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
/**
/**
+ * Creates a {@link FileSyncAdapter}
+ *
+ * {@inheritDoc}
+ */
+ public FileSyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
+ super(context, autoInitialize, allowParallelSyncs);
+ }
+
+
+ /**
* {@inheritDoc}
*/
@Override
public synchronized void onPerformSync(Account account, Bundle extras,
* {@inheritDoc}
*/
@Override
public synchronized void onPerformSync(Account account, Bundle extras,
- String authority, ContentProviderClient provider,
+ String authority, ContentProviderClient provider
Client
,
SyncResult syncResult) {
mCancellation = false;
SyncResult syncResult) {
mCancellation = false;
@@
-127,8
+137,8
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
mSyncResult.delayUntil = 60*60*24; // avoid too many automatic synchronizations
this.setAccount(account);
mSyncResult.delayUntil = 60*60*24; // avoid too many automatic synchronizations
this.setAccount(account);
- this.setContentProvider
(provider
);
- this.setStorageManager(new FileDataStorageManager(account, provider));
+ this.setContentProvider
Client(providerClient
);
+ this.setStorageManager(new FileDataStorageManager(account, provider
Client
));
try {
this.initClientForCurrentAccount();
} catch (IOException e) {
try {
this.initClientForCurrentAccount();
} catch (IOException e) {
@@
-269,8
+279,9
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
} else {
// in failures, the statistics for the global result are updated
if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED ||
} else {
// in failures, the statistics for the global result are updated
if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED ||
- ( result.isIdPRedirection() &&
- MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))) {
+ ( result.isIdPRedirection() &&
+ getClient().getCredentials() == null )) {
+ //MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
@@
-311,8
+322,8
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
private void fetchChildren(OCFile parent, List<OCFile> files, boolean parentEtagChanged) {
int i;
OCFile newFile = null;
private void fetchChildren(OCFile parent, List<OCFile> files, boolean parentEtagChanged) {
int i;
OCFile newFile = null;
- String etag = null;
- boolean syncDown = false;
+
//
String etag = null;
+
//
boolean syncDown = false;
for (i=0; i < files.size() && !mCancellation; i++) {
newFile = files.get(i);
if (newFile.isFolder()) {
for (i=0; i < files.size() && !mCancellation; i++) {
newFile = files.get(i);
if (newFile.isFolder()) {
@@
-357,13
+368,13
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
* Notifies the user about a failed synchronization through the status notification bar
*/
private void notifyFailedSynchronization() {
* Notifies the user about a failed synchronization through the status notification bar
*/
private void notifyFailedSynchronization() {
- Notification notification = new Notification(
R.drawable.icon
, getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis());
+ Notification notification = new Notification(
DisplayUtils.getSeasonalIconId()
, getContext().getString(R.string.sync_fail_ticker), System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
boolean needsToUpdateCredentials = (mLastFailedResult != null &&
( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
notification.flags |= Notification.FLAG_AUTO_CANCEL;
boolean needsToUpdateCredentials = (mLastFailedResult != null &&
( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
- // (mLastFailedResult.isTemporalRedirection() && mLastFailedResult.isIdPRedirection() &&
( mLastFailedResult.isIdPRedirection() &&
( mLastFailedResult.isIdPRedirection() &&
- MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))
+ getClient().getCredentials() == null )
+ //MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))
)
);
// TODO put something smart in the contentIntent below for all the possible errors
)
);
// TODO put something smart in the contentIntent below for all the possible errors
@@
-399,7
+410,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
*/
private void notifyFailsInFavourites() {
if (mFailedResultsCounter > 0) {
*/
private void notifyFailsInFavourites() {
if (mFailedResultsCounter > 0) {
- Notification notification = new Notification(
R.drawable.icon
, getContext().getString(R.string.sync_fail_in_favourites_ticker), System.currentTimeMillis());
+ Notification notification = new Notification(
DisplayUtils.getSeasonalIconId()
, getContext().getString(R.string.sync_fail_in_favourites_ticker), System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
// TODO put something smart in the contentIntent below
notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
// TODO put something smart in the contentIntent below
notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
@@
-410,7
+421,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_fail_in_favourites_ticker, notification);
} else {
((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(R.string.sync_fail_in_favourites_ticker, notification);
} else {
- Notification notification = new Notification(
R.drawable.icon
, getContext().getString(R.string.sync_conflicts_in_favourites_ticker), System.currentTimeMillis());
+ Notification notification = new Notification(
DisplayUtils.getSeasonalIconId()
, getContext().getString(R.string.sync_conflicts_in_favourites_ticker), System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
// TODO put something smart in the contentIntent below
notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
// TODO put something smart in the contentIntent below
notification.contentIntent = PendingIntent.getActivity(getContext().getApplicationContext(), (int)System.currentTimeMillis(), new Intent(), 0);
@@
-432,7
+443,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
* We won't consider a synchronization as failed when foreign files can not be copied to the ownCloud local directory.
*/
private void notifyForgottenLocalFiles() {
* We won't consider a synchronization as failed when foreign files can not be copied to the ownCloud local directory.
*/
private void notifyForgottenLocalFiles() {
- Notification notification = new Notification(
R.drawable.icon
, getContext().getString(R.string.sync_foreign_files_forgotten_ticker), System.currentTimeMillis());
+ Notification notification = new Notification(
DisplayUtils.getSeasonalIconId()
, getContext().getString(R.string.sync_foreign_files_forgotten_ticker), System.currentTimeMillis());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
/// includes a pending intent in the notification showing a more detailed explanation
notification.flags |= Notification.FLAG_AUTO_CANCEL;
/// includes a pending intent in the notification showing a more detailed explanation