Просмотр исходного кода

Merge remote-tracking branch 'origin/operations_service' into operations_service

David A. Velasco 11 лет назад
Родитель
Сommit
e566d041d1

+ 1 - 1
owncloud-android-library

@@ -1 +1 @@
-Subproject commit a3683116ae04f639ff39484b1c54788bbce9fd30
+Subproject commit 6b69b5af1a79275a23339ad6382210d75b061f9f

+ 4 - 0
res/values-el/strings.xml

@@ -97,6 +97,7 @@
   <string name="sync_fail_in_favourites_content">Τα περιεχόμενα των %1$d αρχείων δεν μπόρεσαν να συγχρονιστούν (%2$d διενέξεις)</string>
   <string name="sync_foreign_files_forgotten_ticker">Ορισμένα τοπικά αρχεία ξεχάστηκαν</string>
   <string name="sync_foreign_files_forgotten_content">%1$d αρχεια απο τον %2$s χωρο αποθηκευσης δεν μπορουν να αντιγραφθουν σε</string>
+  <string name="sync_foreign_files_forgotten_explanation">Από την έκδοση 1.3.16 και μετά, αρχεία που μεταφορτώνονται από αυτήν τη συσκευή αντιγράφονται στον τοπικό φάκελο %1$s για να αποτραπεί η απώλεια δεδομένων όταν ένα αρχείο είναι συγχρονισμένο με πολλαπλούς λογαριασμούς.\nΛόγω αυτής της αλλαγής, όλα τα αρχεία που μεταφορτώθηκαν με προηγούμενες εκδόσεις αυτής της εφαρμογής αντιγράφηκαν στον φάκελο %2$s. Ωστόσο, ένα σφάλμα εμπόδισε την ολοκλήρωση αυτής της εργασίας κατά το συγχρονισμό του λογαριασμού. Μπορείτε είτε να αφήσετε τα αρχεία όπως είναι και να καταργήσετε την σύνδεση με το %3$s ή να μετακινήσετε τα αρχεία στον κατάλογο %1$s και να διατηρήσετε τη σύνδεση με το %4$s.\n\nΑπαριθμημένα πιο κάτω είναι το/τα τοπικό/ά αρχείο/α και το/τα απομακρυσμένο/α αρχείο/α στο %5$s με το/τα οποίο/α συνδέονταν.</string>
   <string name="sync_current_folder_was_removed">Ο φάκελος %1$s δεν υπάρχει πια</string>
   <string name="foreign_files_move">Μετακινηση ολων</string>
   <string name="foreign_files_success">Ολα τα αρχεια μετακινηθηκαν</string>
@@ -160,6 +161,8 @@
   <string name="auth_connecting_auth_server">Σύνδεση με το διακομιστή πιστοποίησης σε εξέλιξη...</string>
   <string name="auth_unsupported_auth_method">Ο διακομιστής δεν υποστηρίζει αυτή τη μέθοδο πιστοποίησης</string>
   <string name="auth_unsupported_multiaccount">Ο %1$s  δεν υποστηρίζει πολλαπλούς λογαριασμούς</string>
+  <string name="auth_fail_get_user_name">Ο διακομιστής σας δεν επιστρέφει το σωστό χαρακτηριστικό χρήστη, παρακαλώ επικοινωνήστε με έναν διαχειριστή</string>
+  <string name="auth_can_not_auth_against_server">Δεν είναι δυνατός ο έλεγχος ταυτότητας με αυτόν τον διακομιστή</string>
   <string name="fd_keep_in_sync">Διατήρηση αρχείου ενημερωμένo</string>
   <string name="common_rename">Μετονομασία</string>
   <string name="common_remove">Αφαίρεση</string>
@@ -232,6 +235,7 @@
   <string name="failed_upload_headline_delete_all_btn">διαγραφή όλων των επιλεγμένων από τη λίστα προς μεταφόρτωση</string>
   <string name="failed_upload_retry_text">επανάληψη προσπάθειας μεταφόρτωσης της εικόνας:</string>
   <string name="failed_upload_load_more_images">Φόρτωση περισσότερων εικόνων</string>
