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

Commit 845002e8 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Add missing accessToken field for DavResource constructor

parent 52ffb04c
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ class DavResourceFinder(
    fun queryEmailAddress(principal: HttpUrl): List<String> {
        val mailboxes = LinkedList<String>()
        try {
            DavResource(httpClient.okHttpClient, principal, null, log).propfind(0, CalendarUserAddressSet.NAME) { response, _ ->
            DavResource(httpClient.okHttpClient, principal, loginModel.credentials?.authState?.accessToken, log).propfind(0, CalendarUserAddressSet.NAME) { response, _ ->
                response[CalendarUserAddressSet::class.java]?.let { addressSet ->
                    for (href in addressSet.hrefs)
                        try {
+6 −1
Original line number Diff line number Diff line
@@ -321,7 +321,12 @@ class RefreshCollectionsWorker @AssistedInject constructor(
                                // this collection doesn't belong to a homeset anymore, otherwise it would have been confirmed
                                info.homeSetId = null

                                DavResource(httpClient, url).propfind(0, *DAV_COLLECTION_PROPERTIES) { response, _ ->
                                var accessToken : String? = null
                                service.authState?.let {
                                    accessToken = AuthState.jsonDeserialize(it).accessToken
                                }

                                DavResource(httpClient, url, accessToken).propfind(0, *DAV_COLLECTION_PROPERTIES) { response, _ ->
                                    if (!response.isSuccess())
                                        return@propfind

+3 −2
Original line number Diff line number Diff line
@@ -133,11 +133,12 @@ class CreateCollectionFragment: DialogFragment() {

        fun createCollection(): LiveData<Exception> {
            viewModelScope.launch(Dispatchers.IO + NonCancellable) {
                HttpClient.Builder(context, AccountSettings(context, account))
                val accountSettings = AccountSettings(context, account)
                HttpClient.Builder(context, accountSettings)
                        .setForeground(true)
                        .build().use { httpClient ->
                    try {
                        val dav = DavResource(httpClient.okHttpClient, collection.url)
                        val dav = DavResource(httpClient.okHttpClient, collection.url, accountSettings.credentials().authState?.accessToken)

                        // create collection on remote server
                        dav.mkCol(generateXml()) {}
+4 −2
Original line number Diff line number Diff line
@@ -114,11 +114,13 @@ class DeleteCollectionFragment: DialogFragment() {
            viewModelScope.launch(Dispatchers.IO + NonCancellable) {
                val collectionInfo = collectionInfo ?: return@launch

                HttpClient.Builder(context, AccountSettings(context, account))
                val accountSettings = AccountSettings(context, account)

                HttpClient.Builder(context, accountSettings)
                        .setForeground(true)
                        .build().use { httpClient ->
                            try {
                                val collection = DavResource(httpClient.okHttpClient, collectionInfo.url)
                                val collection = DavResource(httpClient.okHttpClient, collectionInfo.url, accountSettings.credentials().authState?.accessToken)

                                // delete collection from server
                                collection.delete(null) {}
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ class AddWebdavMountActivity: AppCompatActivity() {
        fun hasWebDav(mount: WebDavMount, credentials: Credentials?): Boolean {
            var supported = false
            HttpClient.Builder(context, null, credentials).build().use { client ->
                val dav = DavResource(client.okHttpClient, mount.url)
                val dav = DavResource(client.okHttpClient, mount.url, credentials?.authState?.accessToken)
                dav.options { davCapabilities, _ ->
                    if (CollectionUtils.containsAny(davCapabilities, "1", "2", "3"))
                        supported = true
Loading