Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1b6edb8 authored by Ellen Poe's avatar Ellen Poe
Browse files

Merge branch 'ellenhp/opening_hours' into 'main'

Opening hours

See merge request e/os/cardinal!37
parents bb7afca4 ac415251
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ dependencies {
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(libs.openinghoursparser)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.compose.ui)
    implementation(libs.androidx.compose.ui.graphics)
+3 −1
Original line number Diff line number Diff line
@@ -459,6 +459,7 @@ class LocationRepository @Inject constructor(
    }

    fun createSearchResultPlace(result: GeocodeResult): Place {
        val openingHours = result.properties["opening_hours"]
        return Place(
            name = result.displayName,
            description = mapOsmTagsToDescription(result.properties),
@@ -467,7 +468,8 @@ class LocationRepository @Inject constructor(
                latitude = result.latitude,
                longitude = result.longitude,
            ),
            address = result.address
            address = result.address,
            openingHours = openingHours,
        )
    }

+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ data class Place(
    val icon: String = "place",
    val latLng: LatLng,
    val address: Address? = null,
    val openingHours: String? = null,
    val isMyLocation: Boolean = false,
    val isTransitStop: Boolean = false,
    val transitStopId: String? = null,
+10 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import earth.maps.cardinal.data.DownloadStatusConverter

@Database(
    entities = [OfflineArea::class, RoutingProfile::class, DownloadedTile::class, SavedList::class, SavedPlace::class, ListItem::class, RecentSearch::class],
    version = 11,
    version = 12,
    exportSchema = false
)
@TypeConverters(TileTypeConverter::class, DownloadStatusConverter::class, ItemTypeConverter::class)
@@ -216,6 +216,14 @@ abstract class AppDatabase : RoomDatabase() {
            }
        }

        private val MIGRATION_11_12 = object : Migration(11, 12) {
            override fun migrate(db: SupportSQLiteDatabase) {
                db.execSQL(
                    "ALTER TABLE saved_places ADD COLUMN openingHours TEXT"
                )
            }
        }

        fun getDatabase(context: Context): AppDatabase {
            return INSTANCE ?: synchronized(this) {
                val instance = Room.databaseBuilder(
@@ -230,6 +238,7 @@ abstract class AppDatabase : RoomDatabase() {
                    MIGRATION_8_9,
                    MIGRATION_9_10,
                    MIGRATION_10_11,
                    MIGRATION_11_12,
                ).build()
                INSTANCE = instance
                instance
+3 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ data class SavedPlace(
    val postcode: String? = null,
    val country: String? = null,
    val countryCode: String? = null,
    // Misc fields
    val openingHours: String? = null,
    val isTransitStop: Boolean = false,
    val transitStopId: String? = null,
    val createdAt: Long,
@@ -70,6 +72,7 @@ data class SavedPlace(
                postcode = place.address?.postcode,
                country = place.address?.country,
                countryCode = place.address?.countryCode,
                openingHours = place.openingHours,
                isTransitStop = place.isTransitStop,
                transitStopId = place.transitStopId,
                createdAt = timestamp,
Loading