forked from geode-sdk/android-launcher
figure out how to update (almost) everything
This commit is contained in:
15 files changed
+62
-83
No files matched your search
+16
-18
@@ -1,5 +1,3 @@
|
||||
val composeBOM: String by rootProject.extra
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
extraWarnings.set(true)
|
||||
@@ -13,7 +11,7 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = 36
|
||||
compileSdk = 37
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.geode.launcher"
|
||||
@@ -80,8 +78,8 @@ android {
|
||||
// enables a polyfill for java Instant on api levels < 26 (used for updater)
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
@@ -103,28 +101,28 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation (platform("androidx.compose:compose-bom:$composeBOM"))
|
||||
implementation ("androidx.core:core-ktx:1.18.0")
|
||||
implementation (platform("androidx.compose:compose-bom:2026.08.00"))
|
||||
implementation ("androidx.core:core-ktx:1.19.0")
|
||||
implementation ("androidx.compose.ui:ui")
|
||||
implementation ("androidx.compose.material3:material3")
|
||||
implementation ("androidx.compose.ui:ui-tooling-preview")
|
||||
implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.10.0")
|
||||
implementation ("androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0")
|
||||
implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.11.0")
|
||||
implementation ("androidx.lifecycle:lifecycle-viewmodel-compose:2.11.0")
|
||||
implementation ("androidx.activity:activity-compose:1.13.0")
|
||||
implementation ("androidx.activity:activity-ktx:1.13.0")
|
||||
implementation ("androidx.appcompat:appcompat:1.7.1")
|
||||
implementation ("androidx.appcompat:appcompat:1.8.0")
|
||||
implementation ("androidx.documentfile:documentfile:1.1.0")
|
||||
|
||||
implementation ("com.squareup.okio:okio:3.17.0")
|
||||
implementation ("com.squareup.okhttp3:okhttp:5.3.2")
|
||||
implementation ("com.squareup.okhttp3:okhttp-coroutines:5.3.2")
|
||||
implementation ("com.squareup.okio:okio:3.18.2")
|
||||
implementation ("com.squareup.okhttp3:okhttp:5.5.0")
|
||||
implementation ("com.squareup.okhttp3:okhttp-coroutines:5.5.0")
|
||||
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0")
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json-okio:1.10.0")
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1")
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0")
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json-okio:1.11.0")
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-datetime:0.8.0")
|
||||
|
||||
implementation ("com.mikepenz:multiplatform-markdown-renderer-android:0.39.2")
|
||||
implementation ("com.mikepenz:multiplatform-markdown-renderer-m3:0.39.2")
|
||||
implementation ("com.mikepenz:multiplatform-markdown-renderer-android:0.45.0")
|
||||
implementation ("com.mikepenz:multiplatform-markdown-renderer-m3:0.45.0")
|
||||
implementation ("androidx.browser:browser:1.10.0")
|
||||
debugImplementation ("androidx.compose.ui:ui-tooling")
|
||||
coreLibraryDesugaring ("com.android.tools:desugar_jdk_libs:2.1.5")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user