Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove concept of main accounts #989

Merged
merged 30 commits into from
Sep 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c86a82
Acquire account settings via address book account
sunkup Aug 20, 2024
b355678
Extract the code to find an address books main account to the account…
sunkup Aug 20, 2024
f9089a9
Use collection id as reference in address book account
sunkup Sep 9, 2024
83c3b1c
Remove obsolete baos
sunkup Sep 14, 2024
d57c43a
Find main account directly from collection in SyncManager
sunkup Sep 14, 2024
8b239a8
Require main account to get account settings
sunkup Sep 14, 2024
c7b1809
Stop deleting address book accounts without a main account, since the…
sunkup Sep 14, 2024
f3c0849
Require content provider and introduce static deleteByCollection method
sunkup Sep 14, 2024
5fd7655
Update KDoc
sunkup Sep 14, 2024
4c596d3
Show all address book accounts separately
sunkup Sep 14, 2024
67d0409
Drop mainAccount method
sunkup Sep 14, 2024
484212c
[DI] Use AssistedInject for LocalAddressBook
rfc2822 Sep 17, 2024
e738203
Merge remote-tracking branch 'origin/main-ose' into 878-remove-concep…
rfc2822 Sep 17, 2024
e32c10c
Renaming, remove "main account" concept
rfc2822 Sep 17, 2024
35332e7
Fix debug info
rfc2822 Sep 17, 2024
ee40f02
AccountsCleanupWorker: Rename main account to account
rfc2822 Sep 17, 2024
ea8617a
Further remove main accounts
rfc2822 Sep 17, 2024
53c4ca1
Reduce redundancy
rfc2822 Sep 17, 2024
6555584
AccountSettings: check account type
rfc2822 Sep 17, 2024
5c31a8a
AccountSettingsMigrations: drop v5 -> v6 migration (not tested anyway)
rfc2822 Sep 17, 2024
866cdf0
AccountRepository: directly delete accounts
rfc2822 Sep 17, 2024
beb201b
Remove obsolete workerAccount
rfc2822 Sep 17, 2024
04b6e35
Get all address books, even if not sync enabled
sunkup Sep 18, 2024
cbb2718
Delete orphan address book accounts
sunkup Sep 18, 2024
6e5b3c5
Rename two more occurrences of main account concept
sunkup Sep 18, 2024
dd4efa1
AccountSettings: allow test accounts
rfc2822 Sep 19, 2024
26d3667
Syncer: rename methods for clarity, add KDoc
rfc2822 Sep 19, 2024
dfd81ff
Drop empty test class
sunkup Sep 19, 2024
3b7fa46
Make code more readable and add comment
sunkup Sep 19, 2024
d7ab51f
Merge branch 'main-ose' into 878-remove-concept-of-main-accounts
rfc2822 Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
AccountsCleanupWorker: Rename main account to account
  • Loading branch information
rfc2822 committed Sep 17, 2024
commit ee40f0266d0bdab81a71b8a56e2b2f38238c3abe
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import androidx.work.WorkerParameters
import at.bitfire.davdroid.R
import at.bitfire.davdroid.db.AppDatabase
import at.bitfire.davdroid.repository.AccountRepository
import at.bitfire.davdroid.repository.DavCollectionRepository
import at.bitfire.davdroid.repository.DavServiceRepository
import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import java.time.Duration
Expand Down Expand Up @@ -71,17 +69,17 @@ class AccountsCleanupWorker @AssistedInject constructor(

// Later, accounts which are not in the DB should be deleted here

val mainAccountType = applicationContext.getString(R.string.account_type)
val mainAccountNames = accounts
.filter { account -> account.type == mainAccountType }
val accountType = applicationContext.getString(R.string.account_type)
val accountNames = accounts
.filter { account -> account.type == accountType }
.map { it.name }

// delete orphaned services in DB
val serviceDao = db.serviceDao()
if (mainAccountNames.isEmpty())
if (accountNames.isEmpty())
serviceDao.deleteAll()
else
serviceDao.deleteExceptAccounts(mainAccountNames.toTypedArray())
serviceDao.deleteExceptAccounts(accountNames.toTypedArray())
}

}
Loading