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

Unverified Commit 93c510c7 authored by Patrick Lang's avatar Patrick Lang Committed by GitHub
Browse files

New function to query a jtxIcalObject by UID (#23)

* New function to query a jtxIalObject by UID

https://gitlab.com/techbeeat1/jtx/-/issues/47

* Update test-dev.yml
parent 6c2cb6dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ jobs:
          mkdir apk && cd apk
          wget -q -O org.dmfs.tasks.apk https://f-droid.org/archive/org.dmfs.tasks_80800.apk && adb install org.dmfs.tasks.apk
          wget -q -O org.tasks.apk https://f-droid.org/archive/org.tasks_110701.apk && adb install org.tasks.apk
          wget -q -O at.techbee.jtx.apk https://f-droid.org/repo/at.techbee.jtx_100040011.apk && adb install at.techbee.jtx.apk
          wget -q -O at.techbee.jtx.apk https://f-droid.org/repo/at.techbee.jtx_100090001.apk && adb install at.techbee.jtx.apk
          cd ..
      - name: Run connected tests
        run: ./gradlew connectedCheck
+14 −0
Original line number Diff line number Diff line
@@ -124,6 +124,20 @@ open class JtxCollection<out T: JtxICalObject>(val account: Account,
        }
    }

    /**
     * @param [UID] of the entry that should be retrieved as content values
     * @return Content Values of the found item with the given UID or null if the result was empty or more than 1
     */
    fun queryByUID(uid: String): ContentValues? {
        client.query(JtxContract.JtxICalObject.CONTENT_URI.asSyncAdapter(account), null, "${JtxContract.JtxICalObject.ICALOBJECT_COLLECTIONID} = ? AND ${JtxContract.JtxICalObject.UID} = ?", arrayOf(id.toString(), uid), null).use { cursor ->
            Ical4Android.log.fine("queryByUID: found ${cursor?.count} records in ${account.name}")
            if (cursor?.count != 1)
                return null
            cursor.moveToFirst()
            return cursor.toValues()
        }
    }

    /**
     * updates the flags of all entries in the collection with the given flag
     * @param [flags] to be set