Removed commented code
[pub/Android/ownCloud.git] / src / com / owncloud / android / services / OperationsService.java
index eeda5e9..ce80b57 100644 (file)
@@ -172,10 +172,10 @@ public class OperationsService extends Service {
     @Override
     public void onDestroy() {
         //Log_OC.wtf(TAG, "onDestroy init" );
-        super.onDestroy();
         //Log_OC.wtf(TAG, "Clear mUndispatchedFinisiedOperations" );
         mUndispatchedFinishedOperations.clear();
         //Log_OC.wtf(TAG, "onDestroy end" );
+        super.onDestroy();
     }
 
 
@@ -388,13 +388,19 @@ public class OperationsService extends Service {
             }
         }
 
-        public void dispatchResultIfFinished(int operationId, OnRemoteOperationListener listener) {
+        public boolean dispatchResultIfFinished(int operationId, OnRemoteOperationListener listener) {
             Pair<RemoteOperation, RemoteOperationResult> undispatched = 
                     mUndispatchedFinishedOperations.remove(operationId);
             if (undispatched != null) {
                 listener.onRemoteOperationFinish(undispatched.first, undispatched.second);
+                return true;
                 //Log_OC.wtf(TAG, "Sending callback later");
             } else {
+                if (!mPendingOperations.isEmpty()) {
+                    return true;
+                } else {
+                    return false;
+                }
                 //Log_OC.wtf(TAG, "Not finished yet");
             }
         }
@@ -472,20 +478,20 @@ public class OperationsService extends Service {
                 } else {
                     result = mCurrentOperation.execute(mOwnCloudClient);
                 }
-            
+                
             } catch (AccountsException e) {
                 if (mLastTarget.mAccount == null) {
-                    Log_OC.e(TAG, "Error while trying to get autorization for a NULL account", e);
+                    Log_OC.e(TAG, "Error while trying to get authorization for a NULL account", e);
                 } else {
-                    Log_OC.e(TAG, "Error while trying to get autorization for " + mLastTarget.mAccount.name, e);
+                    Log_OC.e(TAG, "Error while trying to get authorization for " + mLastTarget.mAccount.name, e);
                 }
                 result = new RemoteOperationResult(e);
                 
             } catch (IOException e) {
                 if (mLastTarget.mAccount == null) {
-                    Log_OC.e(TAG, "Error while trying to get autorization for a NULL account", e);
+                    Log_OC.e(TAG, "Error while trying to get authorization for a NULL account", e);
                 } else {
-                    Log_OC.e(TAG, "Error while trying to get autorization for " + mLastTarget.mAccount.name, e);
+                    Log_OC.e(TAG, "Error while trying to get authorization for " + mLastTarget.mAccount.name, e);
                 }
                 result = new RemoteOperationResult(e);
             } catch (Exception e) {