mirror of
				https://github.com/SimpleMobileTools/Simple-Calendar.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	moving getCalDAVCalendarEvents to Room
This commit is contained in:
		@@ -356,8 +356,7 @@ class CalDAVHandler(val context: Context) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun deleteCalDAVCalendarEvents(calendarId: Long) {
 | 
			
		||||
        val events = context.dbHelper.getCalDAVCalendarEvents(calendarId)
 | 
			
		||||
        val eventIds = events.mapNotNull { it.id }.toMutableList()
 | 
			
		||||
        val eventIds = context.eventsDB.getCalDAVCalendarEvents("$CALDAV-$calendarId").toMutableList()
 | 
			
		||||
        EventsHelper(context).deleteEvents(eventIds, false)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -90,13 +90,6 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun getCalDAVCalendarEvents(calendarId: Long): List<Event> {
 | 
			
		||||
        val selection = "$MAIN_TABLE_NAME.$COL_EVENT_SOURCE = (?)"
 | 
			
		||||
        val selectionArgs = arrayOf("$CALDAV-$calendarId")
 | 
			
		||||
        val cursor = getEventsCursor(selection, selectionArgs)
 | 
			
		||||
        return fillEvents(cursor).filter { it.importId.isNotEmpty() }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun addEventRepeatException(parentEventId: Long, occurrenceTS: Int, addToCalDAV: Boolean, childImportId: String? = null) {
 | 
			
		||||
        fillExceptionValues(parentEventId, occurrenceTS, addToCalDAV, childImportId) {
 | 
			
		||||
            context.eventRepetitionExceptionsDB.insert(it)
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,9 @@ interface EventsDao {
 | 
			
		||||
    @Query("SELECT * FROM events WHERE import_id != \"\"")
 | 
			
		||||
    fun getEventsWithImportIds(): List<Event>
 | 
			
		||||
 | 
			
		||||
    @Query("SELECT id FROM events WHERE source = :source AND import_id != \"\"")
 | 
			
		||||
    fun getCalDAVCalendarEvents(source: String): List<Long>
 | 
			
		||||
 | 
			
		||||
    @Insert(onConflict = OnConflictStrategy.REPLACE)
 | 
			
		||||
    fun insertOrUpdate(event: Event): Long
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user