Fix: read instances with null projection for provider-version robustness
All checks were successful
CI / ci (push) Successful in 5m16s
All checks were successful
CI / ci (push) Successful in 5m16s
On-device smoke test (tasks.org, which bundles an older OpenTasks provider) hit SQLITE_ERROR 'no such column: is_recurring' — that column and distance_from_current don't exist in every provider version. Query all columns (projection=null) and let the by-name mapper read what's present (absent -> null); the repository re-sorts, so no provider sort column is needed either. Verified live: reads the real tasks.org/DAVx5 provider (1 list, 0 open tasks) with zero errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -71,7 +71,12 @@ class AndroidTasksDataSource @Inject constructor(
|
||||
|
||||
private fun queryInstances(selection: String?, args: Array<String>?): List<Task> {
|
||||
val uri = TasksContract.instancesUri(authority())
|
||||
return resolver.query(uri, TaskProjections.INSTANCES, selection, args, Instances.INSTANCE_DUE_SORTING)
|
||||
// projection = null (all columns): the instances view differs across
|
||||
// provider versions (e.g. tasks.org's bundled OpenTasks has no
|
||||
// `is_recurring` / `distance_from_current`). The by-name mapper reads
|
||||
// whatever is present and nulls the rest; the repository re-sorts, so we
|
||||
// don't depend on a provider sort column either.
|
||||
return resolver.query(uri, null, selection, args, null)
|
||||
?.use { c ->
|
||||
val reader = CursorColumnReader(c)
|
||||
buildList { while (c.moveToNext()) add(TaskMapper.task(reader)) }
|
||||
|
||||
Reference in New Issue
Block a user