mirror of
https://github.com/Monkopedia/rouse-context.git
synced 2026-12-04 05:13:18 +00:00
Replace fully qualified names with imports across production code
Audit of production Kotlin sources for inline `java.*`, `kotlinx.*`, `io.ktor.*`, and `android.*` FQNs. Replaced with proper imports in: - core/mcp: McpRouting.kt (RoutingCall, JsonArray, JsonElement, JsonPrimitive, URI, UUID), AuthorizationCodeManager.kt (URI, UUID), McpSession.kt (EmbeddedServer) - outreach: OutreachMcpProvider.kt (JsonArray, PackageManager) - usage: UsageMcpProvider.kt (JsonArray) - work: IdleTimeoutManager.kt (StateFlow) - app: AppModule.kt (Context, PowerManager), MainActivity.kt (Color), RouseContextApp.kt (Color), AppNavigation.kt (Uri), FileCertificateStore.kt (Base64), MtlsWebSocketFactory.kt (Base64) No behavior change. ktlintFormat applied. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6776aa2905
commit
a2be40e67f
12 changed files with 77 additions and 63 deletions
|
|
@ -2,6 +2,7 @@ package com.rousecontext.app
|
|||
|
||||
import android.animation.AnimatorSet
|
||||
import android.animation.ObjectAnimator
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.activity.ComponentActivity
|
||||
|
|
@ -30,7 +31,7 @@ class MainActivity : ComponentActivity() {
|
|||
// Navy status bar in both themes = always white icons
|
||||
enableEdgeToEdge(
|
||||
statusBarStyle = SystemBarStyle.dark(
|
||||
android.graphics.Color.parseColor("#0F1A30")
|
||||
Color.parseColor("#0F1A30")
|
||||
)
|
||||
)
|
||||
super.onCreate(savedInstanceState)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.security.KeyStore
|
|||
import java.security.MessageDigest
|
||||
import java.security.cert.CertificateFactory
|
||||
import java.security.cert.X509Certificate
|
||||
import java.util.Base64
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.KeyGenerator
|
||||
import javax.crypto.SecretKey
|
||||
|
|
@ -161,7 +162,7 @@ class FileCertificateStore(private val context: Context) : CertificateStore {
|
|||
val cert = factory.generateCertificate(der.inputStream())
|
||||
pemBuilder.append("-----BEGIN CERTIFICATE-----\n")
|
||||
pemBuilder.append(
|
||||
java.util.Base64.getMimeEncoder(LINE_LENGTH, "\n".toByteArray())
|
||||
Base64.getMimeEncoder(LINE_LENGTH, "\n".toByteArray())
|
||||
.encodeToString(cert.encoded)
|
||||
)
|
||||
pemBuilder.append("\n-----END CERTIFICATE-----\n")
|
||||
|
|
@ -260,7 +261,7 @@ class FileCertificateStore(private val context: Context) : CertificateStore {
|
|||
)
|
||||
for (match in regex.findAll(pem)) {
|
||||
val base64 = match.groupValues[1].replace("\\s".toRegex(), "")
|
||||
val der = java.util.Base64.getDecoder().decode(base64)
|
||||
val der = Base64.getDecoder().decode(base64)
|
||||
val cert = factory.generateCertificate(der.inputStream()) as X509Certificate
|
||||
certs.add(cert)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import java.security.PrivateKey
|
|||
import java.security.cert.CertificateFactory
|
||||
import java.security.cert.X509Certificate
|
||||
import java.security.spec.PKCS8EncodedKeySpec
|
||||
import java.util.Base64
|
||||
import java.util.concurrent.TimeUnit
|
||||
import javax.crypto.Cipher
|
||||
import javax.crypto.SecretKey
|
||||
|
|
@ -244,7 +245,7 @@ object MtlsWebSocketFactory {
|
|||
.replace("-----END EC PRIVATE KEY-----", "")
|
||||
.replace("\\s".toRegex(), "")
|
||||
return try {
|
||||
val der = java.util.Base64.getDecoder().decode(base64)
|
||||
val der = Base64.getDecoder().decode(base64)
|
||||
val spec = PKCS8EncodedKeySpec(der)
|
||||
try {
|
||||
KeyFactory.getInstance("EC").generatePrivate(spec)
|
||||
|
|
@ -266,7 +267,7 @@ object MtlsWebSocketFactory {
|
|||
)
|
||||
for (match in regex.findAll(pem)) {
|
||||
val base64 = match.groupValues[1].replace("\\s".toRegex(), "")
|
||||
val der = java.util.Base64.getDecoder().decode(base64)
|
||||
val der = Base64.getDecoder().decode(base64)
|
||||
val cert = factory.generateCertificate(der.inputStream()) as X509Certificate
|
||||
certs.add(cert)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.rousecontext.app.di
|
||||
|
||||
import android.content.Context
|
||||
import android.os.PowerManager
|
||||
import com.rousecontext.api.IntegrationStateStore
|
||||
import com.rousecontext.api.LaunchRequestNotifierApi
|
||||
import com.rousecontext.api.McpIntegration
|
||||
|
|
@ -323,7 +325,7 @@ val appModule = module {
|
|||
securityAlertCheck = {
|
||||
val prefs = androidContext().getSharedPreferences(
|
||||
com.rousecontext.work.SecurityCheckWorker.PREFS_NAME,
|
||||
android.content.Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE
|
||||
)
|
||||
val self = prefs.getString(
|
||||
com.rousecontext.work.SecurityCheckWorker.KEY_SELF_CERT_RESULT,
|
||||
|
|
@ -371,7 +373,7 @@ val appModule = module {
|
|||
single {
|
||||
val pm = androidContext().getSystemService(android.os.PowerManager::class.java)
|
||||
val wakeLock = pm.newWakeLock(
|
||||
android.os.PowerManager.PARTIAL_WAKE_LOCK,
|
||||
PowerManager.PARTIAL_WAKE_LOCK,
|
||||
"rousecontext:tunnel"
|
||||
)
|
||||
WakelockManager(RealWakeLockHandle(wakeLock))
|
||||
|
|
@ -396,11 +398,11 @@ val appModule = module {
|
|||
viewModel {
|
||||
val certRenewalPrefs = androidContext().getSharedPreferences(
|
||||
com.rousecontext.work.CertRenewalWorker.PREFS_NAME,
|
||||
android.content.Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE
|
||||
)
|
||||
val spuriousWakePrefs = androidContext().getSharedPreferences(
|
||||
SharedPreferencesSpuriousWakeRecorder.PREFS_NAME,
|
||||
android.content.Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE
|
||||
)
|
||||
val refresher: NotificationPermissionRefresher = get()
|
||||
MainDashboardViewModel(
|
||||
|
|
@ -424,7 +426,7 @@ val appModule = module {
|
|||
viewModel {
|
||||
val spuriousWakePrefs = androidContext().getSharedPreferences(
|
||||
SharedPreferencesSpuriousWakeRecorder.PREFS_NAME,
|
||||
android.content.Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE
|
||||
)
|
||||
SettingsViewModel(
|
||||
notificationSettingsProvider = get(),
|
||||
|
|
@ -434,11 +436,11 @@ val appModule = module {
|
|||
integrations = get(),
|
||||
securityCheckPrefs = androidContext().getSharedPreferences(
|
||||
com.rousecontext.work.SecurityCheckWorker.PREFS_NAME,
|
||||
android.content.Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE
|
||||
),
|
||||
settingsPrefs = androidContext().getSharedPreferences(
|
||||
com.rousecontext.app.RouseApplication.PREFS_NAME,
|
||||
android.content.Context.MODE_PRIVATE
|
||||
Context.MODE_PRIVATE
|
||||
),
|
||||
spuriousWakesFlow = SettingsViewModel.spuriousWakeStatsFlow(spuriousWakePrefs)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.rousecontext.app.ui.navigation
|
|||
import android.Manifest
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
|
|
@ -1144,7 +1145,7 @@ fun AppNavigation(
|
|||
val ctx = navController.context
|
||||
val intent = Intent(
|
||||
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||
android.net.Uri.parse("package:${ctx.packageName}")
|
||||
Uri.parse("package:${ctx.packageName}")
|
||||
).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.rousecontext.app.ui.navigation
|
||||
|
||||
import android.graphics.Color
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
|
|
@ -34,9 +35,9 @@ fun RouseContextApp(startDestination: String = Routes.HOME) {
|
|||
val activity = LocalContext.current as? ComponentActivity
|
||||
// Navy bars in both themes = always white system icons
|
||||
val systemBarColor = if (isDark) {
|
||||
android.graphics.Color.parseColor("#060D18")
|
||||
Color.parseColor("#060D18")
|
||||
} else {
|
||||
android.graphics.Color.parseColor("#0F1A30")
|
||||
Color.parseColor("#0F1A30")
|
||||
}
|
||||
androidx.compose.runtime.SideEffect {
|
||||
activity?.enableEdgeToEdge(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.rousecontext.mcp.core
|
||||
|
||||
import java.net.URI
|
||||
import java.security.MessageDigest
|
||||
import java.security.SecureRandom
|
||||
import java.util.Base64
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
|
@ -143,7 +145,7 @@ class AuthorizationCodeManager(
|
|||
) {
|
||||
for (uri in redirectUris) {
|
||||
val scheme = try {
|
||||
java.net.URI(uri).scheme?.lowercase()
|
||||
URI(uri).scheme?.lowercase()
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
|
@ -179,7 +181,7 @@ class AuthorizationCodeManager(
|
|||
"redirect_uri not registered for this client"
|
||||
}
|
||||
|
||||
val requestId = java.util.UUID.randomUUID().toString()
|
||||
val requestId = UUID.randomUUID().toString()
|
||||
val displayCode = generateDisplayCode()
|
||||
val now = clock.currentTimeMillis()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import io.ktor.server.request.receiveParameters
|
|||
import io.ktor.server.request.receiveText
|
||||
import io.ktor.server.response.respond
|
||||
import io.ktor.server.response.respondText
|
||||
import io.ktor.server.routing.RoutingCall
|
||||
import io.ktor.server.routing.get
|
||||
import io.ktor.server.routing.post
|
||||
import io.ktor.server.routing.routing
|
||||
|
|
@ -21,11 +22,16 @@ import io.modelcontextprotocol.kotlin.sdk.types.Implementation
|
|||
import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCMessage
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.ServerCapabilities
|
||||
import io.modelcontextprotocol.kotlin.sdk.types.TextContent
|
||||
import java.net.URI
|
||||
import java.util.UUID
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
import kotlinx.serialization.json.JsonNull
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlinx.serialization.json.jsonArray
|
||||
import kotlinx.serialization.json.jsonObject
|
||||
|
|
@ -83,16 +89,15 @@ fun Application.configureMcpRouting(
|
|||
// Resolve the public hostname from the request's Host header, falling back
|
||||
// to the configured hostname. This allows a single MCP session to serve
|
||||
// multiple integration hostnames correctly.
|
||||
fun io.ktor.server.routing.RoutingCall.resolveHostname(): String =
|
||||
request.headers["Host"]?.takeIf {
|
||||
it.isNotEmpty()
|
||||
} ?: hostname
|
||||
fun RoutingCall.resolveHostname(): String = request.headers["Host"]?.takeIf {
|
||||
it.isNotEmpty()
|
||||
} ?: hostname
|
||||
|
||||
// Resolve the integration name from the Host header.
|
||||
// Hostname format: {adjective}-{integration}.{subdomain}.{domain}
|
||||
// e.g. "exact-health.abc123.rousecontext.com" -> "health"
|
||||
// Falls back to the configured integration parameter.
|
||||
fun io.ktor.server.routing.RoutingCall.resolveIntegration(): String {
|
||||
fun RoutingCall.resolveIntegration(): String {
|
||||
val host = request.headers["Host"]
|
||||
?.substringBefore(":") // strip port if present
|
||||
?.takeIf { it.isNotEmpty() }
|
||||
|
|
@ -104,7 +109,7 @@ fun Application.configureMcpRouting(
|
|||
|
||||
routing {
|
||||
// Helper: if a security alert is active, block the request with 503.
|
||||
suspend fun io.ktor.server.routing.RoutingCall.rejectIfSecurityAlert(): Boolean {
|
||||
suspend fun RoutingCall.rejectIfSecurityAlert(): Boolean {
|
||||
if (securityAlertCheck?.invoke() == true) {
|
||||
respond(
|
||||
HttpStatusCode.ServiceUnavailable,
|
||||
|
|
@ -130,9 +135,9 @@ fun Application.configureMcpRouting(
|
|||
put("resource", "$baseUrl/mcp")
|
||||
put(
|
||||
"authorization_servers",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
kotlinx.serialization.json.JsonPrimitive(baseUrl)
|
||||
JsonPrimitive(baseUrl)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -197,12 +202,12 @@ fun Application.configureMcpRouting(
|
|||
val clientName = body["client_name"]?.jsonPrimitive?.content ?: "unknown"
|
||||
|
||||
// Validate redirect_uris: only http/https schemes allowed
|
||||
val rawUris = (body["redirect_uris"] as? kotlinx.serialization.json.JsonArray)
|
||||
val rawUris = (body["redirect_uris"] as? JsonArray)
|
||||
?.mapNotNull { it.jsonPrimitive.content }
|
||||
?: emptyList()
|
||||
val validUris = rawUris.filter { uri ->
|
||||
try {
|
||||
val scheme = java.net.URI(uri).scheme?.lowercase()
|
||||
val scheme = URI(uri).scheme?.lowercase()
|
||||
scheme == "http" || scheme == "https"
|
||||
} catch (_: Exception) {
|
||||
false
|
||||
|
|
@ -223,7 +228,7 @@ fun Application.configureMcpRouting(
|
|||
}
|
||||
val redirectUris = validUris
|
||||
|
||||
val clientId = java.util.UUID.randomUUID().toString()
|
||||
val clientId = UUID.randomUUID().toString()
|
||||
try {
|
||||
authorizationCodeManager.registerClient(clientId, clientName, redirectUris)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
|
|
@ -242,18 +247,18 @@ fun Application.configureMcpRouting(
|
|||
put("client_name", clientName)
|
||||
put(
|
||||
"redirect_uris",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
validUris.map { kotlinx.serialization.json.JsonPrimitive(it) }
|
||||
JsonArray(
|
||||
validUris.map { JsonPrimitive(it) }
|
||||
)
|
||||
)
|
||||
put(
|
||||
"grant_types",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
kotlinx.serialization.json.JsonPrimitive(
|
||||
JsonPrimitive(
|
||||
"authorization_code"
|
||||
),
|
||||
kotlinx.serialization.json.JsonPrimitive(
|
||||
JsonPrimitive(
|
||||
"urn:ietf:params:oauth:grant-type:device_code"
|
||||
)
|
||||
)
|
||||
|
|
@ -261,9 +266,9 @@ fun Application.configureMcpRouting(
|
|||
)
|
||||
put(
|
||||
"response_types",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
kotlinx.serialization.json.JsonPrimitive("code")
|
||||
JsonPrimitive("code")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -331,7 +336,7 @@ fun Application.configureMcpRouting(
|
|||
|
||||
// Validate redirect_uri scheme
|
||||
val uriScheme = try {
|
||||
java.net.URI(redirectUri!!).scheme?.lowercase()
|
||||
URI(redirectUri!!).scheme?.lowercase()
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
|
@ -587,7 +592,7 @@ fun Application.configureMcpRouting(
|
|||
}
|
||||
|
||||
private suspend fun respondToDeviceCodePoll(
|
||||
call: io.ktor.server.routing.RoutingCall,
|
||||
call: RoutingCall,
|
||||
deviceCodeManager: DeviceCodeManager,
|
||||
deviceCode: String
|
||||
) {
|
||||
|
|
@ -694,9 +699,7 @@ internal suspend fun dispatchJsonRpc(transport: HttpTransport, requestBody: Stri
|
|||
* Parses token request parameters from either form-encoded or JSON body.
|
||||
* Returns a simple map of parameter names to values, or null on parse failure.
|
||||
*/
|
||||
private suspend fun parseTokenRequestParams(
|
||||
call: io.ktor.server.routing.RoutingCall
|
||||
): Map<String, String?>? = try {
|
||||
private suspend fun parseTokenRequestParams(call: RoutingCall): Map<String, String?>? = try {
|
||||
if (call.request.contentType().match(ContentType.Application.FormUrlEncoded)) {
|
||||
val params = call.receiveParameters()
|
||||
params.names().associateWith { params[it] }
|
||||
|
|
@ -977,18 +980,15 @@ internal fun htmlEscapeForJs(value: String): String {
|
|||
/** Timeout for reading the MCP request body and dispatching it (30 seconds). */
|
||||
private const val MCP_REQUEST_TIMEOUT_MS = 30_000L
|
||||
|
||||
private fun jsonRpcError(
|
||||
id: kotlinx.serialization.json.JsonElement,
|
||||
code: Int,
|
||||
message: String
|
||||
): JsonObject = buildJsonObject {
|
||||
put("jsonrpc", "2.0")
|
||||
put(
|
||||
"error",
|
||||
buildJsonObject {
|
||||
put("code", code)
|
||||
put("message", message)
|
||||
}
|
||||
)
|
||||
put("id", id)
|
||||
}
|
||||
private fun jsonRpcError(id: JsonElement, code: Int, message: String): JsonObject =
|
||||
buildJsonObject {
|
||||
put("jsonrpc", "2.0")
|
||||
put(
|
||||
"error",
|
||||
buildJsonObject {
|
||||
put("code", code)
|
||||
put("message", message)
|
||||
}
|
||||
)
|
||||
put("id", id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.rousecontext.mcp.core
|
||||
|
||||
import io.ktor.server.cio.CIO
|
||||
import io.ktor.server.engine.EmbeddedServer
|
||||
import io.ktor.server.engine.embeddedServer
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ class McpSession(
|
|||
) {
|
||||
|
||||
private val done = CompletableDeferred<Unit>()
|
||||
private var engine: io.ktor.server.engine.EmbeddedServer<*, *>? = null
|
||||
private var engine: EmbeddedServer<*, *>? = null
|
||||
|
||||
/**
|
||||
* Returns the actual port the HTTP server is listening on.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import android.content.ClipboardManager
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.Settings
|
||||
|
|
@ -25,6 +26,7 @@ import io.modelcontextprotocol.kotlin.sdk.types.ToolSchema
|
|||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlinx.serialization.json.jsonArray
|
||||
|
|
@ -393,7 +395,7 @@ class OutreachMcpProvider(
|
|||
val pm = context.packageManager
|
||||
val allApps = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
pm.getInstalledApplications(
|
||||
android.content.pm.PackageManager.ApplicationInfoFlags.of(0)
|
||||
PackageManager.ApplicationInfoFlags.of(0)
|
||||
)
|
||||
} else {
|
||||
pm.getInstalledApplications(0)
|
||||
|
|
@ -713,7 +715,7 @@ private fun notificationSchema() = ToolSchema(
|
|||
)
|
||||
put(
|
||||
"enum",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
JsonPrimitive("low"),
|
||||
JsonPrimitive("default"),
|
||||
|
|
@ -764,7 +766,7 @@ private fun notificationSchema() = ToolSchema(
|
|||
)
|
||||
put(
|
||||
"required",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(JsonPrimitive("label"), JsonPrimitive("url"))
|
||||
)
|
||||
)
|
||||
|
|
@ -810,7 +812,7 @@ private fun createChannelSchema() = ToolSchema(
|
|||
)
|
||||
put(
|
||||
"enum",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
JsonPrimitive("min"),
|
||||
JsonPrimitive("low"),
|
||||
|
|
@ -865,7 +867,7 @@ private fun dndSchema() = ToolSchema(
|
|||
)
|
||||
put(
|
||||
"enum",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
JsonPrimitive("total_silence"),
|
||||
JsonPrimitive("priority_only"),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import java.time.ZoneId
|
|||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Calendar
|
||||
import java.util.TimeZone
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
|
||||
|
|
@ -583,7 +584,7 @@ private fun periodProperty() = buildJsonObject {
|
|||
)
|
||||
put(
|
||||
"enum",
|
||||
kotlinx.serialization.json.JsonArray(
|
||||
JsonArray(
|
||||
listOf(
|
||||
JsonPrimitive("today"),
|
||||
JsonPrimitive("yesterday"),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.rousecontext.tunnel.TunnelState
|
|||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +47,7 @@ class IdleTimeoutManager(
|
|||
* Collects [stateFlow] and manages the idle timer.
|
||||
* Suspends until cancelled.
|
||||
*/
|
||||
suspend fun observe(stateFlow: kotlinx.coroutines.flow.StateFlow<TunnelState>) {
|
||||
suspend fun observe(stateFlow: StateFlow<TunnelState>) {
|
||||
timeoutFired = false
|
||||
|
||||
if (batteryExempt) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue