Commit 92a44089 by huangzhicong

当清空网址跳转时,清空记录的地址

parent 9072aa05
......@@ -46,15 +46,22 @@ class StartFragment : Fragment() {
}
button.setOnClickListener {
val storageKey = stringPreferencesKey(STORAGE_URL)
val url = urlEditText.text.trim().toString()
if (url.isEmpty()) {
runBlocking {
context?.dataStore?.edit {
if (it.contains(storageKey)) {
it.remove(storageKey)
}
}
}
findNavController().navigate(
R.id.action_startFragment_to_mainFragment,
MainFragment.createStartBundle()
)
return@setOnClickListener
}
val storageKey = stringPreferencesKey(STORAGE_URL)
runBlocking {
context?.dataStore?.edit { it[storageKey] = url }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment