@@ -10,25 +10,30 @@ class CrossProfileIntentFilterRepository(val dbHelper: MyDbHelper) {
1010 cv.put(" category" , data.category)
1111 cv.put(" mime_type" , data.mimeType)
1212 cv.put(" direction" , data.direction)
13- cv.put(" time " , System .currentTimeMillis())
14- dbHelper.writableDatabase.insert(" cpif " , null , cv)
13+ cv.put(" created_at " , System .currentTimeMillis())
14+ dbHelper.writableDatabase.insert(" cpif2 " , null , cv)
1515 }
1616
17- fun getAllCrossProfileIntentFilters (): List <IntentFilterOptions > {
18- val list = mutableListOf<IntentFilterOptions >()
17+ fun getAllFilters (): List <IntentFilterEntry > {
18+ val list = mutableListOf<IntentFilterEntry >()
1919 dbHelper.readableDatabase.rawQuery(
20- " SELECT * FROM cpif ORDER BY time DESC" , null
20+ " SELECT * FROM cpif2 ORDER BY created_at DESC" , null
2121 ).use {
2222 while (it.moveToNext()) {
23- list + = IntentFilterOptions (
24- it.getString(0 ), it.getString(1 ), it.getString(2 ), it.getInt(3 )
23+ val options = IntentFilterOptions (
24+ it.getString(1 ), it.getString(2 ), it.getString(3 ), it.getInt(4 )
2525 )
26+ list + = IntentFilterEntry (it.getInt(0 ), options, it.getLong(5 ))
2627 }
2728 }
2829 return list
2930 }
3031
32+ fun deleteById (id : Int ) {
33+ dbHelper.writableDatabase.delete(" cpif2" , " id = ?" , arrayOf(" $id " ))
34+ }
35+
3136 fun deleteAllCrossProfileIntentFilters () {
32- dbHelper.writableDatabase.delete(" cpif " , null , null )
37+ dbHelper.writableDatabase.delete(" cpif2 " , null , null )
3338 }
3439}
0 commit comments