Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
ad808044
Commit
ad808044
authored
Apr 19, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up usage of rx subscribers
parent
2d556324
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
SuperuserViewModel.kt
...a/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
+9
-13
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt
View file @
ad808044
...
@@ -5,6 +5,7 @@ import android.content.res.Resources
...
@@ -5,6 +5,7 @@ import android.content.res.Resources
import
com.skoumal.teanity.databinding.ComparableRvItem
import
com.skoumal.teanity.databinding.ComparableRvItem
import
com.skoumal.teanity.extensions.addOnPropertyChangedCallback
import
com.skoumal.teanity.extensions.addOnPropertyChangedCallback
import
com.skoumal.teanity.extensions.applySchedulers
import
com.skoumal.teanity.extensions.applySchedulers
import
com.skoumal.teanity.extensions.subscribeK
import
com.skoumal.teanity.util.DiffObservableList
import
com.skoumal.teanity.util.DiffObservableList
import
com.skoumal.teanity.viewevents.SnackbarEvent
import
com.skoumal.teanity.viewevents.SnackbarEvent
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BR
...
@@ -19,7 +20,6 @@ import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog
...
@@ -19,7 +20,6 @@ import com.topjohnwu.magisk.view.dialogs.CustomAlertDialog
import
com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog
import
com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog
import
io.reactivex.Single
import
io.reactivex.Single
import
me.tatarka.bindingcollectionadapter2.ItemBinding
import
me.tatarka.bindingcollectionadapter2.ItemBinding
import
timber.log.Timber
class
SuperuserViewModel
(
class
SuperuserViewModel
(
private
val
database
:
MagiskDB
,
private
val
database
:
MagiskDB
,
...
@@ -46,17 +46,13 @@ class SuperuserViewModel(
...
@@ -46,17 +46,13 @@ class SuperuserViewModel(
.
toList
()
.
toList
()
.
applySchedulers
()
.
applySchedulers
()
.
applyViewModel
(
this
)
.
applyViewModel
(
this
)
.
subscribe
({
.
subscribeK
{
items
.
update
(
it
)
}
items
.
update
(
it
)
},
Timber
::
e
)
.
add
()
.
add
()
}
}
fun
deletePressed
(
item
:
PolicyRvItem
)
{
fun
deletePressed
(
item
:
PolicyRvItem
)
{
fun
updateState
()
=
deletePolicy
(
item
.
item
)
fun
updateState
()
=
deletePolicy
(
item
.
item
)
.
subscribe
({
.
subscribeK
{
items
.
remove
(
item
)
}
items
.
remove
(
item
)
},
Timber
::
e
)
.
add
()
.
add
()
withView
{
withView
{
...
@@ -88,11 +84,11 @@ class SuperuserViewModel(
...
@@ -88,11 +84,11 @@ class SuperuserViewModel(
updatePolicy
(
item
)
updatePolicy
(
item
)
.
map
{
it
.
policy
==
Policy
.
ALLOW
}
.
map
{
it
.
policy
==
Policy
.
ALLOW
}
.
subscribe
(
{
.
subscribe
K
{
val
textId
=
if
(
it
)
R
.
string
.
su_snack_grant
else
R
.
string
.
su_snack_deny
val
textId
=
if
(
it
)
R
.
string
.
su_snack_grant
else
R
.
string
.
su_snack_deny
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
appName
)
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
appName
)
SnackbarEvent
(
text
).
publish
()
SnackbarEvent
(
text
).
publish
()
}
,
Timber
::
e
)
}
.
add
()
.
add
()
}
}
...
@@ -113,11 +109,11 @@ class SuperuserViewModel(
...
@@ -113,11 +109,11 @@ class SuperuserViewModel(
updatePolicy
(
item
)
updatePolicy
(
item
)
.
map
{
it
.
notification
}
.
map
{
it
.
notification
}
.
subscribe
(
{
.
subscribe
K
{
val
textId
=
if
(
it
)
R
.
string
.
su_snack_notif_on
else
R
.
string
.
su_snack_notif_off
val
textId
=
if
(
it
)
R
.
string
.
su_snack_notif_on
else
R
.
string
.
su_snack_notif_off
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
appName
)
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
appName
)
SnackbarEvent
(
text
).
publish
()
SnackbarEvent
(
text
).
publish
()
}
,
Timber
::
e
)
}
.
add
()
.
add
()
}
}
shouldLog
.
addOnPropertyChangedCallback
{
shouldLog
.
addOnPropertyChangedCallback
{
...
@@ -126,11 +122,11 @@ class SuperuserViewModel(
...
@@ -126,11 +122,11 @@ class SuperuserViewModel(
updatePolicy
(
item
)
updatePolicy
(
item
)
.
map
{
it
.
logging
}
.
map
{
it
.
logging
}
.
subscribe
(
{
.
subscribe
K
{
val
textId
=
if
(
it
)
R
.
string
.
su_snack_log_on
else
R
.
string
.
su_snack_log_off
val
textId
=
if
(
it
)
R
.
string
.
su_snack_log_on
else
R
.
string
.
su_snack_log_off
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
appName
)
val
text
=
resources
.
getString
(
textId
).
format
(
item
.
appName
)
SnackbarEvent
(
text
).
publish
()
SnackbarEvent
(
text
).
publish
()
}
,
Timber
::
e
)
}
.
add
()
.
add
()
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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