+  <string name="failed_upload_retry_do_nothing_text">μην κάνετε τίποτε, δεν είστε συνδεμένος για άμεση μεταφόρτωση</string>
   <string name="failed_upload_failure_text">Μήνυμα Αποτυχίας:</string>
   <string name="failed_upload_quota_exceeded_text">Παρακαλώ ελέγξτε τις ρυθμίσεις του διακομιστή σας, ίσως έχετε υπερβεί τη διαθέσιμη μερίδα σας.</string>
   <string name="share_link_no_support_share_api">Λυπάμαι, ο διαμοιρασμός δεν είναι ενεργοποιημένος στο διακομιστή σας. Παρακαλώ επικοινωνήστε με το διαχειριστή σας.</string>

+ 10 - 10
res/values-es/strings.xml

@@ -28,7 +28,7 @@
   <string name="prefs_recommend">Recomendar a un amigo</string>
   <string name="prefs_feedback">Mensajes de retroalimentación</string>
   <string name="prefs_imprint">Imprint</string>
-  <string name="recommend_subject">Prueba  %1$s en tu smarthphone!</string>
+  <string name="recommend_subject">¡Prueba %1$s en tu teléfono inteligente!</string>
   <string name="recommend_text">Quiero invitarte a usar %1$s en tu smarthphone!⏎\nDescargalo aquí: %2$s</string>
   <string name="auth_check_server">Compruebe el servidor.</string>
   <string name="auth_host_url">Dirección del servidor https://…</string>
@@ -94,14 +94,14 @@
   <string name="sync_conflicts_in_favourites_ticker">Se encontraron conflictos</string>
   <string name="sync_conflicts_in_favourites_content">Falló la sincronización de contenidos de %1$d ficheros</string>
   <string name="sync_fail_in_favourites_ticker">Fallos en la sincronización de contenidos</string>
-  <string name="sync_fail_in_favourites_content">Los contenidos de %1$d ficheros no fueron sincronizados (%2$d conflictos)</string>
+  <string name="sync_fail_in_favourites_content">Los contenidos de %1$d ficheros no se han sincronizado (%2$d conflictos)</string>
   <string name="sync_foreign_files_forgotten_ticker">Algunos archivos locales se han perdido</string>
   <string name="sync_foreign_files_forgotten_content">%1$d archivos de %2$s no han podido ser copiados</string>
   <string name="sync_foreign_files_forgotten_explanation">Como en la versión 1.3.16, los archivos subidos de este dispositivo son copiados a una carpeta local %1$s para evitar la perdida de datos cuando un unico archivo es sincronizado desde multiples cuentas\n\nDebido a este cambio, todos los archivos subidos en versiones previas de esta aplicación han sido copiados a la carpeta %2$s. No obtante, un error evito el completado de esta operación durante la sincronización de cuenta. Debería dejar el o los archivos así y eliminar el enlace a %3$s o mover el o los archivos al %1$s directorio y conservar el enlace a %4$s.\n\n Abajo tiene listado los enlaces a los archivos locales y archivos remotos en %5$s .</string>
   <string name="sync_current_folder_was_removed">La carpeta local %1$s no existe.</string>
   <string name="foreign_files_move">Mover todo</string>
   <string name="foreign_files_success">Todos los archivos fueron movidos</string>
-  <string name="foreign_files_fail">Algunos archivos no han podido ser movidos</string>
+  <string name="foreign_files_fail">No se han podido mover algunos archivos</string>
   <string name="foreign_files_local_text">Local: %1$s</string>
   <string name="foreign_files_remote_text">Remoto: %1$s</string>
   <string name="upload_query_move_foreign_files">No hay suficiente espacio para copiar los archivos seleccionados en la carpeta %1$s. ¿Quiere moverlos en lugar de copiarlos?</string>
@@ -157,17 +157,17 @@
   <string name="auth_wtf_reenter_URL">Estado inesperado; por favor, introduzca la URL del servidor de nuevo</string>
   <string name="auth_expired_oauth_token_toast">Su autorización ha expirado. Por favor, autorice de nuevo</string>
   <string name="auth_expired_basic_auth_toast">Por favor, introduzca la contraseña actual.</string>
-  <string name="auth_expired_saml_sso_token_toast">Su sesión ha expirado. Favor de conectarse de nuevo</string>
+  <string name="auth_expired_saml_sso_token_toast">Tu sesión ha expirado. Por favor, intenta conectarte de nuevo</string>
   <string name="auth_connecting_auth_server">Conectando al servidor de autenticación...</string>
   <string name="auth_unsupported_auth_method">El servidor no soporta este método de autenticación</string>
   <string name="auth_unsupported_multiaccount">%1$s no soporta cuentas múltiples</string>
