Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 8549bfc5 authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé
Browse files

Add newAccount method to preferences to allow creation with given UUID

parent 61d955f7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -122,7 +122,6 @@ class Preferences internal constructor(
        }
    }

    @OptIn(ExperimentalCoroutinesApi::class)
    override fun getAccountFlow(accountUuid: String): Flow<Account> {
        return callbackFlow {
            val initialAccount = getAccount(accountUuid)
@@ -169,6 +168,10 @@ class Preferences internal constructor(

    fun newAccount(): Account {
        val accountUuid = UUID.randomUUID().toString()
        return newAccount(accountUuid)
    }

    fun newAccount(accountUuid: String): Account {
        val account = Account(accountUuid)
        accountPreferenceSerializer.loadDefaults(account)

+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ class AccountCreator(
    }

    private fun create(account: Account): String {
        val newAccount = preferences.newAccount()
        val newAccount = preferences.newAccount(account.uuid)

        newAccount.email = account.emailAddress