fix(android): partial compile fixes for ChronoMind Android
- Fix AuthService: add MapSerializer/serializer imports, replace fully-qualified calls - Fix CMColors: add missing textPrimary and textTertiary tokens - Fix TimerWidget: add Glance clickable/ColorProvider imports, add night param - Fix SyncRepository: replace pomodoroJson with individual pomodoro fields - Note: SyncRepository still has CMTimer model drift errors (deferred)
This commit is contained in:
parent
f49ef788a2
commit
9f2325078d
@ -10,6 +10,8 @@ import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.MapSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
@ -102,10 +104,7 @@ class AuthService @Inject constructor(
|
||||
suspend fun login(email: String, password: String) {
|
||||
_state.value = AuthState.Loading
|
||||
val body = json.encodeToString(
|
||||
kotlinx.serialization.builtins.MapSerializer(
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
),
|
||||
MapSerializer(String.serializer(), String.serializer()),
|
||||
mapOf("email" to email, "password" to password, "productId" to PRODUCT_ID),
|
||||
)
|
||||
val result = postAuth("/auth/login", body)
|
||||
@ -119,10 +118,7 @@ class AuthService @Inject constructor(
|
||||
suspend fun register(name: String, email: String, password: String) {
|
||||
_state.value = AuthState.Loading
|
||||
val body = json.encodeToString(
|
||||
kotlinx.serialization.builtins.MapSerializer(
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
),
|
||||
MapSerializer(String.serializer(), String.serializer()),
|
||||
mapOf(
|
||||
"email" to email,
|
||||
"displayName" to name,
|
||||
@ -158,10 +154,7 @@ class AuthService @Inject constructor(
|
||||
val baseUrl = getBaseUrl()
|
||||
|
||||
val body = json.encodeToString(
|
||||
kotlinx.serialization.builtins.MapSerializer(
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
),
|
||||
MapSerializer(String.serializer(), String.serializer()),
|
||||
mapOf("refreshToken" to rt),
|
||||
)
|
||||
|
||||
@ -200,10 +193,7 @@ class AuthService @Inject constructor(
|
||||
suspend fun forgotPassword(email: String): String? = withContext(Dispatchers.IO) {
|
||||
val baseUrl = getBaseUrl()
|
||||
val body = json.encodeToString(
|
||||
kotlinx.serialization.builtins.MapSerializer(
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
),
|
||||
MapSerializer(String.serializer(), String.serializer()),
|
||||
mapOf("email" to email, "productId" to PRODUCT_ID),
|
||||
)
|
||||
try {
|
||||
@ -229,10 +219,7 @@ class AuthService @Inject constructor(
|
||||
val token = prefs.getString(KEY_ACCESS_TOKEN, null) ?: return@withContext "Not authenticated"
|
||||
val baseUrl = getBaseUrl()
|
||||
val body = json.encodeToString(
|
||||
kotlinx.serialization.builtins.MapSerializer(
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
),
|
||||
MapSerializer(String.serializer(), String.serializer()),
|
||||
mapOf("currentPassword" to currentPassword, "newPassword" to newPassword),
|
||||
)
|
||||
try {
|
||||
@ -262,10 +249,7 @@ class AuthService @Inject constructor(
|
||||
val token = prefs.getString(KEY_ACCESS_TOKEN, null) ?: return@withContext "Not authenticated"
|
||||
val baseUrl = getBaseUrl()
|
||||
val body = json.encodeToString(
|
||||
kotlinx.serialization.builtins.MapSerializer(
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
kotlinx.serialization.builtins.serializer<String>(),
|
||||
),
|
||||
MapSerializer(String.serializer(), String.serializer()),
|
||||
mapOf("password" to password),
|
||||
)
|
||||
try {
|
||||
|
||||
@ -223,11 +223,17 @@ class SyncRepository @Inject constructor(
|
||||
completedAt = dto.completedAt?.let { parseIso(it) },
|
||||
cascadePreset = dto.cascade?.preset,
|
||||
cascadeIntervalsJson = dto.cascade?.intervals?.let { json.encodeToString(it) },
|
||||
pomodoroJson = dto.pomodoro?.let { json.encodeToString(it) },
|
||||
warningsJson = null,
|
||||
pomodoroWorkMinutes = dto.pomodoro?.workMinutes,
|
||||
pomodoroBreakMinutes = dto.pomodoro?.breakMinutes,
|
||||
pomodoroLongBreakMinutes = dto.pomodoro?.longBreakMinutes,
|
||||
pomodoroRounds = dto.pomodoro?.rounds,
|
||||
pomodoroCurrentRound = dto.pomodoro?.currentRound,
|
||||
pomodoroIsBreak = dto.pomodoro?.isBreak,
|
||||
pomodoroIsLongBreak = dto.pomodoro?.isLongBreak,
|
||||
pomodoroCompletedRounds = dto.pomodoro?.totalRoundsCompleted,
|
||||
warningsJson = "",
|
||||
isCalendarSync = dto.isCalendarSync,
|
||||
calendarEventId = null,
|
||||
category = dto.category
|
||||
calendarEventId = null
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,9 @@ object CMColors {
|
||||
val surfaceHover = Color(0xFF1E1E2E)
|
||||
val border = Color(0xFF2A2A3A)
|
||||
val text = Color(0xFFEEEEFF)
|
||||
val textPrimary = Color(0xFFEEEEFF)
|
||||
val textSecondary = Color(0xFFAAAACC)
|
||||
val textTertiary = Color(0xFF888899)
|
||||
val textMuted = Color(0xFF666688)
|
||||
val accent = Color(0xFF6C5CE7)
|
||||
val accentSecondary = Color(0xFF00D2FF)
|
||||
|
||||
@ -7,9 +7,11 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.glance.*
|
||||
import androidx.glance.action.actionStartActivity
|
||||
import androidx.glance.action.clickable
|
||||
import androidx.glance.appwidget.GlanceAppWidget
|
||||
import androidx.glance.appwidget.GlanceAppWidgetReceiver
|
||||
import androidx.glance.appwidget.provideContent
|
||||
import androidx.glance.color.ColorProvider
|
||||
import androidx.glance.layout.*
|
||||
import androidx.glance.text.FontWeight
|
||||
import androidx.glance.text.Text
|
||||
@ -52,7 +54,7 @@ private fun SmallTimerContent() {
|
||||
Text(
|
||||
text = "No active timers",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFFAAAACC)),
|
||||
color = ColorProvider(day = Color(0xFFAAAACC), night = Color(0xFFAAAACC)),
|
||||
fontSize = 12.sp
|
||||
)
|
||||
)
|
||||
@ -86,7 +88,7 @@ private fun MediumTimerContent() {
|
||||
Text(
|
||||
text = "ChronoMind",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFFEEEEFF)),
|
||||
color = ColorProvider(day = Color(0xFFEEEEFF), night = Color(0xFFEEEEFF)),
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
@ -95,7 +97,7 @@ private fun MediumTimerContent() {
|
||||
Text(
|
||||
text = "No active timers",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFF666688)),
|
||||
color = ColorProvider(day = Color(0xFF666688), night = Color(0xFF666688)),
|
||||
fontSize = 12.sp
|
||||
)
|
||||
)
|
||||
@ -103,7 +105,7 @@ private fun MediumTimerContent() {
|
||||
Text(
|
||||
text = "Tap to create one",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFF6C5CE7)),
|
||||
color = ColorProvider(day = Color(0xFF6C5CE7), night = Color(0xFF6C5CE7)),
|
||||
fontSize = 11.sp
|
||||
)
|
||||
)
|
||||
@ -137,7 +139,7 @@ private fun LargeTimerContent() {
|
||||
Text(
|
||||
text = "ChronoMind",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFFEEEEFF)),
|
||||
color = ColorProvider(day = Color(0xFFEEEEFF), night = Color(0xFFEEEEFF)),
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
@ -146,7 +148,7 @@ private fun LargeTimerContent() {
|
||||
Text(
|
||||
text = "Timeline",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFF6C5CE7)),
|
||||
color = ColorProvider(day = Color(0xFF6C5CE7), night = Color(0xFF6C5CE7)),
|
||||
fontSize = 12.sp
|
||||
)
|
||||
)
|
||||
@ -163,7 +165,7 @@ private fun LargeTimerContent() {
|
||||
Text(
|
||||
text = "No active timers",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFF666688)),
|
||||
color = ColorProvider(day = Color(0xFF666688), night = Color(0xFF666688)),
|
||||
fontSize = 14.sp
|
||||
)
|
||||
)
|
||||
@ -171,7 +173,7 @@ private fun LargeTimerContent() {
|
||||
Text(
|
||||
text = "Tap to open ChronoMind",
|
||||
style = TextStyle(
|
||||
color = ColorProvider(Color(0xFF6C5CE7)),
|
||||
color = ColorProvider(day = Color(0xFF6C5CE7), night = Color(0xFF6C5CE7)),
|
||||
fontSize = 12.sp
|
||||
)
|
||||
)
|
||||
|
||||
29
android/app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
29
android/app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<!-- Clock circle -->
|
||||
<path
|
||||
android:fillColor="#5B8DEF"
|
||||
android:pathData="M54,54m-28,0a28,28 0,1 1,56 0a28,28 0,1 1,-56 0"/>
|
||||
<!-- Clock face -->
|
||||
<path
|
||||
android:fillColor="#1A1A2E"
|
||||
android:pathData="M54,54m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0"/>
|
||||
<!-- Hour hand -->
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:strokeWidth="0"
|
||||
android:pathData="M53,54L53,40L55,40L55,54Z"/>
|
||||
<!-- Minute hand -->
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:strokeWidth="0"
|
||||
android:pathData="M54,53L68,53L68,55L54,55Z"/>
|
||||
<!-- Center dot -->
|
||||
<path
|
||||
android:fillColor="#5B8DEF"
|
||||
android:pathData="M54,54m-3,0a3,3 0,1 1,6 0a3,3 0,1 1,-6 0"/>
|
||||
</vector>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#1A1A2E</color>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user