-  <string name="auth_fail_get_user_name">Su servidor no está retornando una identificación de usuario correcta. Contacte a un administrador.</string>
+  <string name="auth_fail_get_user_name">Su servidor no está retornando una identificación de usuario correcta. Contacte con el administrador.</string>
   <string name="auth_can_not_auth_against_server">No puede autenticarse en este servidor.</string>
   <string name="fd_keep_in_sync">Mantener el archivo actualizado</string>
   <string name="common_rename">Renombrar</string>
   <string name="common_remove">Borrar</string>
   <string name="confirmation_remove_alert">¿Está seguro que desea borrar %1$s ?</string>
-  <string name="confirmation_remove_folder_alert">¿Desea elimiar %1$s y sus descendientes?</string>
+  <string name="confirmation_remove_folder_alert">¿Desea eliminar %1$s y sus descendientes?</string>
   <string name="confirmation_remove_local">Sólo local</string>
   <string name="confirmation_remove_folder_local">Sólo ficheros locales</string>
   <string name="confirmation_remove_remote">Eliminar del servidor</string>
@@ -177,7 +177,7 @@
   <string name="rename_dialog_title">Introduzca un nombre nuevo</string>
   <string name="rename_local_fail_msg">No se pudo cambiar el nombre de la copia local, trata con un nombre differente</string>
   <string name="rename_server_fail_msg">No se pudo cambiar el nombre</string>
-  <string name="sync_file_fail_msg">No pudo comprobarse el fichero remoto</string>
+  <string name="sync_file_fail_msg">No se ha podido comprobar el fichero remoto</string>
   <string name="sync_file_nothing_to_do_msg">Ya está sincronizado</string>
   <string name="create_dir_fail_msg">El directorio no pudo ser creado</string>
   <string name="filename_forbidden_characters">Carácteres ilegales: / \\ &lt; &gt; : \" | ? *</string>
@@ -201,7 +201,7 @@
   <string name="ssl_validator_label_CN">Nombre común:</string>
   <string name="ssl_validator_label_O">Organización:</string>
   <string name="ssl_validator_label_OU">Unidad organizativa</string>
-  <string name="ssl_validator_label_C">Pais:</string>
+  <string name="ssl_validator_label_C">País:</string>
   <string name="ssl_validator_label_ST">Estado:</string>
   <string name="ssl_validator_label_L">Ubicación:</string>
   <string name="ssl_validator_label_validity">Validez:</string>
@@ -209,7 +209,7 @@
   <string name="ssl_validator_label_validity_to">A:</string>
   <string name="ssl_validator_label_signature">Firma:</string>
   <string name="ssl_validator_label_signature_algorithm">Algoritmo:</string>
-  <string name="ssl_validator_null_cert">El certifiicado no pudo ser mostrado.</string>
+  <string name="ssl_validator_null_cert">No se ha podido mostrar el certificado</string>
   <string name="ssl_validator_no_info_about_error">- No hay información acerca del error</string>
   <string name="placeholder_sentence">Esto es un marcador de posición</string>
   <string name="placeholder_filename">marcadordeposición.txt</string>
@@ -238,7 +238,7 @@
   <string name="failed_upload_retry_do_nothing_text">No hacer nada no está conectado para subida instantánea</string>
   <string name="failed_upload_failure_text">Mensaje de error:</string>
   <string name="failed_upload_quota_exceeded_text">Por favor revise su configuración de servidor, posiblemente su cuota se haya excedido.</string>
-  <string name="share_link_no_support_share_api">Compartir archivos no está activado en su servidor. Sírvase contactar a su administrador de sistema.</string>
+  <string name="share_link_no_support_share_api">Compartir archivos no está activado en tu servidor. Por favor, ponte en contacto con el administrador.</string>
   <string name="share_link_file_no_exist">No es posible compartir este archivo o carpeta. Asegúrese de que existe.</string>
   <string name="share_link_file_error">Ocurrió un error al tratar de compartir este archivo o carpeta</string>
   <string name="unshare_link_file_no_exist">No se puede dejar de compartir este archivo o carpeta. No existe.</string>

+ 1 - 0
res/values-gl/strings.xml

@@ -161,6 +161,7 @@
   <string name="auth_connecting_auth_server">Conectando co servidor de autenticación…</string>
   <string name="auth_unsupported_auth_method">O servidor non admite este método de autenticación</string>
   <string name="auth_unsupported_multiaccount">%1$s non admite contas múltipes</string>
+  <string name="auth_fail_get_user_name">O seu servidor non devolveu un ID de usuario correcto, contacte cun administrador</string>
   <string name="auth_can_not_auth_against_server">Non é posíbel autenticalo neste servidor</string>
   <string name="fd_keep_in_sync">Manter actualizado o ficheiro</string>
   <string name="common_rename">Renomear</string>

+ 2 - 1
res/values-it/strings.xml

@@ -161,7 +161,8 @@
   <string name="auth_connecting_auth_server">Connessione al server di autenticazione in corso...</string>
   <string name="auth_unsupported_auth_method">Il server non supporta questo metodo di autenticazione</string>
   <string name="auth_unsupported_multiaccount">%1$s non supporta account multipli</string>
-  <string name="auth_can_not_auth_against_server">Impossibile eseguire l\'autenticazione su questo server.</string>
+  <string name="auth_fail_get_user_name">Il tuo server non restituisce un id utente corretto, contatta un amministratore</string>
+  <string name="auth_can_not_auth_against_server">Impossibile eseguire l\'autenticazione su questo server</string>
   <string name="fd_keep_in_sync">Tieni aggiornato il file</string>
   <string name="common_rename">Rinomina</string>
   <string name="common_remove">Rimuovi</string>

+ 1 - 0
res/values-pl/strings.xml

@@ -161,6 +161,7 @@
   <string name="auth_connecting_auth_server">Łączenie z serwerem autoryzacji...</string>
   <string name="auth_unsupported_auth_method">Serwer nie obsługuje tej metody autoryzacji</string>
   <string name="auth_unsupported_multiaccount">%1$s nie wspiera multikont</string>
+  <string name="auth_fail_get_user_name">Twój serwer nie zwraca prawidłowego identyfikatora użytkownika, proszę skontaktuj się z administratorem</string>
   <string name="auth_can_not_auth_against_server">Nie można autoryzować z tym serwerem</string>
   <string name="fd_keep_in_sync">Automatyczne aktualizuj plik</string>
   <string name="common_rename">Zmień nazwę</string>

+ 3 - 0
res/values-sl/strings.xml

@@ -97,6 +97,7 @@
   <string name="sync_fail_in_favourites_content">Vsebine %1$d datotek ni bilo mogoče uskladiti (zaznanih je %2$d sporov)</string>
   <string name="sync_foreign_files_forgotten_ticker">Nekatere krajevne datoteke so spregledane</string>
   <string name="sync_foreign_files_forgotten_content">Skupno %1$d datotek iz mape %2$s ni mogoče kopirati v</string>
+  <string name="sync_foreign_files_forgotten_explanation">Od različice 1.3.16 so datoteke, poslane iz te naprave, varnostno kopirane v krajevno mapo %1$s. S tem je preprečena izguba podatkov, ko je ena datoteka usklajena z več računi.\n\nZaradi te spremembe so vse datoteke, ki so bile kopirane v prejšnjih različicah, kopirane v mapo %2$s. Zaradi napake ni mogoče končati usklajevanja. Datoteke lahko ali pustite kjer so in odstranite povezavo na %3$s ali pa premaknete datoteke v mapo %1$s in ohranite povezavo do %4$s.\n\nSpodaj so izpisane krajevne datoteke in oddaljene povezane datoteke v mapi %5$s.</string>
   <string name="sync_current_folder_was_removed">Mapa %1$s ne obstaja več</string>
   <string name="foreign_files_move">Premakni vse</string>
   <string name="foreign_files_success">Vse datoteke so uspešno premaknjene na novo mesto</string>
@@ -160,6 +161,8 @@
   <string name="auth_connecting_auth_server">Poteka povezovanje z overitvenim strežnikom ...</string>
   <string name="auth_unsupported_auth_method">Strežnik ne podpira tega načina overitve</string>
   <string name="auth_unsupported_multiaccount">%1$s ne omogoča podpore več računom</string>
