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
be9b0c2e
Commit
be9b0c2e
authored
Nov 12, 2021
by
LoveSy
Committed by
John Wu
Nov 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move flow.concurrentMap to ktx
parent
b6affe06
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
XFlow.kt
app/src/main/java/com/topjohnwu/magisk/ktx/XFlow.kt
+13
-0
DenyListViewModel.kt
...in/java/com/topjohnwu/magisk/ui/deny/DenyListViewModel.kt
+2
-8
No files found.
app/src/main/java/com/topjohnwu/magisk/ktx/XFlow.kt
0 → 100644
View file @
be9b0c2e
package
com.topjohnwu.magisk.ktx
import
kotlinx.coroutines.FlowPreview
import
kotlinx.coroutines.flow.Flow
import
kotlinx.coroutines.flow.flatMapMerge
import
kotlinx.coroutines.flow.flow
@FlowPreview
inline
fun
<
T
,
R
>
Flow
<
T
>.
concurrentMap
(
crossinline
transform
:
suspend
(
T
)
->
R
):
Flow
<
R
>
{
return
flatMapMerge
{
value
->
flow
{
emit
(
transform
(
value
))
}
}
}
app/src/main/java/com/topjohnwu/magisk/ui/deny/DenyListViewModel.kt
View file @
be9b0c2e
...
...
@@ -9,6 +9,7 @@ import com.topjohnwu.magisk.arch.Queryable
import
com.topjohnwu.magisk.databinding.filterableListOf
import
com.topjohnwu.magisk.databinding.itemBindingOf
import
com.topjohnwu.magisk.di.AppContext
import
com.topjohnwu.magisk.ktx.concurrentMap
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.*
...
...
@@ -16,6 +17,7 @@ import kotlinx.coroutines.flow.*
import
java.util.*
import
kotlin.collections.ArrayList
@FlowPreview
class
DenyListViewModel
:
BaseViewModel
(),
Queryable
{
override
val
queryDelay
=
0L
...
...
@@ -46,14 +48,6 @@ class DenyListViewModel : BaseViewModel(), Queryable {
it
.
bindExtra
(
BR
.
viewModel
,
this
)
}
@FlowPreview
private
inline
fun
<
T
,
R
>
Flow
<
T
>.
concurrentMap
(
crossinline
transform
:
suspend
(
T
)
->
R
):
Flow
<
R
>
{
return
flatMapMerge
{
value
->
flow
{
emit
(
transform
(
value
))
}
}
}
@FlowPreview
@SuppressLint
(
"InlinedApi"
)
override
fun
refresh
()
=
viewModelScope
.
launch
{
if
(!
Utils
.
showSuperUser
())
{
...
...
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