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

Unverified Commit d9b4149d authored by Ricki Hirner's avatar Ricki Hirner Committed by GitHub
Browse files

Refactor: replace deprecated getShowOnlyPersonalPair method and simplify...

Refactor: replace deprecated getShowOnlyPersonalPair method and simplify removeAccount logic (#1304)
parent 4af61650
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -206,7 +206,7 @@ class LocalAddressBookStoreTest {
    private fun removeAddressBooks() {
        val accountManager = AccountManager.get(context)
        accountManager.getAccountsByType(addressBookAccountType).forEach {
            accountManager.removeAccount(it, null, null)
            accountManager.removeAccountExplicitly(it)
        }
    }

+0 −16
Original line number Diff line number Diff line
@@ -315,22 +315,6 @@ class AccountSettings @AssistedInject constructor(
        else /* including -1 */ -> false
    }

    /**
     * Whether only personal collections should be shown.
     *
     * @return [Pair] of values:
     *
     *   1. (first) whether only personal collections should be shown
     *   2. (second) whether the user shall be able to change the setting (= setting not locked)
     */
    @Deprecated("Use getShowOnlyPersonal() instead", replaceWith = ReplaceWith("getShowOnlyPersonal()"))
    fun getShowOnlyPersonalPair(): Pair<Boolean, Boolean> =
        when (settingsManager.getIntOrNull(KEY_SHOW_ONLY_PERSONAL)) {
            0 -> Pair(false, false)
            1 -> Pair(true, false)
            else /* including -1 */ -> Pair(accountManager.getUserData(account, KEY_SHOW_ONLY_PERSONAL) != null, true)
        }

    fun setShowOnlyPersonal(showOnlyPersonal: Boolean) {
        accountManager.setAndVerifyUserData(account, KEY_SHOW_ONLY_PERSONAL, if (showOnlyPersonal) "1" else null)
    }