Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PublicAndroidApps
Nebulo
Commits
2059f3ae
Commit
2059f3ae
authored
Jun 25, 2019
by
Daniel Wolf
Browse files
Only delete user defined rules with the clear button
parent
2579236d
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/smokescreen/activity/DnsRuleActivity.kt
View file @
2059f3ae
...
...
@@ -117,7 +117,7 @@ class DnsRuleActivity : BaseActivity() {
getString
(
R
.
string
.
dialog_clearuserrules_title
),
getString
(
R
.
string
.
dialog_clearuserrules_message
),
getString
(
R
.
string
.
all_yes
)
to
{
dialog
,
_
->
getDatabase
().
dnsRuleRepository
().
deleteAllAsync
()
getDatabase
().
dnsRuleRepository
().
deleteAll
UserRules
Async
()
dialog
.
dismiss
()
},
getString
(
R
.
string
.
all_no
)
to
{
dialog
,
_
->
dialog
.
dismiss
()
...
...
app/src/main/java/com/frostnerd/smokescreen/database/dao/DnsRuleDao.kt
View file @
2059f3ae
...
...
@@ -30,8 +30,8 @@ import org.minidns.record.Record
@TypeConverters
(
DnsTypeConverter
::
class
)
interface
DnsRuleDao
{
@Query
(
"DELETE FROM DnsRule"
)
fun
deleteAll
()
@Query
(
"DELETE FROM DnsRule
WHERE importedFrom IS NULL
"
)
fun
deleteAll
UserRules
()
@Query
(
"UPDATE DnsRule SET stagingType=1 WHERE importedFrom IS NOT NULL"
)
fun
markNonUserRulesForDeletion
()
...
...
app/src/main/java/com/frostnerd/smokescreen/database/repository/DnsRuleRepository.kt
View file @
2059f3ae
...
...
@@ -27,9 +27,9 @@ import kotlinx.coroutines.launch
*/
class
DnsRuleRepository
(
val
dnsRuleDao
:
DnsRuleDao
)
{
fun
deleteAllAsync
(
coroutineScope
:
CoroutineScope
=
GlobalScope
)
{
fun
deleteAll
UserRules
Async
(
coroutineScope
:
CoroutineScope
=
GlobalScope
)
{
coroutineScope
.
launch
{
dnsRuleDao
.
deleteAll
()
dnsRuleDao
.
deleteAll
UserRules
()
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment