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

Commit 8e8191a8 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

AM: Expose account sync option in settings

- Davx disabled opening account manager this way. Enable it again.
parent bab89d54
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.core.os.bundleOf
import at.bitfire.davdroid.R
import at.bitfire.davdroid.ui.setup.LoginActivity


/**
@@ -34,12 +34,17 @@ class AccountAuthenticatorService: Service() {
        val context: Context
    ): AbstractAccountAuthenticator(context) {

        override fun addAccount(response: AccountAuthenticatorResponse?, accountType: String?, authTokenType: String?, requiredFeatures: Array<String>?, options: Bundle?) =
            bundleOf(
                AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE to response,
                AccountManager.KEY_ERROR_CODE to AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
                AccountManager.KEY_ERROR_MESSAGE to context.getString(R.string.account_prefs_use_app)
            )
        override fun addAccount(
            response: AccountAuthenticatorResponse?,
            accountType: String?,
            authTokenType: String?,
            requiredFeatures: Array<out String>?,
            options: Bundle?
        ): Bundle {
            val intent = Intent(context, LoginActivity::class.java)
            intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response)
            return bundleOf(AccountManager.KEY_INTENT to intent)
        }

        override fun editProperties(response: AccountAuthenticatorResponse?, accountType: String?) = null
        override fun getAuthTokenLabel(p0: String?) = null
+6 −6
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.core.os.bundleOf
import at.bitfire.davdroid.R
import at.bitfire.davdroid.ui.AccountsActivity

class AddressBookAuthenticatorService: Service() {

@@ -30,11 +30,11 @@ class AddressBookAuthenticatorService: Service() {
        val context: Context
    ): AbstractAccountAuthenticator(context) {

        override fun addAccount(response: AccountAuthenticatorResponse?, accountType: String?, authTokenType: String?, requiredFeatures: Array<String>?, options: Bundle?) = bundleOf(
            AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE to response,
            AccountManager.KEY_ERROR_CODE to AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION,
            AccountManager.KEY_ERROR_MESSAGE to context.getString(R.string.account_prefs_use_app)
        )
        override fun addAccount(response: AccountAuthenticatorResponse?, accountType: String?, authTokenType: String?, requiredFeatures: Array<String>?, options: Bundle?): Bundle {
            val intent = Intent(context, AccountsActivity::class.java)
            intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response)
            return bundleOf(AccountManager.KEY_INTENT to intent)
        }

        override fun editProperties(response: AccountAuthenticatorResponse?, accountType: String?) = null
        override fun getAuthTokenLabel(p0: String?) = null
+1 −0
Original line number Diff line number Diff line
@@ -2,4 +2,5 @@
<resources>
    <string name="app_name">Account Manager</string>
    <string name="e_account_list_welcome">Welcome to Account Manager!</string>
    <string name="manage_accounts">Manage accounts</string>
</resources>
+0 −1
Original line number Diff line number Diff line
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="com.android.calendar"
    android:accountType="@string/account_type"
    android:userVisible="false"
    android:supportsUploading="true"
    android:allowParallelSyncs="true"
    android:isAlwaysSyncable="true" />
+0 −1
Original line number Diff line number Diff line
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="com.android.contacts"
    android:accountType="@string/account_type_address_book"
    android:userVisible="false"
    android:supportsUploading="true"
    android:allowParallelSyncs="true"
    android:isAlwaysSyncable="true" />
Loading