package com.hyperling.weather /** * Platform-agnostic location storage abstraction. */ object LocationStorage { /** * Load all saved locations. */ fun load(): List = getStorage().load() /** * Save all locations (replaces existing). */ fun save(locations: List) = getStorage().save(locations) /** * Save a single location, merging with existing list. */ fun saveOne(location: LocationEntry) = getStorage().saveOne(location) /** * Delete a location by id. */ fun delete(id: Long) = getStorage().delete(id) expect fun getStorage(): StorageBackend } interface StorageBackend { fun load(): List fun save(locations: List) fun saveOne(location: LocationEntry) fun delete(id: Long) } expect fun getPlatformStorage(): StorageBackend