aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-11-23 18:19:24 -0800
committerAllan Wang <me@allanwang.ca>2021-11-23 18:19:24 -0800
commitdb646e23ce0047461e68be1af7021ce6171ac850 (patch)
tree50835fa79cf15ff348be386c46cea0a05552ba74 /app/src/main
parent616237d6a2136e1f4e73d70c104a2d4ece20f5e9 (diff)
downloadfrost-db646e23ce0047461e68be1af7021ce6171ac850.tar.gz
frost-db646e23ce0047461e68be1af7021ce6171ac850.tar.bz2
frost-db646e23ce0047461e68be1af7021ce6171ac850.zip
Remove channels from frost debugger
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt7
-rw-r--r--app/src/main/play/en-US/whatsnew6
-rw-r--r--app/src/main/res/xml/frost_changelog.xml5
4 files changed, 17 insertions, 15 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
index b2bb1d11..6ba2c64d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Debug.kt
@@ -42,7 +42,7 @@ import com.pitchedapps.frost.utils.frostUriFromFile
import com.pitchedapps.frost.utils.sendFrostEmail
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
-import kotlinx.coroutines.channels.Channel
+import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.launch
import java.io.File
@@ -71,6 +71,7 @@ fun SettingsActivity.getDebugPrefs(): KPrefAdapterBuilder.() -> Unit = {
val parsers = arrayOf(NotifParser, MessageParser, SearchParser)
materialDialog {
+ // noinspection CheckResult
listItems(items = parsers.map { string(it.nameRes) }) { dialog, position, _ ->
dialog.dismiss()
val parser = parsers[position]
@@ -133,20 +134,15 @@ fun SettingsActivity.sendDebug(url: String, html: String?) {
onDismiss { job.cancel() }
}
- val progressChannel = Channel<Int>(10)
+ val progressFlow = MutableStateFlow(0)
- launchMain {
- for (p in progressChannel) {
-// md.setProgress(p)
- }
- }
+// progressFlow.onEach { md.setProgress(it) }.launchIn(this)
launchMain {
val success = downloader.loadAndZip(ZIP_NAME) {
- progressChannel.offer(it)
+ progressFlow.tryEmit(it)
}
md.dismiss()
- progressChannel.close()
if (success) {
val zipUri = frostUriFromFile(
File(downloader.baseDir, "$ZIP_NAME.zip")
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
index c77ae590..16c28c02 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
@@ -44,8 +44,8 @@ import com.pitchedapps.frost.web.FrostEmitter
import com.pitchedapps.frost.web.asFrostEmitter
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.BufferOverflow
-import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow
@@ -58,6 +58,7 @@ import kotlinx.coroutines.flow.runningFold
import kotlinx.coroutines.flow.transformWhile
import javax.inject.Inject
+@ExperimentalCoroutinesApi
class FrostContentWeb @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@@ -68,6 +69,7 @@ class FrostContentWeb @JvmOverloads constructor(
override val layoutRes: Int = R.layout.view_content_base_web
}
+@ExperimentalCoroutinesApi
class FrostContentRecycler @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@@ -78,6 +80,7 @@ class FrostContentRecycler @JvmOverloads constructor(
override val layoutRes: Int = R.layout.view_content_base_recycler
}
+@ExperimentalCoroutinesApi
abstract class FrostContentView<out T> @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@@ -96,6 +99,7 @@ abstract class FrostContentView<out T> @JvmOverloads constructor(
* Subsection of [FrostContentView] that is [AndroidEntryPoint] friendly (no generics)
*/
@AndroidEntryPoint
+@ExperimentalCoroutinesApi
abstract class FrostContentViewBase(
context: Context,
attrs: AttributeSet?,
@@ -239,7 +243,6 @@ abstract class FrostContentViewBase(
}
private var transitionStart: Long = -1
- private var refreshReceiver: ReceiveChannel<Boolean>? = null
/**
* Hook onto the refresh observable for one cycle
diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew
index 7ca9e6af..eb46a757 100644
--- a/app/src/main/play/en-US/whatsnew
+++ b/app/src/main/play/en-US/whatsnew
@@ -1,5 +1,3 @@
-v3.1.2
+v3.2.0
-* Fix loading full size images
-* Fix menu tab
-* Always load messenger internally \ No newline at end of file
+* Improve loading process \ No newline at end of file
diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml
index b3227a6e..2bdfef82 100644
--- a/app/src/main/res/xml/frost_changelog.xml
+++ b/app/src/main/res/xml/frost_changelog.xml
@@ -6,6 +6,11 @@
<item text="" />
-->
+ <version title="v3.2.0" />
+ <item text="Improve loading process" />
+ <item text="" />
+ <item text="" />
+
<version title="v3.1.2" />
<item text="Fix loading full size images" />
<item text="Fix menu tab" />