+  <string name="auth_fail_get_user_name">Strežnik ne vrača ustreznega ID uporabnika. Stopite v stik s skrbnikom sistema.</string>
+  <string name="auth_can_not_auth_against_server">S tem strežnikom overitev ni mogoča</string>
   <string name="fd_keep_in_sync">Datoteka naj bo posodobljena</string>
   <string name="common_rename">Preimenuj</string>
   <string name="common_remove">Odstrani</string>

+ 63 - 29
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -111,7 +111,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
     private static final String KEY_AUTH_MESSAGE_TEXT = "AUTH_MESSAGE_TEXT";
     private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";
     private static final String KEY_OC_VERSION = "OC_VERSION";
-    private static final String KEY_OC_VERSION_STRING = "OC_VERSION_STRING";
     private static final String KEY_ACCOUNT = "ACCOUNT";
     private static final String KEY_SERVER_VALID = "SERVER_VALID";
     private static final String KEY_SERVER_CHECKED = "SERVER_CHECKED";
@@ -157,10 +156,11 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 
     private final Handler mHandler = new Handler();
     private Thread mOperationThread;
-    //private GetRemoteStatusOperation mOcServerChkOperation;
     private GetServerInfoOperation mServerInfoOperation;
-    private ExistenceCheckRemoteOperation mAuthCheckOperation;
 
+    //private ExistenceCheckRemoteOperation mAuthCheckOperation;
+    private int mExistenceCheckOpId = -1;
+    
     private Uri mNewCapturedUriFromOAuth2Redirection;
 
     private AccountManager mAccountMgr;
@@ -281,10 +281,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             /// retrieve extras from intent
             mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);
             if (mAccount != null) {
-                String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION);
-                String ocVersionString = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION_STRING);
+                String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION);
                 if (ocVersion != null) {
-                    mDiscoveredVersion = new OwnCloudVersion(ocVersion, ocVersionString);
+                    mDiscoveredVersion = new OwnCloudVersion(ocVersion);
                 }
                 mHostBaseUrl = normalizeUrl(mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL));
                 mHostUrlInput.setText(mHostBaseUrl);
@@ -317,9 +316,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 
             /// server data
             String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);
-            String ocVersionString = savedInstanceState.getString(KEY_OC_VERSION_STRING);
             if (ocVersion != null) {
-                mDiscoveredVersion = new OwnCloudVersion(ocVersion, ocVersionString);
+                mDiscoveredVersion = new OwnCloudVersion(ocVersion);
             }
             mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);
 
@@ -500,7 +498,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         /// server data
         if (mDiscoveredVersion != null) {
             outState.putString(KEY_OC_VERSION, mDiscoveredVersion.getVersion());
-            outState.putString(KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString());
         }
         outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl);
 
@@ -827,12 +824,32 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         showDialog(DIALOG_LOGIN_PROGRESS);
 
         /// test credentials accessing the root folder
-        mAuthCheckOperation = new  ExistenceCheckRemoteOperation("", this, false);
-        OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, true);
-        client.setBasicCredentials(username, password);
-        mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);
+        String remotePath ="";
+        boolean successIfAbsent = false;
+        boolean followRedirects = true;
+        startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, username, password, followRedirects);
+        
     }
 
