Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
IBMS
/
nativeview
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6d73cc3c
authored
Feb 23, 2022
by
huangzhicong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复起始页由于storage存储线程导致的崩溃问题
parent
6b4b220c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
app/src/main/java/com/maxrocky/nativeview/fragment/StartFragment.kt
+4
-9
No files found.
app/src/main/java/com/maxrocky/nativeview/fragment/StartFragment.kt
View file @
6d73cc3c
...
...
@@ -17,7 +17,7 @@ import kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.flow.collect
import
kotlinx.coroutines.flow.map
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.
withContext
import
kotlinx.coroutines.
runBlocking
class
StartFragment
:
Fragment
()
{
companion
object
{
...
...
@@ -50,22 +50,18 @@ class StartFragment : Fragment() {
if
(
url
.
isEmpty
())
{
findNavController
().
navigate
(
R
.
id
.
action_startFragment_to_mainFragment
,
MainFragment
.
createStartBundle
(
url
)
MainFragment
.
createStartBundle
()
)
return
@setOnClickListener
}
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
storageKey
=
stringPreferencesKey
(
STORAGE_URL
)
context
?.
dataStore
?.
edit
{
it
[
storageKey
]
=
url
runBlocking
{
context
?.
dataStore
?.
edit
{
it
[
storageKey
]
=
url
}
}
withContext
(
Dispatchers
.
Main
)
{
findNavController
().
navigate
(
R
.
id
.
action_startFragment_to_mainFragment
,
MainFragment
.
createStartBundle
(
url
)
)
}
}
}
}
}
\ No newline at end of file
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