Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
android:allowBackup="true"
Expand Down
2 changes: 1 addition & 1 deletion FloconDesktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
alias(libs.plugins.composeHotReload) apply false
// alias(libs.plugins.composeHotReload) apply false
alias(libs.plugins.composeMultiplatform) apply false
alias(libs.plugins.composeCompiler) apply false
alias(libs.plugins.kotlinJvm) apply false
Expand Down
3 changes: 2 additions & 1 deletion FloconDesktop/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.composeMultiplatform)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.composeHotReload)
// alias(libs.plugins.composeHotReload)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.ksp) // Add KSP plugin
alias(libs.plugins.room)
Expand All @@ -30,6 +30,7 @@ kotlin {
freeCompilerArgs.add("-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi")
freeCompilerArgs.add("-Xcontext-parameters")
freeCompilerArgs.add("-Xcontext-sensitive-resolution")
freeCompilerArgs.add("-Xdata-flow-based-exhaustiveness")
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import io.github.openflocon.flocondesktop.app.AppScreen
import io.github.openflocon.flocondesktop.app.di.appModule
import io.github.openflocon.flocondesktop.common.di.commonModule
import io.github.openflocon.flocondesktop.core.di.coreModule
import io.github.openflocon.flocondesktop.device.deviceModule
import io.github.openflocon.flocondesktop.features.featuresModule
import io.github.openflocon.flocondesktop.features.network.NetworkRoutes
import io.github.openflocon.library.designsystem.FloconTheme
Expand All @@ -43,6 +44,7 @@ fun App() {
dataCoreModule,
dataLocalModule,
dataRemoteModule,
deviceModule,
// Temporary
module {
// scope<MainRoutes.Sub> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ internal sealed interface AppAction {
data object Restart : AppAction

data object Screenshoot : AppAction

data class DeviceDetail(val item: DeviceItemUiModel) : AppAction

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.navigation3.scene.SinglePaneSceneStrategy
import io.github.openflocon.flocondesktop.app.ui.settings.settingsRoutes
import io.github.openflocon.flocondesktop.app.ui.view.leftpannel.LeftPanelView
import io.github.openflocon.flocondesktop.app.ui.view.topbar.MainScreenTopBar
import io.github.openflocon.flocondesktop.device.deviceRoutes
import io.github.openflocon.flocondesktop.app.version.VersionCheckerView
import io.github.openflocon.flocondesktop.common.ui.feedback.FeedbackDisplayerView
import io.github.openflocon.flocondesktop.features.analytics.analyticsRoutes
Expand Down Expand Up @@ -79,7 +80,8 @@ private fun Content(
onAppSelected = { onAction(AppAction.SelectApp(it)) },
onRecordClicked = { onAction(AppAction.Record) },
onRestartClicked = { onAction(AppAction.Restart) },
onTakeScreenshotClicked = { onAction(AppAction.Screenshoot) }
onTakeScreenshotClicked = { onAction(AppAction.Screenshoot) },
onClickDetail = { onAction(AppAction.DeviceDetail(it)) }
)
}
)
Expand All @@ -100,5 +102,6 @@ private fun Content(
tableRoutes()
settingsRoutes()
crashReporterRoutes()
deviceRoutes()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import io.github.openflocon.flocondesktop.app.ui.model.SubScreen
import io.github.openflocon.flocondesktop.app.ui.model.leftpanel.buildMenu
import io.github.openflocon.flocondesktop.app.ui.settings.SettingsRoutes
import io.github.openflocon.flocondesktop.common.utils.stateInWhileSubscribed
import io.github.openflocon.flocondesktop.device.DeviceRoutes
import io.github.openflocon.flocondesktop.features.analytics.AnalyticsRoutes
import io.github.openflocon.flocondesktop.features.crashreporter.CrashReporterRoutes
import io.github.openflocon.flocondesktop.features.dashboard.DashboardRoutes
Expand Down Expand Up @@ -112,9 +113,14 @@ internal class AppViewModel(
AppAction.Screenshoot -> onTakeScreenshot()
is AppAction.SelectApp -> onAppSelected(action)
is AppAction.SelectDevice -> onDeviceSelected(action)
is AppAction.DeviceDetail -> onDeviceDetail(action)
}
}

private fun onDeviceDetail(action: AppAction.DeviceDetail) {
navigationState.navigate(DeviceRoutes.Detail(action.item.id))
}

private fun onSelectMenu(action: AppAction.SelectMenu) {
contentState.update { it.copy(current = action.menu) }
navigationState.menu(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ private fun SettingsScreen(
}
}
FloconSection(
title = stringResource(Res.string.settings_font_size_multiplier, uiState.fontSizeMultiplier),
title = stringResource(
Res.string.settings_font_size_multiplier,
uiState.fontSizeMultiplier
),
initialValue = true
) {
Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.github.openflocon.library.designsystem.FloconTheme
import org.jetbrains.compose.ui.tooling.preview.Preview

@Composable
fun PanelView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import io.github.openflocon.flocondesktop.app.ui.view.topbar.actions.TopBarActio
import io.github.openflocon.library.designsystem.FloconTheme
import org.jetbrains.compose.resources.painterResource

val TopBarHeight = 48.dp

@Composable
fun MainScreenTopBar(
modifier: Modifier = Modifier,
Expand All @@ -41,6 +43,7 @@ fun MainScreenTopBar(
recordState: RecordVideoStateUiModel,
onRecordClicked: () -> Unit,
onRestartClicked: () -> Unit,
onClickDetail: (DeviceItemUiModel) -> Unit,
) {
Row(
modifier = modifier
Expand All @@ -57,6 +60,7 @@ fun MainScreenTopBar(
onAppSelected = onAppSelected,
deleteDevice = deleteDevice,
deleteApp = deleteApp,
onClickDetail = onClickDetail
)
Spacer(modifier = Modifier.weight(1f))
TopBarActions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package io.github.openflocon.flocondesktop.app.ui.view.topbar
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -26,6 +27,7 @@ internal fun TopBarDeviceAndAppView(
deleteDevice: (DeviceItemUiModel) -> Unit,
onAppSelected: (DeviceAppUiModel) -> Unit,
deleteApp: (DeviceAppUiModel) -> Unit,
onClickDetail: (DeviceItemUiModel) -> Unit,
modifier: Modifier = Modifier,
) {
Row(
Expand All @@ -37,6 +39,8 @@ internal fun TopBarDeviceAndAppView(
state = devicesState,
onDeviceSelected = onDeviceSelected,
deleteDevice = deleteDevice,
onClickDetail = onClickDetail,
modifier = Modifier.height(TopBarHeight)
)

AnimatedVisibility(devicesState is DevicesStateUiModel.WithDevices) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package io.github.openflocon.flocondesktop.app.ui.view.topbar.device
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExposedDropdownMenuAnchorType
import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand All @@ -29,6 +29,7 @@ internal fun TopBarDeviceDropdown(
state: DevicesStateUiModel,
onDeviceSelected: (DeviceItemUiModel) -> Unit,
deleteDevice: (DeviceItemUiModel) -> Unit,
onClickDetail: (DeviceItemUiModel) -> Unit,
modifier: Modifier = Modifier,
) {
var expanded by remember { mutableStateOf(false) }
Expand All @@ -51,7 +52,9 @@ internal fun TopBarDeviceDropdown(
) {
TopBarDeviceView(
device = state.deviceSelected,
modifier = Modifier.menuAnchor(MenuAnchorType.PrimaryNotEditable),
onClick = { expanded = true },
onClickDetail = { onClickDetail(state.deviceSelected) },
modifier = Modifier.menuAnchor(ExposedDropdownMenuAnchorType.PrimaryNotEditable),
)
}
}
Expand All @@ -72,6 +75,7 @@ internal fun TopBarDeviceDropdown(
onDeviceSelected(device)
expanded = false
},
onClickDetail = { onClickDetail(device) },
onDelete = {
deleteDevice(device)
expanded = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DesktopAccessDisabled
import androidx.compose.material.icons.filled.DesktopWindows
import androidx.compose.material.icons.filled.MobileOff
import androidx.compose.material.icons.filled.PhoneIphone
import androidx.compose.material.icons.filled.Smartphone
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.Details
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.MobileOff
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -38,14 +39,17 @@ import flocondesktop.composeapp.generated.resources.devices_disconnected
import io.github.openflocon.flocondesktop.app.ui.model.DeviceItemUiModel
import io.github.openflocon.library.designsystem.FloconTheme
import io.github.openflocon.library.designsystem.components.FloconIcon
import io.github.openflocon.library.designsystem.components.FloconIconButton
import io.github.openflocon.library.designsystem.components.FloconSurface
import io.github.openflocon.library.designsystem.components.FloconVerticalDivider
import org.jetbrains.compose.resources.stringResource

@Composable
internal fun TopBarDeviceView(
device: DeviceItemUiModel,
modifier: Modifier = Modifier,
onClick: (() -> Unit)? = null,
onClickDetail: (() -> Unit)? = null,
selected: Boolean = false,
onDelete: (() -> Unit)? = null,
) {
Expand All @@ -57,7 +61,7 @@ internal fun TopBarDeviceView(
else
Modifier
)
.padding(horizontal = 8.dp, 4.dp),
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
Expand Down Expand Up @@ -101,6 +105,7 @@ internal fun TopBarDeviceView(
}

Row(
horizontalArrangement = Arrangement.spacedBy(4.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Column(
Expand All @@ -125,15 +130,23 @@ internal fun TopBarDeviceView(
),
)
}
FloconVerticalDivider(color = FloconTheme.colorPalette.secondary)
FloconIconButton(
onClick = { onClickDetail?.invoke() }
) {
FloconIcon(
imageVector = Icons.Outlined.Info
)
}
if (!selected && onDelete != null) {
FloconVerticalDivider(color = FloconTheme.colorPalette.secondary)
Spacer(modifier = Modifier.weight(1f))
Box(
Modifier.clip(RoundedCornerShape(4.dp))
.background(
Color.White.copy(alpha = 0.8f)
).padding(2.dp).clickable {
onDelete()
},
Modifier
.clip(FloconTheme.shapes.small)
.background(Color.White.copy(alpha = 0.8f))
.padding(2.dp)
.clickable(onClick = onDelete),
contentAlignment = Alignment.Center,
) {
FloconIcon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.openflocon.flocondesktop.common.ui.window
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.FrameWindowScope

interface FloconWindowState

Expand All @@ -18,5 +19,5 @@ expect fun FloconWindow(
state: FloconWindowState,
onCloseRequest: () -> Unit,
alwaysOnTop: Boolean = false,
content: @Composable () -> Unit
content: @Composable FrameWindowScope.() -> Unit,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.github.openflocon.flocondesktop.device

import io.github.openflocon.flocondesktop.device.pages.battery.BatteryViewModel
import io.github.openflocon.flocondesktop.device.pages.cpu.CpuViewModel
import io.github.openflocon.flocondesktop.device.pages.info.InfoViewModel
import io.github.openflocon.flocondesktop.device.pages.memory.MemoryViewModel
import io.github.openflocon.flocondesktop.device.pages.permission.PermissionViewModel
import org.koin.core.module.dsl.viewModelOf
import org.koin.dsl.module

internal val deviceModule = module {
viewModelOf(::DeviceViewModel)
viewModelOf(::PermissionViewModel)
viewModelOf(::CpuViewModel)
viewModelOf(::BatteryViewModel)
viewModelOf(::InfoViewModel)
viewModelOf(::MemoryViewModel)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.github.openflocon.flocondesktop.device

internal sealed interface DeviceAction {

data class SelectTab(val selected: DeviceTab) : DeviceAction

}
Loading