--- /dev/null
+## 1.7.0 (19 February 2015)
+
+- Download full folders
+- Grid view for images
+- Remote thumbnails (OC Server 8.0+)
+- Added number of files and folders at the end of the list
+- "Open with" in contextual menu
+- Downloads added to Media Provider
+- Uploads:
+ + Local thumbnails in section "Files"
+ + Multiple selection in "Content from other apps" (Android 4.3+)
+- Gallery:
+ + proper handling of EXIF
+ + obey sorting in the list of files
+- Settings view updated
+- Improved subjects in e-mails
+- Bugs fixed
+...
+
+
-Subproject commit 2f178c9c34e3dab507c46e718705913ed44db3c5
+Subproject commit c2b5ddd2364f53201e7df6210ce04bc6bf4a2bbd
<string name="prefs_category_security">Сигурност</string>
<string name="prefs_instant_video_upload_path_title">Качване на видео път</string>
<string name="download_folder_failed_content">Свалянето на директорията %1$s не може да бъде завършено</string>
- <string name="shared_subject_header">споделен</string>
- <string name="with_you_subject_header">с Вас</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
</resources>
<string name="prefs_category_security">Zabezpečení</string>
<string name="prefs_instant_video_upload_path_title">Cesta pro nahrávání videí</string>
<string name="download_folder_failed_content">Stažení adresáře %1$s nemohlo být dokončeno</string>
+ <string name="subject_token">%1$s sdílí \"%2$s\"</string>
</resources>
<string name="prefs_category_security">Sikkerhed</string>
<string name="prefs_instant_video_upload_path_title">Sti til videoupload</string>
<string name="download_folder_failed_content">Download af %1$s mappe kunne ikke fuldføres</string>
+ <string name="subject_token">%1$s delt \"%2$s\" med dig</string>
</resources>
<string name="prefs_category_security">Sicherheit</string>
<string name="prefs_instant_video_upload_path_title">Verzeichnis zum Hochladen der Videos</string>
<string name="download_folder_failed_content">Herunterladen des %1$s - Ordners konnte nicht abgeschlossen werden</string>
+ <string name="subject_token">%1$s hat „%2$s“ mit Ihnen geteilt</string>
</resources>
<string name="prefs_category_security">Sicherheit</string>
<string name="prefs_instant_video_upload_path_title">Verzeichnis zum Hochladen der Videos</string>
<string name="download_folder_failed_content">Herunterladen des %1$s - Ordners konnte nicht abgeschlossen werden</string>
+ <string name="subject_token">%1$s hat „%2$s“ mit Dir geteilt</string>
</resources>
<string name="prefs_category_security">Ασφάλεια</string>
<string name="prefs_instant_video_upload_path_title">Διαδρομή Μεταφόρτωσης Βίντεο</string>
<string name="download_folder_failed_content">Η λήψη του φακέλου %1$s δεν ολοκληρώθηκε με επιτυχία.</string>
+ <string name="subject_token">%1$s μοιράστηκε \"%2$s\" μαζί σας</string>
</resources>
<string name="prefs_category_security">Security</string>
<string name="prefs_instant_video_upload_path_title">Upload Video Path</string>
<string name="download_folder_failed_content">Download of %1$s folder could not be completed</string>
+ <string name="subject_token">%1$s shared \"%2$s\" with you</string>
</resources>
<string name="actionbar_settings">Configuración</string>
<string name="actionbar_see_details">Detalles</string>
<string name="actionbar_send_file">Mandar</string>
+ <string name="actionbar_sort">Orden</string>
+ <string name="actionbar_sort_title">Ordenar por</string>
+ <string-array name="actionbar_sortby">
+ <item>A-Z</item>
+ <item>Nuevos - Viejos</item>
+ </string-array>
<!--TODO re-enable when server-side folder size calculation is available
<item>Biggest - Smallest</item>-->
<string name="prefs_category_general">General</string>
<string name="prefs_recommend">Recomendar a un amigo</string>
<string name="prefs_feedback">Sugerencias</string>
<string name="prefs_imprint">Imprint</string>
+ <string name="prefs_remember_last_share_location">Recordar compartir ubicación </string>
+ <string name="prefs_remember_last_upload_location_summary">Recordar la ultima ubicación compartida de subida</string>
<string name="recommend_subject">¡Intento %1$s en tu teléfono inteligente!</string>
+ <string name="recommend_text">Quiero invitarte a usar %1$s en tu teléfono inteligente!\nDescárgalo aquí: %2$s</string>
<string name="auth_check_server">Verificar Servidor</string>
<string name="auth_host_url">Dirección del servidor https://...</string>
<string name="auth_username">Nombre de usuario</string>
<string name="conflict_dont_upload">No subir</string>
<string name="preview_image_description">Previsualización de imagen</string>
<string name="preview_image_error_unknown_format">Esta imagen no puede ser mostrada</string>
+ <string name="error__upload__local_file_not_copied">%1$s no pudo ser copiado a la carpeta local %2$s </string>
+ <string name="prefs_instant_upload_path_title">Dirección de subida</string>
+ <string name="share_link_no_support_share_api">Lo sentimos, compartir no esta activado en su servidor. Por favor contacte a su
+⇥⇥administrator.</string>
+ <string name="share_link_file_no_exist">Imposible compartir. Por favor revise si el archivo existe</string>
+ <string name="share_link_file_error">Un error ocurrió cuando se intentaba compartir el archivo o carpeta</string>
+ <string name="unshare_link_file_no_exist">Imposible dejar de compartir. Por favor revise si los archivos existen</string>
+ <string name="unshare_link_file_error">Un error ocurrió cuando se intentaba dejar de compartir el archivo o carpeta</string>
<string name="activity_chooser_send_file_title">Mandar</string>
+ <string name="copy_link">Copiar dirección url</string>
<string name="clipboard_text_copied">Copiado al portapapeles</string>
+ <string name="error_cant_bind_to_operations_service">Error critico: no se puede realizar operaciones</string>
+ <string name="network_error_socket_exception">Un error ocurrió mientras se conectaba con el Servidor.</string>
+ <string name="network_error_socket_timeout_exception">Un error ocurrió mientras se conectaba con el Servidor. La operación no se realizó </string>
+ <string name="network_error_connect_timeout_exception">Un error ocurrió esperando al Servidor, la operación no se realizó</string>
+ <string name="network_host_not_available">Operación no completada, Servidor no disponible.</string>
<string name="empty"></string>
+ <string name="forbidden_permissions">Tu no tienes permiso %s</string>
+ <string name="forbidden_permissions_rename">para renombrar este archivo</string>
+ <string name="forbidden_permissions_delete">para borrar este archivo</string>
+ <string name="share_link_forbidden_permissions">para compartir este archivo</string>
+ <string name="unshare_link_forbidden_permissions">para dejar de compartir este archivo</string>
+ <string name="forbidden_permissions_create">para crear el archivo</string>
+ <string name="uploader_upload_forbidden_permissions">para subir en esta carpeta</string>
+ <string name="downloader_download_file_not_found">El archivo no esta mas disponible en este Servidor</string>
<string name="prefs_category_accounts">Cuentas</string>
+ <string name="prefs_add_account">Añadir cuenta</string>
+ <string name="auth_redirect_non_secure_connection_title">Conexión segura redireccionada a una ruta insegura.</string>
+ <string name="actionbar_logger">Registro</string>
+ <string name="log_send_history_button">Enviar Historial</string>
+ <string name="log_send_no_mail_app">Aplicación para enviar registros no encontrada. Instale una aplicación de correo!</string>
+ <string name="log_send_mail_subject">%1$s Registros de la aplicación Android</string>
+ <string name="log_progress_dialog_text">Cargando datos...</string>
<string name="saml_authentication_required_text">Autentificación requerida</string>
<string name="saml_authentication_wrong_pass">Clave incorrecta</string>
+ <string name="actionbar_move">Mover</string>
+ <string name="file_list_empty_moving">Nada aquí. Puedes agregar una carpeta!</string>
<string name="folder_picker_choose_button_text">Elegir</string>
+ <string name="move_file_not_found">Imposible mover. Por favor revisa si el archivo existe</string>
+ <string name="move_file_invalid_overwrite">El archivo ya existe en la carpeta destino</string>
+ <string name="move_file_error">Un error ocurrió intentando mover el archivo o carpeta</string>
+ <string name="forbidden_permissions_move">para mover este archivo</string>
+ <string name="prefs_category_instant_uploading">Subida Instantánea </string>
<string name="prefs_category_security">Seguridad</string>
+ <string name="prefs_instant_video_upload_path_title">Dirección de subida del video</string>
+ <string name="download_folder_failed_content">La descarga de la carpeta %1$s no pudo ser completada</string>
</resources>
<string name="saml_authentication_wrong_pass">Contraseña incorrecta</string>
<string name="actionbar_move">Mover</string>
<string name="file_list_empty_moving">Aquí no hay nada. ¡Puede agregar una carpeta!</string>
- <string name="folder_picker_choose_button_text">Seleccionar</string>
+ <string name="folder_picker_choose_button_text">Elegir</string>
<string name="move_file_not_found">No se puede mover. Revise si el archivo existe</string>
<string name="move_file_invalid_into_descendent">No se puede mover una carpeta dentro de una de SUS subcarpetas.</string>
<string name="move_file_invalid_overwrite">El archivo ya existe en la carpeta de destino</string>
<string name="prefs_category_security">Seguridad</string>
<string name="prefs_instant_video_upload_path_title">Guardar videos subidos en la carpeta:</string>
<string name="download_folder_failed_content">La descarga de la carpeta %1$s no ha podido ser completada</string>
- <string name="shared_subject_header">compartido</string>
- <string name="with_you_subject_header">contigo</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
+ <string name="subject_token">%1$s compartió \"%2$s\" contigo</string>
</resources>
<string name="prefs_category_security">Segurtasuna</string>
<string name="prefs_instant_video_upload_path_title">Bideo Igoera Bidea</string>
<string name="download_folder_failed_content">%1$s karpetaren deskarga ezin izan da burutu</string>
- <string name="shared_subject_header">konpartitua</string>
- <string name="with_you_subject_header">zurekin</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
</resources>
<string name="move_file_error">Tämän tiedoston tai kansion siirtoa yrittäessä tapahtui virhe</string>
<string name="prefs_category_instant_uploading">Välittömät lähetykset</string>
<string name="prefs_category_security">Tietoturva</string>
+ <string name="subject_token">%1$s jakoi kohteen \"%2$s\" kanssasi</string>
</resources>
<string name="prefs_category_security">Sécurité</string>
<string name="prefs_instant_video_upload_path_title">Répertoire de téléversement des vidéos</string>
<string name="download_folder_failed_content">Le téléchargement du dossier %1$s n\'a pas pu être achevé</string>
- <string name="shared_subject_header">partagé</string>
- <string name="with_you_subject_header">avec vous</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
+ <string name="subject_token">%1$s a partagé \"%2$s\" avec vous</string>
</resources>
<string name="prefs_category_security">Seguranza</string>
<string name="prefs_instant_video_upload_path_title">Enviar a ruta do vídeo</string>
<string name="download_folder_failed_content">Non foi posíbel completar a descarga do cartafol %1$s</string>
- <string name="shared_subject_header">compartido</string>
- <string name="with_you_subject_header">con vostede</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
+ <string name="subject_token">%1$s compartiu «%2$s» con vostede</string>
</resources>
<string name="prefs_category_security">Protezione</string>
<string name="prefs_instant_video_upload_path_title">Percorso di caricamento video</string>
<string name="download_folder_failed_content">Lo scaricamento della cartella %1$s non può essere completato</string>
+ <string name="subject_token">%1$s ha condiviso \"%2$s\" con te</string>
</resources>
<string name="prefs_category_security">セキュリティ</string>
<string name="prefs_instant_video_upload_path_title">動画のアップロードパス</string>
<string name="download_folder_failed_content">%1$s のフォルダのダウンロードが完了しませんでした。</string>
+ <string name="subject_token">%1$sがあなたと\"%2$s\"を共有しました</string>
</resources>
<string name="prefs_category_security">Sikkerhet</string>
<string name="prefs_instant_video_upload_path_title">Sti til video-opplasting</string>
<string name="download_folder_failed_content">Nedlasting av %1$s mappen kunne ikke fullføres</string>
- <string name="shared_subject_header">delt</string>
- <string name="with_you_subject_header">med deg</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
</resources>
<string name="prefs_category_security">Bezpieczeństwo</string>
<string name="prefs_instant_video_upload_path_title">Katalog wysyłania dla wideo</string>
<string name="download_folder_failed_content">Pobieranie %1$s katalogu nie może zostać ukończone</string>
- <string name="shared_subject_header">współdzielone</string>
- <string name="with_you_subject_header">z Tobą</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
</resources>
<string name="prefs_category_security">Segurança</string>
<string name="prefs_instant_video_upload_path_title">Enviar o Caminho do Vídeo</string>
<string name="download_folder_failed_content">Baixar %1$s da pasta não pode ser completado</string>
+ <string name="subject_token">%1$s compartilhou \"%2$s\" com você</string>
</resources>
<string name="prefs_category_security">Segurança</string>
<string name="prefs_instant_video_upload_path_title">Envio do Caminho do Vídeo</string>
<string name="download_folder_failed_content">Não foi possível completar o download da pasta %1$s</string>
- <string name="shared_subject_header">partilhado</string>
- <string name="with_you_subject_header">consigo</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
+ <string name="subject_token">%1$s partilhou \"%2$s\" consigo</string>
</resources>
<string name="prefs_category_security">Безопасность</string>
<string name="prefs_instant_video_upload_path_title">Путь для загрузки Видео</string>
<string name="download_folder_failed_content">Загрузка папки %1$s не может быть завершена</string>
+ <string name="subject_token">%1$s предоставил вам доступ к \"%2$s\"</string>
</resources>
<string name="prefs_category_instant_uploading">Takojšnje pošiljanje v oblak</string>
<string name="prefs_category_security">Varnost</string>
<string name="prefs_instant_video_upload_path_title">Pot videa za pošiljanje</string>
- <string name="download_folder_failed_content">Prenos imenika %1$s ni mogoče dokončati</string>
- <string name="shared_subject_header">v souporabi</string>
- <string name="with_you_subject_header">z vami</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
+ <string name="download_folder_failed_content">Imenika %1$s ni mogoče prejeti v celoti</string>
</resources>
<string name="common_cancel">Откажи</string>
<string name="common_save_exit">Сачувај и изађи</string>
<string name="common_error">Грешка</string>
+ <string name="common_loading">Учитавам...</string>
+ <string name="common_error_unknown">Непозната грешка</string>
<string name="about_title">О програму</string>
<string name="change_password">Измени лозинку</string>
<string name="delete_account">Обриши налог</string>
<string name="create_account">Отвори налог</string>
<string name="upload_chooser_title">Отпреми из…</string>
+ <string name="uploader_info_dirname">Назив фасцикле</string>
<string name="uploader_upload_in_progress_ticker">Отпремам…</string>
<string name="uploader_upload_in_progress_content">%1$d%% Отпремам %2$s</string>
<string name="uploader_upload_succeeded_ticker">Отпремање је успело</string>
<string name="saml_authentication_wrong_pass">Лозинка пограшна</string>
<string name="folder_picker_choose_button_text">Одабери</string>
<string name="prefs_category_security">Безбедност</string>
- <string name="shared_subject_header">Дељено</string>
</resources>
<string name="file_list_loading">Yükleniyor...</string>
<string name="local_file_list_empty">Bu klasörde dosya yok.</string>
<string name="file_list_folder">klasör</string>
- <string name="file_list_folders">klasörler</string>
+ <string name="file_list_folders">klasör</string>
<string name="file_list_file">dosya</string>
- <string name="file_list_files">dosyalar</string>
+ <string name="file_list_files">dosya</string>
<string name="filedetails_select_file">Ek bilgileri görmek için dosyaya dokunun.</string>
<string name="filedetails_size">Boyut:</string>
<string name="filedetails_type">Tür:</string>
<string name="prefs_category_security">Güvenlik</string>
<string name="prefs_instant_video_upload_path_title">Video Yükleme Yolu</string>
<string name="download_folder_failed_content">%1$s klasörün indirilmesi tamamlanamadı</string>
- <string name="subject_token">%1$s sizinle \"%2$s\" paylaştı</string>
+ <string name="subject_token">%1$s sizinle \"%2$s\" paylaşımını yaptı</string>
</resources>
<string name="prefs_category_security">Безпека</string>
<string name="prefs_instant_video_upload_path_title">Шлях завантаження відео</string>
<string name="download_folder_failed_content">Скачування теки %1$s не може бути завершено</string>
- <string name="shared_subject_header">спільне</string>
- <string name="with_you_subject_header">з тобою</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
</resources>
<string name="prefs_category_security">安全性</string>
<string name="prefs_instant_video_upload_path_title">影片上傳路徑</string>
<string name="download_folder_failed_content">%1$s 目錄的下載未完成</string>
- <string name="shared_subject_header">以分享的</string>
- <string name="with_you_subject_header">與你</string>
- <string name="subject_token">%1$s %2$s >>%3$s<< %4$s</string>
</resources>
<string name="auth_fail_get_user_name">Your server is not returning a correct user id, please contact an administrator
</string>
<string name="auth_can_not_auth_against_server">Cannot authenticate against this server</string>
+ <string name="auth_account_does_not_exist">Account does not exist in the device yet</string>
<string name="fd_keep_in_sync">Keep file up to date</string>
<string name="common_rename">Rename</string>
/* ownCloud Android client application
- * Copyright (C) 2012-2013 ownCloud Inc.
+ * Copyright (C) 2012-2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
/* ownCloud Android client application\r
* Copyright (C) 2012 Bartek Przybylski\r
- * Copyright (C) 2012-2014 ownCloud Inc.\r
+ * Copyright (C) 2012-2015 ownCloud Inc.\r
*\r
* This program is free software: you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License version 2,\r
import com.owncloud.android.MainApp;\r
import com.owncloud.android.R;\r
import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener;\r
+import com.owncloud.android.lib.common.OwnCloudCredentials;\r
+import com.owncloud.android.lib.common.OwnCloudCredentialsFactory;\r
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;\r
+import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;\r
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;\r
import com.owncloud.android.lib.common.network.CertificateCombinedException;\r
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;\r
import com.owncloud.android.lib.common.operations.RemoteOperationResult;\r
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;\r
import com.owncloud.android.lib.common.utils.Log_OC;\r
-import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;\r
import com.owncloud.android.lib.resources.status.OwnCloudVersion;\r
import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;\r
import com.owncloud.android.operations.DetectAuthenticationMethodOperation.AuthenticationMethod;\r
* @author masensio\r
*/\r
public class AuthenticatorActivity extends AccountAuthenticatorActivity\r
-implements OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener, \r
-SsoWebViewClientListener, OnSslUntrustedCertListener {\r
+ implements OnRemoteOperationListener, OnFocusChangeListener, OnEditorActionListener,\r
+ SsoWebViewClientListener, OnSslUntrustedCertListener,\r
+ AuthenticatorAsyncTask.OnAuthenticatorTaskListener {\r
\r
private static final String TAG = AuthenticatorActivity.class.getSimpleName();\r
\r
private static final String CREDENTIALS_DIALOG_TAG = "CREDENTIALS_DIALOG";\r
private static final String KEY_AUTH_IS_FIRST_ATTEMPT_TAG = "KEY_AUTH_IS_FIRST_ATTEMPT";\r
\r
+ private static final String KEY_USERNAME = "USERNAME";\r
+ private static final String KEY_PASSWORD = "PASSWORD";\r
+ private static final String KEY_ASYNC_TASK_IN_PROGRESS = "AUTH_IN_PROGRESS";\r
\r
/// parameters from EXTRAs in starter Intent\r
private byte mAction;\r
private int mAuthStatusText = 0, mAuthStatusIcon = 0;\r
\r
private String mAuthToken = "";\r
+ private AuthenticatorAsyncTask mAsyncTask;\r
\r
private boolean mIsFirstAuthAttempt;\r
-\r
\r
/// Identifier of operation in progress which result shouldn't be lost \r
private long mWaitingForOpId = Long.MAX_VALUE;\r
\r
- \r
+ private final String BASIC_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
+ private final String OAUTH_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
+ private final String SAML_TOKEN_TYPE =\r
+ AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());\r
+\r
+\r
/**\r
* {@inheritDoc}\r
* \r
setContentView(R.layout.account_setup);\r
\r
/// initialize general UI elements\r
- initOverallUi(savedInstanceState);\r
+ initOverallUi();\r
\r
mOkButton = findViewById(R.id.buttonOK);\r
\r
\r
private String chooseAuthTokenType(boolean oauth, boolean saml) {\r
if (saml) {\r
- return AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());\r
+ return SAML_TOKEN_TYPE;\r
} else if (oauth) {\r
- return AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
+ return OAUTH_TOKEN_TYPE;\r
} else {\r
- return AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
+ return BASIC_TOKEN_TYPE;\r
}\r
}\r
\r
\r
/**\r
* Configures elements in the user interface under direct control of the Activity.\r
- * \r
- * @param savedInstanceState Saved activity state, as in {{@link #onCreate(Bundle)}\r
*/\r
- private void initOverallUi(Bundle savedInstanceState) {\r
+ private void initOverallUi() {\r
\r
/// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)\r
boolean isWelcomeLinkVisible = getResources().getBoolean(R.bool.show_welcome_link);\r
if (\r
AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(\r
MainApp.getAccountType()\r
- ).equals(mAuthTokenType) &&\r
- mHostUrlInput.hasFocus()\r
- ) {\r
+ ).equals(mAuthTokenType) &&\r
+ mHostUrlInput.hasFocus()\r
+ ) {\r
checkOcServer();\r
}\r
}\r
* intended to defer the processing of the redirection caught in \r
* {@link #onNewIntent(Intent)} until {@link #onResume()} \r
* \r
- * See {@link #loadSavedInstanceState(Bundle)}\r
+ * See {@link #onSaveInstanceState(Bundle)}\r
*/\r
@Override\r
protected void onSaveInstanceState(Bundle outState) {\r
/// authentication\r
outState.putBoolean(KEY_AUTH_IS_FIRST_ATTEMPT_TAG, mIsFirstAuthAttempt);\r
\r
+ /// AsyncTask (User and password)\r
+ outState.putString(KEY_USERNAME, mUsernameInput.getText().toString());\r
+ outState.putString(KEY_PASSWORD, mPasswordInput.getText().toString());\r
+\r
+ if (mAsyncTask != null) {\r
+ mAsyncTask.cancel(true);\r
+ outState.putBoolean(KEY_ASYNC_TASK_IN_PROGRESS, true);\r
+ } else {\r
+ outState.putBoolean(KEY_ASYNC_TASK_IN_PROGRESS, false);\r
+ }\r
+ mAsyncTask = null;\r
+\r
//Log_OC.wtf(TAG, "onSaveInstanceState end" );\r
}\r
\r
+ @Override\r
+ public void onRestoreInstanceState(Bundle savedInstanceState) {\r
+ super.onRestoreInstanceState(savedInstanceState);\r
+\r
+ // AsyncTask\r
+ boolean inProgress = savedInstanceState.getBoolean(KEY_ASYNC_TASK_IN_PROGRESS);\r
+ if (inProgress){\r
+ String username = savedInstanceState.getString(KEY_USERNAME);\r
+ String password = savedInstanceState.getString(KEY_PASSWORD);\r
+\r
+ OwnCloudCredentials credentials = null;\r
+ if (BASIC_TOKEN_TYPE.equals(mAuthTokenType)) {\r
+ credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password);\r
+\r
+ } else if (OAUTH_TOKEN_TYPE.equals(mAuthTokenType)) {\r
+ credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);\r
+\r
+ }\r
+ accessRootFolder(credentials);\r
+ }\r
+ }\r
\r
/**\r
* The redirection triggered by the OAuth authentication server as response to the \r
*/\r
@Override\r
protected void onResume() {\r
- //Log_OC.wtf(TAG, "onResume init" );\r
super.onResume();\r
\r
// bound here to avoid spurious changes triggered by Android on device rotations\r
doOnResumeAndBound();\r
}\r
\r
- //Log_OC.wtf(TAG, "onResume end" );\r
}\r
\r
\r
@Override\r
protected void onPause() {\r
- //Log_OC.wtf(TAG, "onPause init" );\r
if (mOperationsServiceBinder != null) {\r
- //Log_OC.wtf(TAG, "unregistering to listen for operation callbacks" );\r
mOperationsServiceBinder.removeOperationListener(this);\r
}\r
\r
mHostUrlInput.setOnFocusChangeListener(null);\r
\r
super.onPause();\r
- //Log_OC.wtf(TAG, "onPause end" );\r
}\r
\r
@Override\r
public void onFocusChange(View view, boolean hasFocus) {\r
if (view.getId() == R.id.hostUrlInput) { \r
if (!hasFocus) {\r
- onUrlInputFocusLost((TextView) view);\r
+ onUrlInputFocusLost();\r
}\r
else {\r
showRefreshButton(false);\r
}\r
\r
} else if (view.getId() == R.id.account_password) {\r
- onPasswordFocusChanged((TextView) view, hasFocus);\r
+ onPasswordFocusChanged(hasFocus);\r
}\r
}\r
\r
* started. \r
* \r
* When hasFocus: user 'comes back' to write again the server URL.\r
- * \r
- * @param hostInput TextView with the URL input field receiving the change of focus.\r
*/\r
- private void onUrlInputFocusLost(TextView hostInput) {\r
+ private void onUrlInputFocusLost() {\r
if (!mServerInfo.mBaseUrl.equals(\r
normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn))) {\r
// check server again only if the user changed something in the field\r
* \r
* When (!hasFocus), the button is made invisible and the password is hidden.\r
* \r
- * @param passwordInput TextView with the password input field receiving the change of focus.\r
* @param hasFocus 'True' if focus is received, 'false' if is lost\r
*/\r
- private void onPasswordFocusChanged(TextView passwordInput, boolean hasFocus) {\r
+ private void onPasswordFocusChanged(boolean hasFocus) {\r
if (hasFocus) {\r
showViewPasswordButton();\r
} else {\r
mServerStatusText = R.string.auth_wtf_reenter_URL;\r
showServerStatus();\r
mOkButton.setEnabled(false);\r
- //Log_OC.wtf(TAG, "The user was allowed to click 'connect' to an unchecked server!!");\r
return;\r
}\r
\r
dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
\r
/// validate credentials accessing the root folder\r
- accessRootFolderRemoteOperation(username, password);\r
- \r
+ OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password);\r
+ accessRootFolder(credentials);\r
}\r
\r
- private void accessRootFolderRemoteOperation(String username, String password) {\r
- Intent existenceCheckIntent = new Intent();\r
- existenceCheckIntent.setAction(OperationsService.ACTION_EXISTENCE_CHECK);\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_SERVER_URL, mServerInfo.mBaseUrl);\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_REMOTE_PATH, "/");\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_USERNAME, username);\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_PASSWORD, password);\r
- existenceCheckIntent.putExtra(OperationsService.EXTRA_AUTH_TOKEN, mAuthToken);\r
- \r
- if (mOperationsServiceBinder != null) {\r
- //Log_OC.wtf(TAG, "starting existenceCheckRemoteOperation..." );\r
- mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(existenceCheckIntent);\r
- }\r
+ private void accessRootFolder(OwnCloudCredentials credentials) {\r
+ mAsyncTask = new AuthenticatorAsyncTask(this);\r
+ Object[] params = { mServerInfo.mBaseUrl, credentials };\r
+ mAsyncTask.execute(params);\r
}\r
\r
+\r
/**\r
* Starts the OAuth 'grant type' flow to get an access token, with \r
* a GET AUTHORIZATION request to the BUILT-IN authorization server. \r
* in the server.\r
*/\r
private void startSamlBasedFederatedSingleSignOnAuthorization() {\r
- // be gentle with the user\r
+ /// be gentle with the user\r
mAuthStatusIcon = R.drawable.progress_small;\r
mAuthStatusText = R.string.auth_connecting_auth_server;\r
showAuthStatus();\r
- IndeterminateProgressDialog dialog = \r
- IndeterminateProgressDialog.newInstance(R.string.auth_trying_to_login, true);\r
- dialog.show(getSupportFragmentManager(), WAIT_DIALOG_TAG);\r
-\r
- /// validate credentials accessing the root folder\r
- accessRootFolderRemoteOperation("", "");\r
\r
+ /// Show SAML-based SSO web dialog\r
+ String targetUrl = mServerInfo.mBaseUrl\r
+ + AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
+ SamlWebViewDialog dialog = SamlWebViewDialog.newInstance(targetUrl, targetUrl);\r
+ dialog.show(getSupportFragmentManager(), SAML_DIALOG_TAG);\r
}\r
\r
/**\r
} else if (operation instanceof OAuth2GetAccessToken) {\r
onGetOAuthAccessTokenFinish(result);\r
\r
- } else if (operation instanceof ExistenceCheckRemoteOperation) {\r
- //Log_OC.wtf(TAG, "received detection response through callback" );\r
- if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).\r
- equals(mAuthTokenType)) {\r
- onSamlBasedFederatedSingleSignOnAuthorizationStart(result);\r
-\r
- } else {\r
- onAuthorizationCheckFinish(result);\r
- }\r
} else if (operation instanceof GetRemoteUserNameOperation) {\r
onGetUserNameFinish(result);\r
}\r
if (!mUsernameInput.getText().toString().equals(username)) {\r
// fail - not a new account, but an existing one; disallow\r
result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME);\r
- /*\r
- OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(\r
- new OwnCloudAccount(\r
- Uri.parse(mServerInfo.mBaseUrl),\r
- OwnCloudCredentialsFactory.newSamlSsoCredentials(mAuthToken))\r
- );\r
- */\r
mAuthToken = "";\r
updateAuthStatusIconAndText(result);\r
showAuthStatus();\r
Log_OC.d(TAG, result.getLogMessage());\r
} else {\r
- updateToken();\r
- success = true;\r
+ try {\r
+ updateAccountAuthentication();\r
+ success = true;\r
+\r
+ } catch (AccountNotFoundException e) {\r
+ Log_OC.e(TAG, "Account " + mAccount + " was removed!", e);\r
+ Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show();\r
+ finish();\r
+ }\r
}\r
}\r
\r
\r
}\r
\r
- private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperationResult result) {\r
- mWaitingForOpId = Long.MAX_VALUE;\r
- dismissDialog(WAIT_DIALOG_TAG);\r
-
- if (result.isIdPRedirection()) {
- String targetUrl = mServerInfo.mBaseUrl \r
- + AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
-\r
- // Show dialog\r
- SamlWebViewDialog dialog = SamlWebViewDialog.newInstance(targetUrl, targetUrl); \r
- dialog.show(getSupportFragmentManager(), SAML_DIALOG_TAG);\r
-\r
- mAuthStatusIcon = 0;\r
- mAuthStatusText = 0;\r
-\r
- } else {\r
- mAuthStatusIcon = R.drawable.common_error;\r
- mAuthStatusText = R.string.auth_unsupported_auth_method;\r
-\r
- }\r
- showAuthStatus();\r
- }\r
-\r
-\r
/**\r
* Processes the result of the server check performed when the user finishes the enter of the\r
* server URL.\r
- * \r
- * @param operation Server check performed.\r
+ *\r
* @param result Result of the check.\r
*/\r
private void onGetServerInfoFinish(RemoteOperationResult result) {\r
\r
\r
private boolean authSupported(AuthenticationMethod authMethod) {\r
- String basic = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
- String oAuth = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
- String saml = AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType());\r
- \r
- return (( mAuthTokenType.equals(basic) && \r
- authMethod.equals(AuthenticationMethod.BASIC_HTTP_AUTH) ) ||\r
- ( mAuthTokenType.equals(oAuth) && \r
- authMethod.equals(AuthenticationMethod.BEARER_TOKEN)) ||\r
- ( mAuthTokenType.equals(saml) && \r
- authMethod.equals(AuthenticationMethod.SAML_WEB_SSO))\r
+ return (( BASIC_TOKEN_TYPE.equals(mAuthTokenType) &&\r
+ AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod) ) ||\r
+ ( OAUTH_TOKEN_TYPE.equals(mAuthTokenType) &&\r
+ AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) ||\r
+ ( SAML_TOKEN_TYPE.equals(mAuthTokenType) &&\r
+ AuthenticationMethod.SAML_WEB_SSO.equals(authMethod))\r
);\r
}\r
\r
Map<String, String> tokens = (Map<String, String>)(result.getData().get(0));\r
mAuthToken = tokens.get(OAuth2Constants.KEY_ACCESS_TOKEN);\r
Log_OC.d(TAG, "Got ACCESS TOKEN: " + mAuthToken);\r
- \r
- accessRootFolderRemoteOperation("", "");\r
+\r
+ /// validate token accessing to root folder / getting session\r
+ OwnCloudCredentials credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);\r
+ accessRootFolder(credentials);\r
\r
} else {\r
updateAuthStatusIconAndText(result);\r
* Processes the result of the access check performed to try the user credentials.\r
* \r
* Creates a new account through the AccountManager.\r
- * \r
- * @param operation Access check performed.\r
+ *\r
* @param result Result of the operation.\r
*/\r
- private void onAuthorizationCheckFinish(RemoteOperationResult result) {\r
+ @Override\r
+ public void onAuthenticatorTaskCallback(RemoteOperationResult result) {\r
mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
\r
success = createAccount();\r
\r
} else {\r
- updateToken();\r
- success = true;\r
+ try {\r
+ updateAccountAuthentication();\r
+ success = true;\r
+\r
+ } catch (AccountNotFoundException e) {\r
+ Log_OC.e(TAG, "Account " + mAccount + " was removed!", e);\r
+ Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show();\r
+ finish();\r
+ }\r
}\r
\r
if (success) {\r
finish();\r
}\r
\r
- } else if (result.isServerFail() || result.isException()) {
+ } else if (result.isServerFail() || result.isException()) {\r
/// server errors or exceptions in authorization take to requiring a new check of \r
/// the server\r
mServerIsChecked = true;\r
\r
\r
/**\r
- * Sets the proper response to get that the Account Authenticator that started this activity \r
+ * Updates the authentication token.\r
+ *\r
+ * Sets the proper response so that the AccountAuthenticator that started this activity\r
* saves a new authorization token for mAccount.\r
+ *\r
+ * Kills the session kept by OwnCloudClientManager so that a new one will created with\r
+ * the new credentials when needed.\r
*/\r
- private void updateToken() {\r
+ private void updateAccountAuthentication() throws AccountNotFoundException {\r
+ \r
Bundle response = new Bundle();\r
response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);\r
response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type);\r
final Intent intent = new Intent(); \r
intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, MainApp.getAccountType());\r
intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, mAccount.name);\r
- /*if (!isOAuth)\r
- intent.putExtra(AccountManager.KEY_AUTHTOKEN, MainApp.getAccountType()); */\r
intent.putExtra(AccountManager.KEY_USERDATA, username);\r
if (isOAuth || isSaml) {\r
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);\r
}\r
/// add user data to the new account; TODO probably can be done in the last parameter \r
- // addAccountExplicitly, or in KEY_USERDATA
+ // addAccountExplicitly, or in KEY_USERDATA\r
mAccountMgr.setUserData(\r
mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion()\r
);\r
mAccountMgr.setUserData(\r
mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl\r
);\r
-
+\r
if (isSaml) {\r
mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE"); \r
} else if (isOAuth) {\r
/**\r
* Updates the content and visibility state of the icon and text associated\r
* to the last check on the ownCloud server.\r
- * \r
- * @param serverStatusText Resource identifier of the text to show.\r
- * @param serverStatusIcon Resource identifier of the icon to show.\r
+ *\r
*/\r
private void showServerStatus() {\r
if (mServerStatusIcon == 0 && mServerStatusText == 0) {\r
public void onCheckClick(View view) {\r
CheckBox oAuth2Check = (CheckBox)view;\r
if (oAuth2Check.isChecked()) {\r
- mAuthTokenType = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType());\r
+ mAuthTokenType = OAUTH_TOKEN_TYPE;\r
} else {\r
- mAuthTokenType = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType());\r
+ mAuthTokenType = BASIC_TOKEN_TYPE;\r
}\r
updateAuthenticationPreFragmentVisibility();\r
}\r
getUserNameIntent.putExtra(OperationsService.EXTRA_COOKIE, sessionCookie);\r
\r
if (mOperationsServiceBinder != null) {\r
- //Log_OC.wtf(TAG, "starting getRemoteUserNameOperation..." );\r
mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getUserNameIntent);\r
}\r
}\r
if (component.equals(\r
new ComponentName(AuthenticatorActivity.this, OperationsService.class)\r
)) {\r
- //Log_OC.wtf(TAG, "Operations service connected");\r
mOperationsServiceBinder = (OperationsServiceBinder) service;\r
\r
doOnResumeAndBound();\r
public void doNegativeAuthenticatioDialogClick(){\r
mIsFirstAuthAttempt = true;\r
}\r
+\r
+\r
}\r
--- /dev/null
+/* ownCloud Android client application
+ * Copyright (C) 2012-2015 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package com.owncloud.android.authentication;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.Uri;
+import android.os.AsyncTask;
+
+import com.owncloud.android.lib.common.OwnCloudClient;
+import com.owncloud.android.lib.common.OwnCloudClientFactory;
+import com.owncloud.android.lib.common.OwnCloudCredentials;
+import com.owncloud.android.lib.common.operations.RemoteOperationResult;
+import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
+
+import java.lang.ref.WeakReference;
+
+
+/**
+ * Async Task to verify the credentials of a user
+ *
+ * @author masensio on 09/02/2015.
+ */
+public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOperationResult> {
+
+ private static String REMOTE_PATH = "/";
+ private static boolean SUCCESS_IF_ABSENT = false;
+
+ private Context mContext;
+ private final WeakReference<OnAuthenticatorTaskListener> mListener;
+ protected Activity mActivity;
+
+ public AuthenticatorAsyncTask(Activity activity) {
+ mContext = activity.getApplicationContext();
+ mListener = new WeakReference<OnAuthenticatorTaskListener>((OnAuthenticatorTaskListener)activity);
+ }
+
+ @Override
+ protected RemoteOperationResult doInBackground(Object... params) {
+
+ RemoteOperationResult result;
+ if (params!= null && params.length==2) {
+ String url = (String)params[0];
+ OwnCloudCredentials credentials = (OwnCloudCredentials)params[1];
+
+ // Client
+ Uri uri = Uri.parse(url);
+ OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true);
+
+ client.setCredentials(credentials);
+
+ // Operation
+ ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(
+ REMOTE_PATH,
+ mContext,
+ SUCCESS_IF_ABSENT
+ );
+ result = operation.execute(client);
+
+ } else {
+ result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void onPostExecute(RemoteOperationResult result) {
+
+ if (result!= null)
+ {
+ OnAuthenticatorTaskListener listener = mListener.get();
+ if (listener!= null)
+ {
+ listener.onAuthenticatorTaskCallback(result);
+ }
+ }
+ }
+ /*
+ * Interface to retrieve data from recognition task
+ */
+ public interface OnAuthenticatorTaskListener{
+
+ void onAuthenticatorTaskCallback(RemoteOperationResult result);
+ }
+}
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
-import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.users.GetRemoteUserNameOperation;
import com.owncloud.android.operations.common.SyncOperation;
public static final String EXTRA_NEW_PARENT_PATH = "NEW_PARENT_PATH";
public static final String EXTRA_FILE = "FILE";
- // TODO review if ALL OF THEM are necessary
- 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_COOKIE = "COOKIE";
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_GET_USER_NAME = "GET_USER_NAME";
public static final String ACTION_RENAME = "RENAME";
public static final String ACTION_REMOVE = "REMOVE";
public static final String ACTION_CREATE_FOLDER = "CREATE_FOLDER";
public static final String ACTION_SYNC_FILE = "SYNC_FILE";
public static final String ACTION_SYNC_FOLDER = "SYNC_FOLDER"; // for the moment, just to download
- //public static final String ACTION_CANCEL_SYNC_FOLDER = "CANCEL_SYNC_FOLDER"; // for the moment, just to download
public static final String ACTION_MOVE_FILE = "MOVE_FILE";
public static final String ACTION_OPERATION_ADDED = OperationsService.class.getName() + ".OPERATION_ADDED";
private static class Target {
public Uri mServerUrl = null;
public Account mAccount = null;
- public String mUsername = null;
- public String mPassword = null;
- public String mAuthToken = null;
public String mCookie = null;
- public Target(Account account, Uri serverUrl, String username, String password, String authToken,
- String cookie) {
+ public Target(Account account, Uri serverUrl, String cookie) {
mAccount = account;
mServerUrl = serverUrl;
- mUsername = username;
- mPassword = password;
- mAuthToken = authToken;
mCookie = cookie;
}
}
*/
@Override
public boolean onUnbind(Intent intent) {
- ((OperationsServiceBinder)mOperationsBinder).clearListeners();
+ mOperationsBinder.clearListeners();
return false; // not accepting rebinding (default behaviour)
}
);
} else {
OwnCloudCredentials credentials = null;
- if (mLastTarget.mUsername != null &&
- mLastTarget.mUsername.length() > 0) {
- credentials = OwnCloudCredentialsFactory.newBasicCredentials(
- mLastTarget.mUsername,
- mLastTarget.mPassword); // basic
-
- } else if (mLastTarget.mAuthToken != null &&
- mLastTarget.mAuthToken.length() > 0) {
- credentials = OwnCloudCredentialsFactory.newBearerCredentials(
- mLastTarget.mAuthToken); // bearer token
-
- } else if (mLastTarget.mCookie != null &&
+ if (mLastTarget.mCookie != null &&
mLastTarget.mCookie.length() > 0) {
+ // just used for GetUserName
+ // TODO refactor to run GetUserName as AsyncTask in the context of AuthenticatorActivity
credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials(
mLastTarget.mCookie); // SAML SSO
}
}
//sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result);
- mService.dispatchResultToOperationListeners(mLastTarget, mCurrentOperation, result);
+ mService.dispatchResultToOperationListeners(mCurrentOperation, result);
}
}
} else {
Account account = operationIntent.getParcelableExtra(EXTRA_ACCOUNT);
String serverUrl = operationIntent.getStringExtra(EXTRA_SERVER_URL);
- String username = operationIntent.getStringExtra(EXTRA_USERNAME);
- String password = operationIntent.getStringExtra(EXTRA_PASSWORD);
- String authToken = operationIntent.getStringExtra(EXTRA_AUTH_TOKEN);
String cookie = operationIntent.getStringExtra(EXTRA_COOKIE);
target = new Target(
account,
(serverUrl == null) ? null : Uri.parse(serverUrl),
- username,
- password,
- authToken,
cookie
);
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, false);
- operation = new ExistenceCheckRemoteOperation(remotePath, OperationsService.this, successIfAbsent);
-
} else if (action.equals(ACTION_GET_USER_NAME)) {
// Get User Name
operation = new GetRemoteUserNameOperation();
/**
* Notifies the currently subscribed listeners about the end of an operation.
*
- * @param target Account or URL pointing to an OC server.
* @param operation Finished operation.
* @param result Result of the operation.
*/
protected void dispatchResultToOperationListeners(
- Target target, final RemoteOperation operation, final RemoteOperationResult result) {
+ final RemoteOperation operation, final RemoteOperationResult result
+ ) {
int count = 0;
Iterator<OnRemoteOperationListener> listeners = mOperationsBinder.mBoundListeners.keySet().iterator();
while (listeners.hasNext()) {
} finally {
mPendingOperations.removePayload(account, remotePath);
- mService.dispatchResultToOperationListeners(null, mCurrentSyncOperation, result);
+ mService.dispatchResultToOperationListeners(mCurrentSyncOperation, result);
sendBroadcastFinishedSyncFolder(account, remotePath, result.isSuccess());
}
(synchResult.isException() && synchResult.getException()
instanceof AuthenticatorException))) {
- OwnCloudClient client = null;
+
try {
- OwnCloudAccount ocAccount =
+ OwnCloudClient client;
+ OwnCloudAccount ocAccount =
new OwnCloudAccount(getAccount(), context);
client = (OwnCloudClientManagerFactory.getDefaultSingleton().
removeClientFor(ocAccount));
- // TODO get rid of these exceptions
- } catch (AccountNotFoundException e) {
- e.printStackTrace();
- } catch (AuthenticatorException e) {
- e.printStackTrace();
- } catch (OperationCanceledException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (client != null) {
- OwnCloudCredentials cred = client.getCredentials();
- if (cred != null) {
- AccountManager am = AccountManager.get(context);
- if (cred.authTokenExpires()) {
- am.invalidateAuthToken(
- getAccount().type,
- cred.getAuthToken()
- );
- } else {
- am.clearPassword(getAccount());
+
+ if (client != null) {
+ OwnCloudCredentials cred = client.getCredentials();
+ if (cred != null) {
+ AccountManager am = AccountManager.get(context);
+ if (cred.authTokenExpires()) {
+ am.invalidateAuthToken(
+ getAccount().type,
+ cred.getAuthToken()
+ );
+ } else {
+ am.clearPassword(getAccount());
+ }
}
}
+ requestCredentialsUpdate();
+
+ } catch (AccountNotFoundException e) {
+ Log_OC.e(TAG, "Account " + getAccount() + " was removed!", e);
}
-
- requestCredentialsUpdate();
-
+
}
}
removeStickyBroadcast(intent);
(synchResult.isException() && synchResult.getException()
instanceof AuthenticatorException))) {
- OwnCloudClient client = null;
try {
- OwnCloudAccount ocAccount =
+ OwnCloudClient client;
+ OwnCloudAccount ocAccount =
new OwnCloudAccount(getAccount(), context);
client = (OwnCloudClientManagerFactory.getDefaultSingleton().
removeClientFor(ocAccount));
- // TODO get rid of these exceptions
- } catch (AccountNotFoundException e) {
- e.printStackTrace();
- } catch (AuthenticatorException e) {
- e.printStackTrace();
- } catch (OperationCanceledException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- if (client != null) {
- OwnCloudCredentials cred = client.getCredentials();
- if (cred != null) {
- AccountManager am = AccountManager.get(context);
- if (cred.authTokenExpires()) {
- am.invalidateAuthToken(
- getAccount().type,
- cred.getAuthToken()
- );
- } else {
- am.clearPassword(getAccount());
+
+ if (client != null) {
+ OwnCloudCredentials cred = client.getCredentials();
+ if (cred != null) {
+ AccountManager am = AccountManager.get(context);
+ if (cred.authTokenExpires()) {
+ am.invalidateAuthToken(
+ getAccount().type,
+ cred.getAuthToken()
+ );
+ } else {
+ am.clearPassword(getAccount());
+ }
}
}
+ requestCredentialsUpdate();
+
+ } catch (AccountNotFoundException e) {
+ Log_OC.e(TAG, "Account " + getAccount() + " was removed!", e);
}
-
- requestCredentialsUpdate();
-
+
}
}
removeStickyBroadcast(intent);