Skip to content

Commit

Permalink
chore: restore http connectivity status
Browse files Browse the repository at this point in the history
FINALLY
  • Loading branch information
abdallahmehiz committed Oct 30, 2024
1 parent 6fbf042 commit 255ef2c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
8 changes: 0 additions & 8 deletions composeApp/src/androidMain/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn com.fasterxml.jackson.dataformat.xml.JacksonXmlModule
-dontwarn com.fasterxml.jackson.dataformat.xml.XmlMapper
-dontwarn com.sun.org.apache.xml.internal.utils.PrefixResolver
Expand Down Expand Up @@ -83,13 +82,6 @@
-dontwarn org.zeroturnaround.javarebel.ClassEventListener
-dontwarn org.zeroturnaround.javarebel.Reloader
-dontwarn org.zeroturnaround.javarebel.ReloaderFactory
-dontwarn com.sun.org.apache.xpath.internal.XPathContext
-dontwarn io.ktor.utils.io.ByteReadChannelOperationsKt
-dontwarn java.beans.ConstructorProperties
-dontwarn java.beans.Transient
-dontwarn kotlinx.io.Source
-dontwarn org.apache.xpath.XPathContext
-dontwarn org.slf4j.impl.StaticMDCBinder
-if class androidx.credentials.CredentialManager
-keep class androidx.credentials.playservices.** { *; }
-keeppackagenames
Expand Down
15 changes: 9 additions & 6 deletions composeApp/src/commonMain/kotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.navigator.Navigator
import com.dokar.sonner.Toaster
import com.dokar.sonner.rememberToasterState
import com.svenjacobs.reveal.RevealCanvas
import com.svenjacobs.reveal.rememberRevealCanvasState
import dev.icerock.moko.resources.compose.stringResource
import dev.jordond.connectivity.Connectivity
import dev.jordond.connectivity.HttpConnectivityOptions
import dev.jordond.connectivity.compose.rememberConnectivityState
import mehiz.abdallah.progres.i18n.MR
import org.koin.compose.koinInject
Expand Down Expand Up @@ -60,10 +65,11 @@ fun ConnectivityStatusBar(
modifier: Modifier = Modifier,
) {
val state = rememberConnectivityState().apply { startMonitoring() }
/*
val httpConnectivity = Connectivity(
options = HttpConnectivityOptions(
urls = listOf(stringResource(MR.strings.progres_api_url)),
pollingIntervalMs = 10 * 1000,
timeoutMs = 10 * 1000
),
)
httpConnectivity.start()
Expand All @@ -73,19 +79,16 @@ fun ConnectivityStatusBar(
httpConnectivity.stop()
httpConnectivity.start()
}
*/
Box(modifier = modifier.windowInsetsPadding(WindowInsets.statusBars))
/*isHttpMonitoring &&*/
if (state.isMonitoring) {
if (isHttpMonitoring && state.isMonitoring) {
Row(
modifier
.fillMaxWidth()
.animateContentSize()
.background(MaterialTheme.colorScheme.errorContainer),
horizontalArrangement = Arrangement.Center,
) {
/* || httpStatus.isDisconnected*/
if (state.isDisconnected) {
if (state.isDisconnected || httpStatus.isDisconnected) {
Text(
stringResource(
if (state.isDisconnected) MR.strings.connectivity_no_internet else MR.strings.connectivity_no_progres,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class DataStorePreferenceStore(
}

override fun getFloat(key: String, defaultValue: Float): Preference<Float> {
return getFloat(key, defaultValue)
return FloatPrimitive(dataStore, key, defaultValue)
}

override fun getDouble(key: String, defaultValue: Double): Preference<Double> {
return DoublePrimitive(dataStore, key, defaultValue)
}

override fun getBoolean(key: String, defaultValue: Boolean): Preference<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface PreferenceStore {

fun getFloat(key: String, defaultValue: Float = 0f): Preference<Float>

fun getDouble(key: String, defaultValue: Double = 0.0): Preference<Double>

fun getBoolean(key: String, defaultValue: Boolean = false): Preference<Boolean>

fun getStringSet(key: String, defaultValue: Set<String> = emptySet()): Preference<Set<String>>
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ coil = "3.0.0-rc01"
compose-settings = "2.6.0"
buildkonfig = "0.15.2"
reveal = "3.1.1"
connectivity = "1.1.2"
connectivity = "1.1.3"
compottie = "2.0.0-rc01"
aboutlibraries = "11.2.3"

Expand Down Expand Up @@ -124,7 +124,7 @@ voyager = ["voyager-navigator", "voyager-transitions", "voyager-screenmodels", "
coil = ["coil-core", "coil-compose-core", "coil-compose", "coil-network-ktor"]
compose-settings = ["compose-settings", "compose-settings-extended"]
reveal = ["reveal-core", "reveal-shapes"]
connectivity = ["connectivity-core", "connectivity-compose", "connectivity-compose-device"]
connectivity = ["connectivity-core", "connectivity-compose", "connectivity-compose-device", "connectivity-compose-http"]
firebase = ["firebase-analytics", "firebase-crashlytics", "firebase-performance"]
aboutlibraries = ["aboutlibraries-core", "aboutlibraries-m3"]

Expand Down

0 comments on commit 255ef2c

Please sign in to comment.