Skip to content

Commit

Permalink
Fixing crash on switch screen. (#56)
Browse files Browse the repository at this point in the history
- Needed to use serializer.
- Fixes #55
  • Loading branch information
dessalines authored Jan 27, 2025
1 parent e6f9541 commit 3301d9c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import java.io.Serializable

@Entity(
foreignKeys = [
Expand All @@ -35,7 +36,7 @@ data class Encouragement(
name = "content",
)
val content: String,
)
) : Serializable

@Entity
data class EncouragementInsert(
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/dessalines/habitmaker/db/Habit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.room.Query
import androidx.room.Update
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import java.io.Serializable

@Entity(
indices = [
Expand Down Expand Up @@ -93,7 +94,7 @@ data class Habit(
defaultValue = "0",
)
val lastCompletedTime: Long,
)
) : Serializable

@Entity
data class HabitInsert(
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/dessalines/habitmaker/db/HabitCheck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import kotlinx.coroutines.flow.Flow
import java.io.Serializable

@Entity(
foreignKeys = [
Expand All @@ -36,7 +37,7 @@ data class HabitCheck(
name = "check_time",
)
val checkTime: Long,
)
) : Serializable

@Entity
data class HabitCheckInsert(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.dessalines.habitmaker.db
import androidx.annotation.Keep
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.room.ColumnInfo
Expand All @@ -10,6 +11,7 @@ import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.PrimaryKey
import androidx.room.Query
import java.io.Serializable
import java.time.DayOfWeek
import java.time.LocalTime

Expand All @@ -24,6 +26,7 @@ import java.time.LocalTime
],
indices = [Index(value = ["habit_id", "time", "day"], unique = true)],
)
@Keep
data class HabitReminder(
@PrimaryKey(autoGenerate = true) val id: Int,
@ColumnInfo(
Expand All @@ -38,7 +41,7 @@ data class HabitReminder(
name = "day",
)
val day: DayOfWeek,
)
) : Serializable

@Entity
data class HabitReminderInsert(
Expand Down

0 comments on commit 3301d9c

Please sign in to comment.