diff --git a/app/src/main/java/com/todoroo/astrid/service/Upgrader.kt b/app/src/main/java/com/todoroo/astrid/service/Upgrader.kt index ee970794d..c34f4ee47 100644 --- a/app/src/main/java/com/todoroo/astrid/service/Upgrader.kt +++ b/app/src/main/java/com/todoroo/astrid/service/Upgrader.kt @@ -65,6 +65,7 @@ class Upgrader @Inject constructor( preferences.setBoolean(R.string.p_astrid_sort_enabled, true) taskMover.migrateLocalTasks() } + run(from, V9_7) { googleTaskListDao.resetOrders() } preferences.setBoolean(R.string.p_just_updated, true) } preferences.setCurrentVersion(to) @@ -307,6 +308,7 @@ class Upgrader @Inject constructor( private const val V8_10 = 735 private const val V9_3 = 90300 const val V9_6 = 90600 + const val V9_7 = 90700 @JvmStatic fun getAndroidColor(context: Context, index: Int): Int { diff --git a/app/src/main/java/org/tasks/data/CaldavDao.kt b/app/src/main/java/org/tasks/data/CaldavDao.kt index cfa39a63f..ef25c03f8 100644 --- a/app/src/main/java/org/tasks/data/CaldavDao.kt +++ b/app/src/main/java/org/tasks/data/CaldavDao.kt @@ -4,6 +4,7 @@ import android.content.Context import androidx.lifecycle.LiveData import androidx.room.* import com.todoroo.andlib.utility.DateUtilities.now +import com.todoroo.astrid.api.FilterListItem.NO_ORDER import com.todoroo.astrid.core.SortHelper.APPLE_EPOCH import com.todoroo.astrid.data.Task import com.todoroo.astrid.helper.UUIDHelper @@ -244,6 +245,9 @@ abstract class CaldavDao { @Query("SELECT task.*, caldav_task.*, IFNULL(cd_order, (created - $APPLE_EPOCH) / 1000) AS primary_sort FROM caldav_tasks AS caldav_task INNER JOIN tasks AS task ON _id = cd_task WHERE cd_calendar = :calendar AND parent = :parent AND cd_deleted = 0 AND deleted = 0 AND primary_sort >= :from AND primary_sort < IFNULL(:to, ${Long.MAX_VALUE}) ORDER BY primary_sort") internal abstract fun getTasksToShift(calendar: String, parent: Long, from: Long, to: Long?): List + @Query("UPDATE caldav_lists SET cdl_order = $NO_ORDER") + abstract fun resetOrders() + fun setupLocalAccount(context: Context): CaldavAccount { val account = getLocalAccount() getLocalList(context, account) diff --git a/app/src/main/java/org/tasks/data/FilterDao.kt b/app/src/main/java/org/tasks/data/FilterDao.kt index 10ef4a475..b99feea24 100644 --- a/app/src/main/java/org/tasks/data/FilterDao.kt +++ b/app/src/main/java/org/tasks/data/FilterDao.kt @@ -4,6 +4,7 @@ import androidx.room.Dao import androidx.room.Insert import androidx.room.Query import androidx.room.Update +import com.todoroo.astrid.api.FilterListItem.NO_ORDER @Dao interface FilterDao { @@ -27,4 +28,7 @@ interface FilterDao { @Query("SELECT * FROM filters") fun getAll(): List + + @Query("UPDATE filters SET f_order = $NO_ORDER") + fun resetOrders() } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/GoogleTaskListDao.kt b/app/src/main/java/org/tasks/data/GoogleTaskListDao.kt index 779e77662..ec5586b2d 100644 --- a/app/src/main/java/org/tasks/data/GoogleTaskListDao.kt +++ b/app/src/main/java/org/tasks/data/GoogleTaskListDao.kt @@ -2,6 +2,7 @@ package org.tasks.data import androidx.lifecycle.LiveData import androidx.room.* +import com.todoroo.astrid.api.FilterListItem.NO_ORDER import io.reactivex.Single import org.tasks.filters.GoogleTaskFilters import org.tasks.time.DateTimeUtils.currentTimeMillis @@ -63,4 +64,7 @@ interface GoogleTaskListDao { + " WHERE google_task_lists.gtl_account = :account" + " GROUP BY google_task_lists.gtl_remote_id") fun getGoogleTaskFilters(account: String, now: Long = currentTimeMillis()): List + + @Query("UPDATE google_task_lists SET gtl_remote_order = $NO_ORDER") + fun resetOrders() } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/LocationDao.kt b/app/src/main/java/org/tasks/data/LocationDao.kt index 84bbad1bc..fc5ad5c24 100644 --- a/app/src/main/java/org/tasks/data/LocationDao.kt +++ b/app/src/main/java/org/tasks/data/LocationDao.kt @@ -2,6 +2,7 @@ package org.tasks.data import androidx.lifecycle.LiveData import androidx.room.* +import com.todoroo.astrid.api.FilterListItem.NO_ORDER import io.reactivex.Single import org.tasks.filters.LocationFilters import org.tasks.time.DateTimeUtils.currentTimeMillis @@ -109,4 +110,7 @@ interface LocationDao { + " GROUP BY places.uid" + " ORDER BY name COLLATE NOCASE ASC") fun getPlaceFilters(now: Long = currentTimeMillis()): List + + @Query("UPDATE places SET place_order = $NO_ORDER") + fun resetOrders() } \ No newline at end of file diff --git a/app/src/main/java/org/tasks/data/TagDataDao.kt b/app/src/main/java/org/tasks/data/TagDataDao.kt index 2708793b2..965521235 100644 --- a/app/src/main/java/org/tasks/data/TagDataDao.kt +++ b/app/src/main/java/org/tasks/data/TagDataDao.kt @@ -3,6 +3,7 @@ package org.tasks.data import androidx.core.util.Pair import androidx.lifecycle.LiveData import androidx.room.* +import com.todoroo.astrid.api.FilterListItem.NO_ORDER import com.todoroo.astrid.data.Task import com.todoroo.astrid.helper.UUIDHelper import org.tasks.db.DbUtils @@ -148,4 +149,7 @@ abstract class TagDataDao { + " WHERE tagdata.name IS NOT NULL AND tagdata.name != ''" + " GROUP BY tagdata.remoteId") abstract fun getTagFilters(now: Long = currentTimeMillis()): List + + @Query("UPDATE tagdata SET td_order = $NO_ORDER") + abstract fun resetOrders() } \ No newline at end of file