Commit f13d96a8 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Ignore staged rules which already exist as user rules

parent fff528c4
......@@ -54,7 +54,7 @@ interface DnsRuleDao {
@Query("DELETE FROM DnsRule WHERE stagingType=2")
fun deleteStagedRules()
@Query("UPDATE DnsRule SET stagingType=0")
@Query("UPDATE OR IGNORE DnsRule SET stagingType=0")
fun commitStaging()
@Insert
......
......@@ -210,16 +210,15 @@ class RuleImportService : IntentService("RuleImportService") {
dnsRuleDao.deleteMarkedRules()
log("Commiting staging")
dnsRuleDao.commitStaging()
dnsRuleDao.deleteStagedRules()
log("Recreating database indices")
getDatabase().recreateDnsRuleIndizes()
log("Done.")
showSuccessNotification()
} else {
GlobalScope.launch {
dnsRuleDao.deleteStagedRules()
dnsRuleDao.commitStaging()
sendLocalBroadcast(Intent(BROADCAST_IMPORT_DONE))
}
dnsRuleDao.deleteStagedRules()
dnsRuleDao.commitStaging()
sendLocalBroadcast(Intent(BROADCAST_IMPORT_DONE))
stopForeground(true)
}
log("All imports finished.")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment