From a2f6816527856d7314226af0ec755507cdaceb87 Mon Sep 17 00:00:00 2001 From: Rajesh Ramsaroop Date: Thu, 15 Aug 2024 11:49:02 -0400 Subject: [PATCH 1/2] rename com.example packages to live.ditto --- .../ditto}/dittodiskusage/Constants.kt | 2 +- .../ditto}/dittodiskusage/DiskUsage.kt | 3 +-- .../ditto}/dittodiskusage/DiskUsageState.kt | 2 +- .../ditto}/dittodiskusage/DiskUsageView.kt | 3 +-- .../dittodiskusage/DiskUsageViewModel.kt | 8 ++++---- .../ditto}/dittodiskusage/DittoDiskUsage.kt | 3 +-- .../ditto}/dittodiskusage/DittoHandler.kt | 2 +- .../usecase/GetDiskUsageMetrics.kt | 18 +++++++++--------- 8 files changed, 19 insertions(+), 22 deletions(-) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/Constants.kt (87%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/DiskUsage.kt (92%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/DiskUsageState.kt (88%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/DiskUsageView.kt (98%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/DiskUsageViewModel.kt (89%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/DittoDiskUsage.kt (90%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/DittoHandler.kt (81%) rename DittoDiskUsage/src/main/java/{com/example => live/ditto}/dittodiskusage/usecase/GetDiskUsageMetrics.kt (77%) diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/Constants.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/Constants.kt similarity index 87% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/Constants.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/Constants.kt index ce327c9..67ee9cd 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/Constants.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/Constants.kt @@ -1,4 +1,4 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage const val ROOT_PATH = "rootPath" const val TOTAL_SIZE = "totalSize" diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsage.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsage.kt similarity index 92% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsage.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsage.kt index 9e0804d..8b60217 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsage.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsage.kt @@ -1,10 +1,9 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.remember import androidx.lifecycle.viewmodel.compose.viewModel -import androidx.navigation.NavHostController /** * Wrapper composable function for `DiskUsageView`. diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageState.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageState.kt similarity index 88% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageState.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageState.kt index 185cd35..92b543c 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageState.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageState.kt @@ -1,4 +1,4 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage data class DiskUsageState( val rootPath: String = "ditto", diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageView.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageView.kt similarity index 98% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageView.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageView.kt index 27f474e..bc31f7d 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageView.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageView.kt @@ -1,4 +1,4 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column @@ -32,7 +32,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import live.ditto.Ditto -import live.ditto.dittodiskusage.R import live.ditto.exporter.ExportDialog import java.io.File diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageViewModel.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageViewModel.kt similarity index 89% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageViewModel.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageViewModel.kt index e991de4..bd77f66 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DiskUsageViewModel.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DiskUsageViewModel.kt @@ -1,7 +1,7 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage import androidx.lifecycle.ViewModel -import com.example.dittodiskusage.usecase.GetDiskUsageMetrics +import live.ditto.dittodiskusage.usecase.GetDiskUsageMetrics import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow @@ -27,8 +27,8 @@ class DiskUsageViewModel( /* Private mutable state */ private val _uiState = MutableStateFlow(DiskUsageState()) - /// The size over which disk usage is considered unhealthy when used as a `HealthMetric` with the heartbeat tool (this only considers `ditto_store` and `ditto_replication`). Defaults to 500MB - var unhealthySizeInBytes: Int = FIVE_HUNDRED_MEGABYTES_IN_BYTES + // The size over which disk usage is considered unhealthy when used as a `HealthMetric` with the heartbeat tool (this only considers `ditto_store` and `ditto_replication`). Defaults to 500MB + private var unhealthySizeInBytes: Int = FIVE_HUNDRED_MEGABYTES_IN_BYTES set(value) { field = value getDiskUsageMetrics.unhealthySizeInBytes = value diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DittoDiskUsage.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DittoDiskUsage.kt similarity index 90% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/DittoDiskUsage.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DittoDiskUsage.kt index f93be79..65ec78f 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DittoDiskUsage.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DittoDiskUsage.kt @@ -1,9 +1,8 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.runtime.Composable -import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DittoHandler.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DittoHandler.kt similarity index 81% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/DittoHandler.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DittoHandler.kt index 2ac15ad..77a863b 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/DittoHandler.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/DittoHandler.kt @@ -1,4 +1,4 @@ -package com.example.dittodiskusage +package live.ditto.dittodiskusage import android.app.Application import live.ditto.Ditto diff --git a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/usecase/GetDiskUsageMetrics.kt b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/usecase/GetDiskUsageMetrics.kt similarity index 77% rename from DittoDiskUsage/src/main/java/com/example/dittodiskusage/usecase/GetDiskUsageMetrics.kt rename to DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/usecase/GetDiskUsageMetrics.kt index 2feb692..7afd1ef 100644 --- a/DittoDiskUsage/src/main/java/com/example/dittodiskusage/usecase/GetDiskUsageMetrics.kt +++ b/DittoDiskUsage/src/main/java/live/ditto/dittodiskusage/usecase/GetDiskUsageMetrics.kt @@ -1,12 +1,12 @@ -package com.example.dittodiskusage.usecase - -import com.example.dittodiskusage.DITTO_REPLICATION -import com.example.dittodiskusage.DITTO_STORE -import com.example.dittodiskusage.DiskUsageState -import com.example.dittodiskusage.METRIC_NAME -import com.example.dittodiskusage.ROOT_PATH -import com.example.dittodiskusage.TOTAL_SIZE -import com.example.dittodiskusage.FIVE_HUNDRED_MEGABYTES_IN_BYTES +package live.ditto.dittodiskusage.usecase + +import live.ditto.dittodiskusage.DITTO_REPLICATION +import live.ditto.dittodiskusage.DITTO_STORE +import live.ditto.dittodiskusage.DiskUsageState +import live.ditto.dittodiskusage.METRIC_NAME +import live.ditto.dittodiskusage.ROOT_PATH +import live.ditto.dittodiskusage.TOTAL_SIZE +import live.ditto.dittodiskusage.FIVE_HUNDRED_MEGABYTES_IN_BYTES import live.ditto.healthmetrics.HealthMetric class GetDiskUsageMetrics() { From 2e86a1c37b36d76c1698a118cef8da16810c78ac Mon Sep 17 00:00:00 2001 From: Rajesh Ramsaroop Date: Thu, 15 Aug 2024 13:47:52 -0400 Subject: [PATCH 2/2] update to latest compose bom for compatiblity, fix references to disk usage --- .../presencedegradationreporter/components/PeersForm.kt | 7 +++---- .../dittotoolsviewer/presentation/DittoToolsViewer.kt | 0 .../main/java/live/ditto/dittotoolsapp/HeartbeatView.kt | 2 +- app/src/main/java/live/ditto/dittotoolsapp/MainActivity.kt | 2 +- gradle/libs.versions.toml | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) create mode 100644 DittoToolsViewer/src/main/java/live/ditto/dittotoolsviewer/presentation/DittoToolsViewer.kt diff --git a/DittoPresenceDegradationReporter/src/main/java/live/ditto/presencedegradationreporter/components/PeersForm.kt b/DittoPresenceDegradationReporter/src/main/java/live/ditto/presencedegradationreporter/components/PeersForm.kt index 4221bc9..4267d91 100644 --- a/DittoPresenceDegradationReporter/src/main/java/live/ditto/presencedegradationreporter/components/PeersForm.kt +++ b/DittoPresenceDegradationReporter/src/main/java/live/ditto/presencedegradationreporter/components/PeersForm.kt @@ -9,12 +9,12 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Checkbox -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text import androidx.compose.material3.TextField import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -27,14 +27,13 @@ import androidx.compose.ui.unit.dp import live.ditto.presencedegradationreporter.R import live.ditto.presencedegradationreporter.theme.PresenceDegradationReporterTheme -@OptIn(ExperimentalMaterial3Api::class) @Composable fun PeersForm( expectedPeers: Int, reportApiEnabled: Boolean, onSave: (expectedPeers: Int, reportApiEnabled: Boolean) -> Unit ) { - var peers by remember(expectedPeers) { mutableStateOf(expectedPeers) } + var peers by remember(expectedPeers) { mutableIntStateOf(expectedPeers) } var apiEnabled by remember(reportApiEnabled) { mutableStateOf(reportApiEnabled) } var isError by remember { mutableStateOf(false) } @@ -96,7 +95,7 @@ private fun PeersFormPreview() { PeersForm( expectedPeers = 1, reportApiEnabled = true, - onSave = { a, b -> } + onSave = { _, _ -> } ) } } diff --git a/DittoToolsViewer/src/main/java/live/ditto/dittotoolsviewer/presentation/DittoToolsViewer.kt b/DittoToolsViewer/src/main/java/live/ditto/dittotoolsviewer/presentation/DittoToolsViewer.kt new file mode 100644 index 0000000..e69de29 diff --git a/app/src/main/java/live/ditto/dittotoolsapp/HeartbeatView.kt b/app/src/main/java/live/ditto/dittotoolsapp/HeartbeatView.kt index 0a19188..37097c8 100644 --- a/app/src/main/java/live/ditto/dittotoolsapp/HeartbeatView.kt +++ b/app/src/main/java/live/ditto/dittotoolsapp/HeartbeatView.kt @@ -10,11 +10,11 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp -import com.example.dittodiskusage.DiskUsageViewModel import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import live.ditto.Ditto +import live.ditto.dittodiskusage.DiskUsageViewModel import live.ditto.healthmetrics.HealthMetricProvider import live.ditto.dittoheartbeat.DittoHeartbeatConfig import live.ditto.dittoheartbeat.DittoHeartbeatInfo diff --git a/app/src/main/java/live/ditto/dittotoolsapp/MainActivity.kt b/app/src/main/java/live/ditto/dittotoolsapp/MainActivity.kt index 7f2c4a4..3ab6fbb 100644 --- a/app/src/main/java/live/ditto/dittotoolsapp/MainActivity.kt +++ b/app/src/main/java/live/ditto/dittotoolsapp/MainActivity.kt @@ -27,7 +27,6 @@ import androidx.compose.ui.unit.dp import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController -import com.example.dittodiskusage.DittoDiskUsage import ditto.live.dittopresenceviewer.DittoPresenceViewer import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -37,6 +36,7 @@ import live.ditto.DittoLogLevel import live.ditto.DittoLogger import live.ditto.android.DefaultAndroidDittoDependencies import live.ditto.dittodatabrowser.DittoDataBrowser +import live.ditto.dittodiskusage.DittoDiskUsage import live.ditto.dittotoolsapp.ui.theme.DittoToolsAppTheme import live.ditto.health.HealthScreen import live.ditto.presencedegradationreporter.PresenceDegradationReporterScreen diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c3a99e7..1eac118 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ android-gradle-plugin = "7.3.0" androidx-activity = "1.7.1" androidx-appcompat = "1.6.1" -androidx-compose = "2023.03.00" +androidx-compose = "2024.06.00" androidx-navigation = "2.5.3" androidx-test-ext = "1.1.5" androidx-webkit = "1.7.0"