Skip to content

Commit

Permalink
AccountSettings: allow test accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc2822 committed Sep 19, 2024
1 parent 6e5b3c5 commit dd4efa1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ class AccountSettings @AssistedInject constructor(

val accountManager: AccountManager = AccountManager.get(context)
init {
val requiredAccountType = context.getString(R.string.account_type)
if (account.type != requiredAccountType)
throw IllegalArgumentException("Invalid account type: ${account.type} (must be $requiredAccountType)")
val allowedAccountTypes = arrayOf(
context.getString(R.string.account_type),
"at.bitfire.davdroid.test" // R.strings.account_type_test in androidTest
)
if (!allowedAccountTypes.contains(account.type))
throw IllegalArgumentException("Invalid account type: ${account.type}")

// synchronize because account migration must only be run one time
synchronized(AccountSettings::class.java) {
Expand Down

0 comments on commit dd4efa1

Please sign in to comment.