Skip to content

Commit

Permalink
Merge pull request #4325 from owncloud/feature/make_automatic_discove…
Browse files Browse the repository at this point in the history
…ry_account

[FEATURE REQUEST] Make automatic discovery of the account
  • Loading branch information
Aitorbp authored Mar 8, 2024
2 parents 28047c7 + 03906fb commit fa1b2a9
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 51 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ownCloud admins and users.
## Summary

* Change - Upgrade minimum SDK version to Android 7.0 (v24): [#4230](https://github.com/owncloud/android/issues/4230)
* Change - Automatic discovery of the account in login: [#4301](https://github.com/owncloud/android/issues/4301)
* Enhancement - New setting for automatic removal of local files: [#4175](https://github.com/owncloud/android/issues/4175)
* Enhancement - Unit tests for repository classes - Part 1: [#4232](https://github.com/owncloud/android/issues/4232)

Expand All @@ -43,6 +44,14 @@ ownCloud admins and users.
https://github.com/owncloud/android/issues/4230
https://github.com/owncloud/android/pull/4299

* Change - Automatic discovery of the account in login: [#4301](https://github.com/owncloud/android/issues/4301)

Automatic account discovery is done at login. Removed the refresh account button
in the Manage Accounts view.

https://github.com/owncloud/android/issues/4301
https://github.com/owncloud/android/pull/4325

* Enhancement - New setting for automatic removal of local files: [#4175](https://github.com/owncloud/android/issues/4175)

A new setting has been created to delete automatically downloaded files, when
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/4325
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: Automatic discovery of the account in login

Automatic account discovery is done at login. Removed the refresh account button in the Manage Accounts view.

https://github.com/owncloud/android/issues/4301
https://github.com/owncloud/android/pull/4325
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ import android.accounts.AccountManager
import android.accounts.AccountManagerCallback
import android.accounts.AccountManagerFuture
import android.accounts.OperationCanceledException
import android.content.ContentResolver
import android.content.Intent
import android.content.SyncRequest
import android.os.Bundle
import android.view.MenuItem
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.owncloud.android.MainApp.Companion.accountType
import com.owncloud.android.MainApp.Companion.authority
import com.owncloud.android.MainApp.Companion.initDependencyInjection
import com.owncloud.android.R
import com.owncloud.android.presentation.accounts.RemoveAccountDialogFragment.Companion.newInstance
Expand Down Expand Up @@ -187,25 +184,6 @@ class AccountsManagementActivity : FileActivity(), AccountsManagementAdapter.Acc
startActivity(updateAccountCredentials)
}

override fun refreshAccount(account: Account) {
Timber.d("Got to start sync")
Timber.d("Requesting sync for " + account.name + " at " + authority + " with new API")
val builder = SyncRequest.Builder()
builder.setSyncAdapter(account, authority)
builder.setExpedited(true)
builder.setManual(true)
builder.syncOnce()

// Fix bug in Android Lollipop when you click on refresh the whole account
val extras = Bundle()
builder.setExtras(extras)

val request = builder.build()
ContentResolver.requestSync(request)

showSnackMessage(getString(R.string.synchronizing_account))
}

override fun createAccount() {
val am = AccountManager.get(applicationContext)
am.addAccount(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* ownCloud Android client application
*
* @author Javier Rodríguez Pérez
* @author Aitor Ballesteros Pavón
*
* Copyright (C) 2022 ownCloud GmbH.
* Copyright (C) 2024 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -99,12 +100,6 @@ class AccountsManagementAdapter(private val accountListener: AccountAdapterListe
holder.binding.ticker.visibility = View.INVISIBLE
}

/// bind listener to refresh account
holder.binding.refreshAccountButton.apply {
setImageResource(R.drawable.ic_action_refresh)
setOnClickListener { accountListener.refreshAccount(account) }
}

/// bind listener to change password
holder.binding.passwordButton.apply {
setImageResource(R.drawable.ic_key)
Expand Down Expand Up @@ -169,7 +164,6 @@ class AccountsManagementAdapter(private val accountListener: AccountAdapterListe
interface AccountAdapterListener {
fun removeAccount(account: Account)
fun changePasswordOfAccount(account: Account)
fun refreshAccount(account: Account)
fun createAccount()
fun switchAccount(position: Int)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class ReleaseNotesViewModel(
subtitle = R.string.release_notes_4_3_0_subtitle_1,
type = ReleaseNoteType.ENHANCEMENT,
),
ReleaseNote(
title = R.string.release_notes_4_3_0_title_2,
subtitle = R.string.release_notes_4_3_0_subtitle_2,
type = ReleaseNoteType.ENHANCEMENT,
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
*
* @author Abel García de Prada
* @author Juan Carlos Garrote Gascón
* @author Aitor Ballesteros Pavón
*
* Copyright (C) 2023 ownCloud GmbH.
* Copyright (C) 2024 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -112,7 +113,7 @@ class AccountDiscoveryWorker(
accountName = folder.owner,
remotePath = folder.remotePath,
spaceId = folder.spaceId,
syncMode = SynchronizeFolderUseCase.SyncFolderMode.REFRESH_FOLDER
syncMode = SynchronizeFolderUseCase.SyncFolderMode.REFRESH_FOLDER_RECURSIVELY
)
)
}
Expand Down
19 changes: 0 additions & 19 deletions owncloudApp/src/main/res/layout/account_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,6 @@
app:layout_constraintStart_toEndOf="@id/ticker"
app:layout_constraintTop_toBottomOf="@id/name" />

<ImageView
android:id="@+id/refreshAccountButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/actionbar_sync"
android:paddingLeft="@dimen/standard_half_padding"
android:paddingTop="@dimen/standard_padding"
android:paddingRight="@dimen/standard_half_padding"
android:paddingBottom="@dimen/standard_padding"
android:src="@drawable/ic_action_refresh"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/passwordButton"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/account"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/black" />

<ImageView
android:id="@+id/passwordButton"
android:layout_width="wrap_content"
Expand Down
2 changes: 2 additions & 0 deletions owncloudApp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@

<string name="release_notes_4_3_0_title_1">New setting to remove automatically downloaded files that were not used for a certain time</string>
<string name="release_notes_4_3_0_subtitle_1">A new setting has been added in "Advanced" section to delete automatically downloaded files, when the time since their last usage exceeds the selected time in the setting</string>
<string name="release_notes_4_3_0_title_2">Automatic discovery of the account in login</string>
<string name="release_notes_4_3_0_subtitle_2">Removed the account refresh button in the Manage Accounts view, as automatic account discovery is done at login</string>

<!-- Open in web -->
<string name="ic_action_open_in_web">Open in web</string>
Expand Down

0 comments on commit fa1b2a9

Please sign in to comment.