Delete history when deleting an application

This commit is contained in:
greenart7c3
2025-06-13 12:46:50 -03:00
parent a90bf1d083
commit a462021cb6
3 changed files with 5 additions and 0 deletions
@@ -169,6 +169,9 @@ interface ApplicationDao {
@Query("SELECT * FROM history2 ORDER BY time DESC")
fun getAllHistory(): Flow<List<HistoryEntity2>>
@Query("DELETE FROM history2 where pkKey = :pk")
suspend fun deleteHistory(pk: String)
@Insert
@Transaction
suspend fun insertLog(logEntity: LogEntity)
@@ -467,6 +467,7 @@ object BunkerRequestUtils {
if (oldKey.isNotBlank()) {
database.applicationDao().delete(oldKey)
database.applicationDao().deleteHistory(oldKey)
}
var savedApplication = database.applicationDao().getByKey(key)
@@ -320,6 +320,7 @@ fun EditConfigurationScreen(
application?.let {
scope.launch(Dispatchers.IO) {
Amber.instance.getDatabase(account.npub).applicationDao().delete(it.application)
Amber.instance.getDatabase(account.npub).applicationDao().deleteHistory(it.application.key)
Amber.instance.checkForNewRelays()