Add dao methods to reset drawer orders

pull/1020/head
Alex Baker 4 years ago
parent a49d2d3524
commit f6737cb002

@ -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 {

@ -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<CaldavTaskContainer>
@Query("UPDATE caldav_lists SET cdl_order = $NO_ORDER")
abstract fun resetOrders()
fun setupLocalAccount(context: Context): CaldavAccount {
val account = getLocalAccount()
getLocalList(context, account)

@ -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<Filter>
@Query("UPDATE filters SET f_order = $NO_ORDER")
fun resetOrders()
}

@ -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<GoogleTaskFilters>
@Query("UPDATE google_task_lists SET gtl_remote_order = $NO_ORDER")
fun resetOrders()
}

@ -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<LocationFilters>
@Query("UPDATE places SET place_order = $NO_ORDER")
fun resetOrders()
}

@ -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<TagFilters>
@Query("UPDATE tagdata SET td_order = $NO_ORDER")
abstract fun resetOrders()
}
Loading…
Cancel
Save