figure out how to update (almost) everything

This commit is contained in:
Chloe committed 2026-09-07 00:40:21 -07:00
1 parent 3b4951def1
commit eef9160970
15 files changed
+62 -83

No files matched your search

@@ -256,7 +256,7 @@ fun mapLaunchStatusToInfo(state: LaunchViewModel.LaunchUIState, inSafeMode: Bool
)
}
is LaunchViewModel.LaunchUIState.Cancelled -> {
return mapCancelReasonToInfo(state.reason)
mapCancelReasonToInfo(state.reason)
}
}
}
@@ -36,6 +36,7 @@ import com.geode.launcher.utils.GeodeUtils
import com.geode.launcher.utils.PreferenceUtils
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlin.time.Duration.Companion.milliseconds
@Composable
@@ -142,7 +143,7 @@ fun onSettings(context: Context) {
}
@Composable
fun LongPressButton(onClick: () -> Unit, onLongPress: () -> Unit, enabled: Boolean = true, modifier: Modifier = Modifier, content: @Composable RowScope.() -> Unit) {
fun LongPressButton(onClick: () -> Unit, onLongPress: () -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, content: @Composable RowScope.() -> Unit) {
// compose apis don't provide a good way of adding long press to a button
var isLongPress by remember { mutableStateOf(false) }
@@ -154,11 +155,11 @@ fun LongPressButton(onClick: () -> Unit, onLongPress: () -> Unit, enabled: Boole
interactionSource.interactions.collectLatest { interaction ->
when (interaction) {
is PressInteraction.Press -> {
delay(viewConfiguration.longPressTimeoutMillis)
delay(viewConfiguration.longPressTimeoutMillis.milliseconds)
// perform a second delay to make the action more obvious
haptics.performHapticFeedback(HapticFeedbackType.LongPress)
delay(viewConfiguration.longPressTimeoutMillis)
delay(viewConfiguration.longPressTimeoutMillis.milliseconds)
haptics.performHapticFeedback(HapticFeedbackType.LongPress)
@@ -39,6 +39,8 @@ import com.geode.launcher.utils.GamePackageUtils
import com.geode.launcher.utils.GeodeUtils
import com.geode.launcher.utils.PreferenceUtils
import kotlinx.coroutines.delay
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
enum class LaunchNotificationType {
GEODE_UPDATED, LAUNCHER_UPDATE_AVAILABLE, UPDATE_FAILED, UNSUPPORTED_VERSION, FAILED_LOAD;
@@ -87,7 +89,7 @@ fun NotificationCardFromType(type: LaunchNotificationType) {
}
AnimatedNotificationCard(
displayLength = 5000L,
displayLength = 5.seconds,
onClick = {
showInfoDialog = true
}
@@ -140,15 +142,15 @@ fun LaunchNotification(cards: List<LaunchNotificationType>) {
}
@Composable
fun AnimatedNotificationCard(modifier: Modifier = Modifier, visibilityDelay: Long = 0L, displayLength: Long = 3000L, onClick: (() -> Unit)? = null, contents: @Composable () -> Unit) {
fun AnimatedNotificationCard(modifier: Modifier = Modifier, visibilityDelay: Duration = Duration.ZERO, displayLength: Duration = 3.seconds, onClick: (() -> Unit)? = null, contents: @Composable () -> Unit) {
val state = remember {
MutableTransitionState(false).apply {
targetState = visibilityDelay <= 0
targetState = visibilityDelay <= Duration.ZERO
}
}
LaunchedEffect(true) {
if (visibilityDelay > 0) {
if (visibilityDelay > Duration.ZERO) {
delay(visibilityDelay)
state.targetState = true
}
@@ -4,7 +4,6 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageInstaller
import android.os.Build
import android.widget.Toast
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@@ -25,7 +25,6 @@ import okio.sink
import okio.source
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
import java.io.InterruptedIOException
import kotlin.math.max
import kotlin.time.Clock
@@ -8,6 +8,7 @@ import android.os.Environment
import android.provider.DocumentsContract
import android.provider.MediaStore
import java.io.File
import androidx.core.net.toUri
class FileUtils {
// copied from https://stackoverflow.com/questions/17546101/get-real-path-for-uri-android
@@ -86,7 +87,7 @@ class FileUtils {
val file = File(id)
if (file.exists()) return id
}
val contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), java.lang.Long.valueOf(id))
val contentUri = ContentUris.withAppendedId("content://downloads/public_downloads".toUri(), java.lang.Long.valueOf(id))
return getDataColumn(context, contentUri, null, null)
}
@@ -32,7 +32,6 @@ import androidx.core.net.toUri
import androidx.documentfile.provider.DocumentFile
import com.geode.launcher.BuildConfig
import com.geode.launcher.R
import com.geode.launcher.UserDirectoryProvider
import com.geode.launcher.activityresult.GeodeOpenFileActivityResult
import com.geode.launcher.activityresult.GeodeOpenFilesActivityResult
import com.geode.launcher.activityresult.GeodeSaveFileActivityResult
@@ -430,7 +429,7 @@ object GeodeUtils {
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
return permissions.all {
permissions.all {
ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
}
}
@@ -15,10 +15,6 @@ import androidx.compose.ui.res.painterResource
import androidx.core.content.res.ResourcesCompat
import androidx.core.graphics.drawable.toBitmap
import com.geode.launcher.R
import kotlinx.datetime.Month
import kotlinx.datetime.TimeZone
import kotlinx.datetime.todayIn
import kotlin.time.Clock
// https://gist.github.com/tkuenneth/ddf598663f041dc79960cda503d14448?permalink_comment_id=4660486#gistcomment-4660486
@Composable
@@ -6,17 +6,19 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import kotlinx.coroutines.delay
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
const val MS_TO_SEC = 1000L
@Composable
fun useCountdownTimer(
lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current,
time: Long,
time: Duration,
onCountdownFinish: () -> Unit
): Long {
var millisUntilFinished by remember {
mutableLongStateOf(time)
mutableStateOf(time)
}
var shouldBeCounting by remember {
@@ -28,9 +30,9 @@ fun useCountdownTimer(
return@LaunchedEffect
}
if (millisUntilFinished > 0) {
delay(MS_TO_SEC)
millisUntilFinished -= MS_TO_SEC
if (millisUntilFinished > Duration.ZERO) {
delay(1.seconds)
millisUntilFinished -= 1.seconds
} else {
onCountdownFinish()
}
@@ -58,5 +60,5 @@ fun useCountdownTimer(
}
}
return millisUntilFinished / MS_TO_SEC
return millisUntilFinished.inWholeSeconds
}