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

Commit 5ff86d80 authored by Ricki Hirner's avatar Ricki Hirner
Browse files

Fix crash in account setup

parent 9af246a0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class DavResourceFinderTest {
        server.start()

        val application = InstrumentationRegistry.getInstrumentation().targetContext.applicationContext as Application
        loginModel = LoginModel(application)
        loginModel = LoginModel()
        loginModel.baseURI = URI.create("/")
        loginModel.credentials = Credentials("mock", "12345")

+5 −5
Original line number Diff line number Diff line
@@ -9,19 +9,19 @@ interface CollectionDao {
    @Query("SELECT * FROM collection WHERE id=:id")
    fun get(id: Long): Collection?

    @Query("SELECT * FROM collection WHERE serviceId=:serviceId")
    @Query("SELECT * FROM collection WHERE serviceId=:serviceId ORDER BY displayName, url")
    fun getByService(serviceId: Long): List<Collection>

    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND sync")
    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND sync ORDER BY displayName, url")
    fun getByServiceAndSync(serviceId: Long): List<Collection>

    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND type=:type")
    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND type=:type ORDER BY displayName, url")
    fun observeByServiceAndType(serviceId: Long, type: String): LiveData<List<Collection>>

    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND supportsVEVENT AND sync")
    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND supportsVEVENT AND sync ORDER BY displayName, url")
    fun getSyncCalendars(serviceId: Long): List<Collection>

    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND supportsVTODO AND sync")
    @Query("SELECT * FROM collection WHERE serviceId=:serviceId AND supportsVTODO AND sync ORDER BY displayName, url")
    fun getSyncTaskLists(serviceId: Long): List<Collection>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ class AccountDetailsFragment: Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        val v = LoginAccountDetailsBinding.inflate(inflater, container, false)
        v.lifecycleOwner = this
        v.lifecycleOwner = viewLifecycleOwner
        v.details = model

        val config = loginModel.configuration ?: throw IllegalStateException()
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ class DefaultLoginCredentialsFragment: Fragment() {
        loginModel = ViewModelProviders.of(requireActivity()).get(LoginModel::class.java)

        val v = LoginCredentialsFragmentBinding.inflate(inflater, container, false)
        v.lifecycleOwner = this
        v.lifecycleOwner = viewLifecycleOwner
        v.model = model

        // initialize model on first call
+3 −2
Original line number Diff line number Diff line
package at.bitfire.davdroid.ui.setup

import android.content.Intent
import androidx.annotation.MainThread
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

@@ -29,9 +30,11 @@ class DefaultLoginCredentialsModel: ViewModel() {
        loginWithEmailAddress.value = true
    }

    @MainThread
    fun initialize(intent: Intent) {
        if (initialized)
            return
        initialized = true

        // we've got initial login data
        val givenUrl = intent.getStringExtra(LoginActivity.EXTRA_URL)
@@ -46,8 +49,6 @@ class DefaultLoginCredentialsModel: ViewModel() {
            username.value = givenUsername
        }
        password.value = givenPassword

        initialized = true
    }

}
 No newline at end of file
Loading