+    private void startExistenceCheckRemoteOperation(String remotePath, Context context, boolean successIfAbsent, String webdav_path,
+            String username, String password, boolean followRedirects) {
+        
+        Intent existenceCheckIntent = new Intent();
+        existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mHostBaseUrl);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, remotePath);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_SUCCESS_IF_ABSENT, successIfAbsent);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_WEBDAV_PATH, webdav_path);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);
+        existenceCheckIntent.putExtra(OperationsService.EXTRA_FOLLOW_REDIRECTS, followRedirects);
+        
+        if (mOperationsServiceBinder != null) {
+            Log_OC.wtf(TAG, "starting existenceCheckRemoteOperation..." );
+            mExistenceCheckOpId = mOperationsServiceBinder.newOperation(existenceCheckIntent);
+        }
+    }
 
     /**
      * Starts the OAuth 'grant type' flow to get an access token, with 
@@ -875,9 +892,10 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
         String webdav_path = AccountUtils.getWebdavPath(mDiscoveredVersion, mAuthTokenType);
 
         /// test credentials accessing the root folder
-        mAuthCheckOperation = new  ExistenceCheckRemoteOperation("", this, false);
-        OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, false);
-        mOperationThread = mAuthCheckOperation.execute(client, this, mHandler);
+        String remotePath ="";
+        boolean successIfAbsent = false;
+        boolean followRedirections = false;
+        startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirections);
 
     }
 
@@ -899,11 +917,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             onGetOAuthAccessTokenFinish(result);
 
         } else if (operation instanceof ExistenceCheckRemoteOperation)  {
+            Log_OC.wtf(TAG, "received detection response through callback" );
             if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType)) {
-                onSamlBasedFederatedSingleSignOnAuthorizationStart(operation, result);
+                onSamlBasedFederatedSingleSignOnAuthorizationStart(result);
 
             } else {
-                onAuthorizationCheckFinish((ExistenceCheckRemoteOperation)operation, result);
+                onAuthorizationCheckFinish(result);
             }
         } else if (operation instanceof GetRemoteUserNameOperation) {
             onGetUserNameFinish((GetRemoteUserNameOperation) operation, result);
@@ -945,7 +964,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
 
     }
 
-    private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperation operation, RemoteOperationResult result) {
+    private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperationResult result) {
+        mExistenceCheckOpId = -1;
         try {
             dismissDialog(DIALOG_LOGIN_PROGRESS);
         } catch (IllegalArgumentException e) {
@@ -1053,8 +1073,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                     url = "http://" + url;
                 }
             }
-
-            // OC-208: Add suffix remote.php/webdav to normalize (OC-34)            
+            
             url = trimUrlWebdav(url);
 
             if (url.endsWith("/")) {
@@ -1274,10 +1293,11 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             mAuthToken = tokens.get(OAuth2Constants.KEY_ACCESS_TOKEN);
             //mAuthToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);
             Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);
-            mAuthCheckOperation = new ExistenceCheckRemoteOperation("", this, false);
-            OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this, true);
-            client.setBearerCredentials(mAuthToken);
-            mAuthCheckOperation.execute(client, this, mHandler);
+            
+            String remotePath ="";
+            boolean successIfAbsent = false;
+            boolean followRedirects = true;
+            startExistenceCheckRemoteOperation(remotePath, this, successIfAbsent, webdav_path, "", "", followRedirects);
 
         } else {
             updateAuthStatusIconAndText(result);
@@ -1295,7 +1315,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
      * @param operation     Access check performed.
      * @param result        Result of the operation.
      */
-    private void onAuthorizationCheckFinish(ExistenceCheckRemoteOperation operation, RemoteOperationResult result) {
+    private void onAuthorizationCheckFinish(RemoteOperationResult result) {
+        mExistenceCheckOpId = -1;
         try {
             dismissDialog(DIALOG_LOGIN_PROGRESS);
         } catch (IllegalArgumentException e) {
@@ -1442,7 +1463,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             }
             /// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA
             mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION,         mDiscoveredVersion.getVersion());
-            mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING,  mDiscoveredVersion.getVersionString());
             mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL,   mHostBaseUrl);
 
             if (isSaml) {
@@ -1877,7 +1897,7 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
             RemoteOperationResult result = 
                     mOperationsServiceBinder.getOperationResultIfFinished(mGetServerInfoOpId);
             if (result != null) {
-                //Log.wtf(TAG, "found result of operation finished while rotating");
+                //Log_OC.wtf(TAG, "found result of operation finished while rotating");
                 onGetServerInfoFinish(result);
             }
             
@@ -1886,9 +1906,23 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
                     mOperationsServiceBinder.getOperationResultIfFinished(
                             mOauth2GetAccessTokenOpId);
             if (result != null) {
-                //Log.wtf(TAG, "found result of operation finished while rotating");
+                //Log_OC.wtf(TAG, "found result of operation finished while rotating");
                 onGetOAuthAccessTokenFinish(result);
             }
+            
+        } else if (mExistenceCheckOpId != -1) {
+            RemoteOperationResult result = 
+                    mOperationsServiceBinder.getOperationResultIfFinished(mExistenceCheckOpId);
+            if (result != null) {
+                //Log_OC.wtf(TAG, "found result of operation finished while rotating");
+                if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(
+                        MainApp.getAccountType()).equals(mAuthTokenType)) {
+                    onSamlBasedFederatedSingleSignOnAuthorizationStart(result);
+
+                } else {
+                    onAuthorizationCheckFinish(result);
+                }
+            }
         }
     }
     

+ 1 - 2
src/com/owncloud/android/files/FileOperationsHelper.java

