Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ package io.github.stozo04.openloop.data

import kotlinx.coroutines.flow.Flow

/**
* Contract for reading and writing user preferences.
*
* Backed by Jetpack DataStore (Preferences). The ViewModel depends on
* this interface — never on the implementation — so tests can swap in
* a fake without touching the real DataStore.
*/
/** Contract for reading and writing user preferences (onboarding, flags, saved-loop count). */
interface UserPreferencesRepository {

/** Emits `true` once the user has completed the onboarding carousel. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@ val Context.dataStore: DataStore<Preferences> by preferencesDataStore(
name = "openloop_preferences"
)

/**
* Production implementation of [UserPreferencesRepository].
*
* Reads are exposed as [Flow] (never blocking). Writes use [DataStore.edit]
* which is atomic and transactional. IOException is caught on reads and
* falls back to safe defaults (e.g. show onboarding again).
*/
/** Production implementation of [UserPreferencesRepository]. */
class UserPreferencesRepositoryImpl(
private val dataStore: DataStore<Preferences>
) : UserPreferencesRepository {
Expand All @@ -36,10 +30,6 @@ class UserPreferencesRepositoryImpl(
val HAS_COMPLETED_ONBOARDING = booleanPreferencesKey("has_completed_onboarding")
val HAS_SEEN_SPEED_CURVE_INTRO = booleanPreferencesKey("has_seen_speed_curve_intro")
val SAVED_LOOP_COUNT = intPreferencesKey("saved_loop_count")
// Future keys:
// val CAPTURE_DURATION_MS = longPreferencesKey("capture_duration_ms")
// val DEFAULT_PLAYBACK_SPEED = floatPreferencesKey("default_playback_speed")
// val AUDIO_ENABLED = booleanPreferencesKey("audio_enabled")
}

override val hasCompletedOnboarding: Flow<Boolean> = dataStore.data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ internal class FirebaseAnalyticsReporterImpl(
is Long -> putLong(key, value)
is Int -> putLong(key, value.toLong())
is Double -> putDouble(key, value)
is Float -> putDouble(key, value.toDouble())
is Boolean -> putBoolean(key, value)
else -> Log.w(TAG, "logEvent($name) dropped param '$key' of type ${value::class.simpleName}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ class BaselineProfileGenerator {
@Test
fun generate() = baselineProfileRule.collect(
packageName = "io.github.stozo04.openloop",
// Check if there are other critical paths like Camera or Video Editor
includeInStartupProfile = true
) {
// This block defines the interactions to be profiled.
// For a basic profile, just starting the app is often enough,
// but we can add more interactions here.
pressHome()
startActivityAndWait()
}
Expand Down
Loading