aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/utils
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-11-23 11:58:30 -0800
committerAllan Wang <me@allanwang.ca>2021-11-23 11:58:30 -0800
commite8d9dca1ede1295f67e27faf731a5caa1bd2810a (patch)
treea500c321ee411fc0107221971d29cb659d6d61c1 /app/src/main/kotlin/com/pitchedapps/frost/utils
parent0c97abd838ee834ef17d1b2e746fa26ea9663bd5 (diff)
downloadfrost-e8d9dca1ede1295f67e27faf731a5caa1bd2810a.tar.gz
frost-e8d9dca1ede1295f67e27faf731a5caa1bd2810a.tar.bz2
frost-e8d9dca1ede1295f67e27faf731a5caa1bd2810a.zip
Convert login refresh channel to flow and remove some outdated tests
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/KotlinUtils.kt36
1 files changed, 0 insertions, 36 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/KotlinUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/KotlinUtils.kt
deleted file mode 100644
index f4357c9b..00000000
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/KotlinUtils.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2018 Allan Wang
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.pitchedapps.frost.utils
-
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.channels.ReceiveChannel
-import kotlinx.coroutines.channels.produce
-import kotlinx.coroutines.isActive
-
-@UseExperimental(ExperimentalCoroutinesApi::class)
-fun <T> ReceiveChannel<T>.uniqueOnly(scope: CoroutineScope): ReceiveChannel<T> = scope.produce {
- var previous: T? = null
- for (current in this@uniqueOnly) {
- if (!scope.isActive) {
- cancel()
- } else if (previous != current) {
- previous = current
- send(current)
- }
- }
-}