@@ -139,8 +139,7 @@ public class FileOperationsHelper {
             AccountManager accountManager = AccountManager.get(callerActivity);
 
             String version = accountManager.getUserData(callerActivity.getAccount(), Constants.KEY_OC_VERSION);
-            String versionString = accountManager.getUserData(callerActivity.getAccount(), Constants.KEY_OC_VERSION_STRING);
-            return (new OwnCloudVersion(version, versionString)).isSharedSupported();
+            return (new OwnCloudVersion(version)).isSharedSupported();
             //return Boolean.parseBoolean(accountManager.getUserData(callerActivity.getAccount(), OwnCloudAccount.Constants.KEY_SUPPORTS_SHARE_API));
         }
         return false;

+ 1 - 2
src/com/owncloud/android/files/services/FileUploader.java

@@ -253,8 +253,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
 
         AccountManager aMgr = AccountManager.get(this);
         String version = aMgr.getUserData(account, Constants.KEY_OC_VERSION);
-        String versionString = aMgr.getUserData(account, Constants.KEY_OC_VERSION_STRING);
-        OwnCloudVersion ocv = new OwnCloudVersion(version, versionString);
+        OwnCloudVersion ocv = new OwnCloudVersion(version);
         
         boolean chunked = FileUploader.chunkedUploadIsSupported(ocv);
         AbstractList<String> requestedUploads = new Vector<String>();

+ 1 - 3
src/com/owncloud/android/operations/UpdateOCVersionOperation.java

@@ -78,11 +78,9 @@ public class UpdateOCVersionOperation extends RemoteOperation {
                     if (json != null && json.getString("version") != null) {
 
                         String version = json.getString("version");
-                        String versionstring = json.getString("versionstring");
-                        mOwnCloudVersion = new OwnCloudVersion(version, versionstring);
+                        mOwnCloudVersion = new OwnCloudVersion(version);
                         if (mOwnCloudVersion.isVersionValid()) {
                             accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION, mOwnCloudVersion.getVersion());
-                            accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING, mOwnCloudVersion.getVersionString());
                             Log_OC.d(TAG, "Got new OC version " + mOwnCloudVersion.toString());
 
                             result = new RemoteOperationResult(ResultCode.OK);

+ 55 - 4
src/com/owncloud/android/services/OperationsService.java

@@ -30,6 +30,7 @@ import com.owncloud.android.lib.common.OwnCloudClient;
 import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
 import com.owncloud.android.lib.common.operations.RemoteOperation;
 import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
 import com.owncloud.android.lib.resources.shares.ShareType;
 import com.owncloud.android.operations.common.SyncOperation;
 import com.owncloud.android.operations.CreateShareOperation;
@@ -64,10 +65,19 @@ public class OperationsService extends Service {
     public static final String EXTRA_SEND_INTENT = "SEND_INTENT";
     public static final String EXTRA_RESULT = "RESULT";
     
+    // TODO review if ALL OF THEM are necessary
+    public static final String EXTRA_WEBDAV_PATH = "WEBDAV_PATH";
+    public static final String EXTRA_SUCCESS_IF_ABSENT = "SUCCESS_IF_ABSENT";
+    public static final String EXTRA_USERNAME = "USERNAME";
+    public static final String EXTRA_PASSWORD = "PASSWORD";
+    public static final String EXTRA_AUTH_TOKEN = "AUTH_TOKEN";
+    public static final String EXTRA_FOLLOW_REDIRECTS = "FOLLOW_REDIRECTS";
+    
     public static final String ACTION_CREATE_SHARE = "CREATE_SHARE";
     public static final String ACTION_UNSHARE = "UNSHARE";
     public static final String ACTION_GET_SERVER_INFO = "GET_SERVER_INFO";
     public static final String ACTION_OAUTH2_GET_ACCESS_TOKEN = "OAUTH2_GET_ACCESS_TOKEN";
+    public static final String ACTION_EXISTENCE_CHECK = "EXISTENCE_CHECK";
     
     public static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() + ".OPERATION_ADDED";
     public static final String ACTION_OPERATION_FINISHED = OperationsService.class.getName() + ".OPERATION_FINISHED";
@@ -81,9 +91,21 @@ public class OperationsService extends Service {
     private static class Target {
         public Uri mServerUrl = null;
         public Account mAccount = null;
-        public Target(Account account, Uri serverUrl) {
+        public String mWebDavUrl = "";
+        public String mUsername = "";
+        public String mPassword = "";
+        public String mAuthToken = "";
+        public boolean mFollowRedirects = true;
+        
+        public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken,
+                boolean followRedirects) {
             mAccount = account;
             mServerUrl = serverUrl;
+            mWebDavUrl = webdavUrl;
+            mUsername = username;
+            mPassword = password;
+            mAuthToken = authToken;
+            mFollowRedirects = followRedirects;
         }
     }
 
@@ -232,9 +254,20 @@ public class OperationsService extends Service {
                 } else {
                     Account account = operationIntent.getParcelableExtra(EXTRA_ACCOUNT);
                     String serverUrl = operationIntent.getStringExtra(EXTRA_SERVER_URL);
+                    String webDavPath = operationIntent.getStringExtra(EXTRA_WEBDAV_PATH);
+                    String webDavUrl = serverUrl + webDavPath;
+                    String username = operationIntent.getStringExtra(EXTRA_USERNAME);
+                    String password = operationIntent.getStringExtra(EXTRA_PASSWORD);
+                    String authToken = operationIntent.getStringExtra(EXTRA_AUTH_TOKEN);
+                    boolean followRedirects = operationIntent.getBooleanExtra(EXTRA_FOLLOW_REDIRECTS, true);
                     target = new Target(
                             account, 
-                            (serverUrl == null) ? null : Uri.parse(serverUrl)
+                            (serverUrl == null) ? null : Uri.parse(serverUrl),
+                            ((webDavPath == null) || (serverUrl == null)) ? "" : webDavUrl,
+                            (username == null) ? "" : username,
+                            (password == null) ? "" : password,
+                            (authToken == null) ? "" : authToken,
+                            followRedirects
                     );
                     
                     String action = operationIntent.getAction();
@@ -245,6 +278,7 @@ public class OperationsService extends Service {
                             operation = new CreateShareOperation(remotePath, ShareType.PUBLIC_LINK, 
                                     "", false, "", 1, sendIntent);
                         }
+                        
                     } else if (action.equals(ACTION_UNSHARE)) {  // Unshare file
                         String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
                         if (remotePath.length() > 0) {
@@ -252,6 +286,7 @@ public class OperationsService extends Service {
                                     remotePath, 
                                     OperationsService.this);
                         }
+                        
                     } else if (action.equals(ACTION_GET_SERVER_INFO)) { 
                         // check OC server and get basic information from it
                         String authTokenType = 
@@ -268,6 +303,13 @@ public class OperationsService extends Service {
                                 getString(R.string.oauth2_redirect_uri),       
                                 getString(R.string.oauth2_grant_type),
                                 oauth2QueryParameters);
+                        
+                    } else if (action.equals(ACTION_EXISTENCE_CHECK)) {
+                        // Existence Check 
+                        String remotePath = operationIntent.getStringExtra(EXTRA_REMOTE_PATH);
+                        boolean successIfAbsent = operationIntent.getBooleanExtra(EXTRA_SUCCESS_IF_ABSENT, true);
+                        operation = new ExistenceCheckRemoteOperation(remotePath, OperationsService.this, successIfAbsent);
+                        
                     }
                 }
                     
@@ -329,7 +371,7 @@ public class OperationsService extends Service {
         synchronized(mPendingOperations) {
             next = mPendingOperations.peek();
         }
-        
+
         if (next != null) {
             
             mCurrentOperation = next.second;
@@ -342,7 +384,16 @@ public class OperationsService extends Service {
                         mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mAccount, getApplicationContext());
                         mStorageManager = new FileDataStorageManager(mLastTarget.mAccount, getContentResolver());
                     } else {
-                        mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(), true);    // this is not good enough
+                        mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(), 
+                                mLastTarget.mFollowRedirects);    // this is not good enough
+                        if (mLastTarget.mWebDavUrl != "") {
+                            mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
+                        }
+                        if (mLastTarget.mUsername != "" && mLastTarget.mPassword != "") {
+                            mOwnCloudClient.setBasicCredentials(mLastTarget.mUsername, mLastTarget.mPassword);
+                        } else if (mLastTarget.mAuthToken != "") {
+                            mOwnCloudClient.setBearerCredentials(mLastTarget.mAuthToken);
+                        }
                         mStorageManager = null;
                     }
                 }