Skip to content

Commit

Permalink
Merge pull request #113 from getditto/rr/update-disk-usage-package
Browse files Browse the repository at this point in the history
Update Disk Usage package name
  • Loading branch information
rajramsaroop authored Aug 16, 2024
2 parents de868da + 2e86a1c commit d6b9373
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.dittodiskusage
package live.ditto.dittodiskusage

const val ROOT_PATH = "rootPath"
const val TOTAL_SIZE = "totalSize"
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.dittodiskusage
package live.ditto.dittodiskusage

data class DiskUsageState(
val rootPath: String = "ditto",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.dittodiskusage
package live.ditto.dittodiskusage

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.dittodiskusage
package live.ditto.dittodiskusage

import android.app.Application
import live.ditto.Ditto
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) }

Expand Down Expand Up @@ -96,7 +95,7 @@ private fun PeersFormPreview() {
PeersForm(
expectedPeers = 1,
reportApiEnabled = true,
onSave = { a, b -> }
onSave = { _, _ -> }
)
}
}
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/live/ditto/dittotoolsapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit d6b9373

Please sign in to comment.