-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebd3aa5
commit 2bd3b33
Showing
10 changed files
with
245 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 2, | ||
"identityHash": "8e39fc3e9e9f41852f6f4800436c7f89", | ||
"entities": [ | ||
{ | ||
"tableName": "room_config", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uuid` TEXT NOT NULL, `enable_video` INTEGER NOT NULL, `enable_audio` INTEGER NOT NULL, PRIMARY KEY(`uuid`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "uuid", | ||
"columnName": "uuid", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "enableVideo", | ||
"columnName": "enable_video", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "enableAudio", | ||
"columnName": "enable_audio", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"uuid" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "record_history", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`roomUuid` TEXT NOT NULL, `resourceId` TEXT NOT NULL, `sid` TEXT NOT NULL, `mode` TEXT NOT NULL, PRIMARY KEY(`resourceId`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "roomUuid", | ||
"columnName": "roomUuid", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "resourceId", | ||
"columnName": "resourceId", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "sid", | ||
"columnName": "sid", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "mode", | ||
"columnName": "mode", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"resourceId" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
} | ||
], | ||
"views": [], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '8e39fc3e9e9f41852f6f4800436c7f89')" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package io.agora.flat.data | ||
|
||
import androidx.room.AutoMigration | ||
import androidx.room.Database | ||
import androidx.room.RoomDatabase | ||
import io.agora.flat.data.dao.RecordHistoryDao | ||
import io.agora.flat.data.dao.RoomConfigDao | ||
import io.agora.flat.data.model.RecordHistory | ||
import io.agora.flat.data.model.RoomConfig | ||
|
||
@Database(entities = [RoomConfig::class], version = 1) | ||
@Database( | ||
entities = [RoomConfig::class, RecordHistory::class], | ||
version = 2, | ||
autoMigrations = [AutoMigration(from = 1, to = 2)] | ||
) | ||
abstract class AppDatabase : RoomDatabase() { | ||
abstract fun roomConfigDao(): RoomConfigDao | ||
|
||
abstract fun recordHistoryDao(): RecordHistoryDao | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/io/agora/flat/data/dao/RecordHistoryDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.agora.flat.data.dao | ||
|
||
import androidx.room.* | ||
import io.agora.flat.data.model.RecordHistory | ||
|
||
@Dao | ||
interface RecordHistoryDao { | ||
@Query("SELECT * FROM record_history") | ||
suspend fun getAll(): List<RecordHistory> | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
suspend fun insert(recordHistory: RecordHistory) | ||
|
||
@Query("SELECT * FROM record_history WHERE roomUuid = :roomUuid") | ||
suspend fun getByRoomUuid(roomUuid: String): List<RecordHistory> | ||
|
||
@Query("SELECT * FROM record_history WHERE resourceId = :resourceId") | ||
suspend fun getByResourceId(resourceId: String): List<RecordHistory> | ||
|
||
@Query("DELETE FROM record_history WHERE roomUuid = :roomUuid") | ||
suspend fun deleteByRoomUuid(roomUuid: String) | ||
|
||
@Query("DELETE FROM record_history WHERE resourceId = :resourceId") | ||
suspend fun deleteByResourceId(resourceId: String) | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/io/agora/flat/data/model/RecordHistory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.agora.flat.data.model | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "record_history") | ||
data class RecordHistory( | ||
val roomUuid: String, | ||
@PrimaryKey | ||
val resourceId: String, | ||
val sid: String, | ||
val mode: AgoraRecordMode = AgoraRecordMode.Mix, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package io.agora.flat.data.model | ||
|
||
data class RecordReq constructor( | ||
data class RecordReq( | ||
val roomUUID: String, | ||
val agoraParams: AgoraRecordParams, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.