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

Commit 9aa59b88 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '3511-main-ose-murena_login2' into 'main-ose'

AM: Allow changing account type

See merge request !169
parents 0d21348c 654d48ef
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -256,16 +256,16 @@ dependencies {
    implementation(libs.commons.codec)
    implementation(libs.commons.lang)

    // e-Specific dependencies - (Avoid moving into toml)
    implementation("foundation.e:elib:0.0.1-alpha11")
    implementation("foundation.e:synctools:58bc6752") {
    // e-Specific dependencies
    implementation(libs.elib)
    implementation(libs.ez.vcard)
    implementation(libs.synctools) {
        exclude(group="androidx.test")
        exclude(group = "junit")
    }
    implementation("org.mnode.ical4j:ical4j:3.2.19") {
    implementation(libs.ical4j) {
        exclude(group = "commons-logging", module = "commons-logging")
    }
    implementation("com.googlecode.ez-vcard:ez-vcard:0.12.1")

    // for tests
    androidTestImplementation(libs.androidx.arch.core.testing)
+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ class LocalAddressBookStoreTest {
        }

        mockkObject(localAddressBookStore)
        every { localAddressBookStore.createAddressBookAccount(any(), any(), any()) } returns null
        every { localAddressBookStore.createAddressBookAccount(any(), any(), any(), any()) } returns null

        assertEquals(null, localAddressBookStore.create(provider, collection))
    }
+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ class SyncerTest {
            throw NotImplementedError()
        }

        override fun updateAccount(oldAccount: Account, newAccount: Account) {
        override fun updateAccount(oldAccount: Account, newAccount: Account, accountType: String) {
            throw NotImplementedError()
        }

+2 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import foundation.e.accountmanager.utils.AccountHelper
import java.io.Writer
import javax.inject.Singleton

@@ -97,7 +98,7 @@ abstract class AppDatabase: RoomDatabase() {

                    // remove all accounts because they're unfortunately useless without database
                    val am = AccountManager.get(context)
                    for (account in am.getAccountsByType(context.getString(R.string.account_type)))
                    for (account in AccountHelper.getAllAccounts(am))
                        am.removeAccountExplicitly(account)
                }
            })
+3 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import at.bitfire.davdroid.sync.SyncDataType
import at.bitfire.davdroid.sync.TasksAppManager
import at.bitfire.davdroid.sync.worker.SyncWorkerManager
import dagger.Lazy
import foundation.e.accountmanager.AccountTypes
import org.unifiedpush.android.connector.data.PushMessage
import org.xmlpull.v1.XmlPullParserException
import java.io.StringReader
@@ -70,7 +71,7 @@ class PushMessageHandler @Inject constructor(
                            syncDataTypes += SyncDataType.TASKS

                    // Schedule sync for all the types identified
                    val account = accountRepository.fromName(service.accountName)
                    val account = accountRepository.fromName(service.accountName, AccountTypes.getAccountTypeFromPrincipal(service.principal))
                    for (syncDataType in syncDataTypes)
                        syncWorkerManager.enqueueOneTime(account, syncDataType, fromPush = true)
                }
@@ -81,7 +82,7 @@ class PushMessageHandler @Inject constructor(
            val service = instance.toLongOrNull()?.let { serviceRepository.getBlocking(it) }
            if (service != null) {
                logger.warning("Got push message without topic and service, syncing all accounts")
                val account = accountRepository.fromName(service.accountName)
                val account = accountRepository.fromName(service.accountName, AccountTypes.getAccountTypeFromPrincipal(service.principal))
                syncWorkerManager.enqueueOneTimeAllAuthorities(account, fromPush = true)

            } else {
Loading